Ejemplo n.º 1
0
        public void AddRectangle(Point leftCorner, Point rightCorner, ISourceWithTranslation text)
        {
            var leftPointWithShift  = new Point(leftCorner.X + _leftX, leftCorner.Y + _leftY);
            var rightPointWithShift = new Point(rightCorner.X + _leftX, rightCorner.Y + _leftY);

            var pointWithSign = new PointWithSign(leftPointWithShift, rightPointWithShift, text);

            if (_isHorizontalLine)
            {
                AddPoint(pointWithSign, leftPointWithShift.Y, rightPointWithShift.Y, _centerY);
            }
            else
            {
                AddPoint(pointWithSign, leftPointWithShift.X, rightPointWithShift.X, _centerX);
            }
        }
Ejemplo n.º 2
0
 private void AddPoint(PointWithSign pointWithSign, int leftCoord, int rightCoord, int centerCoord)
 {
     if (leftCoord < centerCoord && rightCoord < centerCoord)
     {
         _firstSidePoints.Add(pointWithSign);
     }
     else if (leftCoord > centerCoord && rightCoord > centerCoord)
     {
         _secondSidePoints.Add(pointWithSign);
     }
     else
     {
         if (centerCoord - leftCoord > rightCoord - centerCoord)
         {
             _candidateFirstPoints.Add(pointWithSign);
         }
         else
         {
             _candidateSecondPoints.Add(pointWithSign);
         }
     }
 }