//        public BezierPainter()
        //        {
        //            
        //            mHandles = new BezierHandleCollection(this);
        //            mHandles.Add(new BezierHandle(10,10));
        //            mHandles.Add( new BezierHandle(50,50));
        //            mHandles.Add( new BezierHandle(100,100));
        //            mHandles.Add(new BezierHandle(150,150));
        //            Init();
        //        }
        //        public BezierPainter(BezierHandleCollection mHandles)
        //        {
        //        
        //            if(mHandles.Count>1)
        //            {
        //                this.mHandles = mHandles;
        //                for(int k =0; k<mHandles.Count; k++)
        //                {mHandles[k].Curve = this;}
        //            }
        //            else
        //                throw new Exception("A curve requires at least two handles");
        //
        //            Init();
        //        }
        //        public BezierPainter(PointF[] points)
        //        {
        //            if(points.Length>1)
        //            {
        //                mHandles = new BezierHandleCollection();
        //                BezierHandle hd;
        //                for(int k=0; k<points.Length; k++)
        //                {
        //                    if(k==0 || k==points.Length-1) //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();
        //        }
        public BezierPainter(Connection connection)
            : base(connection)
        {
            mPoints = mConnection.GetConnectionPoints();
            if(mPoints.Length>1)
            {
                mHandles = new BezierHandleCollection();
                BezierHandle hd;

                for(int k=1; k<mPoints.Length-1; k++)
                {
                    if(k==1 || k==mPoints.Length-2) //start and final handle should be single-type
                        hd = new BezierHandle(mPoints[k],HandleTypes.Single);
                    else
                        hd = new BezierHandle(mPoints[k],HandleTypes.Symmetric);

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

            Init();
        }
        /// <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();
        }
Ejemplo 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;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="curve"></param>
 public BezierTracker(BezierPainter curve) : base(curve.Points)
 {
     mCurve   = curve;
     mHandles = curve.Handles;
 }
 public BezierTracker(Connection connection)
     : base(connection.GetConnectionPoints())
 {
     mCurve = connection.mPainter as BezierPainter;
     mHandles = mCurve.Handles;
 }
 public BezierTracker(BezierPainter curve)
     : base(curve.Points)
 {
     mCurve = curve;
     mHandles = curve.Handles;
 }
 /// <summary>
 /// Deserialization constructor
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected BezierPainter(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     mHandles = info.GetValue("mHandles", typeof(BezierHandleCollection)) as BezierHandleCollection;
 }