Class CmsRectangle
java.lang.Object
org.opencms.ade.galleries.client.preview.util.CmsRectangle
Axis-aligned rectangle in 2D space.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.opencms.ade.galleries.shared.CmsPoint
constrain
(org.opencms.ade.galleries.shared.CmsPoint point) Constrains a point to this rectangle.boolean
contains
(org.opencms.ade.galleries.shared.CmsPoint point) Checks if this rectangle contains a given point.static CmsRectangle
fromLeftTopWidthHeight
(double left, double top, double width, double height) Creates a new rectangle given its left, top coordinates and its width and height.static CmsRectangle
fromPoints
(org.opencms.ade.galleries.shared.CmsPoint topLeft, org.opencms.ade.galleries.shared.CmsPoint bottomRight) Creates a new rectangle from its top left and bottom right corner points.org.opencms.ade.galleries.shared.CmsPoint
Gets the bottom right corner.org.opencms.ade.galleries.shared.CmsPoint
Gets the top left corner.
-
Constructor Details
-
CmsRectangle
protected CmsRectangle()Hidden default constructor.
-
-
Method Details
-
fromLeftTopWidthHeight
public static CmsRectangle fromLeftTopWidthHeight(double left, double top, double width, double height) Creates a new rectangle given its left, top coordinates and its width and height.- Parameters:
left
- the left sidetop
- the top sidewidth
- the widthheight
- the height- Returns:
- the new rectangel
-
getBottomRight
Gets the bottom right corner.- Returns:
- the bottom right corner
-
getTopLeft
Gets the top left corner.- Returns:
- the top left corner
-