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

関連記事

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

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.