Package com.inductiveautomation.rm.tool
Class RMPolygonShapeTool<T extends RMPolygonShape>
- java.lang.Object
-
- com.inductiveautomation.snap.ui.UIOwner<SwingEvent,javax.swing.JComponent>
-
- com.inductiveautomation.snap.swing.SwingOwner
-
- com.inductiveautomation.rm.tool.RMTool<T>
-
- com.inductiveautomation.rm.tool.RMPolygonShapeTool<T>
-
- Direct Known Subclasses:
RMAnimPathShapeTool,RMPencilShapeTool
public class RMPolygonShapeTool<T extends RMPolygonShape> extends RMTool<T>
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
Fields Modifier and Type Field Description static int_mouseDownPointIndex-
Fields 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 Constructor Description RMPolygonShapeTool()RMPolygonShapeTool(com.google.common.eventbus.EventBus ebus)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNewPoint()Add a point to the curve by subdividing the path segment at the hit point.protected javax.swing.JComponentcreateUI()Override to return empty panel.voiddeactivateTool()Overrides standard tool method to trigger polygon creation when the tool is deactivated.voiddeleteSelectedPoint()Delete the selected control point and readjust shape boundsRMRectgetBoundsSuperSelected(RMShape aShape)Returns the bounds for this shape when it's super-selected.RMSizegetPathHandleSize(RMPolygonShape aPoly)For hit testing - returns the size of the handles scaled to path coordinatesjava.lang.ClassgetShapeClass()Returns the class that this tool is responsible for.booleangetSmoothPathOnMouseUp()Returns whether tool should smooth path segments during creation.voidmouseDragged(java.awt.event.MouseEvent anEvent)Handles mouse dragged for polygon creation.voidmouseDragged(T aPolygon, java.awt.event.MouseEvent anEvent)Event handling for shape editing.voidmouseMoved(T aPolygon, java.awt.event.MouseEvent anEvent)Event handling - overridden to maintain default cursor.voidmousePressed(java.awt.event.MouseEvent anEvent)Handles mouse pressed for polygon creation.voidmousePressed(T aPolygon, java.awt.event.MouseEvent anEvent)Event handling for shape editing.voidmouseReleased(java.awt.event.MouseEvent anEvent)Handles mouse released for polygon creation.protected TnewInstance()Returns a new instance of the shape class that this tool is responsible for.voidpaintTool(java.awt.Graphics2D g)Draws the polygon tool's path durring path creation.voidprocessKeyEvent(T aShape, java.awt.event.KeyEvent anEvent)Editor method.voidreactivateTool()Overrides standard tool method to trigger polygon creation when the tool is reactivated.voidrespondUI(SwingEvent anEvent)Handles the pop-up menuvoidrunContextMenu(RMPolygonShape aPolyShape, java.awt.event.MouseEvent anEvent)Runs a context menu for the given event.voidwillLoseSuperSelectionInEditor(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
-
-
-
-
Method Detail
-
createUI
protected javax.swing.JComponent createUI()
Override to return empty panel.- Overrides:
createUIin classRMTool<T extends RMPolygonShape>
-
respondUI
public void respondUI(SwingEvent anEvent)
Handles the pop-up menu- Overrides:
respondUIin classUIOwner<SwingEvent,javax.swing.JComponent>
-
getShapeClass
public java.lang.Class getShapeClass()
Returns the class that this tool is responsible for.- Overrides:
getShapeClassin classRMTool<T extends RMPolygonShape>
-
newInstance
protected T newInstance()
Returns a new instance of the shape class that this tool is responsible for.- Overrides:
newInstancein classRMTool<T extends RMPolygonShape>
-
getSmoothPathOnMouseUp
public boolean getSmoothPathOnMouseUp()
Returns whether tool should smooth path segments during creation.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent anEvent)
Handles mouse pressed for polygon creation.- Overrides:
mousePressedin classRMTool<T extends RMPolygonShape>
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent anEvent)
Handles mouse dragged for polygon creation.- Overrides:
mouseDraggedin classRMTool<T extends RMPolygonShape>
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent anEvent)
Handles mouse released for polygon creation.- Overrides:
mouseReleasedin classRMTool<T extends RMPolygonShape>
-
mouseMoved
public void mouseMoved(T aPolygon, java.awt.event.MouseEvent anEvent)
Event handling - overridden to maintain default cursor.- Overrides:
mouseMovedin classRMTool<T extends RMPolygonShape>
-
mousePressed
public void mousePressed(T aPolygon, java.awt.event.MouseEvent anEvent)
Event handling for shape editing.- Overrides:
mousePressedin classRMTool<T extends RMPolygonShape>
-
mouseDragged
public void mouseDragged(T aPolygon, java.awt.event.MouseEvent anEvent)
Event handling for shape editing.- Overrides:
mouseDraggedin classRMTool<T extends RMPolygonShape>
-
deactivateTool
public void deactivateTool()
Overrides standard tool method to trigger polygon creation when the tool is deactivated.- Overrides:
deactivateToolin classRMTool<T extends RMPolygonShape>
-
reactivateTool
public void reactivateTool()
Overrides standard tool method to trigger polygon creation when the tool is reactivated.- Overrides:
reactivateToolin classRMTool<T extends RMPolygonShape>
-
willLoseSuperSelectionInEditor
public void willLoseSuperSelectionInEditor(RMShape aShape, RMEditor anEditor)
Editor method - called when an instance of this tool's shape in de-super-selected.- Overrides:
willLoseSuperSelectionInEditorin classRMTool<T extends RMPolygonShape>
-
paintTool
public void paintTool(java.awt.Graphics2D g)
Draws the polygon tool's path durring path creation.- Overrides:
paintToolin classRMTool<T extends RMPolygonShape>
-
getBoundsSuperSelected
public RMRect getBoundsSuperSelected(RMShape aShape)
Returns the bounds for this shape when it's super-selected.- Overrides:
getBoundsSuperSelectedin classRMTool<T extends RMPolygonShape>
-
runContextMenu
public void runContextMenu(RMPolygonShape aPolyShape, java.awt.event.MouseEvent anEvent)
Runs a context menu for the given event.
-
deleteSelectedPoint
public void deleteSelectedPoint()
Delete the selected control point and readjust shape bounds
-
processKeyEvent
public void processKeyEvent(T aShape, java.awt.event.KeyEvent anEvent)
Editor method.- Overrides:
processKeyEventin classRMTool<T extends RMPolygonShape>
-
addNewPoint
public void addNewPoint()
Add a point to the curve by subdividing the path segment at the hit point.
-
getPathHandleSize
public RMSize getPathHandleSize(RMPolygonShape aPoly)
For hit testing - returns the size of the handles scaled to path coordinates
-
-