new Extent(x1, y1, x2, y2) [source]
//with 4 numbers: xmin, ymin, xmax and ymax
var extent = new Extent(100, 10, 120, 20);
//with 2 coordinates
var extent = new Extent(new Coordinate(100, 10), new Coordinate(120, 20));
//with a json object containing xmin, ymin, xmax and ymax
var extent = new Extent({xmin : 100, ymin: 10, xmax: 120, ymax:20});
var extent1 = new Extent(100, 10, 120, 20);
//with another extent
var extent2 = new Extent(extent1);
Parameter | Type | Description |
---|---|---|
x1
|
Number | x of coordinate 1 |
y1
|
Number | y of coordinate 1 |
x2
|
Number | x of coordinate 2 |
y2
|
Number | y of coordinate 2 |
Members
xmin
Properties:
Name | Type | Description |
---|---|---|
xmin
|
Number | minimum x |
- Source:
xmax
Properties:
Name | Type | Description |
---|---|---|
xmax
|
Number | maximum x |
- Source:
ymin
Properties:
Name | Type | Description |
---|---|---|
ymin
|
Number | minimum y |
- Source:
ymax
Properties:
Name | Type | Description |
---|---|---|
ymax
|
Number | maximum y |
- Source:
Methods
add(p) [source]
Add the extent with a coordinate or a point.
Parameter | Type | Description |
---|---|---|
p
|
Coordinate | Point | point or coordinate to add |
Returns:
Extent: a new extentsub(p) [source]
Substract the extent with a coordinate or a point.
Parameter | Type | Description |
---|---|---|
p
|
Coordinate | Point | point or coordinate to substract |
Returns:
Extent: a new extentsubstract(p) [source]
Alias for sub
Parameter | Type | Description |
---|---|---|
p
|
Coordinate | Point | point or coordinate to substract |
Returns:
Extent: a new extentround() [source]
Round the extent
Returns:
Extent: rounded extentgetMin() [source]
Get the minimum point
Returns:
Coordinate:getMax() [source]
Get the maximum point
Returns:
Coordinate:getCenter() [source]
Get center of the extent.
Returns:
Coordinate:(protected) isValid() [source]
Whether the extent is valid
Returns:
Boolean:equals(ext2) [source]
Compare with another extent to see whether they are equal.
Parameter | Type | Description |
---|---|---|
ext2
|
Extent | extent to compare |
Returns:
Boolean:intersects(ext2) [source]
Whether it intersects with another extent
Parameter | Type | Description |
---|---|---|
ext2
|
Extent | another extent |
Returns:
Boolean:within(ext2) [source]
Whether the extent is within another extent
Parameter | Type | Description |
---|---|---|
ext2
|
Extent | another extent |
Returns:
Boolean:contains(coordinate) [source]
Whether the extent contains the input point.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | Array.<Number> | input point |
Returns:
Boolean:getWidth() [source]
Get the width of the Extent
Returns:
Number:getHeight() [source]
Get the height of the Extent
Returns:
Number:getSize() [source]
Get size of the Extent
Returns:
Size:combine(extent) [source]
Combine it with another extent to a larger extent.
Parameter | Type | Description |
---|---|---|
extent
|
Extent | Coordinate | Point | extent/coordinate/point to combine into |
Returns:
Extent: extent combinedintersection(extent) [source]
Gets the intersection extent of this and another extent.
Parameter | Type | Description |
---|---|---|
extent
|
Extent | another extent |
Returns:
Extent: intersection extentexpand(distance) [source]
Expand the extent by distance
Parameter | Type | Description |
---|---|---|
distance
|
Size | Number | distance to expand |
Returns:
Extent: a new extent expanded fromtoJSON() [source]
Get extent's JSON object.
// {xmin : 100, ymin: 10, xmax: 120, ymax:20}
var json = extent.toJSON();
Returns:
Object: jsonObjecttoArray() [source]
Get a coordinate array of extent's rectangle area, containing 5 coordinates in which the first equals with the last.
Returns:
Array.<Coordinate>: coordinates arraycopy() [source]
Get a copy of the extent.
Returns:
Extent: copyconvertTo(fn) [source]
Convert to a new extent
Parameter | Type | Description |
---|---|---|
fn
|
function | convert function on each point |