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.ObjectClass 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
All Methods Instance Methods Concrete Methods 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()
-
-
-
Method Detail
-
getBottomRightPoint
public Point getBottomRightPoint()
- Returns:
- Bottom-right point of this bounding box.
-
getTopLeftPoint
public Point getTopLeftPoint()
- Returns:
- Top-left point of this bounding box.
-
extend
public GraphStatistics.BoundingBox extend(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.- 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
public GraphStatistics.BoundingBox extend(float size)
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
public boolean contains(Point point)
- Parameters:
point- Point to check- Returns:
- true if this box contains the given point.
-
contains
public boolean contains(GraphStatistics.BoundingBox other)
- 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
-
-