コード例 #1
0
        public override void Render(DrawingContext dc, GeometryStyleBase geometryStyle)
        {
            if (null == dc || !(geometryStyle is CircleStyle))
            {
                return;
            }

            CircleStyle style = geometryStyle as CircleStyle;
            Pen         pen   = new Pen(style.LineBrush, 6);

            pen.DashStyle = style.DashStyle;

            if (pen.CanFreeze)
            {
                pen.Freeze();
            }

            if (!_moving)
            {
                _beforeMoveFirstPoint  = geometryStyle.FirstPoint;
                _beforeMoveSecondPoint = geometryStyle.SecondPoint;
            }

            dc.DrawEllipse(style.FillBrush, pen, new Point(
                               (geometryStyle.FirstPoint.X + geometryStyle.SecondPoint.X) / 2, (geometryStyle.FirstPoint.Y + geometryStyle.SecondPoint.Y) / 2),
                           Math.Abs(geometryStyle.FirstPoint.X - geometryStyle.SecondPoint.X) / 2, Math.Abs(geometryStyle.FirstPoint.Y - geometryStyle.SecondPoint.Y) / 2);
        }
コード例 #2
0
 public PointOfInterest(string id, string name, PointF location, CircleStyle style, PointOfInterestType type) : base(location)
 {
     this.Style = style;
     //this.Location = location;
     this.Name = name;
     this.ID   = id;
     this.Type = type;
 }
コード例 #3
0
        // Draw a circle around its center coordinates using the specified style
        public static void DrawCircle(Graphics g, int x, int y, CircleStyle style)
        {
            Rectangle rect = new Rectangle((int)(x - style.Radius), (int)(y - style.Radius), (int)(2 * style.Radius), (int)(2 * style.Radius));

            if (style.Fill)
            {
                g.FillEllipse(new SolidBrush(style.FillColor), rect);
            }
            if (style.Stroke)
            {
                g.DrawEllipse(new Pen(style.StrokeColor, style.StrokeWidth), rect);
            }
        }
コード例 #4
0
 public Circle(string id, string label, double posX, double posY, double radius = 2, CircleStyle style = null, string[] classes = null)
 {
     RootName = "circle";
     Id       = id;
     PosX     = posX;
     PosY     = posY;
     Style    = style ?? new CircleStyle();
     Classes  = classes;
     Radius   = radius;
     Label    = label;
 }
コード例 #5
0
 // Draw a circle around its center point using the specified style
 public static void DrawCircle(Graphics g, Point center, CircleStyle style)
 {
     DrawCircle(g, center.X, center.Y, style);
 }