示例#1
0
        /// <summary>
        /// Converts the star into a vector.
        /// </summary>
        /// <returns>The <c>KimonoShapeVector</c> version of the star.</returns>
        public override KimonoShapeVector ToVector()
        {
            var vector = new KimonoShapeVector();

            // Define star points
            var points = MakeStarPoints(-Math.PI / 2, NumberOfPoints, SkipPoints, Rect, DepthOffset * .01f);

            // Add points to vector
            foreach (SKPoint point in points)
            {
                vector.AddPoint(point);
            }

            // Return new vector
            return(vector);
        }
        /// <summary>
        /// Clone this instance.
        /// </summary>
        /// <returns>The clone <c>KimonoShapeVector</c>.</returns>
        public override KimonoBounds Clone()
        {
            // Duplicate shape
            var newShape = new KimonoShapeVector(this.Left, this.Top, this.Right, this.Bottom, this.State)
            {
                UniqueID   = this.UniqueID,
                Name       = this.Name,
                Style      = CloneAttachedStyle(),
                Visible    = this.Visible,
                Closed     = this.Closed,
                LayerDepth = this.LayerDepth
            };

            // Clone control points
            foreach (KimonoHandle handle in ControlPoints)
            {
                // Duplicate handle and add to collection
                newShape.ControlPoints.Add(handle.Clone());
            }

            // Copy points
            foreach (SKPoint point in Points)
            {
                newShape.Points.Add(point);
            }

            // Clone any property connections
            foreach (KimonoPropertyConnection connection in PropertyConnections)
            {
                // Add duplicate connection
                newShape.PropertyConnections.Add(connection.Clone());
            }

            // Return new shape
            return(newShape);
        }