Ejemplo n.º 1
0
 /// <summary>
 /// Handler class which handles with point elements
 /// </summary>
 /// <param name="element"></param>
 /// <param name="hOperator">Handler operator</param>
 /// <param name="point">Point element to be handled</param>
 public PointHandler(ShapeElement element, HandlerOperator hOperator,
                     PointElement point) : base(element, hOperator)
 {
     this.FillColor   = Color.BlueViolet;
     this.linkedPoint = point;
     this.element     = element;
     this.RePosition(element);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Handler class which handles with adding new point operation
 /// </summary>
 /// <param name="element">Current element</param>
 /// <param name="hndlOperator">Handler Operator</param>
 /// <param name="point">New point</param>
 /// <param name="index">index of the handler </param>
 public NewPointHandler(ShapeElement element, HandlerOperator hndlOperator,
                        PointElement point, int index) : base(element, hndlOperator)
 {
     this.element     = element;
     Index            = index;
     this.FillColor   = Color.YellowGreen;
     this.linkedPoint = point;
     this.RePosition(element);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns Cursor according to handler operator value
 /// </summary>
 /// <param name="hOperator">HandlerOperator</param>
 /// <returns><see cref="System.Windows.Forms.Cursor"/></returns>
 public static Cursor GetCursor(HandlerOperator hOperator)
 {
     if (hOperator == HandlerOperator.NewPoint || hOperator == HandlerOperator.Polygon ||
         hOperator == HandlerOperator.Rotation)
     {
         return(Cursors.SizeAll);
     }
     else if (hOperator == HandlerOperator.Default)
     {
         return(Cursors.Hand);
     }
     else if (hOperator == HandlerOperator.RedimNorthWest)
     {
         return(Cursors.SizeNWSE);
     }
     else if (hOperator == HandlerOperator.RedimNorth)
     {
         return(Cursors.SizeNS);
     }
     else if (hOperator == HandlerOperator.RedimNorthEast)
     {
         return(Cursors.SizeNESW);
     }
     else if (hOperator == HandlerOperator.RedimEast)
     {
         return(Cursors.SizeWE);
     }
     else if (hOperator == HandlerOperator.RedimSouthEast)
     {
         return(Cursors.SizeNWSE);
     }
     else if (hOperator == HandlerOperator.RedimSouth)
     {
         return(Cursors.SizeNS);
     }
     else if (hOperator == HandlerOperator.RedimSouthWest)
     {
         return(Cursors.SizeNESW);
     }
     else if (hOperator == HandlerOperator.RedimWest)
     {
         return(Cursors.SizeWE);
     }
     else if (hOperator == HandlerOperator.Zoom)
     {
         return(Cursors.SizeNWSE);
     }
     return(Cursors.Default);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Determines whether point(x,y) is contained by this handler or not
        /// </summary>
        /// <param name="x">x region of the point</param>
        /// <param name="y">y region of the point</param>
        /// <returns>True if contains, false if not</returns>
        public HandlerOperator IsOver(int x, int y)
        {
            HandlerOperator hOperator = HandlerOperator.None;

            foreach (Handler handler in this.handlers)
            {
                hOperator = handler.IsOver(x, y);
                if (hOperator != HandlerOperator.None)
                {
                    return(hOperator);
                }
            }
            if (this.Contains(x, y))
            {
                return(HandlerOperator.Default);
            }

            return(HandlerOperator.None);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Convert <see cref="DrawingBoard2.HandlerOperator"/> enum value to
 /// <see cref="DrawingBoard2.Direction"/>enum value
 /// </summary>
 /// <param name="hOperator">Handler operation value</param>
 /// <returns>Direction enum value</returns>
 public static Direction ToDirection(HandlerOperator hOperator)
 {
     if (hOperator == HandlerOperator.RedimEast)
     {
         return(Direction.East);
     }
     else if (hOperator == HandlerOperator.RedimNorth)
     {
         return(Direction.North);
     }
     else if (hOperator == HandlerOperator.RedimNorthEast)
     {
         return(Direction.NorthEast);
     }
     else if (hOperator == HandlerOperator.RedimNorthWest)
     {
         return(Direction.NorthWest);
     }
     else if (hOperator == HandlerOperator.RedimSouth)
     {
         return(Direction.South);
     }
     else if (hOperator == HandlerOperator.RedimSouthEast)
     {
         return(Direction.SouthEast);
     }
     else if (hOperator == HandlerOperator.RedimSouthWest)
     {
         return(Direction.SouthWest);
     }
     else if (hOperator == HandlerOperator.RedimWest)
     {
         return(Direction.West);
     }
     return(Direction.West);
 }
 /// <summary>
 /// Handler class which handles with rotation of shape elements
 /// </summary>
 /// <param name="element"></param>
 /// <param name="hOperator"></param>
 public RotationHandler(ShapeElement element, HandlerOperator hOperator)
     : base(element, hOperator)
 {
     this.FillColor = Color.Black;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Base handler class
 /// </summary>
 /// <param name="shape">Shape element to be handled</param>
 /// <param name="hOperator">Handler Operator</param>
 public Handler(ShapeElement shape, HandlerOperator hOperator)
 {
     this.handleOperator = hOperator;
     this.RePosition(shape);
 }