Exemplo n.º 1
0
        public RectangleF Selection(ICanvas canvas)
        {
            Rectangle screenRect = ScreenRect();

            if (screenRect.IsEmpty)
            {
                return(RectangleF.Empty);
            }
            return(ScreenUtils.ToUnitNormalized(canvas, screenRect));
        }
Exemplo n.º 2
0
        public static RectangleF LineBoundingRectangle(UnitPoint p1, UnitPoint p2, float halfLineWidth)
        {
            double     x = Math.Min(p1.X, p2.X);
            double     y = Math.Min(p1.Y, p2.Y);
            double     w = Math.Abs(p1.X - p2.X);
            double     h = Math.Abs(p1.Y - p2.Y);
            RectangleF boundingRectangle = ScreenUtils.GetRectangleF(x, y, w, h);

            boundingRectangle.Inflate(halfLineWidth, halfLineWidth);
            return(boundingRectangle);
        }
Exemplo n.º 3
0
        public RectangleF GetMaxUnit()
        {
            float thWidth = UCCanvas.GetThresholdWidth();


            var       tran     = drawObjects[0] as IDrawTranslation;
            UnitPoint maxPoint = new UnitPoint();

            maxPoint = tran.MaxValue;
            UnitPoint minPoint = new UnitPoint();

            minPoint = tran.MinValue;
            for (int i = 1; i < drawObjects.Count; i++)
            {
                UnitPoint tempMax = ((IDrawTranslation)drawObjects[i]).MaxValue;
                UnitPoint tempMin = ((IDrawTranslation)drawObjects[i]).MinValue;
                if (tempMax.X > maxPoint.X)
                {
                    maxPoint.X = tempMax.X;
                }
                if (tempMax.Y > maxPoint.Y)
                {
                    maxPoint.Y = tempMax.Y;
                }
                if (tempMin.X < minPoint.X)
                {
                    minPoint.X = tempMin.X;
                }
                if (tempMin.Y < minPoint.Y)
                {
                    minPoint.Y = tempMin.Y;
                }
            }
            RectangleF rectangleLine = ScreenUtils.GetRectangleF(maxPoint, minPoint, thWidth / 2);

            return(rectangleLine);
        }