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

      2017/12/09

/// <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 , ,