org.vectomatic.dom.svg
Class OMSVGRect

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by org.vectomatic.dom.svg.OMSVGRect

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.


Constructor Summary
protected OMSVGRect()
           
 
Method Summary
 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.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OMSVGRect

protected OMSVGRect()
Method Detail

getX

public final float getX()
The x coordinate of the rectangle, in user units.


setX

public final void setX(float value)
                throws com.google.gwt.core.client.JavaScriptException
The x coordinate of the rectangle, in user units.

Throws:
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

getY

public final float getY()
The y coordinate of the rectangle, in user units.


setY

public final void setY(float value)
                throws com.google.gwt.core.client.JavaScriptException
The y coordinate of the rectangle, in user units.

Throws:
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

getWidth

public final float getWidth()
The width coordinate of the rectangle, in user units.


setWidth

public final void setWidth(float value)
                    throws com.google.gwt.core.client.JavaScriptException
The width coordinate of the rectangle, in user units.

Throws:
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

getHeight

public final float getHeight()
The height coordinate of the rectangle, in user units.


setHeight

public final void setHeight(float value)
                     throws com.google.gwt.core.client.JavaScriptException
The height coordinate of the rectangle, in user units.

Throws:
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

getCenterX

public final float getCenterX()
Returns the X coordinate of the center of this rectangle.

Returns:
the X coordinate of the center of this rectangle.

getCenterY

public final float getCenterY()
Returns the Y coordinate of the center of this rectangle.

Returns:
the Y coordinate of the center of this rectangle.

getMaxX

public final float getMaxX()
Returns the X coordinate of the right corners of this rectangle.

Returns:
the X coordinate of the right corners of this rectangle.

getMaxY

public final float getMaxY()
Returns the X coordinate of the bottom corners of this rectangle.

Returns:
the X coordinate of the bottom corners of this rectangle.

intersection

public final OMSVGRect intersection(OMSVGRect r)
Computes the intersection of this rectangle with the specified rectangle and puts the result in this rectangle. The method returns null if the two rectangles have no intersection.

Parameters:
r - the rectangle to intersect
Returns:
the rectangle resulting from the intersection of this rectangle with the specified rectangle or null if the two rectangles have no intersection.

intersection

public final OMSVGRect intersection(OMSVGRect r,
                                    OMSVGRect destination)
Computes the intersection of this rectangle with the specified rectangle and puts the result in the destination rectangle. The method returns null if the two rectangles have no intersection.

Parameters:
r - the rectangle to intersect
destination - a rectangle to store the intersection
Returns:
the rectangle resulting from the intersection of this rectangle with the specified rectangle or null if the two rectangles have no intersection.

union

public final OMSVGRect union(OMSVGRect r)
Computes the union of this rectangle with the specified rectangle and puts the result in this rectangle.

Parameters:
r - the rectangle with which to compute the union
Returns:
the rectangle resulting from the union of this rectangle with the specified rectangle.

union

public final OMSVGRect union(OMSVGRect r,
                             OMSVGRect destination)
Computes the union of this rectangle with the specified rectangle and puts the result in the destination rectangle.

Parameters:
r - the rectangle with which to compute the union
destination - a rectangle to store the union
Returns:
the rectangle resulting from the union of this rectangle with the specified rectangle.

contains

public final boolean contains(OMSVGPoint p)
Returns true if the specified point is inside this rectangle, false otherwise.

Parameters:
p - The point to test
Returns:
true if the specified point is inside this rectangle, false otherwise.

assignTo

public final OMSVGRect assignTo(OMSVGRect destination)
Copies this rectangle to the specified destination rectangle.

Parameters:
destination - the destination rectangle.
Returns:
the destination rectangle.

getDescription

public final String getDescription()
Returns a textual description of the rectangle for debugging purposes.

Returns:
a textual description of the rectangle.

inset

public final OMSVGRect inset(float x,
                             float y)
Modifies the position and size of this rectangle by adding the specified margin to it.

Parameters:
x - the horizontal margin
y - the vertical margin
Returns:
this rectangle

inset

public final 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.

Parameters:
destination - the destination rectangle.
x - the horizontal margin
y - the vertical margin
Returns:
the destination rectangle.


Copyright © 2012. All Rights Reserved.