コード例 #1
0
ファイル: CADConvert.cs プロジェクト: secondii/Yutai
        private void method_1(IFeatureClass ifeatureClass_0, DXFExport dxfexport_0)
        {
            DXFData dXFDatum;
            int     j;
            IPoint  point;

            dxfexport_0.CurrentLayer = new DXFLayer(ifeatureClass_0.AliasName);
            IFeatureCursor featureCursor = ifeatureClass_0.Search(null, false);

            for (IFeature i = featureCursor.NextFeature(); i != null; i = featureCursor.NextFeature())
            {
                if (this.ifeatureProgress_StepEventHandler_0 != null)
                {
                    this.ifeatureProgress_StepEventHandler_0();
                }
                if (ifeatureClass_0.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    ITextElement annotation = (i as IAnnotationFeature2).Annotation as ITextElement;
                    if (annotation != null)
                    {
                        double xMin = ((annotation as IElement).Geometry.Envelope.XMin +
                                       (annotation as IElement).Geometry.Envelope.XMax) / 2;
                        double yMin = ((annotation as IElement).Geometry.Envelope.YMin +
                                       (annotation as IElement).Geometry.Envelope.YMax) / 2;
                        dXFDatum = new DXFData();
                        dXFDatum.Clear();
                        dXFDatum.color    = annotation.Symbol.Color.RGB;
                        dXFDatum.height   = (float)(annotation as IElement).Geometry.Envelope.Height;
                        dXFDatum.rotation = (float)annotation.Symbol.Angle;
                        dXFDatum.text     = annotation.Text;
                        dXFDatum.point.X  = (float)xMin;
                        dXFDatum.point.Y  = (float)yMin;
                        dxfexport_0.AddText(dXFDatum);
                    }
                }
                else if (
                    !(ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPolyline
                        ? false
                        : ifeatureClass_0.ShapeType != esriGeometryType.esriGeometryPolygon))
                {
                    IGeometryCollection shape = i.Shape as IGeometryCollection;
                    if (shape != null)
                    {
                        if (shape.GeometryCount <= 1)
                        {
                            this.method_0(shape as IPointCollection, dxfexport_0);
                        }
                        else
                        {
                            for (j = 0; j < shape.GeometryCount; j++)
                            {
                                this.method_0(shape.Geometry[j] as IPointCollection, dxfexport_0);
                            }
                        }
                    }
                }
                else if (ifeatureClass_0.ShapeType != esriGeometryType.esriGeometryPoint)
                {
                    IPointCollection pointCollection = i.Shape as IPointCollection;
                    if (pointCollection != null)
                    {
                        for (j = 0; j < pointCollection.PointCount; j++)
                        {
                            point    = pointCollection.Point[j];
                            dXFDatum = new DXFData();
                            dXFDatum.Clear();
                            dXFDatum.point.X = (float)point.X;
                            dXFDatum.point.Y = (float)point.Y;
                            dxfexport_0.AddPixel(dXFDatum);
                        }
                    }
                }
                else
                {
                    point = i.Shape as IPoint;
                    if (point != null)
                    {
                        dXFDatum = new DXFData();
                        dXFDatum.Clear();
                        dXFDatum.point.X = (float)point.X;
                        dXFDatum.point.Y = (float)point.Y;
                        dxfexport_0.AddPixel(dXFDatum);
                    }
                }
            }
            ComReleaser.ReleaseCOMObject(featureCursor);
        }