/// <summary> /// Clones the polygon container and most of the asssociated data. /// </summary> public PolygonContainer Clone() { // Create a new polygon container PolygonContainer clonedContainer = new PolygonContainer(); // Clone the polygons foreach (Polygon polygon in Polygons) { // Clone the polygon Polygon clonePolygon = polygon.Clone(); // Restore the original ID clonePolygon.ID = polygon.ID; // Add the polygon to the container clonedContainer.Polygons.Add(clonePolygon); } // Clone the lines foreach (Line line in Lines) { // Clone the line Line cloneLine = line.Clone(); // Restore the original ID cloneLine.ID = line.ID; // Add the line to the container clonedContainer.Lines.Add(cloneLine); } // Clone the ellipses foreach (Ellipse ellipse in Ellipses) { // Clone the ellipse Ellipse cloneEllipse = ellipse.Clone(); // Restore the original ID cloneEllipse.ID = ellipse.ID; // Add the ellipse to the container clonedContainer.Ellipses.Add(cloneEllipse); } // Clone the polygon times foreach (double time in PolygonTimes) { clonedContainer.PolygonTimes.Add(time); } // Clone the line times foreach (double time in LineTimes) { clonedContainer.LineTimes.Add(time); } // Clone the ellipse times foreach (double time in EllipseTimes) { clonedContainer.EllipseTimes.Add(time); } // Copy the width and height clonedContainer.Width = Width; clonedContainer.Height = Height; // Making a copy of the Editor capability reference clonedContainer.EditorCapabilities = EditorCapabilities; return(clonedContainer); }
/// <summary> /// Clones the polygon container and most of the asssociated data. /// </summary> public PolygonContainer Clone() { // Create a new polygon container PolygonContainer clonedContainer = new PolygonContainer(); // Clone the polygons foreach (Polygon polygon in Polygons) { // Clone the polygon Polygon clonePolygon = polygon.Clone(); // Restore the original ID clonePolygon.ID = polygon.ID; // Add the polygon to the container clonedContainer.Polygons.Add(clonePolygon); } // Clone the lines foreach (Line line in Lines) { // Clone the line Line cloneLine = line.Clone(); // Restore the original ID cloneLine.ID = line.ID; // Add the line to the container clonedContainer.Lines.Add(cloneLine); } // Clone the ellipses foreach (Ellipse ellipse in Ellipses) { // Clone the ellipse Ellipse cloneEllipse = ellipse.Clone(); // Restore the original ID cloneEllipse.ID = ellipse.ID; // Add the ellipse to the container clonedContainer.Ellipses.Add(cloneEllipse); } // Clone the polygon times foreach (double time in PolygonTimes) { clonedContainer.PolygonTimes.Add(time); } // Clone the line times foreach (double time in LineTimes) { clonedContainer.LineTimes.Add(time); } // Clone the ellipse times foreach (double time in EllipseTimes) { clonedContainer.EllipseTimes.Add(time); } // Copy the width and height (including margin) clonedContainer.Width = Width; clonedContainer.Height = Height; // Copy the width and height (excluding margin) clonedContainer.DisplayElementWidth = DisplayElementWidth; clonedContainer.DisplayElementHeight = DisplayElementHeight; // Copy whether the outline of the display should be shown clonedContainer.ShowDisplayElement = ShowDisplayElement; // Making a copy of the Editor capability reference clonedContainer.EditorCapabilities = EditorCapabilities; return(clonedContainer); }