Class Bounds
java.lang.Object
org.openscience.cdk.renderer.elements.Bounds
- All Implemented Interfaces:
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBounds()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
Modifier and TypeMethodDescriptionvoidaccept(IRenderingVisitor visitor) Converts thisTextElementinto widget specific objects.voidadd(double x, double y) Ensure the point x,y is included in the bounding box.voidAdd one bounds to another.voidadd(IRenderingElement element) Add the specified element bounds.doubleheight()Specifies the height of the bounding box.booleanisEmpty()The bounds are empty and contain no elements.root()Access the root rendering element, it contains all elements added to the bounds so far.toString()doublewidth()Specifies the width of the bounding box.
-
Field Details
-
minX
public double minXMinimum x/y coordinates. -
minY
public double minYMinimum x/y coordinates. -
maxX
public double maxXMaximum x/y coordinates. -
maxY
public double maxYMaximum 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 coordinatey1- min y coordinatex2- max x coordinatey2- max y coordinate
-
Bounds
public Bounds()An empty bounding box. -
Bounds
An bounding box around the specified element.
-
-
Method Details
-
add
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
Add one bounds to another.- Parameters:
bounds- other bounds
-
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
Converts thisTextElementinto widget specific objects.- Specified by:
acceptin interfaceIRenderingElement- Parameters:
visitor- Toolkit specific widget factory.
-
toString
-