Class ShapeDelegate
java.lang.Object
com.inductiveautomation.vision.api.client.components.shapes.ShapeDelegate
- Direct Known Subclasses:
ArrowShape
,EllipseShape
,PathShape
,PolygonShape
,RectangleShape
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
alterShape
(Rectangle2D newRect) Directly modify the shape's frame so that it fits tightly within the new framing rectangle.Convert this shape to a GeneralPathcreateArea
(Shape shape, float strokeWidth, boolean filled) Gives the delegate a chance to create the hit-testing area appropriate for it's shape.getBounds2D
(Shape shape) Provides a way for the delegate to do custom calculation of the shape's bounds.getCenterpoint
(Rectangle2D bounds, Point2D rv) abstract Shape
getShape()
The AWT shape this delegate producesabstract String
boolean
Some shape delegates prefer to handle rotation themselves, instead of having the PathBasedVisionShape parent rotate their shape after the fact.abstract boolean
void
void
translateShape
(double dX, double dY) Move the shape using the provided offsets.
-
Constructor Details
-
ShapeDelegate
public ShapeDelegate()
-
-
Method Details
-
getShape
The AWT shape this delegate produces -
alterShape
Directly modify the shape's frame so that it fits tightly within the new framing rectangle.- Parameters:
newRect
- The new bounding rectangle for the shape.- Returns:
- false if the shape was unable to alter itself into the given rectangle.
-
translateShape
public void translateShape(double dX, double dY) Move the shape using the provided offsets. Default implementation calls alterShape. -
getBounds2D
Provides a way for the delegate to do custom calculation of the shape's bounds. Default implementation is:return shape.getBounds2D();
-
createArea
Gives the delegate a chance to create the hit-testing area appropriate for it's shape.- Parameters:
shape
- The shape, after applying rotation transform.strokeWidth
- The width of the stroke, of 0 if the path isn't strokedfilled
- Whether or not the shape will be filled with a paint.
-
getCenterpoint
-
convertToPath
Convert this shape to a GeneralPath -
isSymmetric
public abstract boolean isSymmetric() -
isRotatable
public boolean isRotatable()Some shape delegates prefer to handle rotation themselves, instead of having the PathBasedVisionShape parent rotate their shape after the fact. Delegates that do this should return true from this method, and then handle the rotate method appropriately. Note that all rotations must go through the PathBasedVisionShape so that it can update the angle property. -
rotate
-
getToolKey
-