Package com.inductiveautomation.rm.tool
Class RMPolygonShapeTool<T extends RMPolygonShape>
java.lang.Object
com.inductiveautomation.snap.ui.UIOwner<SwingEvent,JComponent>
com.inductiveautomation.snap.swing.SwingOwner
com.inductiveautomation.rm.tool.RMTool<T>
com.inductiveautomation.rm.tool.RMPolygonShapeTool<T>
- Direct Known Subclasses:
RMAnimPathShapeTool
,RMPencilShapeTool
This class manages creation and editing of polygon shapes.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inductiveautomation.rm.tool.RMTool
RMTool.RMShapeHandle
-
Field Summary
FieldsFields inherited from class com.inductiveautomation.rm.tool.RMTool
HandleE, HandleN, HandleNE, HandleNW, HandleS, HandleSE, HandleSW, HandleW, HandleWidth, SPLIT_RESET
Fields inherited from class com.inductiveautomation.snap.ui.UIOwner
DragDrop, DragEnter, DragEvents, DragExit, DragOver, KeyEvents, KeyFinished, KeyPressed, KeyReleased, KeyTyped, MouseClicked, MouseDragged, MouseEntered, MouseEvents, MouseExited, MouseFinished, MouseMoved, MousePressed, MouseReleased
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a point to the curve by subdividing the path segment at the hit point.protected JComponent
createUI()
Override to return empty panel.void
Overrides standard tool method to trigger polygon creation when the tool is deactivated.void
Delete the selected control point and readjust shape boundsgetBoundsSuperSelected
(RMShape aShape) Returns the bounds for this shape when it's super-selected.getPathHandleSize
(RMPolygonShape aPoly) For hit testing - returns the size of the handles scaled to path coordinatesReturns the class that this tool is responsible for.boolean
Returns whether tool should smooth path segments during creation.void
mouseDragged
(MouseEvent anEvent) Handles mouse dragged for polygon creation.void
mouseDragged
(T aPolygon, MouseEvent anEvent) Event handling for shape editing.void
mouseMoved
(T aPolygon, MouseEvent anEvent) Event handling - overridden to maintain default cursor.void
mousePressed
(MouseEvent anEvent) Handles mouse pressed for polygon creation.void
mousePressed
(T aPolygon, MouseEvent anEvent) Event handling for shape editing.void
mouseReleased
(MouseEvent anEvent) Handles mouse released for polygon creation.protected T
Returns a new instance of the shape class that this tool is responsible for.void
Draws the polygon tool's path durring path creation.void
processKeyEvent
(T aShape, KeyEvent anEvent) Editor method.void
Overrides standard tool method to trigger polygon creation when the tool is reactivated.void
respondUI
(SwingEvent anEvent) Handles the pop-up menuvoid
runContextMenu
(RMPolygonShape aPolyShape, MouseEvent anEvent) Runs a context menu for the given event.void
willLoseSuperSelectionInEditor
(RMShape aShape, RMEditor anEditor) Editor method - called when an instance of this tool's shape in de-super-selected.Methods inherited from class com.inductiveautomation.rm.tool.RMTool
acceptsDrag, activateTool, attachEventBus, didBecomeSuperSelectedShapeInEditor, dragEnter, dragExit, dragOver, drop, dropClass, dropColor, dropDragKey, dropFiles, dropString, flavorForClass, flushChanges, getAcceptsChildren, getDatasetEntity, getDragDisplayBounds, getEditor, getEditorPane, getFont, getFontDeep, getGalleryClone, getHandleAtPoint, getHandleCount, getHandleCursor, getHandleOpposing, getHandlePoint, getHandleRect, getIcon, getIcon, getPointsFromUnits, getSelectedShape, getSelectedShapes, getSelectTool, getShapeFillInspector, getShapeHandleAtPoint, getTool, getTool, getToolTipText, getUnitsFromPoints, getWindowTitle, isSelected, isSuperSelectable, isSuperSelected, isUngroupable, mouseMoved, mousePressedSelection, mouseReleased, moveShapeHandle, paintShapeHandles, setFont, setFontBold, setFontBoldDeep, setFontFamily, setFontFamilyDeep, setFontItalic, setFontItalicDeep, setFontName, setFontNameDeep, setFontSize, setFontSizeDeep
Methods inherited from class com.inductiveautomation.snap.swing.SwingOwner
addKeyActionEvent, createTimer, createUI, createWindow, getNode, getNode, getNodeHelper, getTimer, getTimer, getUI, getWindow, isEventThread, isWindowVisible, requestFocus, requestFocusImpl, runLater, sendEvent, setWindowVisible
Methods inherited from class com.inductiveautomation.snap.ui.UIOwner
addNodeBinding, disableEvents, enableEvents, getBindingModelValue, getBindingNodeValue, getConversionMap, getConversionMapKey, getConversionMaps, getConversionMapValue, getFirstFocus, getModelValue, getNode, getNodeAction, getNodeBoolValue, getNodeFloatValue, getNodeIntValue, getNodeItemDisplayKey, getNodeItems, getNodeSelectedIndex, getNodeSelectedItem, getNodeStringValue, getNodeText, getNodeValue, getUI, getUIHpr, initUI, initUI, isNodeEnabled, isNodeValueAdjusting, isSendEventDisabled, isUISet, processResetUI, processRespondUI, resetLater, resetNodeBindings, resetUI, runLaterDelayed, runLaterOnce, sendEvent, sendNodeAction, setBindingModelValue, setBindingNodeValue, setFirstFocus, setModelValue, setNodeAction, setNodeEnabled, setNodeItemDisplayKey, setNodeItems, setNodeItems, setNodeSelectedIndex, setNodeSelectedItem, setNodeText, setNodeValue, setSendEventDisabled
-
Field Details
-
_mouseDownPointIndex
public static int _mouseDownPointIndex
-
-
Constructor Details
-
RMPolygonShapeTool
public RMPolygonShapeTool() -
RMPolygonShapeTool
public RMPolygonShapeTool(com.google.common.eventbus.EventBus ebus)
-
-
Method Details
-
createUI
Override to return empty panel.- Overrides:
createUI
in classRMTool<T extends RMPolygonShape>
-
respondUI
Handles the pop-up menu- Overrides:
respondUI
in classUIOwner<SwingEvent,
JComponent>
-
getShapeClass
Returns the class that this tool is responsible for.- Overrides:
getShapeClass
in classRMTool<T extends RMPolygonShape>
-
newInstance
Returns a new instance of the shape class that this tool is responsible for.- Overrides:
newInstance
in classRMTool<T extends RMPolygonShape>
-
getSmoothPathOnMouseUp
public boolean getSmoothPathOnMouseUp()Returns whether tool should smooth path segments during creation. -
mousePressed
Handles mouse pressed for polygon creation.- Overrides:
mousePressed
in classRMTool<T extends RMPolygonShape>
-
mouseDragged
Handles mouse dragged for polygon creation.- Overrides:
mouseDragged
in classRMTool<T extends RMPolygonShape>
-
mouseReleased
Handles mouse released for polygon creation.- Overrides:
mouseReleased
in classRMTool<T extends RMPolygonShape>
-
mouseMoved
Event handling - overridden to maintain default cursor.- Overrides:
mouseMoved
in classRMTool<T extends RMPolygonShape>
-
mousePressed
Event handling for shape editing.- Overrides:
mousePressed
in classRMTool<T extends RMPolygonShape>
-
mouseDragged
Event handling for shape editing.- Overrides:
mouseDragged
in classRMTool<T extends RMPolygonShape>
-
deactivateTool
public void deactivateTool()Overrides standard tool method to trigger polygon creation when the tool is deactivated.- Overrides:
deactivateTool
in classRMTool<T extends RMPolygonShape>
-
reactivateTool
public void reactivateTool()Overrides standard tool method to trigger polygon creation when the tool is reactivated.- Overrides:
reactivateTool
in classRMTool<T extends RMPolygonShape>
-
willLoseSuperSelectionInEditor
Editor method - called when an instance of this tool's shape in de-super-selected.- Overrides:
willLoseSuperSelectionInEditor
in classRMTool<T extends RMPolygonShape>
-
paintTool
Draws the polygon tool's path durring path creation.- Overrides:
paintTool
in classRMTool<T extends RMPolygonShape>
-
getBoundsSuperSelected
Returns the bounds for this shape when it's super-selected.- Overrides:
getBoundsSuperSelected
in classRMTool<T extends RMPolygonShape>
-
runContextMenu
Runs a context menu for the given event. -
deleteSelectedPoint
public void deleteSelectedPoint()Delete the selected control point and readjust shape bounds -
processKeyEvent
Editor method.- Overrides:
processKeyEvent
in classRMTool<T extends RMPolygonShape>
-
addNewPoint
public void addNewPoint()Add a point to the curve by subdividing the path segment at the hit point. -
getPathHandleSize
For hit testing - returns the size of the handles scaled to path coordinates
-