Esempio n. 1
0
        public static void UpdateFeatureGeometry(IFeature ifeature_0, IGeometry igeometry_0)
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            IFeature feature = null;
            bool     flag;

            if (flag = (ZDEditTools.Oids.IndexOf(ifeature_0.OID) == -1))
            {
                feature = ZDEditTools.WriteHistory(ifeature_0);
            }
            try
            {
                ifeature_0.Shape = igeometry_0;
                ifeature_0.Store();
                if (flag)
                {
                    IFeature feature2 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    RowOperator.CopyFeatureToFeature(ifeature_0, feature2);
                    ZDEditTools.Oids.Add(feature2.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature2, feature, 3, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            catch
            {
                if (feature != null)
                {
                    feature.Delete();
                }
            }
        }
Esempio n. 2
0
 private static void WriteHistoryLine(IFeature ifeature_0, System.Collections.Generic.List <IFeature> list_0,
                                      IFeature ifeature_1, int int_0, System.DateTime dateTime_0)
 {
     foreach (IFeature current in list_0)
     {
         ZDEditTools.WriteHistoryLine(ifeature_0, current, ifeature_1, int_0, dateTime_0);
     }
 }
Esempio n. 3
0
        public static IFeature CreateZD(IGeometry igeometry_0)
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature();

            feature.Shape = igeometry_0;
            feature.Store();
            ZDEditTools.WriteHistoryLine(feature, null, 0, ZDEditTools.StartEditDateTime);
            ZDEditTools.Oids.Add(feature.OID);
            return(feature);
        }
Esempio n. 4
0
        public static bool UpdateZDAttribute(IFeature ifeature_0, string string_0, object object_0,
                                             out IFeature ifeature_1)
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            Editor.Editor.StartEditOperation();
            IWorkspace workspace = AppConfigInfo.GetWorkspace();

            if (!WorkspaceOperator.WorkspaceIsSame(workspace, Editor.Editor.EditWorkspace as IWorkspace))
            {
                (workspace as IWorkspaceEdit).StartEditOperation();
            }
            ifeature_1 = null;
            bool     flag    = ZDEditTools.Oids.IndexOf(ifeature_0.OID) == -1;
            IFeature feature = null;

            if (flag)
            {
                feature = ZDEditTools.WriteHistory(ifeature_0);
            }
            bool result = true;

            try
            {
                int index = ifeature_0.Fields.FindField(string_0);
                ifeature_0.set_Value(index, object_0);
                ifeature_0.Store();
                if (flag)
                {
                    IFeature feature2 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    RowOperator.CopyFeatureToFeature(ifeature_0, feature2);
                    ZDEditTools.Oids.Add(feature2.OID);
                    ifeature_1 = feature2;
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature2, feature, 5, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            catch (System.Exception exception_)
            {
                if (feature != null)
                {
                    feature.Delete();
                }
                result = false;
                System.Windows.Forms.MessageBox.Show("输入数据格式错误");
                //Logger.Current.Error("", exception_, "");
            }
            if (!WorkspaceOperator.WorkspaceIsSame(workspace, Editor.Editor.EditWorkspace as IWorkspace))
            {
                (workspace as IWorkspaceEdit).StopEditOperation();
            }
            Editor.Editor.StopEditOperation();
            return(result);
        }
Esempio n. 5
0
 public static void ChangeAttribute(IFeature ifeature_0, SortedList <string, object> sortedList_0)
 {
     ZDEditTools.StartEditDateTime = System.DateTime.Now;
     if (ZDEditTools.Oids.IndexOf(ifeature_0.OID) == -1)
     {
         ZDEditTools.Oids.Add(ifeature_0.OID);
         IFeature ifeature_ = ZDEditTools.WriteHistory(ifeature_0);
         ZDEditTools.WriteHistoryLine(ifeature_0, ifeature_, 5, ZDEditTools.StartEditDateTime);
     }
     foreach (System.Collections.Generic.KeyValuePair <string, object> current in sortedList_0)
     {
         RowOperator.SetFieldValue(ifeature_0, current.Key, current.Value);
     }
     ifeature_0.Store();
 }
Esempio n. 6
0
        public static IFeature Union(System.Collections.Generic.List <IFeature> list_0)
        {
            ITopologicalOperator4 topologicalOperator = null;
            IGeometry             geometry            = null;

            System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>();
            foreach (IFeature current in list_0)
            {
                list.Add(ZDEditTools.WriteHistory(current));
                if (topologicalOperator == null)
                {
                    topologicalOperator = (current.ShapeCopy as ITopologicalOperator4);
                }
                else
                {
                    geometry            = topologicalOperator.Union(current.ShapeCopy);
                    topologicalOperator = (geometry as ITopologicalOperator4);
                }
            }
            IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature();

            feature.Shape = geometry;
            RowOperator.CopyFeatureAttributeToFeature(list_0[0], feature);
            feature.Store();
            (ZDEditTools.ZDFeatureClass as IDataset).Name.Split(new char[]
            {
                '.'
            });
            new ZDHistoryTable();
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            int num = 0;

            foreach (IFeature current in list_0)
            {
                ZDEditTools.WriteHistoryLine(current, feature, list[num++], 1, ZDEditTools.StartEditDateTime);
                current.Delete();
            }
            ZDEditTools.Oids.Add(feature.OID);
            return(feature);
        }
Esempio n. 7
0
        public static System.Collections.Generic.List <IFeature> Split(IFeature ifeature_0, IPolyline ipolyline_0)
        {
            System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>();
            ITopologicalOperator4 topologicalOperator       = ifeature_0.ShapeCopy as ITopologicalOperator4;
            IGeometry             geometry = topologicalOperator.Intersect(ipolyline_0, esriGeometryDimension.esriGeometry0Dimension);

            System.Collections.Generic.List <IFeature> list2 = new System.Collections.Generic.List <IFeature>();
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            if (geometry.IsEmpty)
            {
                IGeometry geometry2;
                IGeometry geometry3;
                topologicalOperator.Cut(ipolyline_0, out geometry2, out geometry3);
                if (geometry2 != null && geometry3 != null)
                {
                    IFeature ifeature_ = ZDEditTools.WriteHistory(ifeature_0);
                    IFeature feature   = ZDEditTools.ZDFeatureClass.CreateFeature();
                    list.Add(feature);
                    feature.Shape = geometry2;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature);
                    feature.Store();
                    ZDEditTools.Oids.Add(feature.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, ZDEditTools.StartEditDateTime);
                    feature = ZDEditTools.ZDFeatureClass.CreateFeature();
                    list.Add(feature);
                    feature.Shape = geometry3;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature);
                    feature.Store();
                    ZDEditTools.Oids.Add(feature.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            else if (geometry is IMultipoint && (geometry as IPointCollection).PointCount > 1)
            {
                ISpatialFilter spatialFilter = new SpatialFilter();
                spatialFilter.Geometry   = ipolyline_0;
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                IFeatureCursor featureCursor = (ifeature_0.Class as IFeatureClass).Search(spatialFilter, false);
                for (IFeature feature2 = featureCursor.NextFeature();
                     feature2 != null;
                     feature2 = featureCursor.NextFeature())
                {
                    if (feature2.OID != ifeature_0.OID)
                    {
                        list2.Add(feature2);
                    }
                }
                ComReleaser.ReleaseCOMObject(featureCursor);
                int    pointCount = (geometry as IPointCollection).PointCount;
                IPoint ipoint_    = (geometry as IPointCollection).get_Point(0);
                IPoint ipoint_2   = (geometry as IPointCollection).get_Point(pointCount - 1);
                foreach (IFeature current in list2)
                {
                    ZDEditTools.HitTest(current, ipoint_);
                    ZDEditTools.HitTest(current, ipoint_2);
                }
                IGeometryCollection geometryCollection = topologicalOperator.Cut2(ipolyline_0);
                System.DateTime     startEditDateTime  = ZDEditTools.StartEditDateTime;
                IFeature            ifeature_          = ZDEditTools.WriteHistory(ifeature_0);
                for (int i = 0; i < geometryCollection.GeometryCount; i++)
                {
                    IGeometry shape   = geometryCollection.get_Geometry(i);
                    IFeature  feature = ZDEditTools.ZDFeatureClass.CreateFeature();
                    list.Add(feature);
                    feature.Shape = shape;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature);
                    feature.Store();
                    ZDEditTools.Oids.Add(feature.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, startEditDateTime);
                }
                ifeature_0.Delete();
            }
            return(list);
        }