new SuperMap.Geometry.Rectangle(x, y, width, height)
Name | Type | Description |
---|---|---|
x |
float |
The X coordinate of the lower-left point of rectangle. |
y |
float |
The Y coordinate of the lower-left point of rectangle. |
width |
float |
The width of the rectangle. |
height |
float |
The height of the rectangle. |
Example
//x is the X coordinate of the lower-left point of rectangle.y is the Y coordinate of the lower-left point of rectangle. w is the rectangle width; h is the rectangle height.
var x = 1;
var y = 2;
var w = 10;
var h = 20;
var recttangle = new SuperMap.Geometry.Rectangle(x, y, w, h);
Extends
Members
-
boundsSuperMap.Bounds
-
Bounds of the geometric object.
-
heightfloat
-
The height of the rectangle.
-
idstring
-
The unique identifier of the geometric object.
-
parentSuperMap.Geometry
-
This is set when a Geometry is added as component of another geometry
-
SRIDinterger
-
Projection coordinate parameter. By this parameter, server will determine whether the geometry object's coordinate reference is as the same as dataset, if not, then change projection before adding into database.
Example
var geometry= new SuperMap.Geometry(); geometry. SRID=4326;
-
widthfloat
-
The width of the rectangle.
-
xfloat
-
The X coordinate of the lower-left point of rectangle.
-
yfloat
-
The Y coordinate of the lower-left point of rectangle.
Methods
-
calculateBounds()
Rectangle.js, line 55 -
Calculate the bounds of the rectangle object.
-
inherited clearBounds()
Geometry.js, line 82 -
clear bounds of the geometric object. If the object has a parent class, it also clears the bounds of the parent class geometry object.
-
inherited clone(){SuperMap.Geometry}
Geometry.js, line 60 -
Creates cloned geometric graphics. Non-standard properties should not be set for cloned geometric graphics.
Returns:
Type Description SuperMap.Geometry Clones a geometric figure. -
inherited destroy()
Geometry.js, line 49 -
Deconstruct the Geometry class and release the resources.
-
inherited extendBounds(newBounds)
Geometry.js, line 95 -
Extend the existing bounds to include the new bounds. If geometry's bounds is not yet set, then set a new Bounds.
Name Type Description newBounds
SuperMap.Bounds New bounds.
-
getArea(){float}
Rectangle.js, line 66 -
Get the area of rectangle.
Returns:
Type Description float the area of rectangle. -
inherited getBounds(){SuperMap.Bounds}
Geometry.js, line 112 -
Gets the boundary of the geometric graphic. If not set, it can be acquired through computing.
Returns:
Type Description SuperMap.Bounds Returns the bounds of the geometry. -
inherited getVertices(nodes){Array}
Geometry.js, line 135 -
Returns the list of all vertices of the geometric graphic. (This method needs to be realized in the subclass).
Name Type Description nodes
boolean optional If true, only returns the end point of a line; if false, only returns the vertex; and default is to return the vertex.
Returns:
Type Description Array A list of all vertices in the geometry. -
inherited setBounds(bounds)
Geometry.js, line 70 -
Set bounds of the geometric object.
Name Type Description bounds
SuperMap.Bounds bounds.