new Extent(options)
几何范围对象,由左下角与右上角坐标定义的矩形范围,常用于视图定位、空间过滤与范围运算。
| Name | Type | Default | 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
几何点的空间参考系
typeGeometryType
几何类型
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
-
centerAt(point){Extent}
base/geometry/Extent.js, line 135 -
根据中心点生成新的范围,新范围的宽高为当前范围的宽高
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 589 -
克隆几何对象
Returns:
Type Description Geometry 克隆后的几何对象 -
contains(geometry){Boolean}
base/geometry/Extent.js, line 174 -
输入的几何是否包含在范围内
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 350 -
是否和输入范围相等
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 382 -
按给定的因子扩大范围。例如,值为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 144 -
导入GeoJSON
Name Type Description GeoJSONObject Object
-
inherited getGeometryType(){String}
base/geometry/Geometry.js, line 181 -
获取GeometryModule型
Returns:
Type Description String GeometryModule型 -
getIGSType()
base/geometry/Extent.js, line 541 -
Returns:
string GeometryModule型 -
inherited getType(){String}
base/geometry/Geometry.js, line 165 -
返回所对应的GeometryModule型
Returns:
Type Description String GeometryModule型 -
intersection(extent){Extent}
base/geometry/Extent.js, line 240 -
将原始范围与输入范围求交
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 322 -
输入的几何图形是否与范围相交
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 565 -
归一化计算
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 421 -
根据输入的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 606 -
导出为GeoJSON
Returns:
Type Description Object GeoJSON对象 -
toIGSOldString()
base/geometry/Extent.js, line 533 -
Returns:
string -
toJSON(){Object}
base/geometry/Extent.js, line 517 -
导出为 JSON 对象
Returns:
Type Description Object JSON对象 -
toPolygon(){Polygon}
base/geometry/Extent.js, line 598 -
将Extent转换为多边形实例
Returns:
Type Description Polygon -
toString()
base/geometry/Extent.js, line 484 -
Returns:
string -
inherited toXML(){String}
base/geometry/Geometry.js, line 157 -
导出为OGC服务要求的xml字符串,子类实现
Returns:
Type Description String 字符串 -
union(extent){Extent}
base/geometry/Extent.js, line 460 -
求并
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) -
Extent.fromJSON(json)
base/geometry/Extent.js, line 508 -
通过传入的 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)