drawLine() public method

public drawLine ( Pen pen, Vec pos0, Vec pos1 ) : void
pen System.Drawing.Pen
pos0 Vec
pos1 Vec
return void
Ejemplo n.º 1
0
        public override void draw(DrawInfo di, Object selected)
        {
            Pen pen = new Pen(mColor);
            if (this == selected)
                pen = new Pen(Color.Blue);

            di.drawEllipse(pen,
                mParent.getScreenFromWorld(mPos0), 10, 10);
            di.drawEllipse(pen,
                mParent.getScreenFromWorld(mPos1), 10, 10);
            di.drawLine(pen,
                mParent.getScreenFromWorld(mPos0),
                mParent.getScreenFromWorld(mPos1));
            for (int i = 0; i < mSeg - 1; i++)
            {
                double alpha = (double)(i+1) / (mSeg);
                Vec pos = mPos0.mult(alpha).plus(mPos1.mult(1 - alpha));
                di.drawEllipse(pen, mParent.getScreenFromWorld(pos), 5, 5);
            }
        }
Ejemplo n.º 2
0
        override public void draw(DrawInfo di, Object selected)
        {
            Pen pen = new Pen(mColor);

            if (this == selected)
            {
                pen = new Pen(Color.Blue);
            }

            di.drawEllipse(pen,
                           mParent.getScreenFromWorld(mPos0), 10, 10);
            di.drawEllipse(pen,
                           mParent.getScreenFromWorld(mPos1), 10, 10);
            di.drawLine(pen,
                        mParent.getScreenFromWorld(mPos0),
                        mParent.getScreenFromWorld(mPos1));
            for (int i = 0; i < mSeg - 1; i++)
            {
                double alpha = (double)(i + 1) / (mSeg);
                Vec    pos   = mPos0.mult(alpha).plus(mPos1.mult(1 - alpha));
                di.drawEllipse(pen, mParent.getScreenFromWorld(pos), 5, 5);
            }
        }