public void play(FeaturesContainer featuresContainer) { if (operationType == UndoElementType.DeletePolylinePoint) { Debug.Assert(point != null); PolylineFeature polyline = (PolylineFeature)featuresContainer.getFeature(featureIndex); polyline.m_oParts[partIndex].Points.Insert(pointIndex, point); point.Selected = false; featuresContainer.boundsDirty(); } else if (operationType == UndoElementType.DeletePolylinePart) { Debug.Assert(part != null); PolylineFeature polyline = (PolylineFeature)featuresContainer.getFeature(featureIndex); polyline.m_oParts.Insert(partIndex, part); featuresContainer.boundsDirty(); } else if (operationType == UndoElementType.DeleteFeature) { Debug.Assert(feature != null); featuresContainer.insertFeature(featureIndex, feature); feature.Selected = false; featuresContainer.boundsDirty(); } else if (operationType == UndoElementType.MovePolylinePoint) { Debug.Assert(point != null); point.X = originalPoint.X; point.Y = originalPoint.Y; point.Selected = false; featuresContainer.boundsDirty(); // TODO: use featuresContainer to modify contents } else if (operationType == UndoElementType.MoveFeature) { Debug.Assert(feature != null); // undo feature move if (feature is SymbolFeature) { SymbolFeature sf = (SymbolFeature)feature; Debug.Assert(originalFeature is SymbolFeature); sf.x = ((SymbolFeature)originalFeature).x; sf.y = ((SymbolFeature)originalFeature).y; } } else if (operationType == UndoElementType.InsertFeature) { featuresContainer.removeFeature(featureIndex); } else throw new Exception("Internal error."); }
public UndoManager(FeaturesContainer featuresContainer) { if (featuresContainer == null) throw new Exception("Invalid parameter"); this.featuresContainer = featuresContainer; }
internal void setParentContainer(FeaturesContainer layer) { parentContainer = layer; }