Пример #1
0
 public override Object Clone()
 {
     var result = new PolygonProperty();
     result.InitProperty();
     Copy(result);
     return result;
 }
Пример #2
0
 /// <summary>
 /// Left nouse button is pressed
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnMouseDown(IToolDrawArea drawArea, MouseEventArgs e)
 {
     if (draw == null)
     {
         property = new PolygonProperty();
         property.InitProperty();
         property.AddPoint(new Point(e.X, e.Y));
         property.AddPoint(new Point(e.X + 1, e.Y + 1));
         draw = new DrawPolygon(property);
         drawArea.AddNewDrawObject(draw);
         lastX = e.X;
         lastY = e.Y;
     }
     else
     {
         var point = new Point(e.X, e.Y);
         int distance = (e.X - lastX) * (e.X - lastX) + (e.Y - lastY) * (e.Y - lastY);
         if (distance < minDistance)
         {
             draw.MoveHandleTo(point, draw.HandleCount);
         }
         else
         {
             property.AddPoint(point);
             lastX = e.X;
             lastY = e.Y;
         }
     }
 }
Пример #3
0
 public DrawPolygon(PolygonProperty property)
     : base(property)
 {
 }
Пример #4
0
 /// <summary>
 /// Right mouse button is released
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnRightMouseUp(IToolDrawArea drawArea, MouseEventArgs e)
 {
     property = null;
     draw = null;
     base.OnMouseUp(drawArea, e);
 }
Пример #5
0
 public override IDrawObject CreateDrawObject(PageControl control)
 {
     var property = new PolygonProperty();
     InitDrawObjectFromPageControl(control, property);
     return new DrawPolygon(property);
 }