YouTube | Facebook | X(Twitter) | RSS

レンダラーによるシンボルの回転

2016/9/1 (木)

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

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS
-,

WINGFIELD since1981をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む