Class Bounds
- 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
-
-
Constructor Summary
Constructors Constructor Description Bounds()
An empty bounding box.Bounds(double x1, double y1, double x2, double y2)
Specify the min/max coordinates of the bounding box.Bounds(IRenderingElement element)
An bounding box around the specified element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(IRenderingVisitor visitor)
Converts thisTextElement
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(IRenderingElement element)
Add the specified element bounds.double
height()
Specifies the height of the bounding box.boolean
isEmpty()
The bounds are empty and contain no elements.IRenderingElement
root()
Access the root rendering element, it contains all elements added to the bounds so far.String
toString()
double
width()
Specifies the width of the bounding box.
-
-
-
Constructor Detail
-
Bounds
public Bounds(double x1, double y1, double x2, double y2)
Specify the min/max coordinates of the bounding box.- Parameters:
x1
- min x coordinatey1
- min y coordinatex2
- max x coordinatey2
- max y coordinate
-
Bounds
public Bounds()
An empty bounding box.
-
Bounds
public Bounds(IRenderingElement element)
An bounding box around the specified element.
-
-
Method Detail
-
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-coordinatey
- 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 thisTextElement
into widget specific objects.- Specified by:
accept
in interfaceIRenderingElement
- Parameters:
visitor
- Toolkit specific widget factory.
-
-