Class AbstractVisionShape
- java.lang.Object
- 
- java.awt.Component
- 
- java.awt.Container
- 
- javax.swing.JComponent
- 
- com.inductiveautomation.vision.api.client.components.model.AbstractVisionComponent
- 
- com.inductiveautomation.vision.api.client.components.shapes.AbstractVisionShape
 
 
 
 
 
- 
- All Implemented Interfaces:
- DynamicPropertyProvider,- LocaleListener,- MutableDynamicPropertyProvider,- StyleProvider,- Bounds2DComponent,- ComponentLifecycle,- QualityMonitor,- VisionComponent,- java.awt.image.ImageObserver,- java.awt.MenuContainer,- java.io.Serializable
 - Direct Known Subclasses:
- PathBasedVisionShape,- ShapeGroup
 
 public abstract class AbstractVisionShape extends AbstractVisionComponent implements Bounds2DComponent The superclass for all "shape" components used in the Ignition Vision module. This a special class of components that gets special treatment from the layout and designer system. These shapes paint themselves anywhere within their parent containers, and don't participate in certain Swing features such as border. These shapes need not be rectangular, and the getArea() call will be used for mouse hit-testing and selection hit-testing. - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected doubleangleprotected java.awt.geom.Rectangle2DlastSizeHolds our last known size, set after each repaint is evaluatedprotected java.awt.geom.Rectangle2DorigBoundsHolds the bounds of the shape before layout starts messing with it, so we can remember our original bounds relative to our parent.protected java.awt.geom.Rectangle2DrectUsed during repaint, and compared to _last to determine the correct repaint window.protected java.awt.geom.Rectangle2DrelPosHolds the last set of relative position values that we knew about, so that property change events can have an accurate last value.protected java.awt.geom.Point2DrotationAnchorThe saved rotation anchor for the shape, specified in relative terms, e.g.static java.lang.StringSCALE_STROKE_HINTprotected java.awt.geom.AffineTransformtempTransformA temporary transform that may be set to perform a blanket transform op on the shape.- 
Fields inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionComponentantialias, context, cursorCode
 - 
Fields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 - 
Fields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 - 
Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.ComponentLifecycleCOMPONENT_RUNNING
 - 
Fields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 - 
Fields inherited from interface com.inductiveautomation.ignition.client.model.LocaleListenerLOCAL_CHANGE_EVENT
 - 
Fields inherited from interface com.inductiveautomation.vision.api.client.binding.MutableDynamicPropertyProviderRESERVED_SET_KEY
 - 
Fields inherited from interface com.inductiveautomation.vision.api.client.components.model.VisionComponentCOMPONENT_LOCKED, COMPONENT_PERMISSIONS, COMPONENT_SECURITY, COMPONENT_TRANSLATIONS
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractVisionShape()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void_setAngle(double newAngle)Updates the internal angle property and fires property change events.protected static intceil(double d)Special implementation of ceil to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.voidclearTempTransmform()booleancontains(int x, int y)protected voidfirePositionChange()Fires change events (if necessary) for the relX, relY, relWidth, and relHeight propertiesprotected static intfloor(double d)Special implementation of floor to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.doublegetAngleDegrees()doublegetAngleRadians()abstract java.awt.ShapegetArea()Return the area that this shape will paint in.java.awt.geom.Rectangle2DgetBoundingRect()Calculates the smallest rectangle that encloses the entire shape, creating a new rectangle for the return value.java.awt.geom.Rectangle2DgetBoundingRect(java.awt.geom.Rectangle2D rv)Calculates the smallest rectangle that encloses the entire shape.protected abstract java.awt.geom.Point2DgetCenterpoint()java.awt.geom.Rectangle2DgetOriginalBounds()doublegetRelHeight()doublegetRelWidth()doublegetRelX()doublegetRelY()java.awt.geom.Point2DgetRotationAnchor()Gets the shapes saved rotation anchor.abstract java.awt.geom.Rectangle2DgetShapeBounds(java.awt.geom.Rectangle2D rv)abstract floatgetStrokeSize()Used to outset the repaint region so that widely stroked shapes get repainted correctly.java.awt.geom.AffineTransformgetTempTransform()protected voidpaintComponent(java.awt.Graphics graphics)protected abstract voidpaintShape(java.awt.Graphics2D g)Draw the shape to the given graphics object.voidrepaint()Repaint overridden for performance.voidrotate(double angle, double x, double y)This version is for scripting, since Point2D's are awkward to create in Python.voidrotate(double angle, java.awt.geom.Point2D center)Manipulate the underlying shape/transform so to rotate it.protected abstract voidrotateImpl(double angle, java.awt.geom.Point2D center)Actual implementation of rotation logic from sub-class.protected static intround(double d)Special implementation of round to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.voidsetAngleDegrees(double newAngle)voidsetAngleRadians(double newAngle)Rotates the shape by the difference between the new angle and the existing angle, around the shape's rotation anchor.voidsetBorder(javax.swing.border.Border b)Overridden to be a no-op.abstract voidsetBoundingRect(java.awt.geom.Rectangle2D newBounds)Manipulate the underlying shape/transform so that the shape fits within the new bounding rectangle.voidsetOriginalBounds(java.awt.geom.Rectangle2D rect)voidsetRelHeight(double newHeight)voidsetRelWidth(double newWidth)voidsetRelX(double newX)voidsetRelY(double newY)voidsetRotationAnchor(java.awt.geom.Point2D rotationCenter)voidsetTempTransform(java.awt.geom.AffineTransform tempTransform)java.lang.StringtoString()protected voidupdateRelBounds(double x, double y, double w, double h)- 
Methods inherited from class com.inductiveautomation.vision.api.client.components.model.AbstractVisionComponentgetAppContext, getCursorCode, getDataQuality, getDynamicProps, getProperties, getPropertyValue, getQuality, getStyles, getToolTipText, isAntialias, isPropertyDefined, localeChanged, onShutdown, onStartup, paintChildren, setAntialias, setCursorCode, setDataQuality, setDynamicProps, setName, setPropertyValue, setQuality, setStyles, setToolTipText, setVisible, shutdownComponent, startupComponent, updateQuality
 - 
Methods inherited from class javax.swing.JComponentaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
 - 
Methods inherited from class java.awt.Containeradd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 - 
Methods inherited from class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
- 
 
- 
- 
- 
Field Detail- 
SCALE_STROKE_HINTpublic static final java.lang.String SCALE_STROKE_HINT - See Also:
- Constant Field Values
 
 - 
origBoundsprotected java.awt.geom.Rectangle2D origBounds Holds the bounds of the shape before layout starts messing with it, so we can remember our original bounds relative to our parent.
 - 
relPosprotected java.awt.geom.Rectangle2D relPos Holds the last set of relative position values that we knew about, so that property change events can have an accurate last value.
 - 
rectprotected java.awt.geom.Rectangle2D rect Used during repaint, and compared to _last to determine the correct repaint window.
 - 
lastSizeprotected java.awt.geom.Rectangle2D lastSize Holds our last known size, set after each repaint is evaluated
 - 
tempTransformprotected java.awt.geom.AffineTransform tempTransform A temporary transform that may be set to perform a blanket transform op on the shape. Applied extremely late, during painting, and does not alter any underlying shape information.
 - 
angleprotected double angle 
 - 
rotationAnchorprotected java.awt.geom.Point2D rotationAnchor The saved rotation anchor for the shape, specified in relative terms, e.g. (pct*X, pct*Y). Serialized.
 
- 
 - 
Method Detail- 
containspublic boolean contains(int x, int y)- Overrides:
- containsin class- javax.swing.JComponent
 
 - 
getOriginalBoundspublic java.awt.geom.Rectangle2D getOriginalBounds() - Specified by:
- getOriginalBoundsin interface- Bounds2DComponent
 
 - 
setOriginalBoundspublic void setOriginalBounds(java.awt.geom.Rectangle2D rect) - Specified by:
- setOriginalBoundsin interface- Bounds2DComponent
 
 - 
getCenterpointprotected abstract java.awt.geom.Point2D getCenterpoint() 
 - 
_setAngleprotected void _setAngle(double newAngle) Updates the internal angle property and fires property change events. Note that calling this method does not actually rotate the object, that should already be done.
 - 
getAngleRadianspublic double getAngleRadians() 
 - 
setAngleRadianspublic void setAngleRadians(double newAngle) Rotates the shape by the difference between the new angle and the existing angle, around the shape's rotation anchor.
 - 
getAngleDegreespublic double getAngleDegrees() 
 - 
setAngleDegreespublic void setAngleDegrees(double newAngle) 
 - 
getRotationAnchorpublic java.awt.geom.Point2D getRotationAnchor() Gets the shapes saved rotation anchor. Specified in relative terms, e.g. (pct*X, pct%Y). Defaults to the center of the component, or (0.5, 0.5)
 - 
setRotationAnchorpublic void setRotationAnchor(java.awt.geom.Point2D rotationCenter) 
 - 
firePositionChangeprotected void firePositionChange() Fires change events (if necessary) for the relX, relY, relWidth, and relHeight properties
 - 
updateRelBoundsprotected void updateRelBounds(double x, double y, double w, double h)
 - 
getRelXpublic double getRelX() 
 - 
setRelXpublic void setRelX(double newX) 
 - 
getRelYpublic double getRelY() 
 - 
setRelYpublic void setRelY(double newY) 
 - 
getRelWidthpublic double getRelWidth() 
 - 
setRelWidthpublic void setRelWidth(double newWidth) 
 - 
getRelHeightpublic double getRelHeight() 
 - 
setRelHeightpublic void setRelHeight(double newHeight) 
 - 
getTempTransformpublic java.awt.geom.AffineTransform getTempTransform() 
 - 
setTempTransformpublic void setTempTransform(java.awt.geom.AffineTransform tempTransform) 
 - 
clearTempTransmformpublic void clearTempTransmform() 
 - 
setBorderpublic final void setBorder(javax.swing.border.Border b) Overridden to be a no-op. Because Swing thinks that the component has the same bounds as the parent, borders would be in the wrong spot.- Overrides:
- setBorderin class- javax.swing.JComponent
 
 - 
repaintpublic void repaint() Repaint overridden for performance. Because all shapes take the entire bounds of their parents, we don't want to repaint what Swing considers to be the bounds. This function defers togetBoundingRect()to get the shape's true bounds, and repaints only that region.- Overrides:
- repaintin class- java.awt.Component
 
 - 
floorprotected static int floor(double d) Special implementation of floor to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.
 - 
ceilprotected static int ceil(double d) Special implementation of ceil to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.
 - 
roundprotected static int round(double d) Special implementation of round to help with the fact that vision shapes use double-precision 2d graphics, but in reality drawing often uses integer-precision space.
 - 
paintComponentprotected void paintComponent(java.awt.Graphics graphics) - Overrides:
- paintComponentin class- AbstractVisionComponent
 
 - 
getBoundingRectpublic java.awt.geom.Rectangle2D getBoundingRect() Calculates the smallest rectangle that encloses the entire shape, creating a new rectangle for the return value.- Specified by:
- getBoundingRectin interface- Bounds2DComponent
 
 - 
getBoundingRectpublic final java.awt.geom.Rectangle2D getBoundingRect(java.awt.geom.Rectangle2D rv) Calculates the smallest rectangle that encloses the entire shape.- Specified by:
- getBoundingRectin interface- Bounds2DComponent
- Parameters:
- rv- The "return value" rectangle. May be null, in which case a new rectangle will be returned.
- Returns:
- A rectangle (rv if it was not null) containing the current bounds, relative to the shape's nearest non-group parent.
 
 - 
getShapeBoundspublic abstract java.awt.geom.Rectangle2D getShapeBounds(java.awt.geom.Rectangle2D rv) 
 - 
getStrokeSizepublic abstract float getStrokeSize() Used to outset the repaint region so that widely stroked shapes get repainted correctly.
 - 
setBoundingRectpublic abstract void setBoundingRect(java.awt.geom.Rectangle2D newBounds) Manipulate the underlying shape/transform so that the shape fits within the new bounding rectangle.- Specified by:
- setBoundingRectin interface- Bounds2DComponent
 
 - 
rotatepublic final void rotate(double angle, java.awt.geom.Point2D center)Manipulate the underlying shape/transform so to rotate it.- Parameters:
- angle- The angle to rotate the shape, specified in radians.
- center- The point around which to rotate.
 
 - 
rotatepublic final void rotate(double angle, double x, double y)This version is for scripting, since Point2D's are awkward to create in Python.
 - 
rotateImplprotected abstract void rotateImpl(double angle, java.awt.geom.Point2D center)Actual implementation of rotation logic from sub-class.
 - 
paintShapeprotected abstract void paintShape(java.awt.Graphics2D g) Draw the shape to the given graphics object.
 - 
getAreapublic abstract java.awt.Shape getArea() Return the area that this shape will paint in. The area should be enclosed within the bounding rectangle, but may cover less area than the entire bounding rectangle. Used for mouse hit-testing.
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.awt.Component
 
 
- 
 
-