public FilterInfo(ColumnInfo col, object val, RowOperator rowOp, FilterOperator op)
 {
     Column      = col;
     Value       = val;
     RowOperator = rowOp;
     Operator    = op;
 }
Esempio n. 2
0
        public static void UpdateFeatureGeometry(IFeature ifeature_0, IGeometry igeometry_0)
        {
            ZDEditTools.StartEditDateTime = DateTime.Now;
            IFeature feature = null;
            bool     flag    = ZDEditTools.Oids.IndexOf(ifeature_0.OID) == -1;
            bool     flag1   = flag;

            if (flag)
            {
                feature = ZDEditTools.WriteHistory(ifeature_0);
            }
            try
            {
                ifeature_0.Shape = igeometry_0;
                ifeature_0.Store();
                if (flag1)
                {
                    IFeature feature1 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    RowOperator.CopyFeatureToFeature(ifeature_0, feature1);
                    ZDEditTools.Oids.Add(feature1.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 3, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            catch
            {
                if (feature != null)
                {
                    feature.Delete();
                }
            }
        }
Esempio n. 3
0
        private static void WriteDelHistoryLine(IFeature ifeature_0, IFeature ifeature_1, int int_0,
                                                System.DateTime dateTime_0)
        {
            string[] array = (ZDEditTools.ZDFeatureClass as IDataset).Name.Split(new char[]
            {
                '.'
            });
            ZDHistoryTable zDHistoryTable = new ZDHistoryTable();
            IRow           row            = ZDEditTools.ZDChangeHisInfoTable.CreateRow();

            RowOperator.SetFieldValue(row, zDHistoryTable.ChageDateFieldName, dateTime_0);
            RowOperator.SetFieldValue(row, zDHistoryTable.ChangeTypeFieldName, int_0);
            RowOperator.SetFieldValue(row, zDHistoryTable.OrigineZDOIDName, ifeature_0.OID);
            RowOperator.SetFieldValue(row, zDHistoryTable.NewZDOIDName, -1);
            if (ifeature_1 != null)
            {
                RowOperator.SetFieldValue(row, zDHistoryTable.HisZDOIDName, ifeature_1.OID);
            }
            else
            {
                RowOperator.SetFieldValue(row, zDHistoryTable.HisZDOIDName, -1);
            }
            RowOperator.SetFieldValue(row, zDHistoryTable.ZDFeatureClassName, array[array.Length - 1]);
            RowOperator.SetFieldValue(row, zDHistoryTable.ZDRegisterGuidName,
                                      ZDRegister.GetRegisterZDGuid(ZDEditTools.ZDFeatureClass));
            row.Store();
        }
Esempio n. 4
0
        public static IFeature WriteHistory(IFeature ifeature_0)
        {
            IFeature shapeCopy = ZDEditTools.ZDHisFeatureClass.CreateFeature();

            RowOperator.SetFieldValue(shapeCopy, "OriginOID_", ifeature_0.OID);
            shapeCopy.Shape = ifeature_0.ShapeCopy;
            RowOperator.CopyRowToRow(ifeature_0, shapeCopy);
            return(shapeCopy);
        }
Esempio n. 5
0
        public static bool UpdateZDAttribute(IFeature ifeature_0, string string_0, object object_0,
                                             out IFeature ifeature_1)
        {
            ZDEditTools.StartEditDateTime = DateTime.Now;
            Editor.StartEditOperation();
            IWorkspace workspace = AppConfigInfo.GetWorkspace();

            if (!WorkspaceOperator.WorkspaceIsSame(workspace, 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 flag1 = true;

            try
            {
                ifeature_0.Value[ifeature_0.Fields.FindField(string_0)] = object_0;
                ifeature_0.Store();
                if (flag)
                {
                    IFeature feature1 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    RowOperator.CopyFeatureToFeature(ifeature_0, feature1);
                    ZDEditTools.Oids.Add(feature1.OID);
                    ifeature_1 = feature1;
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 5, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (feature != null)
                {
                    feature.Delete();
                }
                flag1 = false;
                MessageBox.Show("输入数据格式错误");
                // CErrorLog.writeErrorLog(null, exception, "");
            }
            if (!WorkspaceOperator.WorkspaceIsSame(workspace, Editor.EditWorkspace as IWorkspace))
            {
                (workspace as IWorkspaceEdit).StopEditOperation();
            }
            Editor.StopEditOperation();
            return(flag1);
        }
Esempio n. 6
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. 7
0
        public static bool Register(IFeatureClass ifeatureClass_0, string string_0)
        {
            bool result;

            if (ZDRegister.IsZDFeatureClass(ifeatureClass_0))
            {
                result = false;
            }
            else
            {
                string[] array = (ifeatureClass_0 as IDataset).Name.Split(new char[]
                {
                    '.'
                });
                ZDRegisterTable   zDRegisterTable  = new ZDRegisterTable();
                ITable            table            = AppConfigInfo.OpenTable("ZDInfos");
                IFeatureWorkspace featureWorkspace = (ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace;
                string            finalName        = WorkspaceOperator.GetFinalName2(featureWorkspace as IWorkspace,
                                                                                     esriDatasetType.esriDTFeatureClass, "", array[array.Length - 1], "_His");
                IRow row = table.CreateRow();
                RowOperator.SetFieldValue(row, zDRegisterTable.FeatureClassNameField, array[array.Length - 1]);
                RowOperator.SetFieldValue(row, zDRegisterTable.ZDBHFieldName, string_0);
                RowOperator.SetFieldValue(row, zDRegisterTable.RegisterDateFieldName, System.DateTime.Now);
                RowOperator.SetFieldValue(row, zDRegisterTable.HistoryFeatureClassName, finalName);
                string workspaceConnectInfo =
                    WorkspaceOperator.GetWorkspaceConnectInfo((ifeatureClass_0 as IDataset).Workspace);
                RowOperator.SetFieldValue(row, zDRegisterTable.GDBConnectInfoName, workspaceConnectInfo);
                RowOperator.SetFieldValue(row, zDRegisterTable.GuidName, System.Guid.NewGuid().ToString());
                row.Store();
                (ifeatureClass_0 as IDataset).Name.Split(new char[]
                {
                    '.'
                });
                IFields fields = (ifeatureClass_0.Fields as IClone).Clone() as IFields;
                IField  field  = new ESRI.ArcGIS.Geodatabase.Field();
                (field as IFieldEdit).Name_2      = "OriginOID_";
                (field as IFieldEdit).AliasName_2 = "原始宗地编号";
                (field as IFieldEdit).Type_2      = esriFieldType.esriFieldTypeInteger;
                (fields as IFieldsEdit).AddField(field);
                IFeatureClass featureClass = featureWorkspace.CreateFeatureClass(finalName, fields, null, null,
                                                                                 esriFeatureType.esriFTSimple, "shape", "");
                if ((featureWorkspace as IWorkspace).Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    IVersionedObject3 versionedObject = featureClass as IVersionedObject3;
                    if (versionedObject != null)
                    {
                        versionedObject.RegisterAsVersioned3(false);
                    }
                }
                result = true;
            }
            return(result);
        }
Esempio n. 8
0
        public void Excute()
        {
            IPolygon tempLine = SketchToolAssist.TempLine as IPolygon;

            tempLine.SimplifyPreserveFromTo();
            IEnumFeature featureSelection = _context.FocusMap.FeatureSelection as IEnumFeature;

            featureSelection.Reset();
            IFeature feature   = featureSelection.Next();
            IPolygon shapeCopy = feature.ShapeCopy as IPolygon;

            if (!(shapeCopy as IRelationalOperator).Contains(tempLine))
            {
                MessageService.Current.Warn("挖空多边形必须包含原多边形!");
            }
            else
            {
                IGeometry geometry = (shapeCopy as ITopologicalOperator).Difference(tempLine);
                if (!geometry.IsEmpty)
                {
                    Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(geometry, shapeCopy);
                    Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
                    try
                    {
                        feature.Shape = geometry;
                        feature.Store();
                        if (MessageService.Current.Ask("保留挖空面吗?"))
                        {
                            if (this.int_0 == 1)
                            {
                                IFeature feature1 = RowOperator.CreatRowByRow(feature) as IFeature;
                                if (feature1 != null)
                                {
                                    Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(tempLine, shapeCopy);
                                    feature1.Shape = tempLine;
                                    feature1.Store();
                                }
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        //CErrorLog.writeErrorLog(this, exception, "");
                    }
                    Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
                    (_context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
                                                                      shapeCopy.Envelope);
                    (_context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                    _context.UpdateUI();
                }
            }
        }
Esempio n. 9
0
        public void Excute()
        {
            IPolygon     tempLine         = SketchToolAssist.TempLine as IPolygon;
            IInvalidArea invalidAreaClass = new InvalidArea()
            {
                Display = (_context.FocusMap as IActiveView).ScreenDisplay
            };

            invalidAreaClass.Add(tempLine);
            tempLine.SimplifyPreserveFromTo();
            IEnumFeature featureSelection = _context.FocusMap.FeatureSelection as IEnumFeature;

            featureSelection.Reset();
            IFeature feature = featureSelection.Next();

            if (feature != null)
            {
                IPolygon shapeCopy = feature.ShapeCopy as IPolygon;
                if (!(shapeCopy as IRelationalOperator).Disjoint(tempLine))
                {
                    IGeometry geometry = (shapeCopy as ITopologicalOperator).Difference(tempLine);
                    if (!geometry.IsEmpty)
                    {
                        invalidAreaClass.Add(feature);
                        Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(geometry, shapeCopy);
                        Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
                        try
                        {
                            feature.Shape = geometry;
                            feature.Store();
                            IGeometry geometry1 = (shapeCopy as ITopologicalOperator).Difference(geometry);
                            if (!geometry1.IsEmpty)
                            {
                                Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(geometry1, shapeCopy);
                                IFeature feature1 = RowOperator.CreatRowByRow(feature as Row) as IFeature;
                                feature1.Shape = geometry1;
                                feature1.Store();
                            }
                        }
                        catch (Exception exception)
                        {
                            CErrorLog.writeErrorLog(this, exception, "");
                        }
                        Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
                        _context.UpdateUI();
                    }
                }
            }
            invalidAreaClass.Invalidate(-2);
        }
Esempio n. 10
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. 11
0
 public static void ChangeAttribute(IFeature ifeature_0, SortedList <string, object> sortedList_0)
 {
     ZDEditTools.StartEditDateTime = DateTime.Now;
     if (ZDEditTools.Oids.IndexOf(ifeature_0.OID) == -1)
     {
         ZDEditTools.Oids.Add(ifeature_0.OID);
         IFeature feature = ZDEditTools.WriteHistory(ifeature_0);
         ZDEditTools.WriteHistoryLine(ifeature_0, feature, 5, ZDEditTools.StartEditDateTime);
     }
     foreach (KeyValuePair <string, object> sortedList0 in sortedList_0)
     {
         RowOperator.SetFieldValue(ifeature_0, sortedList0.Key, sortedList0.Value);
     }
     ifeature_0.Store();
 }
Esempio n. 12
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. 13
0
        public static IFeature Union(List <IFeature> list_0)
        {
            ITopologicalOperator4 shapeCopy = null;
            IGeometry             geometry  = null;
            List <IFeature>       features  = new List <IFeature>();

            foreach (IFeature list0 in list_0)
            {
                features.Add(ZDEditTools.WriteHistory(list0));
                if (shapeCopy != null)
                {
                    geometry  = shapeCopy.Union(list0.ShapeCopy);
                    shapeCopy = geometry as ITopologicalOperator4;
                }
                else
                {
                    shapeCopy = list0.ShapeCopy 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[] { '.' });
            ZDHistoryTable zDHistoryTable = new ZDHistoryTable();

            ZDEditTools.StartEditDateTime = DateTime.Now;
            int num = 0;

            foreach (IFeature list01 in list_0)
            {
                int num1 = num;
                num = num1 + 1;
                ZDEditTools.WriteHistoryLine(list01, feature, features[num1], 1, ZDEditTools.StartEditDateTime);
                list01.Delete();
            }
            ZDEditTools.Oids.Add(feature.OID);
            return(feature);
        }
Esempio n. 14
0
        private void MirrorCopy(IPolyline ipolyline_0)
        {
            Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
            IEnumFeature enumFeature = _context.FocusMap.FeatureSelection as IEnumFeature;

            enumFeature.Reset();
            for (IFeature feature = enumFeature.Next(); feature != null; feature = enumFeature.Next())
            {
                try
                {
                    IGeometry shape = GeometryOperator.Mirror(feature.Shape, ipolyline_0);
                    IRow      row   = RowOperator.CreatRowByRow(feature);
                    (row as IFeature).Shape = shape;
                    row.Store();
                }
                catch
                {
                }
            }
            Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
            (_context.FocusMap as IActiveView).Refresh();
        }
Esempio n. 15
0
        public override void OnMouseDown(int int_0, int int_1, int int_2, int int_3)
        {
            IFeature feature;
            int      i;
            IPoint   point;

            if (int_0 == 1)
            {
                IActiveView focusMap    = (IActiveView)_context.FocusMap;
                IPoint      anchorPoint = SketchToolAssist.AnchorPoint;
                double      mapUnits    = Common.ConvertPixelsToMapUnits(_context.FocusMap as IActiveView,
                                                                         _context.Config.EngineSnapEnvironment.SnapTolerance);
                Yutai.ArcGIS.Common.Editor.Editor.GetClosesFeature(_context.FocusMap, anchorPoint, mapUnits,
                                                                   esriGeometryType.esriGeometryPolyline, out feature);
                if (feature == null)
                {
                    MessageService.Current.Warn("没有点击的要素上,请设置较大的捕捉范围!");
                }
                else
                {
                    IPolycurve2 shape      = feature.Shape as IPolycurve2;
                    IEnvelope   envelope   = shape.Envelope;
                    object      value      = Missing.Value;
                    IHitTest    hitTest    = shape as IHitTest;
                    IPoint      pointClass = new Point();
                    double      num        = 0;
                    int         num1       = -1;
                    int         num2       = -1;
                    bool        flag       = false;
                    if (hitTest.HitTest(anchorPoint, mapUnits, esriGeometryHitPartType.esriGeometryPartBoundary,
                                        pointClass, ref num, ref num1, ref num2, ref flag))
                    {
                        Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
                        IGeometryCollection polylineClass = new Polyline() as IGeometryCollection;
                        for (i = 0; i < num1; i++)
                        {
                            polylineClass.AddGeometry((shape as IGeometryCollection).Geometry[i], ref value, ref value);
                        }
                        IPointCollection geometry  = (shape as IGeometryCollection).Geometry[num1] as IPointCollection;
                        IPointCollection pathClass = new ESRI.ArcGIS.Geometry.Path();
                        for (i = 0; i < num2 + 1; i++)
                        {
                            point = (geometry.Point[i] as IClone).Clone() as IPoint;
                            pathClass.AddPoint(point, ref value, ref value);
                        }
                        pathClass.AddPoint((pointClass as IClone).Clone() as IPoint, ref value, ref value);
                        polylineClass.AddGeometry(pathClass as IGeometry, ref value, ref value);
                        if ((polylineClass as IPointCollection).PointCount > 1)
                        {
                            Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(polylineClass as IGeometry, shape);
                            feature.Shape = polylineClass as IGeometry;
                            feature.Store();
                        }
                        pathClass = new ESRI.ArcGIS.Geometry.Path();
                        pathClass.AddPoint((pointClass as IClone).Clone() as IPoint, ref value, ref value);
                        for (i = num2 + 1; i < geometry.PointCount; i++)
                        {
                            point = (geometry.Point[i] as IClone).Clone() as IPoint;
                            pathClass.AddPoint(point, ref value, ref value);
                        }
                        polylineClass = new Polyline() as IGeometryCollection;
                        polylineClass.AddGeometry(pathClass as IGeometry, ref value, ref value);
                        for (i = num1 + 1; i < (shape as IGeometryCollection).GeometryCount; i++)
                        {
                            polylineClass.AddGeometry((shape as IGeometryCollection).Geometry[i], ref value, ref value);
                        }
                        if ((polylineClass as IPointCollection).PointCount > 1)
                        {
                            IFeature feature1 = RowOperator.CreatRowByRow(feature as Row) as IFeature;
                            Yutai.ArcGIS.Common.Editor.Editor.SetGeometryZM(polylineClass as IGeometry, shape);
                            feature1.Shape = polylineClass as IGeometry;
                            feature1.Store();
                        }
                        Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
                        (_context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
                                                                          envelope);
                        (_context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null,
                                                                          null);
                    }
                }
            }
        }
Esempio n. 16
0
        public bool UnDoChange(IFeatureClass ifeatureClass_0)
        {
            bool result;

            if (this.CanUndo(ifeatureClass_0))
            {
                string   text  = (ifeatureClass_0 as IDataset).Name;
                string[] array = text.Split(new char[]
                {
                    '.'
                });
                text = array[array.Length - 1];
                if (text.Length > 4)
                {
                    string a = text.Substring(text.Length - 4).ToLower();
                    if (a == "_his")
                    {
                        text = text.Substring(0, text.Length - 4);
                    }
                }
                string         registerZDGuid = ZDRegister.GetRegisterZDGuid(ifeatureClass_0);
                ZDHistoryTable zDHistoryTable = new ZDHistoryTable();
                string         whereClause;
                if (this.ChageType == ZDEditType.Create)
                {
                    whereClause = string.Format("{0}='{1}' and {2} in ({3})", new object[]
                    {
                        zDHistoryTable.ZDRegisterGuidName,
                        registerZDGuid,
                        zDHistoryTable.NewZDOIDName,
                        this.NewOIDs
                    });
                }
                else
                {
                    whereClause = string.Format("{0}='{1}' and {2} in ({3})", new object[]
                    {
                        zDHistoryTable.ZDRegisterGuidName,
                        registerZDGuid,
                        zDHistoryTable.OrigineZDOIDName,
                        this.OriginOIDs
                    });
                }
                IQueryFilter queryFilter = new QueryFilter();
                queryFilter.WhereClause = whereClause;
                IWorkspace workspace = AppConfigInfo.GetWorkspace();
                ITable     table     = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName);
                table.DeleteSearchedRows(queryFilter);
                string        historyZDFeatureName = ZDRegister.GetHistoryZDFeatureName(ifeatureClass_0);
                IFeatureClass featureClass         =
                    ((ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace).OpenFeatureClass(historyZDFeatureName);
                string[] array2 = this.HisOIDs.Split(new char[]
                {
                    ','
                });
                try
                {
                    if (this.ChageType != ZDEditType.Delete)
                    {
                        queryFilter             = new QueryFilter();
                        whereClause             = string.Format("{0} in ({1}) ", ifeatureClass_0.OIDFieldName, this.NewOIDs);
                        queryFilter.WhereClause = whereClause;
                        (ifeatureClass_0 as ITable).DeleteSearchedRows(queryFilter);
                    }
                }
                catch (System.Exception)
                {
                }
                int      index  = featureClass.FindField("OriginOID_");
                int      index2 = table.FindField(zDHistoryTable.NewZDOIDName);
                string[] array3 = array2;
                for (int i = 0; i < array3.Length; i++)
                {
                    string text2 = array3[i];
                    if (text2 != "-1")
                    {
                        IFeature feature  = ifeatureClass_0.CreateFeature();
                        IFeature feature2 = featureClass.GetFeature(System.Convert.ToInt32(text2));
                        int      num      = System.Convert.ToInt32(feature2.get_Value(index));
                        RowOperator.CopyFeatureToFeatureEx(feature2, feature);
                        feature2.Delete();
                        whereClause = string.Format("{0}='{1}' and {2} ={3}", new object[]
                        {
                            zDHistoryTable.ZDRegisterGuidName,
                            registerZDGuid,
                            zDHistoryTable.NewZDOIDName,
                            num
                        });
                        queryFilter.WhereClause = whereClause;
                        ICursor cursor = table.Search(queryFilter, false);
                        for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow())
                        {
                            row.set_Value(index2, feature.OID);
                            row.Store();
                        }
                        ComReleaser.ReleaseCOMObject(cursor);
                    }
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Esempio n. 17
0
        public static List <IFeature> Split(IFeature ifeature_0, IPolyline ipolyline_0)
        {
            IGeometry             geometry;
            IGeometry             geometry1;
            IFeature              feature;
            IFeature              feature1;
            List <IFeature>       features  = new List <IFeature>();
            ITopologicalOperator4 shapeCopy = ifeature_0.ShapeCopy as ITopologicalOperator4;
            IGeometry             geometry2 = shapeCopy.Intersect(ipolyline_0, esriGeometryDimension.esriGeometry0Dimension);
            List <IFeature>       features1 = new List <IFeature>();

            ZDEditTools.StartEditDateTime = DateTime.Now;
            if (geometry2.IsEmpty)
            {
                shapeCopy.Cut(ipolyline_0, out geometry, out geometry1);
                if ((geometry == null ? false : geometry1 != null))
                {
                    feature  = ZDEditTools.WriteHistory(ifeature_0);
                    feature1 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    features.Add(feature1);
                    feature1.Shape = geometry;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1);
                    feature1.Store();
                    ZDEditTools.Oids.Add(feature1.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, ZDEditTools.StartEditDateTime);
                    feature1 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    features.Add(feature1);
                    feature1.Shape = geometry1;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1);
                    feature1.Store();
                    ZDEditTools.Oids.Add(feature1.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, ZDEditTools.StartEditDateTime);
                    ifeature_0.Delete();
                }
            }
            else if ((!(geometry2 is IMultipoint) ? false : (geometry2 as IPointCollection).PointCount > 1))
            {
                ISpatialFilter spatialFilterClass = new SpatialFilter()
                {
                    Geometry   = ipolyline_0,
                    SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
                };
                IFeatureCursor featureCursor = (ifeature_0.Class as IFeatureClass).Search(spatialFilterClass, false);
                for (IFeature i = featureCursor.NextFeature(); i != null; i = featureCursor.NextFeature())
                {
                    if (i.OID != ifeature_0.OID)
                    {
                        features1.Add(i);
                    }
                }
                ComReleaser.ReleaseCOMObject(featureCursor);
                int    pointCount = (geometry2 as IPointCollection).PointCount;
                IPoint point      = (geometry2 as IPointCollection).Point[0];
                IPoint point1     = (geometry2 as IPointCollection).Point[pointCount - 1];
                foreach (IFeature feature2 in features1)
                {
                    ZDEditTools.HitTest(feature2, point);
                    ZDEditTools.HitTest(feature2, point1);
                }
                IGeometryCollection geometryCollection = shapeCopy.Cut2(ipolyline_0);
                DateTime            startEditDateTime  = ZDEditTools.StartEditDateTime;
                feature = ZDEditTools.WriteHistory(ifeature_0);
                for (int j = 0; j < geometryCollection.GeometryCount; j++)
                {
                    IGeometry geometry3 = geometryCollection.Geometry[j];
                    feature1 = ZDEditTools.ZDFeatureClass.CreateFeature();
                    features.Add(feature1);
                    feature1.Shape = geometry3;
                    RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1);
                    feature1.Store();
                    ZDEditTools.Oids.Add(feature1.OID);
                    ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, startEditDateTime);
                }
                ifeature_0.Delete();
            }
            return(features);
        }
Esempio n. 18
0
        private void ReadFieldInfo()
        {
            IDomain           domain       = null;
            ICodedValueDomain domain2      = null;
            ILayerFields      featureLayer = this.FeatureLayer as ILayerFields;

            for (int i = 0; i < featureLayer.FieldCount; i++)
            {
                string     str;
                IFieldInfo info;
                FieldInfo  info2;
                IField     field = featureLayer.get_Field(i);
                if (field.Required)
                {
                    if ((featureLayer is IFDOGraphicsLayer) && (string.Compare(field.Name, "SymbolID", true) == 0))
                    {
                        str = (field.Type == esriFieldType.esriFieldTypeString)
                            ? string.Format("(长度={0})", field.Length)
                            : "";
                        info  = featureLayer.get_FieldInfo(i);
                        info2 = new FieldInfo
                        {
                            FieldName       = "SymbolID",
                            TypeDescription = RowOperator.GetFieldTypeString(field.Type) + str,
                            IsNull          = field.IsNullable,
                            IsVisible       = info.Visible,
                            LayerFieldAlias = info.Alias
                        };
                        this.m_listInfo.Add(info2);
                        this.m_sortAliaslistInfo.Add(info2.LayerFieldAlias, info2);
                        this.m_sortnamelistInfo.Add(info2.FieldName, info2);
                    }
                }
                else if (field.Editable &&
                         ((((field.Type != esriFieldType.esriFieldTypeGeometry) &&
                            (field.Type != esriFieldType.esriFieldTypeBlob)) &&
                           (field.Type != esriFieldType.esriFieldTypeRaster)) &&
                          (field.Type != esriFieldType.esriFieldTypeOID)))
                {
                    str = (field.Type == esriFieldType.esriFieldTypeString)
                        ? string.Format("(长度={0})", field.Length)
                        : "";
                    info  = featureLayer.get_FieldInfo(i);
                    info2 = new FieldInfo
                    {
                        FieldName       = field.Name,
                        TypeDescription = RowOperator.GetFieldTypeString(field.Type) + str,
                        IsNull          = field.IsNullable,
                        IsVisible       = info.Visible,
                        LayerFieldAlias = info.Alias
                    };
                    domain = field.Domain;
                    if ((domain != null) && (domain is ICodedValueDomain))
                    {
                        domain2 = domain as ICodedValueDomain;
                        List <string> list = new List <string>();
                        if (field.IsNullable)
                        {
                            list.Add("<空>");
                        }
                        for (int j = 0; j < domain2.CodeCount; j++)
                        {
                            list.Add(domain2.get_Name(j));
                        }
                        info2.CodeDomainList = list;
                    }
                    this.m_listInfo.Add(info2);
                    this.m_sortAliaslistInfo.Add(info2.LayerFieldAlias, info2);
                    this.m_sortnamelistInfo.Add(info2.FieldName, info2);
                }
            }
        }
Esempio n. 19
0
 public void LoadParent()
 {
     this.IsLoad = true;
     try
     {
         ZDHistoryTable zDHistoryTable = new ZDHistoryTable();
         string         text           = (this.Feature.Class as IDataset).Name;
         string[]       array          = text.Split(new char[]
         {
             '.'
         });
         text = array[array.Length - 1];
         if (text.Length > 4)
         {
             string a = text.Substring(text.Length - 4).ToLower();
             if (a == "_his")
             {
                 text = text.Substring(0, text.Length - 4);
             }
         }
         string        historyZDFeatureName = ZDRegister.GetHistoryZDFeatureName(this.Feature.Class as IFeatureClass);
         string        registerZDGuid       = ZDRegister.GetRegisterZDGuid(this.Feature.Class as IFeatureClass);
         IFeatureClass ifeatureClass_       =
             ((this.Feature.Class as IDataset).Workspace as IFeatureWorkspace).OpenFeatureClass(
                 historyZDFeatureName);
         string whereClause = string.Format("{0}='{1}' and {2}={3}", new object[]
         {
             zDHistoryTable.ZDRegisterGuidName,
             registerZDGuid,
             zDHistoryTable.NewZDOIDName,
             this.OID
         });
         IQueryFilter queryFilter = new QueryFilter();
         queryFilter.WhereClause = whereClause;
         IWorkspace workspace = AppConfigInfo.GetWorkspace();
         ITable     table     = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName);
         ICursor    cursor    = table.Search(queryFilter, false);
         for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow())
         {
             ZDChangeHistoryInfo zDChangeHistoryInfo = new ZDChangeHistoryInfo();
             object fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChangeTypeFieldName);
             if (this.ChageType == ZDEditType.Unknown)
             {
                 this.ChageType = (ZDEditType)System.Convert.ToInt32(fieldValue);
             }
             fieldValue      = RowOperator.GetFieldValue(row, zDHistoryTable.ChageDateFieldName);
             this.ChangeDate = System.Convert.ToDateTime(fieldValue);
             fieldValue      = RowOperator.GetFieldValue(row, zDHistoryTable.OrigineZDOIDName);
             int oID = System.Convert.ToInt32(fieldValue);
             zDChangeHistoryInfo.Feature    = ZDChangeHistory.GetHisFeat(ifeatureClass_, oID);
             zDChangeHistoryInfo.OID        = oID;
             zDChangeHistoryInfo.TopFeat    = this.Feature;
             zDChangeHistoryInfo.SouceInfos = new System.Collections.Generic.List <ZDChangeHistoryInfo>();
             this.SouceInfos.Add(zDChangeHistoryInfo);
         }
         ComReleaser.ReleaseCOMObject(cursor);
     }
     catch (System.Exception)
     {
     }
 }
Esempio n. 20
0
        public static System.Collections.Generic.List <ZDChangeHistoryInfo2> GetZDChangeHistory(
            IFeatureClass ifeatureClass_0)
        {
            System.Collections.Generic.List <ZDChangeHistoryInfo2> list =
                new System.Collections.Generic.List <ZDChangeHistoryInfo2>();
            ZDHistoryTable zDHistoryTable = new ZDHistoryTable();
            string         text           = (ifeatureClass_0 as IDataset).Name;

            string[] array = text.Split(new char[]
            {
                '.'
            });
            text = array[array.Length - 1];
            if (text.Length > 4)
            {
                string a = text.Substring(text.Length - 4).ToLower();
                if (a == "_his")
                {
                    text = text.Substring(0, text.Length - 4);
                }
            }
            string       registerZDGuid = ZDRegister.GetRegisterZDGuid(ifeatureClass_0);
            string       whereClause    = string.Format("{0}='{1}' ", zDHistoryTable.ZDRegisterGuidName, registerZDGuid);
            IQueryFilter queryFilter    = new QueryFilter();

            queryFilter.WhereClause = whereClause;
            (queryFilter as IQueryFilterDefinition).PostfixClause = string.Format(" ORDER BY {0} desc ",
                                                                                  zDHistoryTable.ChageDateFieldName);
            try
            {
                using (ComReleaser comReleaser = new ComReleaser())
                {
                    IWorkspace workspace = AppConfigInfo.GetWorkspace();
                    ITable     table     = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName);
                    ICursor    cursor    = table.Search(queryFilter, true);
                    comReleaser.ManageLifetime(cursor);
                    IRow row = cursor.NextRow();
                    SortedList <int, ZDChangeHistoryInfo2> sortedList  = new SortedList <int, ZDChangeHistoryInfo2>();
                    SortedList <int, ZDChangeHistoryInfo2> sortedList2 = new SortedList <int, ZDChangeHistoryInfo2>();
                    while (row != null)
                    {
                        try
                        {
                            object     fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChangeTypeFieldName);
                            ZDEditType zDEditType = (ZDEditType)System.Convert.ToInt32(fieldValue);
                            fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChageDateFieldName);
                            System.DateTime changeDate = System.Convert.ToDateTime(fieldValue);
                            fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.OrigineZDOIDName);
                            int num = System.Convert.ToInt32(fieldValue);
                            fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.NewZDOIDName);
                            int num2 = System.Convert.ToInt32(fieldValue);
                            fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.HisZDOIDName);
                            int num3 = System.Convert.ToInt32(fieldValue);
                            if (num2 != -1)
                            {
                                ZDChangeHistoryInfo2 zDChangeHistoryInfo;
                                if (zDEditType == ZDEditType.Split)
                                {
                                    if (sortedList2.ContainsKey(num))
                                    {
                                        zDChangeHistoryInfo = sortedList2[num];
                                    }
                                    else
                                    {
                                        zDChangeHistoryInfo = new ZDChangeHistoryInfo2();
                                        sortedList2.Add(num, zDChangeHistoryInfo);
                                        zDChangeHistoryInfo.Add(num);
                                        zDChangeHistoryInfo.AddHis(num3);
                                        zDChangeHistoryInfo.ChangeDate = changeDate;
                                        zDChangeHistoryInfo.ChageType  = zDEditType;
                                        list.Add(zDChangeHistoryInfo);
                                    }
                                    zDChangeHistoryInfo.AddNew(num2);
                                }
                                else if (zDEditType == ZDEditType.Union)
                                {
                                    if (sortedList.ContainsKey(num2))
                                    {
                                        zDChangeHistoryInfo = sortedList[num2];
                                    }
                                    else
                                    {
                                        zDChangeHistoryInfo = new ZDChangeHistoryInfo2();
                                        sortedList.Add(num2, zDChangeHistoryInfo);
                                        zDChangeHistoryInfo.AddNew(num2);
                                        zDChangeHistoryInfo.ChangeDate = changeDate;
                                        zDChangeHistoryInfo.ChageType  = zDEditType;
                                        list.Add(zDChangeHistoryInfo);
                                    }
                                    zDChangeHistoryInfo.Add(num);
                                    zDChangeHistoryInfo.AddHis(num3);
                                }
                                else
                                {
                                    zDChangeHistoryInfo = new ZDChangeHistoryInfo2();
                                    zDChangeHistoryInfo.Add(num);
                                    zDChangeHistoryInfo.AddNew(num2);
                                    zDChangeHistoryInfo.AddHis(num3);
                                    zDChangeHistoryInfo.ChangeDate = changeDate;
                                    zDChangeHistoryInfo.ChageType  = zDEditType;
                                    list.Add(zDChangeHistoryInfo);
                                }
                                zDChangeHistoryInfo.HisOID = num3;
                            }
                            else if (num != -1 && zDEditType == ZDEditType.Delete)
                            {
                                ZDChangeHistoryInfo2 zDChangeHistoryInfo = new ZDChangeHistoryInfo2();
                                zDChangeHistoryInfo.Add(num);
                                zDChangeHistoryInfo.AddNew(num2);
                                zDChangeHistoryInfo.AddHis(num3);
                                zDChangeHistoryInfo.ChangeDate = changeDate;
                                zDChangeHistoryInfo.ChageType  = zDEditType;
                                list.Add(zDChangeHistoryInfo);
                            }
                        }
                        catch (System.Exception)
                        {
                        }
                        row = cursor.NextRow();
                    }
                }
            }
            catch (System.Exception)
            {
            }
            return(list);
        }
Esempio n. 21
0
 public override void OnMouseUp(int int_0, int int_1, int int_2, int int_3)
 {
     if (int_0 != 2 && this.bool_0)
     {
         this.bool_0 = false;
         IActiveView activeView = (IActiveView)_context.FocusMap;
         IEnvelope   envelope   = null;
         IPoint      point      = null;
         if (this.inewEnvelopeFeedback_0 == null)
         {
             point = this.ipoint_0;
         }
         else
         {
             envelope = this.inewEnvelopeFeedback_0.Stop();
             this.inewEnvelopeFeedback_0 = null;
             if (envelope.Width == 0.0 || envelope.Height == 0.0)
             {
                 point    = this.ipoint_0;
                 envelope = null;
             }
         }
         IList        list        = new ArrayList();
         IEnumFeature enumFeature = _context.FocusMap.FeatureSelection as IEnumFeature;
         enumFeature.Reset();
         IFeature            feature            = enumFeature.Next();
         IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection;
         object value = Missing.Value;
         while (feature != null)
         {
             list.Add(feature);
             geometryCollection.AddGeometry(feature.ShapeCopy, ref value, ref value);
             feature = enumFeature.Next();
         }
         IEnvelope envelope2 = (geometryCollection as IGeometryBag).Envelope;
         IPoint    point2    = new Point
         {
             X = (envelope2.XMax + envelope2.XMin) / 2.0,
             Y = (envelope2.YMax + envelope2.YMin) / 2.0
         };
         double num;
         double num2;
         if (envelope != null)
         {
             IPoint point3 = new Point
             {
                 X = (envelope.XMax + envelope.XMin) / 2.0,
                 Y = (envelope.YMax + envelope.YMin) / 2.0
             };
             num  = point2.X - point3.X;
             num2 = point2.Y - point3.Y;
             double num3 = envelope.Width / envelope2.Width;
             double num4 = envelope.Height / envelope2.Height;
             num3 = ((num3 > num4) ? num4 : num3);
             (geometryCollection as ITransform2D).Scale(point2, num3, num3);
         }
         else
         {
             num  = point2.X - point.X;
             num2 = point2.Y - point.Y;
         }
         (geometryCollection as ITransform2D).Move(-num, -num2);
         Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
         for (int i = 0; i < list.Count; i++)
         {
             feature = (list[i] as IFeature);
             try
             {
                 IFeature feature2 = RowOperator.CreatRowByRow(feature) as IFeature;
                 feature2.Shape = geometryCollection.get_Geometry(i);
                 feature2.Store();
             }
             catch (Exception exception_)
             {
                 CErrorLog.writeErrorLog(this, exception_, "");
             }
         }
         Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
         activeView.Refresh();
     }
 }
Esempio n. 22
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);
        }
Esempio n. 23
0
        public static void DoSplit(ITopology pTopology, ITopologyErrorFeature pTopoErrorFeat)
        {
            IFeatureClass class2 = (pTopology as IFeatureClassContainer).get_ClassByID(pTopoErrorFeat.OriginClassID);
            IFeatureClass class3 = null;

            try
            {
                if (pTopoErrorFeat.DestinationClassID != 0)
                {
                    class3 = (pTopology as IFeatureClassContainer).get_ClassByID(pTopoErrorFeat.DestinationClassID);
                }
            }
            catch
            {
            }
            esriTopologyRuleType topologyRuleType = pTopoErrorFeat.TopologyRuleType;

            if (((topologyRuleType == esriTopologyRuleType.esriTRTLineNoIntersection) ||
                 (topologyRuleType == esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch)) &&
                ((pTopoErrorFeat as IFeature).Shape is IPoint))
            {
                int        num;
                IFeature   feature2;
                IFeature   feature3;
                IFeature   feature   = class2.GetFeature(pTopoErrorFeat.OriginOID);
                IPolycurve shapeCopy = feature.ShapeCopy as IPolycurve;
                IPoint     shape     = (pTopoErrorFeat as IFeature).Shape as IPoint;
                IList      list      = PointSplitLine(shapeCopy, shape);
                for (num = 0; num < list.Count; num++)
                {
                    if (num == 0)
                    {
                        feature.Shape = list[num] as IGeometry;
                        feature.Store();
                    }
                    else
                    {
                        feature2       = RowOperator.CreatRowByRow(feature) as IFeature;
                        feature2.Shape = list[num] as IGeometry;
                    }
                }
                if (class3 == null)
                {
                    feature3 = class2.GetFeature(pTopoErrorFeat.DestinationOID);
                }
                else
                {
                    feature3 = class3.GetFeature(pTopoErrorFeat.DestinationOID);
                }
                shapeCopy = feature3.ShapeCopy as IPolycurve;
                list      = PointSplitLine(shapeCopy, shape);
                for (num = 0; num < list.Count; num++)
                {
                    if (num == 0)
                    {
                        feature3.Shape = list[num] as IGeometry;
                        feature3.Store();
                    }
                    else
                    {
                        feature2       = RowOperator.CreatRowByRow(feature3) as IFeature;
                        feature2.Shape = list[num] as IGeometry;
                        feature2.Store();
                    }
                }
            }
        }
Esempio n. 24
0
        private bool Do()
        {
            ListViewItem        item;
            int                 num2;
            bool                flag;
            int                 num6;
            int                 num7;
            IGeometryCollection geometrys;
            object              obj2;
            int                 num8;
            IRow                row;
            double              distance = 0.0;

            for (num2 = 0; num2 < this.listView1.Items.Count; num2++)
            {
                item = this.listView1.Items[num2];
                try
                {
                    distance += (double)item.Tag;
                }
                catch
                {
                }
            }
            double num3 = distance - this.m_pPolyline.Length;
            double num4 = 1.0;

            if (num3 != 0.0)
            {
                num4 = this.m_pPolyline.Length / distance;
            }
            Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation();
            int count = this.listView1.Items.Count;

            item = this.listView1.Items[count - 1];
            try
            {
                if (((double)item.Tag) == 0.0)
                {
                    count--;
                }
            }
            catch
            {
                count--;
            }
            if (this.rdoStartType.SelectedIndex == 0)
            {
                for (num2 = 0; num2 < count; num2++)
                {
                    item     = this.listView1.Items[num2];
                    distance = (double)item.Tag;
                    if (distance != 0.0)
                    {
                        distance *= num4;
                        this.m_pPolyline.SplitAtDistance(distance, false, true, out flag, out num6, out num7);
                        if (flag)
                        {
                            geometrys = new PolylineClass();
                            obj2      = Missing.Value;
                            num8      = 0;
                            while (num8 < num6)
                            {
                                geometrys.AddGeometry((this.m_pPolyline as IGeometryCollection).get_Geometry(num8),
                                                      ref obj2, ref obj2);
                                num8++;
                            }
                            if (num2 == 0)
                            {
                                this.m_pFeature.Shape = geometrys as IGeometry;
                                this.m_pFeature.Store();
                            }
                            else
                            {
                                row = RowOperator.CreatRowByRow(this.m_pFeature);
                                (row as IFeature).Shape = geometrys as IGeometry;
                                row.Store();
                            }
                            (this.m_pPolyline as IGeometryCollection).RemoveGeometries(0, num6);
                        }
                    }
                }
                if (!this.m_pPolyline.IsEmpty)
                {
                    row = RowOperator.CreatRowByRow(this.m_pFeature);
                    (row as IFeature).Shape = this.m_pPolyline;
                    row.Store();
                }
            }
            else
            {
                for (num2 = count - 1; num2 >= 0; num2--)
                {
                    try
                    {
                        item     = this.listView1.Items[num2];
                        distance = (double)item.Tag;
                        if (distance != 0.0)
                        {
                            distance *= num4;
                            this.m_pPolyline.SplitAtDistance(distance, false, true, out flag, out num6, out num7);
                            if (flag)
                            {
                                geometrys = new PolylineClass();
                                obj2      = Missing.Value;
                                for (num8 = 0; num8 < num6; num8++)
                                {
                                    geometrys.AddGeometry((this.m_pPolyline as IGeometryCollection).get_Geometry(num8),
                                                          ref obj2, ref obj2);
                                }
                                if (num2 == (count - 1))
                                {
                                    this.m_pFeature.Shape = geometrys as IGeometry;
                                    this.m_pFeature.Store();
                                }
                                else
                                {
                                    row = RowOperator.CreatRowByRow(this.m_pFeature);
                                    (row as IFeature).Shape = geometrys as IGeometry;
                                    row.Store();
                                }
                                (this.m_pPolyline as IGeometryCollection).RemoveGeometries(0, num6);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                if (!this.m_pPolyline.IsEmpty)
                {
                    row = RowOperator.CreatRowByRow(this.m_pFeature);
                    (row as IFeature).Shape = this.m_pPolyline;
                    row.Store();
                }
            }
            Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation();
            return(true);
        }
Esempio n. 25
0
 public void HandleCommandParameter(string string_0)
 {
     if (string_0.Length != 0)
     {
         if (string_0.Length == 1)
         {
             string text = string_0.ToUpper();
             if (text != null)
             {
                 if (!(text == "N"))
                 {
                     if (!(text == "P"))
                     {
                         if (!(text == "B"))
                         {
                             if (text == "I")
                             {
                                 _context.ShowCommandString("输入点:", CommandTipsType.CTTCommandTip);
                                 this.int_0 = 1;
                                 return;
                             }
                             if (!(text == "D"))
                             {
                                 if (text == "E")
                                 {
                                     this.ifeature_0         = null;
                                     this.ipointCollection_0 = null;
                                     this.int_2           = 0;
                                     _context.CurrentTool = null;
                                     (_context.FocusMap as IActiveView).Refresh();
                                 }
                             }
                             else
                             {
                                 this.ipointCollection_0.RemovePoints(this.int_2, 1);
                                 if (this.int_2 == this.ipointCollection_0.PointCount)
                                 {
                                     this.int_2--;
                                 }
                                 Yutai.ArcGIS.Common.Editor.Editor.StartEditOperation(
                                     this.ifeature_0.Class as IDataset);
                                 this.ifeature_0.Shape = (this.ipointCollection_0 as IGeometry);
                                 this.ifeature_0.Store();
                                 Yutai.ArcGIS.Common.Editor.Editor.StopEditOperation(
                                     this.ifeature_0.Class as IDataset);
                                 this.ZoomToCenter();
                             }
                         }
                         else
                         {
                             if (this.ipointCollection_0 is IPolyline && this.int_2 > 0 &&
                                 this.int_2 < this.ipointCollection_0.PointCount - 1)
                             {
                                 Yutai.ArcGIS.Common.Editor.Editor.StartEditOperation(
                                     this.ifeature_0.Class as IDataset);
                                 try
                                 {
                                     IPoint           point            = this.ipointCollection_0.get_Point(this.int_2);
                                     GeometryOperator geometryOperator =
                                         GeometryOperatorFectory.CreateGeometryOperator(
                                             this.ipointCollection_0 as IGeometry);
                                     IGeometryBag geometryBag;
                                     geometryOperator.SplitAtPoint(point, out geometryBag);
                                     if (geometryBag != null)
                                     {
                                         try
                                         {
                                             this.ifeature_0.Shape =
                                                 (geometryBag as IGeometryCollection).get_Geometry(0);
                                             this.ifeature_0.Store();
                                             this.ipointCollection_0 =
                                                 (this.ifeature_0.Shape as IPointCollection);
                                             this.int_2 = 0;
                                             this.ShowCommand();
                                             for (int i = 1;
                                                  i < (geometryBag as IGeometryCollection).GeometryCount;
                                                  i++)
                                             {
                                                 IRow row = RowOperator.CreatRowByRow(this.ifeature_0);
                                                 (row as IFeature).Shape =
                                                     (geometryBag as IGeometryCollection).get_Geometry(i);
                                                 row.Store();
                                             }
                                         }
                                         catch (Exception ex)
                                         {
                                             CErrorLog.writeErrorLog(this, ex, "");
                                         }
                                     }
                                 }
                                 catch (Exception ex)
                                 {
                                     System.Windows.Forms.MessageBox.Show(ex.Message);
                                 }
                                 Yutai.ArcGIS.Common.Editor.Editor.StopEditOperation(
                                     this.ifeature_0.Class as IDataset);
                             }
                             this.ZoomToCenter();
                         }
                     }
                     else
                     {
                         if (this.int_2 > 0)
                         {
                             this.int_2--;
                         }
                         this.ZoomToCenter();
                     }
                 }
                 else
                 {
                     if (this.int_2 < this.ipointCollection_0.PointCount - 1)
                     {
                         this.int_2++;
                     }
                     this.ZoomToCenter();
                 }
             }
         }
         if (this.int_0 == 1)
         {
             try
             {
                 this.int_0 = 0;
                 string[] array = string_0.Split(new char[]
                 {
                     ','
                 });
                 IPoint point = new ESRI.ArcGIS.Geometry.Point();
                 if (array.Length >= 2)
                 {
                     double x = Convert.ToDouble(array[0]);
                     double y = Convert.ToDouble(array[1]);
                     point.PutCoords(x, y);
                     if (array.Length >= 3)
                     {
                         double z = Convert.ToDouble(array[2]);
                         point.Z = z;
                     }
                     object obj   = 0;
                     object value = Missing.Value;
                     if (this.int_2 == this.ipointCollection_0.PointCount - 1)
                     {
                         obj = this.int_2 - 1;
                     }
                     else
                     {
                         obj = this.int_2;
                     }
                     this.ipointCollection_0.AddPoint(point, ref value, ref obj);
                     Yutai.ArcGIS.Common.Editor.Editor.StartEditOperation(this.ifeature_0.Class as IDataset);
                     this.ifeature_0.Shape = (this.ipointCollection_0 as IGeometry);
                     this.ifeature_0.Store();
                     Yutai.ArcGIS.Common.Editor.Editor.StopEditOperation(this.ifeature_0.Class as IDataset);
                     this.ZoomToCenter();
                 }
                 else
                 {
                     _context.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                 }
             }
             catch
             {
                 _context.ShowCommandString("输入不正确", CommandTipsType.CTTLog);
                 return;
             }
         }
         this.ShowCommand();
     }
 }