Exemple #1
0
 public static void FireEndZDEdit()
 {
     if (ZDEditTools.OnEndZDEdit != null)
     {
         ZDEditTools.OnEndZDEdit();
     }
 }
Exemple #2
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();
                }
            }
        }
Exemple #3
0
 public static void FireStartZDEdit()
 {
     if (ZDEditTools.OnStartZDEdit != null)
     {
         ZDEditTools.OnStartZDEdit();
     }
 }
Exemple #4
0
 public static void FireAfterCreateZD(IRow irow_0)
 {
     if (ZDEditTools.OnAfterCreateZD != null)
     {
         ZDEditTools.OnAfterCreateZD(irow_0);
     }
 }
Exemple #5
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);
     }
 }
Exemple #6
0
        private static void DeleteZD(IFeature ifeature_0)
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            IFeature ifeature_ = ZDEditTools.WriteHistory(ifeature_0);

            ZDEditTools.WriteDelHistoryLine(ifeature_0, ifeature_, 4, ZDEditTools.StartEditDateTime);
            ifeature_0.Delete();
        }
Exemple #7
0
 public static void DeletedSelectedZD(ICursor icursor_0)
 {
     new System.Collections.Generic.List <IFeature>();
     for (IRow row = icursor_0.NextRow(); row != null; row = icursor_0.NextRow())
     {
         ZDEditTools.DeleteZD(row as IFeature);
     }
 }
Exemple #8
0
 public static IFeature Union(ICursor icursor_0)
 {
     System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>();
     for (IRow row = icursor_0.NextRow(); row != null; row = icursor_0.NextRow())
     {
         list.Add(row as IFeature);
     }
     return(ZDEditTools.Union(list));
 }
Exemple #9
0
 public static void StopZDEdit()
 {
     ZDEditTools.Oids.Clear();
     Editor.Editor.SaveEditing();
     ZDEditTools.ZDFeatureLayer    = null;
     ZDEditTools.ZDFeatureClass    = null;
     ZDEditTools.ZDHisFeatureClass = null;
     ZDEditTools.FireEndZDEdit();
 }
Exemple #10
0
        private static bool CheckLayerIsCanEditZD(IFeatureLayer ifeatureLayer_0)
        {
            bool result;

            if (result = ZDEditTools.LayerCanEdit(ifeatureLayer_0))
            {
                result = ZDRegister.IsZDFeatureClass(ifeatureLayer_0.FeatureClass);
            }
            return(result);
        }
Exemple #11
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);
        }
Exemple #12
0
        public static IFeature Union(IFeatureSelection ifeatureSelection_0)
        {
            ICursor cursor = null;

            ifeatureSelection_0.SelectionSet.Search(null, false, out cursor);
            IFeature result = ZDEditTools.Union(cursor);

            ComReleaser.ReleaseCOMObject(cursor);
            cursor = null;
            return(result);
        }
Exemple #13
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);
        }
Exemple #14
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();
 }
Exemple #15
0
        public static System.Collections.Generic.List <IFeature> Split(IFeatureSelection ifeatureSelection_0,
                                                                       IPolyline ipolyline_0)
        {
            ICursor cursor;

            ifeatureSelection_0.SelectionSet.Search(null, false, out cursor);
            IFeature feature = cursor.NextRow() as IFeature;

            ComReleaser.ReleaseCOMObject(cursor);
            System.Collections.Generic.List <IFeature> result = new System.Collections.Generic.List <IFeature>();
            if (feature != null)
            {
                result = ZDEditTools.Split(feature, ipolyline_0);
            }
            return(result);
        }
Exemple #16
0
        public static void StartZDEdit()
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            IMap editMap = Editor.Editor.EditMap;

            System.Collections.Generic.List <IFeatureLayer> list = new System.Collections.Generic.List <IFeatureLayer>();
            for (int i = 0; i < editMap.LayerCount; i++)
            {
                ILayer layer = editMap.get_Layer(i);
                if (layer is IGroupLayer)
                {
                    ZDEditTools.CheckGroupLayerEdit(list, layer as ICompositeLayer);
                }
                else if (layer is IFeatureLayer)
                {
                    IFeatureLayer featureLayer = layer as IFeatureLayer;
                    if (ZDEditTools.CheckLayerIsCanEditZD(featureLayer))
                    {
                        list.Add(featureLayer);
                    }
                }
            }
            if (list.Count == 0)
            {
                System.Windows.Forms.MessageBox.Show("当前没有可编辑的宗地图层!");
            }
            else if (list.Count == 1)
            {
                ZDEditTools.ZDFeatureLayer    = list[0];
                ZDEditTools.ZDFeatureClass    = ZDEditTools.ZDFeatureLayer.FeatureClass;
                ZDEditTools.ZDHisFeatureClass = ZDRegister.GetHistoryFeatureClass(ZDEditTools.ZDFeatureClass);
                ZDEditTools.FireStartZDEdit();
            }
            else
            {
                frmSelectEditZD frmSelectEditZD = new frmSelectEditZD();
                frmSelectEditZD.FeatureLayers = list;
                if (frmSelectEditZD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ZDEditTools.ZDFeatureLayer    = frmSelectEditZD.SelectFeatureLayer;
                    ZDEditTools.ZDFeatureClass    = ZDEditTools.ZDFeatureLayer.FeatureClass;
                    ZDEditTools.ZDHisFeatureClass = ZDRegister.GetHistoryFeatureClass(ZDEditTools.ZDFeatureClass);
                    ZDEditTools.FireStartZDEdit();
                }
            }
        }
Exemple #17
0
        public static void DeletedSelectedZD(IMap imap_0, IFeatureLayer ifeatureLayer_0)
        {
            Editor.Editor.StartEditOperation();
            IWorkspace workspace = AppConfigInfo.GetWorkspace();

            if (!WorkspaceOperator.WorkspaceIsSame(workspace, Editor.Editor.EditWorkspace as IWorkspace))
            {
                (workspace as IWorkspaceEdit).StartEditOperation();
            }
            ZDEditTools.DeletedSelectedZD(ifeatureLayer_0 as IFeatureSelection);
            if (!WorkspaceOperator.WorkspaceIsSame(workspace, Editor.Editor.EditWorkspace as IWorkspace))
            {
                (workspace as IWorkspaceEdit).StopEditOperation();
            }
            Editor.Editor.StopEditOperation();
            imap_0.ClearSelection();
            (imap_0 as IActiveView).Refresh();
        }
Exemple #18
0
 private static void CheckGroupLayerEdit(System.Collections.Generic.List <IFeatureLayer> list_0,
                                         ICompositeLayer icompositeLayer_0)
 {
     for (int i = 0; i < icompositeLayer_0.Count; i++)
     {
         ILayer layer = icompositeLayer_0.get_Layer(i);
         if (layer is IGroupLayer)
         {
             ZDEditTools.CheckGroupLayerEdit(list_0, layer as ICompositeLayer);
         }
         else if (layer is IFeatureLayer)
         {
             IFeatureLayer featureLayer = layer as IFeatureLayer;
             if (ZDEditTools.CheckLayerIsCanEditZD(featureLayer))
             {
                 list_0.Add(featureLayer);
             }
         }
     }
 }
Exemple #19
0
 private static void CheckGroupLayer(System.Collections.Generic.List <IFeatureLayer> list_0,
                                     ICompositeLayer icompositeLayer_0)
 {
     for (int i = 0; i < icompositeLayer_0.Count; i++)
     {
         ILayer layer = icompositeLayer_0.get_Layer(i);
         if (layer is IGroupLayer)
         {
             ZDEditTools.CheckGroupLayer(list_0, layer as ICompositeLayer);
         }
         else if (layer is IFeatureLayer)
         {
             IFeatureLayer item = layer as IFeatureLayer;
             if (ZDRegister.IsZDFeatureClass((layer as IFeatureLayer).FeatureClass))
             {
                 list_0.Add(item);
             }
         }
     }
 }
Exemple #20
0
 public static System.Collections.Generic.List <IFeatureLayer> GetZDLayers(IMap imap_0)
 {
     System.Collections.Generic.List <IFeatureLayer> list = new System.Collections.Generic.List <IFeatureLayer>();
     for (int i = 0; i < imap_0.LayerCount; i++)
     {
         ILayer layer = imap_0.get_Layer(i);
         if (layer is IGroupLayer)
         {
             ZDEditTools.CheckGroupLayer(list, layer as ICompositeLayer);
         }
         else if (layer is IFeatureLayer)
         {
             IFeatureLayer item = layer as IFeatureLayer;
             if (ZDRegister.IsZDFeatureClass((layer as IFeatureLayer).FeatureClass))
             {
                 list.Add(item);
             }
         }
     }
     return(list);
 }
Exemple #21
0
        public static void DeletedSelectedZD(IFeatureSelection ifeatureSelection_0)
        {
            IEnumIDs iDs = ifeatureSelection_0.SelectionSet.IDs;

            iDs.Reset();
            int i = iDs.Next();

            System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>();
            IFeatureClass featureClass = (ifeatureSelection_0 as IFeatureLayer).FeatureClass;

            while (i > 0)
            {
                IFeature feature = featureClass.GetFeature(i);
                list.Add(feature);
                i = iDs.Next();
            }
            foreach (IFeature current in list)
            {
                ZDEditTools.DeleteZD(current);
            }
        }
Exemple #22
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);
        }
Exemple #23
0
        public static System.Collections.Generic.List <IFeature> Split(IFeatureClass ifeatureClass_0,
                                                                       IPolyline ipolyline_0)
        {
            IFeatureCursor featureCursor = ifeatureClass_0.Search(new SpatialFilter
            {
                Geometry   = ipolyline_0,
                SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
            }, false);
            IFeature feature = featureCursor.NextFeature();

            System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>();
            while (feature != null)
            {
                System.Collections.Generic.List <IFeature> list2 = ZDEditTools.Split(feature, ipolyline_0);
                if (list2.Count > 0)
                {
                    list.AddRange(list2);
                }
                feature = featureCursor.NextFeature();
            }
            ComReleaser.ReleaseCOMObject(featureCursor);
            return(list);
        }
Exemple #24
0
 public static void Delete(IFeature ifeature_0)
 {
     ZDEditTools.DeleteZD(ifeature_0);
 }
Exemple #25
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);
        }
Exemple #26
0
 static ZDEditTools()
 {
     // 注意: 此类型已标记为 'beforefieldinit'.
     ZDEditTools.old_acctor_mc();
 }