ArcObjects– tag –
-
選択(VerboseEvents)のフィーチャクラスへアクセスする方法
[vb title="VBA"] 'ThisDocumentの取得 Dim pMxDocument As IMxDocument Set pMxDocument = ThisDocument '選択レイヤの取得 Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = pMxDocument.SelectedLayer '選択レイヤのフィーチャクラスを取得 Dim pFeatureClass As IFeatureClass Set pFeatureClass = pFeatureLayer.FeatureCla... -
マップ サービス レイヤーを追加
[vb title="VBA"] Sub test() Dim pGxApplication As IGxApplication Set pGxApplication = Application Dim pMxDocument As IMxDocument Set pMxDocument = ThisDocument Dim pGxObject As IGxObject Set pGxObject = pGxApplication.SelectedObject If TypeOf pGxObject Is IGxAGSMap... -
レイヤー情報を取得
[vb title="VBA"] 'pLayerがNothingの場合、intLayerからLayerオブジェクトを取得 'pLayerが存在する場合、pLayerからレイヤ インデックス番号を返す Function FindLayerInfomation(ByVal pMap As IMap, ByRef pLayer As ILayer, ByRef intLayer As Integer) If pLayer Is Nothing Then '戻り値:pLayer pLayer = pMap.La... -
Timer イベント内での ArcObjecs 処理
Timer.Tickイベント内でArcObjects処理を行うと処理が間に合わない場合はハングアップする。その場合はフラグによって条件分岐で回避できる。 [vb title="VBA / VB6"] Private m_flag As Boolean Private Sub Timer1_Tick(...)... If m_flag = False Then m_flag = True 'ArcObjects処理 System.Windows.For... -
角度からラジアンを求める方法
[vb title="VBA"] '角度からラジアンを求める(第2引数をTrueにするとラジアンから角度を求める)※ArcObjectsを使用した場合 Private Function fncDegreeToRadian(Value As Double, Optional Reverse As Boolean = False) As Double Dim pAngleFormat As IAngleFormat Set pAngleFormat = New AngleFormat Dim pNumberForm... -
ネットワーク解析レイヤにネットワークロケーションを設定する方法
[csharp title="C#"] //クリックしたポイント IPoint pPoint = new PointClass(); pPoint.X = e.mapX; pPoint.Y = e.mapY; //NALayer INALayer pNALayer = (INALayer)axMapControl1.Map.get_Layer(0); //Stop FeatureClass IFeatureLayer pFeatureLayer = (IFeatureLayer)pNALayer.get_LayerByNAClassName("Stops"); IFeatureC... -
ジオプロセシングのスクリプトを VBA で実行する方法
[vb title="VBA"] 'ArcGIS 9.3.1 以下での実行方法 Public Sub GeoprocessorOnGPDispatch() 'Geoprocessorオブジェクトの作成 Dim gp As Object ' Set gp = WScript.CreateObject("esriGeoprocessing.GPDispatch.1") 'VBScriptで記述する場合 Set gp = CreateObject("esriGeoprocessing.GPDispatch.1"... -
GeocentricTranslation による地理座標系変換
[vb title="VBA"] 'GeocentricTranslationの作成 '3 パラメータ変換(地心変換) Public Function CreateGeoTransformationTKYJGD() As IGeoTransformation Dim pSpatialReferenceFactory As ISpatialReferenceFactory Set pSpatialReferenceFactory = New SpatialReferenceEnvironment '定数による作成 Dim pGeocentr... -
空間参照パラメーターの変更
[csharp title="C#"] //SpatialReferenceFactory オブジェクト(シングルトン)の作成 System.Type t = System.Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); ISpatialReferenceFactory srFacgtory = (ISpatialReferenceFactory)System.Activatornce(t); //パラメーターの作成 IParameter[] paramet... -
投影法の変更(座標換算)
[vb title="VBA"] Public Sub Conversion() '空間参照の作成 Dim pSpatialReferenceFactory As ISpatialReferenceFactory = New SpatialReferenceEnvironment Dim pGCS_JGD2000 As IGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem( _ CType(esriSRGeoCS3Type.esriSRGeoCS_Jap...
