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.
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected java.awt.geom.Rectangle2D |
_last
Holds our last known size, set after each repaint is evaluated
|
protected java.awt.geom.Rectangle2D |
_rect
Used during repaint, and compared to _last to determine the correct repaint window.
|
protected java.awt.geom.Rectangle2D |
_rel
Holds the last set of relative position values that we knew about, so that property change events can have an
accurate last value.
|
protected double |
angle |
protected 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.
|
protected java.awt.geom.Point2D |
rotationAnchor
The saved rotation anchor for the shape, specified in relative terms, e.g.
|
static java.lang.String |
SCALE_STROKE_HINT |
protected java.awt.geom.AffineTransform |
tempTransform
A temporary transform that may be set to perform a blanket transform op on the shape.
|
antialias, context, cursorCode
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
RESERVED_SET_KEY
COMPONENT_LOCKED, COMPONENT_PERMISSIONS, COMPONENT_SECURITY, COMPONENT_TRANSLATIONS
COMPONENT_RUNNING
Modifier | Constructor and Description |
---|---|
protected |
AbstractVisionShape() |
Modifier and Type | Method and Description |
---|---|
protected void |
_setAngle(double newAngle)
Updates the internal angle property and fires property change events.
|
protected 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.
|
void |
clearTempTransmform() |
boolean |
contains(int x,
int y) |
protected void |
firePositionChange()
Fires change events (if necessary) for the relX, relY, relWidth, and relHeight properties
|
protected 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.
|
double |
getAngleDegrees() |
double |
getAngleRadians() |
abstract java.awt.Shape |
getArea()
Return the area that this shape will paint in.
|
java.awt.geom.Rectangle2D |
getBoundingRect()
Calculates the smallest rectangle that encloses the entire shape, creating a new rectangle for the return value.
|
java.awt.geom.Rectangle2D |
getBoundingRect(java.awt.geom.Rectangle2D rv)
Calculates the smallest rectangle that encloses the entire shape.
|
protected abstract java.awt.geom.Point2D |
getCenterpoint() |
java.awt.geom.Rectangle2D |
getOriginalBounds() |
double |
getRelHeight() |
double |
getRelWidth() |
double |
getRelX() |
double |
getRelY() |
java.awt.geom.Point2D |
getRotationAnchor()
Gets the shapes saved rotation anchor.
|
abstract java.awt.geom.Rectangle2D |
getShapeBounds(java.awt.geom.Rectangle2D rv) |
abstract float |
getStrokeSize()
Used to outset the repaint region so that widely stroked shapes get repainted correctly.
|
java.awt.geom.AffineTransform |
getTempTransform() |
protected void |
paintComponent(java.awt.Graphics _g) |
protected abstract void |
paintShape(java.awt.Graphics2D g)
Draw the shape to the given graphics object.
|
void |
repaint()
Repaint overridden for performance.
|
void |
rotate(double angle,
double x,
double y)
This version is for scripting, since Point2D's are awkward to create in Python.
|
void |
rotate(double angle,
java.awt.geom.Point2D center)
Manipulate the underlying shape/transform so to rotate it.
|
protected abstract void |
rotateImpl(double angle,
java.awt.geom.Point2D center)
Actual implementation of rotation logic from sub-class.
|
protected 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.
|
void |
setAngleDegrees(double newAngle) |
void |
setAngleRadians(double newAngle)
Rotates the shape by the difference between the new angle and the existing angle, around the shape's rotation
anchor.
|
void |
setBorder(javax.swing.border.Border b)
Overridden to be a no-op.
|
abstract void |
setBoundingRect(java.awt.geom.Rectangle2D newBounds)
Manipulate the underlying shape/transform so that the shape fits within the new bounding rectangle.
|
void |
setOriginalBounds(java.awt.geom.Rectangle2D rect) |
void |
setRelHeight(double newHeight) |
void |
setRelWidth(double newWidth) |
void |
setRelX(double newX) |
void |
setRelY(double newY) |
void |
setRotationAnchor(java.awt.geom.Point2D rotationCenter) |
void |
setTempTransform(java.awt.geom.AffineTransform tempTransform) |
java.lang.String |
toString() |
protected void |
updateRelBounds(double x,
double y,
double w,
double h) |
getAppContext, getCursorCode, getDataQuality, getDynamicProps, getProperties, getPropertyValue, getStyles, getToolTipText, isAntialias, isPropertyDefined, localeChanged, onShutdown, onStartup, paintChildren, setAntialias, setCursorCode, setDataQuality, setDynamicProps, setName, setPropertyValue, setStyles, setToolTipText, setVisible, shutdownComponent, startupComponent, updateQuality
addAncestorListener, 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, 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
add, 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
action, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String SCALE_STROKE_HINT
protected java.awt.geom.Rectangle2D origBounds
protected java.awt.geom.Rectangle2D _rel
protected java.awt.geom.Rectangle2D _rect
protected java.awt.geom.Rectangle2D _last
protected java.awt.geom.AffineTransform tempTransform
protected double angle
protected java.awt.geom.Point2D rotationAnchor
public boolean contains(int x, int y)
contains
in class javax.swing.JComponent
public java.awt.geom.Rectangle2D getOriginalBounds()
getOriginalBounds
in interface Bounds2DComponent
public void setOriginalBounds(java.awt.geom.Rectangle2D rect)
setOriginalBounds
in interface Bounds2DComponent
protected abstract java.awt.geom.Point2D getCenterpoint()
protected void _setAngle(double newAngle)
public double getAngleRadians()
public void setAngleRadians(double newAngle)
public double getAngleDegrees()
public void setAngleDegrees(double newAngle)
public java.awt.geom.Point2D getRotationAnchor()
public void setRotationAnchor(java.awt.geom.Point2D rotationCenter)
protected void firePositionChange()
protected void updateRelBounds(double x, double y, double w, double h)
public double getRelX()
public void setRelX(double newX)
public double getRelY()
public void setRelY(double newY)
public double getRelWidth()
public void setRelWidth(double newWidth)
public double getRelHeight()
public void setRelHeight(double newHeight)
public java.awt.geom.AffineTransform getTempTransform()
public void setTempTransform(java.awt.geom.AffineTransform tempTransform)
public void clearTempTransmform()
public final void setBorder(javax.swing.border.Border b)
setBorder
in class javax.swing.JComponent
public void repaint()
getBoundingRect()
to get
the shape's true bounds, and repaints only that region.repaint
in class java.awt.Component
protected static int floor(double d)
protected static int ceil(double d)
protected static int round(double d)
protected void paintComponent(java.awt.Graphics _g)
paintComponent
in class AbstractVisionComponent
public java.awt.geom.Rectangle2D getBoundingRect()
getBoundingRect
in interface Bounds2DComponent
public final java.awt.geom.Rectangle2D getBoundingRect(java.awt.geom.Rectangle2D rv)
getBoundingRect
in interface Bounds2DComponent
rv
- The "return value" rectangle. May be null, in which case a new rectangle will be returned.public abstract java.awt.geom.Rectangle2D getShapeBounds(java.awt.geom.Rectangle2D rv)
public abstract float getStrokeSize()
public abstract void setBoundingRect(java.awt.geom.Rectangle2D newBounds)
setBoundingRect
in interface Bounds2DComponent
public final void rotate(double angle, java.awt.geom.Point2D center)
angle
- The angle to rotate the shape, specified in radians.center
- The point around which to rotate.public final void rotate(double angle, double x, double y)
protected abstract void rotateImpl(double angle, java.awt.geom.Point2D center)
protected abstract void paintShape(java.awt.Graphics2D g)
public abstract java.awt.Shape getArea()
public java.lang.String toString()
toString
in class java.awt.Component