new Extent(options)
支持如下方法:
[1、根据中心点生成新的范围][2、输入的几何是否包含在范围内]
[3、将原始范围与输入范围求交]
[4、输入的几何图形是否与范围相交]
[5、是否和输入范围相等]
[6、按给定的因子扩大范围]
[7、平移extent]
[8、求并]
[9、返回字符串]
[10、返回IGS1.0的字符串]
[11、返回IGS所对应的GeometryModule型]
[12、通过传入的json构造并返回一个新的几何对象]
[13、导出为json对象]
14、克隆几何对象
几何范围对象,即左下角和右上角组成的矩形范围几何对象,参考示例:[几何范围对象]
[ES5引入方式]:
zondy.geometry.Extent()
[ES6引入方式]:
import { Extent } from "@mapgis/webclient-common"
| Name | Type | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
构造参数
|
Examples
// ES5引入方式
const { Extent } = zondy.geometry
// ES6引入方式
import { Extent } from "@mapgis/webclient-common"
new Extent({
xmin: 10,
xmax: 210,
ymin: 0,
ymax: 100
})
// ES5引入方式
const { Extent } = zondy.geometry
const { SpatialReference } = zondy
// ES6引入方式
import { Extent, SpatialReference } from "@mapgis/webclient-common"
new Extent({
// 3857坐标系的点
xmin: 12060733.232006868,
xmax: 12929863.44711455,
ymin: 3377247.5680546067,
ymax: 3934286.575385226,
// 当不是4326时请指定坐标系,方便进行投影转换
spatialReference: new SpatialReference('EPSG:3857')
})
Extends
Members
-
centerArray.<Number>
-
中心点
-
extensionOptionsObject
-
初始化几何的额外参数,可以通过该参数传入引擎原生的构造参数
- Default Value: {}
extentNumber
几何的范围
hasZBoolean
是否含有z坐标
heightNumber
高度
spatialReferenceSpatialReference
几何点的空间参考系
widthNumber
宽度
xmaxNumber
x坐标最大值
- Default Value: 0
xminNumber
x坐标最小值
- Default Value: 0
ymaxNumber
y坐标最大值
- Default Value: 0
yminNumber
y坐标最小值
- Default Value: 0
zmaxNumber
z坐标最大值
zminNumber
z坐标最小值
Methods
-
Extent.fromJSON(json)
base/geometry/Extent.js, line 531 -
通过传入的json构造并返回一个新的几何对象
Name Type Description jsonObject 可选 JSON对象
Example
通过传入的json构造并返回一个新的几何对象 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const json = { xmin: 10, xmax: 210, ymin: 0, ymax: 100 } const extent = Extent.fromJSON(json) -
centerAt(point){Extent}
base/geometry/Extent.js, line 150 -
根据中心点生成新的范围,新范围的宽高为当前范围的宽高
Name Type Description pointPoint 中心点
Returns:
Type Description Extent 以点为中心的新范围。 Example
根据中心点生成新的范围 // ES5引入方式 const { Extent, Point } = zondy.geometry // ES6引入方式 import { Extent, Point } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const point = new Point({ coordinates: [100.0, 0.0] }) const newConst = extent.centerAt(point) -
clone(){Geometry}
base/geometry/Extent.js, line 612 -
克隆几何对象
Returns:
Type Description Geometry 克隆后的几何对象 -
contains(geometry){Boolean}
base/geometry/Extent.js, line 188 -
输入的几何是否包含在范围内
Name Type Description geometryPoint | Extent 输入的几何图形
Returns:
Type Description Boolean 如果输入几何图形包含在范围内,则返回true Example
输入的几何是否包含在范围内 // ES5引入方式 const { Extent, Point } = zondy.geometry // ES6引入方式 import { Extent, Point } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const point = new Point({ coordinates: [100.0, 0.0] }) const isIn = extent.contains(point) -
equals(extent){Boolean}
base/geometry/Extent.js, line 370 -
是否和输入范围相等
Name Type Description extentExtent 输入的外包范围
Returns:
Type Description Boolean 如果输入范围等于调用equals()的范围,则返回true Example
是否和输入范围相等 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const extent2 = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const isEqual = extent.equals(extent2) -
expand(factor){Extent}
base/geometry/Extent.js, line 408 -
按给定的因子扩大范围。例如,值为1.5将将范围扩展到比原始范围大50%。
Name Type Description factorNumber 乘数的值,必须大于等于1
Returns:
Type Description Extent 返回扩大的范围 Example
按给定的因子扩大范围 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) extent.expand(1.5) -
inherited fromGeoJSON(GeoJSON)
base/geometry/Geometry.js, line 133 -
导入GeoJSON
Name Type Description GeoJSONObject Object
-
inherited getGeometryType(){String}
base/geometry/Geometry.js, line 170 -
获取GeometryModule型
Returns:
Type Description String GeometryModule型 -
getIGSType()
base/geometry/Extent.js, line 565 -
Returns:
string GeometryModule型 -
inherited getType(){String}
base/geometry/Geometry.js, line 154 -
返回所对应的GeometryModule型
Returns:
Type Description String GeometryModule型 -
intersection(extent){Extent}
base/geometry/Extent.js, line 256 -
将原始范围与输入范围求交
Name Type Description extentExtent 输入的范围,用于相交。
Returns:
Type Description Extent 返回输入Extent与原始Extent的交集,没有交集返回 null Example
将原始范围与输入范围求交 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const extent2 = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const newExtent = extent.intersection(extent2) -
intersects(geometry){Boolean}
base/geometry/Extent.js, line 343 -
输入的几何图形是否与范围相交
Name Type Description geometryGeometry 用于测试相交的几何图形。可以是 Point, Polyline, Polygon, Extent or Multipoint
Returns:
Type Description Boolean 如果输入几何图形与区段相交,则返回true Example
输入的几何图形是否与范围相交 // ES5引入方式 const { Extent, Point } = zondy.geometry // ES6引入方式 import { Extent, Point } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const point = new Point({ coordinates: [100.0, 0.0] }) const isIntersect = extent.intersects(point) -
normalize(){Extent}
base/geometry/Extent.js, line 588 -
归一化计算
Returns:
Type Description Extent 归一化后的点对象 Example
归一化计算 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const normalize = extent.normalize() -
offset(dx, dy, dz){Extent}
base/geometry/Extent.js, line 446 -
根据输入的dx, dy, dz值,平移extent
Name Type Description dxNumber 要平移的x值
dyNumber 要平移的y值
dzNumber 要平移的z值
Returns:
Type Description Extent 偏移后的范围 Example
平移extent // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) extent.offset(0, 1, 0) -
toGeoJSON(){Object}
base/geometry/Extent.js, line 628 -
导出为GeoJSON
Returns:
Type Description Object GeoJSON对象 -
toIGSOldString()
base/geometry/Extent.js, line 557 -
Returns:
string -
toJSON(){Object}
base/geometry/Extent.js, line 541 -
Returns:
Type Description Object json对象 -
toPolygon(){Polygon}
base/geometry/Extent.js, line 620 -
Returns:
Type Description Polygon -
toString()
base/geometry/Extent.js, line 508 -
Returns:
string -
inherited toXML(){String}
base/geometry/Geometry.js, line 146 -
导出为OGC服务要求的xml字符串,子类实现
Returns:
Type Description String 字符串 -
union(extent){Extent}
base/geometry/Extent.js, line 484 -
求并
Name Type Description extentExtent 输入的范围,用于并集
Returns:
Type Description Extent 返回输入Extent与原始Extent的并集 Example
求并 // ES5引入方式 const { Extent } = zondy.geometry // ES6引入方式 import { Extent } from "@mapgis/webclient-common" const extent = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const extent2 = new Extent({ xmin: 10, xmax: 210, ymin: 0, ymax: 100 }) const newExtent = extent.union(extent2)