new ol.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 ol.supermap.Geometry.Rectangle(x, y, w, h);
Extends
Members
-
boundsol.supermap.Bounds
-
Bounds of the geometric object.
-
heightfloat
-
The height of the rectangle.
-
idstring
-
The unique identifier of the geometric object.
-
parentol.supermap.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 ol.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(){ol.supermap.Geometry}
Geometry.js, line 60 -
Creates cloned geometric graphics. Non-standard properties should not be set for cloned geometric graphics.
Returns:
Type Description ol.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
ol.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(){ol.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 ol.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
ol.supermap.Bounds bounds.