ol 7.0.0-dev.1658257118421 → 7.0.0-dev.1658343947608
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.
- package/control/ScaleLine.d.ts +9 -17
- package/control/ScaleLine.d.ts.map +1 -1
- package/control/ScaleLine.js +12 -20
- package/control/ScaleLine.js.map +1 -1
- package/format/EsriJSON.d.ts.map +1 -1
- package/format/EsriJSON.js +16 -16
- package/format/EsriJSON.js.map +1 -1
- package/format/GML3.d.ts.map +1 -1
- package/format/GML3.js +2 -3
- package/format/GML3.js.map +1 -1
- package/format/GMLBase.d.ts.map +1 -1
- package/format/GMLBase.js +4 -5
- package/format/GMLBase.js.map +1 -1
- package/format/GPX.d.ts.map +1 -1
- package/format/GPX.js +9 -9
- package/format/GPX.js.map +1 -1
- package/format/IGC.d.ts +6 -2
- package/format/IGC.d.ts.map +1 -1
- package/format/IGC.js +7 -15
- package/format/IGC.js.map +1 -1
- package/format/KML.d.ts +3 -3
- package/format/KML.d.ts.map +1 -1
- package/format/KML.js +29 -30
- package/format/KML.js.map +1 -1
- package/format/MVT.d.ts.map +1 -1
- package/format/MVT.js +6 -7
- package/format/MVT.js.map +1 -1
- package/format/OSMXML.d.ts.map +1 -1
- package/format/OSMXML.js +2 -3
- package/format/OSMXML.js.map +1 -1
- package/format/Polyline.d.ts +3 -8
- package/format/Polyline.d.ts.map +1 -1
- package/format/Polyline.js +3 -4
- package/format/Polyline.js.map +1 -1
- package/format/WKB.d.ts +3 -3
- package/format/WKB.d.ts.map +1 -1
- package/format/WKB.js +48 -21
- package/format/WKB.js.map +1 -1
- package/format/WKT.d.ts.map +1 -1
- package/format/WKT.js +12 -12
- package/format/WKT.js.map +1 -1
- package/geom/Circle.d.ts +4 -4
- package/geom/Circle.d.ts.map +1 -1
- package/geom/Circle.js +2 -2
- package/geom/Geometry.d.ts +5 -0
- package/geom/Geometry.d.ts.map +1 -1
- package/geom/Geometry.js +5 -0
- package/geom/Geometry.js.map +1 -1
- package/geom/LineString.d.ts +4 -4
- package/geom/LineString.d.ts.map +1 -1
- package/geom/LineString.js +4 -6
- package/geom/LineString.js.map +1 -1
- package/geom/LinearRing.d.ts +4 -4
- package/geom/LinearRing.d.ts.map +1 -1
- package/geom/LinearRing.js +3 -4
- package/geom/LinearRing.js.map +1 -1
- package/geom/MultiLineString.d.ts +4 -9
- package/geom/MultiLineString.d.ts.map +1 -1
- package/geom/MultiLineString.js +4 -6
- package/geom/MultiLineString.js.map +1 -1
- package/geom/MultiPoint.d.ts +4 -4
- package/geom/MultiPoint.d.ts.map +1 -1
- package/geom/MultiPoint.js +2 -2
- package/geom/MultiPolygon.d.ts +4 -4
- package/geom/MultiPolygon.d.ts.map +1 -1
- package/geom/MultiPolygon.js +4 -5
- package/geom/MultiPolygon.js.map +1 -1
- package/geom/Point.d.ts +2 -2
- package/geom/Point.d.ts.map +1 -1
- package/geom/Point.js +2 -2
- package/geom/Polygon.d.ts +4 -4
- package/geom/Polygon.d.ts.map +1 -1
- package/geom/Polygon.js +6 -11
- package/geom/Polygon.js.map +1 -1
- package/geom/SimpleGeometry.d.ts +13 -13
- package/geom/SimpleGeometry.d.ts.map +1 -1
- package/geom/SimpleGeometry.js +17 -18
- package/geom/SimpleGeometry.js.map +1 -1
- package/interaction/Draw.d.ts +7 -7
- package/interaction/Draw.d.ts.map +1 -1
- package/interaction/Draw.js +34 -42
- package/interaction/Draw.js.map +1 -1
- package/layer/Graticule.d.ts.map +1 -1
- package/layer/Graticule.js +4 -5
- package/layer/Graticule.js.map +1 -1
- package/package.json +1 -1
- package/render/Feature.d.ts.map +1 -1
- package/render/Feature.js +5 -6
- package/render/Feature.js.map +1 -1
- package/render/canvas/TextBuilder.d.ts.map +1 -1
- package/render/canvas/TextBuilder.js +1 -2
- package/render/canvas/TextBuilder.js.map +1 -1
- package/render/canvas/hitdetect.d.ts.map +1 -1
- package/render/canvas/hitdetect.js +2 -3
- package/render/canvas/hitdetect.js.map +1 -1
- package/render/canvas.d.ts +2 -11
- package/render/canvas.d.ts.map +1 -1
- package/render/canvas.js +1 -14
- package/render/canvas.js.map +1 -1
- package/source/Zoomify.d.ts +6 -2
- package/source/Zoomify.d.ts.map +1 -1
- package/source/Zoomify.js +5 -9
- package/source/Zoomify.js.map +1 -1
- package/src/control/ScaleLine.js +12 -20
- package/src/format/EsriJSON.js +16 -19
- package/src/format/GML3.js +2 -3
- package/src/format/GMLBase.js +4 -5
- package/src/format/GPX.js +9 -9
- package/src/format/IGC.js +7 -16
- package/src/format/KML.js +29 -30
- package/src/format/MVT.js +6 -7
- package/src/format/OSMXML.js +2 -3
- package/src/format/Polyline.js +3 -4
- package/src/format/WKB.js +55 -21
- package/src/format/WKT.js +12 -12
- package/src/geom/Circle.js +2 -2
- package/src/geom/Geometry.js +6 -0
- package/src/geom/LineString.js +4 -8
- package/src/geom/LinearRing.js +3 -4
- package/src/geom/MultiLineString.js +4 -10
- package/src/geom/MultiPoint.js +2 -2
- package/src/geom/MultiPolygon.js +4 -12
- package/src/geom/Point.js +2 -2
- package/src/geom/Polygon.js +6 -15
- package/src/geom/SimpleGeometry.js +17 -18
- package/src/interaction/Draw.js +34 -42
- package/src/layer/Graticule.js +4 -5
- package/src/render/Feature.js +5 -12
- package/src/render/canvas/TextBuilder.js +1 -2
- package/src/render/canvas/hitdetect.js +2 -3
- package/src/render/canvas.js +1 -15
- package/src/source/Zoomify.js +5 -9
- package/src/style/Icon.js +36 -36
- package/src/style/Text.js +13 -6
- package/style/Icon.d.ts +28 -12
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +34 -36
- package/style/Icon.js.map +1 -1
- package/style/Text.d.ts +14 -7
- package/style/Text.d.ts.map +1 -1
- package/style/Text.js +12 -6
- package/style/Text.js.map +1 -1
- package/util.js +1 -1
- package/geom/GeometryLayout.d.ts +0 -8
- package/geom/GeometryLayout.d.ts.map +0 -1
- package/geom/GeometryLayout.js +0 -16
- package/geom/GeometryLayout.js.map +0 -1
- package/src/geom/GeometryLayout.js +0 -16
- package/src/style/IconAnchorUnits.js +0 -20
- package/src/style/IconOrigin.js +0 -30
- package/src/style/TextPlacement.js +0 -15
- package/style/IconAnchorUnits.d.ts +0 -6
- package/style/IconAnchorUnits.d.ts.map +0 -1
- package/style/IconAnchorUnits.js +0 -20
- package/style/IconAnchorUnits.js.map +0 -1
- package/style/IconOrigin.d.ts +0 -8
- package/style/IconOrigin.d.ts.map +0 -1
- package/style/IconOrigin.js +0 -30
- package/style/IconOrigin.js.map +0 -1
- package/style/TextPlacement.d.ts +0 -6
- package/style/TextPlacement.d.ts.map +0 -1
- package/style/TextPlacement.js +0 -15
- package/style/TextPlacement.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module ol/geom/MultiLineString
|
|
3
3
|
*/
|
|
4
|
-
import GeometryLayout from './GeometryLayout.js';
|
|
5
4
|
import LineString from './LineString.js';
|
|
6
5
|
import SimpleGeometry from './SimpleGeometry.js';
|
|
7
6
|
import {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';
|
|
@@ -27,7 +26,7 @@ class MultiLineString extends SimpleGeometry {
|
|
|
27
26
|
* @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
|
|
28
27
|
* Coordinates or LineString geometries. (For internal use, flat coordinates in
|
|
29
28
|
* combination with `opt_layout` and `opt_ends` are also accepted.)
|
|
30
|
-
* @param {import("./
|
|
29
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
31
30
|
* @param {Array<number>} [opt_ends] Flat coordinate ends for internal use.
|
|
32
31
|
*/
|
|
33
32
|
constructor(coordinates, opt_layout, opt_ends) {
|
|
@@ -173,8 +172,7 @@ class MultiLineString extends SimpleGeometry {
|
|
|
173
172
|
*/
|
|
174
173
|
getCoordinateAtM(m, opt_extrapolate, opt_interpolate) {
|
|
175
174
|
if (
|
|
176
|
-
(this.layout !=
|
|
177
|
-
this.layout != GeometryLayout.XYZM) ||
|
|
175
|
+
(this.layout != 'XYM' && this.layout != 'XYZM') ||
|
|
178
176
|
this.flatCoordinates.length === 0
|
|
179
177
|
) {
|
|
180
178
|
return null;
|
|
@@ -298,11 +296,7 @@ class MultiLineString extends SimpleGeometry {
|
|
|
298
296
|
0,
|
|
299
297
|
simplifiedEnds
|
|
300
298
|
);
|
|
301
|
-
return new MultiLineString(
|
|
302
|
-
simplifiedFlatCoordinates,
|
|
303
|
-
GeometryLayout.XY,
|
|
304
|
-
simplifiedEnds
|
|
305
|
-
);
|
|
299
|
+
return new MultiLineString(simplifiedFlatCoordinates, 'XY', simplifiedEnds);
|
|
306
300
|
}
|
|
307
301
|
|
|
308
302
|
/**
|
|
@@ -333,7 +327,7 @@ class MultiLineString extends SimpleGeometry {
|
|
|
333
327
|
/**
|
|
334
328
|
* Set the coordinates of the multilinestring.
|
|
335
329
|
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
|
|
336
|
-
* @param {GeometryLayout} [opt_layout] Layout.
|
|
330
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
337
331
|
* @api
|
|
338
332
|
*/
|
|
339
333
|
setCoordinates(coordinates, opt_layout) {
|
package/src/geom/MultiPoint.js
CHANGED
|
@@ -19,7 +19,7 @@ class MultiPoint extends SimpleGeometry {
|
|
|
19
19
|
/**
|
|
20
20
|
* @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
|
|
21
21
|
* For internal use, flat coordinates in combination with `opt_layout` are also accepted.
|
|
22
|
-
* @param {import("./
|
|
22
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
23
23
|
*/
|
|
24
24
|
constructor(coordinates, opt_layout) {
|
|
25
25
|
super();
|
|
@@ -182,7 +182,7 @@ class MultiPoint extends SimpleGeometry {
|
|
|
182
182
|
/**
|
|
183
183
|
* Set the coordinates of the multipoint.
|
|
184
184
|
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
|
185
|
-
* @param {import("./
|
|
185
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
186
186
|
* @api
|
|
187
187
|
*/
|
|
188
188
|
setCoordinates(coordinates, opt_layout) {
|
package/src/geom/MultiPolygon.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module ol/geom/MultiPolygon
|
|
3
3
|
*/
|
|
4
|
-
import GeometryLayout from './GeometryLayout.js';
|
|
5
4
|
import MultiPoint from './MultiPoint.js';
|
|
6
5
|
import Polygon from './Polygon.js';
|
|
7
6
|
import SimpleGeometry from './SimpleGeometry.js';
|
|
@@ -34,7 +33,7 @@ class MultiPolygon extends SimpleGeometry {
|
|
|
34
33
|
/**
|
|
35
34
|
* @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
|
|
36
35
|
* For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted.
|
|
37
|
-
* @param {import("./
|
|
36
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
38
37
|
* @param {Array<Array<number>>} [opt_endss] Array of ends for internal use with flat coordinates.
|
|
39
38
|
*/
|
|
40
39
|
constructor(coordinates, opt_layout, opt_endss) {
|
|
@@ -306,10 +305,7 @@ class MultiPolygon extends SimpleGeometry {
|
|
|
306
305
|
* @api
|
|
307
306
|
*/
|
|
308
307
|
getInteriorPoints() {
|
|
309
|
-
return new MultiPoint(
|
|
310
|
-
this.getFlatInteriorPoints().slice(),
|
|
311
|
-
GeometryLayout.XYM
|
|
312
|
-
);
|
|
308
|
+
return new MultiPoint(this.getFlatInteriorPoints().slice(), 'XYM');
|
|
313
309
|
}
|
|
314
310
|
|
|
315
311
|
/**
|
|
@@ -354,11 +350,7 @@ class MultiPolygon extends SimpleGeometry {
|
|
|
354
350
|
0,
|
|
355
351
|
simplifiedEndss
|
|
356
352
|
);
|
|
357
|
-
return new MultiPolygon(
|
|
358
|
-
simplifiedFlatCoordinates,
|
|
359
|
-
GeometryLayout.XY,
|
|
360
|
-
simplifiedEndss
|
|
361
|
-
);
|
|
353
|
+
return new MultiPolygon(simplifiedFlatCoordinates, 'XY', simplifiedEndss);
|
|
362
354
|
}
|
|
363
355
|
|
|
364
356
|
/**
|
|
@@ -450,7 +442,7 @@ class MultiPolygon extends SimpleGeometry {
|
|
|
450
442
|
/**
|
|
451
443
|
* Set the coordinates of the multipolygon.
|
|
452
444
|
* @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
|
|
453
|
-
* @param {import("./
|
|
445
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
454
446
|
* @api
|
|
455
447
|
*/
|
|
456
448
|
setCoordinates(coordinates, opt_layout) {
|
package/src/geom/Point.js
CHANGED
|
@@ -15,7 +15,7 @@ import {squaredDistance as squaredDx} from '../math.js';
|
|
|
15
15
|
class Point extends SimpleGeometry {
|
|
16
16
|
/**
|
|
17
17
|
* @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
|
|
18
|
-
* @param {import("./
|
|
18
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
19
19
|
*/
|
|
20
20
|
constructor(coordinates, opt_layout) {
|
|
21
21
|
super();
|
|
@@ -99,7 +99,7 @@ class Point extends SimpleGeometry {
|
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* @param {!Array<*>} coordinates Coordinates.
|
|
102
|
-
* @param {import("./
|
|
102
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
103
103
|
* @api
|
|
104
104
|
*/
|
|
105
105
|
setCoordinates(coordinates, opt_layout) {
|
package/src/geom/Polygon.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module ol/geom/Polygon
|
|
3
3
|
*/
|
|
4
|
-
import GeometryLayout from './GeometryLayout.js';
|
|
5
4
|
import LinearRing from './LinearRing.js';
|
|
6
5
|
import Point from './Point.js';
|
|
7
6
|
import SimpleGeometry from './SimpleGeometry.js';
|
|
@@ -34,7 +33,7 @@ class Polygon extends SimpleGeometry {
|
|
|
34
33
|
* an array of vertices' coordinates where the first coordinate and the last are
|
|
35
34
|
* equivalent. (For internal use, flat coordinates in combination with
|
|
36
35
|
* `opt_layout` and `opt_ends` are also accepted.)
|
|
37
|
-
* @param {import("./
|
|
36
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
38
37
|
* @param {Array<number>} [opt_ends] Ends (for internal use with flat coordinates).
|
|
39
38
|
*/
|
|
40
39
|
constructor(coordinates, opt_layout, opt_ends) {
|
|
@@ -253,7 +252,7 @@ class Polygon extends SimpleGeometry {
|
|
|
253
252
|
* @api
|
|
254
253
|
*/
|
|
255
254
|
getInteriorPoint() {
|
|
256
|
-
return new Point(this.getFlatInteriorPoint(),
|
|
255
|
+
return new Point(this.getFlatInteriorPoint(), 'XYM');
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
/**
|
|
@@ -353,11 +352,7 @@ class Polygon extends SimpleGeometry {
|
|
|
353
352
|
0,
|
|
354
353
|
simplifiedEnds
|
|
355
354
|
);
|
|
356
|
-
return new Polygon(
|
|
357
|
-
simplifiedFlatCoordinates,
|
|
358
|
-
GeometryLayout.XY,
|
|
359
|
-
simplifiedEnds
|
|
360
|
-
);
|
|
355
|
+
return new Polygon(simplifiedFlatCoordinates, 'XY', simplifiedEnds);
|
|
361
356
|
}
|
|
362
357
|
|
|
363
358
|
/**
|
|
@@ -388,7 +383,7 @@ class Polygon extends SimpleGeometry {
|
|
|
388
383
|
/**
|
|
389
384
|
* Set the coordinates of the polygon.
|
|
390
385
|
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
|
|
391
|
-
* @param {import("./
|
|
386
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
392
387
|
* @api
|
|
393
388
|
*/
|
|
394
389
|
setCoordinates(coordinates, opt_layout) {
|
|
@@ -433,9 +428,7 @@ export function circular(center, radius, opt_n, opt_sphereRadius) {
|
|
|
433
428
|
);
|
|
434
429
|
}
|
|
435
430
|
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
|
436
|
-
return new Polygon(flatCoordinates,
|
|
437
|
-
flatCoordinates.length,
|
|
438
|
-
]);
|
|
431
|
+
return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);
|
|
439
432
|
}
|
|
440
433
|
|
|
441
434
|
/**
|
|
@@ -461,9 +454,7 @@ export function fromExtent(extent) {
|
|
|
461
454
|
minX,
|
|
462
455
|
minY,
|
|
463
456
|
];
|
|
464
|
-
return new Polygon(flatCoordinates,
|
|
465
|
-
flatCoordinates.length,
|
|
466
|
-
]);
|
|
457
|
+
return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);
|
|
467
458
|
}
|
|
468
459
|
|
|
469
460
|
/**
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module ol/geom/SimpleGeometry
|
|
3
3
|
*/
|
|
4
4
|
import Geometry from './Geometry.js';
|
|
5
|
-
import GeometryLayout from './GeometryLayout.js';
|
|
6
5
|
import {abstract} from '../util.js';
|
|
7
6
|
import {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';
|
|
8
7
|
import {rotate, scale, transform2D, translate} from './flat/transform.js';
|
|
@@ -21,9 +20,9 @@ class SimpleGeometry extends Geometry {
|
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* @protected
|
|
24
|
-
* @type {import("./
|
|
23
|
+
* @type {import("./Geometry.js").GeometryLayout}
|
|
25
24
|
*/
|
|
26
|
-
this.layout =
|
|
25
|
+
this.layout = 'XY';
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* @protected
|
|
@@ -89,8 +88,8 @@ class SimpleGeometry extends Geometry {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
/**
|
|
92
|
-
* Return the {@link
|
|
93
|
-
* @return {import("./
|
|
91
|
+
* Return the {@link import("./Geometry.js").GeometryLayout layout} of the geometry.
|
|
92
|
+
* @return {import("./Geometry.js").GeometryLayout} Layout.
|
|
94
93
|
* @api
|
|
95
94
|
*/
|
|
96
95
|
getLayout() {
|
|
@@ -151,7 +150,7 @@ class SimpleGeometry extends Geometry {
|
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
/**
|
|
154
|
-
* @param {import("./
|
|
153
|
+
* @param {import("./Geometry.js").GeometryLayout} layout Layout.
|
|
155
154
|
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
156
155
|
*/
|
|
157
156
|
setFlatCoordinates(layout, flatCoordinates) {
|
|
@@ -163,14 +162,14 @@ class SimpleGeometry extends Geometry {
|
|
|
163
162
|
/**
|
|
164
163
|
* @abstract
|
|
165
164
|
* @param {!Array<*>} coordinates Coordinates.
|
|
166
|
-
* @param {import("./
|
|
165
|
+
* @param {import("./Geometry.js").GeometryLayout} [opt_layout] Layout.
|
|
167
166
|
*/
|
|
168
167
|
setCoordinates(coordinates, opt_layout) {
|
|
169
168
|
abstract();
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
/**
|
|
173
|
-
* @param {import("./
|
|
172
|
+
* @param {import("./Geometry.js").GeometryLayout|undefined} layout Layout.
|
|
174
173
|
* @param {Array<*>} coordinates Coordinates.
|
|
175
174
|
* @param {number} nesting Nesting.
|
|
176
175
|
* @protected
|
|
@@ -183,7 +182,7 @@ class SimpleGeometry extends Geometry {
|
|
|
183
182
|
} else {
|
|
184
183
|
for (let i = 0; i < nesting; ++i) {
|
|
185
184
|
if (coordinates.length === 0) {
|
|
186
|
-
this.layout =
|
|
185
|
+
this.layout = 'XY';
|
|
187
186
|
this.stride = 2;
|
|
188
187
|
return;
|
|
189
188
|
} else {
|
|
@@ -299,31 +298,31 @@ class SimpleGeometry extends Geometry {
|
|
|
299
298
|
|
|
300
299
|
/**
|
|
301
300
|
* @param {number} stride Stride.
|
|
302
|
-
* @return {import("./
|
|
301
|
+
* @return {import("./Geometry.js").GeometryLayout} layout Layout.
|
|
303
302
|
*/
|
|
304
303
|
function getLayoutForStride(stride) {
|
|
305
304
|
let layout;
|
|
306
305
|
if (stride == 2) {
|
|
307
|
-
layout =
|
|
306
|
+
layout = 'XY';
|
|
308
307
|
} else if (stride == 3) {
|
|
309
|
-
layout =
|
|
308
|
+
layout = 'XYZ';
|
|
310
309
|
} else if (stride == 4) {
|
|
311
|
-
layout =
|
|
310
|
+
layout = 'XYZM';
|
|
312
311
|
}
|
|
313
|
-
return /** @type {import("./
|
|
312
|
+
return /** @type {import("./Geometry.js").GeometryLayout} */ (layout);
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
/**
|
|
317
|
-
* @param {import("./
|
|
316
|
+
* @param {import("./Geometry.js").GeometryLayout} layout Layout.
|
|
318
317
|
* @return {number} Stride.
|
|
319
318
|
*/
|
|
320
319
|
export function getStrideForLayout(layout) {
|
|
321
320
|
let stride;
|
|
322
|
-
if (layout ==
|
|
321
|
+
if (layout == 'XY') {
|
|
323
322
|
stride = 2;
|
|
324
|
-
} else if (layout ==
|
|
323
|
+
} else if (layout == 'XYZ' || layout == 'XYM') {
|
|
325
324
|
stride = 3;
|
|
326
|
-
} else if (layout ==
|
|
325
|
+
} else if (layout == 'XYZM') {
|
|
327
326
|
stride = 4;
|
|
328
327
|
}
|
|
329
328
|
return /** @type {number} */ (stride);
|
package/src/interaction/Draw.js
CHANGED
|
@@ -5,7 +5,6 @@ import Circle from '../geom/Circle.js';
|
|
|
5
5
|
import Event from '../events/Event.js';
|
|
6
6
|
import EventType from '../events/EventType.js';
|
|
7
7
|
import Feature from '../Feature.js';
|
|
8
|
-
import GeometryLayout from '../geom/GeometryLayout.js';
|
|
9
8
|
import InteractionProperty from './Property.js';
|
|
10
9
|
import LineString from '../geom/LineString.js';
|
|
11
10
|
import MapBrowserEvent from '../MapBrowserEvent.js';
|
|
@@ -83,7 +82,7 @@ import {squaredDistance as squaredCoordinateDistance} from '../coordinate.js';
|
|
|
83
82
|
* Shift key activates freehand drawing.
|
|
84
83
|
* @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
|
|
85
84
|
* overlay.
|
|
86
|
-
* @property {GeometryLayout} [geometryLayout='XY'] Layout of the
|
|
85
|
+
* @property {import("../geom/Geometry.js").GeometryLayout} [geometryLayout='XY'] Layout of the
|
|
87
86
|
* feature geometries created by the draw interaction.
|
|
88
87
|
*/
|
|
89
88
|
|
|
@@ -118,16 +117,10 @@ import {squaredDistance as squaredCoordinateDistance} from '../coordinate.js';
|
|
|
118
117
|
*/
|
|
119
118
|
|
|
120
119
|
/**
|
|
120
|
+
* @typedef {'Point' | 'LineString' | 'Polygon' | 'Circle'} Mode
|
|
121
121
|
* Draw mode. This collapses multi-part geometry types with their single-part
|
|
122
122
|
* cousins.
|
|
123
|
-
* @enum {string}
|
|
124
123
|
*/
|
|
125
|
-
const Mode = {
|
|
126
|
-
POINT: 'Point',
|
|
127
|
-
LINE_STRING: 'LineString',
|
|
128
|
-
POLYGON: 'Polygon',
|
|
129
|
-
CIRCLE: 'Circle',
|
|
130
|
-
};
|
|
131
124
|
|
|
132
125
|
/**
|
|
133
126
|
* @enum {string}
|
|
@@ -312,7 +305,7 @@ class Draw extends PointerInteraction {
|
|
|
312
305
|
*/
|
|
313
306
|
this.minPoints_ = options.minPoints
|
|
314
307
|
? options.minPoints
|
|
315
|
-
: this.mode_ ===
|
|
308
|
+
: this.mode_ === 'Polygon'
|
|
316
309
|
? 3
|
|
317
310
|
: 2;
|
|
318
311
|
|
|
@@ -323,7 +316,7 @@ class Draw extends PointerInteraction {
|
|
|
323
316
|
* @private
|
|
324
317
|
*/
|
|
325
318
|
this.maxPoints_ =
|
|
326
|
-
this.mode_ ===
|
|
319
|
+
this.mode_ === 'Circle'
|
|
327
320
|
? 2
|
|
328
321
|
: options.maxPoints
|
|
329
322
|
? options.maxPoints
|
|
@@ -340,16 +333,16 @@ class Draw extends PointerInteraction {
|
|
|
340
333
|
|
|
341
334
|
/**
|
|
342
335
|
* @private
|
|
343
|
-
* @type {import("../geom/
|
|
336
|
+
* @type {import("../geom/Geometry.js").GeometryLayout}
|
|
344
337
|
*/
|
|
345
338
|
this.geometryLayout_ = options.geometryLayout
|
|
346
339
|
? options.geometryLayout
|
|
347
|
-
:
|
|
340
|
+
: 'XY';
|
|
348
341
|
|
|
349
342
|
let geometryFunction = options.geometryFunction;
|
|
350
343
|
if (!geometryFunction) {
|
|
351
344
|
const mode = this.mode_;
|
|
352
|
-
if (mode ===
|
|
345
|
+
if (mode === 'Circle') {
|
|
353
346
|
/**
|
|
354
347
|
* @param {!LineCoordType} coordinates The coordinates.
|
|
355
348
|
* @param {import("../geom/SimpleGeometry.js").default|undefined} geometry Optional geometry.
|
|
@@ -378,11 +371,11 @@ class Draw extends PointerInteraction {
|
|
|
378
371
|
};
|
|
379
372
|
} else {
|
|
380
373
|
let Constructor;
|
|
381
|
-
if (mode ===
|
|
374
|
+
if (mode === 'Point') {
|
|
382
375
|
Constructor = Point;
|
|
383
|
-
} else if (mode ===
|
|
376
|
+
} else if (mode === 'LineString') {
|
|
384
377
|
Constructor = LineString;
|
|
385
|
-
} else if (mode ===
|
|
378
|
+
} else if (mode === 'Polygon') {
|
|
386
379
|
Constructor = Polygon;
|
|
387
380
|
}
|
|
388
381
|
/**
|
|
@@ -393,7 +386,7 @@ class Draw extends PointerInteraction {
|
|
|
393
386
|
*/
|
|
394
387
|
geometryFunction = function (coordinates, geometry, projection) {
|
|
395
388
|
if (geometry) {
|
|
396
|
-
if (mode ===
|
|
389
|
+
if (mode === 'Polygon') {
|
|
397
390
|
if (coordinates[0].length) {
|
|
398
391
|
// Add a closing coordinate to match the first
|
|
399
392
|
geometry.setCoordinates(
|
|
@@ -555,8 +548,7 @@ class Draw extends PointerInteraction {
|
|
|
555
548
|
// Avoid context menu for long taps when drawing on mobile
|
|
556
549
|
event.originalEvent.preventDefault();
|
|
557
550
|
}
|
|
558
|
-
this.freehand_ =
|
|
559
|
-
this.mode_ !== Mode.POINT && this.freehandCondition_(event);
|
|
551
|
+
this.freehand_ = this.mode_ !== 'Point' && this.freehandCondition_(event);
|
|
560
552
|
let move = event.type === MapBrowserEventType.POINTERMOVE;
|
|
561
553
|
let pass = true;
|
|
562
554
|
if (
|
|
@@ -674,7 +666,7 @@ class Draw extends PointerInteraction {
|
|
|
674
666
|
this.finishDrawing();
|
|
675
667
|
} else if (
|
|
676
668
|
!this.freehand_ &&
|
|
677
|
-
(!startingToDraw || this.mode_ ===
|
|
669
|
+
(!startingToDraw || this.mode_ === 'Point')
|
|
678
670
|
) {
|
|
679
671
|
if (this.atFinish_(event.pixel)) {
|
|
680
672
|
if (this.finishCondition_(event)) {
|
|
@@ -740,13 +732,13 @@ class Draw extends PointerInteraction {
|
|
|
740
732
|
let potentiallyDone = false;
|
|
741
733
|
let potentiallyFinishCoordinates = [this.finishCoordinate_];
|
|
742
734
|
const mode = this.mode_;
|
|
743
|
-
if (mode ===
|
|
735
|
+
if (mode === 'Point') {
|
|
744
736
|
at = true;
|
|
745
|
-
} else if (mode ===
|
|
737
|
+
} else if (mode === 'Circle') {
|
|
746
738
|
at = this.sketchCoords_.length === 2;
|
|
747
|
-
} else if (mode ===
|
|
739
|
+
} else if (mode === 'LineString') {
|
|
748
740
|
potentiallyDone = this.sketchCoords_.length > this.minPoints_;
|
|
749
|
-
} else if (mode ===
|
|
741
|
+
} else if (mode === 'Polygon') {
|
|
750
742
|
const sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);
|
|
751
743
|
potentiallyDone = sketchCoords[0].length > this.minPoints_;
|
|
752
744
|
potentiallyFinishCoordinates = [
|
|
@@ -824,9 +816,9 @@ class Draw extends PointerInteraction {
|
|
|
824
816
|
start.push(0);
|
|
825
817
|
}
|
|
826
818
|
this.finishCoordinate_ = start;
|
|
827
|
-
if (this.mode_ ===
|
|
819
|
+
if (this.mode_ === 'Point') {
|
|
828
820
|
this.sketchCoords_ = start.slice();
|
|
829
|
-
} else if (this.mode_ ===
|
|
821
|
+
} else if (this.mode_ === 'Polygon') {
|
|
830
822
|
this.sketchCoords_ = [[start.slice(), start.slice()]];
|
|
831
823
|
this.sketchLineCoords_ = this.sketchCoords_[0];
|
|
832
824
|
} else {
|
|
@@ -865,9 +857,9 @@ class Draw extends PointerInteraction {
|
|
|
865
857
|
while (coordinate.length < stride) {
|
|
866
858
|
coordinate.push(0);
|
|
867
859
|
}
|
|
868
|
-
if (this.mode_ ===
|
|
860
|
+
if (this.mode_ === 'Point') {
|
|
869
861
|
last = this.sketchCoords_;
|
|
870
|
-
} else if (this.mode_ ===
|
|
862
|
+
} else if (this.mode_ === 'Polygon') {
|
|
871
863
|
coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
|
|
872
864
|
last = coordinates[coordinates.length - 1];
|
|
873
865
|
if (this.atFinish_(map.getPixelFromCoordinate(coordinate))) {
|
|
@@ -889,7 +881,7 @@ class Draw extends PointerInteraction {
|
|
|
889
881
|
const sketchPointGeom = this.sketchPoint_.getGeometry();
|
|
890
882
|
sketchPointGeom.setCoordinates(coordinate);
|
|
891
883
|
}
|
|
892
|
-
if (geometry.getType() === 'Polygon' && this.mode_ !==
|
|
884
|
+
if (geometry.getType() === 'Polygon' && this.mode_ !== 'Polygon') {
|
|
893
885
|
this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));
|
|
894
886
|
} else if (this.sketchLineCoords_) {
|
|
895
887
|
const sketchLineGeom = this.sketchLine_.getGeometry();
|
|
@@ -909,7 +901,7 @@ class Draw extends PointerInteraction {
|
|
|
909
901
|
let done;
|
|
910
902
|
let coordinates;
|
|
911
903
|
const mode = this.mode_;
|
|
912
|
-
if (mode ===
|
|
904
|
+
if (mode === 'LineString' || mode === 'Circle') {
|
|
913
905
|
this.finishCoordinate_ = coordinate.slice();
|
|
914
906
|
coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
|
|
915
907
|
if (coordinates.length >= this.maxPoints_) {
|
|
@@ -921,7 +913,7 @@ class Draw extends PointerInteraction {
|
|
|
921
913
|
}
|
|
922
914
|
coordinates.push(coordinate.slice());
|
|
923
915
|
this.geometryFunction_(coordinates, geometry, projection);
|
|
924
|
-
} else if (mode ===
|
|
916
|
+
} else if (mode === 'Polygon') {
|
|
925
917
|
coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
|
|
926
918
|
if (coordinates.length >= this.maxPoints_) {
|
|
927
919
|
if (this.freehand_) {
|
|
@@ -956,7 +948,7 @@ class Draw extends PointerInteraction {
|
|
|
956
948
|
const projection = this.getMap().getView().getProjection();
|
|
957
949
|
let coordinates;
|
|
958
950
|
const mode = this.mode_;
|
|
959
|
-
if (mode ===
|
|
951
|
+
if (mode === 'LineString' || mode === 'Circle') {
|
|
960
952
|
coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
|
|
961
953
|
coordinates.splice(-2, 1);
|
|
962
954
|
if (coordinates.length >= 2) {
|
|
@@ -969,7 +961,7 @@ class Draw extends PointerInteraction {
|
|
|
969
961
|
if (geometry.getType() === 'Polygon' && this.sketchLine_) {
|
|
970
962
|
this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));
|
|
971
963
|
}
|
|
972
|
-
} else if (mode ===
|
|
964
|
+
} else if (mode === 'Polygon') {
|
|
973
965
|
coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
|
|
974
966
|
coordinates.splice(-2, 1);
|
|
975
967
|
const sketchLineGeom = this.sketchLine_.getGeometry();
|
|
@@ -1003,11 +995,11 @@ class Draw extends PointerInteraction {
|
|
|
1003
995
|
let coordinates = this.sketchCoords_;
|
|
1004
996
|
const geometry = sketchFeature.getGeometry();
|
|
1005
997
|
const projection = this.getMap().getView().getProjection();
|
|
1006
|
-
if (this.mode_ ===
|
|
998
|
+
if (this.mode_ === 'LineString') {
|
|
1007
999
|
// remove the redundant last point
|
|
1008
1000
|
coordinates.pop();
|
|
1009
1001
|
this.geometryFunction_(coordinates, geometry, projection);
|
|
1010
|
-
} else if (this.mode_ ===
|
|
1002
|
+
} else if (this.mode_ === 'Polygon') {
|
|
1011
1003
|
// remove the redundant last point in ring
|
|
1012
1004
|
/** @type {PolyCoordType} */ (coordinates)[0].pop();
|
|
1013
1005
|
this.geometryFunction_(coordinates, geometry, projection);
|
|
@@ -1084,9 +1076,9 @@ class Draw extends PointerInteraction {
|
|
|
1084
1076
|
}
|
|
1085
1077
|
/** @type {LineCoordType} */
|
|
1086
1078
|
let sketchCoords;
|
|
1087
|
-
if (mode ===
|
|
1079
|
+
if (mode === 'LineString' || mode === 'Circle') {
|
|
1088
1080
|
sketchCoords = /** @type {LineCoordType} */ (this.sketchCoords_);
|
|
1089
|
-
} else if (mode ===
|
|
1081
|
+
} else if (mode === 'Polygon') {
|
|
1090
1082
|
sketchCoords =
|
|
1091
1083
|
this.sketchCoords_ && this.sketchCoords_.length
|
|
1092
1084
|
? /** @type {PolyCoordType} */ (this.sketchCoords_)[0]
|
|
@@ -1277,15 +1269,15 @@ function getMode(type) {
|
|
|
1277
1269
|
switch (type) {
|
|
1278
1270
|
case 'Point':
|
|
1279
1271
|
case 'MultiPoint':
|
|
1280
|
-
return
|
|
1272
|
+
return 'Point';
|
|
1281
1273
|
case 'LineString':
|
|
1282
1274
|
case 'MultiLineString':
|
|
1283
|
-
return
|
|
1275
|
+
return 'LineString';
|
|
1284
1276
|
case 'Polygon':
|
|
1285
1277
|
case 'MultiPolygon':
|
|
1286
|
-
return
|
|
1278
|
+
return 'Polygon';
|
|
1287
1279
|
case 'Circle':
|
|
1288
|
-
return
|
|
1280
|
+
return 'Circle';
|
|
1289
1281
|
default:
|
|
1290
1282
|
throw new Error('Invalid type: ' + type);
|
|
1291
1283
|
}
|
package/src/layer/Graticule.js
CHANGED
|
@@ -5,7 +5,6 @@ import Collection from '../Collection.js';
|
|
|
5
5
|
import EventType from '../render/EventType.js';
|
|
6
6
|
import Feature from '../Feature.js';
|
|
7
7
|
import Fill from '../style/Fill.js';
|
|
8
|
-
import GeometryLayout from '../geom/GeometryLayout.js';
|
|
9
8
|
import LineString from '../geom/LineString.js';
|
|
10
9
|
import Point from '../geom/Point.js';
|
|
11
10
|
import Stroke from '../style/Stroke.js';
|
|
@@ -1037,10 +1036,10 @@ class Graticule extends VectorLayer {
|
|
|
1037
1036
|
);
|
|
1038
1037
|
let lineString = this.meridians_[index];
|
|
1039
1038
|
if (!lineString) {
|
|
1040
|
-
lineString = new LineString(flatCoordinates,
|
|
1039
|
+
lineString = new LineString(flatCoordinates, 'XY');
|
|
1041
1040
|
this.meridians_[index] = lineString;
|
|
1042
1041
|
} else {
|
|
1043
|
-
lineString.setFlatCoordinates(
|
|
1042
|
+
lineString.setFlatCoordinates('XY', flatCoordinates);
|
|
1044
1043
|
lineString.changed();
|
|
1045
1044
|
}
|
|
1046
1045
|
return lineString;
|
|
@@ -1107,9 +1106,9 @@ class Graticule extends VectorLayer {
|
|
|
1107
1106
|
);
|
|
1108
1107
|
let lineString = this.parallels_[index];
|
|
1109
1108
|
if (!lineString) {
|
|
1110
|
-
lineString = new LineString(flatCoordinates,
|
|
1109
|
+
lineString = new LineString(flatCoordinates, 'XY');
|
|
1111
1110
|
} else {
|
|
1112
|
-
lineString.setFlatCoordinates(
|
|
1111
|
+
lineString.setFlatCoordinates('XY', flatCoordinates);
|
|
1113
1112
|
lineString.changed();
|
|
1114
1113
|
}
|
|
1115
1114
|
return lineString;
|
package/src/render/Feature.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module ol/render/Feature
|
|
3
3
|
*/
|
|
4
4
|
import Feature from '../Feature.js';
|
|
5
|
-
import GeometryLayout from '../geom/GeometryLayout.js';
|
|
6
5
|
import {
|
|
7
6
|
LineString,
|
|
8
7
|
MultiLineString,
|
|
@@ -350,19 +349,13 @@ export function toGeometry(renderFeature) {
|
|
|
350
349
|
case 'Point':
|
|
351
350
|
return new Point(renderFeature.getFlatCoordinates());
|
|
352
351
|
case 'MultiPoint':
|
|
353
|
-
return new MultiPoint(
|
|
354
|
-
renderFeature.getFlatCoordinates(),
|
|
355
|
-
GeometryLayout.XY
|
|
356
|
-
);
|
|
352
|
+
return new MultiPoint(renderFeature.getFlatCoordinates(), 'XY');
|
|
357
353
|
case 'LineString':
|
|
358
|
-
return new LineString(
|
|
359
|
-
renderFeature.getFlatCoordinates(),
|
|
360
|
-
GeometryLayout.XY
|
|
361
|
-
);
|
|
354
|
+
return new LineString(renderFeature.getFlatCoordinates(), 'XY');
|
|
362
355
|
case 'MultiLineString':
|
|
363
356
|
return new MultiLineString(
|
|
364
357
|
renderFeature.getFlatCoordinates(),
|
|
365
|
-
|
|
358
|
+
'XY',
|
|
366
359
|
/** @type {Array<number>} */ (renderFeature.getEnds())
|
|
367
360
|
);
|
|
368
361
|
case 'Polygon':
|
|
@@ -370,8 +363,8 @@ export function toGeometry(renderFeature) {
|
|
|
370
363
|
const ends = /** @type {Array<number>} */ (renderFeature.getEnds());
|
|
371
364
|
const endss = inflateEnds(flatCoordinates, ends);
|
|
372
365
|
return endss.length > 1
|
|
373
|
-
? new MultiPolygon(flatCoordinates,
|
|
374
|
-
: new Polygon(flatCoordinates,
|
|
366
|
+
? new MultiPolygon(flatCoordinates, 'XY', endss)
|
|
367
|
+
: new Polygon(flatCoordinates, 'XY', ends);
|
|
375
368
|
default:
|
|
376
369
|
throw new Error('Invalid geometry type:' + geometryType);
|
|
377
370
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import CanvasBuilder from './Builder.js';
|
|
5
5
|
import CanvasInstruction from './Instruction.js';
|
|
6
|
-
import TextPlacement from '../../style/TextPlacement.js';
|
|
7
6
|
import {asColorLike} from '../../colorlike.js';
|
|
8
7
|
import {
|
|
9
8
|
defaultFillStyle,
|
|
@@ -177,7 +176,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
|
|
177
176
|
let stride = geometry.getStride();
|
|
178
177
|
|
|
179
178
|
if (
|
|
180
|
-
textState.placement ===
|
|
179
|
+
textState.placement === 'line' &&
|
|
181
180
|
(geometryType == 'LineString' ||
|
|
182
181
|
geometryType == 'MultiLineString' ||
|
|
183
182
|
geometryType == 'Polygon' ||
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import CanvasImmediateRenderer from './Immediate.js';
|
|
6
|
-
import IconAnchorUnits from '../../style/IconAnchorUnits.js';
|
|
7
6
|
import {Icon} from '../../style.js';
|
|
8
7
|
import {clamp} from '../../math.js';
|
|
9
8
|
import {createCanvasContext2D} from '../../dom.js';
|
|
@@ -104,8 +103,8 @@ export function createHitDetectionImageData(
|
|
|
104
103
|
img: img,
|
|
105
104
|
imgSize: imgSize,
|
|
106
105
|
anchor: image.getAnchor(),
|
|
107
|
-
anchorXUnits:
|
|
108
|
-
anchorYUnits:
|
|
106
|
+
anchorXUnits: 'pixels',
|
|
107
|
+
anchorYUnits: 'pixels',
|
|
109
108
|
offset: image.getOrigin(),
|
|
110
109
|
opacity: 1,
|
|
111
110
|
size: image.getSize(),
|