当前位置: 代码迷 >> CGI >> arcgis 线自动构面的步骤一例
  详细解决方案

arcgis 线自动构面的步骤一例

热度:672   发布时间:2013-09-05 16:02:07.0
arcgis 线自动构面的方法一例
arcgis 线自动构面的方法一例
public class CreatePolygonTools
    {
        //自动构造面  
        public static bool AutoCompleteFromGeometries(GeometryBagClass enumGeoLines, IFeatureClass fc_polygon)
        {
            bool rbc = false;            
            IGeoDataset geoDS = fc_polygon as IGeoDataset;
            IEnvelope processingBounds = geoDS.Extent;
            IWorkspace ws = (fc_polygon as IDataset).Workspace;
            ISelectionSet selSet;
            IInvalidArea invalidArea = new InvalidAreaClass();
            //
            IFeatureConstruction pfeatBuild = new FeatureConstructionClass();
            pfeatBuild.AutoCompleteFromGeometries(fc_polygon, processingBounds, enumGeoLines, invalidArea, 0.0001, ws, out selSet);
            //
            rbc=true;
            return rbc;
        }
        //构面  从线图层
        public static bool ConstructPolygons(IFeatureClass fc_line, IFeatureClass fc_polygon)
        {
            bool rbc = false;
            ICancelOperation cancel = new CancelOperationClass();            
            //
            IFeatureCursor pLineSrc = fc_line.Search(null, false);
            IFeatureConstruction pfeatBuild = new FeatureConstructionClass();
            pfeatBuild.ConstructPolygonsFromFeaturesFromCursor(cancel, fc_polygon, null, false, false, pLineSrc, null, 0.001, null);
            //
            if (pLineSrc != null)
            {
                TokayWorkspace.ComRelease(pLineSrc);
                pLineSrc = null;
            }
            rbc = true;
            return rbc;
        }
        //构面 选中要素集
        public bool ConstructPolygonsFromFeatures(IEnumFeature pEnumFeature, IFeatureClass fc_polygon)
        {
            bool rbc = false;
            ICancelOperation cancel = new CancelOperationClass();            
            //            
            IFeatureConstruction pfeatBuild = new FeatureConstructionClass();
            pfeatBuild.ConstructPolygonsFromFeatures(cancel, fc_polygon, null, false, false, pEnumFeature, null, 0.001, null);
            //            
            rbc = true;
            return rbc;
        }

    }
    public class CancelOperationClass : ICancelOperation
    {
        private Boolean isCancelled = false;
        public Boolean IsCancelled { get { return isCancelled; } }

        public void Cancel() { isCancelled = true; }
    }

  相关解决方案