コード例 #1
0
ファイル: Link.cs プロジェクト: jboenig/Diagram
        /// <summary>
        /// Creates a link shape matching the type specified by the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.Link.Shapes"/>
        /// enumeration and load its with the given array of points.
        /// </summary>
        /// <param name="shapeType">Type of shape to create</param>
        /// <param name="pts">Points to initialize shape with</param>
        /// <returns>IPoints interface to the link shape object created</returns>
        /// <remarks>
        /// <para>
        /// A link shape can be any type of node that supports the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.IPoints"/>
        /// interface. This method supports creating one of the following
        /// types of link shapes:
        /// <see cref="Syncfusion.Windows.Forms.Diagram.Line"/>,
        /// <see cref="Syncfusion.Windows.Forms.Diagram.OrthogonalLine"/>,
        /// <see cref="Syncfusion.Windows.Forms.Diagram.PolyLine"/>, and
        /// <see cref="Syncfusion.Windows.Forms.Diagram.Arc"/>. If
        /// <see cref="Syncfusion.Windows.Forms.Diagram.Link.Shapes.Default"/>
        /// is specified, then a polyline is created.
        /// </para>
        /// <para>
        /// This method can be overridden in derived classes to support the
        /// creation of other types of link shapes.
        /// </para>
        /// <seealso cref="Syncfusion.Windows.Forms.Diagram.Link.Shapes"/>
        /// <seealso cref="Syncfusion.Windows.Forms.Diagram.IPoints"/>
        /// </remarks>
        protected virtual IPoints CreateLinkShape(Link.Shapes shapeType, PointF[] pts)
        {
            Shape linkShape = null;

            switch (shapeType)
            {
            case Link.Shapes.Line:
                linkShape = new Line();
                break;

            case Link.Shapes.OrthogonalLine:
                linkShape = new OrthogonalLine();
                break;

            case Link.Shapes.Arc:
                linkShape = new Arc();
                break;

            default:
                linkShape = new PolyLine();
                break;
            }

            if (linkShape != null)
            {
                linkShape.SetPoints(pts);
            }

            return(linkShape);
        }
コード例 #2
0
ファイル: PolyLine.cs プロジェクト: jboenig/Diagram
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="src">Object to copy</param>
 public PolyLine(PolyLine src) : base(src)
 {
     ((IEndPoints)this).FirstEndPoint = src.firstEndPoint;
     ((IEndPoints)this).LastEndPoint  = src.lastEndPoint;
 }