Class: MultiPoint

ol/geom/MultiPoint~MultiPoint


import MultiPoint from 'ol/geom/MultiPoint.js';

多点几何对象。

new MultiPoint(coordinates, layout)

Name Type Description
coordinates Array<Coordinate> | Array.<number>

坐标。对于内部使用,也接受与 layout 组合的扁平坐标。

layout GeometryLayout | undefined

布局。

触发事件:

Extends

Methods

appendPoint(point)

将传入的点追加到此多点中。

Name Type Description
point Point

点。

applyTransform(transformFn) inherited

对几何对象的坐标应用变换函数。几何对象会被原地修改。如果不想原地修改几何对象,请先 clone() 它,然后对副本使用此函数。

Name Type Description
transformFn Transform函数

变换函数。 使用几何坐标的扁平数组调用。

增加修订计数器并分发 'change' 事件。

制作几何对象的完整副本。

返回值:
Clone.

dispatchEvent(event){boolean | undefined} inherited

分发事件并调用所有监听此类型事件的监听器。事件参数可以是一个字符串或一个 具有 type 属性的对象。

Name Type Description
event BaseEvent | string

事件对象。

返回值:
如果有人在事件对象上调用了 preventDefault 或任何监听器返回 false,则返回 false

获取一个值。

Name Type Description
key string

键名。

返回值:
值。

getClosestPoint(point, closestPoint){Coordinate} inherited

返回几何对象上距离传入点最近的点作为坐标。

Name Type Description
point Coordinate

点。

closestPoint Coordinate | undefined

最近点。

返回值:
最近点。

getCoordinates(){Array<Coordinate>}

返回coordinates of the multipoint.

返回值:
坐标。

获取几何对象的范围。

Name Type Description
extent Extent | undefined

范围。

返回值:
extent 范围。

返回几何对象的第一个坐标。

返回值:
First coordinate.

getKeys(){Array.<string>} inherited

获取对象属性名列表。

返回值:
属性名列表。

返回几何对象的最后一个坐标。

返回值:
Last point.

返回layout of the geometry.

返回值:
布局。

getPoint(index){Point}

返回point at the specified index.

Name Type Description
index number

索引。

返回值:
点。

getPoints(){Array<Point>}

返回points of this multipoint.

返回值:
Points.

getProperties(){NoInfer.<Properties>} inherited

获取包含所有属性名和值的对象。

返回值:
对象。

getRevision(){number} inherited

获取此对象的版本号。 每次对象被修改时,其版本号将递增。

返回值:
版本号。

获取此几何对象的类型。

返回值:
Geometry type.

intersectsCoordinate(coordinate){boolean} inherited

如果此几何对象包含指定坐标则返回 true。 如果坐标在几何对象的边界上,则返回 false。

Name Type Description
coordinate Coordinate

坐标。

返回值:
Contains coordinate.

intersectsExtent(extent){boolean}

测试几何对象与传入范围是否相交。

Name Type Description
extent Extent

范围。

返回值:
true if the geometry and the extent intersect.

on(type, listener){EventsKey | Array<EventsKey>} inherited

监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

once(type, listener){EventsKey | Array<EventsKey>} inherited

仅监听一次特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

围绕给定坐标旋转几何对象。此操作会原地修改几何对象的坐标。

Name Type Description
angle number

逆时针旋转角度(弧度)。

anchor Coordinate

旋转中心。

缩放几何对象(可选原点)。此操作会原地修改几何对象的坐标。

Name Type Description
sx number

x 方向的缩放因子。

sy number | undefined

y 方向的缩放因子(默认为 sx)。

anchor Coordinate | undefined

缩放原点(默认为几何对象范围的中心)。

set(key, value, silent) inherited

设置一个值。

Name Type Description
key string

键名。

value *

值。

silent boolean | undefined

更新但不触发事件。

setCoordinates(coordinates, layout)

设置coordinates of the multipoint.

Name Type Description
coordinates Array<Coordinate>

坐标。

layout GeometryLayout | undefined

布局。

setProperties(values, silent) inherited

设置一组键值对。 注意,这会更改任何现有属性并添加新属性(不会移除任何现有属性)。

Name Type Description
values Partial.<NoInfer.<Properties>>

值。

silent boolean | undefined

更新但不触发事件。

创建此几何图形的简化版本。对于线字符串,使用 Douglas Peucker 算法。对于多边形,使用基于量化的简化来保持拓扑。

Name Type Description
tolerance number

简化的容差距离。

返回值:
A new, simplified version of the original geometry.

transform(source, destination){this} inherited

将几何对象的每个坐标从一个坐标参考系变换到另一个。几何对象会被原地修改。例如,线将变换为线,圆将变换为圆。如果不想原地修改几何对象,请先 clone() 它,然后对副本使用此函数。

Name Type Description
source ProjectionLike

当前投影。可以是字符串标识符或 Projection 对象。

destination ProjectionLike

目标投影。可以是字符串标识符或 Projection 对象。

返回值:
This geometry. Note that original geometry is modified in place.

translate(deltaX, deltaY) inherited

平移几何图形。此方法就地修改几何坐标。如果需要新几何图形,请先 clone() 该几何图形。

Name Type Description
deltaX number

X 增量。

deltaY number

Y 增量。

un(type, listener) inherited

取消监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

unset(key, silent) inherited

取消设置一个属性。

Name Type Description
key string

键名。

silent boolean | undefined

取消设置但不触发事件。