示例#1
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public void _drawNormal(Graphics nGraphics)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     string name_ = mLine._getName();
     Graphicsos._runDraw(line_, nGraphics, mLineStream._getDraw(), mLineStream._getStyleName(), 1, mLineStream._getImage(), name_, mLineStream._getFont());
 }
示例#2
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public void _drawMove(Point2I nPoint, Graphics nGraphics)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     beg_._offset(nPoint);
     end_._offset(nPoint);
     Line2I line_ = new Line2I(beg_, end_);
     string name_ = mLine._getName();
     Graphicsos._runDraw(line_, nGraphics, mLineStream._getMoveDraw(), mLineStream._getStyleName(), 1, mLineStream._getImage(), name_, mLineStream._getFont());
 }
示例#3
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public void _drawSelect(Graphics nGraphics)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     Point2I beg0_ = line_._begPoint(3);
     Point2I beg1_ = line_._begPoint(6);
     Point2I end0_ = line_._endPoint(3);
     Point2I end1_ = line_._endPoint(6);
     ShapeDescriptorSingleton shapeDescriptorSingleton_ = __singleton<ShapeDescriptorSingleton>._instance();
     Graphicsos._fillRectangle(beg0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Graphicsos._fillRectangle(end0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Line2I line0_ = new Line2I(beg1_, end1_);
     string name_ = mLine._getName();
     Graphicsos._runDraw(line0_, nGraphics, mLineStream._getDraw(), mLineStream._getStyleName(), 1, mLineStream._getImage(), name_, mLineStream._getFont());
 }
示例#4
0
 public static void _drawBroken(Line2I nLine, Graphics nGraphics, RGB nRGB, bool nStart = true)
 {
     Color color_ = nRGB._getColor();
     Pen pen_ = new Pen(color_);
     float length_ = nLine._length();
     if (length_ < 6)
     {
         nGraphics.DrawLine(pen_, nLine._begX(), nLine._begY(), nLine._endX(), nLine._endY());
         return;
     }
     Point2I point_ = nLine._vector();
     PointF f = new PointF();
     f.X = point_._getX() / length_;
     f.Y = point_._getY() / length_;
     if (nStart)
     {
         for (int i = 0; i < (length_ - 1); i += 8)
         {
             Point beg_ = new Point();
             beg_.X = (int)(i * f.X + nLine._begX());
             beg_.Y = (int)(i * f.Y + nLine._begY());
             int k = i + 3;
             Point end_ = new Point();
             end_.X = (int)(k * f.X + nLine._begX());
             end_.Y = (int)(k * f.Y + nLine._begY());
             nGraphics.DrawLine(pen_, beg_, end_);
         }
     }
     else
     {
         for (int i = 0; i < (length_ - 1); i += 8)
         {
             Point beg_ = new Point();
             int l = i + 5;
             beg_.X = (int)(l * f.X + nLine._begX());
             beg_.Y = (int)(l * f.Y + nLine._begY());
             Point end_ = new Point();
             int k = i;
             end_.X = (int)(k * f.X + nLine._begX());
             end_.Y = (int)(k * f.Y + nLine._begY());
             nGraphics.DrawLine(pen_, beg_, end_);
         }
     }
 }
示例#5
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public void _drawPull(Graphics nGraphics)
 {
     if (default(int) != mPullPoint._getX() || default(int) != mPullPoint._getY())
     {
         return;
     }
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     Point2I beg0_ = line_._begPoint(3);
     Point2I beg1_ = line_._begPoint(6);
     Point2I end0_ = line_._endPoint(3);
     Point2I end1_ = line_._endPoint(6);
     ShapeDescriptorSingleton shapeDescriptorSingleton_ = __singleton<ShapeDescriptorSingleton>._instance();
     Graphicsos._drawEllipse(beg0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Graphicsos._drawEllipse(end0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Line2I line0_ = new Line2I(beg1_, end1_);
     string name_ = mLine._getName();
     Graphicsos._runDraw(line0_, nGraphics, mLineStream._getMoveDraw(), mLineStream._getStyleName(), 1, mLineStream._getImage(), name_, mLineStream._getFont());
 }
示例#6
0
        public static void _drawBroken(Rect2I nRect, Graphics nGraphics, RGB nRGB, int nSize = 0)
        {
            Point2I lefttop_ = nRect._getPoint();
            lefttop_._offset(-nSize, -nSize);

            Point2I righttop_ = nRect._getRTPoint();
            righttop_._offset(nSize, -nSize);

            Point2I leftbottom_ = nRect._getLBPoint();
            leftbottom_._offset(-nSize, nSize);

            Point2I rightbottom_ = nRect._getRBPoint();
            rightbottom_._offset(nSize, nSize);

            Line2I top_ = new Line2I(lefttop_, righttop_);
            Graphicsos._drawBroken(top_, nGraphics, nRGB);
            Line2I bottom_ = new Line2I(rightbottom_, leftbottom_);
            Graphicsos._drawBroken(bottom_, nGraphics, nRGB);
            Line2I left_ = new Line2I(leftbottom_, lefttop_);
            Graphicsos._drawBroken(left_, nGraphics, nRGB);
            Line2I right_ = new Line2I(righttop_, rightbottom_);
            Graphicsos._drawBroken(right_, nGraphics, nRGB);
        }
示例#7
0
 public static void _runDraw(Line2I nLine, Graphics nGraphics, RGB nRGB, string nStyle, int nWidth = 1, Image nImage = null, string nName = null, FONT nFont = null)
 {
     PenCapProvider penCapProvider_ = __singleton<PenCapProvider>._instance();
     Color color_ = nRGB._getColor();
     Pen pen_ = new Pen(color_, nWidth);
     if ("multiEnd" == nStyle)
     {
         pen_.CustomEndCap = penCapProvider_._getMultiCap();
     }
     else if ("multiBeg" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getMultiCap();
     }
     else if ("multiMulti" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getMultiCap();
         pen_.CustomEndCap = penCapProvider_._getMultiCap();
     }
     else if ("multiAggr" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getMultiCap();
         pen_.CustomEndCap = penCapProvider_._getAggrCap();
     }
     else if ("multiInh" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getMultiCap();
         pen_.CustomEndCap = penCapProvider_._getInhCap();
     }
     else if ("multiSingle" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getMultiCap();
         pen_.CustomEndCap = penCapProvider_._getSingleCap();
     }
     else if ("aggrEnd" == nStyle)
     {
         pen_.CustomEndCap = penCapProvider_._getAggrCap();
     }
     else if ("aggrBeg" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getAggrCap();
     }
     else if ("aggrMulti" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getAggrCap();
         pen_.CustomEndCap = penCapProvider_._getMultiCap();
     }
     else if ("aggrAggr" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getAggrCap();
         pen_.CustomEndCap = penCapProvider_._getAggrCap();
     }
     else if ("aggrInh" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getAggrCap();
         pen_.CustomEndCap = penCapProvider_._getInhCap();
     }
     else if ("aggrSingle" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getAggrCap();
         pen_.CustomEndCap = penCapProvider_._getSingleCap();
     }
     else if ("inhEnd" == nStyle)
     {
         pen_.CustomEndCap = penCapProvider_._getInhCap();
     }
     else if ("inhBeg" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getInhCap();
     }
     else if ("inhMulti" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getInhCap();
         pen_.CustomEndCap = penCapProvider_._getMultiCap();
     }
     else if ("inhAggr" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getInhCap();
         pen_.CustomEndCap = penCapProvider_._getAggrCap();
     }
     else if ("inhInh" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getInhCap();
         pen_.CustomEndCap = penCapProvider_._getInhCap();
     }
     else if ("inhSingle" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getInhCap();
         pen_.CustomEndCap = penCapProvider_._getSingleCap();
     }
     else if ("singleEnd" == nStyle)
     {
         pen_.CustomEndCap = penCapProvider_._getSingleCap();
     }
     else if ("singleBeg" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getSingleCap();
     }
     else if ("singleMulti" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getSingleCap();
         pen_.CustomEndCap = penCapProvider_._getMultiCap();
     }
     else if ("singleAggr" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getSingleCap();
         pen_.CustomEndCap = penCapProvider_._getAggrCap();
     }
     else if ("singleInh" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getSingleCap();
         pen_.CustomEndCap = penCapProvider_._getInhCap();
     }
     else if ("singleSingle" == nStyle)
     {
         pen_.CustomStartCap = penCapProvider_._getSingleCap();
         pen_.CustomEndCap = penCapProvider_._getSingleCap();
     }
     else
     {
     }
     GraphicsState graphicsState_ = nGraphics.Save();
     nGraphics.SmoothingMode = SmoothingMode.HighQuality;
     nGraphics.DrawLine(pen_, nLine._begX(), nLine._begY(), nLine._endX(), nLine._endY());
     nGraphics.Restore(graphicsState_);
     Rect2I rect_ = new Rect2I(nLine._getBeg(), nLine._getEnd());
     Point2I imagePoint_ = nLine._begPoint();
     if (null == imagePoint_)
     {
         return;
     }
     if (nLine._begX() < nLine._endX())
     {
         imagePoint_._offset(3, 0);
     }
     else
     {
         imagePoint_._offset(-3, 0);
     }
     if (nLine._begY() < nLine._endY())
     {
         imagePoint_._offset(0, 3);
     }
     else
     {
         imagePoint_._offset(0, -3);
     }
     nGraphics.DrawImage(nImage, imagePoint_._getX(), imagePoint_._getY(), 12, 12);
     if (null == nName || "" == nName)
     {
         return;
     }
     int h_ = rect_._getHeight();
     if (h_ < 18)
     {
         return;
     }
     Point2I center_ = rect_._centerPoint();
     int x_ = center_._getX() - 50;
     int y_ = center_._getY() - 9;
     int w_ = 100;
     int hx_ = 18;
     Rect2I rect0_ = new Rect2I(x_, y_, w_, hx_);
     Graphicsos._drawString(nName, rect0_, nGraphics, nFont);
 }
示例#8
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public void _setLine(Line2I nLine)
 {
     mBeg._setPoint(nLine._getBeg());
     mEnd._setPoint(nLine._getEnd());
 }
示例#9
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public __tuple<Point2I, Point2I> _minMax(Point2I nMin, Point2I nMax)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     return line_._minMax(nMin, nMax);
 }
示例#10
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public bool _isSelect(Point2I nBeg, Point2I nEnd)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     return line_._isSelect(nBeg, nEnd);
 }
示例#11
0
文件: LineShape.cs 项目: zyouhua/nvwa
 public bool _isPull(Point2I nPoint)
 {
     Point2I beg_ = mLine._getBegPoint();
     Point2I end_ = mLine._getEndPoint();
     Line2I line_ = new Line2I(beg_, end_);
     Point2I beg0_ = line_._begPoint(3);
     if (beg0_._isSelect(nPoint))
     {
         return true;
     }
     Point2I end0_ = line_._endPoint(3);
     if (end0_._isSelect(nPoint))
     {
         return true;
     }
     return false;
 }
示例#12
0
文件: Rect2I.cs 项目: zyouhua/nvwa
        bool _intersectWithY(Line2I nLine)
        {
            int x_ = default(int);
            int x0_ = default(int);
            int x1_ = mPoint._getY();
            int x2_ = mPoint._getY() + mSize._getHeight();
            if (((nLine._begY() < x1_) && (nLine._endY() > x1_)) || ((nLine._begY() > x1_) && (nLine._endY() < x1_)))
            {
                x_ = x1_;
            }

            if (((nLine._begY() < x2_) && (nLine._endY() > x2_)) || ((nLine._begY() > x2_) && (nLine._endY() < x2_)))
            {
                x0_ = x2_;
            }
            if ((x_ == default(int)) && (x0_ == default(int)))
            {
                return false;
            }
            int y1_ = mPoint._getX();
            int y2_ = mPoint._getX() + mSize._getWidth();

            int y_ = default(int);
            if (x_ != default(int))
            {
                y_ = nLine._xPoint(x_);
            }

            int y0_ = default(int);
            if (x0_ != default(int))
            {
                y0_ = nLine._xPoint(x0_);
            }

            if ((y_ > y1_) && (y_ < y2_))
            {
                return true;
            }

            if ((y0_ > y1_) && (y0_ < y2_))
            {
                return true;
            }
            return false;
        }
示例#13
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 public bool _intersectWith(Line2I nLine)
 {
     if (this._contain(nLine._getBeg()))
     {
         return true;
     }
     if (this._contain(nLine._getEnd()))
     {
         return true;
     }
     bool statusX_ = this._intersectWithX(nLine);
     if (statusX_ == true)
     {
         return true;
     }
     bool statusY_ = this._intersectWithY(nLine);
     if (statusY_ == true)
     {
         return true;
     }
     return false;
 }
示例#14
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public Line2I(Line2I nLine)
 {
     mBeg = new Point2I(nLine._getBeg());
     mEnd = new Point2I(nLine._getEnd());
 }
示例#15
0
        public static void _drawPull(Rect2I nRect, Graphics nGraphics, RGB nRGB, int nSize = 4)
        {
            Point2I lefttop_ = nRect._getPoint();
            lefttop_._offset(-nSize, -nSize);

            Point2I righttop_ = nRect._getRTPoint();
            righttop_._offset(nSize, -nSize);

            Point2I leftbottom_ = nRect._getLBPoint();
            leftbottom_._offset(-nSize, nSize);

            Point2I rightbottom_ = nRect._getRBPoint();
            rightbottom_._offset(nSize, nSize);

            Point2I lt_ = new Point2I();
            lt_._setX(nRect._getX() - nSize);
            lt_._setY(nRect._centerY() - 3);
            Point2I lb_ = new Point2I();
            lb_._setX(nRect._getX() - nSize);
            lb_._setY(nRect._centerY() + 3);
            Point2I lp_ = new Point2I();
            lp_._setX(nRect._getX() - 4);
            lp_._setY(nRect._centerY());

            Point2I rt_ = new Point2I();
            rt_._setX(nRect._getRTX() + nSize);
            rt_._setY(nRect._centerY() - 3);
            Point2I rb_ = new Point2I();
            rb_._setX(nRect._getRTX() + nSize);
            rb_._setY(nRect._centerY() + 3);
            Point2I rp_ = new Point2I();
            rp_._setX(nRect._getRTX() + 4);
            rp_._setY(nRect._centerY());

            Line2I top_ = new Line2I(lefttop_, righttop_);
            _drawBroken(top_, nGraphics, nRGB);
            Line2I bottom_ = new Line2I(leftbottom_, rightbottom_);
            _drawBroken(bottom_, nGraphics, nRGB);
            Line2I left0_ = new Line2I(lefttop_, lt_);
            _drawBroken(left0_, nGraphics, nRGB);
            Line2I left1_ = new Line2I(leftbottom_, lb_);
            _drawBroken(left1_, nGraphics, nRGB);
            Line2I right0_ = new Line2I(righttop_, rt_);
            _drawBroken(right0_, nGraphics, nRGB);
            Line2I right1_ = new Line2I(rightbottom_, rb_);
            _drawBroken(right1_, nGraphics, nRGB);
            _drawEllipse(lp_, nGraphics, nRGB);
            _drawEllipse(rp_, nGraphics, nRGB);
        }
示例#16
0
        public void _createMid(Point2I nPoint, Graphics nGraphics)
        {
            if (null == mRectShape)
            {
                return;
            }
            Point2I point_ = mRectShape._rectJoinPoint(mMouseDown, nPoint);
            ShapeDescriptorSingleton shapeDescriptorSingleton_ = __singleton<ShapeDescriptorSingleton>._instance();
            RGB selectRGB_ = shapeDescriptorSingleton_._selectRGB();
            Line2I line_ = new Line2I(point_, nPoint);
            Graphicsos._drawBroken(line_, nGraphics, selectRGB_);

            mRectShape._rectDrawCreate(nGraphics);

            SideItem sideItem_ = mSideBar._getChooseSideItem();
            LineCreater lineCreater_ = sideItem_._getTag() as LineCreater;
            string endId_ = lineCreater_._getEndId();
            foreach (IShape i in mNormals)
            {
                if (i._drawCreate(nPoint, endId_, nGraphics))
                {
                    return;
                }
            }
        }
示例#17
0
 public void _pullMid(Point2I nPoint, Graphics nGraphics)
 {
     if (default(int) == mPullPoint._getX() && default(int) == mPullPoint._getY())
     {
         return;
     }
     mPullState = PullState_.mDoing_;
     Line2I line_ = this._runPulling(nPoint);
     Point2I beg0_ = line_._begPoint(3);
     Point2I beg1_ = line_._begPoint(6);
     Point2I end0_ = line_._endPoint(3);
     Point2I end1_ = line_._endPoint(6);
     ShapeDescriptorSingleton shapeDescriptorSingleton_ = __singleton<ShapeDescriptorSingleton>._instance();
     Graphicsos._drawEllipse(beg0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Graphicsos._drawEllipse(end0_, nGraphics, shapeDescriptorSingleton_._selectRGB());
     Line2I line0_ = new Line2I(beg1_, end1_);
     string name_ = mLine._getName();
     Graphicsos._runDraw(line0_, nGraphics, mLineStream._getMoveDraw(), mLineStream._getStyleName(), 1, mLineStream._getImage(), name_, mLineStream._getFont());
 }