Пример #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
        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
 public bool _contain(Point2I nPoint)
 {
     return this._contain(nPoint._getX(), nPoint._getY());
 }
Пример #4
0
        public Point2I _connectPoint(Point2I nPoint)
        {
            Point2I result_ = new Point2I();
            Point2I center_ = this._centerPoint();
            if (center_._getX() > nPoint._getX())
            {
                result_._setX(mPoint._getX());
            }
            else
            {
                result_._setX(mPoint._getX() + mSize._getWidth());
            }

            result_._setY(center_._getY());
            return result_;
        }
Пример #5
0
 public void _setBeg(Point2I nBeg)
 {
     mBeg._setX(nBeg._getX());
     mBeg._setY(nBeg._getY());
 }
Пример #6
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();
 }
Пример #7
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);
 }
Пример #8
0
 public void _setPoint(Point2I nPoint)
 {
     mPoint._setX(nPoint._getX());
     mPoint._setY(nPoint._getY());
 }
Пример #9
0
 public void _setPoint(Point2I nPoint)
 {
     mX = nPoint._getX();
     mY = nPoint._getY();
 }
Пример #10
0
 public void _offset(Point2I nPoint)
 {
     this._offset(nPoint._getX(), nPoint._getY());
 }
Пример #11
0
 public __tuple<Point2I, Point2I> _minMax(Point2I nPoint)
 {
     return this._minMax(nPoint._getX(), nPoint._getY());
 }
Пример #12
0
 public decimal _length(Point2I nPoint)
 {
     return this._length(nPoint._getX(), nPoint._getY());
 }
Пример #13
0
 public void _offset(Point2I nPoint)
 {
     if (null != m_tMovePoint2I)
     {
         this.m_tMovePoint2I(nPoint);
     }
     mX += nPoint._getX();
     mY += nPoint._getY();
 }
Пример #14
0
 public double _distance(Point2I nPoint)
 {
     return this._distance(nPoint._getX(), nPoint._getY());
 }
Пример #15
0
 public void _setEnd(Point2I nEnd)
 {
     mEnd._setX(nEnd._getX());
     mEnd._setY(nEnd._getY());
 }
Пример #16
0
 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_;
     }
 }
Пример #17
0
 public Point2I(Point2I nPoint)
 {
     mX = nPoint._getX();
     mY = nPoint._getY();
 }
Пример #18
0
 public Point2I _vectorTo(Point2I nPoint)
 {
     return this._vectorTo(nPoint._getX(), nPoint._getY());
 }
Пример #19
0
 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_;
 }
Пример #20
0
 public bool _isSelect(Point2I nPoint, int nSize = 6)
 {
     return this._isSelect(nPoint._getX(), nPoint._getY(), nSize);
 }
Пример #21
0
 public override void _offset(Point2I nPoint)
 {
     mX += nPoint._getX();
     mY += nPoint._getY();
     base._offset(nPoint);
 }
Пример #22
0
        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 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);
 }
Пример #24
0
 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_;
 }
Пример #25
0
 Rect2I _runPull(Point2I nPoint)
 {
     Rect2I rect2i_ = this._getRect2I();
     if (this._isPullRight(mPullPoint))
     {
         int v_ = nPoint._getX() - mPullPoint._getX();
         int w_ = rect2i_._getWidth();
         w_ += v_;
         if (w_ < mRectWidth)
         {
             w_ = mRectWidth;
         }
         rect2i_._setWidth(w_);
     }
     if (this._isPullLeft(mPullPoint))
     {
         int v_ = nPoint._getX() - mPullPoint._getX();
         int w_ = rect2i_._getWidth();
         w_ -= v_;
         if (w_ < mRectWidth)
         {
             v_ -= mRectWidth;
             v_ += w_;
         }
         int x_ = rect2i_._getX();
         x_ += v_;
         if (x_ < 3)
         {
             w_ -= 3;
             w_ += x_;
             x_ = 3;
         }
         rect2i_._setX(x_);
         rect2i_._sizeOffset(-v_, 0);
     }
     return rect2i_;
 }
Пример #26
0
 public bool _isSelect(Point2I nPoint, int nDistance = 3)
 {
     return _isSelect(nPoint._getX(), nPoint._getY(), nDistance);
 }