mobility-toolbox-js 3.0.0-beta.0 → 3.0.0-beta.2
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/LICENSE +21 -0
- package/README.md +42 -0
- package/common/utils/getLayersAsFlatArray.js +1 -1
- package/mbt.js +5 -6
- package/mbt.js.map +2 -2
- package/mbt.min.js +2 -2
- package/mbt.min.js.map +2 -2
- package/ol/layers/MapGlLayer.js +3 -5
- package/ol/layers/MaplibreStyleLayer.js +4 -4
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 geOps
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# mobility-toolbox-js
|
|
2
|
+
|
|
3
|
+
Toolbox for JavaScript applications in the domains of mobility and logistics.
|
|
4
|
+
The tools in this library have been inspired by many projects realized for public transport agencies, mobility providers and logistics companies.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/mobility-toolbox-js)
|
|
7
|
+
[](https://github.com/geops/mobility-toolbox-js/actions?query=workflow%3ABuild)
|
|
8
|
+
[](https://github.com/geops/mobility-toolbox-js/actions?query=workflow%3ALint%20/%20Unit%20tests)
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Documentation and examples
|
|
12
|
+
|
|
13
|
+
Visit https://mobility-toolbox-js.vercel.app/
|
|
14
|
+
|
|
15
|
+
## Demos
|
|
16
|
+
|
|
17
|
+
* Display [real-time vehicle positions and prognosis data](https://mobility.portal.geops.io) on a map.
|
|
18
|
+
* Search for [stops and stations](https://maps.trafimage.ch) all over the world.
|
|
19
|
+
* Get [precise geographic courses](https://routing-demo.geops.io/) for all modes of transport.
|
|
20
|
+
* Generate beautiful [schematic](https://mobility.portal.geops.io/world.geops.networkplans) or [topographic](https://mobility.portal.geops.io) maps for public transport, mobility and logistics.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
Install the library and the peer dependencies:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add mobility-toolbox-js ol maplibre-gl
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Development
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn install
|
|
34
|
+
yarn dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Deploy
|
|
38
|
+
|
|
39
|
+
This library website is deployed automatically using [Vercel](https://vercel.com/geops).
|
|
40
|
+
For Vercel we have to add the nextjs and raw-loader modules in the dev dependencies of the main package.json.
|
|
41
|
+
But those 2 librairies are not needed to build the library.
|
|
42
|
+
|
|
@@ -8,7 +8,7 @@ const getLayersAsFlatArray = (layersOrLayer) => {
|
|
|
8
8
|
let flatLayers = [];
|
|
9
9
|
layers.forEach((layer) => {
|
|
10
10
|
flatLayers.push(layer);
|
|
11
|
-
const
|
|
11
|
+
const children = layer.children || layer.get('children') || {};
|
|
12
12
|
flatLayers = flatLayers.concat(getLayersAsFlatArray(children || []));
|
|
13
13
|
});
|
|
14
14
|
return flatLayers;
|
package/mbt.js
CHANGED
|
@@ -20225,7 +20225,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
20225
20225
|
let flatLayers = [];
|
|
20226
20226
|
layers.forEach((layer) => {
|
|
20227
20227
|
flatLayers.push(layer);
|
|
20228
|
-
const
|
|
20228
|
+
const children = layer.children || layer.get("children") || {};
|
|
20229
20229
|
flatLayers = flatLayers.concat(getLayersAsFlatArray(children || []));
|
|
20230
20230
|
});
|
|
20231
20231
|
return flatLayers;
|
|
@@ -45713,7 +45713,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45713
45713
|
this.loaded = false;
|
|
45714
45714
|
this.olListenersKeys.push(
|
|
45715
45715
|
// @ts-ignore
|
|
45716
|
-
this.map?.on("change:target", this.loadMbMap)
|
|
45716
|
+
this.map?.on("change:target", this.loadMbMap.bind(this))
|
|
45717
45717
|
);
|
|
45718
45718
|
if (!this.map?.getTargetElement()) {
|
|
45719
45719
|
return;
|
|
@@ -45721,7 +45721,7 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45721
45721
|
if (!this.visible) {
|
|
45722
45722
|
this.olListenersKeys.push(
|
|
45723
45723
|
// @ts-ignore
|
|
45724
|
-
this.once("change:visible", this.loadMbMap)
|
|
45724
|
+
this.once("change:visible", this.loadMbMap.bind(this))
|
|
45725
45725
|
);
|
|
45726
45726
|
return;
|
|
45727
45727
|
}
|
|
@@ -45730,7 +45730,6 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
45730
45730
|
container.style.width = "100%";
|
|
45731
45731
|
container.style.height = "100%";
|
|
45732
45732
|
this.mbMap = this.createMap({
|
|
45733
|
-
// https://maps.geops.io/styles/t7ravic_v2/style.json',
|
|
45734
45733
|
style: this.getStyle(),
|
|
45735
45734
|
container,
|
|
45736
45735
|
...this.options?.mapOptions || {}
|
|
@@ -46102,11 +46101,11 @@ uniform ${i3} ${s3} u_${a3};
|
|
|
46102
46101
|
maplibreMap.once("load", this.onLoad);
|
|
46103
46102
|
}
|
|
46104
46103
|
this.olListenersKeys.push(
|
|
46104
|
+
// @ts-expect-error 'load' is a custom event form mobility-toolbox-js
|
|
46105
|
+
this.maplibreLayer.on("load", this.onLoad.bind(this)),
|
|
46105
46106
|
this.on("change:visible", (evt) => {
|
|
46106
46107
|
this.applyLayoutVisibility(evt);
|
|
46107
46108
|
}),
|
|
46108
|
-
// @ts-expect-error 'load' is a custom event form mobility-toolbox-js
|
|
46109
|
-
this.maplibreLayer.on("load", this.onLoad),
|
|
46110
46109
|
this.on("propertychange", (evt) => {
|
|
46111
46110
|
if (/(sources|layers|layersFilter|maplibreLayer|beforeId|)/.test(evt.key)) {
|
|
46112
46111
|
this.detachFromMap();
|