Public Sub subChangeSymbolFromFeature() 'ThisDocumentの取得 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 IFeatureLayer Set pFeatureLayer = pLayer 'QI Dim pFeatureClass As IFeatureClass Set pFeatureClass = pFeatureLayer.FeatureClass Dim pFeature As IFeature Set pFeature = pFeatureClass.GetFeature(0) 'レンダラの変更 Dim pGeoFeatureLayer As IGeoFeatureLayer Set pGeoFeatureLayer = pLayer 'QI Dim pUniqueValueRenderer As IUniqueValueRenderer Set pUniqueValueRenderer = pGeoFeatureLayer.Renderer 'レンダラで使用しているフィールド名の取得(複数フィールドを使用している場合) Dim sField1 As String Dim sField2 As String Dim sDeliniter As String Dim sValue As String sField1 = "num" sField2 = "Test" sDeliniter = pUniqueValueRenderer.FieldDelimiter sValue = pFeature.Value(pFeatureClass.FindField(sField1)) & sDeliniter & _ pFeature.Value(pFeatureClass.FindField(sField2)) '対象フィーチャの使用しているシンボルを取得 Dim pSimpleMarkerSymbol As ISimpleMarkerSymbol Set pSimpleMarkerSymbol = pUniqueValueRenderer.Symbol(sValue) '取得したシンボルの色を変更 Dim pRGB As IRgbColor Set pRGB = New RgbColor pRGB.RGB = vbRed pSimpleMarkerSymbol.Color = pRGB 'TOC、マップの再描画 pMxDocument.UpdateContents pMxDocument.ActiveView.Refresh End Sub
個別値分類のシンボルを特定したフィーチャから判断して更新する方法
2016/9/1 (木)