選択フィーチャの範囲を取得する方法

投稿日:2016/9/1 (木) 更新日:

/// <summary>
/// 選択フィーチャの範囲を取得
/// </summary>
/// <param name="FeatureLayer">FeatureLayer</param>
/// <returns>Envelope</returns>
public static IEnvelope getSelectedFeaturesExtent(IFeatureLayer FeatureLayer)
{
    IFeatureSelection pFeatureSelection = (IFeatureSelection)FeatureLayer;
 
    IEnumGeometryBind pEnumGeometryBind = new EnumFeatureGeometryClass();
    pEnumGeometryBind.BindGeometrySource(null,pFeatureSelection.SelectionSet);
 
    System.Type t = Type.GetTypeFromProgID("esriGeometry.GeometryEnvironment");
    IGeometryFactory3 pGeometryFactory = (IGeometryFactory3)Activator.CreateInst
 
    IGeometry pGeometry = pGeometryFactory.CreateGeometryFromEnumerator((IEnumGeEnumGeometryBind);
 
    return pGeometry.Envelope;
}

関連記事

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

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.