Exemplo n.º 1
0
        public void RotateProperDouble(int rotation, PdfSourcePoint point)
        {
            double temp;

            rotation = (rotation + 360) % 360;
            switch (rotation)
            {
            case 90:
                //temp = (point.dY - _dY -_dHeight) + point.dX;
                temp     = -(_dY + _dHeight - point.dY) + point.dX;
                _dY      = (_dX - point.dX) + point.dY;
                _dX      = temp;
                temp     = _dWidth;
                _dWidth  = _dHeight;
                _dHeight = temp;
                break;

            case 180:
                _dX = point.dX - (dRight - point.dX);
                _dY = point.dY - (dBottom - point.dY);
                break;

            case 270:
                temp     = (_dY - point.dY) + point.dX;
                _dY      = -(_dX + _dWidth - point.dX) + point.dY;
                _dX      = temp;
                temp     = _dWidth;
                _dWidth  = _dHeight;
                _dHeight = temp;
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        public PdfSourcePoint GetOnPageCoordinates(PdfSourcePoint onCanvasCoordinates, int rotation)
        {
            PdfSourcePoint origin; //origin of page in canvas coordinates (botleft corner of unrotated page)

            switch (rotation)
            {
            case 0:
                origin = new PdfSourcePoint(_dX, dBottom); break;

            case 90:
                origin = new PdfSourcePoint(_dX, _dY); break;

            case 180:
                origin = new PdfSourcePoint(dRight, _dY); break;

            case 270:
                origin = new PdfSourcePoint(dRight, dBottom); break;

            default:
                throw new InvalidProgramException();
            }

            PdfSourcePoint onPage = onCanvasCoordinates - origin;

            onPage.RotateAroundOrigin(360 - rotation);
            onPage.dY = -onPage.dY;

            return(onPage);
        }
Exemplo n.º 3
0
        public double ShortestDistanceSquared(PdfSourcePoint point)
        {
            double l = dX - point.dX;
            double r = point.dX - dRight;
            double t = dY - point.dY;
            double b = point.dY - dBottom;
            double h = Math.Max(0.0, Math.Max(l, r));
            double v = Math.Max(0.0, Math.Max(t, b));

            return(v * v + h * h);
        }
Exemplo n.º 4
0
 public bool contains(PdfSourcePoint point)
 {
     return(point.dX >= _dX && point.dY >= _dY && point.dX <= dRight && point.dY <= dBottom);
 }