Interface TransformableFigure

All Superinterfaces:
Figure, PropertyBean, StyleableBean, StyleablePropertyBean, TransformCachingFigure, TreeNode<Figure>
All Known Implementing Classes:
AbstractLabelConnectionFigure, ArcFigure, BezierPathFigure, CombinedPathFigure, EllipseFigure, GroupFigure, ImageFigure, LabelFigure, LineFigure, PageFigure, PageLabelFigure, PolygonFigure, PolylineFigure, RectangleFigure, RegionFigure, SimpleLabelConnectionFigure, SliceFigure, TextAreaFigure, TextFigure

public interface TransformableFigure extends TransformCachingFigure, Figure
A transformable figure supports the transformation of a figure.

The following transformations are supported:

  • Translation of the local bounds of the figure.
  • Rotation around the center of the untransformed local bounds of the figure.
  • Scaling around the center of the untransformed local bounds of the figure.
  • Arbitrary sequence of affine transformations of the figure.
Note that transformation matrices computed from the Rotation and Scaling must be recomputed every time when the local bounds of the figure change.
Author:
Werner Randelshofer
  • Field Details

    • CACHE

      static final boolean CACHE
      See Also:
    • ROTATE

      static final @NonNull DoubleStyleableKey ROTATE
      Defines the angle of rotation around the rotation pivot of the figure in degrees.

      Default value: 0.

    • ROTATION_PIVOT

      static final @NonNull CssPoint2DStyleableKey ROTATION_PIVOT
      Defines the pivot of the rotation.

      Default value: 0.5, 0.5.

    • ROTATION_AXIS

      static final @NonNull NonNullObjectKey<javafx.geometry.Point3D> ROTATION_AXIS
      Defines the rotation axis used.

      Default value: Rotate.Z_AXIS.

    • SCALE_X

      static final @NonNull DoubleStyleableKey SCALE_X
      Defines the scale factor by which coordinates are scaled on the x axis about the center of the figure. Default value: 1.
    • SCALE_Y

      static final @NonNull DoubleStyleableKey SCALE_Y
      Defines the scale factor by which coordinates are scaled on the y axis about the center of the figure. Default value: 1.
    • SCALE_Z

      static final @NonNull DoubleStyleableKey SCALE_Z
      Defines the scale factor by which coordinates are scaled on the z axis about the center of the figure. Default value: 1.
    • SCALE

      Defines the scale factor by which coordinates are scaled on the axes about the center of the figure.
    • TRANSFORMS

      static final @NonNull TransformListStyleableKey TRANSFORMS
    • TRANSLATE_X

      static final @NonNull DoubleStyleableKey TRANSLATE_X
      Defines the translation on the x axis about the center of the figure. Default value: 0.
    • TRANSLATE_Y

      static final @NonNull DoubleStyleableKey TRANSLATE_Y
      Defines the translation on the y axis about the center of the figure. Default value: 0.
    • TRANSLATE_Z

      static final @NonNull DoubleStyleableKey TRANSLATE_Z
      Defines the translation on the z axis about the center of the figure. Default value: 0.
    • TRANSLATE

      static final @NonNull Point3DStyleableMapAccessor TRANSLATE
      Defines the translation on the axes about the center of the figure.
  • Method Details

    • getDeclaredKeys

      static @NonNull Set<Key<?>> getDeclaredKeys()
    • applyTransformableFigureProperties

      default void applyTransformableFigureProperties(@NonNull RenderContext ctx, @NonNull javafx.scene.Node node)
      Updates a figure node with all transformation properties defined in this interface.

      Applies the following properties: TRANSFORM, translation TRANSLATE_X, TRANSLATE_Y, TRANSLATE_Z, scale SCALE_X, SCALE_Y, SCALE_Z, and rotation ROTATE, ROTATION_AXIS.

      This method is intended to be used by Figure.updateNode(org.jhotdraw8.draw.render.RenderContext, javafx.scene.Node).

      Parameters:
      ctx - the render context
      node - a node which was created with method Figure.createNode(org.jhotdraw8.draw.render.RenderContext).
    • clearTransforms

      default void clearTransforms()
    • flattenTransforms

      default void flattenTransforms()
    • getInverseTransform

      default @NonNull javafx.scene.transform.Transform getInverseTransform()
    • getLocalToParent

      default @NonNull javafx.scene.transform.Transform getLocalToParent()
      Description copied from interface: Figure
      Returns the transformation from local coordinates into parent coordinates.

      This method may use caching and return incorrect results if the cache is stale.

      Specified by:
      getLocalToParent in interface Figure
      Returns:
      the transformation
    • getLocalToParent

      default @NonNull javafx.scene.transform.Transform getLocalToParent(boolean styled)
    • getLocalToParentAsList

      default @NonNull List<javafx.scene.transform.Transform> getLocalToParentAsList(boolean styled)
    • getParentToLocal

      default @NonNull javafx.scene.transform.Transform getParentToLocal()
      Description copied from interface: Figure
      Returns the transformation from parent coordinates into local coordinates.

      This method may use caching and return incorrect results if the cache is stale.

      Specified by:
      getParentToLocal in interface Figure
      Returns:
      the transformation
    • getParentToLocal

      default @NonNull javafx.scene.transform.Transform getParentToLocal(boolean styled)
    • getTransform

      default @NonNull javafx.scene.transform.Transform getTransform()
      Gets the TRANSFORMS flattened into a single transform.
      Returns:
      the flattened transforms
    • hasCenterTransforms

      default boolean hasCenterTransforms()
    • reshapeInLocal

      default void reshapeInLocal(javafx.scene.transform.Transform transform)
      Description copied from interface: Figure
      Attempts to change the local bounds of the figure.

      The figure may choose to only partially change its local bounds.

      Specified by:
      reshapeInLocal in interface Figure
      Parameters:
      transform - the desired transformation in local coordinates
    • reshapeInParent

      default void reshapeInParent(@NonNull javafx.scene.transform.Transform transform)
      Description copied from interface: Figure
      Attempts to change the parent bounds of the figure.

      The figure may choose to only partially change its parent bounds.

      This method may also call reshapeInLocal on child figures.

      Specified by:
      reshapeInParent in interface Figure
      Parameters:
      transform - the desired transformation in parent coordinates
    • setTransforms

      default void setTransforms(@NonNull javafx.scene.transform.Transform... transforms)
      Convenience method for setting a new value for the TRANSFORMS property.
      Parameters:
      transforms - new value
    • transformInLocal

      default void transformInLocal(@NonNull javafx.scene.transform.Transform t)
      Description copied from interface: Figure
      Attempts to transform the figure.

      The figure may choose to only partially change its transformation.

      Specified by:
      transformInLocal in interface Figure
      Parameters:
      t - the desired transformation in local coordinates
    • transformInParent

      default void transformInParent(@NonNull javafx.scene.transform.Transform t)
      Description copied from interface: Figure
      Attempts to transform the figure.

      The figure may choose to only partially change its transformation.

      Specified by:
      transformInParent in interface Figure
      Parameters:
      t - the desired transformation in parent coordinates