Пример #1
0
 public static void StartEditing()
 {
     if (EditorEvent.OnStartEditing != null)
     {
         EditorEvent.OnStartEditing();
     }
 }
Пример #2
0
 public static void FeatureGeometryChanged(IFeature ifeature_0)
 {
     if (EditorEvent.OnFeatureGeometryChanged != null)
     {
         EditorEvent.OnFeatureGeometryChanged(ifeature_0);
     }
 }
Пример #3
0
 public static void NewRow(IRow irow_0)
 {
     if (EditorEvent.OnNewRow != null)
     {
         EditorEvent.OnNewRow(irow_0);
     }
 }
Пример #4
0
 public static void EditLayerChange(IFeatureLayer ifeatureLayer_0)
 {
     if (EditorEvent.OnEditLayerChange != null)
     {
         EditorEvent.OnEditLayerChange(ifeatureLayer_0);
     }
 }
Пример #5
0
 public static void EditTempalateChange(YTEditTemplate jlkeditTemplate_0)
 {
     if (EditorEvent.OnEditTemplateChange != null)
     {
         EditorEvent.OnEditTemplateChange(jlkeditTemplate_0);
     }
 }
Пример #6
0
 public static void CancelEditing()
 {
     if (EditorEvent.OnCancelEditing != null)
     {
         EditorEvent.OnCancelEditing();
     }
 }
Пример #7
0
 public static void DeleteFeature(ILayer ilayer_0, int int_0)
 {
     if (EditorEvent.OnDeleteFeature != null)
     {
         EditorEvent.OnDeleteFeature(ilayer_0, int_0);
     }
 }
Пример #8
0
 public static void AddFeature(ILayer ilayer_0, IFeature ifeature_0)
 {
     if (EditorEvent.OnAddFeature != null)
     {
         EditorEvent.OnAddFeature(ilayer_0, ifeature_0);
     }
 }
Пример #9
0
 public static void BeginStopEditing()
 {
     if (EditorEvent.OnBeginStopEditing != null)
     {
         EditorEvent.OnBeginStopEditing();
     }
 }
Пример #10
0
        public static void SetGeometry(IGeometry pGeometry, IFeature pFeature)
        {
            double        num;
            double        num1;
            IFeatureClass @class = pFeature.Class as IFeatureClass;

            try
            {
                int          num2        = @class.FindField(@class.ShapeFieldName);
                IGeometryDef geometryDef = @class.Fields.Field[num2].GeometryDef;
                if (!geometryDef.HasZ)
                {
                    ((IZAware)pGeometry).ZAware = false;
                }
                else
                {
                    ((IZAware)pGeometry).ZAware = true;
                    if (pGeometry is IZ)
                    {
                        IZ igeometry0 = (IZ)pGeometry;
                        geometryDef.SpatialReference.GetZDomain(out num, out num1);
                        igeometry0.SetConstantZ(num);
                    }
                    else if (pGeometry is IPoint)
                    {
                        geometryDef.SpatialReference.GetZDomain(out num, out num1);
                        (pGeometry as IPoint).Z = num;
                    }
                }
                if (!geometryDef.HasM)
                {
                    ((IMAware)pGeometry).MAware = false;
                }
                else
                {
                    ((IMAware)pGeometry).MAware = true;
                }
                IFeature feature = @class.CreateFeature();
                (pGeometry as ITopologicalOperator6).SimplifyAsFeature();
                feature.Shape = pGeometry;
                try
                {
                    ((IRowSubtypes)feature).InitDefaultValues();
                }
                catch (Exception exception)
                {
                    Logger.Current.Error("", exception, null);
                }
                EditorEvent.NewRow(feature);
                feature.Store();
            }
            catch (COMException cOMException)
            {
                Logger.Current.Error("", cOMException, null);
            }
            catch (Exception exception1)
            {
                Logger.Current.Error("", exception1, null);
            }
        }
Пример #11
0
 public static void CreateDimensionFeature(IDimensionShape pDimensionShape, esriDimensionType pDimensionType,
                                           IActiveView pActiveView, IFeatureLayer pFeatureLayer)
 {
     if (pDimensionShape != null)
     {
         IWorkspaceEdit workspace = (IWorkspaceEdit)((IDataset)pFeatureLayer.FeatureClass).Workspace;
         workspace.StartEditOperation();
         IFeature     esriDimensionType0 = pFeatureLayer.FeatureClass.CreateFeature();
         IRowSubtypes rowSubtype         = (IRowSubtypes)esriDimensionType0;
         try
         {
             rowSubtype.InitDefaultValues();
         }
         catch (Exception exception)
         {
             //Logger.Current.Error("",exception, "");
             Logger.Current.Warn(exception.Message);
         }
         (esriDimensionType0 as IDimensionFeature).DimensionType  = pDimensionType;
         (esriDimensionType0 as IDimensionFeature).DimensionShape = pDimensionShape;
         EditorEvent.NewRow(esriDimensionType0);
         esriDimensionType0.Store();
         workspace.StopEditOperation();
         EditorEvent.AfterNewRow(esriDimensionType0);
         pActiveView.FocusMap.ClearSelection();
         pActiveView.FocusMap.SelectFeature(pFeatureLayer, esriDimensionType0);
         pActiveView.Refresh();
     }
 }
Пример #12
0
        public static int CreateFeature(IGeometry pGeometry, IFeatureClass pFeatureClass)
        {
            double num;
            double num1;
            int    oID;

            try
            {
                if ((pGeometry == null ? false : pFeatureClass != null))
                {
                    int          num2        = pFeatureClass.FindField(pFeatureClass.ShapeFieldName);
                    IGeometryDef geometryDef = pFeatureClass.Fields.Field[num2].GeometryDef;
                    if (geometryDef.HasZ)
                    {
                        ((IZAware)pGeometry).ZAware = true;
                        if (pGeometry is IZ)
                        {
                            IZ igeometry0 = (IZ)pGeometry;
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            igeometry0.SetConstantZ(num);
                        }
                        else if (pGeometry is IPoint)
                        {
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            (pGeometry as IPoint).Z = num;
                        }
                    }
                    if (geometryDef.HasM)
                    {
                        ((IMAware)pGeometry).MAware = true;
                    }
                    IFeature feature = pFeatureClass.CreateFeature();
                    feature.Shape = pGeometry;
                    try
                    {
                        ((IRowSubtypes)feature).InitDefaultValues();
                    }
                    catch (Exception exception)
                    {
                        Logger.Current.Error("", exception, null);
                    }
                    EditorEvent.NewRow(feature);
                    feature.Store();
                    EditorEvent.AfterNewRow(feature);
                    oID = feature.OID;
                    return(oID);
                }
            }
            catch (Exception exception1)
            {
                Logger.Current.Error("", exception1, null);
            }
            oID = -1;
            return(oID);
        }
Пример #13
0
        public static void CreateFeature2(IGeometry pGeometry, IFeatureClass pFeatureClass)
        {
            double num;
            double num1;

            if (pGeometry != null && !pGeometry.IsEmpty)
            {
                pGeometry.Envelope.Expand(10, 10, false);
                try
                {
                    int          num2        = pFeatureClass.FindField(pFeatureClass.ShapeFieldName);
                    IGeometryDef geometryDef = pFeatureClass.Fields.Field[num2].GeometryDef;
                    if (geometryDef.HasZ)
                    {
                        ((IZAware)pGeometry).ZAware = true;
                        if (pGeometry is IZ)
                        {
                            IZ igeometry0 = (IZ)pGeometry;
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            igeometry0.SetConstantZ(num);
                        }
                        else if (pGeometry is IPoint)
                        {
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            (pGeometry as IPoint).Z = num;
                        }
                    }
                    if (geometryDef.HasM)
                    {
                        ((IMAware)pGeometry).MAware = true;
                    }
                    IFeature feature = pFeatureClass.CreateFeature();
                    feature.Shape = pGeometry;
                    try
                    {
                        ((IRowSubtypes)feature).InitDefaultValues();
                    }
                    catch (Exception exception)
                    {
                        Logger.Current.Error("", exception, null);
                    }
                    EditorEvent.NewRow(feature);
                    feature.Store();
                }
                catch (COMException cOMException)
                {
                    Logger.Current.Error("", cOMException, null);
                }
                catch (Exception exception1)
                {
                    Logger.Current.Error("", exception1, null);
                }
            }
        }
Пример #14
0
        public static void CreateFeature(IGeometry pGeometry, IActiveView pActiveView, IFeatureLayer pFeatureLayer,
                                         bool IsClearSelection)
        {
            double    num;
            double    num1;
            Exception exception;

            if (pGeometry != null && !pGeometry.IsEmpty)
            {
                IEnvelope envelope = pGeometry.Envelope;
                envelope.Expand(10, 10, false);
                try
                {
                    pGeometry.SpatialReference = pActiveView.FocusMap.SpatialReference;
                    int          num2        = pFeatureLayer.FeatureClass.FindField(pFeatureLayer.FeatureClass.ShapeFieldName);
                    IGeometryDef geometryDef = pFeatureLayer.FeatureClass.Fields.Field[num2].GeometryDef;
                    if (geometryDef.HasZ)
                    {
                        ((IZAware)pGeometry).ZAware = true;
                        if (pGeometry is IZ)
                        {
                            IZ igeometry0 = (IZ)pGeometry;
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            igeometry0.SetConstantZ(num);
                        }
                        else if (pGeometry is IPoint)
                        {
                            geometryDef.SpatialReference.GetZDomain(out num, out num1);
                            (pGeometry as IPoint).Z = num;
                        }
                    }
                    if (geometryDef.HasM)
                    {
                        ((IMAware)pGeometry).MAware = true;
                    }
                    IWorkspaceEdit workspace = (IWorkspaceEdit)((IDataset)pFeatureLayer.FeatureClass).Workspace;
                    workspace.StartEditOperation();
                    IFeature feature = pFeatureLayer.FeatureClass.CreateFeature();
                    feature.Shape = pGeometry;
                    try
                    {
                        ((IRowSubtypes)feature).InitDefaultValues();
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        Logger.Current.Error(exception.Message);
                    }
                    if (Editor.CurrentEditTemplate != null)
                    {
                        Editor.CurrentEditTemplate.SetFeatureValue(feature);
                    }
                    EditorEvent.NewRow(feature);
                    feature.Store();
                    workspace.StopEditOperation();
                    EditorEvent.AfterNewRow(feature);
                    if (IsClearSelection)
                    {
                        if (pActiveView.FocusMap.SelectionCount > 0)
                        {
                            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                            pActiveView.FocusMap.ClearSelection();
                            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                        }
                    }
                    pActiveView.FocusMap.SelectFeature(pFeatureLayer, feature);
                    if (pGeometry.GeometryType != esriGeometryType.esriGeometryPoint)
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, envelope);
                    }
                    else
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, envelope);
                    }
                    if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, envelope);
                    }
                }
                catch (COMException cOMException1)
                {
                    COMException cOMException = cOMException1;
                    if (cOMException.ErrorCode != -2147220936)
                    {
                        MessageBox.Show(cOMException.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        MessageBox.Show("几何坐标超出边界!", "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    if (pGeometry.GeometryType != esriGeometryType.esriGeometryPoint)
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, envelope);
                    }
                    else
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, null);
                    }
                    Logger.Current.Error("", cOMException, null);
                }
                catch (Exception exception2)
                {
                    exception = exception2;
                    Logger.Current.Error("", exception, null);
                    if (pGeometry.GeometryType != esriGeometryType.esriGeometryPoint)
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, envelope);
                    }
                    else
                    {
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, null);
                    }
                    MessageBox.Show(exception.Message);
                }
            }
        }