mobility-toolbox-js 2.0.0-beta.30 → 2.0.0-beta.34

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.
Files changed (225) hide show
  1. package/api/RealtimeAPI.d.ts +268 -0
  2. package/api/RealtimeAPI.d.ts.map +1 -0
  3. package/api/RealtimeAPI.js +626 -343
  4. package/api/RoutingAPI.d.ts +33 -0
  5. package/api/RoutingAPI.d.ts.map +1 -0
  6. package/api/RoutingAPI.js +65 -15
  7. package/api/StopsAPI.d.ts +36 -0
  8. package/api/StopsAPI.d.ts.map +1 -0
  9. package/api/StopsAPI.js +70 -12
  10. package/api/index.d.ts +5 -0
  11. package/api/index.d.ts.map +1 -0
  12. package/api/index.js +10 -3
  13. package/api/typedefs.d.ts +105 -0
  14. package/api/typedefs.d.ts.map +1 -0
  15. package/api/typedefs.js +72 -0
  16. package/common/api/HttpAPI.d.ts +31 -0
  17. package/common/api/HttpAPI.d.ts.map +1 -0
  18. package/common/api/HttpAPI.js +82 -30
  19. package/common/api/WebSocketAPI.d.ts +95 -0
  20. package/common/api/WebSocketAPI.d.ts.map +1 -0
  21. package/common/api/WebSocketAPI.js +313 -168
  22. package/common/controls/Control.d.ts +74 -0
  23. package/common/controls/Control.d.ts.map +1 -0
  24. package/common/controls/Control.js +167 -78
  25. package/common/index.d.ts +3 -0
  26. package/common/index.d.ts.map +1 -0
  27. package/common/index.js +18 -2
  28. package/common/layers/Layer.d.ts +80 -0
  29. package/common/layers/Layer.d.ts.map +1 -0
  30. package/common/layers/Layer.js +251 -134
  31. package/common/mixins/CopyrightMixin.d.ts +22 -0
  32. package/common/mixins/CopyrightMixin.d.ts.map +1 -0
  33. package/common/mixins/CopyrightMixin.js +70 -22
  34. package/common/mixins/MapboxLayerMixin.d.ts +27 -0
  35. package/common/mixins/MapboxLayerMixin.d.ts.map +1 -0
  36. package/common/mixins/MapboxLayerMixin.js +240 -0
  37. package/common/mixins/RealtimeLayerMixin.d.ts +58 -0
  38. package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
  39. package/common/mixins/RealtimeLayerMixin.js +698 -429
  40. package/common/mixins/StopFinderMixin.d.ts +40 -0
  41. package/common/mixins/StopFinderMixin.d.ts.map +1 -0
  42. package/common/mixins/StopFinderMixin.js +195 -107
  43. package/common/mixins/UserInteractionsLayerMixin.d.ts +42 -0
  44. package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
  45. package/common/mixins/UserInteractionsLayerMixin.js +222 -121
  46. package/common/styles/index.d.ts +5 -0
  47. package/common/styles/index.d.ts.map +1 -0
  48. package/common/styles/index.js +24 -4
  49. package/common/styles/realtimeDefaultStyle.d.ts +15 -0
  50. package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
  51. package/common/styles/realtimeDefaultStyle.js +236 -190
  52. package/common/styles/realtimeDelayStyle.d.ts +11 -0
  53. package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
  54. package/common/styles/realtimeDelayStyle.js +25 -7
  55. package/common/styles/realtimeSimpleStyle.d.ts +3 -0
  56. package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
  57. package/common/styles/realtimeSimpleStyle.js +23 -17
  58. package/common/typedefs.d.ts +50 -0
  59. package/common/typedefs.d.ts.map +1 -0
  60. package/common/typedefs.js +21 -0
  61. package/common/utils/cleanStopTime.d.ts +7 -0
  62. package/common/utils/cleanStopTime.d.ts.map +1 -0
  63. package/common/utils/cleanStopTime.js +28 -17
  64. package/common/utils/compareDepartures.d.ts +9 -0
  65. package/common/utils/compareDepartures.d.ts.map +1 -0
  66. package/common/utils/compareDepartures.js +34 -22
  67. package/common/utils/createCanvas.d.ts +9 -0
  68. package/common/utils/createCanvas.d.ts.map +1 -0
  69. package/common/utils/createCanvas.js +28 -16
  70. package/common/utils/createTrackerFilters.d.ts +12 -0
  71. package/common/utils/createTrackerFilters.d.ts.map +1 -0
  72. package/common/utils/createTrackerFilters.js +75 -54
  73. package/common/utils/getLayersAsFlatArray.d.ts +3 -0
  74. package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
  75. package/common/utils/getLayersAsFlatArray.js +15 -13
  76. package/common/utils/getMapboxMapCopyrights.d.ts +8 -0
  77. package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
  78. package/common/utils/getMapboxMapCopyrights.js +24 -17
  79. package/common/utils/getMapboxRender.d.ts +5 -0
  80. package/common/utils/getMapboxRender.d.ts.map +1 -0
  81. package/common/utils/getMapboxRender.js +77 -0
  82. package/common/utils/getMaplibreRender.d.ts +5 -0
  83. package/common/utils/getMaplibreRender.d.ts.map +1 -0
  84. package/common/utils/getMaplibreRender.js +38 -0
  85. package/common/utils/getRealtimeModeSuffix.d.ts +8 -0
  86. package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
  87. package/common/utils/getRealtimeModeSuffix.js +11 -2
  88. package/common/utils/getUrlWithParams.d.ts +9 -0
  89. package/common/utils/getUrlWithParams.d.ts.map +1 -0
  90. package/common/utils/getUrlWithParams.js +20 -10
  91. package/common/utils/getVehiclePosition.d.ts +14 -0
  92. package/common/utils/getVehiclePosition.d.ts.map +1 -0
  93. package/common/utils/getVehiclePosition.js +63 -39
  94. package/common/utils/index.d.ts +12 -0
  95. package/common/utils/index.d.ts.map +1 -0
  96. package/common/utils/index.js +37 -9
  97. package/common/utils/removeDuplicate.d.ts +10 -0
  98. package/common/utils/removeDuplicate.d.ts.map +1 -0
  99. package/common/utils/removeDuplicate.js +29 -7
  100. package/common/utils/renderTrajectories.d.ts +20 -0
  101. package/common/utils/renderTrajectories.d.ts.map +1 -0
  102. package/common/utils/renderTrajectories.js +111 -78
  103. package/common/utils/sortByDelay.d.ts +3 -0
  104. package/common/utils/sortByDelay.d.ts.map +1 -0
  105. package/common/utils/sortByDelay.js +21 -17
  106. package/common/utils/timeUtils.d.ts +5 -0
  107. package/common/utils/timeUtils.d.ts.map +1 -0
  108. package/common/utils/timeUtils.js +47 -18
  109. package/common/utils/trackerConfig.d.ts +24 -0
  110. package/common/utils/trackerConfig.d.ts.map +1 -0
  111. package/common/utils/trackerConfig.js +171 -118
  112. package/iife.d.ts +3 -0
  113. package/iife.d.ts.map +1 -0
  114. package/iife.js +7 -0
  115. package/index.d.ts +6 -0
  116. package/index.d.ts.map +1 -0
  117. package/index.js +10 -7
  118. package/mapbox/controls/CopyrightControl.d.ts +32 -0
  119. package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
  120. package/mapbox/controls/CopyrightControl.js +72 -28
  121. package/mapbox/controls/index.d.ts +2 -0
  122. package/mapbox/controls/index.d.ts.map +1 -0
  123. package/mapbox/controls/index.js +6 -1
  124. package/mapbox/index.d.ts +5 -0
  125. package/mapbox/index.d.ts.map +1 -0
  126. package/mapbox/index.js +20 -4
  127. package/mapbox/layers/Layer.d.ts +47 -0
  128. package/mapbox/layers/Layer.d.ts.map +1 -0
  129. package/mapbox/layers/Layer.js +137 -54
  130. package/mapbox/layers/RealtimeLayer.d.ts +118 -0
  131. package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
  132. package/mapbox/layers/RealtimeLayer.js +310 -183
  133. package/mapbox/layers/index.d.ts +3 -0
  134. package/mapbox/layers/index.d.ts.map +1 -0
  135. package/mapbox/layers/index.js +7 -2
  136. package/mapbox/utils.d.ts +8 -0
  137. package/mapbox/utils.d.ts.map +1 -0
  138. package/mapbox/utils.js +54 -29
  139. package/mbt.js +2052 -2109
  140. package/mbt.js.map +3 -3
  141. package/mbt.min.js +18 -18
  142. package/mbt.min.js.map +3 -3
  143. package/ol/controls/CopyrightControl.d.ts +31 -0
  144. package/ol/controls/CopyrightControl.d.ts.map +1 -0
  145. package/ol/controls/CopyrightControl.js +89 -41
  146. package/ol/controls/RoutingControl.d.ts +180 -0
  147. package/ol/controls/RoutingControl.d.ts.map +1 -0
  148. package/ol/controls/RoutingControl.js +666 -371
  149. package/ol/controls/StopFinderControl.d.ts +32 -0
  150. package/ol/controls/StopFinderControl.d.ts.map +1 -0
  151. package/ol/controls/StopFinderControl.js +59 -10
  152. package/ol/controls/index.d.ts +4 -0
  153. package/ol/controls/index.d.ts.map +1 -0
  154. package/ol/controls/index.js +9 -3
  155. package/ol/index.d.ts +6 -0
  156. package/ol/index.d.ts.map +1 -0
  157. package/ol/index.js +21 -5
  158. package/ol/layers/Layer.d.ts +49 -0
  159. package/ol/layers/Layer.d.ts.map +1 -0
  160. package/ol/layers/Layer.js +178 -81
  161. package/ol/layers/MapboxLayer.d.ts +42 -0
  162. package/ol/layers/MapboxLayer.d.ts.map +1 -0
  163. package/ol/layers/MapboxLayer.js +131 -198
  164. package/ol/layers/MapboxStyleLayer.d.ts +146 -0
  165. package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
  166. package/ol/layers/MapboxStyleLayer.js +382 -186
  167. package/ol/layers/MaplibreLayer.d.ts +27 -0
  168. package/ol/layers/MaplibreLayer.d.ts.map +1 -0
  169. package/ol/layers/MaplibreLayer.js +67 -138
  170. package/ol/layers/RealtimeLayer.d.ts +119 -0
  171. package/ol/layers/RealtimeLayer.d.ts.map +1 -0
  172. package/ol/layers/RealtimeLayer.js +327 -184
  173. package/ol/layers/RoutingLayer.d.ts +24 -0
  174. package/ol/layers/RoutingLayer.d.ts.map +1 -0
  175. package/ol/layers/RoutingLayer.js +111 -56
  176. package/ol/layers/VectorLayer.d.ts +23 -0
  177. package/ol/layers/VectorLayer.d.ts.map +1 -0
  178. package/ol/layers/VectorLayer.js +71 -21
  179. package/ol/layers/WMSLayer.d.ts +38 -0
  180. package/ol/layers/WMSLayer.d.ts.map +1 -0
  181. package/ol/layers/WMSLayer.js +105 -37
  182. package/ol/layers/index.d.ts +9 -0
  183. package/ol/layers/index.d.ts.map +1 -0
  184. package/ol/layers/index.js +19 -8
  185. package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
  186. package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
  187. package/ol/styles/fullTrajectoryDelayStyle.js +32 -28
  188. package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
  189. package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
  190. package/ol/styles/fullTrajectoryStyle.js +44 -40
  191. package/ol/styles/index.d.ts +3 -0
  192. package/ol/styles/index.d.ts.map +1 -0
  193. package/ol/styles/index.js +7 -2
  194. package/package.json +14 -36
  195. package/setupTests.d.ts +2 -0
  196. package/setupTests.d.ts.map +1 -0
  197. package/setupTests.js +15 -0
  198. package/types/index.d.ts +7 -6
  199. package/types/routing.d.ts +25 -25
  200. package/types/stops.d.ts +19 -19
  201. package/api/RealtimeAPI.test.js +0 -67
  202. package/api/RoutingAPI.test.js +0 -25
  203. package/api/StopsAPI.test.js +0 -22
  204. package/common/api/HttpAPI.test.js +0 -50
  205. package/common/api/WebSocketAPI.test.js +0 -311
  206. package/common/controls/Control.test.js +0 -87
  207. package/common/layers/Layer.test.js +0 -134
  208. package/common/mixins/UserInteractionsLayerMixin.test.js +0 -199
  209. package/common/utils/createTrackerFilters.test.js +0 -79
  210. package/common/utils/getMapboxMapCopyrights.test.js +0 -40
  211. package/common/utils/removeDuplicate.test.js +0 -19
  212. package/common/utils/timeUtils.test.js +0 -10
  213. package/common/utils/trackerConfig.test.js +0 -23
  214. package/mapbox/layers/Layer.test.js +0 -182
  215. package/mapbox/layers/RealtimeLayer.test.js +0 -10
  216. package/ol/controls/CopyrightControl.test.js +0 -165
  217. package/ol/controls/RoutingControl.test.js +0 -146
  218. package/ol/controls/StopFinderControl.test.js +0 -48
  219. package/ol/layers/Layer.test.js +0 -175
  220. package/ol/layers/MapboxLayer.test.js +0 -160
  221. package/ol/layers/MapboxStyleLayer.test.js +0 -226
  222. package/ol/layers/RealtimeLayer.test.js +0 -67
  223. package/ol/layers/RoutingLayer.test.js +0 -39
  224. package/ol/layers/VectorLayer.test.js +0 -76
  225. package/ol/layers/WMSLayer.test.js +0 -57
@@ -1,61 +1,116 @@
1
- import { Circle, Fill, Stroke, Style } from "ol/style";
2
- import { Vector as VectorSource } from "ol/source";
3
- import { Vector } from "ol/layer";
4
- import Layer from "./Layer";
5
- const circleStyle = new Circle({
6
- radius: 6,
7
- fill: new Fill({
8
- color: [255, 0, 0, 1]
9
- }),
10
- stroke: new Stroke({
11
- color: [0, 0, 0, 1],
12
- width: 1
13
- })
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ var style_1 = require("ol/style");
30
+ var source_1 = require("ol/source");
31
+ var layer_1 = require("ol/layer");
32
+ var Layer_1 = require("./Layer");
33
+ /** @private */
34
+ var circleStyle = new style_1.Circle({
35
+ radius: 6,
36
+ fill: new style_1.Fill({
37
+ color: [255, 0, 0, 1],
38
+ }),
39
+ stroke: new style_1.Stroke({
40
+ color: [0, 0, 0, 1],
41
+ width: 1,
42
+ }),
14
43
  });
15
- const blackBorder = new Style({
16
- stroke: new Stroke({
17
- color: [0, 0, 0, 1],
18
- width: 5
19
- })
44
+ /** @private */
45
+ var blackBorder = new style_1.Style({
46
+ stroke: new style_1.Stroke({
47
+ color: [0, 0, 0, 1],
48
+ width: 5,
49
+ }),
20
50
  });
21
- const redLine = new Style({
22
- image: circleStyle,
23
- stroke: new Stroke({
24
- color: [255, 0, 0, 1],
25
- width: 3
26
- })
51
+ /** @private */
52
+ var redLine = new style_1.Style({
53
+ image: circleStyle,
54
+ stroke: new style_1.Stroke({
55
+ color: [255, 0, 0, 1],
56
+ width: 3,
57
+ }),
27
58
  });
28
- const dashedRedLine = new Style({
29
- image: circleStyle,
30
- stroke: new Stroke({
31
- color: [255, 0, 0, 1],
32
- width: 3,
33
- lineDash: [1, 10]
34
- })
59
+ /** @private */
60
+ var dashedRedLine = new style_1.Style({
61
+ image: circleStyle,
62
+ stroke: new style_1.Stroke({
63
+ color: [255, 0, 0, 1],
64
+ width: 3,
65
+ lineDash: [1, 10],
66
+ }),
35
67
  });
36
- const defaultStyleFunction = (feature, resolution) => {
37
- const minResolution = feature.get("minResolution");
38
- const maxResolution = feature.get("maxResolution");
39
- const inRange = resolution <= minResolution && resolution > maxResolution;
40
- if (minResolution && maxResolution && !inRange) {
41
- return null;
42
- }
43
- const mot = feature.get("mot");
44
- if (mot !== "foot") {
45
- return [blackBorder, redLine];
46
- }
47
- return [dashedRedLine];
68
+ /** @private */
69
+ var defaultStyleFunction = function (feature, resolution) {
70
+ var minResolution = feature.get('minResolution');
71
+ var maxResolution = feature.get('maxResolution');
72
+ var inRange = resolution <= minResolution && resolution > maxResolution;
73
+ if (minResolution && maxResolution && !inRange) {
74
+ return null;
75
+ }
76
+ var mot = feature.get('mot');
77
+ if (mot !== 'foot') {
78
+ return [blackBorder, redLine];
79
+ }
80
+ return [dashedRedLine];
48
81
  };
49
- class RoutingLayer extends Layer {
50
- constructor(options = {}) {
51
- super(options);
52
- this.olLayer = options.olLayer || new Vector({
53
- source: new VectorSource(),
54
- style: options.style || defaultStyleFunction
55
- });
56
- }
57
- clone(newOptions) {
58
- return new RoutingLayer({ ...this.options, ...newOptions });
59
- }
60
- }
61
- export default RoutingLayer;
82
+ /**
83
+ * A class use to display vector data.
84
+ *
85
+ * @classproperty {ol/Map~Map} map - The map where the layer is displayed.
86
+ * @extends {Layer}
87
+ */
88
+ var RoutingLayer = /** @class */ (function (_super) {
89
+ __extends(RoutingLayer, _super);
90
+ /**
91
+ * Constructor.
92
+ * @param {Object} [options]
93
+ * @param {ol/style/Style~StyleLike} [options.style] Style to be used for routes, uses (ol/StyleLike) [https://openlayers.org/en/latest/apidoc/module-ol_style_Style.html#~StyleLike] instances
94
+ */
95
+ function RoutingLayer(options) {
96
+ if (options === void 0) { options = {}; }
97
+ var _this = _super.call(this, options) || this;
98
+ _this.olLayer =
99
+ options.olLayer ||
100
+ new layer_1.Vector({
101
+ source: new source_1.Vector(),
102
+ style: options.style || defaultStyleFunction,
103
+ });
104
+ return _this;
105
+ }
106
+ /**
107
+ * Create a copy of the RoutingLayer.
108
+ * @param {Object} newOptions Options to override
109
+ * @return {RoutingLayer} A RoutingLayer
110
+ */
111
+ RoutingLayer.prototype.clone = function (newOptions) {
112
+ return new RoutingLayer(__assign(__assign({}, this.options), newOptions));
113
+ };
114
+ return RoutingLayer;
115
+ }(Layer_1.default));
116
+ exports.default = RoutingLayer;
@@ -0,0 +1,23 @@
1
+ export default VectorLayer;
2
+ /**
3
+ * A class use to display vector data.
4
+ *
5
+ * @classproperty {ol/Map~Map} map - The map where the layer is displayed.
6
+ * @extends {Layer}
7
+ */
8
+ declare class VectorLayer extends Layer {
9
+ /**
10
+ * Request feature information for a given coordinate.
11
+ * @param {ol/coordinate~Coordinate} coordinate the coordinate to request the information at.
12
+ * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
13
+ */
14
+ getFeatureInfoAtCoordinate(coordinate: any): Promise<FeatureInfo>;
15
+ /**
16
+ * Create a copy of the VectorLayer.
17
+ * @param {Object} newOptions Options to override
18
+ * @return {VectorLayer} A VectorLayer
19
+ */
20
+ clone(newOptions: any): VectorLayer;
21
+ }
22
+ import Layer from "./Layer";
23
+ //# sourceMappingURL=VectorLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/VectorLayer.js"],"names":[],"mappings":";AAEA;;;;;GAKG;AACH;IACE;;;;OAIG;IACH,6CAFY,QAAQ,WAAW,CAAC,CAkB/B;IAED;;;;OAIG;IACH,wBAFY,WAAW,CAItB;CACF"}
@@ -1,22 +1,72 @@
1
- import Layer from "./Layer";
2
- class VectorLayer extends Layer {
3
- getFeatureInfoAtCoordinate(coordinate) {
4
- let features = [];
5
- if (this.map) {
6
- const pixel = this.map.getPixelFromCoordinate(coordinate);
7
- features = this.map.getFeaturesAtPixel(pixel, {
8
- layerFilter: (l) => l === this.olLayer,
9
- hitTolerance: this.hitTolerance
10
- });
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ var Layer_1 = require("./Layer");
30
+ /**
31
+ * A class use to display vector data.
32
+ *
33
+ * @classproperty {ol/Map~Map} map - The map where the layer is displayed.
34
+ * @extends {Layer}
35
+ */
36
+ var VectorLayer = /** @class */ (function (_super) {
37
+ __extends(VectorLayer, _super);
38
+ function VectorLayer() {
39
+ return _super !== null && _super.apply(this, arguments) || this;
11
40
  }
12
- return Promise.resolve({
13
- features,
14
- layer: this,
15
- coordinate
16
- });
17
- }
18
- clone(newOptions) {
19
- return new VectorLayer({ ...this.options, ...newOptions });
20
- }
21
- }
22
- export default VectorLayer;
41
+ /**
42
+ * Request feature information for a given coordinate.
43
+ * @param {ol/coordinate~Coordinate} coordinate the coordinate to request the information at.
44
+ * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
45
+ */
46
+ VectorLayer.prototype.getFeatureInfoAtCoordinate = function (coordinate) {
47
+ var _this = this;
48
+ var features = [];
49
+ if (this.map) {
50
+ var pixel = this.map.getPixelFromCoordinate(coordinate);
51
+ features = this.map.getFeaturesAtPixel(pixel, {
52
+ layerFilter: function (l) { return l === _this.olLayer; },
53
+ hitTolerance: this.hitTolerance,
54
+ });
55
+ }
56
+ return Promise.resolve({
57
+ features: features,
58
+ layer: this,
59
+ coordinate: coordinate,
60
+ });
61
+ };
62
+ /**
63
+ * Create a copy of the VectorLayer.
64
+ * @param {Object} newOptions Options to override
65
+ * @return {VectorLayer} A VectorLayer
66
+ */
67
+ VectorLayer.prototype.clone = function (newOptions) {
68
+ return new VectorLayer(__assign(__assign({}, this.options), newOptions));
69
+ };
70
+ return VectorLayer;
71
+ }(Layer_1.default));
72
+ exports.default = VectorLayer;
@@ -0,0 +1,38 @@
1
+ export default WMSLayer;
2
+ /**
3
+ * Class use to display a WMS layer.
4
+ *
5
+ * @classproperty {ol/Map~Map} map - The map where the layer is displayed.
6
+ * @extends {Layer}
7
+ */
8
+ declare class WMSLayer extends Layer {
9
+ /**
10
+ * @override
11
+ */
12
+ constructor(options?: {});
13
+ /** @ignore */
14
+ abortController: AbortController;
15
+ /** @ignore */
16
+ format: GeoJSON;
17
+ /**
18
+ * Get features infos' Url.
19
+ * @param {ol/coordinate~Coordinate} coord
20
+ * @return {ol/layer/Layer~Layer}
21
+ */
22
+ getFeatureInfoUrl(coord: any): ol;
23
+ /**
24
+ * Request feature information for a given coordinate.
25
+ * @param {ol/coordinate~Coordinate} coordinate to request the information at.
26
+ * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
27
+ */
28
+ getFeatureInfoAtCoordinate(coordinate: any): Promise<FeatureInfo>;
29
+ /**
30
+ * Create a copy of the WMSLayer.
31
+ * @param {Object} newOptions Options to override
32
+ * @return {WMSLayer} A WMSLayer
33
+ */
34
+ clone(newOptions: any): WMSLayer;
35
+ }
36
+ import Layer from "./Layer";
37
+ import GeoJSON from "ol/format/GeoJSON";
38
+ //# sourceMappingURL=WMSLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WMSLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/WMSLayer.js"],"names":[],"mappings":";AAGA;;;;;GAKG;AACH;IACE;;OAEG;IACH,0BAOC;IAJC,cAAc;IACd,iCAA4C;IAC5C,cAAc;IACd,gBAA2B;IAG7B;;;;OAIG;IACH,kCAaC;IAED;;;;OAIG;IACH,6CAFY,QAAQ,WAAW,CAAC,CAsB/B;IAED;;;;OAIG;IACH,wBAFY,QAAQ,CAInB;CACF"}
@@ -1,38 +1,106 @@
1
- import GeoJSON from "ol/format/GeoJSON";
2
- import Layer from "./Layer";
3
- class WMSLayer extends Layer {
4
- constructor(options = {}) {
5
- super(options);
6
- this.abortController = new AbortController();
7
- this.format = new GeoJSON();
8
- }
9
- getFeatureInfoUrl(coord) {
10
- const projection = this.map.getView().getProjection();
11
- const resolution = this.map.getView().getResolution();
12
- if (this.olLayer.getSource().getFeatureInfoUrl) {
13
- return this.olLayer.getSource().getFeatureInfoUrl(coord, resolution, projection, {
14
- info_format: "application/json",
15
- query_layers: this.olLayer.getSource().getParams().layers
16
- });
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ var GeoJSON_1 = require("ol/format/GeoJSON");
30
+ var Layer_1 = require("./Layer");
31
+ /**
32
+ * Class use to display a WMS layer.
33
+ *
34
+ * @classproperty {ol/Map~Map} map - The map where the layer is displayed.
35
+ * @extends {Layer}
36
+ */
37
+ var WMSLayer = /** @class */ (function (_super) {
38
+ __extends(WMSLayer, _super);
39
+ /**
40
+ * @override
41
+ */
42
+ function WMSLayer(options) {
43
+ if (options === void 0) { options = {}; }
44
+ var _this = _super.call(this, options) || this;
45
+ /** @ignore */
46
+ _this.abortController = new AbortController();
47
+ /** @ignore */
48
+ _this.format = new GeoJSON_1.default();
49
+ return _this;
17
50
  }
18
- return false;
19
- }
20
- getFeatureInfoAtCoordinate(coordinate) {
21
- this.abortController.abort();
22
- this.abortController = new AbortController();
23
- const { signal } = this.abortController;
24
- return fetch(this.getFeatureInfoUrl(coordinate), { signal }).then((resp) => resp.json()).then((r) => r.features).then((data) => ({
25
- layer: this,
26
- coordinate,
27
- features: data.map((d) => this.format.readFeature(d))
28
- })).catch(() => Promise.resolve({
29
- features: [],
30
- coordinate,
31
- layer: this
32
- }));
33
- }
34
- clone(newOptions) {
35
- return new WMSLayer({ ...this.options, ...newOptions });
36
- }
37
- }
38
- export default WMSLayer;
51
+ /**
52
+ * Get features infos' Url.
53
+ * @param {ol/coordinate~Coordinate} coord
54
+ * @return {ol/layer/Layer~Layer}
55
+ */
56
+ WMSLayer.prototype.getFeatureInfoUrl = function (coord) {
57
+ var projection = this.map.getView().getProjection();
58
+ var resolution = this.map.getView().getResolution();
59
+ if (this.olLayer.getSource().getFeatureInfoUrl) {
60
+ return this.olLayer
61
+ .getSource()
62
+ .getFeatureInfoUrl(coord, resolution, projection, {
63
+ info_format: 'application/json',
64
+ query_layers: this.olLayer.getSource().getParams().layers,
65
+ });
66
+ }
67
+ return false;
68
+ };
69
+ /**
70
+ * Request feature information for a given coordinate.
71
+ * @param {ol/coordinate~Coordinate} coordinate to request the information at.
72
+ * @return {Promise<FeatureInfo>} Promise with features, layer and coordinate.
73
+ */
74
+ WMSLayer.prototype.getFeatureInfoAtCoordinate = function (coordinate) {
75
+ var _this = this;
76
+ this.abortController.abort();
77
+ this.abortController = new AbortController();
78
+ var signal = this.abortController.signal;
79
+ return fetch(this.getFeatureInfoUrl(coordinate), { signal: signal })
80
+ .then(function (resp) { return resp.json(); })
81
+ .then(function (r) { return r.features; })
82
+ .then(function (data) { return ({
83
+ layer: _this,
84
+ coordinate: coordinate,
85
+ features: data.map(function (d) { return _this.format.readFeature(d); }),
86
+ }); })
87
+ .catch(function () {
88
+ // resolve an empty feature array something fails
89
+ return Promise.resolve({
90
+ features: [],
91
+ coordinate: coordinate,
92
+ layer: _this,
93
+ });
94
+ });
95
+ };
96
+ /**
97
+ * Create a copy of the WMSLayer.
98
+ * @param {Object} newOptions Options to override
99
+ * @return {WMSLayer} A WMSLayer
100
+ */
101
+ WMSLayer.prototype.clone = function (newOptions) {
102
+ return new WMSLayer(__assign(__assign({}, this.options), newOptions));
103
+ };
104
+ return WMSLayer;
105
+ }(Layer_1.default));
106
+ exports.default = WMSLayer;
@@ -0,0 +1,9 @@
1
+ export { default as Layer } from "./Layer";
2
+ export { default as MapboxLayer } from "./MapboxLayer";
3
+ export { default as MaplibreLayer } from "./MaplibreLayer";
4
+ export { default as MapboxStyleLayer } from "./MapboxStyleLayer";
5
+ export { default as RoutingLayer } from "./RoutingLayer";
6
+ export { default as RealtimeLayer } from "./RealtimeLayer";
7
+ export { default as VectorLayer } from "./VectorLayer";
8
+ export { default as WMSLayer } from "./WMSLayer";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/index.js"],"names":[],"mappings":""}
@@ -1,8 +1,19 @@
1
- export { default as Layer } from "./Layer";
2
- export { default as MapboxLayer } from "./MapboxLayer";
3
- export { default as MaplibreLayer } from "./MaplibreLayer";
4
- export { default as MapboxStyleLayer } from "./MapboxStyleLayer";
5
- export { default as RoutingLayer } from "./RoutingLayer";
6
- export { default as RealtimeLayer } from "./RealtimeLayer";
7
- export { default as VectorLayer } from "./VectorLayer";
8
- export { default as WMSLayer } from "./WMSLayer";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WMSLayer = exports.VectorLayer = exports.RealtimeLayer = exports.RoutingLayer = exports.MapboxStyleLayer = exports.MaplibreLayer = exports.MapboxLayer = exports.Layer = void 0;
4
+ var Layer_1 = require("./Layer");
5
+ Object.defineProperty(exports, "Layer", { enumerable: true, get: function () { return Layer_1.default; } });
6
+ var MapboxLayer_1 = require("./MapboxLayer");
7
+ Object.defineProperty(exports, "MapboxLayer", { enumerable: true, get: function () { return MapboxLayer_1.default; } });
8
+ var MaplibreLayer_1 = require("./MaplibreLayer");
9
+ Object.defineProperty(exports, "MaplibreLayer", { enumerable: true, get: function () { return MaplibreLayer_1.default; } });
10
+ var MapboxStyleLayer_1 = require("./MapboxStyleLayer");
11
+ Object.defineProperty(exports, "MapboxStyleLayer", { enumerable: true, get: function () { return MapboxStyleLayer_1.default; } });
12
+ var RoutingLayer_1 = require("./RoutingLayer");
13
+ Object.defineProperty(exports, "RoutingLayer", { enumerable: true, get: function () { return RoutingLayer_1.default; } });
14
+ var RealtimeLayer_1 = require("./RealtimeLayer");
15
+ Object.defineProperty(exports, "RealtimeLayer", { enumerable: true, get: function () { return RealtimeLayer_1.default; } });
16
+ var VectorLayer_1 = require("./VectorLayer");
17
+ Object.defineProperty(exports, "VectorLayer", { enumerable: true, get: function () { return VectorLayer_1.default; } });
18
+ var WMSLayer_1 = require("./WMSLayer");
19
+ Object.defineProperty(exports, "WMSLayer", { enumerable: true, get: function () { return WMSLayer_1.default; } });
@@ -0,0 +1,4 @@
1
+ export default fullTrajectoryDelaystyle;
2
+ declare function fullTrajectoryDelaystyle(): Style[];
3
+ import { Style } from "ol/style";
4
+ //# sourceMappingURL=fullTrajectoryDelayStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullTrajectoryDelayStyle.d.ts","sourceRoot":"","sources":["../../../src/ol/styles/fullTrajectoryDelayStyle.js"],"names":[],"mappings":";AAgCA,qDAEC"}
@@ -1,31 +1,35 @@
1
- import { Style, Fill, Stroke, Circle } from "ol/style";
2
- const stroke = new Style({
3
- zIndex: 2,
4
- image: new Circle({
5
- radius: 5,
6
- fill: new Fill({
7
- color: "#000000"
8
- })
9
- }),
10
- stroke: new Stroke({
11
- color: "#000000",
12
- width: 6
13
- })
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var style_1 = require("ol/style");
4
+ /** @private */
5
+ var stroke = new style_1.Style({
6
+ zIndex: 2,
7
+ image: new style_1.Circle({
8
+ radius: 5,
9
+ fill: new style_1.Fill({
10
+ color: '#000000',
11
+ }),
12
+ }),
13
+ stroke: new style_1.Stroke({
14
+ color: '#000000',
15
+ width: 6,
16
+ }),
14
17
  });
15
- const fill = new Style({
16
- zIndex: 3,
17
- image: new Circle({
18
- radius: 4,
19
- fill: new Fill({
20
- color: "#a0a0a0"
21
- })
22
- }),
23
- stroke: new Stroke({
24
- color: "#a0a0a0",
25
- width: 4
26
- })
18
+ /** @private */
19
+ var fill = new style_1.Style({
20
+ zIndex: 3,
21
+ image: new style_1.Circle({
22
+ radius: 4,
23
+ fill: new style_1.Fill({
24
+ color: '#a0a0a0',
25
+ }),
26
+ }),
27
+ stroke: new style_1.Stroke({
28
+ color: '#a0a0a0',
29
+ width: 4,
30
+ }),
27
31
  });
28
- const fullTrajectoryDelaystyle = () => {
29
- return [stroke, fill];
32
+ var fullTrajectoryDelaystyle = function () {
33
+ return [stroke, fill];
30
34
  };
31
- export default fullTrajectoryDelaystyle;
35
+ exports.default = fullTrajectoryDelaystyle;
@@ -0,0 +1,4 @@
1
+ export default fullTrajectorystyle;
2
+ declare function fullTrajectorystyle(feature: any, resolution: any, options: any): Style[];
3
+ import { Style } from "ol/style";
4
+ //# sourceMappingURL=fullTrajectoryStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullTrajectoryStyle.d.ts","sourceRoot":"","sources":["../../../src/ol/styles/fullTrajectoryStyle.js"],"names":[],"mappings":";AAiBA,2FAgCC"}