Class Rect
- java.lang.Object
-
- com._1c.g5.v8.dt.form.layout.model.common.Rect
-
public class Rect extends Object
The rectangle.
-
-
Constructor Summary
Constructors Constructor Description Rect()
Creates instance.Rect(int left, int top, int right, int bottom)
Creates instance.Rect(int x, int y, Size size)
Creates instance by coordinates and rectangle size.Rect(Rect rect)
Creates instance by hippo rectangle.Rect(Point point, Size size)
Creates instance by point and size.Rect(org.eclipse.swt.graphics.Point point, Size size)
Creates instance by SWT point and size.Rect(org.eclipse.swt.graphics.Rectangle rect)
Creates instance by SWT rectangle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Point
bottomLeft()
Returns a bottom left point of the rectangle.Point
bottomRight()
Returns a bottom right point of the rectangle.Point
center()
Returns a center point of the rectangle.boolean
contains(Point point)
Check if the rectangle containsthe given point.boolean
contains(org.eclipse.swt.graphics.Point point)
Check if the rectangle containsthe given SWT point.boolean
empty()
Checks if the rectangle has zero size.int
getBottom()
Returns bottom.int
getLeft()
Returns left.int
getRight()
Returns right.int
getTop()
Returns top.int
height()
Calculates height.void
inflate(long x, long y)
Inflates the rectangle.Rect
intersect(Rect rect)
Modifies current rectangle as intersect the the given one.static Rect
intersect(Rect rect1, Rect rect2)
boolean
isEmpty()
Checks if the rectangle has default value.boolean
isEquals(Rect rect)
Check if rectangles are equals.void
offset(int x, int y)
Adds offset to the rectangle.void
setBottom(int bottom)
Sets bottom.void
setLeft(int left)
Sets left.void
setRight(int right)
Sets right.void
setTop(int top)
Sets top.Size
size()
Calculates rectangle's size.Point
topLeft()
Returns a top left point of the rectangle.Point
topRight()
Returns a top right point of the rectangle.org.eclipse.swt.graphics.Rectangle
toRectangle()
Converts to SWT rectangle.int
width()
Calculates width.
-
-
-
Constructor Detail
-
Rect
public Rect()
Creates instance.
-
Rect
public Rect(org.eclipse.swt.graphics.Rectangle rect)
Creates instance by SWT rectangle.- Parameters:
rect
- the rectangle, cannot benull
-
Rect
public Rect(int left, int top, int right, int bottom)
Creates instance.- Parameters:
left
-top
-right
-bottom
-
-
Rect
public Rect(Rect rect)
Creates instance by hippo rectangle.- Parameters:
rect
- the hippo rectangle, cannot benull
-
Rect
public Rect(int x, int y, Size size)
Creates instance by coordinates and rectangle size.- Parameters:
x
- the X-coordinatey
- the Y-coordinatesize
- the rectangle size, cannot benull
-
Rect
public Rect(Point point, Size size)
Creates instance by point and size.- Parameters:
point
- the rectangle init point, cannot benull
size
- the rectangle size, cannot benull
-
Rect
public Rect(org.eclipse.swt.graphics.Point point, Size size)
Creates instance by SWT point and size.- Parameters:
point
- the rectangle init point, cannot benull
size
- the rectangle size, cannot benull
-
-
Method Detail
-
toRectangle
public org.eclipse.swt.graphics.Rectangle toRectangle()
Converts to SWT rectangle.- Returns:
- rectangle, cannot be
null
-
contains
public boolean contains(Point point)
Check if the rectangle containsthe given point.- Parameters:
point
- the point, cannot benull
- Returns:
true
if the rectangle containsthe given point.
-
contains
public boolean contains(org.eclipse.swt.graphics.Point point)
Check if the rectangle containsthe given SWT point.- Parameters:
point
- the SWT point, cannot benull
- Returns:
true
if the rectangle containsthe given point.
-
inflate
public void inflate(long x, long y)
Inflates the rectangle.- Parameters:
x
-y
-
-
offset
public void offset(int x, int y)
Adds offset to the rectangle.- Parameters:
x
- the x offsety
- the y offset
-
isEquals
public boolean isEquals(Rect rect)
Check if rectangles are equals.- Parameters:
rect
- the rectangle, cannot benull
- Returns:
true
if rectangles are equals
-
isEmpty
public boolean isEmpty()
Checks if the rectangle has default value.- Returns:
true
if the rectangle has default value
-
width
public int width()
Calculates width.- Returns:
- width
-
height
public int height()
Calculates height.- Returns:
- height
-
size
public Size size()
Calculates rectangle's size.- Returns:
- size, cannot be
null
-
empty
public boolean empty()
Checks if the rectangle has zero size.- Returns:
true
if the rectangle has zero size
-
topLeft
public Point topLeft()
Returns a top left point of the rectangle.- Returns:
- top left point, cannot be
null
-
topRight
public Point topRight()
Returns a top right point of the rectangle.- Returns:
- top right point, cannot be
null
-
bottomRight
public Point bottomRight()
Returns a bottom right point of the rectangle.- Returns:
- bottom right point, cannot be
null
-
bottomLeft
public Point bottomLeft()
Returns a bottom left point of the rectangle.- Returns:
- bottom left point, cannot be
null
-
center
public Point center()
Returns a center point of the rectangle.- Returns:
- center point, cannot be
null
-
intersect
public Rect intersect(Rect rect)
Modifies current rectangle as intersect the the given one.- Parameters:
rect
- , cannot benull
- Returns:
- rectangle, cannot be
null
-
getTop
public int getTop()
Returns top.- Returns:
- top
-
setTop
public void setTop(int top)
Sets top.- Parameters:
top
-
-
getLeft
public int getLeft()
Returns left.- Returns:
- left
-
setLeft
public void setLeft(int left)
Sets left.- Parameters:
left
-
-
getBottom
public int getBottom()
Returns bottom.- Returns:
- bottom
-
setBottom
public void setBottom(int bottom)
Sets bottom.- Parameters:
bottom
-
-
getRight
public int getRight()
Returns right.- Returns:
- right
-
setRight
public void setRight(int right)
Sets right.- Parameters:
right
-
-
-