@hybridcore/ui 1.6.13 → 1.6.14
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/dist/AccordionSummary-DUtr16g6.js +781 -0
- package/dist/Add-Bk8R160M.js +403 -0
- package/dist/Button-Cem3nbwc.js +357 -0
- package/dist/ButtonBase-DObmf4Q_.js +886 -0
- package/dist/Delete-CVJ6FeDn.js +203 -0
- package/dist/FormGroup-BRj1o7-E.js +89 -0
- package/dist/InputLabel-CjD30ZHz.js +341 -0
- package/dist/MenuItem-BKvRGLvM.js +233 -0
- package/dist/Modal-BVYydOr5.js +1156 -0
- package/dist/Paper-B1HV8GyO.js +582 -0
- package/dist/Select-Bfhvigsx.js +3914 -0
- package/dist/Source-BSZST_GH.js +4410 -0
- package/dist/SwitchBase-BEK49kdS.js +235 -0
- package/dist/Text-ChJRuaD8.js +2197 -0
- package/dist/TextField-Ca9ykixI.js +696 -0
- package/dist/TransitionGroupContext-Ja2CgIob.js +96 -0
- package/dist/Typography-D3X-Y5fh.js +178 -0
- package/dist/Vector-BmuhQO4p.js +3606 -0
- package/dist/Vector-DfTqQEln.js +1735 -0
- package/dist/WKT-2wsDT-nq.js +2310 -0
- package/dist/{_commonjsHelpers-BVfed4GL.js → _commonjsHelpers-BkfeUUK-.js} +2 -2
- package/dist/assertThisInitialized-C1dAyb4j.js +7 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/button/styled.js +1 -1
- package/dist/components/charts/_common/format.js +126 -82
- package/dist/components/charts/drill-down-voronoi-treemap/logic.js +1 -1
- package/dist/components/collapsible-card/index.js +30 -21
- package/dist/components/collapsible-card/styled.js +14 -16
- package/dist/components/color-picker/index.js +3358 -2228
- package/dist/components/color-picker/styled.js +7 -87
- package/dist/components/confirm/dialog.js +7 -89
- package/dist/components/confirm/index.js +1 -1
- package/dist/components/data-map/index.js +1 -1
- package/dist/components/data-map/logic.js +20 -20
- package/dist/components/data-security-selectors/dissemination-list/index.js +3117 -32
- package/dist/components/date-range-picker/index.js +454 -466
- package/dist/components/document-viewer/components/viewer/index.js +1 -1
- package/dist/components/duration-select/index.js +10 -10
- package/dist/components/duration-select/styled.js +1 -1
- package/dist/components/geometry-picker/coordinate/index.js +14 -14
- package/dist/components/geometry-picker/edit/index.js +1 -1
- package/dist/components/geometry-picker/geometry/index.js +1 -1
- package/dist/components/geometry-picker/kml/index.js +11 -11
- package/dist/components/geometry-picker/map/logic.js +3656 -145
- package/dist/components/geometry-picker/map/style.js +17 -18
- package/dist/components/geometry-picker/parser/coordinate-input/logic.js +1255 -43
- package/dist/components/heat-map/index.js +1 -1
- package/dist/components/heat-map/logic.js +1924 -77
- package/dist/components/instance-form/components/composite-matrix/components/json-editor/index.js +2 -2
- package/dist/components/instance-hierarchy-table/styled.js +16 -18
- package/dist/components/map/helpers/mapbox.js +15 -17
- package/dist/components/map/helpers/ol.js +27 -386
- package/dist/components/map/index.js +10 -11
- package/dist/components/map/logic.js +22 -22
- package/dist/components/map/styled.js +27 -31
- package/dist/components/phone-input/index.js +9 -10
- package/dist/components/property-mapping/index.js +1 -1
- package/dist/components/prr-map/index.js +1 -1
- package/dist/components/prr-map/logic.js +26 -27
- package/dist/components/raster-grid-map/index.js +1 -1
- package/dist/components/raster-grid-map/logic.js +57 -60
- package/dist/components/sortable-list/index.js +1264 -1091
- package/dist/components/template-form/components/property-list/index.js +32 -36
- package/dist/components/template-form/components/property-list/property-list-columns.js +17 -19
- package/dist/components/template-form/components/property-list/property-list-form.js +600 -137
- package/dist/components/template-form/components/recognition-property-list/index.js +36 -40
- package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +9 -11
- package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +64 -57
- package/dist/components/tree-select/index.js +16 -16
- package/dist/createChainedFunction-C0nujS3O.js +9 -0
- package/dist/createSvgIcon-BghzB2Y9.js +93 -0
- package/dist/createSvgIcon-D7U1nd99.js +185 -0
- package/dist/debounce-46wSf_lW.js +15 -0
- package/dist/dialog-BtJhjyF5.js +664 -0
- package/dist/extends-C3382pL0.js +22 -0
- package/dist/formControlState-vgaj2ksH.js +10 -0
- package/dist/generateUtilityClasses-Cc-owZ4J.js +2971 -0
- package/dist/{index-C__OZmYy.js → index-CblbdqjE.js} +1 -1
- package/dist/index-DH6qsPBn.js +153 -0
- package/dist/index.esm-DAf19hyR.js +318 -0
- package/dist/math-Bvt2Ubuz.js +704 -0
- package/dist/ol-yOE-NV0X.js +7465 -0
- package/dist/ownerWindow-wg6foiOE.js +10 -0
- package/dist/setPrototypeOf-NPgp4cYc.js +8 -0
- package/dist/styled-DD4BkuVf.js +350 -0
- package/dist/useControlled-BYdyS7Pn.js +31 -0
- package/dist/useFormControl-CatNKXAi.js +10 -0
- package/dist/useId-BW-oWmul.js +19 -0
- package/dist/useSlot-u4t0X96G.js +42 -0
- package/package.json +1 -1
- package/dist/index.esm-UfGMjYOL.js +0 -197
|
@@ -0,0 +1,2310 @@
|
|
|
1
|
+
import { B as Q, u as X, l as U, E as Z, a as V, b as g, c as tt, d as b, e as y, s as et } from "./math-Bvt2Ubuz.js";
|
|
2
|
+
import { c as x, e as st, d as R, h as T, m as it, i as nt, j as rt, k as H, l as ot, n as at, o as K, p as ht, q as lt, r as ut, s as ct, u as dt, v as gt, P as I, w as ft, x as mt, y as yt, z as _t, A as pt, B as Ct, C as Tt, D as Y, E as Pt, F as Et, G as Gt, H as xt, I as O, J as Mt, K as Ft, M as Lt, N as Rt, O as wt, Q as At } from "./Source-BSZST_GH.js";
|
|
3
|
+
import { l as Nt } from "./Vector-DfTqQEln.js";
|
|
4
|
+
class M extends Q {
|
|
5
|
+
/**
|
|
6
|
+
* @param {Geometry|ObjectWithGeometry<Geometry>} [geometryOrProperties]
|
|
7
|
+
* You may pass a Geometry object directly, or an object literal containing
|
|
8
|
+
* properties. If you pass an object literal, you may include a Geometry
|
|
9
|
+
* associated with a `geometry` key.
|
|
10
|
+
*/
|
|
11
|
+
constructor(t) {
|
|
12
|
+
if (super(), this.on, this.once, this.un, this.id_ = void 0, this.geometryName_ = "geometry", this.style_ = null, this.styleFunction_ = void 0, this.geometryChangeKey_ = null, this.addChangeListener(this.geometryName_, this.handleGeometryChanged_), t)
|
|
13
|
+
if (typeof /** @type {?} */
|
|
14
|
+
t.getSimplifiedGeometry == "function") {
|
|
15
|
+
const e = (
|
|
16
|
+
/** @type {Geometry} */
|
|
17
|
+
t
|
|
18
|
+
);
|
|
19
|
+
this.setGeometry(e);
|
|
20
|
+
} else {
|
|
21
|
+
const e = t;
|
|
22
|
+
this.setProperties(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Clone this feature. If the original feature has a geometry it
|
|
27
|
+
* is also cloned. The feature id is not set in the clone.
|
|
28
|
+
* @return {Feature<Geometry>} The clone.
|
|
29
|
+
* @api
|
|
30
|
+
*/
|
|
31
|
+
clone() {
|
|
32
|
+
const t = (
|
|
33
|
+
/** @type {Feature<Geometry>} */
|
|
34
|
+
new M(this.hasProperties() ? this.getProperties() : null)
|
|
35
|
+
);
|
|
36
|
+
t.setGeometryName(this.getGeometryName());
|
|
37
|
+
const e = this.getGeometry();
|
|
38
|
+
e && t.setGeometry(
|
|
39
|
+
/** @type {Geometry} */
|
|
40
|
+
e.clone()
|
|
41
|
+
);
|
|
42
|
+
const s = this.getStyle();
|
|
43
|
+
return s && t.setStyle(s), t;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the feature's default geometry. A feature may have any number of named
|
|
47
|
+
* geometries. The "default" geometry (the one that is rendered by default) is
|
|
48
|
+
* set when calling {@link module:ol/Feature~Feature#setGeometry}.
|
|
49
|
+
* @return {Geometry|undefined} The default geometry for the feature.
|
|
50
|
+
* @api
|
|
51
|
+
* @observable
|
|
52
|
+
*/
|
|
53
|
+
getGeometry() {
|
|
54
|
+
return (
|
|
55
|
+
/** @type {Geometry|undefined} */
|
|
56
|
+
this.get(this.geometryName_)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the feature identifier. This is a stable identifier for the feature and
|
|
61
|
+
* is either set when reading data from a remote source or set explicitly by
|
|
62
|
+
* calling {@link module:ol/Feature~Feature#setId}.
|
|
63
|
+
* @return {number|string|undefined} Id.
|
|
64
|
+
* @api
|
|
65
|
+
*/
|
|
66
|
+
getId() {
|
|
67
|
+
return this.id_;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get the name of the feature's default geometry. By default, the default
|
|
71
|
+
* geometry is named `geometry`.
|
|
72
|
+
* @return {string} Get the property name associated with the default geometry
|
|
73
|
+
* for this feature.
|
|
74
|
+
* @api
|
|
75
|
+
*/
|
|
76
|
+
getGeometryName() {
|
|
77
|
+
return this.geometryName_;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the feature's style. Will return what was provided to the
|
|
81
|
+
* {@link module:ol/Feature~Feature#setStyle} method.
|
|
82
|
+
* @return {import("./style/Style.js").StyleLike|undefined} The feature style.
|
|
83
|
+
* @api
|
|
84
|
+
*/
|
|
85
|
+
getStyle() {
|
|
86
|
+
return this.style_;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get the feature's style function.
|
|
90
|
+
* @return {import("./style/Style.js").StyleFunction|undefined} Return a function
|
|
91
|
+
* representing the current style of this feature.
|
|
92
|
+
* @api
|
|
93
|
+
*/
|
|
94
|
+
getStyleFunction() {
|
|
95
|
+
return this.styleFunction_;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
handleGeometryChange_() {
|
|
101
|
+
this.changed();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
106
|
+
handleGeometryChanged_() {
|
|
107
|
+
this.geometryChangeKey_ && (X(this.geometryChangeKey_), this.geometryChangeKey_ = null);
|
|
108
|
+
const t = this.getGeometry();
|
|
109
|
+
t && (this.geometryChangeKey_ = U(
|
|
110
|
+
t,
|
|
111
|
+
Z.CHANGE,
|
|
112
|
+
this.handleGeometryChange_,
|
|
113
|
+
this
|
|
114
|
+
)), this.changed();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Set the default geometry for the feature. This will update the property
|
|
118
|
+
* with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
|
|
119
|
+
* @param {Geometry|undefined} geometry The new geometry.
|
|
120
|
+
* @api
|
|
121
|
+
* @observable
|
|
122
|
+
*/
|
|
123
|
+
setGeometry(t) {
|
|
124
|
+
this.set(this.geometryName_, t);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Set the style for the feature to override the layer style. This can be a
|
|
128
|
+
* single style object, an array of styles, or a function that takes a
|
|
129
|
+
* resolution and returns an array of styles. To unset the feature style, call
|
|
130
|
+
* `setStyle()` without arguments or a falsey value.
|
|
131
|
+
* @param {import("./style/Style.js").StyleLike} [style] Style for this feature.
|
|
132
|
+
* @api
|
|
133
|
+
* @fires module:ol/events/Event~BaseEvent#event:change
|
|
134
|
+
*/
|
|
135
|
+
setStyle(t) {
|
|
136
|
+
this.style_ = t, this.styleFunction_ = t ? It(t) : void 0, this.changed();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Set the feature id. The feature id is considered stable and may be used when
|
|
140
|
+
* requesting features or comparing identifiers returned from a remote source.
|
|
141
|
+
* The feature id can be used with the
|
|
142
|
+
* {@link module:ol/source/Vector~VectorSource#getFeatureById} method.
|
|
143
|
+
* @param {number|string|undefined} id The feature id.
|
|
144
|
+
* @api
|
|
145
|
+
* @fires module:ol/events/Event~BaseEvent#event:change
|
|
146
|
+
*/
|
|
147
|
+
setId(t) {
|
|
148
|
+
this.id_ = t, this.changed();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Set the property name to be used when getting the feature's default geometry.
|
|
152
|
+
* When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
|
|
153
|
+
* this name will be returned.
|
|
154
|
+
* @param {string} name The property name of the default geometry.
|
|
155
|
+
* @api
|
|
156
|
+
*/
|
|
157
|
+
setGeometryName(t) {
|
|
158
|
+
this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_), this.geometryName_ = t, this.addChangeListener(this.geometryName_, this.handleGeometryChanged_), this.handleGeometryChanged_();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function It(r) {
|
|
162
|
+
if (typeof r == "function")
|
|
163
|
+
return r;
|
|
164
|
+
let t;
|
|
165
|
+
return Array.isArray(r) ? t = r : (V(typeof /** @type {?} */
|
|
166
|
+
r.getZIndex == "function", 41), t = [
|
|
167
|
+
/** @type {import("./style/Style.js").default} */
|
|
168
|
+
r
|
|
169
|
+
]), function() {
|
|
170
|
+
return t;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
class Ot {
|
|
174
|
+
constructor() {
|
|
175
|
+
this.dataProjection = void 0, this.defaultFeatureProjection = void 0, this.supportedMediaTypes = null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Adds the data projection to the read options.
|
|
179
|
+
* @param {Document|Element|Object|string} source Source.
|
|
180
|
+
* @param {ReadOptions} [options] Options.
|
|
181
|
+
* @return {ReadOptions|undefined} Options.
|
|
182
|
+
* @protected
|
|
183
|
+
*/
|
|
184
|
+
getReadOptions(t, e) {
|
|
185
|
+
if (e) {
|
|
186
|
+
let s = e.dataProjection ? x(e.dataProjection) : this.readProjection(t);
|
|
187
|
+
e.extent && s && s.getUnits() === "tile-pixels" && (s = x(s), s.setWorldExtent(e.extent)), e = {
|
|
188
|
+
dataProjection: s,
|
|
189
|
+
featureProjection: e.featureProjection
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return this.adaptOptions(e);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Sets the `dataProjection` on the options, if no `dataProjection`
|
|
196
|
+
* is set.
|
|
197
|
+
* @param {WriteOptions|ReadOptions|undefined} options
|
|
198
|
+
* Options.
|
|
199
|
+
* @protected
|
|
200
|
+
* @return {WriteOptions|ReadOptions|undefined}
|
|
201
|
+
* Updated options.
|
|
202
|
+
*/
|
|
203
|
+
adaptOptions(t) {
|
|
204
|
+
return Object.assign(
|
|
205
|
+
{
|
|
206
|
+
dataProjection: this.dataProjection,
|
|
207
|
+
featureProjection: this.defaultFeatureProjection
|
|
208
|
+
},
|
|
209
|
+
t
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @abstract
|
|
214
|
+
* @return {Type} The format type.
|
|
215
|
+
*/
|
|
216
|
+
getType() {
|
|
217
|
+
return g();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Read a single feature from a source.
|
|
221
|
+
*
|
|
222
|
+
* @abstract
|
|
223
|
+
* @param {Document|Element|Object|string} source Source.
|
|
224
|
+
* @param {ReadOptions} [options] Read options.
|
|
225
|
+
* @return {import("../Feature.js").FeatureLike} Feature.
|
|
226
|
+
*/
|
|
227
|
+
readFeature(t, e) {
|
|
228
|
+
return g();
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Read all features from a source.
|
|
232
|
+
*
|
|
233
|
+
* @abstract
|
|
234
|
+
* @param {Document|Element|ArrayBuffer|Object|string} source Source.
|
|
235
|
+
* @param {ReadOptions} [options] Read options.
|
|
236
|
+
* @return {Array<import("../Feature.js").FeatureLike>} Features.
|
|
237
|
+
*/
|
|
238
|
+
readFeatures(t, e) {
|
|
239
|
+
return g();
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Read a single geometry from a source.
|
|
243
|
+
*
|
|
244
|
+
* @abstract
|
|
245
|
+
* @param {Document|Element|Object|string} source Source.
|
|
246
|
+
* @param {ReadOptions} [options] Read options.
|
|
247
|
+
* @return {import("../geom/Geometry.js").default} Geometry.
|
|
248
|
+
*/
|
|
249
|
+
readGeometry(t, e) {
|
|
250
|
+
return g();
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Read the projection from a source.
|
|
254
|
+
*
|
|
255
|
+
* @abstract
|
|
256
|
+
* @param {Document|Element|Object|string} source Source.
|
|
257
|
+
* @return {import("../proj/Projection.js").default|undefined} Projection.
|
|
258
|
+
*/
|
|
259
|
+
readProjection(t) {
|
|
260
|
+
return g();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Encode a feature in this format.
|
|
264
|
+
*
|
|
265
|
+
* @abstract
|
|
266
|
+
* @param {import("../Feature.js").default} feature Feature.
|
|
267
|
+
* @param {WriteOptions} [options] Write options.
|
|
268
|
+
* @return {string|ArrayBuffer} Result.
|
|
269
|
+
*/
|
|
270
|
+
writeFeature(t, e) {
|
|
271
|
+
return g();
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Encode an array of features in this format.
|
|
275
|
+
*
|
|
276
|
+
* @abstract
|
|
277
|
+
* @param {Array<import("../Feature.js").default>} features Features.
|
|
278
|
+
* @param {WriteOptions} [options] Write options.
|
|
279
|
+
* @return {string|ArrayBuffer} Result.
|
|
280
|
+
*/
|
|
281
|
+
writeFeatures(t, e) {
|
|
282
|
+
return g();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Write a single geometry in this format.
|
|
286
|
+
*
|
|
287
|
+
* @abstract
|
|
288
|
+
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
|
289
|
+
* @param {WriteOptions} [options] Write options.
|
|
290
|
+
* @return {string|ArrayBuffer} Result.
|
|
291
|
+
*/
|
|
292
|
+
writeGeometry(t, e) {
|
|
293
|
+
return g();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function k(r, t, e) {
|
|
297
|
+
const s = e ? x(e.featureProjection) : null, i = e ? x(e.dataProjection) : null;
|
|
298
|
+
let n;
|
|
299
|
+
if (s && i && !st(s, i) ? n = (t ? r.clone() : r).transform(
|
|
300
|
+
t ? s : i,
|
|
301
|
+
t ? i : s
|
|
302
|
+
) : n = r, t && e && /** @type {WriteOptions} */
|
|
303
|
+
e.decimals !== void 0) {
|
|
304
|
+
const o = Math.pow(
|
|
305
|
+
10,
|
|
306
|
+
/** @type {WriteOptions} */
|
|
307
|
+
e.decimals
|
|
308
|
+
), a = function(h) {
|
|
309
|
+
for (let c = 0, l = h.length; c < l; ++c)
|
|
310
|
+
h[c] = Math.round(h[c] * o) / o;
|
|
311
|
+
return h;
|
|
312
|
+
};
|
|
313
|
+
n === r && (n = r.clone()), n.applyTransform(a);
|
|
314
|
+
}
|
|
315
|
+
return n;
|
|
316
|
+
}
|
|
317
|
+
function D(r, t, e, s, i, n, o) {
|
|
318
|
+
let a, h;
|
|
319
|
+
const c = (e - t) / s;
|
|
320
|
+
if (c === 1)
|
|
321
|
+
a = t;
|
|
322
|
+
else if (c === 2)
|
|
323
|
+
a = t, h = i;
|
|
324
|
+
else if (c !== 0) {
|
|
325
|
+
let l = r[t], f = r[t + 1], d = 0;
|
|
326
|
+
const m = [0];
|
|
327
|
+
for (let E = t + s; E < e; E += s) {
|
|
328
|
+
const A = r[E], N = r[E + 1];
|
|
329
|
+
d += Math.sqrt((A - l) * (A - l) + (N - f) * (N - f)), m.push(d), l = A, f = N;
|
|
330
|
+
}
|
|
331
|
+
const P = i * d, _ = tt(m, P);
|
|
332
|
+
_ < 0 ? (h = (P - m[-_ - 2]) / (m[-_ - 1] - m[-_ - 2]), a = t + (-_ - 2) * s) : a = t + _ * s;
|
|
333
|
+
}
|
|
334
|
+
o = o > 1 ? o : 2, n = n || new Array(o);
|
|
335
|
+
for (let l = 0; l < o; ++l)
|
|
336
|
+
n[l] = a === void 0 ? NaN : h === void 0 ? r[a + l] : b(r[a + l], r[a + s + l], h);
|
|
337
|
+
return n;
|
|
338
|
+
}
|
|
339
|
+
function v(r, t, e, s, i, n) {
|
|
340
|
+
if (e == t)
|
|
341
|
+
return null;
|
|
342
|
+
let o;
|
|
343
|
+
if (i < r[t + s - 1])
|
|
344
|
+
return n ? (o = r.slice(t, t + s), o[s - 1] = i, o) : null;
|
|
345
|
+
if (r[e - 1] < i)
|
|
346
|
+
return n ? (o = r.slice(e - s, e), o[s - 1] = i, o) : null;
|
|
347
|
+
if (i == r[t + s - 1])
|
|
348
|
+
return r.slice(t, t + s);
|
|
349
|
+
let a = t / s, h = e / s;
|
|
350
|
+
for (; a < h; ) {
|
|
351
|
+
const d = a + h >> 1;
|
|
352
|
+
i < r[(d + 1) * s - 1] ? h = d : a = d + 1;
|
|
353
|
+
}
|
|
354
|
+
const c = r[a * s - 1];
|
|
355
|
+
if (i == c)
|
|
356
|
+
return r.slice((a - 1) * s, (a - 1) * s + s);
|
|
357
|
+
const l = r[(a + 1) * s - 1], f = (i - c) / (l - c);
|
|
358
|
+
o = [];
|
|
359
|
+
for (let d = 0; d < s - 1; ++d)
|
|
360
|
+
o.push(
|
|
361
|
+
b(
|
|
362
|
+
r[(a - 1) * s + d],
|
|
363
|
+
r[a * s + d],
|
|
364
|
+
f
|
|
365
|
+
)
|
|
366
|
+
);
|
|
367
|
+
return o.push(i), o;
|
|
368
|
+
}
|
|
369
|
+
function vt(r, t, e, s, i, n, o) {
|
|
370
|
+
if (o)
|
|
371
|
+
return v(
|
|
372
|
+
r,
|
|
373
|
+
t,
|
|
374
|
+
e[e.length - 1],
|
|
375
|
+
s,
|
|
376
|
+
i,
|
|
377
|
+
n
|
|
378
|
+
);
|
|
379
|
+
let a;
|
|
380
|
+
if (i < r[s - 1])
|
|
381
|
+
return n ? (a = r.slice(0, s), a[s - 1] = i, a) : null;
|
|
382
|
+
if (r[r.length - 1] < i)
|
|
383
|
+
return n ? (a = r.slice(r.length - s), a[s - 1] = i, a) : null;
|
|
384
|
+
for (let h = 0, c = e.length; h < c; ++h) {
|
|
385
|
+
const l = e[h];
|
|
386
|
+
if (t != l) {
|
|
387
|
+
if (i < r[t + s - 1])
|
|
388
|
+
return null;
|
|
389
|
+
if (i <= r[l - 1])
|
|
390
|
+
return v(
|
|
391
|
+
r,
|
|
392
|
+
t,
|
|
393
|
+
l,
|
|
394
|
+
s,
|
|
395
|
+
i,
|
|
396
|
+
!1
|
|
397
|
+
);
|
|
398
|
+
t = l;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
class p extends R {
|
|
404
|
+
/**
|
|
405
|
+
* @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
|
|
406
|
+
* For internal use, flat coordinates in combination with `layout` are also accepted.
|
|
407
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
408
|
+
*/
|
|
409
|
+
constructor(t, e) {
|
|
410
|
+
super(), this.flatMidpoint_ = null, this.flatMidpointRevision_ = -1, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, e !== void 0 && !Array.isArray(t[0]) ? this.setFlatCoordinates(
|
|
411
|
+
e,
|
|
412
|
+
/** @type {Array<number>} */
|
|
413
|
+
t
|
|
414
|
+
) : this.setCoordinates(
|
|
415
|
+
/** @type {Array<import("../coordinate.js").Coordinate>} */
|
|
416
|
+
t,
|
|
417
|
+
e
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Append the passed coordinate to the coordinates of the linestring.
|
|
422
|
+
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
423
|
+
* @api
|
|
424
|
+
*/
|
|
425
|
+
appendCoordinate(t) {
|
|
426
|
+
this.flatCoordinates ? y(this.flatCoordinates, t) : this.flatCoordinates = t.slice(), this.changed();
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Make a complete copy of the geometry.
|
|
430
|
+
* @return {!LineString} Clone.
|
|
431
|
+
* @api
|
|
432
|
+
*/
|
|
433
|
+
clone() {
|
|
434
|
+
const t = new p(
|
|
435
|
+
this.flatCoordinates.slice(),
|
|
436
|
+
this.layout
|
|
437
|
+
);
|
|
438
|
+
return t.applyProperties(this), t;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* @param {number} x X.
|
|
442
|
+
* @param {number} y Y.
|
|
443
|
+
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
|
444
|
+
* @param {number} minSquaredDistance Minimum squared distance.
|
|
445
|
+
* @return {number} Minimum squared distance.
|
|
446
|
+
*/
|
|
447
|
+
closestPointXY(t, e, s, i) {
|
|
448
|
+
return i < T(this.getExtent(), t, e) ? i : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
|
|
449
|
+
it(
|
|
450
|
+
this.flatCoordinates,
|
|
451
|
+
0,
|
|
452
|
+
this.flatCoordinates.length,
|
|
453
|
+
this.stride,
|
|
454
|
+
0
|
|
455
|
+
)
|
|
456
|
+
), this.maxDeltaRevision_ = this.getRevision()), nt(
|
|
457
|
+
this.flatCoordinates,
|
|
458
|
+
0,
|
|
459
|
+
this.flatCoordinates.length,
|
|
460
|
+
this.stride,
|
|
461
|
+
this.maxDelta_,
|
|
462
|
+
!1,
|
|
463
|
+
t,
|
|
464
|
+
e,
|
|
465
|
+
s,
|
|
466
|
+
i
|
|
467
|
+
));
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Iterate over each segment, calling the provided callback.
|
|
471
|
+
* If the callback returns a truthy value the function returns that
|
|
472
|
+
* value immediately. Otherwise the function returns `false`.
|
|
473
|
+
*
|
|
474
|
+
* @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function
|
|
475
|
+
* called for each segment. The function will receive two arguments, the start and end coordinates of the segment.
|
|
476
|
+
* @return {T|boolean} Value.
|
|
477
|
+
* @template T,S
|
|
478
|
+
* @api
|
|
479
|
+
*/
|
|
480
|
+
forEachSegment(t) {
|
|
481
|
+
return rt(
|
|
482
|
+
this.flatCoordinates,
|
|
483
|
+
0,
|
|
484
|
+
this.flatCoordinates.length,
|
|
485
|
+
this.stride,
|
|
486
|
+
t
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Returns the coordinate at `m` using linear interpolation, or `null` if no
|
|
491
|
+
* such coordinate exists.
|
|
492
|
+
*
|
|
493
|
+
* `extrapolate` controls extrapolation beyond the range of Ms in the
|
|
494
|
+
* MultiLineString. If `extrapolate` is `true` then Ms less than the first
|
|
495
|
+
* M will return the first coordinate and Ms greater than the last M will
|
|
496
|
+
* return the last coordinate.
|
|
497
|
+
*
|
|
498
|
+
* @param {number} m M.
|
|
499
|
+
* @param {boolean} [extrapolate] Extrapolate. Default is `false`.
|
|
500
|
+
* @return {import("../coordinate.js").Coordinate|null} Coordinate.
|
|
501
|
+
* @api
|
|
502
|
+
*/
|
|
503
|
+
getCoordinateAtM(t, e) {
|
|
504
|
+
return this.layout != "XYM" && this.layout != "XYZM" ? null : (e = e !== void 0 ? e : !1, v(
|
|
505
|
+
this.flatCoordinates,
|
|
506
|
+
0,
|
|
507
|
+
this.flatCoordinates.length,
|
|
508
|
+
this.stride,
|
|
509
|
+
t,
|
|
510
|
+
e
|
|
511
|
+
));
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Return the coordinates of the linestring.
|
|
515
|
+
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
|
|
516
|
+
* @api
|
|
517
|
+
*/
|
|
518
|
+
getCoordinates() {
|
|
519
|
+
return H(
|
|
520
|
+
this.flatCoordinates,
|
|
521
|
+
0,
|
|
522
|
+
this.flatCoordinates.length,
|
|
523
|
+
this.stride
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Return the coordinate at the provided fraction along the linestring.
|
|
528
|
+
* The `fraction` is a number between 0 and 1, where 0 is the start of the
|
|
529
|
+
* linestring and 1 is the end.
|
|
530
|
+
* @param {number} fraction Fraction.
|
|
531
|
+
* @param {import("../coordinate.js").Coordinate} [dest] Optional coordinate whose values will
|
|
532
|
+
* be modified. If not provided, a new coordinate will be returned.
|
|
533
|
+
* @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point.
|
|
534
|
+
* @api
|
|
535
|
+
*/
|
|
536
|
+
getCoordinateAt(t, e) {
|
|
537
|
+
return D(
|
|
538
|
+
this.flatCoordinates,
|
|
539
|
+
0,
|
|
540
|
+
this.flatCoordinates.length,
|
|
541
|
+
this.stride,
|
|
542
|
+
t,
|
|
543
|
+
e,
|
|
544
|
+
this.stride
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Return the length of the linestring on projected plane.
|
|
549
|
+
* @return {number} Length (on projected plane).
|
|
550
|
+
* @api
|
|
551
|
+
*/
|
|
552
|
+
getLength() {
|
|
553
|
+
return Nt(
|
|
554
|
+
this.flatCoordinates,
|
|
555
|
+
0,
|
|
556
|
+
this.flatCoordinates.length,
|
|
557
|
+
this.stride
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* @return {Array<number>} Flat midpoint.
|
|
562
|
+
*/
|
|
563
|
+
getFlatMidpoint() {
|
|
564
|
+
return this.flatMidpointRevision_ != this.getRevision() && (this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_), this.flatMidpointRevision_ = this.getRevision()), this.flatMidpoint_;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* @param {number} squaredTolerance Squared tolerance.
|
|
568
|
+
* @return {LineString} Simplified LineString.
|
|
569
|
+
* @protected
|
|
570
|
+
*/
|
|
571
|
+
getSimplifiedGeometryInternal(t) {
|
|
572
|
+
const e = [];
|
|
573
|
+
return e.length = ot(
|
|
574
|
+
this.flatCoordinates,
|
|
575
|
+
0,
|
|
576
|
+
this.flatCoordinates.length,
|
|
577
|
+
this.stride,
|
|
578
|
+
t,
|
|
579
|
+
e,
|
|
580
|
+
0
|
|
581
|
+
), new p(e, "XY");
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Get the type of this geometry.
|
|
585
|
+
* @return {import("./Geometry.js").Type} Geometry type.
|
|
586
|
+
* @api
|
|
587
|
+
*/
|
|
588
|
+
getType() {
|
|
589
|
+
return "LineString";
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Test if the geometry and the passed extent intersect.
|
|
593
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
594
|
+
* @return {boolean} `true` if the geometry and the extent intersect.
|
|
595
|
+
* @api
|
|
596
|
+
*/
|
|
597
|
+
intersectsExtent(t) {
|
|
598
|
+
return at(
|
|
599
|
+
this.flatCoordinates,
|
|
600
|
+
0,
|
|
601
|
+
this.flatCoordinates.length,
|
|
602
|
+
this.stride,
|
|
603
|
+
t
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Set the coordinates of the linestring.
|
|
608
|
+
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
|
609
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
610
|
+
* @api
|
|
611
|
+
*/
|
|
612
|
+
setCoordinates(t, e) {
|
|
613
|
+
this.setLayout(e, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = K(
|
|
614
|
+
this.flatCoordinates,
|
|
615
|
+
0,
|
|
616
|
+
t,
|
|
617
|
+
this.stride
|
|
618
|
+
), this.changed();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
class F extends R {
|
|
622
|
+
/**
|
|
623
|
+
* @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
|
|
624
|
+
* Coordinates or LineString geometries. (For internal use, flat coordinates in
|
|
625
|
+
* combination with `layout` and `ends` are also accepted.)
|
|
626
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
627
|
+
* @param {Array<number>} [ends] Flat coordinate ends for internal use.
|
|
628
|
+
*/
|
|
629
|
+
constructor(t, e, s) {
|
|
630
|
+
if (super(), this.ends_ = [], this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, Array.isArray(t[0]))
|
|
631
|
+
this.setCoordinates(
|
|
632
|
+
/** @type {Array<Array<import("../coordinate.js").Coordinate>>} */
|
|
633
|
+
t,
|
|
634
|
+
e
|
|
635
|
+
);
|
|
636
|
+
else if (e !== void 0 && s)
|
|
637
|
+
this.setFlatCoordinates(
|
|
638
|
+
e,
|
|
639
|
+
/** @type {Array<number>} */
|
|
640
|
+
t
|
|
641
|
+
), this.ends_ = s;
|
|
642
|
+
else {
|
|
643
|
+
let i = this.getLayout();
|
|
644
|
+
const n = (
|
|
645
|
+
/** @type {Array<LineString>} */
|
|
646
|
+
t
|
|
647
|
+
), o = [], a = [];
|
|
648
|
+
for (let h = 0, c = n.length; h < c; ++h) {
|
|
649
|
+
const l = n[h];
|
|
650
|
+
h === 0 && (i = l.getLayout()), y(o, l.getFlatCoordinates()), a.push(o.length);
|
|
651
|
+
}
|
|
652
|
+
this.setFlatCoordinates(i, o), this.ends_ = a;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Append the passed linestring to the multilinestring.
|
|
657
|
+
* @param {LineString} lineString LineString.
|
|
658
|
+
* @api
|
|
659
|
+
*/
|
|
660
|
+
appendLineString(t) {
|
|
661
|
+
this.flatCoordinates ? y(this.flatCoordinates, t.getFlatCoordinates().slice()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.ends_.push(this.flatCoordinates.length), this.changed();
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Make a complete copy of the geometry.
|
|
665
|
+
* @return {!MultiLineString} Clone.
|
|
666
|
+
* @api
|
|
667
|
+
*/
|
|
668
|
+
clone() {
|
|
669
|
+
const t = new F(
|
|
670
|
+
this.flatCoordinates.slice(),
|
|
671
|
+
this.layout,
|
|
672
|
+
this.ends_.slice()
|
|
673
|
+
);
|
|
674
|
+
return t.applyProperties(this), t;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* @param {number} x X.
|
|
678
|
+
* @param {number} y Y.
|
|
679
|
+
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
|
680
|
+
* @param {number} minSquaredDistance Minimum squared distance.
|
|
681
|
+
* @return {number} Minimum squared distance.
|
|
682
|
+
*/
|
|
683
|
+
closestPointXY(t, e, s, i) {
|
|
684
|
+
return i < T(this.getExtent(), t, e) ? i : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
|
|
685
|
+
ht(
|
|
686
|
+
this.flatCoordinates,
|
|
687
|
+
0,
|
|
688
|
+
this.ends_,
|
|
689
|
+
this.stride,
|
|
690
|
+
0
|
|
691
|
+
)
|
|
692
|
+
), this.maxDeltaRevision_ = this.getRevision()), lt(
|
|
693
|
+
this.flatCoordinates,
|
|
694
|
+
0,
|
|
695
|
+
this.ends_,
|
|
696
|
+
this.stride,
|
|
697
|
+
this.maxDelta_,
|
|
698
|
+
!1,
|
|
699
|
+
t,
|
|
700
|
+
e,
|
|
701
|
+
s,
|
|
702
|
+
i
|
|
703
|
+
));
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Returns the coordinate at `m` using linear interpolation, or `null` if no
|
|
707
|
+
* such coordinate exists.
|
|
708
|
+
*
|
|
709
|
+
* `extrapolate` controls extrapolation beyond the range of Ms in the
|
|
710
|
+
* MultiLineString. If `extrapolate` is `true` then Ms less than the first
|
|
711
|
+
* M will return the first coordinate and Ms greater than the last M will
|
|
712
|
+
* return the last coordinate.
|
|
713
|
+
*
|
|
714
|
+
* `interpolate` controls interpolation between consecutive LineStrings
|
|
715
|
+
* within the MultiLineString. If `interpolate` is `true` the coordinates
|
|
716
|
+
* will be linearly interpolated between the last coordinate of one LineString
|
|
717
|
+
* and the first coordinate of the next LineString. If `interpolate` is
|
|
718
|
+
* `false` then the function will return `null` for Ms falling between
|
|
719
|
+
* LineStrings.
|
|
720
|
+
*
|
|
721
|
+
* @param {number} m M.
|
|
722
|
+
* @param {boolean} [extrapolate] Extrapolate. Default is `false`.
|
|
723
|
+
* @param {boolean} [interpolate] Interpolate. Default is `false`.
|
|
724
|
+
* @return {import("../coordinate.js").Coordinate|null} Coordinate.
|
|
725
|
+
* @api
|
|
726
|
+
*/
|
|
727
|
+
getCoordinateAtM(t, e, s) {
|
|
728
|
+
return this.layout != "XYM" && this.layout != "XYZM" || this.flatCoordinates.length === 0 ? null : (e = e !== void 0 ? e : !1, s = s !== void 0 ? s : !1, vt(
|
|
729
|
+
this.flatCoordinates,
|
|
730
|
+
0,
|
|
731
|
+
this.ends_,
|
|
732
|
+
this.stride,
|
|
733
|
+
t,
|
|
734
|
+
e,
|
|
735
|
+
s
|
|
736
|
+
));
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Return the coordinates of the multilinestring.
|
|
740
|
+
* @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
|
|
741
|
+
* @api
|
|
742
|
+
*/
|
|
743
|
+
getCoordinates() {
|
|
744
|
+
return ut(
|
|
745
|
+
this.flatCoordinates,
|
|
746
|
+
0,
|
|
747
|
+
this.ends_,
|
|
748
|
+
this.stride
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* @return {Array<number>} Ends.
|
|
753
|
+
*/
|
|
754
|
+
getEnds() {
|
|
755
|
+
return this.ends_;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Return the linestring at the specified index.
|
|
759
|
+
* @param {number} index Index.
|
|
760
|
+
* @return {LineString} LineString.
|
|
761
|
+
* @api
|
|
762
|
+
*/
|
|
763
|
+
getLineString(t) {
|
|
764
|
+
return t < 0 || this.ends_.length <= t ? null : new p(
|
|
765
|
+
this.flatCoordinates.slice(
|
|
766
|
+
t === 0 ? 0 : this.ends_[t - 1],
|
|
767
|
+
this.ends_[t]
|
|
768
|
+
),
|
|
769
|
+
this.layout
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Return the linestrings of this multilinestring.
|
|
774
|
+
* @return {Array<LineString>} LineStrings.
|
|
775
|
+
* @api
|
|
776
|
+
*/
|
|
777
|
+
getLineStrings() {
|
|
778
|
+
const t = this.flatCoordinates, e = this.ends_, s = this.layout, i = [];
|
|
779
|
+
let n = 0;
|
|
780
|
+
for (let o = 0, a = e.length; o < a; ++o) {
|
|
781
|
+
const h = e[o], c = new p(
|
|
782
|
+
t.slice(n, h),
|
|
783
|
+
s
|
|
784
|
+
);
|
|
785
|
+
i.push(c), n = h;
|
|
786
|
+
}
|
|
787
|
+
return i;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* @return {Array<number>} Flat midpoints.
|
|
791
|
+
*/
|
|
792
|
+
getFlatMidpoints() {
|
|
793
|
+
const t = [], e = this.flatCoordinates;
|
|
794
|
+
let s = 0;
|
|
795
|
+
const i = this.ends_, n = this.stride;
|
|
796
|
+
for (let o = 0, a = i.length; o < a; ++o) {
|
|
797
|
+
const h = i[o], c = D(
|
|
798
|
+
e,
|
|
799
|
+
s,
|
|
800
|
+
h,
|
|
801
|
+
n,
|
|
802
|
+
0.5
|
|
803
|
+
);
|
|
804
|
+
y(t, c), s = h;
|
|
805
|
+
}
|
|
806
|
+
return t;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* @param {number} squaredTolerance Squared tolerance.
|
|
810
|
+
* @return {MultiLineString} Simplified MultiLineString.
|
|
811
|
+
* @protected
|
|
812
|
+
*/
|
|
813
|
+
getSimplifiedGeometryInternal(t) {
|
|
814
|
+
const e = [], s = [];
|
|
815
|
+
return e.length = ct(
|
|
816
|
+
this.flatCoordinates,
|
|
817
|
+
0,
|
|
818
|
+
this.ends_,
|
|
819
|
+
this.stride,
|
|
820
|
+
t,
|
|
821
|
+
e,
|
|
822
|
+
0,
|
|
823
|
+
s
|
|
824
|
+
), new F(e, "XY", s);
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Get the type of this geometry.
|
|
828
|
+
* @return {import("./Geometry.js").Type} Geometry type.
|
|
829
|
+
* @api
|
|
830
|
+
*/
|
|
831
|
+
getType() {
|
|
832
|
+
return "MultiLineString";
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Test if the geometry and the passed extent intersect.
|
|
836
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
837
|
+
* @return {boolean} `true` if the geometry and the extent intersect.
|
|
838
|
+
* @api
|
|
839
|
+
*/
|
|
840
|
+
intersectsExtent(t) {
|
|
841
|
+
return dt(
|
|
842
|
+
this.flatCoordinates,
|
|
843
|
+
0,
|
|
844
|
+
this.ends_,
|
|
845
|
+
this.stride,
|
|
846
|
+
t
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Set the coordinates of the multilinestring.
|
|
851
|
+
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
|
|
852
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
853
|
+
* @api
|
|
854
|
+
*/
|
|
855
|
+
setCoordinates(t, e) {
|
|
856
|
+
this.setLayout(e, t, 2), this.flatCoordinates || (this.flatCoordinates = []);
|
|
857
|
+
const s = gt(
|
|
858
|
+
this.flatCoordinates,
|
|
859
|
+
0,
|
|
860
|
+
t,
|
|
861
|
+
this.stride,
|
|
862
|
+
this.ends_
|
|
863
|
+
);
|
|
864
|
+
this.flatCoordinates.length = s.length === 0 ? 0 : s[s.length - 1], this.changed();
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
class w extends R {
|
|
868
|
+
/**
|
|
869
|
+
* @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
|
|
870
|
+
* For internal use, flat coordinates in combination with `layout` are also accepted.
|
|
871
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
872
|
+
*/
|
|
873
|
+
constructor(t, e) {
|
|
874
|
+
super(), e && !Array.isArray(t[0]) ? this.setFlatCoordinates(
|
|
875
|
+
e,
|
|
876
|
+
/** @type {Array<number>} */
|
|
877
|
+
t
|
|
878
|
+
) : this.setCoordinates(
|
|
879
|
+
/** @type {Array<import("../coordinate.js").Coordinate>} */
|
|
880
|
+
t,
|
|
881
|
+
e
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Append the passed point to this multipoint.
|
|
886
|
+
* @param {Point} point Point.
|
|
887
|
+
* @api
|
|
888
|
+
*/
|
|
889
|
+
appendPoint(t) {
|
|
890
|
+
this.flatCoordinates ? y(this.flatCoordinates, t.getFlatCoordinates()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.changed();
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Make a complete copy of the geometry.
|
|
894
|
+
* @return {!MultiPoint} Clone.
|
|
895
|
+
* @api
|
|
896
|
+
*/
|
|
897
|
+
clone() {
|
|
898
|
+
const t = new w(
|
|
899
|
+
this.flatCoordinates.slice(),
|
|
900
|
+
this.layout
|
|
901
|
+
);
|
|
902
|
+
return t.applyProperties(this), t;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* @param {number} x X.
|
|
906
|
+
* @param {number} y Y.
|
|
907
|
+
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
|
908
|
+
* @param {number} minSquaredDistance Minimum squared distance.
|
|
909
|
+
* @return {number} Minimum squared distance.
|
|
910
|
+
*/
|
|
911
|
+
closestPointXY(t, e, s, i) {
|
|
912
|
+
if (i < T(this.getExtent(), t, e))
|
|
913
|
+
return i;
|
|
914
|
+
const n = this.flatCoordinates, o = this.stride;
|
|
915
|
+
for (let a = 0, h = n.length; a < h; a += o) {
|
|
916
|
+
const c = et(
|
|
917
|
+
t,
|
|
918
|
+
e,
|
|
919
|
+
n[a],
|
|
920
|
+
n[a + 1]
|
|
921
|
+
);
|
|
922
|
+
if (c < i) {
|
|
923
|
+
i = c;
|
|
924
|
+
for (let l = 0; l < o; ++l)
|
|
925
|
+
s[l] = n[a + l];
|
|
926
|
+
s.length = o;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return i;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Return the coordinates of the multipoint.
|
|
933
|
+
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
|
|
934
|
+
* @api
|
|
935
|
+
*/
|
|
936
|
+
getCoordinates() {
|
|
937
|
+
return H(
|
|
938
|
+
this.flatCoordinates,
|
|
939
|
+
0,
|
|
940
|
+
this.flatCoordinates.length,
|
|
941
|
+
this.stride
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Return the point at the specified index.
|
|
946
|
+
* @param {number} index Index.
|
|
947
|
+
* @return {Point} Point.
|
|
948
|
+
* @api
|
|
949
|
+
*/
|
|
950
|
+
getPoint(t) {
|
|
951
|
+
const e = this.flatCoordinates ? this.flatCoordinates.length / this.stride : 0;
|
|
952
|
+
return t < 0 || e <= t ? null : new I(
|
|
953
|
+
this.flatCoordinates.slice(
|
|
954
|
+
t * this.stride,
|
|
955
|
+
(t + 1) * this.stride
|
|
956
|
+
),
|
|
957
|
+
this.layout
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Return the points of this multipoint.
|
|
962
|
+
* @return {Array<Point>} Points.
|
|
963
|
+
* @api
|
|
964
|
+
*/
|
|
965
|
+
getPoints() {
|
|
966
|
+
const t = this.flatCoordinates, e = this.layout, s = this.stride, i = [];
|
|
967
|
+
for (let n = 0, o = t.length; n < o; n += s) {
|
|
968
|
+
const a = new I(t.slice(n, n + s), e);
|
|
969
|
+
i.push(a);
|
|
970
|
+
}
|
|
971
|
+
return i;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Get the type of this geometry.
|
|
975
|
+
* @return {import("./Geometry.js").Type} Geometry type.
|
|
976
|
+
* @api
|
|
977
|
+
*/
|
|
978
|
+
getType() {
|
|
979
|
+
return "MultiPoint";
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Test if the geometry and the passed extent intersect.
|
|
983
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
984
|
+
* @return {boolean} `true` if the geometry and the extent intersect.
|
|
985
|
+
* @api
|
|
986
|
+
*/
|
|
987
|
+
intersectsExtent(t) {
|
|
988
|
+
const e = this.flatCoordinates, s = this.stride;
|
|
989
|
+
for (let i = 0, n = e.length; i < n; i += s) {
|
|
990
|
+
const o = e[i], a = e[i + 1];
|
|
991
|
+
if (ft(t, o, a))
|
|
992
|
+
return !0;
|
|
993
|
+
}
|
|
994
|
+
return !1;
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Set the coordinates of the multipoint.
|
|
998
|
+
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
|
999
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
1000
|
+
* @api
|
|
1001
|
+
*/
|
|
1002
|
+
setCoordinates(t, e) {
|
|
1003
|
+
this.setLayout(e, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = K(
|
|
1004
|
+
this.flatCoordinates,
|
|
1005
|
+
0,
|
|
1006
|
+
t,
|
|
1007
|
+
this.stride
|
|
1008
|
+
), this.changed();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function St(r, t, e, s) {
|
|
1012
|
+
const i = [];
|
|
1013
|
+
let n = yt();
|
|
1014
|
+
for (let o = 0, a = e.length; o < a; ++o) {
|
|
1015
|
+
const h = e[o];
|
|
1016
|
+
n = mt(
|
|
1017
|
+
r,
|
|
1018
|
+
t,
|
|
1019
|
+
h[0],
|
|
1020
|
+
s
|
|
1021
|
+
), i.push((n[0] + n[2]) / 2, (n[1] + n[3]) / 2), t = h[h.length - 1];
|
|
1022
|
+
}
|
|
1023
|
+
return i;
|
|
1024
|
+
}
|
|
1025
|
+
class L extends R {
|
|
1026
|
+
/**
|
|
1027
|
+
* @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
|
|
1028
|
+
* For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.
|
|
1029
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
1030
|
+
* @param {Array<Array<number>>} [endss] Array of ends for internal use with flat coordinates.
|
|
1031
|
+
*/
|
|
1032
|
+
constructor(t, e, s) {
|
|
1033
|
+
if (super(), this.endss_ = [], this.flatInteriorPointsRevision_ = -1, this.flatInteriorPoints_ = null, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, this.orientedRevision_ = -1, this.orientedFlatCoordinates_ = null, !s && !Array.isArray(t[0])) {
|
|
1034
|
+
let i = this.getLayout();
|
|
1035
|
+
const n = (
|
|
1036
|
+
/** @type {Array<Polygon>} */
|
|
1037
|
+
t
|
|
1038
|
+
), o = [], a = [];
|
|
1039
|
+
for (let h = 0, c = n.length; h < c; ++h) {
|
|
1040
|
+
const l = n[h];
|
|
1041
|
+
h === 0 && (i = l.getLayout());
|
|
1042
|
+
const f = o.length, d = l.getEnds();
|
|
1043
|
+
for (let m = 0, P = d.length; m < P; ++m)
|
|
1044
|
+
d[m] += f;
|
|
1045
|
+
y(o, l.getFlatCoordinates()), a.push(d);
|
|
1046
|
+
}
|
|
1047
|
+
e = i, t = o, s = a;
|
|
1048
|
+
}
|
|
1049
|
+
e !== void 0 && s ? (this.setFlatCoordinates(
|
|
1050
|
+
e,
|
|
1051
|
+
/** @type {Array<number>} */
|
|
1052
|
+
t
|
|
1053
|
+
), this.endss_ = s) : this.setCoordinates(
|
|
1054
|
+
/** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */
|
|
1055
|
+
t,
|
|
1056
|
+
e
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Append the passed polygon to this multipolygon.
|
|
1061
|
+
* @param {Polygon} polygon Polygon.
|
|
1062
|
+
* @api
|
|
1063
|
+
*/
|
|
1064
|
+
appendPolygon(t) {
|
|
1065
|
+
let e;
|
|
1066
|
+
if (!this.flatCoordinates)
|
|
1067
|
+
this.flatCoordinates = t.getFlatCoordinates().slice(), e = t.getEnds().slice(), this.endss_.push();
|
|
1068
|
+
else {
|
|
1069
|
+
const s = this.flatCoordinates.length;
|
|
1070
|
+
y(this.flatCoordinates, t.getFlatCoordinates()), e = t.getEnds().slice();
|
|
1071
|
+
for (let i = 0, n = e.length; i < n; ++i)
|
|
1072
|
+
e[i] += s;
|
|
1073
|
+
}
|
|
1074
|
+
this.endss_.push(e), this.changed();
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Make a complete copy of the geometry.
|
|
1078
|
+
* @return {!MultiPolygon} Clone.
|
|
1079
|
+
* @api
|
|
1080
|
+
*/
|
|
1081
|
+
clone() {
|
|
1082
|
+
const t = this.endss_.length, e = new Array(t);
|
|
1083
|
+
for (let i = 0; i < t; ++i)
|
|
1084
|
+
e[i] = this.endss_[i].slice();
|
|
1085
|
+
const s = new L(
|
|
1086
|
+
this.flatCoordinates.slice(),
|
|
1087
|
+
this.layout,
|
|
1088
|
+
e
|
|
1089
|
+
);
|
|
1090
|
+
return s.applyProperties(this), s;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* @param {number} x X.
|
|
1094
|
+
* @param {number} y Y.
|
|
1095
|
+
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
|
1096
|
+
* @param {number} minSquaredDistance Minimum squared distance.
|
|
1097
|
+
* @return {number} Minimum squared distance.
|
|
1098
|
+
*/
|
|
1099
|
+
closestPointXY(t, e, s, i) {
|
|
1100
|
+
return i < T(this.getExtent(), t, e) ? i : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
|
|
1101
|
+
_t(
|
|
1102
|
+
this.flatCoordinates,
|
|
1103
|
+
0,
|
|
1104
|
+
this.endss_,
|
|
1105
|
+
this.stride,
|
|
1106
|
+
0
|
|
1107
|
+
)
|
|
1108
|
+
), this.maxDeltaRevision_ = this.getRevision()), pt(
|
|
1109
|
+
this.getOrientedFlatCoordinates(),
|
|
1110
|
+
0,
|
|
1111
|
+
this.endss_,
|
|
1112
|
+
this.stride,
|
|
1113
|
+
this.maxDelta_,
|
|
1114
|
+
!0,
|
|
1115
|
+
t,
|
|
1116
|
+
e,
|
|
1117
|
+
s,
|
|
1118
|
+
i
|
|
1119
|
+
));
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* @param {number} x X.
|
|
1123
|
+
* @param {number} y Y.
|
|
1124
|
+
* @return {boolean} Contains (x, y).
|
|
1125
|
+
*/
|
|
1126
|
+
containsXY(t, e) {
|
|
1127
|
+
return Ct(
|
|
1128
|
+
this.getOrientedFlatCoordinates(),
|
|
1129
|
+
0,
|
|
1130
|
+
this.endss_,
|
|
1131
|
+
this.stride,
|
|
1132
|
+
t,
|
|
1133
|
+
e
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Return the area of the multipolygon on projected plane.
|
|
1138
|
+
* @return {number} Area (on projected plane).
|
|
1139
|
+
* @api
|
|
1140
|
+
*/
|
|
1141
|
+
getArea() {
|
|
1142
|
+
return Tt(
|
|
1143
|
+
this.getOrientedFlatCoordinates(),
|
|
1144
|
+
0,
|
|
1145
|
+
this.endss_,
|
|
1146
|
+
this.stride
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Get the coordinate array for this geometry. This array has the structure
|
|
1151
|
+
* of a GeoJSON coordinate array for multi-polygons.
|
|
1152
|
+
*
|
|
1153
|
+
* @param {boolean} [right] Orient coordinates according to the right-hand
|
|
1154
|
+
* rule (counter-clockwise for exterior and clockwise for interior rings).
|
|
1155
|
+
* If `false`, coordinates will be oriented according to the left-hand rule
|
|
1156
|
+
* (clockwise for exterior and counter-clockwise for interior rings).
|
|
1157
|
+
* By default, coordinate orientation will depend on how the geometry was
|
|
1158
|
+
* constructed.
|
|
1159
|
+
* @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
|
|
1160
|
+
* @api
|
|
1161
|
+
*/
|
|
1162
|
+
getCoordinates(t) {
|
|
1163
|
+
let e;
|
|
1164
|
+
return t !== void 0 ? (e = this.getOrientedFlatCoordinates().slice(), Y(
|
|
1165
|
+
e,
|
|
1166
|
+
0,
|
|
1167
|
+
this.endss_,
|
|
1168
|
+
this.stride,
|
|
1169
|
+
t
|
|
1170
|
+
)) : e = this.flatCoordinates, Pt(
|
|
1171
|
+
e,
|
|
1172
|
+
0,
|
|
1173
|
+
this.endss_,
|
|
1174
|
+
this.stride
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* @return {Array<Array<number>>} Endss.
|
|
1179
|
+
*/
|
|
1180
|
+
getEndss() {
|
|
1181
|
+
return this.endss_;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @return {Array<number>} Flat interior points.
|
|
1185
|
+
*/
|
|
1186
|
+
getFlatInteriorPoints() {
|
|
1187
|
+
if (this.flatInteriorPointsRevision_ != this.getRevision()) {
|
|
1188
|
+
const t = St(
|
|
1189
|
+
this.flatCoordinates,
|
|
1190
|
+
0,
|
|
1191
|
+
this.endss_,
|
|
1192
|
+
this.stride
|
|
1193
|
+
);
|
|
1194
|
+
this.flatInteriorPoints_ = Et(
|
|
1195
|
+
this.getOrientedFlatCoordinates(),
|
|
1196
|
+
0,
|
|
1197
|
+
this.endss_,
|
|
1198
|
+
this.stride,
|
|
1199
|
+
t
|
|
1200
|
+
), this.flatInteriorPointsRevision_ = this.getRevision();
|
|
1201
|
+
}
|
|
1202
|
+
return this.flatInteriorPoints_;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.
|
|
1206
|
+
* @return {MultiPoint} Interior points as XYM coordinates, where M is
|
|
1207
|
+
* the length of the horizontal intersection that the point belongs to.
|
|
1208
|
+
* @api
|
|
1209
|
+
*/
|
|
1210
|
+
getInteriorPoints() {
|
|
1211
|
+
return new w(this.getFlatInteriorPoints().slice(), "XYM");
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* @return {Array<number>} Oriented flat coordinates.
|
|
1215
|
+
*/
|
|
1216
|
+
getOrientedFlatCoordinates() {
|
|
1217
|
+
if (this.orientedRevision_ != this.getRevision()) {
|
|
1218
|
+
const t = this.flatCoordinates;
|
|
1219
|
+
Gt(t, 0, this.endss_, this.stride) ? this.orientedFlatCoordinates_ = t : (this.orientedFlatCoordinates_ = t.slice(), this.orientedFlatCoordinates_.length = Y(
|
|
1220
|
+
this.orientedFlatCoordinates_,
|
|
1221
|
+
0,
|
|
1222
|
+
this.endss_,
|
|
1223
|
+
this.stride
|
|
1224
|
+
)), this.orientedRevision_ = this.getRevision();
|
|
1225
|
+
}
|
|
1226
|
+
return this.orientedFlatCoordinates_;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* @param {number} squaredTolerance Squared tolerance.
|
|
1230
|
+
* @return {MultiPolygon} Simplified MultiPolygon.
|
|
1231
|
+
* @protected
|
|
1232
|
+
*/
|
|
1233
|
+
getSimplifiedGeometryInternal(t) {
|
|
1234
|
+
const e = [], s = [];
|
|
1235
|
+
return e.length = xt(
|
|
1236
|
+
this.flatCoordinates,
|
|
1237
|
+
0,
|
|
1238
|
+
this.endss_,
|
|
1239
|
+
this.stride,
|
|
1240
|
+
Math.sqrt(t),
|
|
1241
|
+
e,
|
|
1242
|
+
0,
|
|
1243
|
+
s
|
|
1244
|
+
), new L(e, "XY", s);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Return the polygon at the specified index.
|
|
1248
|
+
* @param {number} index Index.
|
|
1249
|
+
* @return {Polygon} Polygon.
|
|
1250
|
+
* @api
|
|
1251
|
+
*/
|
|
1252
|
+
getPolygon(t) {
|
|
1253
|
+
if (t < 0 || this.endss_.length <= t)
|
|
1254
|
+
return null;
|
|
1255
|
+
let e;
|
|
1256
|
+
if (t === 0)
|
|
1257
|
+
e = 0;
|
|
1258
|
+
else {
|
|
1259
|
+
const n = this.endss_[t - 1];
|
|
1260
|
+
e = n[n.length - 1];
|
|
1261
|
+
}
|
|
1262
|
+
const s = this.endss_[t].slice(), i = s[s.length - 1];
|
|
1263
|
+
if (e !== 0)
|
|
1264
|
+
for (let n = 0, o = s.length; n < o; ++n)
|
|
1265
|
+
s[n] -= e;
|
|
1266
|
+
return new O(
|
|
1267
|
+
this.flatCoordinates.slice(e, i),
|
|
1268
|
+
this.layout,
|
|
1269
|
+
s
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Return the polygons of this multipolygon.
|
|
1274
|
+
* @return {Array<Polygon>} Polygons.
|
|
1275
|
+
* @api
|
|
1276
|
+
*/
|
|
1277
|
+
getPolygons() {
|
|
1278
|
+
const t = this.layout, e = this.flatCoordinates, s = this.endss_, i = [];
|
|
1279
|
+
let n = 0;
|
|
1280
|
+
for (let o = 0, a = s.length; o < a; ++o) {
|
|
1281
|
+
const h = s[o].slice(), c = h[h.length - 1];
|
|
1282
|
+
if (n !== 0)
|
|
1283
|
+
for (let f = 0, d = h.length; f < d; ++f)
|
|
1284
|
+
h[f] -= n;
|
|
1285
|
+
const l = new O(
|
|
1286
|
+
e.slice(n, c),
|
|
1287
|
+
t,
|
|
1288
|
+
h
|
|
1289
|
+
);
|
|
1290
|
+
i.push(l), n = c;
|
|
1291
|
+
}
|
|
1292
|
+
return i;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Get the type of this geometry.
|
|
1296
|
+
* @return {import("./Geometry.js").Type} Geometry type.
|
|
1297
|
+
* @api
|
|
1298
|
+
*/
|
|
1299
|
+
getType() {
|
|
1300
|
+
return "MultiPolygon";
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Test if the geometry and the passed extent intersect.
|
|
1304
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
1305
|
+
* @return {boolean} `true` if the geometry and the extent intersect.
|
|
1306
|
+
* @api
|
|
1307
|
+
*/
|
|
1308
|
+
intersectsExtent(t) {
|
|
1309
|
+
return Mt(
|
|
1310
|
+
this.getOrientedFlatCoordinates(),
|
|
1311
|
+
0,
|
|
1312
|
+
this.endss_,
|
|
1313
|
+
this.stride,
|
|
1314
|
+
t
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Set the coordinates of the multipolygon.
|
|
1319
|
+
* @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
|
|
1320
|
+
* @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
|
|
1321
|
+
* @api
|
|
1322
|
+
*/
|
|
1323
|
+
setCoordinates(t, e) {
|
|
1324
|
+
this.setLayout(e, t, 3), this.flatCoordinates || (this.flatCoordinates = []);
|
|
1325
|
+
const s = Ft(
|
|
1326
|
+
this.flatCoordinates,
|
|
1327
|
+
0,
|
|
1328
|
+
t,
|
|
1329
|
+
this.stride,
|
|
1330
|
+
this.endss_
|
|
1331
|
+
);
|
|
1332
|
+
if (s.length === 0)
|
|
1333
|
+
this.flatCoordinates.length = 0;
|
|
1334
|
+
else {
|
|
1335
|
+
const i = s[s.length - 1];
|
|
1336
|
+
this.flatCoordinates.length = i.length === 0 ? 0 : i[i.length - 1];
|
|
1337
|
+
}
|
|
1338
|
+
this.changed();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
class C extends Lt {
|
|
1342
|
+
/**
|
|
1343
|
+
* @param {Array<Geometry>} [geometries] Geometries.
|
|
1344
|
+
*/
|
|
1345
|
+
constructor(t) {
|
|
1346
|
+
super(), this.geometries_ = t || null, this.changeEventsKeys_ = [], this.listenGeometriesChange_();
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* @private
|
|
1350
|
+
*/
|
|
1351
|
+
unlistenGeometriesChange_() {
|
|
1352
|
+
this.changeEventsKeys_.forEach(X), this.changeEventsKeys_.length = 0;
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* @private
|
|
1356
|
+
*/
|
|
1357
|
+
listenGeometriesChange_() {
|
|
1358
|
+
if (this.geometries_)
|
|
1359
|
+
for (let t = 0, e = this.geometries_.length; t < e; ++t)
|
|
1360
|
+
this.changeEventsKeys_.push(
|
|
1361
|
+
U(this.geometries_[t], Z.CHANGE, this.changed, this)
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Make a complete copy of the geometry.
|
|
1366
|
+
* @return {!GeometryCollection} Clone.
|
|
1367
|
+
* @api
|
|
1368
|
+
*/
|
|
1369
|
+
clone() {
|
|
1370
|
+
const t = new C(null);
|
|
1371
|
+
return t.setGeometries(this.geometries_), t.applyProperties(this), t;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* @param {number} x X.
|
|
1375
|
+
* @param {number} y Y.
|
|
1376
|
+
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
|
1377
|
+
* @param {number} minSquaredDistance Minimum squared distance.
|
|
1378
|
+
* @return {number} Minimum squared distance.
|
|
1379
|
+
*/
|
|
1380
|
+
closestPointXY(t, e, s, i) {
|
|
1381
|
+
if (i < T(this.getExtent(), t, e))
|
|
1382
|
+
return i;
|
|
1383
|
+
const n = this.geometries_;
|
|
1384
|
+
for (let o = 0, a = n.length; o < a; ++o)
|
|
1385
|
+
i = n[o].closestPointXY(
|
|
1386
|
+
t,
|
|
1387
|
+
e,
|
|
1388
|
+
s,
|
|
1389
|
+
i
|
|
1390
|
+
);
|
|
1391
|
+
return i;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* @param {number} x X.
|
|
1395
|
+
* @param {number} y Y.
|
|
1396
|
+
* @return {boolean} Contains (x, y).
|
|
1397
|
+
*/
|
|
1398
|
+
containsXY(t, e) {
|
|
1399
|
+
const s = this.geometries_;
|
|
1400
|
+
for (let i = 0, n = s.length; i < n; ++i)
|
|
1401
|
+
if (s[i].containsXY(t, e))
|
|
1402
|
+
return !0;
|
|
1403
|
+
return !1;
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
1407
|
+
* @protected
|
|
1408
|
+
* @return {import("../extent.js").Extent} extent Extent.
|
|
1409
|
+
*/
|
|
1410
|
+
computeExtent(t) {
|
|
1411
|
+
Rt(t);
|
|
1412
|
+
const e = this.geometries_;
|
|
1413
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
1414
|
+
wt(t, e[s].getExtent());
|
|
1415
|
+
return t;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Return the geometries that make up this geometry collection.
|
|
1419
|
+
* @return {Array<Geometry>} Geometries.
|
|
1420
|
+
* @api
|
|
1421
|
+
*/
|
|
1422
|
+
getGeometries() {
|
|
1423
|
+
return j(this.geometries_);
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* @return {Array<Geometry>} Geometries.
|
|
1427
|
+
*/
|
|
1428
|
+
getGeometriesArray() {
|
|
1429
|
+
return this.geometries_;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* @return {Array<Geometry>} Geometries.
|
|
1433
|
+
*/
|
|
1434
|
+
getGeometriesArrayRecursive() {
|
|
1435
|
+
let t = [];
|
|
1436
|
+
const e = this.geometries_;
|
|
1437
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
1438
|
+
e[s].getType() === this.getType() ? t = t.concat(
|
|
1439
|
+
/** @type {GeometryCollection} */
|
|
1440
|
+
e[s].getGeometriesArrayRecursive()
|
|
1441
|
+
) : t.push(e[s]);
|
|
1442
|
+
return t;
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Create a simplified version of this geometry using the Douglas Peucker algorithm.
|
|
1446
|
+
* @param {number} squaredTolerance Squared tolerance.
|
|
1447
|
+
* @return {GeometryCollection} Simplified GeometryCollection.
|
|
1448
|
+
*/
|
|
1449
|
+
getSimplifiedGeometry(t) {
|
|
1450
|
+
if (this.simplifiedGeometryRevision !== this.getRevision() && (this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = this.getRevision()), t < 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && t < this.simplifiedGeometryMaxMinSquaredTolerance)
|
|
1451
|
+
return this;
|
|
1452
|
+
const e = [], s = this.geometries_;
|
|
1453
|
+
let i = !1;
|
|
1454
|
+
for (let n = 0, o = s.length; n < o; ++n) {
|
|
1455
|
+
const a = s[n], h = a.getSimplifiedGeometry(t);
|
|
1456
|
+
e.push(h), h !== a && (i = !0);
|
|
1457
|
+
}
|
|
1458
|
+
if (i) {
|
|
1459
|
+
const n = new C(null);
|
|
1460
|
+
return n.setGeometriesArray(e), n;
|
|
1461
|
+
}
|
|
1462
|
+
return this.simplifiedGeometryMaxMinSquaredTolerance = t, this;
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Get the type of this geometry.
|
|
1466
|
+
* @return {import("./Geometry.js").Type} Geometry type.
|
|
1467
|
+
* @api
|
|
1468
|
+
*/
|
|
1469
|
+
getType() {
|
|
1470
|
+
return "GeometryCollection";
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Test if the geometry and the passed extent intersect.
|
|
1474
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
1475
|
+
* @return {boolean} `true` if the geometry and the extent intersect.
|
|
1476
|
+
* @api
|
|
1477
|
+
*/
|
|
1478
|
+
intersectsExtent(t) {
|
|
1479
|
+
const e = this.geometries_;
|
|
1480
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
1481
|
+
if (e[s].intersectsExtent(t))
|
|
1482
|
+
return !0;
|
|
1483
|
+
return !1;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* @return {boolean} Is empty.
|
|
1487
|
+
*/
|
|
1488
|
+
isEmpty() {
|
|
1489
|
+
return this.geometries_.length === 0;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Rotate the geometry around a given coordinate. This modifies the geometry
|
|
1493
|
+
* coordinates in place.
|
|
1494
|
+
* @param {number} angle Rotation angle in radians.
|
|
1495
|
+
* @param {import("../coordinate.js").Coordinate} anchor The rotation center.
|
|
1496
|
+
* @api
|
|
1497
|
+
*/
|
|
1498
|
+
rotate(t, e) {
|
|
1499
|
+
const s = this.geometries_;
|
|
1500
|
+
for (let i = 0, n = s.length; i < n; ++i)
|
|
1501
|
+
s[i].rotate(t, e);
|
|
1502
|
+
this.changed();
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Scale the geometry (with an optional origin). This modifies the geometry
|
|
1506
|
+
* coordinates in place.
|
|
1507
|
+
* @abstract
|
|
1508
|
+
* @param {number} sx The scaling factor in the x-direction.
|
|
1509
|
+
* @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
|
|
1510
|
+
* @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
|
|
1511
|
+
* of the geometry extent).
|
|
1512
|
+
* @api
|
|
1513
|
+
*/
|
|
1514
|
+
scale(t, e, s) {
|
|
1515
|
+
s || (s = At(this.getExtent()));
|
|
1516
|
+
const i = this.geometries_;
|
|
1517
|
+
for (let n = 0, o = i.length; n < o; ++n)
|
|
1518
|
+
i[n].scale(t, e, s);
|
|
1519
|
+
this.changed();
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Set the geometries that make up this geometry collection.
|
|
1523
|
+
* @param {Array<Geometry>} geometries Geometries.
|
|
1524
|
+
* @api
|
|
1525
|
+
*/
|
|
1526
|
+
setGeometries(t) {
|
|
1527
|
+
this.setGeometriesArray(j(t));
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* @param {Array<Geometry>} geometries Geometries.
|
|
1531
|
+
*/
|
|
1532
|
+
setGeometriesArray(t) {
|
|
1533
|
+
this.unlistenGeometriesChange_(), this.geometries_ = t, this.listenGeometriesChange_(), this.changed();
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Apply a transform function to the coordinates of the geometry.
|
|
1537
|
+
* The geometry is modified in place.
|
|
1538
|
+
* If you do not want the geometry modified in place, first `clone()` it and
|
|
1539
|
+
* then use this function on the clone.
|
|
1540
|
+
* @param {import("../proj.js").TransformFunction} transformFn Transform function.
|
|
1541
|
+
* Called with a flat array of geometry coordinates.
|
|
1542
|
+
* @api
|
|
1543
|
+
*/
|
|
1544
|
+
applyTransform(t) {
|
|
1545
|
+
const e = this.geometries_;
|
|
1546
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
1547
|
+
e[s].applyTransform(t);
|
|
1548
|
+
this.changed();
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Translate the geometry. This modifies the geometry coordinates in place. If
|
|
1552
|
+
* instead you want a new geometry, first `clone()` this geometry.
|
|
1553
|
+
* @param {number} deltaX Delta X.
|
|
1554
|
+
* @param {number} deltaY Delta Y.
|
|
1555
|
+
* @api
|
|
1556
|
+
*/
|
|
1557
|
+
translate(t, e) {
|
|
1558
|
+
const s = this.geometries_;
|
|
1559
|
+
for (let i = 0, n = s.length; i < n; ++i)
|
|
1560
|
+
s[i].translate(t, e);
|
|
1561
|
+
this.changed();
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Clean up.
|
|
1565
|
+
*/
|
|
1566
|
+
disposeInternal() {
|
|
1567
|
+
this.unlistenGeometriesChange_(), super.disposeInternal();
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
function j(r) {
|
|
1571
|
+
const t = [];
|
|
1572
|
+
for (let e = 0, s = r.length; e < s; ++e)
|
|
1573
|
+
t.push(r[e].clone());
|
|
1574
|
+
return t;
|
|
1575
|
+
}
|
|
1576
|
+
class Yt extends Ot {
|
|
1577
|
+
constructor() {
|
|
1578
|
+
super();
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* @return {import("./Feature.js").Type} Format.
|
|
1582
|
+
*/
|
|
1583
|
+
getType() {
|
|
1584
|
+
return "text";
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Read the feature from the source.
|
|
1588
|
+
*
|
|
1589
|
+
* @param {Document|Element|Object|string} source Source.
|
|
1590
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1591
|
+
* @return {import("../Feature.js").default} Feature.
|
|
1592
|
+
* @api
|
|
1593
|
+
*/
|
|
1594
|
+
readFeature(t, e) {
|
|
1595
|
+
return this.readFeatureFromText(
|
|
1596
|
+
G(t),
|
|
1597
|
+
this.adaptOptions(e)
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* @abstract
|
|
1602
|
+
* @param {string} text Text.
|
|
1603
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1604
|
+
* @protected
|
|
1605
|
+
* @return {import("../Feature.js").default} Feature.
|
|
1606
|
+
*/
|
|
1607
|
+
readFeatureFromText(t, e) {
|
|
1608
|
+
return g();
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Read the features from the source.
|
|
1612
|
+
*
|
|
1613
|
+
* @param {Document|Element|Object|string} source Source.
|
|
1614
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1615
|
+
* @return {Array<import("../Feature.js").default>} Features.
|
|
1616
|
+
* @api
|
|
1617
|
+
*/
|
|
1618
|
+
readFeatures(t, e) {
|
|
1619
|
+
return this.readFeaturesFromText(
|
|
1620
|
+
G(t),
|
|
1621
|
+
this.adaptOptions(e)
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* @abstract
|
|
1626
|
+
* @param {string} text Text.
|
|
1627
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1628
|
+
* @protected
|
|
1629
|
+
* @return {Array<import("../Feature.js").default>} Features.
|
|
1630
|
+
*/
|
|
1631
|
+
readFeaturesFromText(t, e) {
|
|
1632
|
+
return g();
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Read the geometry from the source.
|
|
1636
|
+
*
|
|
1637
|
+
* @param {Document|Element|Object|string} source Source.
|
|
1638
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1639
|
+
* @return {import("../geom/Geometry.js").default} Geometry.
|
|
1640
|
+
* @api
|
|
1641
|
+
*/
|
|
1642
|
+
readGeometry(t, e) {
|
|
1643
|
+
return this.readGeometryFromText(
|
|
1644
|
+
G(t),
|
|
1645
|
+
this.adaptOptions(e)
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* @abstract
|
|
1650
|
+
* @param {string} text Text.
|
|
1651
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
1652
|
+
* @protected
|
|
1653
|
+
* @return {import("../geom/Geometry.js").default} Geometry.
|
|
1654
|
+
*/
|
|
1655
|
+
readGeometryFromText(t, e) {
|
|
1656
|
+
return g();
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Read the projection from the source.
|
|
1660
|
+
*
|
|
1661
|
+
* @param {Document|Element|Object|string} source Source.
|
|
1662
|
+
* @return {import("../proj/Projection.js").default|undefined} Projection.
|
|
1663
|
+
* @api
|
|
1664
|
+
*/
|
|
1665
|
+
readProjection(t) {
|
|
1666
|
+
return this.readProjectionFromText(G(t));
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* @param {string} text Text.
|
|
1670
|
+
* @protected
|
|
1671
|
+
* @return {import("../proj/Projection.js").default|undefined} Projection.
|
|
1672
|
+
*/
|
|
1673
|
+
readProjectionFromText(t) {
|
|
1674
|
+
return this.dataProjection;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Encode a feature as a string.
|
|
1678
|
+
*
|
|
1679
|
+
* @param {import("../Feature.js").default} feature Feature.
|
|
1680
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1681
|
+
* @return {string} Encoded feature.
|
|
1682
|
+
* @api
|
|
1683
|
+
*/
|
|
1684
|
+
writeFeature(t, e) {
|
|
1685
|
+
return this.writeFeatureText(t, this.adaptOptions(e));
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* @abstract
|
|
1689
|
+
* @param {import("../Feature.js").default} feature Features.
|
|
1690
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1691
|
+
* @protected
|
|
1692
|
+
* @return {string} Text.
|
|
1693
|
+
*/
|
|
1694
|
+
writeFeatureText(t, e) {
|
|
1695
|
+
return g();
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Encode an array of features as string.
|
|
1699
|
+
*
|
|
1700
|
+
* @param {Array<import("../Feature.js").default>} features Features.
|
|
1701
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1702
|
+
* @return {string} Encoded features.
|
|
1703
|
+
* @api
|
|
1704
|
+
*/
|
|
1705
|
+
writeFeatures(t, e) {
|
|
1706
|
+
return this.writeFeaturesText(t, this.adaptOptions(e));
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* @abstract
|
|
1710
|
+
* @param {Array<import("../Feature.js").default>} features Features.
|
|
1711
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1712
|
+
* @protected
|
|
1713
|
+
* @return {string} Text.
|
|
1714
|
+
*/
|
|
1715
|
+
writeFeaturesText(t, e) {
|
|
1716
|
+
return g();
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* Write a single geometry.
|
|
1720
|
+
*
|
|
1721
|
+
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
|
1722
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1723
|
+
* @return {string} Geometry.
|
|
1724
|
+
* @api
|
|
1725
|
+
*/
|
|
1726
|
+
writeGeometry(t, e) {
|
|
1727
|
+
return this.writeGeometryText(t, this.adaptOptions(e));
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* @abstract
|
|
1731
|
+
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
|
1732
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
1733
|
+
* @protected
|
|
1734
|
+
* @return {string} Text.
|
|
1735
|
+
*/
|
|
1736
|
+
writeGeometryText(t, e) {
|
|
1737
|
+
return g();
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function G(r) {
|
|
1741
|
+
return typeof r == "string" ? r : "";
|
|
1742
|
+
}
|
|
1743
|
+
const kt = {
|
|
1744
|
+
POINT: I,
|
|
1745
|
+
LINESTRING: p,
|
|
1746
|
+
POLYGON: O,
|
|
1747
|
+
MULTIPOINT: w,
|
|
1748
|
+
MULTILINESTRING: F,
|
|
1749
|
+
MULTIPOLYGON: L
|
|
1750
|
+
}, B = "EMPTY", W = "Z", z = "M", jt = "ZM", u = {
|
|
1751
|
+
START: 0,
|
|
1752
|
+
TEXT: 1,
|
|
1753
|
+
LEFT_PAREN: 2,
|
|
1754
|
+
RIGHT_PAREN: 3,
|
|
1755
|
+
NUMBER: 4,
|
|
1756
|
+
COMMA: 5,
|
|
1757
|
+
EOF: 6
|
|
1758
|
+
}, Xt = {
|
|
1759
|
+
Point: "POINT",
|
|
1760
|
+
LineString: "LINESTRING",
|
|
1761
|
+
Polygon: "POLYGON",
|
|
1762
|
+
MultiPoint: "MULTIPOINT",
|
|
1763
|
+
MultiLineString: "MULTILINESTRING",
|
|
1764
|
+
MultiPolygon: "MULTIPOLYGON",
|
|
1765
|
+
GeometryCollection: "GEOMETRYCOLLECTION",
|
|
1766
|
+
Circle: "CIRCLE"
|
|
1767
|
+
};
|
|
1768
|
+
class Ut {
|
|
1769
|
+
/**
|
|
1770
|
+
* @param {string} wkt WKT string.
|
|
1771
|
+
*/
|
|
1772
|
+
constructor(t) {
|
|
1773
|
+
this.wkt = t, this.index_ = -1;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* @param {string} c Character.
|
|
1777
|
+
* @return {boolean} Whether the character is alphabetic.
|
|
1778
|
+
* @private
|
|
1779
|
+
*/
|
|
1780
|
+
isAlpha_(t) {
|
|
1781
|
+
return t >= "a" && t <= "z" || t >= "A" && t <= "Z";
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* @param {string} c Character.
|
|
1785
|
+
* @param {boolean} [decimal] Whether the string number
|
|
1786
|
+
* contains a dot, i.e. is a decimal number.
|
|
1787
|
+
* @return {boolean} Whether the character is numeric.
|
|
1788
|
+
* @private
|
|
1789
|
+
*/
|
|
1790
|
+
isNumeric_(t, e) {
|
|
1791
|
+
return e = e !== void 0 ? e : !1, t >= "0" && t <= "9" || t == "." && !e;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* @param {string} c Character.
|
|
1795
|
+
* @return {boolean} Whether the character is whitespace.
|
|
1796
|
+
* @private
|
|
1797
|
+
*/
|
|
1798
|
+
isWhiteSpace_(t) {
|
|
1799
|
+
return t == " " || t == " " || t == "\r" || t == `
|
|
1800
|
+
`;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* @return {string} Next string character.
|
|
1804
|
+
* @private
|
|
1805
|
+
*/
|
|
1806
|
+
nextChar_() {
|
|
1807
|
+
return this.wkt.charAt(++this.index_);
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Fetch and return the next token.
|
|
1811
|
+
* @return {Token} Next string token.
|
|
1812
|
+
*/
|
|
1813
|
+
nextToken() {
|
|
1814
|
+
const t = this.nextChar_(), e = this.index_;
|
|
1815
|
+
let s = t, i;
|
|
1816
|
+
if (t == "(")
|
|
1817
|
+
i = u.LEFT_PAREN;
|
|
1818
|
+
else if (t == ",")
|
|
1819
|
+
i = u.COMMA;
|
|
1820
|
+
else if (t == ")")
|
|
1821
|
+
i = u.RIGHT_PAREN;
|
|
1822
|
+
else if (this.isNumeric_(t) || t == "-")
|
|
1823
|
+
i = u.NUMBER, s = this.readNumber_();
|
|
1824
|
+
else if (this.isAlpha_(t))
|
|
1825
|
+
i = u.TEXT, s = this.readText_();
|
|
1826
|
+
else {
|
|
1827
|
+
if (this.isWhiteSpace_(t))
|
|
1828
|
+
return this.nextToken();
|
|
1829
|
+
if (t === "")
|
|
1830
|
+
i = u.EOF;
|
|
1831
|
+
else
|
|
1832
|
+
throw new Error("Unexpected character: " + t);
|
|
1833
|
+
}
|
|
1834
|
+
return { position: e, value: s, type: i };
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* @return {number} Numeric token value.
|
|
1838
|
+
* @private
|
|
1839
|
+
*/
|
|
1840
|
+
readNumber_() {
|
|
1841
|
+
let t;
|
|
1842
|
+
const e = this.index_;
|
|
1843
|
+
let s = !1, i = !1;
|
|
1844
|
+
do
|
|
1845
|
+
t == "." ? s = !0 : (t == "e" || t == "E") && (i = !0), t = this.nextChar_();
|
|
1846
|
+
while (this.isNumeric_(t, s) || // if we haven't detected a scientific number before, 'e' or 'E'
|
|
1847
|
+
// hint that we should continue to read
|
|
1848
|
+
!i && (t == "e" || t == "E") || // once we know that we have a scientific number, both '-' and '+'
|
|
1849
|
+
// are allowed
|
|
1850
|
+
i && (t == "-" || t == "+"));
|
|
1851
|
+
return parseFloat(this.wkt.substring(e, this.index_--));
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* @return {string} String token value.
|
|
1855
|
+
* @private
|
|
1856
|
+
*/
|
|
1857
|
+
readText_() {
|
|
1858
|
+
let t;
|
|
1859
|
+
const e = this.index_;
|
|
1860
|
+
do
|
|
1861
|
+
t = this.nextChar_();
|
|
1862
|
+
while (this.isAlpha_(t));
|
|
1863
|
+
return this.wkt.substring(e, this.index_--).toUpperCase();
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
class Zt {
|
|
1867
|
+
/**
|
|
1868
|
+
* @param {Lexer} lexer The lexer.
|
|
1869
|
+
*/
|
|
1870
|
+
constructor(t) {
|
|
1871
|
+
this.lexer_ = t, this.token_ = {
|
|
1872
|
+
position: 0,
|
|
1873
|
+
type: u.START
|
|
1874
|
+
}, this.layout_ = "XY";
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Fetch the next token form the lexer and replace the active token.
|
|
1878
|
+
* @private
|
|
1879
|
+
*/
|
|
1880
|
+
consume_() {
|
|
1881
|
+
this.token_ = this.lexer_.nextToken();
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Tests if the given type matches the type of the current token.
|
|
1885
|
+
* @param {TokenType} type Token type.
|
|
1886
|
+
* @return {boolean} Whether the token matches the given type.
|
|
1887
|
+
*/
|
|
1888
|
+
isTokenType(t) {
|
|
1889
|
+
return this.token_.type == t;
|
|
1890
|
+
}
|
|
1891
|
+
/**
|
|
1892
|
+
* If the given type matches the current token, consume it.
|
|
1893
|
+
* @param {TokenType} type Token type.
|
|
1894
|
+
* @return {boolean} Whether the token matches the given type.
|
|
1895
|
+
*/
|
|
1896
|
+
match(t) {
|
|
1897
|
+
const e = this.isTokenType(t);
|
|
1898
|
+
return e && this.consume_(), e;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Try to parse the tokens provided by the lexer.
|
|
1902
|
+
* @return {import("../geom/Geometry.js").default} The geometry.
|
|
1903
|
+
*/
|
|
1904
|
+
parse() {
|
|
1905
|
+
return this.consume_(), this.parseGeometry_();
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* Try to parse the dimensional info.
|
|
1909
|
+
* @return {import("../geom/Geometry.js").GeometryLayout} The layout.
|
|
1910
|
+
* @private
|
|
1911
|
+
*/
|
|
1912
|
+
parseGeometryLayout_() {
|
|
1913
|
+
let t = "XY";
|
|
1914
|
+
const e = this.token_;
|
|
1915
|
+
if (this.isTokenType(u.TEXT)) {
|
|
1916
|
+
const s = e.value;
|
|
1917
|
+
s === W ? t = "XYZ" : s === z ? t = "XYM" : s === jt && (t = "XYZM"), t !== "XY" && this.consume_();
|
|
1918
|
+
}
|
|
1919
|
+
return t;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* @return {Array<import("../geom/Geometry.js").default>} A collection of geometries.
|
|
1923
|
+
* @private
|
|
1924
|
+
*/
|
|
1925
|
+
parseGeometryCollectionText_() {
|
|
1926
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1927
|
+
const t = [];
|
|
1928
|
+
do
|
|
1929
|
+
t.push(this.parseGeometry_());
|
|
1930
|
+
while (this.match(u.COMMA));
|
|
1931
|
+
if (this.match(u.RIGHT_PAREN))
|
|
1932
|
+
return t;
|
|
1933
|
+
}
|
|
1934
|
+
throw new Error(this.formatErrorMessage_());
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* @return {Array<number>} All values in a point.
|
|
1938
|
+
* @private
|
|
1939
|
+
*/
|
|
1940
|
+
parsePointText_() {
|
|
1941
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1942
|
+
const t = this.parsePoint_();
|
|
1943
|
+
if (this.match(u.RIGHT_PAREN))
|
|
1944
|
+
return t;
|
|
1945
|
+
}
|
|
1946
|
+
throw new Error(this.formatErrorMessage_());
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* @return {Array<Array<number>>} All points in a linestring.
|
|
1950
|
+
* @private
|
|
1951
|
+
*/
|
|
1952
|
+
parseLineStringText_() {
|
|
1953
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1954
|
+
const t = this.parsePointList_();
|
|
1955
|
+
if (this.match(u.RIGHT_PAREN))
|
|
1956
|
+
return t;
|
|
1957
|
+
}
|
|
1958
|
+
throw new Error(this.formatErrorMessage_());
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* @return {Array<Array<Array<number>>>} All points in a polygon.
|
|
1962
|
+
* @private
|
|
1963
|
+
*/
|
|
1964
|
+
parsePolygonText_() {
|
|
1965
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1966
|
+
const t = this.parseLineStringTextList_();
|
|
1967
|
+
if (this.match(u.RIGHT_PAREN))
|
|
1968
|
+
return t;
|
|
1969
|
+
}
|
|
1970
|
+
throw new Error(this.formatErrorMessage_());
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* @return {Array<Array<number>>} All points in a multipoint.
|
|
1974
|
+
* @private
|
|
1975
|
+
*/
|
|
1976
|
+
parseMultiPointText_() {
|
|
1977
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1978
|
+
let t;
|
|
1979
|
+
if (this.token_.type == u.LEFT_PAREN ? t = this.parsePointTextList_() : t = this.parsePointList_(), this.match(u.RIGHT_PAREN))
|
|
1980
|
+
return t;
|
|
1981
|
+
}
|
|
1982
|
+
throw new Error(this.formatErrorMessage_());
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* @return {Array<Array<Array<number>>>} All linestring points
|
|
1986
|
+
* in a multilinestring.
|
|
1987
|
+
* @private
|
|
1988
|
+
*/
|
|
1989
|
+
parseMultiLineStringText_() {
|
|
1990
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
1991
|
+
const t = this.parseLineStringTextList_();
|
|
1992
|
+
if (this.match(u.RIGHT_PAREN))
|
|
1993
|
+
return t;
|
|
1994
|
+
}
|
|
1995
|
+
throw new Error(this.formatErrorMessage_());
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* @return {Array<Array<Array<Array<number>>>>} All polygon points in a multipolygon.
|
|
1999
|
+
* @private
|
|
2000
|
+
*/
|
|
2001
|
+
parseMultiPolygonText_() {
|
|
2002
|
+
if (this.match(u.LEFT_PAREN)) {
|
|
2003
|
+
const t = this.parsePolygonTextList_();
|
|
2004
|
+
if (this.match(u.RIGHT_PAREN))
|
|
2005
|
+
return t;
|
|
2006
|
+
}
|
|
2007
|
+
throw new Error(this.formatErrorMessage_());
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* @return {Array<number>} A point.
|
|
2011
|
+
* @private
|
|
2012
|
+
*/
|
|
2013
|
+
parsePoint_() {
|
|
2014
|
+
const t = [], e = this.layout_.length;
|
|
2015
|
+
for (let s = 0; s < e; ++s) {
|
|
2016
|
+
const i = this.token_;
|
|
2017
|
+
if (this.match(u.NUMBER))
|
|
2018
|
+
t.push(
|
|
2019
|
+
/** @type {number} */
|
|
2020
|
+
i.value
|
|
2021
|
+
);
|
|
2022
|
+
else
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
if (t.length == e)
|
|
2026
|
+
return t;
|
|
2027
|
+
throw new Error(this.formatErrorMessage_());
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* @return {Array<Array<number>>} An array of points.
|
|
2031
|
+
* @private
|
|
2032
|
+
*/
|
|
2033
|
+
parsePointList_() {
|
|
2034
|
+
const t = [this.parsePoint_()];
|
|
2035
|
+
for (; this.match(u.COMMA); )
|
|
2036
|
+
t.push(this.parsePoint_());
|
|
2037
|
+
return t;
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* @return {Array<Array<number>>} An array of points.
|
|
2041
|
+
* @private
|
|
2042
|
+
*/
|
|
2043
|
+
parsePointTextList_() {
|
|
2044
|
+
const t = [this.parsePointText_()];
|
|
2045
|
+
for (; this.match(u.COMMA); )
|
|
2046
|
+
t.push(this.parsePointText_());
|
|
2047
|
+
return t;
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* @return {Array<Array<Array<number>>>} An array of points.
|
|
2051
|
+
* @private
|
|
2052
|
+
*/
|
|
2053
|
+
parseLineStringTextList_() {
|
|
2054
|
+
const t = [this.parseLineStringText_()];
|
|
2055
|
+
for (; this.match(u.COMMA); )
|
|
2056
|
+
t.push(this.parseLineStringText_());
|
|
2057
|
+
return t;
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* @return {Array<Array<Array<Array<number>>>>} An array of points.
|
|
2061
|
+
* @private
|
|
2062
|
+
*/
|
|
2063
|
+
parsePolygonTextList_() {
|
|
2064
|
+
const t = [this.parsePolygonText_()];
|
|
2065
|
+
for (; this.match(u.COMMA); )
|
|
2066
|
+
t.push(this.parsePolygonText_());
|
|
2067
|
+
return t;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* @return {boolean} Whether the token implies an empty geometry.
|
|
2071
|
+
* @private
|
|
2072
|
+
*/
|
|
2073
|
+
isEmptyGeometry_() {
|
|
2074
|
+
const t = this.isTokenType(u.TEXT) && this.token_.value == B;
|
|
2075
|
+
return t && this.consume_(), t;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Create an error message for an unexpected token error.
|
|
2079
|
+
* @return {string} Error message.
|
|
2080
|
+
* @private
|
|
2081
|
+
*/
|
|
2082
|
+
formatErrorMessage_() {
|
|
2083
|
+
return "Unexpected `" + this.token_.value + "` at position " + this.token_.position + " in `" + this.lexer_.wkt + "`";
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* @return {import("../geom/Geometry.js").default} The geometry.
|
|
2087
|
+
* @private
|
|
2088
|
+
*/
|
|
2089
|
+
parseGeometry_() {
|
|
2090
|
+
const t = this.token_;
|
|
2091
|
+
if (this.match(u.TEXT)) {
|
|
2092
|
+
const e = (
|
|
2093
|
+
/** @type {string} */
|
|
2094
|
+
t.value
|
|
2095
|
+
);
|
|
2096
|
+
this.layout_ = this.parseGeometryLayout_();
|
|
2097
|
+
const s = this.isEmptyGeometry_();
|
|
2098
|
+
if (e == "GEOMETRYCOLLECTION") {
|
|
2099
|
+
if (s)
|
|
2100
|
+
return new C([]);
|
|
2101
|
+
const o = this.parseGeometryCollectionText_();
|
|
2102
|
+
return new C(o);
|
|
2103
|
+
}
|
|
2104
|
+
const i = kt[e];
|
|
2105
|
+
if (!i)
|
|
2106
|
+
throw new Error("Invalid geometry type: " + e);
|
|
2107
|
+
let n;
|
|
2108
|
+
if (s)
|
|
2109
|
+
e == "POINT" ? n = [NaN, NaN] : n = [];
|
|
2110
|
+
else
|
|
2111
|
+
switch (e) {
|
|
2112
|
+
case "POINT": {
|
|
2113
|
+
n = this.parsePointText_();
|
|
2114
|
+
break;
|
|
2115
|
+
}
|
|
2116
|
+
case "LINESTRING": {
|
|
2117
|
+
n = this.parseLineStringText_();
|
|
2118
|
+
break;
|
|
2119
|
+
}
|
|
2120
|
+
case "POLYGON": {
|
|
2121
|
+
n = this.parsePolygonText_();
|
|
2122
|
+
break;
|
|
2123
|
+
}
|
|
2124
|
+
case "MULTIPOINT": {
|
|
2125
|
+
n = this.parseMultiPointText_();
|
|
2126
|
+
break;
|
|
2127
|
+
}
|
|
2128
|
+
case "MULTILINESTRING": {
|
|
2129
|
+
n = this.parseMultiLineStringText_();
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
case "MULTIPOLYGON": {
|
|
2133
|
+
n = this.parseMultiPolygonText_();
|
|
2134
|
+
break;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
return new i(n, this.layout_);
|
|
2138
|
+
}
|
|
2139
|
+
throw new Error(this.formatErrorMessage_());
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
class Jt extends Yt {
|
|
2143
|
+
/**
|
|
2144
|
+
* @param {Options} [options] Options.
|
|
2145
|
+
*/
|
|
2146
|
+
constructor(t) {
|
|
2147
|
+
super(), t = t || {}, this.splitCollection_ = t.splitCollection !== void 0 ? t.splitCollection : !1;
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Parse a WKT string.
|
|
2151
|
+
* @param {string} wkt WKT string.
|
|
2152
|
+
* @return {import("../geom/Geometry.js").default}
|
|
2153
|
+
* The geometry created.
|
|
2154
|
+
* @private
|
|
2155
|
+
*/
|
|
2156
|
+
parse_(t) {
|
|
2157
|
+
const e = new Ut(t);
|
|
2158
|
+
return new Zt(e).parse();
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* @protected
|
|
2162
|
+
* @param {string} text Text.
|
|
2163
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
2164
|
+
* @return {import("../Feature.js").default} Feature.
|
|
2165
|
+
*/
|
|
2166
|
+
readFeatureFromText(t, e) {
|
|
2167
|
+
const s = this.readGeometryFromText(t, e), i = new M();
|
|
2168
|
+
return i.setGeometry(s), i;
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* @param {string} text Text.
|
|
2172
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
2173
|
+
* @protected
|
|
2174
|
+
* @return {Array<Feature>} Features.
|
|
2175
|
+
*/
|
|
2176
|
+
readFeaturesFromText(t, e) {
|
|
2177
|
+
let s = [];
|
|
2178
|
+
const i = this.readGeometryFromText(t, e);
|
|
2179
|
+
this.splitCollection_ && i.getType() == "GeometryCollection" ? s = /** @type {GeometryCollection} */
|
|
2180
|
+
i.getGeometriesArray() : s = [i];
|
|
2181
|
+
const n = [];
|
|
2182
|
+
for (let o = 0, a = s.length; o < a; ++o) {
|
|
2183
|
+
const h = new M();
|
|
2184
|
+
h.setGeometry(s[o]), n.push(h);
|
|
2185
|
+
}
|
|
2186
|
+
return n;
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* @param {string} text Text.
|
|
2190
|
+
* @param {import("./Feature.js").ReadOptions} [options] Read options.
|
|
2191
|
+
* @protected
|
|
2192
|
+
* @return {import("../geom/Geometry.js").default} Geometry.
|
|
2193
|
+
*/
|
|
2194
|
+
readGeometryFromText(t, e) {
|
|
2195
|
+
const s = this.parse_(t);
|
|
2196
|
+
return k(s, !1, e);
|
|
2197
|
+
}
|
|
2198
|
+
/**
|
|
2199
|
+
* @param {import("../Feature.js").default} feature Features.
|
|
2200
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
2201
|
+
* @protected
|
|
2202
|
+
* @return {string} Text.
|
|
2203
|
+
*/
|
|
2204
|
+
writeFeatureText(t, e) {
|
|
2205
|
+
const s = t.getGeometry();
|
|
2206
|
+
return s ? this.writeGeometryText(s, e) : "";
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* @param {Array<import("../Feature.js").default>} features Features.
|
|
2210
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
2211
|
+
* @protected
|
|
2212
|
+
* @return {string} Text.
|
|
2213
|
+
*/
|
|
2214
|
+
writeFeaturesText(t, e) {
|
|
2215
|
+
if (t.length == 1)
|
|
2216
|
+
return this.writeFeatureText(t[0], e);
|
|
2217
|
+
const s = [];
|
|
2218
|
+
for (let n = 0, o = t.length; n < o; ++n)
|
|
2219
|
+
s.push(t[n].getGeometry());
|
|
2220
|
+
const i = new C(s);
|
|
2221
|
+
return this.writeGeometryText(i, e);
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
|
2225
|
+
* @param {import("./Feature.js").WriteOptions} [options] Write options.
|
|
2226
|
+
* @protected
|
|
2227
|
+
* @return {string} Text.
|
|
2228
|
+
*/
|
|
2229
|
+
writeGeometryText(t, e) {
|
|
2230
|
+
return J(k(t, !0, e));
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
function $(r) {
|
|
2234
|
+
const t = r.getCoordinates();
|
|
2235
|
+
return t.length === 0 ? "" : t.join(" ");
|
|
2236
|
+
}
|
|
2237
|
+
function bt(r) {
|
|
2238
|
+
const t = [], e = r.getPoints();
|
|
2239
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
2240
|
+
t.push("(" + $(e[s]) + ")");
|
|
2241
|
+
return t.join(",");
|
|
2242
|
+
}
|
|
2243
|
+
function Ht(r) {
|
|
2244
|
+
const t = [], e = r.getGeometries();
|
|
2245
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
2246
|
+
t.push(J(e[s]));
|
|
2247
|
+
return t.join(",");
|
|
2248
|
+
}
|
|
2249
|
+
function S(r) {
|
|
2250
|
+
const t = r.getCoordinates(), e = [];
|
|
2251
|
+
for (let s = 0, i = t.length; s < i; ++s)
|
|
2252
|
+
e.push(t[s].join(" "));
|
|
2253
|
+
return e.join(",");
|
|
2254
|
+
}
|
|
2255
|
+
function Kt(r) {
|
|
2256
|
+
const t = [], e = r.getLineStrings();
|
|
2257
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
2258
|
+
t.push("(" + S(e[s]) + ")");
|
|
2259
|
+
return t.join(",");
|
|
2260
|
+
}
|
|
2261
|
+
function q(r) {
|
|
2262
|
+
const t = [], e = r.getLinearRings();
|
|
2263
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
2264
|
+
t.push("(" + S(e[s]) + ")");
|
|
2265
|
+
return t.join(",");
|
|
2266
|
+
}
|
|
2267
|
+
function Dt(r) {
|
|
2268
|
+
const t = [], e = r.getPolygons();
|
|
2269
|
+
for (let s = 0, i = e.length; s < i; ++s)
|
|
2270
|
+
t.push("(" + q(e[s]) + ")");
|
|
2271
|
+
return t.join(",");
|
|
2272
|
+
}
|
|
2273
|
+
function Bt(r) {
|
|
2274
|
+
const t = r.getLayout();
|
|
2275
|
+
let e = "";
|
|
2276
|
+
return (t === "XYZ" || t === "XYZM") && (e += W), (t === "XYM" || t === "XYZM") && (e += z), e;
|
|
2277
|
+
}
|
|
2278
|
+
const Wt = {
|
|
2279
|
+
Point: $,
|
|
2280
|
+
LineString: S,
|
|
2281
|
+
Polygon: q,
|
|
2282
|
+
MultiPoint: bt,
|
|
2283
|
+
MultiLineString: Kt,
|
|
2284
|
+
MultiPolygon: Dt,
|
|
2285
|
+
GeometryCollection: Ht
|
|
2286
|
+
};
|
|
2287
|
+
function J(r) {
|
|
2288
|
+
const t = r.getType(), e = Wt[t], s = e(r);
|
|
2289
|
+
let i = Xt[t];
|
|
2290
|
+
if (typeof /** @type {?} */
|
|
2291
|
+
r.getFlatCoordinates == "function") {
|
|
2292
|
+
const n = Bt(
|
|
2293
|
+
/** @type {import("../geom/SimpleGeometry.js").default} */
|
|
2294
|
+
r
|
|
2295
|
+
);
|
|
2296
|
+
n.length > 0 && (i += " " + n);
|
|
2297
|
+
}
|
|
2298
|
+
return s.length === 0 ? i + " " + B : i + "(" + s + ")";
|
|
2299
|
+
}
|
|
2300
|
+
export {
|
|
2301
|
+
M as F,
|
|
2302
|
+
C as G,
|
|
2303
|
+
p as L,
|
|
2304
|
+
w as M,
|
|
2305
|
+
Jt as W,
|
|
2306
|
+
F as a,
|
|
2307
|
+
L as b,
|
|
2308
|
+
Ot as c,
|
|
2309
|
+
k as t
|
|
2310
|
+
};
|