Module: ol/interaction/Snap

ol/interaction/Snap


Classes

Snap

Type Definitions

Options{Object}

属性:
Name Type Description
features Collection<要素> | undefined

吸附到这些要素。应提供此选项或source。

source VectorSource | undefined

吸附到此数据源的要素。应提供此选项或features

edge boolean
(defaults to true)

吸附到边。

vertex boolean
(defaults to true)

吸附到顶点。

intersection boolean
(defaults to false)

吸附到线段之间的交叉点。

pixelTolerance number
(defaults to 10)

像素容差,用于判断指针是否足够接近线段或顶点以进行吸附。

segmenters Segmenters | undefined

Type自定义分段器。默认使用以下分段器:

  • Point:一维线段(例如 [[10, 20]])表示该点。
  • LineString:线字符串的每个线段对应一个二维线段(例如 [[10, 20], [30, 40]])。
  • Polygon:外环和内环的每个线段对应一个二维线段。
  • Circle:用32个点表示圆周的正多边形的每个线段对应一个二维线段。
  • GeometryCollection:所包含几何图形的所有线段。
  • MultiPoint:每个点对应一个一维线段。
  • MultiLineString:各线字符串的每个线段对应一个二维线段。
  • MultiPolygon:各多边形的每个线段对应一个二维线段。

Segment{Array<Coordinate>}

由两个坐标组成的数组表示线段,或由一个坐标组成的数组表示点。

SegmentData{Object}

属性:
Name Type Description
feature 要素

要素。

intersection要素 要素 | undefined

相交的要素。

segment Segment

线段。

一个以Geometry为参数并返回Segment数组的函数。

Segmenters{Object}

此处指定的每个分段器将覆盖对应几何图形类型的默认分段器。要将特定几何图形类型的所有几何图形从吸附中排除,请将分段器设置为 null

属性:
Name Type Description
Point Segmenter<Point> | null | undefined

Point 分段器。

LineString Segmenter<LineString> | null | undefined

LineString 分段器。

Polygon Segmenter<Polygon> | null | undefined

Polygon 分段器。

Circle Segmenter<Circle> | null | undefined

Circle 分段器。

GeometryCollection Segmenter<GeometryCollection> | null | undefined

GeometryCollection 分段器。

MultiPoint Segmenter<MultiPoint> | null | undefined

MultiPoint 分段器。

MultiLineString Segmenter<MultiLineString> | null | undefined

MultiLineString 分段器。

MultiPolygon Segmenter<MultiPolygon> | null | undefined

MultiPolygon 分段器。

SnappedInfo{Object}

关于上次吸附状态的信息。

属性:
Name Type Description
vertex Coordinate | null

吸附到的顶点。

vertexPixel Pixel | null

吸附到的顶点的像素坐标。

feature 要素 | null

被吸附到的要素。

segment Segment | null

线段,如果吸附到顶点则为 null