Esempio n. 1
0
 __tuple<Point2I, Point2I> _moveMinMax()
 {
     Point2I min_ = new Point2I(65536, 65536);
     Point2I max_ = new Point2I(0, 0);
     foreach (IShape i in mSelects)
     {
         __tuple<Point2I, Point2I> tuple_ = i._minMax(min_, max_);
         if (null == tuple_)
         {
             continue;
         }
         min_._setPoint(tuple_._get_0());
         max_._setPoint(tuple_._get_1());
     }
     return new __tuple<Point2I, Point2I>(min_, max_);
 }
Esempio n. 2
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_;
 }