/// <summary> /// Creates a new Text that is a copy of the current instance. /// </summary> /// <returns>A new Text that is a copy of this instance.</returns> public override object Clone() { Text entity = new Text { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Text properties Position = position, Rotation = rotation, Height = height, WidthFactor = widthFactor, ObliqueAngle = obliqueAngle, Alignment = alignment, Style = (TextStyle)style.Clone(), Value = text }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new MText that is a copy of the current instance. /// </summary> /// <returns>A new MText that is a copy of this instance.</returns> public override object Clone() { MText entity = new MText { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //MText properties Position = position, Rotation = rotation, Height = height, LineSpacingFactor = lineSpacing, LineSpacingStyle = lineSpacingStyle, RectangleWidth = rectangleWidth, AttachmentPoint = attachmentPoint, Style = (TextStyle)style.Clone(), Value = text }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Trace that is a copy of the current instance. /// </summary> /// <returns>A new Trace that is a copy of this instance.</returns> public override object Clone() { Trace entity = new Trace { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Solid properties FirstVertex = firstVertex, SecondVertex = secondVertex, ThirdVertex = thirdVertex, FourthVertex = fourthVertex, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Arc that is a copy of the current instance. /// </summary> /// <returns>A new Arc that is a copy of this instance.</returns> public override object Clone() { Arc entity = new Arc { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Arc properties Center = center, Radius = radius, StartAngle = startAngle, EndAngle = endAngle, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
//public override void TransformBy2(Matrix3 transformation, Vector3 translation) //{ // Vector3 newCenter; // Vector3 newNormal; // double newMajorAxis; // double newMinorAxis; // double newRotation; // newCenter = transformation * this.Center + translation; // newNormal = transformation * this.Normal; // Matrix3 transOW = MathHelper.ArbitraryAxis(this.Normal); // transOW *= Matrix3.RotationZ(this.Rotation * MathHelper.DegToRad); // Matrix3 transWO = MathHelper.ArbitraryAxis(newNormal); // transWO = transWO.Transpose(); // Vector3 v = transOW * Vector3.UnitX; // v = transformation * v; // v = transWO * v; // double angle = Vector2.Angle(new Vector2(v.X, v.Y)); // newRotation = angle * MathHelper.RadToDeg; // transWO = Matrix3.RotationZ(newRotation * MathHelper.DegToRad).Transpose() * transWO; // Vector3 s = transOW * new Vector3(this.MajorAxis, this.MinorAxis, 0.0); // s = transformation * s; // s = transWO * s; // newMajorAxis = s.X <= 0 ? MathHelper.Epsilon : s.X; // newMinorAxis = s.Y <= 0 ? MathHelper.Epsilon : s.Y; // this.Center = newCenter; // this.Normal = newNormal; // this.Rotation = newRotation; // if (newMinorAxis > newMajorAxis) // { // this.MajorAxis = newMinorAxis; // this.MinorAxis = newMajorAxis; // } // else // { // this.MajorAxis = newMajorAxis; // this.MinorAxis = newMinorAxis; // } //} /// <summary> /// Creates a new Ellipse that is a copy of the current instance. /// </summary> /// <returns>A new Ellipse that is a copy of this instance.</returns> public override object Clone() { Ellipse entity = new Ellipse { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Ellipse properties Center = center, MajorAxis = majorAxis, MinorAxis = minorAxis, Rotation = rotation, StartAngle = startAngle, EndAngle = endAngle, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
public override object Clone() { Shape entity = new Shape(name, (ShapeStyle)style.Clone()) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Shape properties Position = position, Size = size, Rotation = rotation, ObliqueAngle = obliqueAngle, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Hatch that is a copy of the current instance. /// </summary> /// <returns>A new Hatch that is a copy of this instance.</returns> /// <remarks>If the hatch is associative the referenced boundary entities will not be automatically cloned. Use CreateBoundary if required.</remarks> public override object Clone() { Hatch entity = new Hatch((HatchPattern)pattern.Clone(), associative) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Hatch properties Elevation = elevation }; foreach (HatchBoundaryPath path in boundaryPaths) { entity.boundaryPaths.Add((HatchBoundaryPath)path.Clone()); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new LwPolyline that is a copy of the current instance. /// </summary> /// <returns>A new LwPolyline that is a copy of this instance.</returns> public override Object Clone() { LwPolyline entity = new LwPolyline { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //LwPolyline properties Elevation = elevation, Thickness = thickness, Flags = flags }; foreach (LwPolylineVertex vertex in vertexes) { entity.Vertexes.Add((LwPolylineVertex)vertex.Clone()); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Underlay that is a copy of the current instance. /// </summary> /// <returns>A new Underlay that is a copy of this instance.</returns> public override object Clone() { Underlay entity = new Underlay { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Underlay properties Definition = (UnderlayDefinition)definition.Clone(), Position = position, Scale = scale, Rotation = rotation, Contrast = contrast, Fade = fade, DisplayOptions = displayOptions, ClippingBoundary = clippingBoundary != null ? (ClippingBoundary)clippingBoundary.Clone() : null }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Attribute that is a copy of the current instance. /// </summary> /// <returns>A new Attribute that is a copy of this instance.</returns> public object Clone() { Attribute entity = new Attribute { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = isVisible, //Attribute properties Definition = (AttributeDefinition)definition?.Clone(), Tag = tag, Height = height, WidthFactor = widthFactor, ObliqueAngle = obliqueAngle, Value = attValue, Style = style, Position = position, Flags = flags, Rotation = rotation, Alignment = alignment }; return(entity); }
/// <summary> /// Creates a new Ray that is a copy of the current instance. /// </summary> /// <returns>A new Ray that is a copy of this instance.</returns> public override object Clone() { Ray entity = new Ray { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Ray properties Origin = origin, Direction = direction, }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new AttributeDefinition that is a copy of the current instance. /// </summary> /// <returns>A new AttributeDefinition that is a copy of this instance.</returns> public object Clone() { AttributeDefinition entity = new AttributeDefinition(tag) { //Attribute definition properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, Prompt = prompt, Value = attValue, Height = height, WidthFactor = widthFactor, ObliqueAngle = obliqueAngle, Style = style, Position = position, Flags = flags, Rotation = rotation, Alignment = alignment }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Line that is a copy of the current instance. /// </summary> /// <returns>A new Line that is a copy of this instance.</returns> public override object Clone() { Line entity = new Line { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Line properties StartPoint = start, EndPoint = end, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
public override object Clone() { Tolerance entity = new Tolerance { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Tolerance properties Entry1 = (ToleranceEntry)entry1.Clone(), Entry2 = (ToleranceEntry)entry2.Clone(), Height = height, ShowProjectedToleranceZoneSymbol = showProjectedToleranceZoneSymbol, DatumIdentifier = datumIdentifier, Style = (DimensionStyle)style.Clone(), Position = position, Rotation = rotation }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Converts the arc in a Polyline. /// </summary> /// <param name="precision">Number of divisions.</param> /// <returns>A new instance of <see cref="LwPolyline">LightWeightPolyline</see> that represents the arc.</returns> public LwPolyline ToPolyline(int precision) { IEnumerable <Vector2> vertexes = PolygonalVertexes(precision); Vector3 ocsCenter = MathHelper.Transform(center, Normal, CoordinateSystem.World, CoordinateSystem.Object); LwPolyline poly = new LwPolyline { Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, Elevation = ocsCenter.Z, Thickness = Thickness, IsClosed = false }; foreach (Vector2 v in vertexes) { poly.Vertexes.Add(new LwPolylineVertex(v.X + ocsCenter.X, v.Y + ocsCenter.Y)); } return(poly); }
/// <summary> /// Creates a new Point that is a copy of the current instance. /// </summary> /// <returns>A new Point that is a copy of this instance.</returns> public override object Clone() { Point entity = new Point { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Point properties Position = position, Rotation = rotation, Thickness = thickness }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new MLine that is a copy of the current instance. /// </summary> /// <returns>A new MLine that is a copy of this instance.</returns> public override object Clone() { MLine entity = new MLine { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //MLine properties Elevation = elevation, Scale = scale, Justification = justification, Style = (MLineStyle)style.Clone(), Flags = flags }; foreach (MLineVertex vertex in vertexes) { entity.vertexes.Add((MLineVertex)vertex.Clone()); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Spline that is a copy of the current instance. /// </summary> /// <returns>A new Spline that is a copy of this instance.</returns> public override object Clone() { Spline entity; if (creationMethod == SplineCreationMethod.FitPoints) { entity = new Spline(new List <Vector3>(fitPoints)) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Spline properties KnotParameterization = KnotParameterization, StartTangent = startTangent, EndTangent = endTangent }; } else { List <SplineVertex> copyControlPoints = new List <SplineVertex>(controlPoints.Count); foreach (SplineVertex vertex in controlPoints) { copyControlPoints.Add((SplineVertex)vertex.Clone()); } List <double> copyKnots = new List <double>(knots); entity = new Spline(copyControlPoints, copyKnots, degree) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal //Spline properties }; } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new viewport that is a copy of the current instance. /// </summary> /// <returns>A new viewport that is a copy of this instance.</returns> public override object Clone() { Viewport viewport = new Viewport { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //viewport properties Center = center, Width = width, Height = height, Stacking = stacking, Id = id, ViewCenter = viewCenter, SnapBase = snapBase, SnapSpacing = snapSpacing, GridSpacing = gridSpacing, ViewDirection = viewDirection, ViewTarget = viewTarget, LensLength = lensLength, FrontClipPlane = frontClipPlane, BackClipPlane = backClipPlane, ViewHeight = viewHeight, SnapAngle = snapAngle, TwistAngle = twistAngle, CircleZoomPercent = circleZoomPercent, Status = status, UcsOrigin = ucsOrigin, UcsXAxis = ucsXAxis, UcsYAxis = ucsYAxis, Elevation = elevation, }; foreach (XData data in XData.Values) { viewport.XData.Add((XData)data.Clone()); } if (boundary != null) { viewport.ClippingBoundary = (EntityObject)boundary.Clone(); } viewport.FrozenLayers.AddRange(frozenLayers.ToArray()); return(viewport); }
private Line CreateLine(Vector2 start, Vector2 end, AciColor color, Linetype linetype) { return(new Line(start, end) { Layer = (Layer)Layer.Clone(), Linetype = (Linetype)linetype.Clone(), Color = (AciColor)color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal }); }
private Arc CreateArc(Vector2 center, double radius, double startAngle, double endAngle, AciColor color, Linetype linetype) { return(new Arc(center, radius, startAngle, endAngle) { Layer = (Layer)Layer.Clone(), Linetype = (Linetype)linetype.Clone(), Color = (AciColor)color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, }); }
/// <summary> /// Creates a new Angular2LineDimension that is a copy of the current instance. /// </summary> /// <returns>A new Angular2LineDimension that is a copy of this instance.</returns> public override object Clone() { Angular2LineDimension entity = new Angular2LineDimension { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Dimension properties Style = (DimensionStyle)Style.Clone(), DefinitionPoint = DefinitionPoint, TextReferencePoint = TextReferencePoint, TextPositionManuallySet = TextPositionManuallySet, TextRotation = TextRotation, AttachmentPoint = AttachmentPoint, LineSpacingStyle = LineSpacingStyle, LineSpacingFactor = LineSpacingFactor, UserText = UserText, Elevation = Elevation, //Angular2LineDimension properties StartFirstLine = startFirstLine, EndFirstLine = endFirstLine, StartSecondLine = startSecondLine, EndSecondLine = endSecondLine, Offset = offset, arcDefinitionPoint = arcDefinitionPoint }; foreach (DimensionStyleOverride styleOverride in StyleOverrides.Values) { object copy; ICloneable value = styleOverride.Value as ICloneable; copy = value != null?value.Clone() : styleOverride.Value; entity.StyleOverrides.Add(new DimensionStyleOverride(styleOverride.Type, copy)); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new OrdinateDimension that is a copy of the current instance. /// </summary> /// <returns>A new OrdinateDimension that is a copy of this instance.</returns> public override object Clone() { OrdinateDimension entity = new OrdinateDimension { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Dimension properties Style = (DimensionStyle)Style.Clone(), DefinitionPoint = defPoint, TextReferencePoint = TextReferencePoint, TextPositionManuallySet = TextPositionManuallySet, TextRotation = TextRotation, AttachmentPoint = AttachmentPoint, LineSpacingStyle = LineSpacingStyle, LineSpacingFactor = LineSpacingFactor, UserText = UserText, Elevation = Elevation, //OrdinateDimension properties FeaturePoint = firstPoint, LeaderEndPoint = secondPoint, Rotation = rotation, Axis = axis }; foreach (DimensionStyleOverride styleOverride in StyleOverrides.Values) { object copy; ICloneable value = styleOverride.Value as ICloneable; copy = value != null?value.Clone() : styleOverride.Value; entity.StyleOverrides.Add(new DimensionStyleOverride(styleOverride.Type, copy)); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Mesh that is a copy of the current instance. /// </summary> /// <returns>A new Mesh that is a copy of this instance.</returns> public override object Clone() { List <Vector3> copyVertexes = new List <Vector3>(vertexes.Count); List <int[]> copyFaces = new List <int[]>(faces.Count); List <MeshEdge> copyEdges = null; copyVertexes.AddRange(vertexes); foreach (int[] face in faces) { int[] copyFace = new int[face.Length]; face.CopyTo(copyFace, 0); copyFaces.Add(copyFace); } if (edges != null) { copyEdges = new List <MeshEdge>(edges.Count); foreach (MeshEdge meshEdge in edges) { copyEdges.Add((MeshEdge)meshEdge.Clone()); } } Mesh entity = new Mesh(copyVertexes, copyFaces, copyEdges) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Mesh properties SubdivisionLevel = subdivisionLevel }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Decompose the actual polyline in a list of <see cref="Line">lines</see>. /// </summary> /// <returns>A list of <see cref="Line">lines</see> that made up the polyline.</returns> public List <EntityObject> Explode() { List <EntityObject> entities = new List <EntityObject>(); int index = 0; foreach (PolylineVertex vertex in Vertexes) { Vector3 start; Vector3 end; if (index == Vertexes.Count - 1) { if (!IsClosed) { break; } start = vertex.Position; end = vertexes[0].Position; } else { start = vertex.Position; end = vertexes[index + 1].Position; } entities.Add(new Line { Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, StartPoint = start, EndPoint = end, }); index++; } return(entities); }
/// <summary> /// Creates a new Layer that is a copy of the current instance. /// </summary> /// <param name="newName">Layer name of the copy.</param> /// <returns>A new Layer that is a copy of this instance.</returns> public override TableObject Clone(string newName) { Layer copy = new Layer(newName) { Color = (AciColor)Color.Clone(), IsVisible = isVisible, IsFrozen = isFrozen, IsLocked = isLocked, Plot = plot, Linetype = (Linetype)Linetype.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone() }; foreach (XData data in XData.Values) { copy.XData.Add((XData)data.Clone()); } return(copy); }
/// <summary> /// Creates a new Leader that is a copy of the current instance. /// </summary> /// <returns>A new Leader that is a copy of this instance.</returns> public override object Clone() { Leader entity = new Leader(vertexes) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Leader properties Elevation = elevation, Style = (DimensionStyle)style.Clone(), ShowArrowhead = showArrowhead, PathType = pathType, Offset = offset, LineColor = lineColor, Annotation = (EntityObject)annotation?.Clone(), hasHookline = hasHookline // do not call directly the property, the vertexes list already includes it if it has a hook line }; foreach (DimensionStyleOverride styleOverride in StyleOverrides.Values) { object copy; ICloneable value = styleOverride.Value as ICloneable; copy = value != null?value.Clone() : styleOverride.Value; entity.StyleOverrides.Add(new DimensionStyleOverride(styleOverride.Type, copy)); } foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Converts the spline in a Polyline. /// </summary> /// <param name="precision">Number of vertexes generated.</param> /// <returns>A new instance of <see cref="Polyline">Polyline</see> that represents the spline.</returns> public Polyline ToPolyline(int precision) { IEnumerable <Vector3> vertexes = PolygonalVertexes(precision); Polyline poly = new Polyline { Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsClosed = isClosed }; foreach (Vector3 v in vertexes) { poly.Vertexes.Add(new PolylineVertex(v)); } return(poly); }
/// <summary> /// Creates a new Insert that is a copy of the current instance. /// </summary> /// <returns>A new Insert that is a copy of this instance.</returns> public override object Clone() { // copy attributes List <Attribute> copyAttributes = new List <Attribute>(); foreach (Attribute att in attributes) { copyAttributes.Add((Attribute)att.Clone()); } Insert entity = new Insert(copyAttributes) { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Insert properties Position = position, Block = (Block)block.Clone(), Scale = scale, Rotation = rotation, }; // copy extended data foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }
/// <summary> /// Creates a new Image that is a copy of the current instance. /// </summary> /// <returns>A new Image that is a copy of this instance.</returns> public override object Clone() { Image entity = new Image { //EntityObject properties Layer = (Layer)Layer.Clone(), Linetype = (Linetype)Linetype.Clone(), Color = (AciColor)Color.Clone(), Lineweight = Lineweight, Transparency = (Transparency)Transparency.Clone(), LinetypeScale = LinetypeScale, Normal = Normal, IsVisible = IsVisible, //Image properties Position = position, Height = height, Width = width, Uvector = uvector, Vvector = vvector, //Rotation = this.rotation, Definition = (ImageDefinition)imageDefinition.Clone(), Clipping = clipping, Brightness = brightness, Contrast = contrast, Fade = fade, DisplayOptions = displayOptions, ClippingBoundary = (ClippingBoundary)clippingBoundary.Clone() }; foreach (XData data in XData.Values) { entity.XData.Add((XData)data.Clone()); } return(entity); }