mobility-toolbox-js 3.0.0-beta.3 → 3.0.0-beta.5
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/mbt.js +119 -117
- package/mbt.js.map +3 -3
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/MaplibreStyleLayer.js +15 -13
- package/ol/mixins/PropertiesLayerMixin.js +1 -1
- package/package.json +1 -1
package/mbt.js
CHANGED
|
@@ -20122,11 +20122,11 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
20122
20122
|
var removeDuplicate_default = removeDuplicate;
|
|
20123
20123
|
|
|
20124
20124
|
// src/common/utils/getMapGlCopyrights.ts
|
|
20125
|
-
var getMapGlCopyrights = (
|
|
20126
|
-
if (!
|
|
20125
|
+
var getMapGlCopyrights = (map) => {
|
|
20126
|
+
if (!map) {
|
|
20127
20127
|
return [];
|
|
20128
20128
|
}
|
|
20129
|
-
const { style } =
|
|
20129
|
+
const { style } = map;
|
|
20130
20130
|
if (!style) {
|
|
20131
20131
|
return [];
|
|
20132
20132
|
}
|
|
@@ -28737,9 +28737,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
28737
28737
|
*/
|
|
28738
28738
|
isVisible(view) {
|
|
28739
28739
|
let frameState;
|
|
28740
|
-
const
|
|
28741
|
-
if (!view &&
|
|
28742
|
-
view =
|
|
28740
|
+
const map = this.getMapInternal();
|
|
28741
|
+
if (!view && map) {
|
|
28742
|
+
view = map.getView();
|
|
28743
28743
|
}
|
|
28744
28744
|
if (view instanceof View_default) {
|
|
28745
28745
|
frameState = {
|
|
@@ -28749,8 +28749,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
28749
28749
|
} else {
|
|
28750
28750
|
frameState = view;
|
|
28751
28751
|
}
|
|
28752
|
-
if (!frameState.layerStatesArray &&
|
|
28753
|
-
frameState.layerStatesArray =
|
|
28752
|
+
if (!frameState.layerStatesArray && map) {
|
|
28753
|
+
frameState.layerStatesArray = map.getLayerGroup().getLayerStatesArray();
|
|
28754
28754
|
}
|
|
28755
28755
|
let layerState;
|
|
28756
28756
|
if (frameState.layerStatesArray) {
|
|
@@ -28836,11 +28836,11 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
28836
28836
|
* For use inside the library only.
|
|
28837
28837
|
* @param {import("../Map.js").default|null} map Map.
|
|
28838
28838
|
*/
|
|
28839
|
-
setMapInternal(
|
|
28840
|
-
if (!
|
|
28839
|
+
setMapInternal(map) {
|
|
28840
|
+
if (!map) {
|
|
28841
28841
|
this.unrender();
|
|
28842
28842
|
}
|
|
28843
|
-
this.set(Property_default.MAP,
|
|
28843
|
+
this.set(Property_default.MAP, map);
|
|
28844
28844
|
}
|
|
28845
28845
|
/**
|
|
28846
28846
|
* For use inside the library only.
|
|
@@ -28860,21 +28860,21 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
28860
28860
|
* @param {import("../Map.js").default|null} map Map.
|
|
28861
28861
|
* @api
|
|
28862
28862
|
*/
|
|
28863
|
-
setMap(
|
|
28863
|
+
setMap(map) {
|
|
28864
28864
|
if (this.mapPrecomposeKey_) {
|
|
28865
28865
|
unlistenByKey(this.mapPrecomposeKey_);
|
|
28866
28866
|
this.mapPrecomposeKey_ = null;
|
|
28867
28867
|
}
|
|
28868
|
-
if (!
|
|
28868
|
+
if (!map) {
|
|
28869
28869
|
this.changed();
|
|
28870
28870
|
}
|
|
28871
28871
|
if (this.mapRenderKey_) {
|
|
28872
28872
|
unlistenByKey(this.mapRenderKey_);
|
|
28873
28873
|
this.mapRenderKey_ = null;
|
|
28874
28874
|
}
|
|
28875
|
-
if (
|
|
28875
|
+
if (map) {
|
|
28876
28876
|
this.mapPrecomposeKey_ = listen(
|
|
28877
|
-
|
|
28877
|
+
map,
|
|
28878
28878
|
EventType_default2.PRECOMPOSE,
|
|
28879
28879
|
function(evt) {
|
|
28880
28880
|
const renderEvent = (
|
|
@@ -28893,7 +28893,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
28893
28893
|
},
|
|
28894
28894
|
this
|
|
28895
28895
|
);
|
|
28896
|
-
this.mapRenderKey_ = listen(this, EventType_default.CHANGE,
|
|
28896
|
+
this.mapRenderKey_ = listen(this, EventType_default.CHANGE, map.render, map);
|
|
28897
28897
|
this.changed();
|
|
28898
28898
|
}
|
|
28899
28899
|
}
|
|
@@ -29097,7 +29097,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
29097
29097
|
* @param {import("../Map.js").default|null} map Map.
|
|
29098
29098
|
* @api
|
|
29099
29099
|
*/
|
|
29100
|
-
setMap(
|
|
29100
|
+
setMap(map) {
|
|
29101
29101
|
if (this.map_) {
|
|
29102
29102
|
removeNode(this.element);
|
|
29103
29103
|
}
|
|
@@ -29105,16 +29105,16 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
29105
29105
|
unlistenByKey(this.listenerKeys[i]);
|
|
29106
29106
|
}
|
|
29107
29107
|
this.listenerKeys.length = 0;
|
|
29108
|
-
this.map_ =
|
|
29109
|
-
if (
|
|
29110
|
-
const target = this.target_ ? this.target_ :
|
|
29108
|
+
this.map_ = map;
|
|
29109
|
+
if (map) {
|
|
29110
|
+
const target = this.target_ ? this.target_ : map.getOverlayContainerStopEvent();
|
|
29111
29111
|
target.appendChild(this.element);
|
|
29112
29112
|
if (this.render !== VOID) {
|
|
29113
29113
|
this.listenerKeys.push(
|
|
29114
|
-
listen(
|
|
29114
|
+
listen(map, MapEventType_default.POSTRENDER, this.render, this)
|
|
29115
29115
|
);
|
|
29116
29116
|
}
|
|
29117
|
-
|
|
29117
|
+
map.render();
|
|
29118
29118
|
}
|
|
29119
29119
|
}
|
|
29120
29120
|
/**
|
|
@@ -42508,8 +42508,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
42508
42508
|
* the map here.
|
|
42509
42509
|
* @param {import("../Map.js").default|null} map Map.
|
|
42510
42510
|
*/
|
|
42511
|
-
setMap(
|
|
42512
|
-
this.map_ =
|
|
42511
|
+
setMap(map) {
|
|
42512
|
+
this.map_ = map;
|
|
42513
42513
|
}
|
|
42514
42514
|
};
|
|
42515
42515
|
var Interaction_default = Interaction;
|
|
@@ -42798,9 +42798,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
42798
42798
|
writer(feature2, geometry);
|
|
42799
42799
|
}
|
|
42800
42800
|
}
|
|
42801
|
-
const
|
|
42802
|
-
if (
|
|
42803
|
-
this.handlePointerAtPixel_(this.lastPixel_,
|
|
42801
|
+
const map = this.getMap();
|
|
42802
|
+
if (map && map.isRendered() && this.getActive()) {
|
|
42803
|
+
this.handlePointerAtPixel_(this.lastPixel_, map);
|
|
42804
42804
|
}
|
|
42805
42805
|
feature2.addEventListener(EventType_default.CHANGE, this.boundHandleFeatureChange_);
|
|
42806
42806
|
}
|
|
@@ -42896,9 +42896,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
42896
42896
|
* the map here.
|
|
42897
42897
|
* @param {import("../Map.js").default} map Map.
|
|
42898
42898
|
*/
|
|
42899
|
-
setMap(
|
|
42900
|
-
this.overlay_.setMap(
|
|
42901
|
-
super.setMap(
|
|
42899
|
+
setMap(map) {
|
|
42900
|
+
this.overlay_.setMap(map);
|
|
42901
|
+
super.setMap(map);
|
|
42902
42902
|
}
|
|
42903
42903
|
/**
|
|
42904
42904
|
* Get the overlay layer that this interaction renders the modification point or vertex to.
|
|
@@ -43419,9 +43419,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
43419
43419
|
* @param {import("../coordinate.js").Coordinate} [coordinate] The pixel Coordinate.
|
|
43420
43420
|
* @private
|
|
43421
43421
|
*/
|
|
43422
|
-
handlePointerAtPixel_(pixel,
|
|
43423
|
-
const pixelCoordinate = coordinate ||
|
|
43424
|
-
const projection =
|
|
43422
|
+
handlePointerAtPixel_(pixel, map, coordinate) {
|
|
43423
|
+
const pixelCoordinate = coordinate || map.getCoordinateFromPixel(pixel);
|
|
43424
|
+
const projection = map.getView().getProjection();
|
|
43425
43425
|
const sortByDistance = function(a, b) {
|
|
43426
43426
|
return projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) - projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection);
|
|
43427
43427
|
};
|
|
@@ -43429,7 +43429,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
43429
43429
|
let hitPointGeometry;
|
|
43430
43430
|
if (this.hitDetection_) {
|
|
43431
43431
|
const layerFilter = typeof this.hitDetection_ === "object" ? (layer) => layer === this.hitDetection_ : void 0;
|
|
43432
|
-
|
|
43432
|
+
map.forEachFeatureAtPixel(
|
|
43433
43433
|
pixel,
|
|
43434
43434
|
(feature2, layer, geometry) => {
|
|
43435
43435
|
if (geometry && geometry.getType() === "Point") {
|
|
@@ -43463,7 +43463,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
43463
43463
|
createOrUpdateFromCoordinate(pixelCoordinate, tempExtent),
|
|
43464
43464
|
projection
|
|
43465
43465
|
);
|
|
43466
|
-
const buffer2 =
|
|
43466
|
+
const buffer2 = map.getView().getResolution() * this.pixelTolerance_;
|
|
43467
43467
|
const box = toUserExtent(
|
|
43468
43468
|
buffer(viewExtent, buffer2, tempExtent),
|
|
43469
43469
|
projection
|
|
@@ -43474,7 +43474,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
43474
43474
|
const node = nodes.sort(sortByDistance)[0];
|
|
43475
43475
|
const closestSegment = node.segment;
|
|
43476
43476
|
let vertex = closestOnSegmentData(pixelCoordinate, node, projection);
|
|
43477
|
-
const vertexPixel =
|
|
43477
|
+
const vertexPixel = map.getPixelFromCoordinate(vertex);
|
|
43478
43478
|
let dist = distance(pixel, vertexPixel);
|
|
43479
43479
|
if (hitPointGeometry || dist <= this.pixelTolerance_) {
|
|
43480
43480
|
const vertexSegments = {};
|
|
@@ -43491,8 +43491,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
43491
43491
|
[node.geometry]
|
|
43492
43492
|
);
|
|
43493
43493
|
} else {
|
|
43494
|
-
const pixel1 =
|
|
43495
|
-
const pixel2 =
|
|
43494
|
+
const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
|
43495
|
+
const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
|
43496
43496
|
const squaredDist1 = squaredDistance2(vertexPixel, pixel1);
|
|
43497
43497
|
const squaredDist2 = squaredDistance2(vertexPixel, pixel2);
|
|
43498
43498
|
dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
|
@@ -44808,8 +44808,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
44808
44808
|
*
|
|
44809
44809
|
* @private
|
|
44810
44810
|
*/
|
|
44811
|
-
static getGraphsResolutions(graphs,
|
|
44812
|
-
const view =
|
|
44811
|
+
static getGraphsResolutions(graphs, map) {
|
|
44812
|
+
const view = map.getView();
|
|
44813
44813
|
return graphs.map(([, minZoom, maxZoom]) => [
|
|
44814
44814
|
view.getResolutionForZoom(minZoom),
|
|
44815
44815
|
view.getResolutionForZoom(maxZoom || minZoom + 1)
|
|
@@ -45227,39 +45227,39 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45227
45227
|
unByKey(this.onMapClickKey);
|
|
45228
45228
|
}
|
|
45229
45229
|
}
|
|
45230
|
-
setMap(
|
|
45231
|
-
super.setMap(
|
|
45232
|
-
if (
|
|
45230
|
+
setMap(map) {
|
|
45231
|
+
super.setMap(map);
|
|
45232
|
+
if (map && this.active) {
|
|
45233
45233
|
this.activate();
|
|
45234
|
-
} else if (!
|
|
45234
|
+
} else if (!map) {
|
|
45235
45235
|
this.active = false;
|
|
45236
45236
|
}
|
|
45237
45237
|
}
|
|
45238
45238
|
activate() {
|
|
45239
|
-
const
|
|
45240
|
-
if (
|
|
45239
|
+
const map = this.getMap();
|
|
45240
|
+
if (map) {
|
|
45241
45241
|
this.format = new GeoJSON_default({
|
|
45242
|
-
featureProjection:
|
|
45242
|
+
featureProjection: map.getView().getProjection()
|
|
45243
45243
|
});
|
|
45244
45244
|
this.graphsResolutions = _RoutingControl.getGraphsResolutions(
|
|
45245
45245
|
this.graphs,
|
|
45246
|
-
|
|
45246
|
+
map
|
|
45247
45247
|
);
|
|
45248
45248
|
if (this.modifyInteraction) {
|
|
45249
|
-
|
|
45249
|
+
map.removeInteraction(this.modifyInteraction);
|
|
45250
45250
|
}
|
|
45251
45251
|
if (this.modifyInteraction) {
|
|
45252
|
-
|
|
45252
|
+
map.addInteraction(this.modifyInteraction);
|
|
45253
45253
|
}
|
|
45254
45254
|
this.modifyInteraction?.setActive(this.modify);
|
|
45255
45255
|
this.addListeners();
|
|
45256
45256
|
}
|
|
45257
45257
|
}
|
|
45258
45258
|
deactivate() {
|
|
45259
|
-
const
|
|
45260
|
-
if (
|
|
45259
|
+
const map = this.getMap();
|
|
45260
|
+
if (map) {
|
|
45261
45261
|
if (this.modifyInteraction) {
|
|
45262
|
-
|
|
45262
|
+
map.removeInteraction(this.modifyInteraction);
|
|
45263
45263
|
}
|
|
45264
45264
|
this.removeListeners();
|
|
45265
45265
|
this.reset();
|
|
@@ -45531,10 +45531,10 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45531
45531
|
set visible(newValue) {
|
|
45532
45532
|
this.setVisible(newValue);
|
|
45533
45533
|
}
|
|
45534
|
-
setMapInternal(
|
|
45535
|
-
super.setMapInternal(
|
|
45536
|
-
if (
|
|
45537
|
-
this.attachToMap(
|
|
45534
|
+
setMapInternal(map) {
|
|
45535
|
+
super.setMapInternal(map);
|
|
45536
|
+
if (map) {
|
|
45537
|
+
this.attachToMap(map);
|
|
45538
45538
|
} else {
|
|
45539
45539
|
this.detachFromMap();
|
|
45540
45540
|
}
|
|
@@ -45585,11 +45585,11 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45585
45585
|
*
|
|
45586
45586
|
* @param {ol/Map~Map} map A map.
|
|
45587
45587
|
*/
|
|
45588
|
-
attachToMap(
|
|
45588
|
+
attachToMap(map) {
|
|
45589
45589
|
(super.attachToMap || (() => {
|
|
45590
|
-
}))(
|
|
45590
|
+
}))(map);
|
|
45591
45591
|
(this.get("children") || []).forEach((child) => {
|
|
45592
|
-
|
|
45592
|
+
map.addLayer(child);
|
|
45593
45593
|
});
|
|
45594
45594
|
}
|
|
45595
45595
|
/**
|
|
@@ -45600,7 +45600,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45600
45600
|
this.map.removeLayer(child);
|
|
45601
45601
|
});
|
|
45602
45602
|
(super.detachFromMap || (() => {
|
|
45603
|
-
}))(
|
|
45603
|
+
}))();
|
|
45604
45604
|
}
|
|
45605
45605
|
/**
|
|
45606
45606
|
* Return the an array containing all the descendants of the layer in a flat array. Including the current layer.
|
|
@@ -45680,8 +45680,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45680
45680
|
* Initialize the layer and listen to feature clicks.
|
|
45681
45681
|
* @param {ol/Map~Map} map
|
|
45682
45682
|
*/
|
|
45683
|
-
attachToMap(
|
|
45684
|
-
super.attachToMap(
|
|
45683
|
+
attachToMap(map) {
|
|
45684
|
+
super.attachToMap(map);
|
|
45685
45685
|
this.loadMbMap();
|
|
45686
45686
|
const updateMbMapDebounced = (0, import_lodash.default)(this.updateMbMap.bind(this), 150);
|
|
45687
45687
|
this.olListenersKeys.push(
|
|
@@ -45775,9 +45775,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45775
45775
|
return [];
|
|
45776
45776
|
}
|
|
45777
45777
|
const layer = this.getLayer();
|
|
45778
|
-
const
|
|
45778
|
+
const map = layer.getMapInternal();
|
|
45779
45779
|
const { mbMap } = layer;
|
|
45780
|
-
const projection =
|
|
45780
|
+
const projection = map?.getView()?.getProjection()?.getCode() || "EPSG:3857";
|
|
45781
45781
|
let features = [];
|
|
45782
45782
|
if (!formats[projection]) {
|
|
45783
45783
|
formats[projection] = new GeoJSON_default({
|
|
@@ -45820,8 +45820,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45820
45820
|
}
|
|
45821
45821
|
renderFrame(frameState) {
|
|
45822
45822
|
const layer = this.getLayer();
|
|
45823
|
-
const { map
|
|
45824
|
-
if (!layer || !
|
|
45823
|
+
const { map, mbMap } = layer;
|
|
45824
|
+
if (!layer || !map || !mbMap) {
|
|
45825
45825
|
return null;
|
|
45826
45826
|
}
|
|
45827
45827
|
const canvas2 = mbMap.getCanvas();
|
|
@@ -45834,7 +45834,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45834
45834
|
bearing: toDegrees(-viewState.rotation)
|
|
45835
45835
|
});
|
|
45836
45836
|
if (!canvas2.isConnected) {
|
|
45837
|
-
|
|
45837
|
+
map.render();
|
|
45838
45838
|
} else if (canvas2.width !== frameState.size[0] || canvas2.height !== frameState.size[1]) {
|
|
45839
45839
|
mbMap.resize();
|
|
45840
45840
|
}
|
|
@@ -45911,9 +45911,9 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45911
45911
|
return [];
|
|
45912
45912
|
}
|
|
45913
45913
|
const layer = this.getLayer();
|
|
45914
|
-
const
|
|
45914
|
+
const map = layer.getMapInternal();
|
|
45915
45915
|
const { maplibreMap } = layer.maplibreLayer;
|
|
45916
|
-
const projection =
|
|
45916
|
+
const projection = map?.getView()?.getProjection()?.getCode() || "EPSG:3857";
|
|
45917
45917
|
let features = [];
|
|
45918
45918
|
if (!formats2[projection]) {
|
|
45919
45919
|
formats2[projection] = new GeoJSON_default({
|
|
@@ -46078,27 +46078,29 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
46078
46078
|
* @param {ol/Map~Map} map the Maplibre map.
|
|
46079
46079
|
* @override
|
|
46080
46080
|
*/
|
|
46081
|
-
attachToMap(
|
|
46081
|
+
attachToMap(map) {
|
|
46082
46082
|
if (this.maplibreLayer && !this.maplibreLayer.map) {
|
|
46083
|
-
|
|
46083
|
+
map.addLayer(this.maplibreLayer);
|
|
46084
46084
|
}
|
|
46085
|
-
super.attachToMap(
|
|
46085
|
+
super.attachToMap(map);
|
|
46086
46086
|
if (!this.map || !this.maplibreLayer) {
|
|
46087
46087
|
return;
|
|
46088
46088
|
}
|
|
46089
|
-
|
|
46090
|
-
if (!maplibreMap) {
|
|
46089
|
+
if (!this.map.getTargetElement()) {
|
|
46091
46090
|
this.olListenersKeys.push(
|
|
46092
46091
|
this.map.on("change:target", () => {
|
|
46093
|
-
this.attachToMap(
|
|
46092
|
+
this.attachToMap(map);
|
|
46094
46093
|
})
|
|
46095
46094
|
);
|
|
46096
46095
|
return;
|
|
46097
46096
|
}
|
|
46098
|
-
|
|
46099
|
-
|
|
46100
|
-
|
|
46101
|
-
|
|
46097
|
+
const { maplibreMap } = this.maplibreLayer;
|
|
46098
|
+
if (maplibreMap) {
|
|
46099
|
+
if (maplibreMap.loaded()) {
|
|
46100
|
+
this.onLoad();
|
|
46101
|
+
} else {
|
|
46102
|
+
maplibreMap.once("load", this.onLoad);
|
|
46103
|
+
}
|
|
46102
46104
|
}
|
|
46103
46105
|
this.olListenersKeys.push(
|
|
46104
46106
|
// @ts-expect-error 'load' is a custom event form mobility-toolbox-js
|
|
@@ -46109,7 +46111,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
46109
46111
|
this.on("propertychange", (evt) => {
|
|
46110
46112
|
if (/(sources|layers|layersFilter|maplibreLayer|beforeId|)/.test(evt.key)) {
|
|
46111
46113
|
this.detachFromMap();
|
|
46112
|
-
this.attachToMap(
|
|
46114
|
+
this.attachToMap(map);
|
|
46113
46115
|
}
|
|
46114
46116
|
})
|
|
46115
46117
|
);
|
|
@@ -46628,8 +46630,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
46628
46630
|
// },
|
|
46629
46631
|
});
|
|
46630
46632
|
}
|
|
46631
|
-
attachToMap(
|
|
46632
|
-
super.attachToMap(
|
|
46633
|
+
attachToMap(map) {
|
|
46634
|
+
super.attachToMap(map);
|
|
46633
46635
|
document.addEventListener(
|
|
46634
46636
|
"visibilitychange",
|
|
46635
46637
|
this.onDocumentVisibilityChange
|
|
@@ -47333,8 +47335,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47333
47335
|
return [];
|
|
47334
47336
|
}
|
|
47335
47337
|
const layer = this.getLayer();
|
|
47336
|
-
const
|
|
47337
|
-
const resolution =
|
|
47338
|
+
const map = layer.getMapInternal();
|
|
47339
|
+
const resolution = map.getView().getResolution();
|
|
47338
47340
|
const nb = 10;
|
|
47339
47341
|
const ext = buffer(
|
|
47340
47342
|
[...coordinate, ...coordinate],
|
|
@@ -47410,8 +47412,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47410
47412
|
return new RealtimeLayerRenderer(this);
|
|
47411
47413
|
}
|
|
47412
47414
|
/** @private */
|
|
47413
|
-
attachToMap(
|
|
47414
|
-
super.attachToMap(
|
|
47415
|
+
attachToMap(map) {
|
|
47416
|
+
super.attachToMap(map);
|
|
47415
47417
|
if (this.map) {
|
|
47416
47418
|
if (this.visible) {
|
|
47417
47419
|
this.start();
|
|
@@ -47672,8 +47674,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47672
47674
|
abortControllers = {};
|
|
47673
47675
|
const flatLayers = getLayersAsFlatArray_default(layers);
|
|
47674
47676
|
const promises = flatLayers.map((layer) => {
|
|
47675
|
-
const
|
|
47676
|
-
const projection =
|
|
47677
|
+
const map = layer.getMapInternal();
|
|
47678
|
+
const projection = map?.getView()?.getProjection()?.getCode();
|
|
47677
47679
|
const emptyResponse = { features: [], layer, coordinate };
|
|
47678
47680
|
if (!projection) {
|
|
47679
47681
|
return Promise.resolve(emptyResponse);
|
|
@@ -47686,7 +47688,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47686
47688
|
const id = getUid(void 0);
|
|
47687
47689
|
abortControllers[id]?.abort();
|
|
47688
47690
|
abortControllers[id] = new AbortController();
|
|
47689
|
-
const resolution =
|
|
47691
|
+
const resolution = map?.getView()?.getResolution();
|
|
47690
47692
|
return getFeaturesFromWMS(
|
|
47691
47693
|
source,
|
|
47692
47694
|
{
|
|
@@ -47713,11 +47715,11 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47713
47715
|
};
|
|
47714
47716
|
});
|
|
47715
47717
|
}
|
|
47716
|
-
const pixel =
|
|
47718
|
+
const pixel = map?.getPixelFromCoordinate(coordinate);
|
|
47717
47719
|
if (!pixel) {
|
|
47718
47720
|
return Promise.resolve(emptyResponse);
|
|
47719
47721
|
}
|
|
47720
|
-
const features =
|
|
47722
|
+
const features = map?.getFeaturesAtPixel(pixel, {
|
|
47721
47723
|
layerFilter: (l) => l === layer,
|
|
47722
47724
|
hitTolerance: (
|
|
47723
47725
|
// @ts-ignore
|
|
@@ -47780,8 +47782,8 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47780
47782
|
constructor(options = {}) {
|
|
47781
47783
|
this.options = options;
|
|
47782
47784
|
}
|
|
47783
|
-
onAdd(
|
|
47784
|
-
this.map =
|
|
47785
|
+
onAdd(map) {
|
|
47786
|
+
this.map = map;
|
|
47785
47787
|
if (!this.container) {
|
|
47786
47788
|
this.container = document.createElement("div");
|
|
47787
47789
|
}
|
|
@@ -47884,10 +47886,10 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
47884
47886
|
this.type = "custom";
|
|
47885
47887
|
}
|
|
47886
47888
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47887
|
-
onAdd(
|
|
47888
|
-
this.map =
|
|
47889
|
+
onAdd(map, gl) {
|
|
47890
|
+
this.map = map;
|
|
47889
47891
|
}
|
|
47890
|
-
onRemove(
|
|
47892
|
+
onRemove(map, gl) {
|
|
47891
47893
|
this.map = void 0;
|
|
47892
47894
|
}
|
|
47893
47895
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -48400,15 +48402,15 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
48400
48402
|
var es_default6 = transformRotate;
|
|
48401
48403
|
|
|
48402
48404
|
// src/maplibre/utils/getSourceCoordinates.ts
|
|
48403
|
-
var getSourceCoordinates = (
|
|
48404
|
-
const { width, height } =
|
|
48405
|
-
const leftTop =
|
|
48406
|
-
const leftBottom =
|
|
48407
|
-
const rightBottom =
|
|
48405
|
+
var getSourceCoordinates = (map, pixelRatio = 1) => {
|
|
48406
|
+
const { width, height } = map.getCanvas();
|
|
48407
|
+
const leftTop = map.unproject({ x: 0, y: 0 });
|
|
48408
|
+
const leftBottom = map.unproject({ x: 0, y: height / pixelRatio });
|
|
48409
|
+
const rightBottom = map.unproject({
|
|
48408
48410
|
x: width / pixelRatio,
|
|
48409
48411
|
y: height / pixelRatio
|
|
48410
48412
|
});
|
|
48411
|
-
const rightTop =
|
|
48413
|
+
const rightTop = map.unproject({ x: width / pixelRatio, y: 0 });
|
|
48412
48414
|
return [
|
|
48413
48415
|
[leftTop.lng, leftTop.lat],
|
|
48414
48416
|
[rightTop.lng, rightTop.lat],
|
|
@@ -48419,12 +48421,12 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
48419
48421
|
var getSourceCoordinates_default = getSourceCoordinates;
|
|
48420
48422
|
|
|
48421
48423
|
// src/maplibre/utils/getMercatorResolution.ts
|
|
48422
|
-
var getMercatorResolution = (
|
|
48423
|
-
const bounds =
|
|
48424
|
+
var getMercatorResolution = (map) => {
|
|
48425
|
+
const bounds = map.getBounds().toArray();
|
|
48424
48426
|
const a = fromLonLat(bounds[0]);
|
|
48425
48427
|
const b = fromLonLat(bounds[1]);
|
|
48426
48428
|
const extent = [...a, ...b];
|
|
48427
|
-
const { width, height } =
|
|
48429
|
+
const { width, height } = map.getCanvas();
|
|
48428
48430
|
const xResolution = getWidth(extent) / width;
|
|
48429
48431
|
const yResolution = getHeight(extent) / height;
|
|
48430
48432
|
return Math.max(xResolution, yResolution);
|
|
@@ -48491,25 +48493,25 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
48491
48493
|
/**
|
|
48492
48494
|
* Add sources, layers and listeners to the map.
|
|
48493
48495
|
*/
|
|
48494
|
-
onAdd(
|
|
48495
|
-
super.onAdd(
|
|
48496
|
-
if (
|
|
48496
|
+
onAdd(map, gl) {
|
|
48497
|
+
super.onAdd(map, gl);
|
|
48498
|
+
if (map.isStyleLoaded()) {
|
|
48497
48499
|
this.onLoad();
|
|
48498
48500
|
}
|
|
48499
|
-
|
|
48501
|
+
map.on("load", this.onLoad);
|
|
48500
48502
|
}
|
|
48501
48503
|
/**
|
|
48502
48504
|
* Remove source, layers and listeners from the map.
|
|
48503
48505
|
*/
|
|
48504
|
-
onRemove(
|
|
48505
|
-
|
|
48506
|
-
if (
|
|
48507
|
-
|
|
48506
|
+
onRemove(map, gl) {
|
|
48507
|
+
map.off("load", this.onLoad);
|
|
48508
|
+
if (map.getLayer(this.layer.id)) {
|
|
48509
|
+
map.removeLayer(this.layer.id);
|
|
48508
48510
|
}
|
|
48509
|
-
if (
|
|
48510
|
-
|
|
48511
|
+
if (map.getSource(this.id)) {
|
|
48512
|
+
map.removeSource(this.id);
|
|
48511
48513
|
}
|
|
48512
|
-
super.onRemove(
|
|
48514
|
+
super.onRemove(map, gl);
|
|
48513
48515
|
}
|
|
48514
48516
|
onLoad() {
|
|
48515
48517
|
if (!this.map.getSource(this.id)) {
|