/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connection">the connection this painter is painting</param>
        public BezierPainter(Connection connection) : base(connection)
        {
            base.Points = Connection.GetConnectionPoints();
            if (Points.Length > 1)
            {
                mHandles = new BezierHandleCollection();
                BezierHandle hd;

                for (int k = 1; k < Points.Length - 1; k++)          //this range is linked to the fact that connections have an adjacent point a little of the shape's edge
                {
                    if (k == 1 || k == Points.Length - 2)            //start and final handle should be single-type
                    {
                        hd = new BezierHandle(Points[k], HandleTypes.Single);
                    }
                    else
                    {
                        hd = new BezierHandle(Points[k], HandleTypes.Symmetric);
                    }

                    hd.Curve = this;
                    mHandles.Add(hd);
                }
            }
            else
            {
                throw new Exception("A curve requires at least two handles");
            }

            Init();
        }
 /// <summary>
 /// Creates a connection painter based on the given connection
 /// </summary>
 /// <param name="connection"></param>
 public ConnectionPainter(Connection connection)
 {
     mConnection = connection;
     pen = connection.pen;
     mPoints = connection.GetConnectionPoints();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="connection"></param>
 public BezierTracker(Connection connection) : base(connection.GetConnectionPoints())
 {
     mCurve   = connection.ConnectionPainter as BezierPainter;
     mHandles = mCurve.Handles;
 }
 public BezierTracker(Connection connection)
     : base(connection.GetConnectionPoints())
 {
     mCurve = connection.mPainter as BezierPainter;
     mHandles = mCurve.Handles;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a connection painter based on the given connection
 /// </summary>
 /// <param name="connection"></param>
 protected ConnectionPainter(Connection connection)
 {
     mConnection = connection;
     mPen        = connection.Pen;
     mPoints     = connection.GetConnectionPoints();
 }