mobility-toolbox-js 2.0.0-beta.47 → 2.0.0-beta.48
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/common/utils/getMapboxRender.d.ts +2 -2
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getMapboxRender.js +20 -11
- package/mapbox/index.d.ts +1 -0
- package/mapbox/index.js +1 -0
- package/mapbox/layers/Layer.d.ts +19 -7
- package/mapbox/layers/Layer.d.ts.map +1 -1
- package/mapbox/layers/Layer.js +8 -4
- package/mapbox/layers/RealtimeLayer.d.ts +112 -53
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mapbox/layers/RealtimeLayer.js +14 -8
- package/mapbox/utils/getMercatorResolution.d.ts +9 -0
- package/mapbox/utils/getMercatorResolution.d.ts.map +1 -0
- package/mapbox/utils/getMercatorResolution.js +18 -0
- package/mapbox/utils/getSourceCoordinates.d.ts +9 -0
- package/mapbox/utils/getSourceCoordinates.d.ts.map +1 -0
- package/mapbox/{utils.js → utils/getSourceCoordinates.js} +6 -22
- package/mapbox/utils/index.d.ts +3 -0
- package/mapbox/utils/index.d.ts.map +1 -0
- package/mapbox/utils/index.js +2 -0
- package/mbt.js +107 -77
- package/mbt.js.map +3 -3
- package/mbt.min.js +13 -13
- package/mbt.min.js.map +3 -3
- package/ol/layers/Layer.d.ts +4 -16
- package/ol/layers/Layer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.d.ts +11 -1
- package/ol/layers/MapboxLayer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.js +4 -4
- package/ol/layers/MapboxStyleLayer.d.ts +55 -78
- package/ol/layers/MapboxStyleLayer.d.ts.map +1 -1
- package/ol/layers/MapboxStyleLayer.js +63 -32
- package/ol/layers/VectorLayer.d.ts +6 -4
- package/ol/layers/VectorLayer.d.ts.map +1 -1
- package/ol/layers/WMSLayer.d.ts +15 -11
- package/ol/layers/WMSLayer.d.ts.map +1 -1
- package/ol/layers/WMSLayer.js +25 -9
- package/ol/styles/fullTrajectoryDelayStyle.d.ts +2 -2
- package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -1
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/common.d.ts +1 -0
- package/mapbox/utils.d.ts +0 -8
- package/mapbox/utils.d.ts.map +0 -1
package/mbt.js
CHANGED
|
@@ -35891,42 +35891,41 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
35891
35891
|
return (frameState) => {
|
|
35892
35892
|
const { map, mbMap, renderState, olLayer } = mapoxLayer;
|
|
35893
35893
|
if (!map || !mbMap) {
|
|
35894
|
-
return
|
|
35894
|
+
return document.createElement("div");
|
|
35895
35895
|
}
|
|
35896
35896
|
let changed = false;
|
|
35897
35897
|
const canvas2 = mbMap.getCanvas();
|
|
35898
35898
|
const { viewState } = frameState;
|
|
35899
|
-
const visible = olLayer
|
|
35900
|
-
if (renderState
|
|
35899
|
+
const visible = olLayer?.getVisible();
|
|
35900
|
+
if (renderState && renderState?.visible !== visible) {
|
|
35901
35901
|
canvas2.style.display = visible ? "block" : "none";
|
|
35902
35902
|
renderState.visible = visible;
|
|
35903
35903
|
canvas2.style.position = "absolute";
|
|
35904
35904
|
}
|
|
35905
|
-
const opacity = olLayer
|
|
35906
|
-
if (renderState.opacity !== opacity) {
|
|
35905
|
+
const opacity = olLayer?.getOpacity();
|
|
35906
|
+
if (canvas2 && renderState && renderState.opacity !== opacity) {
|
|
35907
35907
|
canvas2.style.opacity = opacity;
|
|
35908
35908
|
renderState.opacity = opacity;
|
|
35909
35909
|
}
|
|
35910
35910
|
const { rotation } = viewState;
|
|
35911
|
-
if (renderState.rotation !== rotation) {
|
|
35911
|
+
if (renderState && renderState.rotation !== rotation) {
|
|
35912
35912
|
mbMap.rotateTo(-(rotation || 0) * 180 / Math.PI, {
|
|
35913
35913
|
animate: false
|
|
35914
35914
|
});
|
|
35915
35915
|
changed = true;
|
|
35916
35916
|
renderState.rotation = rotation;
|
|
35917
35917
|
}
|
|
35918
|
-
if (renderState.zoom !== viewState.zoom || renderState.center[0] !== viewState.center[0] || renderState.center[1] !== viewState.center[1]) {
|
|
35918
|
+
if (renderState && renderState.center && (renderState.zoom !== viewState.zoom || renderState.center[0] !== viewState.center[0] || renderState.center[1] !== viewState.center[1])) {
|
|
35919
35919
|
mbMap.jumpTo({
|
|
35920
35920
|
center: toLonLat(viewState.center),
|
|
35921
|
-
zoom: viewState.zoom - 1
|
|
35922
|
-
animate: false
|
|
35921
|
+
zoom: viewState.zoom - 1
|
|
35923
35922
|
});
|
|
35924
35923
|
changed = true;
|
|
35925
35924
|
renderState.zoom = viewState.zoom;
|
|
35926
35925
|
renderState.center = viewState.center;
|
|
35927
35926
|
}
|
|
35928
35927
|
const size = map.getSize() || [0, 0];
|
|
35929
|
-
if (renderState.size[0] !== size[0] || renderState.size[1] !== size[1]) {
|
|
35928
|
+
if (renderState && renderState.size && (renderState.size[0] !== size[0] || renderState.size[1] !== size[1])) {
|
|
35930
35929
|
changed = true;
|
|
35931
35930
|
renderState.size = size;
|
|
35932
35931
|
}
|
|
@@ -48920,10 +48919,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48920
48919
|
}
|
|
48921
48920
|
this.renderState = {
|
|
48922
48921
|
center: [x, y],
|
|
48923
|
-
zoom:
|
|
48924
|
-
rotation:
|
|
48925
|
-
visible:
|
|
48926
|
-
opacity:
|
|
48922
|
+
zoom: void 0,
|
|
48923
|
+
rotation: void 0,
|
|
48924
|
+
visible: void 0,
|
|
48925
|
+
opacity: void 0,
|
|
48927
48926
|
size: [0, 0]
|
|
48928
48927
|
};
|
|
48929
48928
|
super.loadMbMap();
|
|
@@ -48972,9 +48971,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48972
48971
|
}
|
|
48973
48972
|
};
|
|
48974
48973
|
|
|
48975
|
-
// src/ol/layers/MapboxStyleLayer.
|
|
48974
|
+
// src/ol/layers/MapboxStyleLayer.ts
|
|
48976
48975
|
var MapboxStyleLayer = class extends Layer_default4 {
|
|
48977
|
-
constructor(options
|
|
48976
|
+
constructor(options) {
|
|
48978
48977
|
super(options);
|
|
48979
48978
|
this.mapboxLayer = options.mapboxLayer;
|
|
48980
48979
|
this.disabled = false;
|
|
@@ -48998,11 +48997,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
48998
48997
|
}
|
|
48999
48998
|
}
|
|
49000
48999
|
attachToMap(map) {
|
|
49001
|
-
if (!this.mapboxLayer.map) {
|
|
49002
|
-
this.mapboxLayer
|
|
49000
|
+
if (this.mapboxLayer && !this.mapboxLayer.map) {
|
|
49001
|
+
this.mapboxLayer?.attachToMap(map);
|
|
49003
49002
|
}
|
|
49004
49003
|
super.attachToMap(map);
|
|
49005
|
-
if (!this.map) {
|
|
49004
|
+
if (!this.map || !this.mapboxLayer) {
|
|
49006
49005
|
return;
|
|
49007
49006
|
}
|
|
49008
49007
|
const { mbMap } = this.mapboxLayer;
|
|
@@ -49024,35 +49023,36 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49024
49023
|
this.onLoad();
|
|
49025
49024
|
}));
|
|
49026
49025
|
}
|
|
49027
|
-
detachFromMap(
|
|
49028
|
-
|
|
49029
|
-
|
|
49026
|
+
detachFromMap() {
|
|
49027
|
+
if (this.mapboxLayer?.mbMap) {
|
|
49028
|
+
const { mbMap } = this.mapboxLayer;
|
|
49030
49029
|
mbMap.off("load", this.onLoad);
|
|
49031
49030
|
this.removeStyleLayers();
|
|
49032
49031
|
}
|
|
49033
|
-
super.detachFromMap(
|
|
49032
|
+
super.detachFromMap();
|
|
49034
49033
|
}
|
|
49035
49034
|
addStyleLayers() {
|
|
49036
|
-
|
|
49037
|
-
if (!mbMap) {
|
|
49035
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49038
49036
|
return;
|
|
49039
49037
|
}
|
|
49038
|
+
const { mbMap } = this.mapboxLayer;
|
|
49040
49039
|
this.styleLayers.forEach((styleLayer) => {
|
|
49041
49040
|
const { id, source } = styleLayer;
|
|
49042
|
-
if (mbMap.getSource(source) && !mbMap.getLayer(id)) {
|
|
49041
|
+
if (mbMap.getSource(source) && id && !mbMap.getLayer(id)) {
|
|
49043
49042
|
mbMap.addLayer(styleLayer, this.beforeId);
|
|
49044
49043
|
}
|
|
49045
49044
|
});
|
|
49046
49045
|
this.applyLayoutVisibility();
|
|
49047
49046
|
}
|
|
49048
49047
|
removeStyleLayers() {
|
|
49049
|
-
|
|
49050
|
-
if (!mbMap) {
|
|
49048
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49051
49049
|
return;
|
|
49052
49050
|
}
|
|
49051
|
+
const { mbMap } = this.mapboxLayer;
|
|
49053
49052
|
this.styleLayers.forEach((styleLayer) => {
|
|
49054
|
-
|
|
49055
|
-
|
|
49053
|
+
const { id } = styleLayer;
|
|
49054
|
+
if (id && mbMap.getLayer(id)) {
|
|
49055
|
+
mbMap.removeLayer(id);
|
|
49056
49056
|
}
|
|
49057
49057
|
});
|
|
49058
49058
|
}
|
|
@@ -49061,6 +49061,9 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49061
49061
|
if (this.addDynamicFilters) {
|
|
49062
49062
|
this.addDynamicFilters();
|
|
49063
49063
|
}
|
|
49064
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49065
|
+
return;
|
|
49066
|
+
}
|
|
49064
49067
|
const { mbMap } = this.mapboxLayer;
|
|
49065
49068
|
const style = mbMap.getStyle();
|
|
49066
49069
|
if (style && this.styleLayersFilter) {
|
|
@@ -49069,8 +49072,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49069
49072
|
}
|
|
49070
49073
|
}
|
|
49071
49074
|
getFeatureInfoAtCoordinate(coordinate) {
|
|
49075
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49076
|
+
return Promise.resolve({ coordinate, features: [], layer: this });
|
|
49077
|
+
}
|
|
49072
49078
|
const { mbMap } = this.mapboxLayer;
|
|
49073
|
-
if (!mbMap
|
|
49079
|
+
if (!mbMap.isStyleLoaded()) {
|
|
49074
49080
|
return Promise.resolve({ coordinate, features: [], layer: this });
|
|
49075
49081
|
}
|
|
49076
49082
|
let layers = this.styleLayers || [];
|
|
@@ -49084,23 +49090,28 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49084
49090
|
layers: layers.map((layer) => layer && layer.id),
|
|
49085
49091
|
validate: false
|
|
49086
49092
|
}).then((featureInfo) => {
|
|
49087
|
-
const features = featureInfo.features.filter((feature2) =>
|
|
49093
|
+
const features = featureInfo.features.filter((feature2) => {
|
|
49094
|
+
return this.featureInfoFilter(feature2, this.map?.getView().getResolution());
|
|
49095
|
+
});
|
|
49088
49096
|
this.highlight(features);
|
|
49089
49097
|
return { ...featureInfo, features, layer: this };
|
|
49090
49098
|
});
|
|
49091
49099
|
}
|
|
49092
49100
|
setFilter(filter) {
|
|
49093
|
-
|
|
49094
|
-
if (!mbMap) {
|
|
49101
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49095
49102
|
return;
|
|
49096
49103
|
}
|
|
49104
|
+
const { mbMap } = this.mapboxLayer;
|
|
49097
49105
|
this.styleLayers.forEach(({ id }) => {
|
|
49098
|
-
if (mbMap.getLayer(id)) {
|
|
49106
|
+
if (id && filter && mbMap.getLayer(id)) {
|
|
49099
49107
|
mbMap.setFilter(id, filter);
|
|
49100
49108
|
}
|
|
49101
49109
|
});
|
|
49102
49110
|
}
|
|
49103
49111
|
setHoverState(features, state) {
|
|
49112
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49113
|
+
return;
|
|
49114
|
+
}
|
|
49104
49115
|
const { mbMap } = this.mapboxLayer;
|
|
49105
49116
|
if (!features || !mbMap) {
|
|
49106
49117
|
return;
|
|
@@ -49121,23 +49132,23 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49121
49132
|
});
|
|
49122
49133
|
}
|
|
49123
49134
|
select(features = []) {
|
|
49124
|
-
this.setHoverState(this.selectedFeatures, false);
|
|
49135
|
+
this.setHoverState(this.selectedFeatures || [], false);
|
|
49125
49136
|
this.selectedFeatures = features;
|
|
49126
|
-
this.setHoverState(this.selectedFeatures, true);
|
|
49137
|
+
this.setHoverState(this.selectedFeatures || [], true);
|
|
49127
49138
|
}
|
|
49128
49139
|
highlight(features = []) {
|
|
49129
|
-
const filtered = this.highlightedFeatures
|
|
49140
|
+
const filtered = this.highlightedFeatures?.filter((feature2) => !(this.selectedFeatures || []).map((feat) => feat.getId()).includes(feature2.getId())) || [];
|
|
49130
49141
|
this.setHoverState(filtered, false);
|
|
49131
49142
|
this.highlightedFeatures = features;
|
|
49132
49143
|
this.setHoverState(this.highlightedFeatures, true);
|
|
49133
49144
|
}
|
|
49134
49145
|
applyLayoutVisibility(evt) {
|
|
49135
49146
|
const { visible } = this;
|
|
49136
|
-
const { mbMap } = this.mapboxLayer;
|
|
49137
49147
|
const filterFunc = this.styleLayersFilter;
|
|
49138
|
-
if (!mbMap) {
|
|
49148
|
+
if (!this.mapboxLayer?.mbMap) {
|
|
49139
49149
|
return;
|
|
49140
49150
|
}
|
|
49151
|
+
const { mbMap } = this.mapboxLayer;
|
|
49141
49152
|
const style = mbMap.getStyle();
|
|
49142
49153
|
if (!style) {
|
|
49143
49154
|
return;
|
|
@@ -49650,7 +49661,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49650
49661
|
};
|
|
49651
49662
|
var fullTrajectoryStyle_default = fullTrajectorystyle;
|
|
49652
49663
|
|
|
49653
|
-
// src/ol/styles/fullTrajectoryDelayStyle.
|
|
49664
|
+
// src/ol/styles/fullTrajectoryDelayStyle.ts
|
|
49654
49665
|
var stroke = new Style_default({
|
|
49655
49666
|
zIndex: 2,
|
|
49656
49667
|
image: new Circle_default({
|
|
@@ -49868,7 +49879,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49868
49879
|
};
|
|
49869
49880
|
var RealtimeLayer_default = RealtimeLayer;
|
|
49870
49881
|
|
|
49871
|
-
// src/ol/layers/VectorLayer.
|
|
49882
|
+
// src/ol/layers/VectorLayer.ts
|
|
49872
49883
|
var VectorLayer2 = class extends Layer_default4 {
|
|
49873
49884
|
getFeatureInfoAtCoordinate(coordinate) {
|
|
49874
49885
|
let features = [];
|
|
@@ -49891,29 +49902,40 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49891
49902
|
};
|
|
49892
49903
|
var VectorLayer_default2 = VectorLayer2;
|
|
49893
49904
|
|
|
49894
|
-
// src/ol/layers/WMSLayer.
|
|
49905
|
+
// src/ol/layers/WMSLayer.ts
|
|
49895
49906
|
var WMSLayer = class extends Layer_default4 {
|
|
49896
|
-
constructor(options
|
|
49907
|
+
constructor(options) {
|
|
49897
49908
|
super(options);
|
|
49898
49909
|
this.abortController = new AbortController();
|
|
49899
49910
|
this.format = new GeoJSON_default();
|
|
49900
49911
|
}
|
|
49901
49912
|
getFeatureInfoUrl(coord) {
|
|
49913
|
+
if (!this.map) {
|
|
49914
|
+
return;
|
|
49915
|
+
}
|
|
49902
49916
|
const projection = this.map.getView().getProjection();
|
|
49903
49917
|
const resolution = this.map.getView().getResolution();
|
|
49904
|
-
if (this.olLayer
|
|
49905
|
-
return this.olLayer
|
|
49918
|
+
if (resolution && projection && this.olLayer?.getSource()?.getFeatureInfoUrl) {
|
|
49919
|
+
return this.olLayer?.getSource()?.getFeatureInfoUrl(coord, resolution, projection, {
|
|
49906
49920
|
info_format: "application/json",
|
|
49907
|
-
query_layers: this.olLayer
|
|
49921
|
+
query_layers: this.olLayer?.getSource()?.getParams().layers
|
|
49908
49922
|
});
|
|
49909
49923
|
}
|
|
49910
|
-
return false;
|
|
49911
49924
|
}
|
|
49912
49925
|
getFeatureInfoAtCoordinate(coordinate) {
|
|
49913
|
-
this.abortController
|
|
49926
|
+
this.abortController?.abort();
|
|
49914
49927
|
this.abortController = new AbortController();
|
|
49915
49928
|
const { signal } = this.abortController;
|
|
49916
|
-
|
|
49929
|
+
const url = this.getFeatureInfoUrl(coordinate);
|
|
49930
|
+
if (!url) {
|
|
49931
|
+
console.error("No url for the WMS layer.");
|
|
49932
|
+
return Promise.resolve({
|
|
49933
|
+
features: [],
|
|
49934
|
+
coordinate,
|
|
49935
|
+
layer: this
|
|
49936
|
+
});
|
|
49937
|
+
}
|
|
49938
|
+
return fetch(url, { signal }).then((resp) => resp.json()).then((r) => r.features).then((data) => ({
|
|
49917
49939
|
layer: this,
|
|
49918
49940
|
coordinate,
|
|
49919
49941
|
features: data.map((d) => this.format.readFeature(d))
|
|
@@ -49948,6 +49970,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49948
49970
|
getMapboxMapCopyrights: () => getMapboxMapCopyrights_default,
|
|
49949
49971
|
getMapboxRender: () => getMapboxRender,
|
|
49950
49972
|
getMaplibreRender: () => getMaplibreRender,
|
|
49973
|
+
getMercatorResolution: () => getMercatorResolution_default,
|
|
49974
|
+
getSourceCoordinates: () => getSourceCoordinates_default,
|
|
49951
49975
|
getTextCanvas: () => getTextCanvas,
|
|
49952
49976
|
getUTCDateString: () => getUTCDateString,
|
|
49953
49977
|
getUTCTimeString: () => getUTCTimeString,
|
|
@@ -49990,7 +50014,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
49990
50014
|
};
|
|
49991
50015
|
var CopyrightControl_default2 = CopyrightControl2;
|
|
49992
50016
|
|
|
49993
|
-
// src/mapbox/layers/Layer.
|
|
50017
|
+
// src/mapbox/layers/Layer.ts
|
|
49994
50018
|
var Layer4 = class extends UserInteractionsLayerMixin_default(Layer2) {
|
|
49995
50019
|
attachToMap(map) {
|
|
49996
50020
|
super.attachToMap(map);
|
|
@@ -50011,10 +50035,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50011
50035
|
}
|
|
50012
50036
|
activateUserInteractions() {
|
|
50013
50037
|
this.deactivateUserInteractions();
|
|
50014
|
-
if (this.map && this.userInteractions && this.userClickInteractions && this.userClickCallbacks
|
|
50038
|
+
if (this.map && this.userInteractions && this.userClickInteractions && this.userClickCallbacks?.length) {
|
|
50015
50039
|
this.map.on("click", this.onUserClickCallback);
|
|
50016
50040
|
}
|
|
50017
|
-
if (this.map && this.userInteractions && this.userHoverInteractions && this.userHoverCallbacks
|
|
50041
|
+
if (this.map && this.userInteractions && this.userHoverInteractions && this.userHoverCallbacks?.length) {
|
|
50018
50042
|
this.map.on("mousemove", this.onUserMoveCallback);
|
|
50019
50043
|
}
|
|
50020
50044
|
}
|
|
@@ -50523,18 +50547,8 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50523
50547
|
}
|
|
50524
50548
|
var es_default6 = transformRotate;
|
|
50525
50549
|
|
|
50526
|
-
// src/mapbox/utils.
|
|
50527
|
-
var
|
|
50528
|
-
const bounds = map.getBounds().toArray();
|
|
50529
|
-
const a = fromLonLat(bounds[0]);
|
|
50530
|
-
const b = fromLonLat(bounds[1]);
|
|
50531
|
-
const extent = [...a, ...b];
|
|
50532
|
-
const { width, height } = map.getCanvas();
|
|
50533
|
-
const xResolution = getWidth(extent) / width;
|
|
50534
|
-
const yResolution = getHeight(extent) / height;
|
|
50535
|
-
return Math.max(xResolution, yResolution);
|
|
50536
|
-
};
|
|
50537
|
-
var getSourceCoordinates = (map, pixelRatio) => {
|
|
50550
|
+
// src/mapbox/utils/getSourceCoordinates.ts
|
|
50551
|
+
var getSourceCoordinates = (map, pixelRatio = 1) => {
|
|
50538
50552
|
const { width, height } = map.getCanvas();
|
|
50539
50553
|
const leftTop = map.unproject({ x: 0, y: 0 });
|
|
50540
50554
|
const leftBottom = map.unproject({ x: 0, y: height / pixelRatio });
|
|
@@ -50550,8 +50564,22 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50550
50564
|
[leftBottom.lng, leftBottom.lat]
|
|
50551
50565
|
];
|
|
50552
50566
|
};
|
|
50567
|
+
var getSourceCoordinates_default = getSourceCoordinates;
|
|
50553
50568
|
|
|
50554
|
-
// src/mapbox/
|
|
50569
|
+
// src/mapbox/utils/getMercatorResolution.ts
|
|
50570
|
+
var getMercatorResolution = (map) => {
|
|
50571
|
+
const bounds = map.getBounds().toArray();
|
|
50572
|
+
const a = fromLonLat(bounds[0]);
|
|
50573
|
+
const b = fromLonLat(bounds[1]);
|
|
50574
|
+
const extent = [...a, ...b];
|
|
50575
|
+
const { width, height } = map.getCanvas();
|
|
50576
|
+
const xResolution = getWidth(extent) / width;
|
|
50577
|
+
const yResolution = getHeight(extent) / height;
|
|
50578
|
+
return Math.max(xResolution, yResolution);
|
|
50579
|
+
};
|
|
50580
|
+
var getMercatorResolution_default = getMercatorResolution;
|
|
50581
|
+
|
|
50582
|
+
// src/mapbox/layers/RealtimeLayer.ts
|
|
50555
50583
|
var RealtimeLayer2 = class extends RealtimeLayerMixin_default(Layer_default5) {
|
|
50556
50584
|
constructor(options = {}) {
|
|
50557
50585
|
super({
|
|
@@ -50567,15 +50595,11 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50567
50595
|
if (!map) {
|
|
50568
50596
|
return;
|
|
50569
50597
|
}
|
|
50570
|
-
|
|
50571
|
-
super.attachToMap(map, {
|
|
50572
|
-
width: canvas2.width / this.pixelRatio,
|
|
50573
|
-
height: canvas2.height / this.pixelRatio
|
|
50574
|
-
});
|
|
50598
|
+
super.attachToMap(map);
|
|
50575
50599
|
this.source = {
|
|
50576
50600
|
type: "canvas",
|
|
50577
50601
|
canvas: this.canvas,
|
|
50578
|
-
coordinates:
|
|
50602
|
+
coordinates: getSourceCoordinates_default(map, this.pixelRatio),
|
|
50579
50603
|
animate: true,
|
|
50580
50604
|
attribution: this.copyrights && this.copyrights.join(", ")
|
|
50581
50605
|
};
|
|
@@ -50642,17 +50666,23 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50642
50666
|
...evt
|
|
50643
50667
|
});
|
|
50644
50668
|
}
|
|
50645
|
-
renderTrajectories(noInterpolate) {
|
|
50669
|
+
renderTrajectories(noInterpolate = false) {
|
|
50646
50670
|
if (!this.map) {
|
|
50647
50671
|
return;
|
|
50648
50672
|
}
|
|
50673
|
+
if (!this.pixelRatio) {
|
|
50674
|
+
this.pixelRatio = 1;
|
|
50675
|
+
}
|
|
50649
50676
|
const { width, height } = this.map.getCanvas();
|
|
50650
50677
|
const center = this.map.getCenter();
|
|
50651
50678
|
const leftBottom = this.map.unproject({
|
|
50652
50679
|
x: 0,
|
|
50653
50680
|
y: height / this.pixelRatio
|
|
50654
50681
|
});
|
|
50655
|
-
const rightTop = this.map.unproject({
|
|
50682
|
+
const rightTop = this.map.unproject({
|
|
50683
|
+
x: width / this.pixelRatio,
|
|
50684
|
+
y: 0
|
|
50685
|
+
});
|
|
50656
50686
|
const coord0 = es_default6(point([leftBottom.lng, leftBottom.lat]), -this.map.getBearing(), {
|
|
50657
50687
|
pivot: [center.lng, center.lat]
|
|
50658
50688
|
}).geometry.coordinates;
|
|
@@ -50678,7 +50708,7 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50678
50708
|
return super.getRefreshTimeInMs(this.map.getZoom());
|
|
50679
50709
|
}
|
|
50680
50710
|
getFeatureInfoAtCoordinate(coordinate, options = {}) {
|
|
50681
|
-
const resolution =
|
|
50711
|
+
const resolution = getMercatorResolution_default(this.map);
|
|
50682
50712
|
return super.getFeatureInfoAtCoordinate(coordinate, {
|
|
50683
50713
|
resolution,
|
|
50684
50714
|
...options
|
|
@@ -50706,10 +50736,10 @@ uniform ${i3} ${o3} u_${a3};
|
|
|
50706
50736
|
onMove() {
|
|
50707
50737
|
this.renderTrajectories();
|
|
50708
50738
|
}
|
|
50709
|
-
renderTrajectoriesInternal(viewState, noInterpolate) {
|
|
50739
|
+
renderTrajectoriesInternal(viewState, noInterpolate = false) {
|
|
50710
50740
|
const render = super.renderTrajectoriesInternal(viewState, noInterpolate);
|
|
50711
50741
|
if (render && this.map.style) {
|
|
50712
|
-
const extent =
|
|
50742
|
+
const extent = getSourceCoordinates_default(this.map, this.pixelRatio);
|
|
50713
50743
|
const source = this.map.getSource(this.key);
|
|
50714
50744
|
if (source) {
|
|
50715
50745
|
source.setCoordinates(extent);
|