public class OMSVGRect
extends com.google.gwt.core.client.JavaScriptObject
Represents rectangular geometry. Rectangles are defined as consisting of a (x,y) coordinate pair identifying a minimum X value, a minimum Y value, and a width and height, which are usually constrained to be non-negative.
An OMSVGRect
object
can be designated as read only, which means that attempts to modify
the object will result in an exception being thrown, as described below.
Modifier | Constructor and Description |
---|---|
protected |
OMSVGRect() |
Modifier and Type | Method and Description |
---|---|
OMSVGRect |
assignTo(OMSVGRect destination)
Copies this rectangle to the specified destination rectangle.
|
boolean |
contains(OMSVGPoint p)
Returns true if the specified point is inside this rectangle,
false otherwise.
|
float |
getCenterX()
Returns the X coordinate of the center of this rectangle.
|
float |
getCenterY()
Returns the Y coordinate of the center of this rectangle.
|
String |
getDescription()
Returns a textual description of the rectangle for debugging purposes.
|
float |
getHeight()
The height coordinate of the rectangle, in user units.
|
float |
getMaxX()
Returns the X coordinate of the right corners of this rectangle.
|
float |
getMaxY()
Returns the X coordinate of the bottom corners of this rectangle.
|
float |
getWidth()
The width coordinate of the rectangle, in user units.
|
float |
getX()
The x coordinate of the rectangle, in user units.
|
float |
getY()
The y coordinate of the rectangle, in user units.
|
OMSVGRect |
inset(float x,
float y)
Modifies the position and size of this rectangle by adding
the specified margin to it.
|
OMSVGRect |
inset(OMSVGRect destination,
float x,
float y)
Modifies the position and size of this rectangle by adding
the specified margin to it and puts the result in the destination
rectangle.
|
OMSVGRect |
intersection(OMSVGRect r)
Computes the intersection of this rectangle with the
specified rectangle and puts the result in this rectangle.
|
OMSVGRect |
intersection(OMSVGRect r,
OMSVGRect destination)
Computes the intersection of this rectangle with the
specified rectangle and puts the result in the destination rectangle.
|
void |
setHeight(float value)
The height coordinate of the rectangle, in user units.
|
void |
setWidth(float value)
The width coordinate of the rectangle, in user units.
|
void |
setX(float value)
The x coordinate of the rectangle, in user units.
|
void |
setY(float value)
The y coordinate of the rectangle, in user units.
|
OMSVGRect |
union(OMSVGRect r)
Computes the union of this rectangle with the
specified rectangle and puts the result in this rectangle.
|
OMSVGRect |
union(OMSVGRect r,
OMSVGRect destination)
Computes the union of this rectangle with the
specified rectangle and puts the result in the destination rectangle.
|
public final float getX()
public final void setX(float value) throws com.google.gwt.core.client.JavaScriptException
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the rectangle
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final float getY()
public final void setY(float value) throws com.google.gwt.core.client.JavaScriptException
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the rectangle
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final float getWidth()
public final void setWidth(float value) throws com.google.gwt.core.client.JavaScriptException
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the rectangle
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final float getHeight()
public final void setHeight(float value) throws com.google.gwt.core.client.JavaScriptException
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the rectangle
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final float getCenterX()
public final float getCenterY()
public final float getMaxX()
public final float getMaxY()
public final OMSVGRect intersection(OMSVGRect r)
r
- the rectangle to intersectpublic final OMSVGRect intersection(OMSVGRect r, OMSVGRect destination)
r
- the rectangle to intersectdestination
- a rectangle to store the intersectionpublic final OMSVGRect union(OMSVGRect r)
r
- the rectangle with which to compute the unionpublic final OMSVGRect union(OMSVGRect r, OMSVGRect destination)
r
- the rectangle with which to compute the uniondestination
- a rectangle to store the unionpublic final boolean contains(OMSVGPoint p)
p
- The point to testpublic final OMSVGRect assignTo(OMSVGRect destination)
destination
- the destination rectangle.public final String getDescription()
public final OMSVGRect inset(float x, float y)
x
- the horizontal marginy
- the vertical marginpublic final OMSVGRect inset(OMSVGRect destination, float x, float y)
destination
- the destination rectangle.x
- the horizontal marginy
- the vertical marginCopyright © 2018. All Rights Reserved.