'引数 :IFeatureLayerDefinition 選択したフィーチャから作成したレイヤ '戻り値 :IEnvelope 実質のレイヤ範囲 Public Function ExtentFromSelectionSet(FeatureLayer As IFeatureLayerDefinition) As IEnvelope Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = FeatureLayer Dim pSelectionSet As ISelectionSet Set pSelectionSet = FeatureLayer.DefinitionSelectionSet '選択したフィーチャから作成したレイヤでなければ引数のFeatureLayer範囲を返す If pSelectionSet Is Nothing Then Set ExtentFromSelectionSet = pFeatureLayer.AreaOfInterest Exit Function End If Dim pEnumGeometry As IEnumGeometry Set pEnumGeometry = New EnumFeatureGeometry Dim EnumGeometryBind As IEnumGeometryBind Set EnumGeometryBind = pEnumGeometry EnumGeometryBind.BindGeometrySource Nothing, pSelectionSet Dim pGeomFactory As IGeometryFactory Set pGeomFactory = New GeometryEnvironment Dim pGeometry As IGeometry Set pGeometry = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeometry) Set ExtentFromSelectionSet = pGeometry.Envelope End Function
選択したフィーチャから作成したレイヤーの実質範囲を取得
2016/9/1 (木)