Exemple #1
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();
 }
Exemple #2
0
 public void Convert(ICoConvert icoConvert_0, ICoConvert icoConvert_1, ProgressBar progressBar_0)
 {
     if (((icoConvert_0 != null) && (icoConvert_1 != null)) && (icoConvert_0.FeatureCount > 0))
     {
         int num  = 0;
         int num2 = 200;
         icoConvert_0.DestConvert = icoConvert_1;
         while (icoConvert_0.NextFeature() != -1)
         {
             num++;
             if ((num % num2) == 0)
             {
                 icoConvert_0.ConvertFlush(this.coLayerMapper_0);
                 icoConvert_0.XpgisLayer.RemoveAllFeature();
                 if (progressBar_0 != null)
                 {
                     if ((progressBar_0.Value + num2) < progressBar_0.Maximum)
                     {
                         progressBar_0.Value += num2;
                     }
                     else
                     {
                         progressBar_0.Value = progressBar_0.Maximum;
                     }
                 }
                 Application.DoEvents();
             }
         }
         icoConvert_0.ConvertFlush(this.coLayerMapper_0);
         if (progressBar_0 != null)
         {
             progressBar_0.Value = progressBar_0.Maximum;
         }
         icoConvert_0.XpgisLayer.RemoveAllFeature();
     }
 }
Exemple #3
0
        private void method_0()
        {
            int             featureCount = this.icoConvert_0.FeatureCount;
            GxVCTObject     parent       = this.Parent as GxVCTObject;
            frmProgressBar1 bar          = new frmProgressBar1();

            try
            {
                IFeatureLayer layer;
                IFeatureClass class2    = null;
                CoLayerType   layerType = this.icoConvert_0.XpgisLayer.LayerType;
                string        str       = "Point";
                switch (layerType)
                {
                case CoLayerType.Point:
                    str = "Point";
                    break;

                case CoLayerType.Line:
                    str = "line";
                    break;

                case CoLayerType.Region:
                    str = "Polygon";
                    break;

                case CoLayerType.Annotation:
                    str = "Text";
                    break;
                }
                ICoConvert convert = null;
                if (str != "Text")
                {
                    convert =
                        new ShapeLayerClass(
                            parent.GetTemplatePath() + @"\" + this.icoConvert_0.XpgisLayer.Name + ".shp", str,
                            this.icoConvert_0.XpgisLayer);
                }
                else
                {
                    IFieldsEdit edit = null;
                    edit = new FieldsClass();
                    foreach (ICoField field in this.icoConvert_0.XpgisLayer.Fields)
                    {
                        IFieldEdit field1 = new Field() as IFieldEdit;
                        field1.Name_2         = field.Name;
                        field1.AliasName_2    = field.AliasName;
                        field1.DefaultValue_2 = field.DefaultValue;
                        field1.Editable_2     = field.Enable;
                        IFieldEdit  edit2 = field1 as IFieldEdit;
                        CoFieldType type  = field.Type;
                        switch (type)
                        {
                        case CoFieldType.整型:
                            edit2.Type_2 = esriFieldType.esriFieldTypeInteger;
                            break;

                        case ((CoFieldType)2):
                        case ((CoFieldType)6):
                        case ((CoFieldType)7):
                            break;

                        case CoFieldType.浮点型:
                            edit2.Type_2      = esriFieldType.esriFieldTypeSingle;
                            edit2.Precision_2 = field.Precision;
                            edit2.Scale_2     = field.Length;
                            break;

                        case CoFieldType.字符型:
                            edit2.Type_2   = esriFieldType.esriFieldTypeString;
                            edit2.Length_2 = field.Length;
                            break;

                        case CoFieldType.日期型:
                            edit2.Type_2 = esriFieldType.esriFieldTypeDate;
                            break;

                        case CoFieldType.二进制:
                            edit2.Type_2 = esriFieldType.esriFieldTypeBlob;
                            break;

                        default:
                            if (type == CoFieldType.布尔型)
                            {
                                edit2.Type_2 = esriFieldType.esriFieldTypeInteger;
                            }
                            break;
                        }
                        edit.AddField(edit2);
                    }
                    class2 = this.method_2(parent.GetTemplateTextWorksoace() as IFeatureWorkspace,
                                           this.icoConvert_0.XpgisLayer.Name, esriFeatureType.esriFTAnnotation,
                                           esriGeometryType.esriGeometryPolygon, edit);
                    convert = new GeodatabaseLayerClass(class2);
                }
                ConvertHander hander = new ConvertHander();
                bar.Text = "打开数据";
                bar.Show();
                bar.progressBar1.Maximum = featureCount;
                bar.progressBar1.Value   = 0;
                bar.Caption1.Text        = "正在载入图层:" + this.icoConvert_0.XpgisLayer.AliasName + " [要素总数:" +
                                           featureCount.ToString() + "]";
                hander.Convert(this.icoConvert_0, convert, bar.progressBar1);
                string name = this.icoConvert_0.XpgisLayer.Name;
                convert.Dispose();
                if (class2 == null)
                {
                    class2 = (parent.GetTemplateShapefile() as IFeatureWorkspace).OpenFeatureClass(name);
                }
                if (class2.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    FDOGraphicsLayerClass class3 = new FDOGraphicsLayerClass
                    {
                        Cached = true
                    };
                    layer = class3;
                    layer.FeatureClass = class2;
                    layer.Name         = class2.AliasName;
                }
                else if (class2.FeatureType == esriFeatureType.esriFTDimension)
                {
                    DimensionLayerClass class4 = new DimensionLayerClass
                    {
                        Cached = true
                    };
                    layer = class4;
                    layer.FeatureClass = class2;
                    layer.Name         = class2.AliasName;
                }
                else
                {
                    FeatureLayerClass class5 = new FeatureLayerClass
                    {
                        Cached = true
                    };
                    layer = class5;
                    layer.FeatureClass = class2;
                    layer.Name         = class2.AliasName;
                }
                this.ilayer_0 = layer;
                bar.Close();
            }
            catch (Exception)
            {
            }
        }