示例#1
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            try
            {
                float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
                if (thWidth < Width)
                {
                    thWidth = Width;
                }

                RectangleF rect = RectangleF.Empty;
                if (m_p2.IsEmpty || m_p3.IsEmpty)
                {
                    rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth);
                }

                if (rect.IsEmpty)
                {
                    float r = m_radius + thWidth / 2;
                    rect = HitUtil.CircleBoundingRect(m_center, r);
                    if (Selected)
                    {
                        float w = (float)canvas.ToUnit(20);
                        rect.Inflate(w, w);
                    }
                }
                if (m_lastPoint.IsEmpty == false)
                {
                    rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0, 0)));
                }
                return(rect);
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#2
0
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         float thWidth = ThresholdWidth(canvas, Width);
         return(ScreenUtils.GetRect(m_p1, m_p2, thWidth));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#3
0
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         float PriWidth  = canvas.ToScreen(0.5F);
         float PriHeight = canvas.ToScreen(0.3F);
         aqlocation = new UnitPoint(location.X + canvas.ToUnit(PriWidth), location.Y - canvas.ToUnit(PriHeight));
         return(ScreenUtils.GetRect(location, aqlocation, 0));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#4
0
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         double    thWidth    = canvas.ToUnit(ThresholdPixel);
         float     PriWidth   = canvas.ToScreen(this.radius);
         UnitPoint aqlocation = new UnitPoint(Location.X + canvas.ToUnit(PriWidth), Location.Y - canvas.ToUnit(PriWidth));
         return(ScreenUtils.GetRect(Location, aqlocation, thWidth));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#5
0
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         //RectangleF rec = new RectangleF((float)Location.X, (float)Location.Y, 0.5F, -0.5F);
         //return rec;
         float PriWidth = canvas.ToScreen(0.5F);
         aqlocation = new UnitPoint(location.X + 0.5, location.Y - 0.5);
         return(ScreenUtils.GetRect(location, aqlocation, 0));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#6
0
 /// <summary>
 /// 得到当前图形元素的矩形区域
 /// </summary>
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
         if (thWidth < Width)
         {
             thWidth = Width;
         }
         float     ProduceWidth = canvas.ToScreen(width / 96);
         float     ProduceHight = canvas.ToScreen(height / 96);
         UnitPoint Aqlocation   = new UnitPoint(location.X + canvas.ToUnit(ProduceWidth), location.Y - canvas.ToUnit(ProduceHight));
         return(ScreenUtils.GetRect(location, Aqlocation, thWidth));
     }
     catch (Exception ex)
     { throw ex; }
 }
示例#7
0
        /// <summary>
        /// 得到当前图形元素的矩形区域
        /// </summary>
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            try
            {
                //Font m_font = new System.Drawing.Font("Arial Black", FontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                //SizeF size= canvas.GetStrValueSize(StrValue, m_font);
                //UnitPoint aqlocation = new UnitPoint(location.X + (float)canvas.ToUnit(size.Width), location.Y - (float)canvas.ToUnit(size.Height));
                //return ScreenUtils.GetRect(location, aqlocation, 0);


                float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
                if (thWidth < Width)
                {
                    thWidth = Width;
                }
                UnitPoint Aqlocation = new UnitPoint(location.X + canvas.ToUnit((float)10 * str_value.Length), location.Y - canvas.ToUnit(10F));
                return(ScreenUtils.GetRect(location, Aqlocation, thWidth));
            }
            catch (Exception ex)
            { throw ex; }
        }
示例#8
0
        /// <summary>
        /// 获取用户图像选择周围的边界矩形的坐标
        /// </summary>
        /// <param name="canvas"></param>
        /// <returns></returns>
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = Line.ThresholdWidth(canvas, Width, ThresholdPixel);

            if (thWidth < Width)
            {
                thWidth = Width;
            }

            RectangleF rect = RectangleF.Empty;

            //如果其中一个点是空的,那么绘制一条直线,因此返回一条直线的边界。
            if (m_p2.IsEmpty || m_p3.IsEmpty)
            {
                rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth);
            }

            if (rect.IsEmpty)
            {
                float r = m_radius + thWidth / 2;
                rect = HitUtil.CircleBoundingRect(m_center, r);
                if (Selected)
                {
                    float w = (float)canvas.ToUnit(20);                     // include space for the 'extern' nodes
                    rect.Inflate(w, w);
                }
            }
            //如果绘制任一角度,则在矩形中包含鼠标点-这是重新绘制(擦除)绘制的线。
            //从中心点到鼠标点
            //if (m_curPoint == eCurrentPoint.startAngle || m_curPoint == eCurrentPoint.endAngle)
            if (m_lastPoint.IsEmpty == false)
            {
                rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0, 0)));
            }
            return(rect);
        }
示例#9
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = Line.ThresholdWidth(canvas, Width, ThresholdPixel);

            if (thWidth < Width)
            {
                thWidth = Width;
            }

            RectangleF rect = RectangleF.Empty;

            // if one of the points is empty, then a straight line is drawn, so return bounding rect for a line
            if (m_p2.IsEmpty || m_p3.IsEmpty)
            {
                rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth);
            }

            if (rect.IsEmpty)
            {
                float r = m_radius + thWidth / 2;
                rect = HitUtil.CircleBoundingRect(m_center, r);
                if (Selected)
                {
                    float w = (float)canvas.ToUnit(20); // include space for the 'extern' nodes
                    rect.Inflate(w, w);
                }
            }
            // if drawing either angle then include the mouse point in the rectangle - this is to redraw (erase) the line drawn
            // from center point to mouse point
            //if (m_curPoint == eCurrentPoint.startAngle || m_curPoint == eCurrentPoint.endAngle)
            if (m_lastPoint.IsEmpty == false)
            {
                rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0, 0)));
            }
            return(rect);
        }
示例#10
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = ThresholdWidth(canvas, Width);

            return(ScreenUtils.GetRect(m_p1, m_p2, thWidth));
        }
示例#11
0
 public RectangleF GetExactBoundingRect(ICanvas canvas)
 {
     return(ScreenUtils.GetRect(m_p1, m_p3, 0));
 }
示例#12
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = Line.ThresholdWidth(canvas, Width, ThresholdPixel);

            return(ScreenUtils.GetRect(m_p1, m_p3, thWidth));
        }
示例#13
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);

            return(ScreenUtils.GetRect(new UnitPoint(position.X - 0.2, position.Y + 0.2), new UnitPoint(position.X + 0.2, position.Y - 0.2), thWidth));
        }