Class AbstractViewBoxDrawing

All Implemented Interfaces:
Drawing, Figure, TransformCachingFigure, ViewBoxableDrawing, PropertyBean, StyleableBean, StyleablePropertyBean, TreeNode<Figure>
Direct Known Subclasses:
SimpleDrawing, SimpleLayeredDrawing

public abstract class AbstractViewBoxDrawing extends AbstractDrawing implements ViewBoxableDrawing, Figure
Abstract drawing that supports ViewBoxableDrawing.
  • Constructor Details

    • AbstractViewBoxDrawing

      public AbstractViewBoxDrawing()
    • AbstractViewBoxDrawing

      public AbstractViewBoxDrawing(double width, double height)
    • AbstractViewBoxDrawing

      public AbstractViewBoxDrawing(CssSize width, CssSize height)
  • Method Details

    • getLocalToParent

      public 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
    • getParentToLocal

      public 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
    • updateNode

      public void updateNode(RenderContext ctx, javafx.scene.Node n)
      Description copied from interface: Figure
      This method is invoked by a RenderContext, when it needs to update the node which represents the scene graph in the figure.

      A figure which is composed from child figures, must addChild the nodes of its getChildren to its node. This ensures that coordinate space transformations of the composed figure are properly propagated to its getChildren.

       public void updateNode(RenderContext rc, Node n) {
           ObservableList<Node> group = ((Group) n).getChildren();
       group.clear();
       for (Figure child : children()) {
       group.addChild(rc.getNode(child));
       }
       

      A figure may be shown in multiple RenderContexts. Each RenderContext uses this method to update the a JavaFX node for the figure.

      Note that the figure must retrieve the JavaFX node from other figures from the render context by invoking rc.getNode(child) rather than creating new nodes using child.createNode(rc). This convention allows to implement a cache in the render context for the Java FX node. Also, render contexts like a drawing view need to associate input events on Java FX nodes to the corresponding figure.

      This figure does not keep track of changes that require node updates. DrawingModel to manage node updates.

      Specified by:
      updateNode in interface Figure
      Overrides:
      updateNode in class AbstractDrawing
      Parameters:
      ctx - the render context
      n - the node which was created with Figure.createNode(org.jhotdraw8.draw.render.RenderContext)