YouTube | Facebook | X(Twitter) | RSS

ServerStyle の使用方法

2016/9/1 (木)

'StyleGallery、ServerStyleGalleryはシングルトンオブジェクト
Private pStyleGallery As IStyleGallery
Private pStyleGalleryStorage As IStyleGalleryStorage
 
'ServerStyleファイルの読み込み
Private Sub Form_Load()
    'Dim m_pStyleGallery As IStyleGallery
    Set pStyleGallery = New ServerStyleGallery
     
    'Dim pStyleGalleryStorage As IStyleGalleryStorage
    Set pStyleGalleryStorage = pStyleGallery
     
     
    'Debug.Print pStyleGalleryStorage.FileCount  'ServerStyleGalleryに格納されているファイルの数
    'Debug.Print pStyleGalleryStorage.CanUpdate(pPath & "ESRI.ServerStyle")  'Updateの可否
    Debug.Print pStyleGalleryStorage.FileCount
    'Debug.Print pStyleGalleryStorage.File(0)
     
    'デフォルトスタイルパス取得
    pPath = pStyleGalleryStorage.DefaultStylePath
     
    'pStyleGalleryStorage.AddFile pPath & "Business.ServerStyle"
    'pStyleGalleryStorage.AddFile pPath & "ESRI.ServerStyle"
    'pStyleGalleryStorage.AddFile pPath & "Civic.ServerStyle"
    'pStyleGalleryStorage.RemoveFile pPath & "Crime.ServerStyle"
    'pStyleGalleryStorage.RemoveFile pPath & "ESRI.ServerStyle"
     
    Debug.Print pStyleGalleryStorage.TargetFile
     
    pStyleGalleryStorage.TargetFile = pPath & "ESRI.ServerStyle"
    pStyleGalleryStorage.TargetFile = pPath & "Civic.ServerStyle"
    pStyleGalleryStorage.TargetFile = pPath & "Business.ServerStyle"
     
    Debug.Print pStyleGalleryStorage.FileCount
 
End Sub
 
 
'取得したServerStyleファイルの適用
Private Sub Command2_Click()
    'Business.ServerStyleの"Marker Symbols"の"Arrow Up"
     
    Dim pMapControl As IMapControl2
    Set pMapControl = MapControl1.object
     
    Dim pGFLayer As IGeoFeatureLayer
    Set pGFLayer = MapControl1.Map.Layer(0)
     
    Dim pSimpleRenderer As ISimpleRenderer
    Set pSimpleRenderer = pGFLayer.Renderer
     
    Dim pItems As IEnumStyleGalleryItem
    Set pItems = pStyleGallery.Items("Marker Symbols", pPath & "Civic.ServerStyle", "Default")
     
    Dim pStyleGalleryItem As IStyleGalleryItem
    Set pStyleGalleryItem = pItems.Next
     
    Do Until pStyleGalleryItem Is Nothing
    'If pStyleGalleryItem.Name = "Arrow Up" Then
    If pStyleGalleryItem.Name = "Bell 1" Then
     
        Set pSimpleRenderer.Symbol = pStyleGalleryItem.Item
        Exit Do
    End If
    Set pStyleGalleryItem = pItems.Next
    Loop
     
    pMapControl.ActiveView.Refresh
 
End Sub

関連記事

  • この記事を書いた人

羽田 康祐

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

-プログラミング, ArcGIS
-

WINGFIELD since1981をもっと見る

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

続きを読む