java.lang.Object
org.openscience.cdk.renderer.elements.Bounds
All Implemented Interfaces:
IRenderingElement

public final class Bounds extends Object implements IRenderingElement
Defines a bounding box element which the renderer can use to determine the true drawing limits. Using only atom coordinates adjuncts (e.g. hydrogen labels) may be truncated. If a generator provide a bounding box element, then the min/max bounds of all bounding boxes are utilised.
Author:
John May
Source code:
main
Belongs to CDK module:
renderbasic
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Maximum x/y coordinates.
    double
    Maximum x/y coordinates.
    double
    Minimum x/y coordinates.
    double
    Minimum x/y coordinates.
  • Constructor Summary

    Constructors
    Constructor
    Description
    An empty bounding box.
    Bounds(double x1, double y1, double x2, double y2)
    Specify the min/max coordinates of the bounding box.
    An bounding box around the specified element.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Converts this TextElement into widget specific objects.
    void
    add(double x, double y)
    Ensure the point x,y is included in the bounding box.
    void
    add(Bounds bounds)
    Add one bounds to another.
    void
    Add the specified element bounds.
    double
    Specifies the height of the bounding box.
    boolean
    The bounds are empty and contain no elements.
    Access the root rendering element, it contains all elements added to the bounds so far.
    double
    Specifies the width of the bounding box.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • minX

      public double minX
      Minimum x/y coordinates.
    • minY

      public double minY
      Minimum x/y coordinates.
    • maxX

      public double maxX
      Maximum x/y coordinates.
    • maxY

      public double maxY
      Maximum x/y coordinates.
  • Constructor Details

    • Bounds

      public Bounds(double x1, double y1, double x2, double y2)
      Specify the min/max coordinates of the bounding box.
      Parameters:
      x1 - min x coordinate
      y1 - min y coordinate
      x2 - max x coordinate
      y2 - max y coordinate
    • Bounds

      public Bounds()
      An empty bounding box.
    • Bounds

      public Bounds(IRenderingElement element)
      An bounding box around the specified element.
  • Method Details

    • add

      public void add(IRenderingElement element)
      Add the specified element bounds.
    • add

      public void add(double x, double y)
      Ensure the point x,y is included in the bounding box.
      Parameters:
      x - x-coordinate
      y - y-coordinate
    • add

      public void add(Bounds bounds)
      Add one bounds to another.
      Parameters:
      bounds - other bounds
    • root

      public IRenderingElement root()
      Access the root rendering element, it contains all elements added to the bounds so far.
      Returns:
      root rendering element
    • width

      public double width()
      Specifies the width of the bounding box.
      Returns:
      the width of the bounding box
    • height

      public double height()
      Specifies the height of the bounding box.
      Returns:
      the height of the bounding box
    • isEmpty

      public boolean isEmpty()
      The bounds are empty and contain no elements.
      Returns:
      bounds are empty (true) or not (false)
    • accept

      public void accept(IRenderingVisitor visitor)
      Converts this TextElement into widget specific objects.
      Specified by:
      accept in interface IRenderingElement
      Parameters:
      visitor - Toolkit specific widget factory.
    • toString

      public String toString()
      Overrides:
      toString in class Object