Package edu.cnu.mdi.container
Class BaseToolHandler
java.lang.Object
edu.cnu.mdi.container.BaseToolHandler
- All Implemented Interfaces:
IToolHandler
- Direct Known Subclasses:
MapToolHandler
Default tool handler for BaseContainer. This class provides standard
implementations for all tools, which can be used as-is or overridden by
subclasses.
Dragging an already-selected item translates every selected item that is draggable and belongs to an unlocked layer. Locked and non-draggable items remain in place. Resize and rotate gestures continue to affect only the item whose handle initiated the gesture.
- Author:
- heddle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferedImageprotected BufferedImageprotected final BaseContainerprotected Pointprotected booleanprotected AItemprotected static final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanApprove or reject a connection point.voidBegin dragging an object/selection.voidboxZoomRubberbanding(GestureContext gc, Rectangle bounds) Box-zoom rubberband completion (or continuous feedback depending on tool).voidvoidcreateConnection(GestureContext gc, Point start, Point end) Create a connection between two points.voidcreateEllipse(GestureContext gc, Rectangle bounds) Create an ellipse.voidcreateLine(GestureContext gc, Point start, Point end) Create a line between two points.voidcreatePolygon(GestureContext gc, Point[] vertices) Create a polygon.voidcreatePolyline(GestureContext gc, Point[] vertices) Create a polyline.voidcreateRadArc(GestureContext gc, Point[] pp) Create a radial arc.voidcreateRectangle(GestureContext gc, Rectangle bounds) Create a rectangle.voidcreateTextItem(GestureContext gc, Point location) Create a text item at the given location.voiddelete(GestureContext gc) booleanOptional veto before starting a drag.voiddragObjectBy(GestureContext gc, int dx, int dy) Drag the object/selection by a pixel delta.voidEnd dragging an object/selection.hitTest(GestureContext gc, Point p) Hit test at the given point on the canvas.voidinfo(GestureContext gc) voidvoidvoidvoidvoidvoidvoidHandle pointer click on an object at the given point.voidHandle pointer double click on an object at the given point.voidpointerRubberbanding(GestureContext gc, Rectangle bounds) Pointer rubberband feedback (typically multi-select or region selection).voidprint(GestureContext gc) voidvoidvoidvoidvoidzoomIn(GestureContext gc) void
-
Field Details
-
ZOOM_FACTOR
protected static final double ZOOM_FACTOR- See Also:
-
base
-
buffer
-
container
-
modifyItem
-
modifyItems
-
modifying
protected boolean modifying -
dragPressPoint
-
-
Constructor Details
-
BaseToolHandler
Constructor.- Parameters:
container- BaseContainer that owns this tool handler
-
-
Method Details
-
info
- Specified by:
infoin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
hitTest
Hit test at the given point on the canvas.- Specified by:
hitTestin interfaceIToolHandler- Parameters:
gc- GestureContext providing context for the hit testp- Point to hit test- Returns:
- Object that was hit, or null if nothing was hit
-
pointerClick
Handle pointer click on an object at the given point.- Specified by:
pointerClickin interfaceIToolHandler- Parameters:
gc- GestureContext providing context for the click
-
pointerDoubleClick
Handle pointer double click on an object at the given point.- Specified by:
pointerDoubleClickin interfaceIToolHandler- Parameters:
gc- GestureContext providing context for the double click
-
pointerRubberbanding
Description copied from interface:IToolHandlerPointer rubberband feedback (typically multi-select or region selection).- Specified by:
pointerRubberbandingin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rubberband bounds (non-null)
-
beginDragObject
Description copied from interface:IToolHandlerBegin dragging an object/selection.- Specified by:
beginDragObjectin interfaceIToolHandler- Parameters:
gc- gesture context (non-null).gc.getTarget()is the drag target.
-
dragObjectBy
Description copied from interface:IToolHandlerDrag the object/selection by a pixel delta.- Specified by:
dragObjectByin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)dx- delta x since last updatedy- delta y since last update
-
endDragObject
Description copied from interface:IToolHandlerEnd dragging an object/selection.- Specified by:
endDragObjectin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
boxZoomRubberbanding
Description copied from interface:IToolHandlerBox-zoom rubberband completion (or continuous feedback depending on tool).- Specified by:
boxZoomRubberbandingin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rubberband bounds (non-null)
-
panStartDrag
- Specified by:
panStartDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
panUpdateDrag
- Specified by:
panUpdateDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
panDoneDrag
- Specified by:
panDoneDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyStartMove
- Specified by:
magnifyStartMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyUpdateMove
- Specified by:
magnifyUpdateMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
magnifyDoneMove
- Specified by:
magnifyDoneMovein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
recenter
- Specified by:
recenterin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)
-
zoomIn
- Specified by:
zoomInin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
zoomOut
- Specified by:
zoomOutin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
undoZoom
- Specified by:
undoZoomin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
resetZoom
- Specified by:
resetZoomin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
styleEdit
- Specified by:
styleEditin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
delete
- Specified by:
deletein interfaceIToolHandler- Parameters:
gc- context (non-null)
-
createConnection
Description copied from interface:IToolHandlerCreate a connection between two points.- Specified by:
createConnectionin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)start- start point (non-null)end- end point (non-null)
-
approveConnectionPoint
Description copied from interface:IToolHandlerApprove or reject a connection point.- Specified by:
approveConnectionPointin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)p- point to approve/reject (non-null)- Returns:
- true to approve
-
createRectangle
Description copied from interface:IToolHandlerCreate a rectangle.- Specified by:
createRectanglein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- rectangle bounds (non-null)
-
createEllipse
Description copied from interface:IToolHandlerCreate an ellipse.- Specified by:
createEllipsein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)bounds- ellipse bounds (non-null)
-
createPolygon
Description copied from interface:IToolHandlerCreate a polygon.- Specified by:
createPolygonin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)vertices- polygon vertices (non-null)
-
createPolyline
Description copied from interface:IToolHandlerCreate a polyline.- Specified by:
createPolylinein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)vertices- polyline vertices (non-null)
-
createLine
Description copied from interface:IToolHandlerCreate a line between two points.- Specified by:
createLinein interfaceIToolHandler- Parameters:
gc- gesture context (non-null)start- start pointend- end point
-
createRadArc
Description copied from interface:IToolHandlerCreate a radial arc.The expected interpretation of vertices is tool-defined; for a typical radial arc gesture:
- vertices[0] = center
- vertices[1] = radius leg endpoint
- vertices[2] = angle-defining point
- Specified by:
createRadArcin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)pp- gesture vertices (non-null)
-
createTextItem
Description copied from interface:IToolHandlerCreate a text item at the given location.- Specified by:
createTextItemin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)location- text location (non-null)
-
captureImage
- Specified by:
captureImagein interfaceIToolHandler- Parameters:
gc- context (non-null)
-
print
- Specified by:
printin interfaceIToolHandler- Parameters:
gc- context (non-null)
-
doNotDrag
Description copied from interface:IToolHandlerOptional veto before starting a drag.- Specified by:
doNotDragin interfaceIToolHandler- Parameters:
gc- gesture context (non-null)- Returns:
- true to veto drag start, false to allow
-