예제 #1
0
        // Left mouse button selects the object clicked on, or drag something already selected.
        public override MapViewer.DragAction LeftButtonDown(Pane pane, PointF location, float pixelSize, ref bool displayUpdateNeeded)
        {
            if (pane != Pane.Map)
            {
                return(MapViewer.DragAction.None);
            }

            PointF handleLocation;

            // Area we initiating a drag of a corner/side?
            if (HitTestHandle(location, pixelSize, out handleLocation, out cursorDrag))
            {
                // being dragging the corner
                draggingHandle      = true;
                startDrag           = location;
                handleDrag          = handleLocation;
                dragStartCourseObj  = (SelectingRectangleCourseObj)selectingCourseObj.Clone();
                displayUpdateNeeded = true;
                return(MapViewer.DragAction.ImmediateDrag);
            }

            // Are we initiating a drag of the whole object?
            if (HitTestDraggable(location, pixelSize))
            {
                // Begin dragging the clicked object.
                draggingWhole       = true;
                startDrag           = location;
                dragStartCourseObj  = (SelectingRectangleCourseObj)selectingCourseObj.Clone();
                displayUpdateNeeded = true;
                return(MapViewer.DragAction.ImmediateDrag);
            }

            return(MapViewer.DragAction.None);
        }
예제 #2
0
        bool allowResize = true;                        // Allow resized with a handle.

        public RectangleSelectMode(Controller controller, RectangleF rect, IDisposable disposeOnEndMode)
        {
            this.controller       = controller;
            originalRectangle     = rect;
            this.disposeOnEndMode = disposeOnEndMode;
            selectingCourseObj    = new SelectingRectangleCourseObj(rect);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            SelectingRectangleCourseObj other = (SelectingRectangleCourseObj)obj;

            if (showHandles != other.showHandles)
            {
                return(false);
            }

            return(base.Equals(obj));
        }
예제 #4
0
        public override void LeftButtonDrag(Pane pane, PointF location, PointF locationStart, float pixelSize, ref bool displayUpdateNeeded)
        {
            Debug.Assert(pane == Pane.Map);

            if (draggingWhole)
            {
                // Update the rectangle being dragged.
                selectingCourseObj = (SelectingRectangleCourseObj)dragStartCourseObj.Clone();
                selectingCourseObj.Offset(location.X - startDrag.X, location.Y - startDrag.Y);
            }
            else if (draggingHandle)
            {
                // Update the rectangle where the handle is being dragged.
                selectingCourseObj = (SelectingRectangleCourseObj)dragStartCourseObj.Clone();
                PointF newHandleLocation = new PointF(handleDrag.X + location.X - startDrag.X, handleDrag.Y + location.Y - startDrag.Y);
                selectingCourseObj.MoveHandle(handleDrag, newHandleLocation);
            }

            displayUpdateNeeded = true;
        }
예제 #5
0
        public override void LeftButtonDrag(Pane pane, PointF location, PointF locationStart, float pixelSize, ref bool displayUpdateNeeded)
        {
            Debug.Assert(pane == Pane.Map);

            if (draggingWhole) {
                // Update the rectangle being dragged.
                selectingCourseObj = (SelectingRectangleCourseObj) dragStartCourseObj.Clone();
                selectingCourseObj.Offset(location.X - startDrag.X, location.Y - startDrag.Y);
            }
            else if (draggingHandle) {
                // Update the rectangle where the handle is being dragged.
                selectingCourseObj = (SelectingRectangleCourseObj) dragStartCourseObj.Clone();
                PointF newHandleLocation = new PointF(handleDrag.X + location.X - startDrag.X, handleDrag.Y + location.Y - startDrag.Y);
                selectingCourseObj.MoveHandle(handleDrag, newHandleLocation);
            }

            displayUpdateNeeded = true;
        }
예제 #6
0
        // Left mouse button selects the object clicked on, or drag something already selected.
        public override MapViewer.DragAction LeftButtonDown(Pane pane, PointF location, float pixelSize, ref bool displayUpdateNeeded)
        {
            if (pane != Pane.Map)
                return MapViewer.DragAction.None;

            PointF handleLocation;

            // Area we initiating a drag of a corner/side?
            if (HitTestHandle(location, pixelSize, out handleLocation, out cursorDrag)) {
                // being dragging the corner
                draggingHandle = true;
                startDrag = location;
                handleDrag = handleLocation;
                dragStartCourseObj = (SelectingRectangleCourseObj) selectingCourseObj.Clone();
                displayUpdateNeeded = true;
                return MapViewer.DragAction.ImmediateDrag;
            }

            // Are we initiating a drag of the whole object?
            if (HitTestDraggable(location, pixelSize)) {
                // Begin dragging the clicked object.
                draggingWhole = true;
                startDrag = location;
                dragStartCourseObj = (SelectingRectangleCourseObj) selectingCourseObj.Clone();
                displayUpdateNeeded = true;
                return MapViewer.DragAction.ImmediateDrag;
            }

            return MapViewer.DragAction.None;
        }
예제 #7
0
        PointF startDrag; // location dragging started

        #endregion Fields

        #region Constructors

        public RectangleSelectMode(Controller controller, RectangleF rect, IDisposable disposeOnEndMode)
        {
            this.controller = controller;
            originalRectangle = rect;
            this.disposeOnEndMode = disposeOnEndMode;
            selectingCourseObj = new SelectingRectangleCourseObj(rect);
        }