Public Sub RotationRenderer()
'現在のドキュメントを取得
Dim pMxDocument As IMxDocument
Set pMxDocument = ThisDocument
'アクティブなデータフレームの取得
Dim pMap As IMap
Set pMap = pMxDocument.FocusMap
'レイヤを取得
Dim pLayer As ILayer
Set pLayer = pMap.Layer(0)
'フィーチャレイヤを取得
Dim pFeatureLayer As IGeoFeatureLayer
Set pFeatureLayer = pLayer
Dim pRotationrenderer As IRotationRenderer2
Set pRotationrenderer = pFeatureLayer.Renderer
'フィールド指定、条件式の場合
pRotationrenderer.SymbolRotation3DRotationTypeZ = esriRotateSymbolGeographic
Call pRotationrenderer.SetSymbolRotation3DFlags(esriSymbolRotation3DNone, esriSymbolRotation3DNone, esriSymbolRotation3DUseExpressionZ) 'ArcScene ArcGlobe の場合は XYZ が設定できる。ArcMap の場合は Z のみ設定
Call pRotationrenderer.SetSymbolRotation3DExpressions("", "", "") '第3引数にフィールド名、もしくは条件式を記述
'ランダムの場合
' pRotationrenderer.SymbolRotation3DRotationTypeZ = esriRotateSymbolGeographic
' Call pRotationrenderer.SetSymbolRotation3DFlags(esriSymbolRotation3DRandomZ, esriSymbolRotation3DNone, esriSymbolRotation3DNone)
' '※本来第3引数に esriSymbolRotation3DRandomZ を設定するべきだが第1引数に Z を設定しないと動作しない
' Call pRotationrenderer.SetSymbolRotation3DExpressions("", "", "")
' Call pRotationrenderer.SetSymbolRotation3DRandomRanges(0, 0, 0, 0, 0, 180)
'結果確認
Dim a(2) As Long
Dim b(2) As String
Dim c(5) As Double
'種類
Call pRotationrenderer.GetSymbolRotation3DFlags(a(0), a(1), a(2))
Debug.Print a(0), a(1), a(2)
'条件式 [] で囲むだけならフィールド指定
Call pRotationrenderer.GetSymbolRotation3DExpressions(b(0), b(1), b(2))
Debug.Print b(0), b(1), b(2)
'ランダムなレンジ
Call pRotationrenderer.GetSymbolRotation3DRandomRanges(c(0), c(1), c(2), c(3), c(4), c(5))
Debug.Print c(0), c(1), c(2), c(3), c(4), c(5)
pMxDocument.ActiveView.Refresh
End Sub
記事
