Exemple #1
0
        public virtual object Clone()
        {
            ICoLayer layer = new CoLayerClass
            {
                AliasName = this.string_1,
                Name      = this.string_0,
                Categorie = this.string_2,
                Enable    = this.bool_0,
                LayerType = this.LayerType,
                Parameter = new CoLayerHead()
            };

            layer.Parameter.Coordinate = this.coLayerHead_0.Coordinate;
            layer.Parameter.Dim        = this.coLayerHead_0.Dim;
            layer.Parameter.Meridian   = this.coLayerHead_0.Meridian;
            layer.Parameter.ScaleM     = this.coLayerHead_0.ScaleM;
            layer.Parameter.Spheroid   = this.coLayerHead_0.Spheroid;
            layer.Parameter.Unit       = this.coLayerHead_0.Unit;
            layer.Parameter.MaxPoint   = new CoPointClass(this.coLayerHead_0.MaxPoint.X, this.coLayerHead_0.MaxPoint.Y,
                                                          this.coLayerHead_0.MaxPoint.Z);
            layer.Parameter.MinPoint = new CoPointClass(this.coLayerHead_0.MinPoint.X, this.coLayerHead_0.MinPoint.Y,
                                                        this.coLayerHead_0.MinPoint.Z);
            foreach (ICoField field in this.Fields)
            {
                ICoField item = (field as ICoClone).Clone() as ICoField;
                layer.Fields.Add(item);
            }
            return(layer);
        }
 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);
             }
         }
     }
 }
Exemple #3
0
        public object GetValue(ICoField icoField_0)
        {
            Debug.Assert(icoField_0 != null);
            int fieldIndex = this.icoLayer_0.GetFieldIndex(icoField_0);

            if (fieldIndex != -1)
            {
                return(this.GetValue(fieldIndex));
            }
            return("");
        }
Exemple #4
0
 public int GetFieldIndex(ICoField icoField_0)
 {
     for (int i = 0; i < this.list_1.Count; i++)
     {
         if (this.list_1[i].Name.ToUpper() == icoField_0.Name.ToUpper())
         {
             return(i);
         }
     }
     return(-1);
 }
Exemple #5
0
 public ICoField FindDestField(ICoField icoField_0)
 {
     foreach (CoFieldMapper mapper in this.list_0)
     {
         if ((mapper.SourceField != null) && (mapper.SourceField.Name.ToUpper() == icoField_0.Name.ToUpper()))
         {
             return(mapper.DestField);
         }
     }
     return(null);
 }
Exemple #6
0
        private void method_1(ICoLayer icoLayer_1)
        {
            for (int i = 0; i < icoLayer_1.Fields.Count; i++)
            {
                ICoField field = icoLayer_1.Fields[i];
                string   name  = field.Name;
                switch (field.Type)
                {
                case CoFieldType.整型:
                    ShapeLib.DBFAddField(this.intptr_1, name, ShapeLib.DBFFieldType.FTInteger, 16, 0);
                    this.list_0.Add(name);
                    break;

                case CoFieldType.浮点型:
                {
                    int length    = field.Length;
                    int precision = field.Precision;
                    ShapeLib.DBFAddField(this.intptr_1, name, ShapeLib.DBFFieldType.FTDouble, length, precision);
                    this.list_0.Add(name);
                    break;
                }

                case CoFieldType.字符型:
                {
                    int num4 = field.Length;
                    ShapeLib.DBFAddField(this.intptr_1, name, ShapeLib.DBFFieldType.FTString, num4, 0);
                    this.list_0.Add(name);
                    break;
                }

                case CoFieldType.日期型:
                    ShapeLib.DBFAddField(this.intptr_1, name, ShapeLib.DBFFieldType.FTInteger, 8, 0);
                    this.list_0.Add(name);
                    break;

                case CoFieldType.二进制:
                    ShapeLib.DBFAddField(this.intptr_1, name, ShapeLib.DBFFieldType.FTLogical, 5, 0);
                    this.list_0.Add(name);
                    break;
                }
            }
        }
 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;
             }
         }
     }
 }
Exemple #8
0
 public void SetValue(ICoField icoField_0, object object_0)
 {
     Debug.Assert(this.icoLayer_0 != null);
     this.SetValue(this.icoLayer_0.GetFieldIndex(icoField_0), object_0);
 }
Exemple #9
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
            {
            }
        }
Exemple #10
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);
        }
Exemple #11
0
 public CoFieldMapper(ICoField icoField_2, ICoField icoField_3)
 {
     this.icoField_0 = icoField_2;
     this.icoField_1 = icoField_3;
 }