Package org.insa.graphs.model
Class GraphStatistics.BoundingBox
java.lang.Object
org.insa.graphs.model.GraphStatistics.BoundingBox
- Enclosing class:
- GraphStatistics
public static class GraphStatistics.BoundingBox
extends java.lang.Object
Class representing a bounding box for a graph (a rectangle that contains all
nodes in the graph).
-
Constructor Summary
Constructors Constructor Description BoundingBox(Point topLeft, Point bottomRight)Create a new BoundingBox represented by the given top-left and bottom-right points. -
Method Summary
Modifier and Type Method Description booleancontains(GraphStatistics.BoundingBox other)booleancontains(Point point)GraphStatistics.BoundingBoxextend(float size)Create a new bounding box by extending the current one according by the given value on each side.GraphStatistics.BoundingBoxextend(float left, float top, float right, float bottom)Create a new bounding box by extending the current one according to the given value for each side.PointgetBottomRightPoint()PointgetTopLeftPoint()java.lang.StringtoString()
-
Constructor Details
-
BoundingBox
Create a new BoundingBox represented by the given top-left and bottom-right points.- Parameters:
topLeft- Top left corner of the bounding box.bottomRight- Bottom right corner of the bounding box.
-
-
Method Details
-
getBottomRightPoint
- Returns:
- Bottom-right point of this bounding box.
-
getTopLeftPoint
- Returns:
- Top-left point of this bounding box.
-
extend
Create a new bounding box by extending the current one according to the given value for each side.- Parameters:
left- Extra size to add to the left of the box.top- Extra size to add to the top of the box.right- Extra size to add to the right of the box.bottom- Extra size to add to the bottom of the box.- Returns:
- New bounding box corresponding to an extension of the current one.
-
extend
Create a new bounding box by extending the current one according by the given value on each side.- Parameters:
size- Extra size to add to each side of this box.- Returns:
- New bounding box corresponding to an extension of the current one.
-
contains
- Parameters:
point- Point to check- Returns:
- true if this box contains the given point.
-
contains
- Parameters:
other- Box to intersect.- Returns:
- true if this box contains the given box.
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-