示例#1
0
 public Point2I _normalPoint(Point2I nPoint)
 {
     int width_ = mWidth * 2 - 3;
     int height_ = mHeight * 3 - 3;
     Point2I point_ = new Point2I(nPoint);
     int x_ = point_._getX();
     if (x_ < 3)
     {
         point_._setX(3);
     }
     if (x_ > width_)
     {
         point_._setX(width_);
     }
     int y_ = point_._getY();
     if (y_ < 3)
     {
         point_._setY(3);
     }
     if (y_ > height_)
     {
         point_._setY(height_);
     }
     return point_;
 }
示例#2
0
文件: Rect2I.cs 项目: zyouhua/nvwa
        public Rect2I(Point2I nPoint, Size2I nSize)
        {
            Point2I point_ = new Point2I();
            point_._setX(nPoint._getX() + nSize._getWidth());
            point_._setY(nPoint._getY() + nSize._getHeight());

            __tuple<Point2I, Point2I> tuple_ = nPoint._minMax(point_);
            Point2I min_ = tuple_._get_0();
            Point2I max_ = tuple_._get_1();

            Size2I size_ = new Size2I();
            size_._setWidth(max_._getX() - min_._getX());
            size_._setHeight(max_._getY() - min_._getY());

            mPoint = new Point2I(min_);
            mSize = new Size2I(size_);
        }
示例#3
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 public Quadrant_ _getQuadrant(Point2I nPoint)
 {
     Point2I center_ = _centerPoint();
     int x_ = nPoint._getX() - center_._getX();
     int y_ = nPoint._getY() - center_._getY();
     if (0 == x_ && 0 == y_)
     {
         return Quadrant_.mCenter_;
     }
     else if (0 < x_ && 0 == y_)
     {
         return Quadrant_.mUdx_;
     }
     else if (0 < x_ && 0 > y_)
     {
         return Quadrant_.mFirst_;
     }
     else if (0 == x_ && 0 > y_)
     {
         return Quadrant_.mUdy_;
     }
     else if (0 > x_ && 0 > y_)
     {
         return Quadrant_.mSecond_;
     }
     else if (0 > x_ && 0 == y_)
     {
         return Quadrant_.mSdx_;
     }
     else if (0 > x_ && 0 < y_)
     {
         return Quadrant_.mThree_;
     }
     else if (0 == x_ && 0 < y_)
     {
         return Quadrant_.mSdy_;
     }
     else if (0 < x_ && 0 < y_)
     {
         return Quadrant_.mFour_;
     }
     else
     {
         return Quadrant_.mError_;
     }
 }
示例#4
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 public bool _contain(Point2I nPoint)
 {
     return this._contain(nPoint._getX(), nPoint._getY());
 }
示例#5
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 public Point2I _connectPoint(Point2I nBeg, Point2I nEnd)
 {
     if (this._contain(nEnd))
     {
         return nEnd;
     }
     if (!this._contain(nBeg))
     {
         return nEnd;
     }
     Point2I result_ = new Point2I();
     int x0_ = mPoint._getX();
     int x1_ = x0_ + mSize._getWidth();
     int y0_ = mPoint._getY();
     int y1_ = y0_ + mSize._getHeight();
     if (nEnd._getY() < this._centerY())
     {
         if (nBeg._getY() == y0_)
         {
             result_._setPoint(nBeg);
             return result_;
         }
         float temp_ = this._connectPointY(nBeg, nEnd, y0_);
         if (temp_ > x0_ && temp_ < x1_)
         {
             int int_ = (int)temp_;
             result_._setX(int_);
             result_._setY(y0_);
             return result_;
         }
     }
     else
     {
         if (nBeg._getY() == y1_)
         {
             result_._setPoint(nBeg);
             return result_;
         }
         float temp_ = this._connectPointY(nBeg, nEnd, y1_);
         if (temp_ > x0_ && temp_ < x1_)
         {
             int int_ = (int)temp_;
             result_._setX(int_);
             result_._setY(y1_);
             return result_;
         }
     }
     if (nEnd._getX() > nBeg._getX())
     {
         result_._setX(x1_);
     }
     else
     {
         result_._setX(x0_);
     }
     if (nEnd._getY() > nBeg._getY())
     {
         result_._setY(y1_);
     }
     else
     {
         result_._setY(y0_);
     }
     return result_;
 }
示例#6
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public void _setBeg(Point2I nBeg)
 {
     mBeg._setX(nBeg._getX());
     mBeg._setY(nBeg._getY());
 }
示例#7
0
 public static void _drawEllipse(Point2I nPoint, Graphics nGraphics, RGB nRGB, int nSize = 3)
 {
     Point2I result_ = new Point2I(nPoint);
     result_._offset(-nSize, -nSize);
     Color color_ = nRGB._getColor();
     Pen pen_ = new Pen(color_);
     nGraphics.DrawEllipse(pen_, result_._getX(), result_._getY(), nSize * 2, nSize * 2);
 }
示例#8
0
文件: Label.cs 项目: zyouhua/weilai
 public override void _offset(Point2I nPoint)
 {
     mX += nPoint._getX();
     mY += nPoint._getY();
     base._offset(nPoint);
 }
示例#9
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 float _connectPointY(Point2I nBeg, Point2I nEnd, int nY)
 {
     if (nY > nBeg._getY() && nY > nEnd._getY())
     {
         return default(float);
     }
     if (nY < nBeg._getY() && nY < nEnd._getY())
     {
         return default(float);
     }
     int y1_ = nEnd._getY() - nY;
     int y0_ = nEnd._getY() - nBeg._getY();
     int x_ = nEnd._getX() - nBeg._getX();
     float result_ = (x_ * y1_) / y0_;
     result_ = nEnd._getX() - result_;
     if (result_ > nBeg._getX() && result_ > nEnd._getX())
     {
         return default(float);
     }
     if (result_ < nBeg._getX() && result_ < nEnd._getX())
     {
         return default(float);
     }
     return result_;
 }
示例#10
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public void _setPoint(Point2I nPoint)
 {
     mX = nPoint._getX();
     mY = nPoint._getY();
 }
示例#11
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public void _offset(Point2I nPoint)
 {
     this._offset(nPoint._getX(), nPoint._getY());
 }
示例#12
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public __tuple<Point2I, Point2I> _minMax(Point2I nPoint)
 {
     return this._minMax(nPoint._getX(), nPoint._getY());
 }
示例#13
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public decimal _length(Point2I nPoint)
 {
     return this._length(nPoint._getX(), nPoint._getY());
 }
示例#14
0
文件: Label.cs 项目: zyouhua/nvwa
 public void _offset(Point2I nPoint)
 {
     if (null != m_tMovePoint2I)
     {
         this.m_tMovePoint2I(nPoint);
     }
     mX += nPoint._getX();
     mY += nPoint._getY();
 }
示例#15
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public double _distance(Point2I nPoint)
 {
     return this._distance(nPoint._getX(), nPoint._getY());
 }
示例#16
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public void _setEnd(Point2I nEnd)
 {
     mEnd._setX(nEnd._getX());
     mEnd._setY(nEnd._getY());
 }
示例#17
0
文件: Rect2I.cs 项目: zyouhua/nvwa
 public void _setPoint(Point2I nPoint)
 {
     mPoint._setX(nPoint._getX());
     mPoint._setY(nPoint._getY());
 }
示例#18
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public Point2I(Point2I nPoint)
 {
     mX = nPoint._getX();
     mY = nPoint._getY();
 }
示例#19
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public Point2I _vectorTo(Point2I nPoint)
 {
     return this._vectorTo(nPoint._getX(), nPoint._getY());
 }
示例#20
0
文件: Point2I.cs 项目: zyouhua/nvwa
 public bool _isSelect(Point2I nPoint, int nSize = 6)
 {
     return this._isSelect(nPoint._getX(), nPoint._getY(), nSize);
 }
示例#21
0
 public static void _fillRectangle(Point2I nPoint, Graphics nGraphics, RGB nRGB, int nSize = 3)
 {
     Point2I result_ = new Point2I(nPoint);
     result_._offset(-nSize, -nSize);
     Color color_ = nRGB._getColor();
     Brush brush_ = new SolidBrush(color_);
     nGraphics.FillRectangle(brush_, result_._getX(), result_._getY(), nSize * 2, nSize * 2);
 }
示例#22
0
文件: Rect2I.cs 项目: zyouhua/nvwa
        public __tuple<Status_, Point2I> _borderPoint(Point2I nPoint)
        {
            Point2I center_ = _centerPoint();

            Point2I point_ = new Point2I();
            point_._setX(nPoint._getX() - center_._getX());
            point_._setY(nPoint._getY() - center_._getY());

            long x_ = point_._getX() * mSize._getHeight();
            long y_ = point_._getY() * mSize._getWidth();

            Point2I result_ = new Point2I();
            Quadrant_ quadrant_ = _getQuadrant(nPoint);
            //                    |
            //                    |
            //             _______0_______
            //                    |
            //                    |
            //                    |
            if (Quadrant_.mCenter_ == quadrant_)
            {
                return new __tuple<Status_, Point2I>(Status_.mSucess_, center_);
            }
            //                    |
            //                    |
            //             _______|_______1
            //                    |
            //                    |
            //                    |
            else if (Quadrant_.mUdx_ == quadrant_)
            {
                result_._setX(mPoint._getX() + mSize._getWidth());
                result_._setY(center_._getY());
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                    |  2
            //             _______|_______
            //                    |
            //                    |
            //                    |
            else if (Quadrant_.mFirst_ == quadrant_)
            {
                y_ = -y_;
                if (x_ > y_)
                {
                    result_._setX(mPoint._getX() + mSize._getWidth());
                    long temp_ = y_ / 2;
                    y_ = (int)(temp_ / point_._getX());
                    result_._setY((int)(center_._getY() - y_));
                }
                else if (x_ == y_)
                {
                    result_._setX(mPoint._getX() + mSize._getWidth());
                    result_._setY(mPoint._getY());
                }
                else
                {
                    result_._setY(mPoint._getY());
                    long temp_ = x_ / 2;
                    x_ = (int)(temp_ / point_._getY());
                    result_._setX((int)(center_._getX() - x_));
                }
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    3
            //                    |
            //                    |
            //             _______|_______
            //                    |
            //                    |
            //                    |
            else if (Quadrant_.mUdy_ == quadrant_)
            {
                result_._setX(center_._getX());
                result_._setY(mPoint._getY());
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                 4  |
            //             _______|_______
            //                    |
            //                    |
            //                    |
            else if (Quadrant_.mSecond_ == quadrant_)
            {
                x_ = -x_;
                y_ = -y_;
                if (x_ > y_)
                {
                    result_._setX(mPoint._getX());
                    long temp_ = y_ / 2;
                    y_ = (int)(temp_ / point_._getX());
                    result_._setY((int)(center_._getY() + y_));
                }
                else if (x_ == y_)
                {
                    result_._setX(mPoint._getX());
                    result_._setY(mPoint._getY());
                }
                else
                {
                    result_._setY(mPoint._getY());
                    long temp_ = x_ / 2;
                    x_ = (int)(temp_ / point_._getY());
                    result_._setX((int)(center_._getX() + x_));
                }
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                    |
            //            5_______|_______
            //                    |
            //                    |
            //                    |
            else if (Quadrant_.mSdx_ == quadrant_)
            {
                result_._setX(mPoint._getX());
                result_._setY(center_._getY());

                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                    |
            //             _______|_______
            //                    |
            //                 6  |
            //                    |
            if (Quadrant_.mThree_ == quadrant_)
            {
                x_ = -x_;
                if (x_ > y_)
                {
                    result_._setX(mPoint._getX());
                    long temp_ = y_ / 2;
                    y_ = (int)(temp_ / point_._getX());
                    result_._setY((int)(center_._getY() - y_));
                }
                else if (x_ == y_)
                {
                    result_._setX(mPoint._getX());
                    result_._setY(mPoint._getY() + mSize._getHeight());
                }
                else
                {
                    result_._setY(mPoint._getY() + mSize._getHeight());
                    long temp_ = x_ / 2;
                    x_ = (int)(temp_ / point_._getY());
                    result_._setX((int)(center_._getX() - x_));
                }
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                    |
            //             _______|_______
            //                    |
            //                    |
            //                    |
            //                    7
            if (Quadrant_.mSdy_ == quadrant_)
            {
                result_._setX(center_._getX());
                result_._setY(mPoint._getY() + mSize._getHeight());
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            //                    |
            //                    |
            //             _______|_______
            //                    |
            //                    |   8
            //                    |
            else if (Quadrant_.mFour_ == quadrant_)
            {
                if (x_ > y_)
                {
                    result_._setX(mPoint._getX() + mSize._getWidth());
                    long temp_ = y_ / 2;
                    y_ = (int)(temp_ / point_._getX());
                    result_._setY((int)(center_._getY() + y_));
                }
                else if (x_ == y_)
                {
                    result_._setX(mPoint._getX() + mSize._getWidth());
                    result_._setY(mPoint._getY() + mSize._getHeight());
                }
                else
                {
                    result_._setY(mPoint._getY() + mSize._getHeight());
                    long temp = x_ / 2;
                    x_ = (int)(temp / point_._getY());
                    result_._setX((int)(center_._getX() + x_));
                }
                return new __tuple<Status_, Point2I>(Status_.mSucess_, result_);
            }
            else
            {
                return new __tuple<Status_, Point2I>(Status_.mError_, result_);
            }
        }
示例#23
0
 public void _createLabel(Point2I nPoint)
 {
     this._pushDown(nPoint);
     this._resetShape();
     SideItem sideItem_ = mSideBar._getChooseSideItem();
     LabelCreater labelCreater_ = sideItem_._getTag() as LabelCreater;
     labelCreater_._setObject(mObject);
     labelCreater_._setX(nPoint._getX());
     labelCreater_._setY(nPoint._getY());
     ILabel label_ = labelCreater_._runCreate() as ILabel;
     if (null == label_)
     {
         mSideBar._resetActiveTab();
         this._pushUp();
         return;
     }
     LabelShape labelshape_ = new LabelShape();
     labelshape_._initLabel(label_);
     mSelects.Add(labelshape_);
     mSideBar._resetActiveTab();
     this._pushUp();
 }
示例#24
0
文件: Line2I.cs 项目: zyouhua/nvwa
 public bool _isSelect(Point2I nPoint, int nDistance = 3)
 {
     return _isSelect(nPoint._getX(), nPoint._getY(), nDistance);
 }