@vaadin/bundles 23.1.0 → 23.2.0-alpha2
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/node_modules_ol_ImageCanvas_js.js +121 -0
- package/node_modules_ol_ImageCanvas_js.js.map +1 -0
- package/node_modules_ol_ImageTile_js.js +177 -0
- package/node_modules_ol_ImageTile_js.js.map +1 -0
- package/node_modules_ol_TileRange_js.js +154 -0
- package/node_modules_ol_TileRange_js.js.map +1 -0
- package/node_modules_ol_VectorRenderTile_js.js +182 -0
- package/node_modules_ol_VectorRenderTile_js.js.map +1 -0
- package/node_modules_ol_VectorTile_js.js +158 -0
- package/node_modules_ol_VectorTile_js.js.map +1 -0
- package/node_modules_ol_geom_flat_geodesic_js.js +171 -0
- package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -0
- package/node_modules_ol_render_js.js +131 -0
- package/node_modules_ol_render_js.js.map +1 -0
- package/node_modules_ol_structs_LRUCache_js.js +275 -0
- package/node_modules_ol_structs_LRUCache_js.js.map +1 -0
- package/node_modules_ol_style_js.js +47 -0
- package/node_modules_ol_style_js.js.map +1 -0
- package/node_modules_ol_tilecoord_js.js +115 -0
- package/node_modules_ol_tilecoord_js.js.map +1 -0
- package/package.json +148 -120
- package/vaadin-bundle.json +2762 -1147
- package/vaadin.js +83964 -37317
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_ol_Geolocation_js.js +379 -0
- package/vendors-node_modules_ol_Geolocation_js.js.map +1 -0
- package/vendors-node_modules_ol_TileCache_js.js +461 -0
- package/vendors-node_modules_ol_TileCache_js.js.map +1 -0
- package/vendors-node_modules_ol_Tile_js.js +330 -0
- package/vendors-node_modules_ol_Tile_js.js.map +1 -0
- package/vendors-node_modules_ol_index_js.js +874 -0
- package/vendors-node_modules_ol_index_js.js.map +1 -0
- package/vendors-node_modules_ol_layer_Graticule_js.js +1359 -0
- package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -0
- package/vendors-node_modules_ol_style_Text_js.js +509 -0
- package/vendors-node_modules_ol_style_Text_js.js.map +1 -0
- package/vendors-node_modules_rbush_index_js.js +531 -0
- package/vendors-node_modules_rbush_index_js.js.map +1 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_Geolocation_js"],{
|
|
2
|
+
|
|
3
|
+
/***/ "./node_modules/ol/Geolocation.js":
|
|
4
|
+
/*!****************************************!*\
|
|
5
|
+
!*** ./node_modules/ol/Geolocation.js ***!
|
|
6
|
+
\****************************************/
|
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/Event.js */ "./node_modules/ol/events/Event.js");
|
|
14
|
+
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
|
|
15
|
+
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
|
|
16
|
+
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
|
|
17
|
+
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
|
|
18
|
+
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
|
|
19
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
20
|
+
var extendStatics = function (d, b) {
|
|
21
|
+
extendStatics = Object.setPrototypeOf ||
|
|
22
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24
|
+
return extendStatics(d, b);
|
|
25
|
+
};
|
|
26
|
+
return function (d, b) {
|
|
27
|
+
if (typeof b !== "function" && b !== null)
|
|
28
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
29
|
+
extendStatics(d, b);
|
|
30
|
+
function __() { this.constructor = d; }
|
|
31
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
/**
|
|
35
|
+
* @module ol/Geolocation
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @enum {string}
|
|
45
|
+
*/
|
|
46
|
+
var Property = {
|
|
47
|
+
ACCURACY: 'accuracy',
|
|
48
|
+
ACCURACY_GEOMETRY: 'accuracyGeometry',
|
|
49
|
+
ALTITUDE: 'altitude',
|
|
50
|
+
ALTITUDE_ACCURACY: 'altitudeAccuracy',
|
|
51
|
+
HEADING: 'heading',
|
|
52
|
+
POSITION: 'position',
|
|
53
|
+
PROJECTION: 'projection',
|
|
54
|
+
SPEED: 'speed',
|
|
55
|
+
TRACKING: 'tracking',
|
|
56
|
+
TRACKING_OPTIONS: 'trackingOptions',
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @classdesc
|
|
60
|
+
* Events emitted on Geolocation error.
|
|
61
|
+
*/
|
|
62
|
+
var GeolocationError = /** @class */ (function (_super) {
|
|
63
|
+
__extends(GeolocationError, _super);
|
|
64
|
+
/**
|
|
65
|
+
* @param {GeolocationPositionError} error error object.
|
|
66
|
+
*/
|
|
67
|
+
function GeolocationError(error) {
|
|
68
|
+
var _this = _super.call(this, _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) || this;
|
|
69
|
+
/**
|
|
70
|
+
* @type {number}
|
|
71
|
+
*/
|
|
72
|
+
_this.code = error.code;
|
|
73
|
+
/**
|
|
74
|
+
* @type {string}
|
|
75
|
+
*/
|
|
76
|
+
_this.message = error.message;
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
return GeolocationError;
|
|
80
|
+
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
|
|
81
|
+
/**
|
|
82
|
+
* @typedef {Object} Options
|
|
83
|
+
* @property {boolean} [tracking=false] Start Tracking right after
|
|
84
|
+
* instantiation.
|
|
85
|
+
* @property {PositionOptions} [trackingOptions] Tracking options.
|
|
86
|
+
* See https://www.w3.org/TR/geolocation-API/#position_options_interface.
|
|
87
|
+
* @property {import("./proj.js").ProjectionLike} [projection] The projection the position
|
|
88
|
+
* is reported in.
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* @typedef {import("./ObjectEventType").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|
|
|
92
|
+
* 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|
|
|
93
|
+
* 'change:trackingOptions'} GeolocationObjectEventTypes
|
|
94
|
+
*/
|
|
95
|
+
/***
|
|
96
|
+
* @template Return
|
|
97
|
+
* @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
|
|
98
|
+
* import("./Observable").OnSignature<GeolocationObjectEventTypes, import("./Object").ObjectEvent, Return> &
|
|
99
|
+
* import("./Observable").OnSignature<'error', GeolocationError, Return> &
|
|
100
|
+
* import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|GeolocationObjectEventTypes|
|
|
101
|
+
* 'error', Return>} GeolocationOnSignature
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* @classdesc
|
|
105
|
+
* Helper class for providing HTML5 Geolocation capabilities.
|
|
106
|
+
* The [Geolocation API](https://www.w3.org/TR/geolocation-API/)
|
|
107
|
+
* is used to locate a user's position.
|
|
108
|
+
*
|
|
109
|
+
* To get notified of position changes, register a listener for the generic
|
|
110
|
+
* `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.
|
|
111
|
+
*
|
|
112
|
+
* Example:
|
|
113
|
+
*
|
|
114
|
+
* var geolocation = new Geolocation({
|
|
115
|
+
* // take the projection to use from the map's view
|
|
116
|
+
* projection: view.getProjection()
|
|
117
|
+
* });
|
|
118
|
+
* // listen to changes in position
|
|
119
|
+
* geolocation.on('change', function(evt) {
|
|
120
|
+
* window.console.log(geolocation.getPosition());
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* @fires module:ol/events/Event~BaseEvent#event:error
|
|
124
|
+
* @api
|
|
125
|
+
*/
|
|
126
|
+
var Geolocation = /** @class */ (function (_super) {
|
|
127
|
+
__extends(Geolocation, _super);
|
|
128
|
+
/**
|
|
129
|
+
* @param {Options} [opt_options] Options.
|
|
130
|
+
*/
|
|
131
|
+
function Geolocation(opt_options) {
|
|
132
|
+
var _this = _super.call(this) || this;
|
|
133
|
+
/***
|
|
134
|
+
* @type {GeolocationOnSignature<import("./events").EventsKey>}
|
|
135
|
+
*/
|
|
136
|
+
_this.on;
|
|
137
|
+
/***
|
|
138
|
+
* @type {GeolocationOnSignature<import("./events").EventsKey>}
|
|
139
|
+
*/
|
|
140
|
+
_this.once;
|
|
141
|
+
/***
|
|
142
|
+
* @type {GeolocationOnSignature<void>}
|
|
143
|
+
*/
|
|
144
|
+
_this.un;
|
|
145
|
+
var options = opt_options || {};
|
|
146
|
+
/**
|
|
147
|
+
* The unprojected (EPSG:4326) device position.
|
|
148
|
+
* @private
|
|
149
|
+
* @type {?import("./coordinate.js").Coordinate}
|
|
150
|
+
*/
|
|
151
|
+
_this.position_ = null;
|
|
152
|
+
/**
|
|
153
|
+
* @private
|
|
154
|
+
* @type {import("./proj.js").TransformFunction}
|
|
155
|
+
*/
|
|
156
|
+
_this.transform_ = _proj_js__WEBPACK_IMPORTED_MODULE_0__.identityTransform;
|
|
157
|
+
/**
|
|
158
|
+
* @private
|
|
159
|
+
* @type {number|undefined}
|
|
160
|
+
*/
|
|
161
|
+
_this.watchId_ = undefined;
|
|
162
|
+
_this.addChangeListener(Property.PROJECTION, _this.handleProjectionChanged_);
|
|
163
|
+
_this.addChangeListener(Property.TRACKING, _this.handleTrackingChanged_);
|
|
164
|
+
if (options.projection !== undefined) {
|
|
165
|
+
_this.setProjection(options.projection);
|
|
166
|
+
}
|
|
167
|
+
if (options.trackingOptions !== undefined) {
|
|
168
|
+
_this.setTrackingOptions(options.trackingOptions);
|
|
169
|
+
}
|
|
170
|
+
_this.setTracking(options.tracking !== undefined ? options.tracking : false);
|
|
171
|
+
return _this;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Clean up.
|
|
175
|
+
*/
|
|
176
|
+
Geolocation.prototype.disposeInternal = function () {
|
|
177
|
+
this.setTracking(false);
|
|
178
|
+
_super.prototype.disposeInternal.call(this);
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
183
|
+
Geolocation.prototype.handleProjectionChanged_ = function () {
|
|
184
|
+
var projection = this.getProjection();
|
|
185
|
+
if (projection) {
|
|
186
|
+
this.transform_ = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getTransformFromProjections)((0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.get)('EPSG:4326'), projection);
|
|
187
|
+
if (this.position_) {
|
|
188
|
+
this.set(Property.POSITION, this.transform_(this.position_));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* @private
|
|
194
|
+
*/
|
|
195
|
+
Geolocation.prototype.handleTrackingChanged_ = function () {
|
|
196
|
+
if ('geolocation' in navigator) {
|
|
197
|
+
var tracking = this.getTracking();
|
|
198
|
+
if (tracking && this.watchId_ === undefined) {
|
|
199
|
+
this.watchId_ = navigator.geolocation.watchPosition(this.positionChange_.bind(this), this.positionError_.bind(this), this.getTrackingOptions());
|
|
200
|
+
}
|
|
201
|
+
else if (!tracking && this.watchId_ !== undefined) {
|
|
202
|
+
navigator.geolocation.clearWatch(this.watchId_);
|
|
203
|
+
this.watchId_ = undefined;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* @private
|
|
209
|
+
* @param {GeolocationPosition} position position event.
|
|
210
|
+
*/
|
|
211
|
+
Geolocation.prototype.positionChange_ = function (position) {
|
|
212
|
+
var coords = position.coords;
|
|
213
|
+
this.set(Property.ACCURACY, coords.accuracy);
|
|
214
|
+
this.set(Property.ALTITUDE, coords.altitude === null ? undefined : coords.altitude);
|
|
215
|
+
this.set(Property.ALTITUDE_ACCURACY, coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy);
|
|
216
|
+
this.set(Property.HEADING, coords.heading === null ? undefined : (0,_math_js__WEBPACK_IMPORTED_MODULE_3__.toRadians)(coords.heading));
|
|
217
|
+
if (!this.position_) {
|
|
218
|
+
this.position_ = [coords.longitude, coords.latitude];
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.position_[0] = coords.longitude;
|
|
222
|
+
this.position_[1] = coords.latitude;
|
|
223
|
+
}
|
|
224
|
+
var projectedPosition = this.transform_(this.position_);
|
|
225
|
+
this.set(Property.POSITION, projectedPosition);
|
|
226
|
+
this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);
|
|
227
|
+
var geometry = (0,_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_4__.circular)(this.position_, coords.accuracy);
|
|
228
|
+
geometry.applyTransform(this.transform_);
|
|
229
|
+
this.set(Property.ACCURACY_GEOMETRY, geometry);
|
|
230
|
+
this.changed();
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* @private
|
|
234
|
+
* @param {GeolocationPositionError} error error object.
|
|
235
|
+
*/
|
|
236
|
+
Geolocation.prototype.positionError_ = function (error) {
|
|
237
|
+
this.dispatchEvent(new GeolocationError(error));
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Get the accuracy of the position in meters.
|
|
241
|
+
* @return {number|undefined} The accuracy of the position measurement in
|
|
242
|
+
* meters.
|
|
243
|
+
* @observable
|
|
244
|
+
* @api
|
|
245
|
+
*/
|
|
246
|
+
Geolocation.prototype.getAccuracy = function () {
|
|
247
|
+
return /** @type {number|undefined} */ (this.get(Property.ACCURACY));
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Get a geometry of the position accuracy.
|
|
251
|
+
* @return {?import("./geom/Polygon.js").default} A geometry of the position accuracy.
|
|
252
|
+
* @observable
|
|
253
|
+
* @api
|
|
254
|
+
*/
|
|
255
|
+
Geolocation.prototype.getAccuracyGeometry = function () {
|
|
256
|
+
return /** @type {?import("./geom/Polygon.js").default} */ (this.get(Property.ACCURACY_GEOMETRY) || null);
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Get the altitude associated with the position.
|
|
260
|
+
* @return {number|undefined} The altitude of the position in meters above mean
|
|
261
|
+
* sea level.
|
|
262
|
+
* @observable
|
|
263
|
+
* @api
|
|
264
|
+
*/
|
|
265
|
+
Geolocation.prototype.getAltitude = function () {
|
|
266
|
+
return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Get the altitude accuracy of the position.
|
|
270
|
+
* @return {number|undefined} The accuracy of the altitude measurement in
|
|
271
|
+
* meters.
|
|
272
|
+
* @observable
|
|
273
|
+
* @api
|
|
274
|
+
*/
|
|
275
|
+
Geolocation.prototype.getAltitudeAccuracy = function () {
|
|
276
|
+
return /** @type {number|undefined} */ (this.get(Property.ALTITUDE_ACCURACY));
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Get the heading as radians clockwise from North.
|
|
280
|
+
* Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`
|
|
281
|
+
* is set to `true` in the tracking options.
|
|
282
|
+
* @return {number|undefined} The heading of the device in radians from north.
|
|
283
|
+
* @observable
|
|
284
|
+
* @api
|
|
285
|
+
*/
|
|
286
|
+
Geolocation.prototype.getHeading = function () {
|
|
287
|
+
return /** @type {number|undefined} */ (this.get(Property.HEADING));
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Get the position of the device.
|
|
291
|
+
* @return {import("./coordinate.js").Coordinate|undefined} The current position of the device reported
|
|
292
|
+
* in the current projection.
|
|
293
|
+
* @observable
|
|
294
|
+
* @api
|
|
295
|
+
*/
|
|
296
|
+
Geolocation.prototype.getPosition = function () {
|
|
297
|
+
return /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION));
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Get the projection associated with the position.
|
|
301
|
+
* @return {import("./proj/Projection.js").default|undefined} The projection the position is
|
|
302
|
+
* reported in.
|
|
303
|
+
* @observable
|
|
304
|
+
* @api
|
|
305
|
+
*/
|
|
306
|
+
Geolocation.prototype.getProjection = function () {
|
|
307
|
+
return /** @type {import("./proj/Projection.js").default|undefined} */ (this.get(Property.PROJECTION));
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Get the speed in meters per second.
|
|
311
|
+
* @return {number|undefined} The instantaneous speed of the device in meters
|
|
312
|
+
* per second.
|
|
313
|
+
* @observable
|
|
314
|
+
* @api
|
|
315
|
+
*/
|
|
316
|
+
Geolocation.prototype.getSpeed = function () {
|
|
317
|
+
return /** @type {number|undefined} */ (this.get(Property.SPEED));
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Determine if the device location is being tracked.
|
|
321
|
+
* @return {boolean} The device location is being tracked.
|
|
322
|
+
* @observable
|
|
323
|
+
* @api
|
|
324
|
+
*/
|
|
325
|
+
Geolocation.prototype.getTracking = function () {
|
|
326
|
+
return /** @type {boolean} */ (this.get(Property.TRACKING));
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Get the tracking options.
|
|
330
|
+
* See https://www.w3.org/TR/geolocation-API/#position-options.
|
|
331
|
+
* @return {PositionOptions|undefined} PositionOptions as defined by
|
|
332
|
+
* the [HTML5 Geolocation spec
|
|
333
|
+
* ](https://www.w3.org/TR/geolocation-API/#position_options_interface).
|
|
334
|
+
* @observable
|
|
335
|
+
* @api
|
|
336
|
+
*/
|
|
337
|
+
Geolocation.prototype.getTrackingOptions = function () {
|
|
338
|
+
return /** @type {PositionOptions|undefined} */ (this.get(Property.TRACKING_OPTIONS));
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Set the projection to use for transforming the coordinates.
|
|
342
|
+
* @param {import("./proj.js").ProjectionLike} projection The projection the position is
|
|
343
|
+
* reported in.
|
|
344
|
+
* @observable
|
|
345
|
+
* @api
|
|
346
|
+
*/
|
|
347
|
+
Geolocation.prototype.setProjection = function (projection) {
|
|
348
|
+
this.set(Property.PROJECTION, (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.get)(projection));
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Enable or disable tracking.
|
|
352
|
+
* @param {boolean} tracking Enable tracking.
|
|
353
|
+
* @observable
|
|
354
|
+
* @api
|
|
355
|
+
*/
|
|
356
|
+
Geolocation.prototype.setTracking = function (tracking) {
|
|
357
|
+
this.set(Property.TRACKING, tracking);
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Set the tracking options.
|
|
361
|
+
* See http://www.w3.org/TR/geolocation-API/#position-options.
|
|
362
|
+
* @param {PositionOptions} options PositionOptions as defined by the
|
|
363
|
+
* [HTML5 Geolocation spec
|
|
364
|
+
* ](http://www.w3.org/TR/geolocation-API/#position_options_interface).
|
|
365
|
+
* @observable
|
|
366
|
+
* @api
|
|
367
|
+
*/
|
|
368
|
+
Geolocation.prototype.setTrackingOptions = function (options) {
|
|
369
|
+
this.set(Property.TRACKING_OPTIONS, options);
|
|
370
|
+
};
|
|
371
|
+
return Geolocation;
|
|
372
|
+
}(_Object_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
|
|
373
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Geolocation);
|
|
374
|
+
//# sourceMappingURL=Geolocation.js.map
|
|
375
|
+
|
|
376
|
+
/***/ })
|
|
377
|
+
|
|
378
|
+
}])
|
|
379
|
+
//# sourceMappingURL=vendors-node_modules_ol_Geolocation_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_ol_Geolocation_js.js","mappings":";;;;;;;;;;;;;;;;;;AAAA,iBAAiB,SAAI,IAAI,SAAI;AAC7B;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD;AACA;AACA;AAC0C;AACL;AACS;AACkB;AACkC;AAC5D;AACtC;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,0BAA0B;AACzC;AACA;AACA,sCAAsC,kEAAe;AACrD;AACA,kBAAkB;AAClB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,wDAAS;AACX;AACA,aAAa,QAAQ;AACrB,cAAc,SAAS;AACvB;AACA,cAAc,iBAAiB;AAC/B;AACA,cAAc,oCAAoC;AAClD;AACA;AACA;AACA,aAAa;AACb;AACA,gCAAgC;AAChC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,wCAAwC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,2BAA2B,uDAAiB;AAC5C;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,qEAA2B,CAAC,6CAAa;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,mDAAS;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,0DAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,0BAA0B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA,gBAAgB,sCAAsC;AACtD;AACA;AACA;AACA;AACA,0BAA0B,sCAAsC;AAChE;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA,gBAAgB,gDAAgD;AAChE;AACA;AACA;AACA;AACA;AACA,0BAA0B,gDAAgD;AAC1E;AACA;AACA;AACA,gBAAgB,kDAAkD;AAClE;AACA;AACA;AACA;AACA;AACA,0BAA0B,kDAAkD;AAC5E;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2BAA2B;AACrD;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA;AACA;AACA;AACA,sCAAsC,6CAAa;AACnD;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,kDAAU;AACZ,iEAAe,WAAW,EAAC;AAC3B","sources":["webpack://@vaadin/bundles/./node_modules/ol/Geolocation.js"],"sourcesContent":["var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * @module ol/Geolocation\n */\nimport BaseEvent from './events/Event.js';\nimport BaseObject from './Object.js';\nimport EventType from './events/EventType.js';\nimport { circular as circularPolygon } from './geom/Polygon.js';\nimport { get as getProjection, getTransformFromProjections, identityTransform, } from './proj.js';\nimport { toRadians } from './math.js';\n/**\n * @enum {string}\n */\nvar Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n/**\n * @classdesc\n * Events emitted on Geolocation error.\n */\nvar GeolocationError = /** @class */ (function (_super) {\n __extends(GeolocationError, _super);\n /**\n * @param {GeolocationPositionError} error error object.\n */\n function GeolocationError(error) {\n var _this = _super.call(this, EventType.ERROR) || this;\n /**\n * @type {number}\n */\n _this.code = error.code;\n /**\n * @type {string}\n */\n _this.message = error.message;\n return _this;\n }\n return GeolocationError;\n}(BaseEvent));\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|\n * 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|\n * 'change:trackingOptions'} GeolocationObjectEventTypes\n */\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<GeolocationObjectEventTypes, import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").OnSignature<'error', GeolocationError, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|GeolocationObjectEventTypes|\n * 'error', Return>} GeolocationOnSignature\n */\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](https://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes, register a listener for the generic\n * `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * var geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * window.console.log(geolocation.getPosition());\n * });\n *\n * @fires module:ol/events/Event~BaseEvent#event:error\n * @api\n */\nvar Geolocation = /** @class */ (function (_super) {\n __extends(Geolocation, _super);\n /**\n * @param {Options} [opt_options] Options.\n */\n function Geolocation(opt_options) {\n var _this = _super.call(this) || this;\n /***\n * @type {GeolocationOnSignature<import(\"./events\").EventsKey>}\n */\n _this.on;\n /***\n * @type {GeolocationOnSignature<import(\"./events\").EventsKey>}\n */\n _this.once;\n /***\n * @type {GeolocationOnSignature<void>}\n */\n _this.un;\n var options = opt_options || {};\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n _this.position_ = null;\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n _this.transform_ = identityTransform;\n /**\n * @private\n * @type {number|undefined}\n */\n _this.watchId_ = undefined;\n _this.addChangeListener(Property.PROJECTION, _this.handleProjectionChanged_);\n _this.addChangeListener(Property.TRACKING, _this.handleTrackingChanged_);\n if (options.projection !== undefined) {\n _this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n _this.setTrackingOptions(options.trackingOptions);\n }\n _this.setTracking(options.tracking !== undefined ? options.tracking : false);\n return _this;\n }\n /**\n * Clean up.\n */\n Geolocation.prototype.disposeInternal = function () {\n this.setTracking(false);\n _super.prototype.disposeInternal.call(this);\n };\n /**\n * @private\n */\n Geolocation.prototype.handleProjectionChanged_ = function () {\n var projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(getProjection('EPSG:4326'), projection);\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n };\n /**\n * @private\n */\n Geolocation.prototype.handleTrackingChanged_ = function () {\n if ('geolocation' in navigator) {\n var tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(this.positionChange_.bind(this), this.positionError_.bind(this), this.getTrackingOptions());\n }\n else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n };\n /**\n * @private\n * @param {GeolocationPosition} position position event.\n */\n Geolocation.prototype.positionChange_ = function (position) {\n var coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(Property.ALTITUDE, coords.altitude === null ? undefined : coords.altitude);\n this.set(Property.ALTITUDE_ACCURACY, coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy);\n this.set(Property.HEADING, coords.heading === null ? undefined : toRadians(coords.heading));\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n }\n else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n var projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition);\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n var geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n };\n /**\n * @private\n * @param {GeolocationPositionError} error error object.\n */\n Geolocation.prototype.positionError_ = function (error) {\n this.dispatchEvent(new GeolocationError(error));\n };\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n Geolocation.prototype.getAccuracy = function () {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n };\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n Geolocation.prototype.getAccuracyGeometry = function () {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (this.get(Property.ACCURACY_GEOMETRY) || null);\n };\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n Geolocation.prototype.getAltitude = function () {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n };\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n Geolocation.prototype.getAltitudeAccuracy = function () {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE_ACCURACY));\n };\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n Geolocation.prototype.getHeading = function () {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n };\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n Geolocation.prototype.getPosition = function () {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (this.get(Property.POSITION));\n };\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n Geolocation.prototype.getProjection = function () {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (this.get(Property.PROJECTION));\n };\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n Geolocation.prototype.getSpeed = function () {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n };\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n Geolocation.prototype.getTracking = function () {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n };\n /**\n * Get the tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](https://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n Geolocation.prototype.getTrackingOptions = function () {\n return /** @type {PositionOptions|undefined} */ (this.get(Property.TRACKING_OPTIONS));\n };\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n Geolocation.prototype.setProjection = function (projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n };\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n Geolocation.prototype.setTracking = function (tracking) {\n this.set(Property.TRACKING, tracking);\n };\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n Geolocation.prototype.setTrackingOptions = function (options) {\n this.set(Property.TRACKING_OPTIONS, options);\n };\n return Geolocation;\n}(BaseObject));\nexport default Geolocation;\n//# sourceMappingURL=Geolocation.js.map"],"names":[],"sourceRoot":""}
|