Esempio n. 1
0
        public ICoConvert Create(string string_0, string string_1)
        {
            if (this.vctClass_0 == null)
            {
                m_path = string.Empty;
            }
            if (m_path != string_1)
            {
                this.vctClass_0 = new VctClass(string_1);
                this.vctClass_0.CreateMap();
                m_path = string_1;
            }
            ICoLayer layer = null;

            foreach (ICoLayer layer2 in this.vctClass_0.Layers)
            {
                if (layer2.Name.ToUpper() == string_0.ToUpper())
                {
                    layer = layer2;
                    break;
                }
            }
            if (layer != null)
            {
                return(new VctLayerClass(this.vctClass_0, layer));
            }
            return(null);
        }
Esempio n. 2
0
 public ShapeLayerClass(string string_1, string string_2, ICoLayer icoLayer_1)
 {
     this.method_0(string_1);
     this.list_0.Clear();
     this.string_0 = string_1.ToUpper();
     if (this.string_0.EndsWith(".SHP"))
     {
         this.string_0 = this.string_0.Substring(0, this.string_0.Length - 4);
     }
     if (string_2.ToLower().Trim() == "point")
     {
         this.shapeType_0 = ShapeLib.ShapeType.Point;
     }
     if (string_2.ToLower().Trim() == "line")
     {
         this.shapeType_0 = ShapeLib.ShapeType.PolyLine;
     }
     if (string_2.ToLower().Trim() == "polygon")
     {
         this.shapeType_0 = ShapeLib.ShapeType.Polygon;
     }
     if (string_2.ToLower().Trim() == "text")
     {
         this.shapeType_0 = ShapeLib.ShapeType.Point;
     }
     this.intptr_0 = ShapeLib.SHPCreate(this.string_0, this.shapeType_0);
     if (!this.intptr_0.Equals(IntPtr.Zero))
     {
         this.intptr_1 = ShapeLib.DBFCreate(this.string_0);
         if (!this.intptr_1.Equals(IntPtr.Zero))
         {
             this.method_1(icoLayer_1);
         }
     }
 }
Esempio n. 3
0
 public CoAnnotationFeature(ICoLayer icoLayer_1) : base(icoLayer_1, CoFeatureType.Annotation)
 {
     this.double_0            = 0.0;
     this.color_0             = System.Drawing.Color.Black;
     this.font_0              = SystemFonts.DefaultFont;
     this.coPointCollection_0 = new CoPointCollection();
 }
Esempio n. 4
0
 public VctLayerClass(VctClass vctClass_1, ICoLayer icoLayer_2)
 {
     this.icoLayer_1 = icoLayer_2;
     this.vctClass_0 = vctClass_1;
     base.XpgisLayer = icoLayer_2;
     this.long_0     = vctClass_1.GetLayerGraphIndex(icoLayer_2);
     this.long_2     = vctClass_1.GetLayerAttributeIndex(icoLayer_2);
 }
Esempio n. 5
0
        internal long GetLayerGraphIndex(ICoLayer icoLayer_0)
        {
            int num = this.FindLayerIndexByName(icoLayer_0.Name);

            if ((num != -1) && (this.arrayList_0[num] != null))
            {
                return((long)int.Parse(this.arrayList_0[num].ToString()));
            }
            return(-1L);
        }
Esempio n. 6
0
 public AbsCoFeature(ICoLayer icoLayer_1, CoFeatureType coFeatureType_1)
 {
     this.icoLayer_0      = icoLayer_1;
     this.coFeatureType_0 = coFeatureType_1;
     if (this.icoLayer_0 != null)
     {
         for (int i = 0; i < this.icoLayer_0.Fields.Count; i++)
         {
             this.list_0.Add(null);
         }
     }
 }
Esempio n. 7
0
 public virtual void Dispose()
 {
     if (this.icoLayer_0 != null)
     {
         this.icoLayer_0.RemoveAllFeature();
         this.icoLayer_0 = null;
     }
     if (this.icoConvert_0 != null)
     {
         this.icoConvert_0.Dispose();
         this.icoConvert_0 = null;
     }
     this.Close();
 }
Esempio n. 8
0
        internal int GetLayerFeatureCount(ICoLayer icoLayer_0)
        {
            int num = this.FindLayerIndexByName(icoLayer_0.Name);

            if ((num != -1) && (this.arrayList_2[num] != null))
            {
                int num2 = int.Parse(this.arrayList_2[num].ToString());
                if (num2 > 0)
                {
                    return(num2);
                }
                return(0);
            }
            return(0);
        }
Esempio n. 9
0
        public static ICoFeature CreateFeature(ICoLayer icoLayer_0, CoFeatureType coFeatureType_0)
        {
            switch (coFeatureType_0)
            {
            case CoFeatureType.Point:
                return(new CoPointFeature(icoLayer_0));

            case CoFeatureType.Polygon:
                return(new CoPolygonFeature(icoLayer_0));

            case CoFeatureType.Annotation:
                return(new CoAnnotationFeature(icoLayer_0));

            case CoFeatureType.Polyline:
                return(new CoPolylineFeature(icoLayer_0));
            }
            return(null);
        }
Esempio n. 10
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;
                }
            }
        }
Esempio n. 11
0
        public void ConvertFlush(CoLayerMapper coLayerMapper_0)
        {
            if (this.icoConvert_0 == null)
            {
                throw new Exception("mDestConvert 为空,未将对象引用到实例。");
            }
            ICoLayer xpgisLayer = this.icoConvert_0.XpgisLayer;

            for (int i = 0; i < this.icoLayer_0.FeatureCount; i++)
            {
                xpgisLayer.AppendFeature(this.icoLayer_0.GetFeatureByIndex(i));
            }
            if (coLayerMapper_0 == null)
            {
                this.icoConvert_0.Flush();
            }
            else
            {
                this.icoConvert_0.Flush(coLayerMapper_0);
            }
            this.icoConvert_0.XpgisLayer.RemoveAllFeature();
            this.icoLayer_0.RemoveAllFeature();
        }
Esempio n. 12
0
        public VctClass(string string_5)
        {
            this.string_1 = CommonHelper.GetTempFile("log");
            try
            {
                if (File.Exists(this.string_1))
                {
                    FileInfo info = new FileInfo(this.string_1)
                    {
                        Attributes = FileAttributes.Normal
                    };
                    File.Delete(this.string_1);
                }
                this.streamWriter_0 = File.CreateText(this.string_1);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.ToString());
            }
            this.string_0          = string_5;
            this.dataFile.fileName = string_5;
            using (StreamReader reader = new StreamReader(this.string_0, Encoding.GetEncoding(0)))
            {
                string   str2;
                string   str3;
                DateTime time;
                ICoLayer layer;
                bool     flag = false;
                this.method_0(reader, "HEADBEGIN");
Label_0149:
                if (reader.EndOfStream)
                {
                    goto Label_04CF;
                }
                string str = reader.ReadLine();
                while (str.Length <= 0)
                {
                    str = reader.ReadLine();
                }
                if (str.ToUpper().Trim() == "HEADEND")
                {
                    goto Label_04CD;
                }
                string[] strArray = str.Split(new char[] { ':' });
                if (strArray.Length == 2)
                {
                    str2 = strArray[1].Trim();
                    int result = 0;
                    int.TryParse(str2, out result);
                    double num2 = 0.0;
                    double.TryParse(str2, out num2);
                    str3 = strArray[0].ToUpper().Trim();
                    switch (str3)
                    {
                    case "DATAMARK":
                        this.coLayerHead_0.Datamark = str2;
                        break;

                    case "VERSION":
                        this.coLayerHead_0.Version = str2;
                        break;

                    case "UNIT":
                        this.coLayerHead_0.Unit = str2;
                        break;

                    case "DIM":
                        this.coLayerHead_0.Dim = result;
                        break;

                    case "TOPO":
                        this.coLayerHead_0.Topo = result;
                        break;

                    case "COORDINATE":
                        this.coLayerHead_0.Coordinate = str2;
                        break;

                    case "PROJECTION":
                        this.coLayerHead_0.Projection = str2;
                        break;

                    case "SPHEROID":
                        this.coLayerHead_0.Spheroid = str2;
                        break;

                    case "PARAMETERS":
                        this.coLayerHead_0.Parameters = str2;
                        break;

                    case "MERIDINAN":
                        this.coLayerHead_0.Meridian = result;
                        break;

                    case "MINX":
                        this.coLayerHead_0.MinPoint.X = num2;
                        break;

                    case "MINY":
                        this.coLayerHead_0.MinPoint.Y = num2;
                        break;

                    case "MAXX":
                        this.coLayerHead_0.MaxPoint.X = num2;
                        break;

                    case "MAXY":
                        this.coLayerHead_0.MaxPoint.Y = num2;
                        break;

                    case "SCALE":
                        this.coLayerHead_0.ScaleM = result;
                        break;

                    case "DATE":
                        goto Label_0474;

                    case "SEPARATOR":
                        goto Label_0489;
                    }
                }
                goto Label_0149;
Label_0474:
                time = DateTime.Now;
                try
                {
                    time = Convert.ToDateTime(str2);
                }
                catch
                {
                }
                goto Label_04BB;
Label_0489:
                if (str2.Length == 1)
                {
                    this.char_0 = str2[0];
                }
                else
                {
                    this.WriteLog("Separator字符不正确,将采用默认字符“,”。");
                }
                goto Label_0149;
Label_04BB:
                this.coLayerHead_0.Date = time;
                goto Label_0149;
Label_04CD:
                flag = true;
Label_04CF:
                if (!flag)
                {
                    this.WriteLog(string.Format(this.string_2, "HEADBEGIN", "HEADEND"));
                }
                flag = false;
                this.method_0(reader, "FEATURECODEBEGIN");
                while (!reader.EndOfStream)
                {
                    str = reader.ReadLine();
                    while (str.Length <= 0)
                    {
                        str = reader.ReadLine();
                    }
                    if (str.ToUpper().Trim() == "FEATURECODEEND")
                    {
                        goto Label_07AF;
                    }
                    strArray = str.Split(new char[] { this.Separator });
                    layer    = null;
                    if (strArray.Length < 3)
                    {
                        goto Label_0714;
                    }
                    layer = new CoLayerClass();
                    List <string> list = new List <string>
                    {
                        strArray[0].Trim()
                    };
                    layer.Tag       = list;
                    layer.AliasName = strArray[1].Trim();
                    str3            = strArray[2].Trim().ToUpper();
                    switch (str3)
                    {
                    case null:
                        break;

                    case "POINT":
                        layer.LayerType = CoLayerType.Point;
                        goto Label_065B;

                    case "LINE":
                        layer.LayerType = CoLayerType.Line;
                        goto Label_065B;

                    case "POLYGON":
                        layer.LayerType = CoLayerType.Region;
                        goto Label_065B;

                    default:
                        if (!(str3 == "ANNOTATION"))
                        {
                            if (!(str3 == "IMAGE"))
                            {
                                break;
                            }
                            this.WriteLog("行\"" + str + "\"中图层类型IMAGE不能被读取。");
                        }
                        else
                        {
                            layer.LayerType = CoLayerType.Annotation;
                        }
                        goto Label_065B;
                    }
                    layer.LayerType = CoLayerType.Region;
                    this.WriteLog(string.Format("行\"{0}\"不能获取图层类型,将采用多边形为默认类型", str));
Label_065B:
                    if (this.coLayerHead_0.Version.Length > 0)
                    {
                        if ((this.coLayerHead_0.Version.Substring(0, 1) == "2") && (strArray.Length >= 7))
                        {
                            layer.Name = strArray[6].Trim();
                        }
                        else if ((this.coLayerHead_0.Version.Substring(0, 1) == "1") && (strArray.Length >= 5))
                        {
                            layer.Name = strArray[4].Trim();
                        }
                        else
                        {
                            this.WriteLog("行\"" + str + "\"不能获取属性表名");
                        }
                    }
                    else
                    {
                        this.WriteLog("没有版本信息。");
                    }
                    goto Label_072B;
Label_0714:
                    this.WriteLog("行\"" + str + "\"不能获取图层的信息");
Label_072B:
                    if (layer != null)
                    {
                        layer.Parameter = this.coLayerHead_0;
                        ICoLayer layer2 = this.FindLayer(layer.Name);
                        if (layer2 == null)
                        {
                            this.list_0.Add(layer);
                            continue;
                        }
                        List <string> tag = layer2.Tag as List <string>;
                        if (tag == null)
                        {
                            tag = new List <string>();
                        }
                        tag.Add(strArray[0].Trim());
                        layer2.Tag = tag;
                    }
                }
                goto Label_07B1;
Label_07AF:
                flag = true;
Label_07B1:
                if (!flag)
                {
                    this.WriteLog(string.Format(this.string_2, "FEATURECODEBEGIN", "FEATURECODEEND"));
                }
                flag = false;
                this.method_0(reader, "TABLESTRUCTUREBEGIN");
                while (!reader.EndOfStream)
                {
                    str = reader.ReadLine();
                    while (str.Length <= 0)
                    {
                        str = reader.ReadLine();
                    }
                    if (str.ToUpper().Trim() == "TABLESTRUCTUREEND")
                    {
                        goto Label_0BDA;
                    }
                    strArray = str.Split(new char[] { this.Separator });
                    if (strArray.Length == 2)
                    {
                        string str4 = strArray[0].Trim();
                        int    num4 = 0;
                        int.TryParse(strArray[1].Trim(), out num4);
                        layer = this.FindLayer(str4);
                        for (int i = 0; i < num4; i++)
                        {
                            int      num7;
                            ICoField item = new CoFieldClass();
                            string   str5 = reader.ReadLine();
                            while (str5.Length <= 0)
                            {
                                str5 = reader.ReadLine();
                            }
                            string[] strArray2 = str5.Split(new char[] { this.Separator });
                            if (strArray2.Length < 2)
                            {
                                goto Label_0B8D;
                            }
                            item.AliasName = item.Name = strArray2[0].Trim();
                            switch (strArray2[1].Trim().ToUpper())
                            {
                            case "SMALLINT":
                            case "INTEGER":
                            case "INT":
                                item.Type = CoFieldType.整型;
                                goto Label_0BA4;

                            case "CHAR":
                            case "VARCHAR":
                            {
                                item.Type = CoFieldType.字符型;
                                if (strArray2.Length <= 2)
                                {
                                    break;
                                }
                                int num6 = 0;
                                int.TryParse(strArray2[2].Trim(), out num6);
                                item.Length = num6;
                                goto Label_0BA4;
                            }

                            case "VARBIN":
                                item.Type = CoFieldType.二进制;
                                goto Label_0BA4;

                            case "FLOAT":
                            case "DOUBLE":
                            case "NUMERIC":
                                item.Type = CoFieldType.浮点型;
                                num7      = 0;
                                if (strArray2.Length < 2)
                                {
                                    goto Label_0AE0;
                                }
                                if (int.TryParse(strArray2[2].Trim(), out num7))
                                {
                                    goto Label_0AD2;
                                }
                                item.Length = 28;
                                this.WriteLog("行\"" + str5 + "\"不能获取浮点数的长度,将采用默认值28.");
                                goto Label_0BA4;

                            case "DATE":
                            case "TIME":
                            case "DATETIME":
                                item.Type = CoFieldType.日期型;
                                goto Label_0BA4;

                            case "BOOLEAN":
                                item.Type = CoFieldType.布尔型;
                                goto Label_0BA4;

                            default:
                                item.Type = CoFieldType.字符型;
                                this.WriteLog("行\"" + str5 + "\"不能获取字段类型,将采用字符串作为默认类型");
                                goto Label_0BA4;
                            }
                            item.Length = 20;
                            this.WriteLog("行\"" + str5 + "\"不能获取字符长度,将采用20作为默认长度");
                            goto Label_0BA4;
Label_0AD2:
                            item.Length = num7;
                            goto Label_0BA4;
Label_0AE0:
                            if (strArray2.Length >= 3)
                            {
                                num7 = 0;
                                if (!int.TryParse(strArray2[3].Trim(), out num7))
                                {
                                    item.Precision = 8;
                                    this.WriteLog("行\"" + str5 + "\"不能获取浮点数的小数位,将采用默认值8.");
                                }
                                else
                                {
                                    item.Precision = num7;
                                }
                            }
                            else
                            {
                                item.Length    = 28;
                                item.Precision = 8;
                                this.WriteLog("行\"" + str5 + "\"不能获取浮点数长度和精度,将采用8位小数位。");
                            }
                            goto Label_0BA4;
Label_0B8D:
                            this.WriteLog("行\"" + str5 + "\"不能获取字段信息");
Label_0BA4:
                            if (layer != null)
                            {
                                layer.Fields.Add(item);
                            }
                        }
                    }
                }
                goto Label_0BDC;
Label_0BDA:
                flag = true;
Label_0BDC:
                if (!flag)
                {
                    this.WriteLog(string.Format(this.string_2, "TABLESTRUCTUREBEGIN", "TABLESTRUCTUREEND"));
                }
            }
        }
Esempio n. 13
0
 public CoPointFeature(ICoLayer icoLayer_1) : base(icoLayer_1, CoFeatureType.Point)
 {
     this.coPointCollection_0 = new CoPointCollection();
 }
Esempio n. 14
0
 public CoPolygonFeature(ICoLayer icoLayer_1) : base(icoLayer_1, CoFeatureType.Polygon)
 {
     this.list_1 = new List <CoPointCollection>();
 }
Esempio n. 15
0
 public CoLayerMapper(ICoLayer icoLayer_2, ICoLayer icoLayer_3)
 {
     this.icoLayer_0 = icoLayer_2;
     this.icoLayer_1 = icoLayer_3;
 }