ol 10.4.1-dev.1738789133545 → 10.4.1-dev.1739165709127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,75 @@
1
1
  export default Snap;
2
- export type Result = {
2
+ /**
3
+ * An array of two coordinates representing a line segment, or an array of one
4
+ * coordinate representing a point.
5
+ */
6
+ export type Segment = Array<import("../coordinate.js").Coordinate>;
7
+ export type SegmentData = {
3
8
  /**
4
- * Vertex.
9
+ * Feature.
5
10
  */
6
- vertex: import("../coordinate.js").Coordinate | null;
11
+ feature: import("../Feature.js").default;
7
12
  /**
8
- * VertexPixel.
13
+ * Segment.
9
14
  */
10
- vertexPixel: import("../pixel.js").Pixel | null;
15
+ segment: Segment;
11
16
  /**
12
- * Feature.
17
+ * Is intersection.
13
18
  */
14
- feature: import("../Feature.js").default | null;
19
+ isIntersection?: boolean | undefined;
20
+ };
21
+ /**
22
+ * A function taking a {@link module :ol/geom/Geometry~Geometry} as argument and returning an array of {@link Segment}s.
23
+ */
24
+ export type Segmenter<GeometryType extends import("../geom/Geometry.js").default = import("../geom/Geometry.js").default> = (geometry: GeometryType, projection?: import("../proj/Projection.js").default) => Array<Segment>;
25
+ /**
26
+ * Each segmenter specified here will override the default segmenter for the
27
+ * corresponding geometry type. To exclude all geometries of a specific geometry type from being snapped to,
28
+ * set the segmenter to `null`.
29
+ */
30
+ export type Segmenters = {
15
31
  /**
16
- * Segment, or `null` if snapped to a vertex.
32
+ * Point segmenter.
17
33
  */
18
- segment: Array<import("../coordinate.js").Coordinate> | null;
19
- };
20
- export type SegmentData = {
34
+ Point?: Segmenter<import("../geom/Point.js").default> | null | undefined;
21
35
  /**
22
- * Feature.
36
+ * LineString segmenter.
23
37
  */
24
- feature: import("../Feature.js").default;
38
+ LineString?: Segmenter<import("../geom/LineString.js").default> | null | undefined;
25
39
  /**
26
- * Segment.
40
+ * Polygon segmenter.
27
41
  */
28
- segment: Array<import("../coordinate.js").Coordinate>;
42
+ Polygon?: Segmenter<import("../geom/Polygon.js").default> | null | undefined;
29
43
  /**
30
- * Is intersection.
44
+ * Circle segmenter.
31
45
  */
32
- isIntersection?: boolean | undefined;
46
+ Circle?: Segmenter<import("../geom/Circle.js").default> | null | undefined;
47
+ /**
48
+ * GeometryCollection segmenter.
49
+ */
50
+ GeometryCollection?: Segmenter<import("../geom/GeometryCollection.js").default> | null | undefined;
51
+ /**
52
+ * MultiPoint segmenter.
53
+ */
54
+ MultiPoint?: Segmenter<import("../geom/MultiPoint.js").default> | null | undefined;
55
+ /**
56
+ * MultiLineString segmenter.
57
+ */
58
+ MultiLineString?: Segmenter<import("../geom/MultiLineString.js").default> | null | undefined;
59
+ /**
60
+ * MultiPolygon segmenter.
61
+ */
62
+ MultiPolygon?: Segmenter<import("../geom/MultiPolygon.js").default> | null | undefined;
33
63
  };
34
64
  export type Options = {
35
65
  /**
36
66
  * Snap to these features. Either this option or source should be provided.
37
67
  */
38
68
  features?: import("../Collection.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
69
+ /**
70
+ * Snap to features from this source. Either this option or features should be provided
71
+ */
72
+ source?: import("../source/Vector.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
39
73
  /**
40
74
  * Snap to edges.
41
75
  */
@@ -54,9 +88,18 @@ export type Options = {
54
88
  */
55
89
  pixelTolerance?: number | undefined;
56
90
  /**
57
- * Snap to features from this source. Either this option or features should be provided
58
- */
59
- source?: import("../source/Vector.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
91
+ * Custom segmenters by {@link module :ol/geom/Geometry~Type}. By default, the
92
+ * following segmenters are used:
93
+ * - `Point`: A one-dimensional segment (e.g. `[[10, 20]]`) representing the point.
94
+ * - `LineString`: One two-dimensional segment (e.g. `[[10, 20], [30, 40]]`) for each segment of the linestring.
95
+ * - `Polygon`: One two-dimensional segment for each segment of the exterior ring and the interior rings.
96
+ * - `Circle`: One two-dimensional segment for each segment of a regular polygon with 32 points representing the circle circumference.
97
+ * - `GeometryCollection`: All segments of the contained geometries.
98
+ * - `MultiPoint`: One one-dimensional segment for each point.
99
+ * - `MultiLineString`: One two-dimensional segment for each segment of the linestrings.
100
+ * - `MultiPolygon`: One two-dimensional segment for each segment of the polygons.
101
+ */
102
+ segmenters?: Segmenters | undefined;
60
103
  };
61
104
  /**
62
105
  * Information about the last snapped state.
@@ -69,7 +112,7 @@ export type SnappedInfo = {
69
112
  /**
70
113
  * - The pixel of the snapped vertex.
71
114
  */
72
- vertexPixel: import("../coordinate.js").Coordinate | null;
115
+ vertexPixel: import("../pixel.js").Pixel | null;
73
116
  /**
74
117
  * - The feature being snapped.
75
118
  */
@@ -77,7 +120,7 @@ export type SnappedInfo = {
77
120
  /**
78
121
  * - Segment, or `null` if snapped to a vertex.
79
122
  */
80
- segment: Array<import("../coordinate.js").Coordinate> | null;
123
+ segment: Segment | null;
81
124
  };
82
125
  /**
83
126
  * *
@@ -201,11 +244,10 @@ declare class Snap extends PointerInteraction {
201
244
  */
202
245
  private snapped_;
203
246
  /**
204
- * @const
247
+ * @type {Object<string, Segmenter>}
205
248
  * @private
206
- * @type {Object<string, function(Array<Array<import('../coordinate.js').Coordinate>>, import("../geom/Geometry.js").default): void>}
207
249
  */
208
- private GEOMETRY_SEGMENTERS_;
250
+ private segmenters_;
209
251
  /**
210
252
  * Add a feature to the collection of features that we may snap to.
211
253
  * @param {import("../Feature.js").default} feature Feature.
@@ -264,62 +306,14 @@ declare class Snap extends PointerInteraction {
264
306
  * @param {import("../pixel.js").Pixel} pixel Pixel
265
307
  * @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
266
308
  * @param {import("../Map.js").default} map Map.
267
- * @return {Result|null} Snap result
309
+ * @return {SnappedInfo|null} Snap result
268
310
  */
269
- snapTo(pixel: import("../pixel.js").Pixel, pixelCoordinate: import("../coordinate.js").Coordinate, map: import("../Map.js").default): Result | null;
311
+ snapTo(pixel: import("../pixel.js").Pixel, pixelCoordinate: import("../coordinate.js").Coordinate, map: import("../Map.js").default): SnappedInfo | null;
270
312
  /**
271
313
  * @param {import("../Feature.js").default} feature Feature
272
314
  * @private
273
315
  */
274
316
  private updateFeature_;
275
- /**
276
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
277
- * @param {import("../geom/Circle.js").default} geometry Geometry.
278
- * @private
279
- */
280
- private segmentCircleGeometry_;
281
- /**
282
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
283
- * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
284
- * @private
285
- */
286
- private segmentGeometryCollectionGeometry_;
287
- /**
288
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
289
- * @param {import("../geom/LineString.js").default} geometry Geometry.
290
- * @private
291
- */
292
- private segmentLineStringGeometry_;
293
- /**
294
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
295
- * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
296
- * @private
297
- */
298
- private segmentMultiLineStringGeometry_;
299
- /**
300
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
301
- * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
302
- * @private
303
- */
304
- private segmentMultiPointGeometry_;
305
- /**
306
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
307
- * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
308
- * @private
309
- */
310
- private segmentMultiPolygonGeometry_;
311
- /**
312
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
313
- * @param {import("../geom/Point.js").default} geometry Geometry.
314
- * @private
315
- */
316
- private segmentPointGeometry_;
317
- /**
318
- * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
319
- * @param {import("../geom/Polygon.js").default} geometry Geometry.
320
- * @private
321
- */
322
- private segmentPolygonGeometry_;
323
317
  }
324
318
  import { SnapEvent } from '../events/SnapEvent.js';
325
319
  import PointerInteraction from './Pointer.js';
@@ -1 +1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