Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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);
        }