Beispiel #1
0
 public void SaveEdit()
 {
     try
     {
         Editor.UniqueInstance.StartEditOperation();
         object before  = new object();
         object missing = Type.Missing;
         foreach (LinkArgs args in this._las)
         {
             if (args.PartIndex >= 0)
             {
                 IFeature            feature   = args.feature;
                 IGeometryCollection shapeCopy = feature.ShapeCopy as IGeometryCollection;
                 IPointCollection    points    = shapeCopy.get_Geometry(args.PartIndex) as IPointCollection;
                 for (int i = 0; i < this._editInfoList.Count; i++)
                 {
                     EditInfo info  = this._editInfoList[i] as EditInfo;
                     int      index = args.VertexIndex[i];
                     IPoint   p     = (info.NewPoint as IClone).Clone() as IPoint;
                     if (p.SpatialReference != (EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference)
                     {
                         p.Project((EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference);
                         p.SpatialReference = (EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference;
                     }
                     if (index == 0)
                     {
                         points.UpdatePoint(0, p);
                     }
                     else
                     {
                         points.ReplacePoints(index, 1, 1, ref p);
                     }
                 }
                 shapeCopy.RemoveGeometries(args.PartIndex, 1);
                 before = args.PartIndex;
                 shapeCopy.AddGeometry(points as IGeometry, ref before, ref missing);
                 IGeometry geometry = (IGeometry)shapeCopy;
                 feature.Shape = geometry;
                 feature.Store();
             }
         }
         Editor.UniqueInstance.StopEditOperation("Linkage Edit");
     }
     catch (Exception exception)
     {
         Editor.UniqueInstance.AbortEditOperation();
         this._mErrOpt.ErrorOperate(this._mSubSysName, "ShapeEdit.LinkageEdit", "SaveEdit", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
     }
 }