Example #1
0
        private void method_1(ICoFeature icoFeature_0, IGeometry igeometry_0)
        {
            ICoPolylineFeature feature  = icoFeature_0 as ICoPolylineFeature;
            IPolyline          polyline = igeometry_0 as IPolyline;

            if ((feature != null) && (polyline != null))
            {
                IGeometryCollection geometrys = polyline as IGeometryCollection;
                if (geometrys != null)
                {
                    for (int i = 0; i < geometrys.GeometryCount; i++)
                    {
                        CoPointCollection item    = new CoPointCollection();
                        IPointCollection  points2 = geometrys.get_Geometry(i) as IPointCollection;
                        if (points2 != null)
                        {
                            for (int j = 0; j < points2.PointCount; j++)
                            {
                                IPoint point = points2.get_Point(j);
                                item.Add(new CoPointClass(point.X, point.Y, point.Z));
                            }
                            feature.Points.Add(item);
                        }
                    }
                }
            }
        }
Example #2
0
        private void method_2(ICoFeature icoFeature_0, IFeature ifeature_0)
        {
            ICoPolygonFeature feature = icoFeature_0 as ICoPolygonFeature;
            IPolygon          shape   = ifeature_0.Shape as IPolygon;

            if ((feature != null) && (shape != null))
            {
                IGeometryCollection geometrys = shape as IGeometryCollection;
                if (geometrys != null)
                {
                    for (int i = 0; i < geometrys.GeometryCount; i++)
                    {
                        IPointCollection points = geometrys.get_Geometry(i) as IPointCollection;
                        if (points != null)
                        {
                            CoPointCollection item = new CoPointCollection();
                            for (int j = 0; j < points.PointCount; j++)
                            {
                                IPoint point = points.get_Point(j);
                                if (point != null)
                                {
                                    item.Add(new CoPointClass(point.X, point.Y, point.Z));
                                }
                            }
                            feature.Points.Add(item);
                        }
                    }
                }
            }
        }
Example #3
0
        private void method_2(ICoFeature icoFeature_0, IGeometry igeometry_0)
        {
            ICoPointFeature feature = icoFeature_0 as ICoPointFeature;
            IPoint          point   = igeometry_0 as IPoint;

            if ((feature != null) && (point != null))
            {
                feature.Point.Add(new CoPointClass(point.X, point.Y, point.Z));
            }
        }
Example #4
0
        private void method_4(ICoFeature icoFeature_0, IFeature ifeature_0)
        {
            ICoPointFeature feature = icoFeature_0 as ICoPointFeature;
            IPoint          shape   = ifeature_0.Shape as IPoint;

            if ((feature != null) && (shape != null))
            {
                feature.Point.Add(new CoPointClass(shape.X, shape.Y, shape.Z));
            }
        }
Example #5
0
 private void method_10(IFeatureBuffer ifeatureBuffer_0, ICoFeature icoFeature_0)
 {
     foreach (ICoField field in icoFeature_0.Layer.Fields)
     {
         ICoField field2 = field;
         if (this.coLayerMapper_0 != null)
         {
             field2 = this.coLayerMapper_0.FindDestField(field);
         }
         if (field2 == null)
         {
             field2 = field;
         }
         int index = ifeatureBuffer_0.Fields.FindField(field2.Name);
         if ((index > -1) && (index < ifeatureBuffer_0.Fields.FieldCount))
         {
             Exception exception;
             try
             {
                 object obj2   = icoFeature_0.GetValue(field.Name);
                 IField field3 = ifeatureBuffer_0.Fields.get_Field(index);
                 if (field3 != null)
                 {
                     object obj3 = Class4.ToObjectFun(obj2, field3);
                     switch (field3.Type)
                     {
                     case esriFieldType.esriFieldTypeOID:
                     case esriFieldType.esriFieldTypeGeometry:
                     {
                         continue;
                     }
                     }
                     ifeatureBuffer_0.set_Value(index, obj3);
                 }
                 else
                 {
                     try
                     {
                         ifeatureBuffer_0.set_Value(index, obj2);
                     }
                     catch (Exception exception1)
                     {
                         exception = exception1;
                         Debug.WriteLine(exception.Message);
                     }
                 }
             }
             catch (Exception exception2)
             {
                 exception = exception2;
                 Debug.WriteLine(exception.Message);
             }
         }
     }
 }
Example #6
0
        public IGeometry XpgisFeatureToGeometry(ICoFeature icoFeature_0)
        {
            object before = Missing.Value;

            switch (icoFeature_0.Type)
            {
            case CoFeatureType.Point:
            {
                IPoint[] pointArray2 = this.method_4((icoFeature_0 as ICoPointFeature).Point);
                int      index       = 0;
                if (0 >= pointArray2.Length)
                {
                    break;
                }
                return(pointArray2[index]);
            }

            case CoFeatureType.Polygon:
            {
                IGeometryCollection geometrys2 = new PolygonClass();
                foreach (CoPointCollection points in (icoFeature_0 as ICoPolygonFeature).Points)
                {
                    IPointCollection points3 = new RingClass();
                    foreach (IPoint point2 in this.method_4(points))
                    {
                        points3.AddPoint(point2, ref before, ref before);
                    }
                    geometrys2.AddGeometry((IGeometry)points3, ref before, ref before);
                }
                ((IPolygon)geometrys2).SimplifyPreserveFromTo();
                return((IGeometry)geometrys2);
            }

            case CoFeatureType.Polyline:
            {
                IGeometryCollection geometrys = new PolylineClass();
                foreach (CoPointCollection points in (icoFeature_0 as ICoPolylineFeature).Points)
                {
                    IPoint[]         pointArray3 = this.method_4(points);
                    IPointCollection points2     = new PathClass();
                    for (int i = 0; i < pointArray3.Length; i++)
                    {
                        points2.AddPoint(pointArray3[i], ref before, ref before);
                    }
                    geometrys.AddGeometry((IGeometry)points2, ref before, ref before);
                }
                return((IGeometry)geometrys);
            }
            }
            return(null);
        }
Example #7
0
        public ICoFeature GeometryToXpgisFeature(IGeometry igeometry_0)
        {
            if (igeometry_0 == null)
            {
                return(null);
            }
            ICoFeature feature2 = null;

            switch (igeometry_0.GeometryType)
            {
            case esriGeometryType.esriGeometryPoint:
                feature2 = CoFeatureFactory.CreateFeature(this.icoLayer_0, CoFeatureType.Point);
                break;

            case esriGeometryType.esriGeometryPolyline:
                feature2 = CoFeatureFactory.CreateFeature(this.icoLayer_0, CoFeatureType.Polyline);
                break;

            case esriGeometryType.esriGeometryPolygon:
                feature2 = CoFeatureFactory.CreateFeature(this.icoLayer_0, CoFeatureType.Polygon);
                break;
            }
            if (feature2 != null)
            {
                switch (feature2.Type)
                {
                case CoFeatureType.Point:
                    this.method_2(feature2, igeometry_0);
                    return(feature2);

                case CoFeatureType.Line:
                    return(feature2);

                case CoFeatureType.Polygon:
                    this.method_0(feature2, igeometry_0);
                    return(feature2);

                case CoFeatureType.Annotation:
                    this.method_3(feature2, igeometry_0);
                    return(feature2);

                case CoFeatureType.Polyline:
                    this.method_1(feature2, igeometry_0);
                    return(feature2);
                }
            }
            return(feature2);
        }
Example #8
0
 public override void Flush(CoLayerMapper coLayerMapper_1)
 {
     try
     {
         this.coLayerMapper_0 = coLayerMapper_1;
         for (int i = 0; i < base.XpgisLayer.FeatureCount; i++)
         {
             ICoFeature featureByIndex = base.XpgisLayer.GetFeatureByIndex(i);
             this.method_2(featureByIndex);
         }
         base.XpgisLayer.RemoveAllFeature();
     }
     catch
     {
         base.XpgisLayer.RemoveAllFeature();
     }
 }
Example #9
0
        public override int NextFeature()
        {
            IFeature feature = this.ifeatureCursor_0.NextFeature();

            if (feature == null)
            {
                return(-1);
            }
            ICoFeature feature2 = this.method_0(feature);

            if (feature2 != null)
            {
                base.XpgisLayer.AppendFeature(feature2);
            }
            if (feature.HasOID)
            {
                return(feature.OID);
            }
            return(0);
        }
Example #10
0
        private void method_5(ICoFeature icoFeature_0, IFeature ifeature_0)
        {
            ICoAnnotationFeature feature  = icoFeature_0 as ICoAnnotationFeature;
            IAnnotationFeature   feature2 = ifeature_0 as IAnnotationFeature;

            if (((feature != null) && (feature2 != null)) && (feature2.Annotation != null))
            {
                ITextElement annotation = feature2.Annotation as ITextElement;
                if (annotation != null)
                {
                    IPoint geometry = ((IElement)annotation).Geometry as IPoint;
                    if (geometry != null)
                    {
                        feature.Point.Add(new CoPointClass(geometry.X, geometry.Y, geometry.Z));
                        feature.Text  = annotation.Text;
                        feature.Angle = annotation.Symbol.Angle;
                        feature.Color = Color.FromArgb(annotation.Symbol.Color.RGB);
                        FontStyle regular = FontStyle.Regular;
                        if (annotation.Symbol.Font.Bold)
                        {
                            regular = FontStyle.Bold;
                        }
                        if (annotation.Symbol.Font.Italic)
                        {
                            regular = FontStyle.Italic;
                        }
                        if (annotation.Symbol.Font.Strikethrough)
                        {
                            regular = FontStyle.Strikeout;
                        }
                        if (annotation.Symbol.Font.Underline)
                        {
                            regular = FontStyle.Underline;
                        }
                        System.Drawing.Font font = new System.Drawing.Font(annotation.Symbol.Font.Name,
                                                                           (float)annotation.Symbol.Font.Size, regular);
                        feature.Font = font;
                    }
                }
            }
        }
Example #11
0
 private void method_1(ICoFeature icoFeature_0, IFeature ifeature_0)
 {
     if ((icoFeature_0 == null) || (ifeature_0 == null))
     {
         Debug.WriteLine("ArcgisConvertClass.SetXpgisFeautreValue()的任何参数都不能为空");
     }
     else
     {
         int num2;
         for (int i = 0; i < icoFeature_0.Layer.Fields.Count; i++)
         {
             ICoField field = icoFeature_0.Layer.Fields[i];
             num2 = ifeature_0.Fields.FindField(field.Name);
             if (num2 != -1)
             {
                 object obj2 = ifeature_0.get_Value(num2);
                 if (icoFeature_0.Values.Length > i)
                 {
                     icoFeature_0.SetValue(num2, obj2);
                 }
                 else
                 {
                     icoFeature_0.AppendValue(obj2);
                 }
             }
         }
         IFeatureClass class2 = ifeature_0.Class as IFeatureClass;
         if (class2 != null)
         {
             num2 = ifeature_0.Fields.FindField(class2.OIDFieldName);
             if (num2 != -1)
             {
                 int result = 0;
                 int.TryParse(ifeature_0.get_Value(num2).ToString(), out result);
                 icoFeature_0.OID = result;
             }
         }
     }
 }
Example #12
0
        private void method_3(ICoFeature icoFeature_0, int int_0)
        {
            try
            {
                int      num2;
                DateTime time;
                if (this.coLayerMapper_0 == null)
                {
                    goto Label_016A;
                }
                int num = 0;
Label_0011:
                if (num >= this.coLayerMapper_0.FieldRelation.Count)
                {
                    return;
                }
                CoFieldMapper mapper      = this.coLayerMapper_0.FieldRelation[num];
                ICoField      destField   = mapper.DestField;
                ICoField      sourceField = mapper.SourceField;
                object        obj2        = "";
                try
                {
                    obj2 = icoFeature_0.GetValue(sourceField);
                }
                catch
                {
                    obj2 = "";
                }
                goto Label_010A;
Label_006B:
                ShapeLib.DBFWriteStringAttribute(this.intptr_1, int_0, num2, obj2.ToString().ToUpper());
                goto Label_0101;
Label_0088:
                ShapeLib.DBFWriteIntegerAttribute(this.intptr_1, int_0, num2, this.method_7(obj2.ToString()));
                goto Label_0101;
Label_00A6:
                ShapeLib.DBFWriteDoubleAttribute(this.intptr_1, int_0, num2, this.method_6(obj2.ToString()));
                goto Label_0101;
Label_00C4:
                ShapeLib.DBFWriteLogicalAttribute(this.intptr_1, int_0, num2, this.method_5(obj2.ToString()));
                goto Label_0101;
Label_00E2:
                time = DateTime.Parse(obj2.ToString());
                ShapeLib.DBFWriteDateAttribute(this.intptr_1, int_0, num2, time);
Label_0101:
                num++;
                goto Label_0011;
Label_010A:
                num2 = ShapeLib.DBFGetFieldIndex(this.intptr_1, destField.Name);
                int           num3    = 0;
                int           num4    = 0;
                StringBuilder builder = new StringBuilder(destField.Name);
                switch (ShapeLib.DBFGetFieldInfo(this.intptr_1, num2, builder, ref num3, ref num4))
                {
                case ShapeLib.DBFFieldType.FTString:
                    goto Label_006B;

                case ShapeLib.DBFFieldType.FTInteger:
                    goto Label_0088;

                case ShapeLib.DBFFieldType.FTDouble:
                    goto Label_00A6;

                case ShapeLib.DBFFieldType.FTLogical:
                    goto Label_00C4;

                case ShapeLib.DBFFieldType.FTInvalid:
                    goto Label_0101;

                case ShapeLib.DBFFieldType.FTDate:
                    goto Label_00E2;

                default:
                    goto Label_0101;
                }
Label_016A:
                using (List <ICoField> .Enumerator enumerator = icoFeature_0.Layer.Fields.GetEnumerator())
                {
Label_017D:
                    if (!enumerator.MoveNext())
                    {
                        return;
                    }
                    ICoField current = enumerator.Current;
                    obj2 = "";
                    try
                    {
                        obj2 = icoFeature_0.GetValue(current);
                    }
                    catch
                    {
                        obj2 = "";
                    }
                    goto Label_0256;
Label_01B5:
                    ShapeLib.DBFWriteStringAttribute(this.intptr_1, int_0, num2, obj2.ToString().ToUpper());
                    goto Label_017D;
Label_01D2:
                    ShapeLib.DBFWriteIntegerAttribute(this.intptr_1, int_0, num2, this.method_7(obj2.ToString()));
                    goto Label_017D;
Label_01F0:
                    ShapeLib.DBFWriteDoubleAttribute(this.intptr_1, int_0, num2, this.method_6(obj2.ToString()));
                    goto Label_017D;
Label_0211:
                    ShapeLib.DBFWriteLogicalAttribute(this.intptr_1, int_0, num2, this.method_5(obj2.ToString()));
                    goto Label_017D;
Label_0232:
                    time = DateTime.Parse(obj2.ToString());
                    ShapeLib.DBFWriteDateAttribute(this.intptr_1, int_0, num2, time);
                    goto Label_017D;
Label_0256:
                    num2    = ShapeLib.DBFGetFieldIndex(this.intptr_1, current.Name);
                    num3    = 0;
                    num4    = 0;
                    builder = new StringBuilder(current.Name);
                    switch (ShapeLib.DBFGetFieldInfo(this.intptr_1, num2, builder, ref num3, ref num4))
                    {
                    case ShapeLib.DBFFieldType.FTString:
                        goto Label_01B5;

                    case ShapeLib.DBFFieldType.FTInteger:
                        goto Label_01D2;

                    case ShapeLib.DBFFieldType.FTDouble:
                        goto Label_01F0;

                    case ShapeLib.DBFFieldType.FTLogical:
                        goto Label_0211;

                    case ShapeLib.DBFFieldType.FTDate:
                        goto Label_0232;
                    }
                    goto Label_017D;
                }
            }
            catch
            {
            }
        }
Example #13
0
        private void method_2(ICoFeature icoFeature_0)
        {
            try
            {
                int[] numArray;
                ShapeLib.PartType[] typeArray;
                int num5;
                int count = 0;
                int num2  = 0;
                int num3  = 0;
                int index = 0;
                switch (icoFeature_0.Type)
                {
                case CoFeatureType.Point:
                    foreach (ICoPoint point in (icoFeature_0 as ICoPointFeature).Point)
                    {
                        this.double_0    = new double[1];
                        this.double_1    = new double[1];
                        this.double_0[0] = point.X;
                        this.double_1[0] = point.Y;
                        this.intptr_2    = ShapeLib.SHPCreateObject(this.shapeType_0, -1, 0, null, null, 1,
                                                                    this.double_0, this.double_1, null, null);
                        num2 = ShapeLib.SHPWriteObject(this.intptr_0, -1, this.intptr_2);
                        ShapeLib.SHPDestroyObject(this.intptr_2);
                        this.method_3(icoFeature_0, num2);
                    }
                    return;

                case CoFeatureType.Line:
                case CoFeatureType.Annotation:
                    return;

                case CoFeatureType.Polygon:
                {
                    ICoPolygonFeature feature2 = icoFeature_0 as ICoPolygonFeature;
                    if (feature2 != null)
                    {
                        count        = feature2.Points.Count;
                        numArray     = new int[count];
                        typeArray    = new ShapeLib.PartType[count];
                        typeArray[0] = ShapeLib.PartType.Ring;
                        numArray[0]  = 0;
                        num3         = feature2.Points[0].Count;
                        for (num5 = 1; num5 < count; num5++)
                        {
                            numArray[num5]  = num3;
                            typeArray[num5] = ShapeLib.PartType.Ring;
                            num3           += feature2.Points[num5].Count;
                        }
                        this.double_0 = new double[num3];
                        this.double_1 = new double[num3];
                        int num6 = 0;
                        foreach (CoPointCollection points in feature2.Points)
                        {
                            int    num8;
                            double num7 = this.method_8(points);
                            if (num6 == 0)
                            {
                                if (num7 > 0.0)
                                {
                                    foreach (ICoPoint point2 in points)
                                    {
                                        this.double_0[index] = point2.X;
                                        this.double_1[index] = point2.Y;
                                        index++;
                                    }
                                }
                                else
                                {
                                    num8 = points.Count - 1;
                                    while (num8 >= 0)
                                    {
                                        this.double_0[index] = points[num8].X;
                                        this.double_1[index] = points[num8].Y;
                                        index++;
                                        num8--;
                                    }
                                }
                            }
                            else if (num7 > 0.0)
                            {
                                for (num8 = points.Count - 1; num8 >= 0; num8--)
                                {
                                    this.double_0[index] = points[num8].X;
                                    this.double_1[index] = points[num8].Y;
                                    index++;
                                }
                            }
                            else
                            {
                                foreach (ICoPoint point2 in points)
                                {
                                    this.double_0[index] = point2.X;
                                    this.double_1[index] = point2.Y;
                                    index++;
                                }
                            }
                            num6++;
                        }
                        this.intptr_2 = ShapeLib.SHPCreateObject(this.shapeType_0, -1, count, numArray, typeArray,
                                                                 num3, this.double_0, this.double_1, null, null);
                        try
                        {
                            num2 = ShapeLib.SHPWriteObject(this.intptr_0, -1, this.intptr_2);
                            ShapeLib.SHPDestroyObject(this.intptr_2);
                            this.method_3(icoFeature_0, num2);
                        }
                        catch
                        {
                        }
                    }
                    return;
                }

                case CoFeatureType.Polyline:
                    break;

                default:
                    return;
                }
                ICoPolylineFeature feature = icoFeature_0 as ICoPolylineFeature;
                count        = feature.Points.Count;
                numArray     = new int[count];
                typeArray    = new ShapeLib.PartType[count];
                typeArray[0] = ShapeLib.PartType.Ring;
                numArray[0]  = 0;
                num3         = feature.Points[0].Count;
                for (num5 = 1; num5 < count; num5++)
                {
                    numArray[num5]  = num3;
                    typeArray[num5] = ShapeLib.PartType.Ring;
                    num3           += feature.Points[num5].Count;
                }
                this.double_0 = new double[num3];
                this.double_1 = new double[num3];
                foreach (CoPointCollection points in feature.Points)
                {
                    foreach (ICoPoint point2 in points)
                    {
                        this.double_0[index] = point2.X;
                        this.double_1[index] = point2.Y;
                        index++;
                    }
                }
                this.intptr_2 = ShapeLib.SHPCreateObject(this.shapeType_0, -1, count, numArray, typeArray, num3,
                                                         this.double_0, this.double_1, null, null);
                num2 = ShapeLib.SHPWriteObject(this.intptr_0, -1, this.intptr_2);
                ShapeLib.SHPDestroyObject(this.intptr_2);
                this.method_3(icoFeature_0, num2);
            }
            finally
            {
            }
        }
Example #14
0
 public void AppendFeature(ICoFeature icoFeature_0)
 {
     this.list_0.Add(icoFeature_0);
 }
Example #15
0
        private ICoFeature method_0(IFeature ifeature_0)
        {
            if ((ifeature_0 == null) || (ifeature_0.Shape == null))
            {
                if (ifeature_0.HasOID)
                {
                    Debug.WriteLine("丢失要素:" + ifeature_0.OID.ToString());
                }
                else
                {
                    Debug.WriteLine("丢失要素:" + ifeature_0.ToString());
                }
                return(null);
            }
            ICoFeature    feature2 = null;
            IFeatureClass class2   = ifeature_0.Class as IFeatureClass;

            if (class2 != null)
            {
                switch (class2.FeatureType)
                {
                case esriFeatureType.esriFTSimple:
                    switch (ifeature_0.Shape.GeometryType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        feature2 = CoFeatureFactory.CreateFeature(base.XpgisLayer, CoFeatureType.Point);
                        goto Label_00E5;

                    case esriGeometryType.esriGeometryMultipoint:
                        goto Label_00E5;

                    case esriGeometryType.esriGeometryPolyline:
                        feature2 = CoFeatureFactory.CreateFeature(base.XpgisLayer, CoFeatureType.Polyline);
                        goto Label_00E5;

                    case esriGeometryType.esriGeometryPolygon:
                        feature2 = CoFeatureFactory.CreateFeature(base.XpgisLayer, CoFeatureType.Polygon);
                        goto Label_00E5;
                    }
                    break;

                case esriFeatureType.esriFTAnnotation:
                    feature2 = CoFeatureFactory.CreateFeature(base.XpgisLayer, CoFeatureType.Annotation);
                    break;
                }
            }
Label_00E5:
            if (feature2 != null)
            {
                switch (feature2.Type)
                {
                case CoFeatureType.Point:
                    this.method_4(feature2, ifeature_0);
                    break;

                case CoFeatureType.Polygon:
                    this.method_2(feature2, ifeature_0);
                    break;

                case CoFeatureType.Annotation:
                    this.method_5(feature2, ifeature_0);
                    break;

                case CoFeatureType.Polyline:
                    this.method_3(feature2, ifeature_0);
                    break;
                }
            }
            this.method_1(feature2, ifeature_0);
            return(feature2);
        }
Example #16
0
        public override int NextFeature()
        {
            ICoFeature feature = null;
            int        num3;
            Exception  exception;
            string     str7;
            Color      color;
            bool       flag;
            string     s    = string.Empty;
            string     str2 = string.Empty;
            string     str3 = string.Empty;

            string[] strArray = new string[0];
            switch (base.XpgisLayer.LayerType)
            {
            case CoLayerType.Point:
                goto Label_034A;

            case CoLayerType.Line:
            {
                feature = new CoPolylineFeature(base.XpgisLayer);
                s       = string.Empty;
                if (this.streamReader_0 == null)
                {
                    if (this.long_1 != 0L)
                    {
                        this.streamReader_0 = this.vctClass_0.CreateReader(this.long_1 - 1L);
                        this.long_3         = this.long_1 - 1L;
                        this.long_1         = 0L;
                    }
                    else
                    {
                        this.streamReader_0 = this.vctClass_0.CreateReader(this.long_0 - 1L);
                        this.long_3         = this.long_0 - 1L;
                    }
                }
                s = this.method_1(ref this.streamReader_0);
                while (s.Length <= 0)
                {
                    s = this.method_1(ref this.streamReader_0);
                }
                str2 = this.method_1(ref this.streamReader_0);
                if (this.vctClass_0.FindLayerIndex(str2, CoLayerType.Line) !=
                    this.vctClass_0.FindLayerIndexByName(base.XpgisLayer.Name))
                {
                    return(-1);
                }
                this.method_1(ref this.streamReader_0);
                this.method_1(ref this.streamReader_0);
                int num2 = 0;
                int.TryParse(this.method_1(ref this.streamReader_0), out num2);
                CoPointCollection points = new CoPointCollection();
                for (num3 = 0; num3 < num2; num3++)
                {
                    string str4 = this.method_1(ref this.streamReader_0);
                    try
                    {
                        CoPointClass class3 = this.vctClass_0.LineToPoint(str4);
                        points.Add(class3);
                    }
                    catch (Exception exception2)
                    {
                        exception = exception2;
                        this.vctClass_0.WriteLog(string.Format(this.string_0, this.long_3, "不能转换为坐标"));
                        this.streamReader_0.Close();
                        this.streamReader_0.Dispose();
                        this.streamReader_0 = null;
                        this.long_1         = this.long_3;
                        return(-2);
                    }
                }
                (feature as CoPolylineFeature).Points.Add(points);
                feature.OID = int.Parse(s);
                goto Label_0AA8;
            }

            case CoLayerType.Region:
            {
                int num4;
                feature = new CoPolygonFeature(base.XpgisLayer);
                s       = string.Empty;
                if (this.streamReader_0 == null)
                {
                    this.streamReader_0 = this.vctClass_0.CreateReader(this.long_0 - 1L);
                    this.long_3         = this.long_0 - 1L;
                }
                for (s = this.method_1(ref this.streamReader_0);
                     s.Length <= 0;
                     s = this.method_1(ref this.streamReader_0))
                {
                }
                str2 = this.method_1(ref this.streamReader_0);
                if (this.vctClass_0.FindLayerIndex(str2, CoLayerType.Region) !=
                    this.vctClass_0.FindLayerIndexByName(base.XpgisLayer.Name))
                {
                    return(-1);
                }
                this.method_1(ref this.streamReader_0);
                string str5 = this.method_1(ref this.streamReader_0);
                if (this.vctClass_0.LineToPoint(str5) == null)
                {
                    str5 = this.method_1(ref this.streamReader_0);
                }
                if (this.icoLayer_1.Parameter.Topo != 0)
                {
                    if (this.icoLayer_1.Parameter.Topo == 1)
                    {
                        this.vctClass_0.LineToPoint(str5);
                        num4 = 0;
                        int.TryParse(this.method_1(ref this.streamReader_0).Trim(), out num4);
                        int num5 = 0;
                        num5 = num4 / 8;
                        if ((num4 % 8) > 0)
                        {
                            num5++;
                        }
                        (feature as CoPolygonFeature).Points.Add(new CoPointCollection());
                        for (num3 = 0; num3 < num5; num3++)
                        {
                            foreach (
                                string str6 in
                                this.method_1(ref this.streamReader_0).Split(new char[] { this.vctClass_0.Separator })
                                )
                            {
                                int num7 = 0;
                                int.TryParse(str6.Trim(), out num7);
                                if (num7 != 0)
                                {
                                    CoPointCollection points3 = this.method_0(Math.Abs(num7));
                                    if (num7 > 0)
                                    {
                                        foreach (CoPointClass class4 in points3)
                                        {
                                            (feature as CoPolygonFeature).Points[
                                                (feature as CoPolygonFeature).Points.Count - 1].Add(class4);
                                        }
                                    }
                                    else if (num7 < 0)
                                    {
                                        for (int i = points3.Count - 1; i > -1; i--)
                                        {
                                            (feature as CoPolygonFeature).Points[
                                                (feature as CoPolygonFeature).Points.Count - 1].Add(points3[i]);
                                        }
                                    }
                                }
                                else
                                {
                                    (feature as CoPolygonFeature).Points.Add(new CoPointCollection());
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.vctClass_0.LineToPoint(str5);
                    num4 = 0;
                    int.TryParse(this.method_1(ref this.streamReader_0).Trim(), out num4);
                    while (num4 > 0)
                    {
                        (feature as CoPolygonFeature).Points.Add(new CoPointCollection());
                        num3 = 0;
                        while (num3 < num4)
                        {
                            CoPointClass class4 = this.vctClass_0.LineToPoint(this.streamReader_0.ReadLine().Trim());
                            if (class4 == null)
                            {
                                this.vctClass_0.WriteLog(string.Format(this.string_0, this.long_3, "不能转换为坐标"));
                                this.streamReader_0.Close();
                                this.streamReader_0.Dispose();
                                this.streamReader_0 = null;
                                this.long_0         = this.long_3;
                                return(-2);
                            }
                            (feature as CoPolygonFeature).Points[(feature as CoPolygonFeature).Points.Count - 1].Add
                                (class4);
                            num3++;
                        }
                        int.TryParse(this.method_1(ref this.streamReader_0).Trim(), out num4);
                    }
                }
                goto Label_0AA8;
            }

            case CoLayerType.Annotation:
            {
                feature = new CoAnnotationFeature(base.XpgisLayer);
                s       = string.Empty;
                if (this.streamReader_0 == null)
                {
                    this.streamReader_0 = this.vctClass_0.CreateReader(this.long_0 - 1L);
                    this.long_3         = this.long_0 - 1L;
                }
                s = this.method_1(ref this.streamReader_0);
                while (s.Trim().Length <= 0)
                {
                    s = this.streamReader_0.ReadLine();
                }
                str2 = this.method_1(ref this.streamReader_0);
                if (this.vctClass_0.FindLayerIndex(str2, CoLayerType.Annotation) !=
                    this.vctClass_0.FindLayerIndexByName(base.XpgisLayer.Name))
                {
                    return(-1);
                }
                this.method_1(ref this.streamReader_0);
                str7  = this.method_1(ref this.streamReader_0).Trim();
                color = this.vctClass_0.LineToColor(this.method_1(ref this.streamReader_0).Trim());
                string[] strArray4 =
                    this.method_1(ref this.streamReader_0).Trim().Split(new char[] { this.vctClass_0.Separator });
                int num9 = 0;
                int.TryParse(strArray4[0].Trim(), out num9);
                uint num10 = 0;
                uint.TryParse(strArray4[1].Trim(), out num10);
                flag = false;
                string str8 = strArray4[2].Trim().ToUpper();
                if ((str8 == null) || (!(str8 == "T") && !(str8 == "Y")))
                {
                    flag = false;
                    break;
                }
                flag = true;
                break;
            }

            default:
                goto Label_0AA8;
            }
            float result = 8f;

            float.TryParse(this.method_1(ref this.streamReader_0).Trim(), out result);
            result /= 10f;
            float num12 = 8f;

            float.TryParse(this.method_1(ref this.streamReader_0).Trim(), out num12);
            num12 /= 8f;
            string str9 = this.method_1(ref this.streamReader_0).Trim();

            this.streamReader_0.ReadLine();
            CoPointClass item = this.vctClass_0.LineToPoint(this.method_1(ref this.streamReader_0).Trim());

            (feature as CoAnnotationFeature).Point.Add(item);
            (feature as CoAnnotationFeature).OID   = int.Parse(s);
            (feature as CoAnnotationFeature).Color = color;
            (feature as CoAnnotationFeature).Text  = str9;
            (feature as CoAnnotationFeature).Angle = 0.0;
            FontStyle regular = FontStyle.Regular;

            if (flag)
            {
                regular = FontStyle.Underline;
            }
            try
            {
                Font font = new Font(new FontFamily(str7), result, regular);
                (feature as CoAnnotationFeature).Font = font;
                goto Label_0AA8;
            }
            catch (Exception exception1)
            {
                exception = exception1;
                this.vctClass_0.WriteLog(string.Format(this.string_0, this.long_3, "不能转换为字体\r\n" + exception.ToString()));
                this.streamReader_0.Close();
                this.streamReader_0.Dispose();
                this.streamReader_0 = null;
                this.long_0         = this.long_3;
                return(-2);
            }
Label_034A:
            feature = new CoPointFeature(base.XpgisLayer);
            s       = string.Empty;
            if (this.streamReader_0 == null)
            {
                this.streamReader_0 = this.vctClass_0.CreateReader(this.long_0 - 1L);
                this.long_3         = this.long_0 - 1L;
            }
            s = this.method_1(ref this.streamReader_0);
            while (s.Length <= 0)
            {
                s = this.method_1(ref this.streamReader_0);
            }
            str2 = this.method_1(ref this.streamReader_0);
            if (this.vctClass_0.FindLayerIndex(str2, CoLayerType.Point) !=
                this.vctClass_0.FindLayerIndexByName(base.XpgisLayer.Name))
            {
                return(-1);
            }
            this.method_1(ref this.streamReader_0);
            this.method_1(ref this.streamReader_0);
            CoPointClass class2 = this.vctClass_0.LineToPoint(this.method_1(ref this.streamReader_0));

            if (class2 == null)
            {
                this.vctClass_0.WriteLog(string.Format(this.string_0, this.long_3, "不能转换为坐标"));
                this.streamReader_0.Close();
                this.streamReader_0.Dispose();
                this.streamReader_0 = null;
                this.long_0         = this.long_3;
                return(-2);
            }
            (feature as CoPointFeature).Point.Add(class2);
            feature.OID = int.Parse(s);
Label_0AA8:
            if (feature != null)
            {
                str3 = string.Empty;
                if (this.streamReader_1 == null)
                {
                    this.streamReader_1 = this.vctClass_0.CreateReader(this.long_2 - 1L);
                    this.long_4         = this.long_2 - 1L;
                }
                strArray = this.method_1(ref this.streamReader_1).Split(new char[] { this.vctClass_0.Separator });
                StringBuilder builder = new StringBuilder();
                string        str10   = string.Empty;
                for (num3 = 0; num3 < feature.Values.Length; num3++)
                {
                    ICoField field = feature.Layer.GetField(num3);
                    if (strArray.Length > feature.Values.Length)
                    {
                        if (strArray.Length > (num3 + 1))
                        {
                            feature.SetValue(num3, strArray[num3 + 1]);
                        }
                        else
                        {
                            str10 = feature.OID.ToString();
                            builder.Append(field.ToString() + ",");
                        }
                    }
                    else if (strArray.Length > num3)
                    {
                        feature.SetValue(num3, strArray[num3]);
                    }
                    else
                    {
                        str10 = feature.OID.ToString();
                        builder.Append(field.ToString() + ",");
                    }
                }
                if (str10.Length > 0)
                {
                    this.vctClass_0.WriteLog(string.Format("要素{0}的字段{1}没有找到属性。", str10, builder.ToString()));
                }
                base.XpgisLayer.AppendFeature(feature);
                this.int_0++;
                return(this.int_0);
            }
            return(-1);
        }
Example #17
0
        private IFeatureBuffer method_9(ICoFeature icoFeature_0)
        {
            object         before = Missing.Value;
            IFeatureBuffer buffer = null;

            if (this.bool_0)
            {
                buffer = this.ifeatureClass_0.CreateFeatureBuffer();
            }
            else
            {
                buffer = this.ifeatureClass_0.CreateFeature() as IFeatureBuffer;
            }
            if (buffer != null)
            {
                buffer.Shape = null;
            }
            switch (icoFeature_0.Type)
            {
            case CoFeatureType.Point:
                if ((this.ifeatureClass_0.FeatureType != esriFeatureType.esriFTAnnotation) &&
                    (this.ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPoint))
                {
                    foreach (IPoint point in this.method_15((icoFeature_0 as ICoPointFeature).Point))
                    {
                        buffer.Shape = point;
                    }
                }
                break;

            case CoFeatureType.Polygon:
                if ((this.ifeatureClass_0.FeatureType != esriFeatureType.esriFTAnnotation) &&
                    (this.ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPolygon))
                {
                    IGeometryCollection geometrys2 = new PolygonClass();
                    foreach (CoPointCollection points in (icoFeature_0 as ICoPolygonFeature).Points)
                    {
                        IPointCollection points3 = new RingClass();
                        foreach (IPoint point2 in this.method_15(points))
                        {
                            points3.AddPoint(point2, ref before, ref before);
                        }
                        geometrys2.AddGeometry((IGeometry)points3, ref before, ref before);
                    }
                    ((IPolygon)geometrys2).SimplifyPreserveFromTo();
                    buffer.Shape = (IGeometry)geometrys2;
                }
                break;

            case CoFeatureType.Annotation:
                if (this.ifeatureClass_0.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    IAnnotationFeature   feature  = buffer as IAnnotationFeature;
                    IPoint               point    = new PointClass();
                    ICoAnnotationFeature feature2 = icoFeature_0 as ICoAnnotationFeature;
                    point.X = feature2.Point[0].X;
                    point.Y = feature2.Point[0].Y;
                    point.Z = feature2.Point[0].Z;
                    ITextElement element = this.method_11(feature2.Text, 0.0, (decimal)feature2.Font.Size,
                                                          feature2.Font.Name, feature2.Color.ToArgb(), point);
                    feature.Annotation = (IElement)element;
                }
                break;

            case CoFeatureType.Polyline:
                if ((this.ifeatureClass_0.FeatureType != esriFeatureType.esriFTAnnotation) &&
                    (this.ifeatureClass_0.ShapeType == esriGeometryType.esriGeometryPolyline))
                {
                    IGeometryCollection geometrys = new PolylineClass();
                    foreach (CoPointCollection points in (icoFeature_0 as ICoPolylineFeature).Points)
                    {
                        IPoint[]         pointArray = this.method_15(points);
                        IPointCollection points2    = new PathClass();
                        for (int i = 0; i < pointArray.Length; i++)
                        {
                            points2.AddPoint(pointArray[i], ref before, ref before);
                        }
                        geometrys.AddGeometry((IGeometry)points2, ref before, ref before);
                    }
                    buffer.Shape = (IGeometry)geometrys;
                }
                break;
            }
            if (buffer != null)
            {
                if (buffer.Shape != null)
                {
                    this.method_10(buffer, icoFeature_0);
                    return(buffer);
                }
                return(null);
            }
            return(null);
        }
Example #18
0
 public void RemoveFeature(ICoFeature icoFeature_0)
 {
 }