Esempio n. 1
0
        //线构面
        private static IPolygon PolylineToPolygon(ref IPolyline pPolyline)
        {
            try
            {
                //创建一个新的Polygon geometry.
                IGeometryCollection pPolygonGeometryCol = new PolygonClass();

                //克隆即将要操作的Polyline
                IClone pClone = pPolyline as IClone;

                IGeometryCollection pGeoms_Polyline = pClone.Clone() as IGeometryCollection;
                object pBObj = Type.Missing;
                object pAObj = Type.Missing;
                for (int i = 0; i < pGeoms_Polyline.GeometryCount; i++)
                {
                    //通过Polyline的每个Path创建为一个新的Ring,并把Ring增加到一个新的Polygon
                    ISegmentCollection pSegs_Ring = new RingClass();
                    pSegs_Ring.AddSegmentCollection(pGeoms_Polyline.get_Geometry(i) as ISegmentCollection);
                    pPolygonGeometryCol.AddGeometry(pSegs_Ring as IGeometry, ref pBObj, ref pAObj);
                }
                //生成的Polygon旋转的顺序可能不正确,为确保正确调用SimplifyPreserveFromTo
                IPolygon pNewPolygon = new PolygonClass();
                pNewPolygon = pPolygonGeometryCol as IPolygon;
                pNewPolygon.SimplifyPreserveFromTo();
                return(pNewPolygon);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 2
0
        //GradientFillSymbol
        private void button15_Click(object sender, EventArgs e)
        {
            IGradientFillSymbol   gradientFillSymbol = new GradientFillSymbolClass();
            IAlgorithmicColorRamp algorithcColorRamp = new AlgorithmicColorRampClass();

            algorithcColorRamp.FromColor          = getRGB(255, 0, 0);
            algorithcColorRamp.ToColor            = getRGB(0, 255, 0);
            algorithcColorRamp.Algorithm          = esriColorRampAlgorithm.esriHSVAlgorithm;
            gradientFillSymbol.ColorRamp          = algorithcColorRamp;
            gradientFillSymbol.GradientAngle      = 45;
            gradientFillSymbol.GradientPercentage = 0.9;
            gradientFillSymbol.Style = esriGradientFillStyle.esriGFSLinear;


            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(gradientFillSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 3
0
        private IPolygon polylinetoPolygon(IPolyline pPolyline)
        {
            IPointCollection pPtC;

            ESRI.ArcGIS.Geometry.IPoint pPt0, pPtn;
            ESRI.ArcGIS.Geometry.ILine  pSeg = new LineClass();

            IPolygon           polygon           = new PolygonClass();
            ISegmentCollection segmentCollection = (ISegmentCollection)pPolyline;
            int segmentCount = segmentCollection.SegmentCount;
            ISegmentCollection segmentCollection2 = (ISegmentCollection)polygon;
            object             value  = Missing.Value;
            object             value2 = Missing.Value;

            for (int i = 0; i < segmentCount; i++)
            {
                segmentCollection2.AddSegment(segmentCollection.get_Segment(i), ref value, ref value2);
            }
            if (!pPolyline.IsClosed)
            {
                pPtC            = pPolyline as IPointCollection;
                pPt0            = pPtC.get_Point(0);
                polygon.ToPoint = pPt0;
                //pPtn = pPtC.get_Point(pPtC.PointCount - 1);
                //pSeg.PutCoords(pPtn, pPt0);
                //segmentCollection2.AddSegment((ISegment)pSeg, ref value, ref value2);
            }

            polygon.SimplifyPreserveFromTo();
            return(polygon);
        }
Esempio n. 4
0
        //MultilayerFillSymbol
        private void button17_Click(object sender, EventArgs e)
        {
            IMultiLayerFillSymbol multiLayerFillSymbol = new MultiLayerFillSymbolClass();

            IGradientFillSymbol   gradientFillSymbol = new GradientFillSymbolClass();
            IAlgorithmicColorRamp algorithcColorRamp = new AlgorithmicColorRampClass();

            algorithcColorRamp.FromColor          = getRGB(255, 0, 0);
            algorithcColorRamp.ToColor            = getRGB(0, 255, 0);
            algorithcColorRamp.Algorithm          = esriColorRampAlgorithm.esriHSVAlgorithm;
            gradientFillSymbol.ColorRamp          = algorithcColorRamp;
            gradientFillSymbol.GradientAngle      = 45;
            gradientFillSymbol.GradientPercentage = 0.9;
            gradientFillSymbol.Style = esriGradientFillStyle.esriGFSLinear;

            ICartographicLineSymbol cartoLine = new CartographicLineSymbol();

            cartoLine.Cap   = esriLineCapStyle.esriLCSButt;
            cartoLine.Join  = esriLineJoinStyle.esriLJSMitre;
            cartoLine.Color = getRGB(255, 0, 0);
            cartoLine.Width = 2;
            //Create the LineFillSymbo
            ILineFillSymbol lineFill = new LineFillSymbol();

            lineFill.Angle      = 45;
            lineFill.Separation = 10;
            lineFill.Offset     = 5;
            lineFill.LineSymbol = cartoLine;


            multiLayerFillSymbol.AddLayer(gradientFillSymbol);
            multiLayerFillSymbol.AddLayer(lineFill);

            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(multiLayerFillSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 5
0
        private bool RedrawHengChuanPolygon(TunnelHChuan entity)
        {
            //找到导线点图层
            IMap map = new MapClass();

            map = DataEditCommon.g_pMap;
            var           layerName    = LayerNames.DEFALUT_HENGCHUAN; //“默认_导线点”图层
            IFeatureLayer featureLayer = new FeatureLayerClass();

            featureLayer = LayerHelper.GetLayerByName(map, layerName); //获得图层

            if (featureLayer == null)
            {
                MessageBox.Show("没有找到" + layerName + "图层,将不能绘制导线点。", "提示", MessageBoxButtons.OK);
                return(false);
            }

            var point1 = new PointClass {
                X = entity.X1, Y = entity.Y1, Z = entity.Z1, ZAware = true
            };
            var point2 = new PointClass {
                X = entity.X2, Y = entity.Y2, Z = entity.Z2, ZAware = true
            };
            var line = new LineClass {
                FromPoint = point1, ToPoint = point2
            };
            var polygon = new PolygonClass {
                ZAware = true
            };
            var width = entity.Width / 2;

            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad + 90, width));
            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad - 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 + 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 - 90, width));
            polygon.SimplifyPreserveFromTo();

            var list = new List <ziduan>
            {
                new ziduan("BID", entity.Id.ToString()),
                new ziduan("BID0", entity.TunnelId1.ToString()),
                new ziduan("BID1", entity.TunnelId2.ToString()),
                new ziduan("NAME", entity.NameHChuan)
            };

            var feature = DataEditCommon.ModifyFeature(featureLayer, entity.Id, polygon, list);

            return(feature != null);
        }
Esempio n. 6
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_hookHelper == null)
            {
                return;
            }
            if (Button == 4 || Button == 2)
            {
                return;
            }
            IActiveView  pAv     = m_hookHelper.ActiveView;
            IMapControl2 pMapCtl = m_hookHelper.Hook as IMapControl2;

            IPolygon         pPoly = new PolygonClass();
            IPointCollection polylinePointCollection = new PolygonClass();

            pPoly.SpatialReference = pMapCtl.SpatialReference;
            IEnvelope pGeo    = pMapCtl.TrackRectangle();
            object    missing = Type.Missing;
            IPoint    pPoint  = new PointClass();

            pPoint.PutCoords(pGeo.XMin, pGeo.YMin);
            polylinePointCollection.AddPoint(pPoint, ref missing, ref missing);
            pPoint.PutCoords(pGeo.XMin, pGeo.YMax);
            polylinePointCollection.AddPoint(pPoint, ref missing, ref missing);
            pPoint.PutCoords(pGeo.XMax, pGeo.YMax);
            polylinePointCollection.AddPoint(pPoint, ref missing, ref missing);
            pPoint.PutCoords(pGeo.XMax, pGeo.YMin);
            polylinePointCollection.AddPoint(pPoint, ref missing, ref missing);
            pPoly = polylinePointCollection as IPolygon;
            pPoly.SimplifyPreserveFromTo();

            if (pPoly == null)
            {
                return;
            }
            //drawgeometryXOR(pGeo);
            frm = new frmAreaStatistics();
            pPoly.SpatialReference = pMapCtl.SpatialReference;  //added by chulili 2013-02-28 到这里为止,pPoly的空间参考变成null了,再赋值一次
            frm.CurGeometry        = pPoly as IGeometry;
            frm.FormClosed        += new FormClosedEventHandler(frm_FormClosed);
            frm.CurMap             = m_hookHelper.Hook as IMapControlDefault;
            frm.InitFrm();
            frm.SetSliderValue(true);
            frm.ShowDialog();
        }
Esempio n. 7
0
        //MarkerFillSymbol
        private void button14_Click(object sender, EventArgs e)
        {
            IArrowMarkerSymbol arrowMarkerSymbol = new ArrowMarkerSymbolClass();
            IRgbColor          rgbColor          = getRGB(255, 0, 0);

            arrowMarkerSymbol.Color  = rgbColor as IColor;
            arrowMarkerSymbol.Length = 10;
            arrowMarkerSymbol.Width  = 10;
            arrowMarkerSymbol.Style  = esriArrowMarkerStyle.esriAMSPlain;


            IMarkerFillSymbol markerFillSymbol = new MarkerFillSymbolClass();

            markerFillSymbol.MarkerSymbol = arrowMarkerSymbol;
            rgbColor = getRGB(0, 255, 0);
            markerFillSymbol.Color = rgbColor;
            markerFillSymbol.Style = esriMarkerFillStyle.esriMFSGrid;

            IFillProperties fillProperties = markerFillSymbol as IFillProperties;

            fillProperties.XOffset     = 2;
            fillProperties.YOffset     = 2;
            fillProperties.XSeparation = 15;
            fillProperties.YSeparation = 20;

            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(markerFillSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 8
0
        private void EnvelopeToPolygon(IEnvelope ev) //把envelope变为polygon
        {
            IRing  ring     = new RingClass();
            object missing1 = Type.Missing;
            object missing2 = Type.Missing;

            (ring as IPointCollection).AddPoint(ev.LowerLeft, ref missing1, ref missing2);
            (ring as IPointCollection).AddPoint(ev.UpperLeft, ref missing1, ref missing2);
            (ring as IPointCollection).AddPoint(ev.UpperRight, ref missing1, ref missing2);
            (ring as IPointCollection).AddPoint(ev.LowerRight, ref missing1, ref missing2);
            (ring as IPointCollection).AddPoint(ev.LowerLeft, ref missing1, ref missing2);
            ring.Close();

            IPolygon p = new PolygonClass();

            (p as IGeometryCollection).AddGeometry(ring, ref missing1, ref missing2);
            p.SimplifyPreserveFromTo();
            polygon = p as IPolygon;
        }
        /// <summary>
        /// Convert a polyline feature to a polygon
        /// </summary>
        /// <param name="geom">IGeometry</param>
        /// <returns>IPolygon</returns>
        private IPolygon PolylineToPolygon(IGeometry geom)
        {
            //Build a polygon segment-by-segment.
            IPolygon polygon  = new PolygonClass();
            Polyline polyLine = geom as Polyline;

            ISegmentCollection polygonSegs  = polygon as ISegmentCollection;
            ISegmentCollection polylineSegs = polyLine as ISegmentCollection;

            for (int i = 0; i < polylineSegs.SegmentCount; i++)
            {
                ISegment seg = polylineSegs.Segment[i];
                polygonSegs.AddSegment(seg);
            }

            polygon.SimplifyPreserveFromTo();

            return(polygon);
        }
Esempio n. 10
0
        //PictureFillSymbol
        private void button16_Click(object sender, EventArgs e)
        {
            IPictureFillSymbol pictureFillSymbol = new PictureFillSymbolClass();
            //创建图片符号
            //string fileName = @"E:\vs2005\第五章\lesson2\lesson2\data\qq.bmp";
            string path     = Directory.GetCurrentDirectory();
            string fileName = path + @"\qq.bmp";

            pictureFillSymbol.CreateFillSymbolFromFile(esriIPictureType.esriIPictureBitmap, fileName);
            pictureFillSymbol.Color = getRGB(0, 255, 0);

            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot;
            simpleLineSymbol.Color = getRGB(255, 0, 0);
            ISymbol symbol = pictureFillSymbol as ISymbol;

            symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            pictureFillSymbol.Outline = simpleLineSymbol;
            pictureFillSymbol.Angle   = 45;

            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(pictureFillSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 11
0
        /// <summary>
        /// 重新构造面对象
        /// </summary>
        /// <param name="pPolygon"></param>
        /// <returns></returns>
        public static PolygonClass ReNew(IPolygon geo)
        {
            object       obj = Type.Missing;
            PolygonClass p   = null;

            IRing[] ExtRingArray = GetExteriorRings(geo as IPolygon4);
            if (ExtRingArray != null && ExtRingArray.Length > 0)
            {
                p = new PolygonClass();
                foreach (IRing r in ExtRingArray)
                {
                    p.AddGeometry(r, ref obj, ref obj);
                    foreach (IRing ir in GetInteriorRingsByExterior(r, geo))
                    {
                        p.AddGeometry(ir, ref obj, ref obj);
                    }
                }
                p.SimplifyPreserveFromTo();
            }
            return(p);
        }
Esempio n. 12
0
        //SimpleFillSymbol
        private void button12_Click(object sender, EventArgs e)
        {
            //简单填充符号
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();

            simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
            simpleFillSymbol.Color = getRGB(255, 0, 0);
            //创建边线符号
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot;
            simpleLineSymbol.Color = getRGB(0, 255, 0);
            simpleLineSymbol.Width = 10;
            ISymbol symbol = simpleLineSymbol as ISymbol;

            symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            simpleFillSymbol.Outline = simpleLineSymbol;
            //创建面对象
            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(simpleFillSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 13
0
        //LineFillSymbol
        private void button13_Click(object sender, EventArgs e)
        {
            ICartographicLineSymbol cartoLine = new CartographicLineSymbol();

            cartoLine.Cap   = esriLineCapStyle.esriLCSButt;
            cartoLine.Join  = esriLineJoinStyle.esriLJSMitre;
            cartoLine.Color = getRGB(255, 0, 0);
            cartoLine.Width = 2;
            //Create the LineFillSymbo
            ILineFillSymbol lineFill = new LineFillSymbol();

            lineFill.Angle      = 45;
            lineFill.Separation = 10;
            lineFill.Offset     = 5;
            lineFill.LineSymbol = cartoLine;
            object           Missing         = Type.Missing;
            IPolygon         polygon         = new PolygonClass();
            IPointCollection pointCollection = polygon as IPointCollection;
            IPoint           point           = new PointClass();

            point.PutCoords(5, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(5, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 10);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            point.PutCoords(10, 5);
            pointCollection.AddPoint(point, ref Missing, ref Missing);
            polygon.SimplifyPreserveFromTo();
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(lineFill as ISymbol);
            activeView.ScreenDisplay.DrawPolygon(polygon as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
        }
Esempio n. 14
0
        private static IPolygon CreatePunchedSquarePolygon(
            double xOffset, double yOffset, double sideLength,
            int holes, int pointsPerPart, double z, int rotateSteps,
            ISpatialReference sr)
        {
            var holesInXAndY  = (int)Math.Round(Math.Sqrt(holes));
            var pointsPerSide = (int)Math.Round(pointsPerPart / 4.0);

            IPolygon polygon = new PolygonClass();

            polygon.SpatialReference = sr;
            GeometryUtils.MakeZAware(polygon);

            var geoColl = (IGeometryCollection)polygon;

            object missing = Type.Missing;

            // Create and add the outer ring
            WKSPointZ[] pointArray = CreateSquare(xOffset, yOffset, sideLength,
                                                  pointsPerSide,
                                                  true,
                                                  z);
            CollectionUtils.Rotate(pointArray, rotateSteps);

            IRing ring = new RingClass();

            GeometryUtils.SetWKSPointZs((IPointCollection4)ring, pointArray);
            ring.Close();

            geoColl.AddGeometry(ring, ref missing, ref missing);

            // Create and add inner rings (= holes)
            double innerSideLength = sideLength / (1 + (2 * holesInXAndY));

            for (var i = 0; i < holesInXAndY; i++)
            {
                double llx = xOffset + (innerSideLength + 2 * i * innerSideLength);

                for (var j = 0; j < holesInXAndY; j++)
                {
                    double lly = yOffset + (innerSideLength + 2 * j * innerSideLength);

                    pointArray =
                        CreateSquare(llx, lly, innerSideLength, pointsPerSide, false, z);
                    CollectionUtils.Rotate(pointArray, rotateSteps);

                    ring = new RingClass();
                    GeometryUtils.SetWKSPointZs((IPointCollection4)ring, pointArray);
                    ring.Close();

                    geoColl.AddGeometry(ring, ref missing, ref missing);
                }
            }

            geoColl.GeometriesChanged();
            polygon.SimplifyPreserveFromTo();

            // We closed each ring: poly must be closed too!
            Assert.IsTrue(polygon.IsClosed);

            return(polygon);
        }
Esempio n. 15
0
        //
        //输出外环面 shape
        public bool OutPutPolygonExteriorRing(IFeatureClass featclass, string outShapeFilePath, bool IsGetExtRingOfHaveInnerRing)
        {
            bool rbc = false;

            if (System.IO.File.Exists(outShapeFilePath) == true)
            {   //输出Shape文件
                LocalShapeFileOperator delshpOp = new LocalShapeFileOperator();
                delshpOp.LocalShapePathFileName = outShapeFilePath;
                delshpOp.DeleteShapeFile();
                delshpOp.Dispose();
            }

            esriGeometryType geoType = featclass.ShapeType;

            //创建新的Shape文件
            LocalShapeFileOperator shpOp = new LocalShapeFileOperator();

            shpOp.LocalShapePathFileName = outShapeFilePath;

            string dir  = shpOp.getDir(outShapeFilePath);
            string name = shpOp.getFileName(outShapeFilePath);
            ShapefileWorkspaceFactoryClass objwsf = new ShapefileWorkspaceFactoryClass();
            IWorkspace        objws    = objwsf.OpenFromFile(dir, 0);
            IFeatureWorkspace feaureWS = objws as IFeatureWorkspace;
            //设置投影
            ISpatialReference sr = (featclass as IGeoDataset).SpatialReference;

            shpOp.ShapeSpatialReference = sr;
            //设置shp文件的oid字段和几何字段
            if (IsObjGeo == false)
            {
                if (featclass.HasOID == true)
                {
                    this.OIDFieldName = featclass.OIDFieldName;
                }
                this.GeometryFieldName = featclass.ShapeFieldName;
            }
            shpOp.OIDFieldName      = this.OIDFieldName;
            shpOp.GeometryFieldName = this.GeometryFieldName;
            //创建要素类
            IFeatureClass fc = shpOp.CreateFeatureClass(feaureWS, name, esriFeatureType.esriFTSimple, geoType);

            if (fc != null)
            {
                TokayWorkspace.ComRelease(fc);
                fc  = null;
                rbc = true;
            }
            TokayWorkspace.ComRelease(objws);
            feaureWS = null;
            objws    = null;
            objwsf   = null;
            //拷贝字段结构
            IFeatureClass  Dfeatclass   = shpOp.getIFeatureClass();
            ZhFeatureClass Szhfeatclass = new ZhPointFeatureClass(featclass);

            Szhfeatclass.CopyFieldsToObjectFeatureClass(Dfeatclass);

            //拷贝几何对象和属性数据
            ZhFeature      Szhfeat       = null;
            IFeatureBuffer DfeatBuffer   = null;
            IFeatureCursor featCurInsert = Dfeatclass.Insert(true);

            //获取总要素个数
            int             fIndex    = 0;
            int             tmpFCount = Szhfeatclass.FeatureClass.FeatureCount(null);
            frmProgressBar1 pb        = new frmProgressBar1();

            pb.Text                 = "正在输出shp文件...";
            pb.Caption1.Text        = "正在输出shp文件...";
            pb.progressBar1.Maximum = tmpFCount + 1;
            pb.progressBar1.Value   = 0;
            pb.Show(this.ParentForm);
            Application.DoEvents();

            object   refobj = Type.Missing;
            IPolygon s_p    = null;

            IRing[] ExtRingArray   = null;
            IRing[] InnerRingArray = null;


            IFeatureCursor featcur = Szhfeatclass.FeatureClass.Search(null, false);
            IFeature       feat    = featcur.NextFeature();

            while (feat != null)
            {
                fIndex += 1;
                if (fIndex % 200 == 0)
                {
                    pb.Caption1.Text      = "已输出要素个数:" + fIndex.ToString() + "/总" + tmpFCount.ToString();
                    pb.progressBar1.Value = fIndex;
                    Application.DoEvents();
                    featCurInsert.Flush();
                }
                s_p = feat.ShapeCopy as IPolygon;
                //获取外环面几何对象
                ExtRingArray = PolygonHelper.GetExteriorRings(s_p);
                if (ExtRingArray != null && ExtRingArray.Length > 0)
                {
                    foreach (IRing r in ExtRingArray)
                    {
                        if (IsGetExtRingOfHaveInnerRing == true)
                        {
                            InnerRingArray = PolygonHelper.GetInteriorRingsByExterior(r, s_p);
                            if (InnerRingArray != null && InnerRingArray.Length > 0)
                            {   //有内环
                                //外环构面并输出保存
                                DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                                PolygonClass pclass = new PolygonClass();
                                pclass.AddGeometry(r, ref refobj, ref refobj);
                                pclass.SimplifyPreserveFromTo();
                                pclass.SpatialReference = sr;

                                DfeatBuffer.Shape = pclass;

                                //拷贝属性数据
                                Szhfeat = new ZHFeaturePoint(feat);
                                Szhfeat.CopyField(ref DfeatBuffer);

                                featCurInsert.InsertFeature(DfeatBuffer);
                                //
                            }
                        }
                        else
                        {
                            //外环构面并输出保存
                            DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                            PolygonClass pclass = new PolygonClass();
                            pclass.AddGeometry(r, ref refobj, ref refobj);
                            pclass.SimplifyPreserveFromTo();
                            pclass.SpatialReference = sr;

                            DfeatBuffer.Shape = pclass;

                            //拷贝属性数据
                            Szhfeat = new ZHFeaturePoint(feat);
                            Szhfeat.CopyField(ref DfeatBuffer);

                            featCurInsert.InsertFeature(DfeatBuffer);
                            //
                        }
                    }
                }
                feat = featcur.NextFeature();
            }
            featCurInsert.Flush();
            TokayWorkspace.ComRelease(featcur);
            featcur = null;
            TokayWorkspace.ComRelease(featCurInsert);
            featCurInsert = null;
            rbc           = true;

            pb.Close();
            pb.Dispose();
            pb = null;

            return(rbc);
        }