示例#1
0
        /// <inheritdoc />
        /// <summary>
        /// Нарисовать фигуру
        /// </summary>
        /// <param name="figure">Рисуемая фигура</param>
        /// <param name="canvas">Канва</param>
        public override void DrawFigure(BaseFigure figure, Graphics canvas)
        {
            FillableFigure ellipse;

            IReadOnlyList <PointF> points;

            if (!CircleDrawer.GetFillableFigure(figure,
                                                out ellipse,
                                                out points))
            {
                return;
            }

            var ellipseRectangle = CircleDrawer.MakeRectangle(
                points[0], points[1],
                RoundShapeType.Ellipse);

            Brush brush = new SolidBrush(ellipse.FillProperty.FillColor);

            canvas.FillEllipse(brush, ellipseRectangle);

            brush.Dispose();

            var pen = new Pen(ellipse.LineProperties.Color,
                              ellipse.LineProperties.Thickness)
            {
                DashStyle = ellipse.LineProperties.Style
            };

            canvas.DrawEllipse(pen, ellipseRectangle);

            pen.Dispose();
        }
示例#2
0
        /// <inheritdoc />
        /// <summary>
        /// Нарисовать маркеры
        /// </summary>
        /// <param name="figure">Рисуемая фигура</param>
        /// <param name="canvas">Канва</param>
        public override void DrawSelection(BaseFigure figure, Graphics canvas)
        {
            FillableFigure ellipse;

            IReadOnlyList <PointF> points;

            if (!CircleDrawer.GetFillableFigure(figure,
                                                out ellipse,
                                                out points))
            {
                return;
            }

            CircleDrawer.DrawSelectionRoundShapes(points, canvas);

            var rectangle = CircleDrawer.MakeRectangle(
                points[0], points[1],
                RoundShapeType.Ellipse);

            var pen = new Pen(Color.Black, 1)
            {
                DashStyle = System.Drawing.Drawing2D.DashStyle.Dash
            };

            canvas.DrawRectangle(pen, rectangle);

            pen.Dispose();
        }
示例#3
0
 /// <summary>
 /// Рисовка маркеров фигуры
 /// </summary>
 /// <param name="figure"></param>
 /// <param name="canvas"></param>
 public static void DrawSelection(BaseFigure figure, Graphics canvas)
 {
     if (figure.GetType() == typeof(Line))
     {
         var lineDrawer = new LineDrawer();
         lineDrawer.DrawSelection(figure, canvas);
     }
     else if (figure.GetType() == typeof(Polyline))
     {
         var drawer = new PolylineDrawer();
         drawer.DrawSelection(figure, canvas);
     }
     else if (figure.GetType() == typeof(Circle))
     {
         var circleDrawer = new CircleDrawer();
         circleDrawer.DrawSelection(figure, canvas);
     }
     else if (figure.GetType() == typeof(Ellipse))
     {
         var ellipseDrawer = new EllipseDrawer();
         ellipseDrawer.DrawSelection(figure, canvas);
     }
     else if (figure.GetType() == typeof(Polygon))
     {
         var polygonDrawer = new PolygonDrawer();
         polygonDrawer.DrawSelection(figure, canvas);
     }
 }
示例#4
0
        /// <summary>
        /// Рисовка маркеров для линии, полилинии, полигона
        /// </summary>
        /// <param name="figure">Рисуемая фигура</param>
        /// <param name="canvas">Канва</param>
        public static void DrawLineSelection(BaseFigure figure, Graphics canvas)
        {
            var points = figure.Points.GetPoints();

            CircleDrawer.DrawSelectionRoundShapes(points, canvas);
        }