示例#1
0
        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);
        }
示例#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);
        }