mobility-toolbox-js 2.0.0-beta.1 → 2.0.0

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 (67) hide show
  1. package/README.md +7 -4
  2. package/api/index.js +0 -1
  3. package/api/tralis/TralisAPI.js +1 -1
  4. package/common/controls/Control.js +4 -1
  5. package/common/layers/Layer.js +18 -49
  6. package/common/layers/Layer.test.js +2 -106
  7. package/common/mixins/SearchMixin.js +1 -1
  8. package/common/mixins/TralisLayerMixin.js +549 -21
  9. package/common/styles/index.js +4 -0
  10. package/common/{utils/delayTrackerStyle.js → styles/trackerDefaultStyle.js} +8 -8
  11. package/common/styles/trackerDelayStyle.js +17 -0
  12. package/common/styles/trackerSimpleStyle.js +22 -0
  13. package/common/trackerConfig.test.js +0 -13
  14. package/common/utils/getMapboxMapCopyrights.js +1 -0
  15. package/common/utils/index.js +2 -3
  16. package/common/utils/sortByDelay.js +23 -0
  17. package/index.js +1 -1
  18. package/index.js.map +1 -1
  19. package/mapbox/controls/CopyrightControl.js +5 -1
  20. package/mapbox/index.js +0 -2
  21. package/mapbox/layers/Layer.test.js +2 -2
  22. package/mapbox/layers/TralisLayer.js +270 -5
  23. package/mapbox/layers/TralisLayer.test.js +40 -0
  24. package/module.js +1 -9
  25. package/ol/controls/CopyrightControl.js +4 -4
  26. package/ol/controls/CopyrightControl.test.js +16 -16
  27. package/ol/controls/RoutingControl.js +9 -7
  28. package/ol/controls/RoutingControl.test.js +1 -1
  29. package/ol/controls/StopFinderControl.js +8 -6
  30. package/ol/controls/StopFinderControl.test.js +1 -1
  31. package/ol/index.js +3 -3
  32. package/ol/layers/Layer.js +9 -0
  33. package/ol/layers/Layer.test.js +22 -7
  34. package/ol/layers/MapboxLayer.js +39 -44
  35. package/ol/layers/MapboxLayer.test.js +5 -5
  36. package/ol/layers/MapboxStyleLayer.js +0 -6
  37. package/ol/layers/MapboxStyleLayer.test.js +22 -6
  38. package/ol/layers/MaplibreLayer.js +280 -0
  39. package/ol/layers/RoutingLayer.test.js +1 -1
  40. package/ol/layers/TralisLayer.js +258 -76
  41. package/ol/layers/TralisLayer.test.js +1 -49
  42. package/ol/layers/VectorLayer.test.js +1 -1
  43. package/ol/layers/WMSLayer.test.js +6 -2
  44. package/ol/styles/fullTrajectoryDelayStyle.js +35 -0
  45. package/ol/styles/fullTrajectoryStyle.js +51 -0
  46. package/ol/styles/index.js +2 -0
  47. package/package.json +16 -8
  48. package/api/trajserv/TrajservAPI.js +0 -71
  49. package/api/trajserv/TrajservAPI.test.js +0 -171
  50. package/api/trajserv/TrajservAPIUtils.js +0 -191
  51. package/api/trajserv/TrajservAPIUtils.test.js +0 -40
  52. package/api/trajserv/typedefs.js +0 -44
  53. package/common/mixins/MapMixin.js +0 -103
  54. package/common/mixins/TrackerLayerMixin.js +0 -745
  55. package/common/mixins/TrajservLayerMixin.js +0 -544
  56. package/common/utils/simpleTrackerStyle.js +0 -18
  57. package/mapbox/Map.js +0 -87
  58. package/mapbox/layers/TrackerLayer.js +0 -282
  59. package/mapbox/layers/TrackerLayer.test.js +0 -68
  60. package/mapbox/layers/TrajservLayer.js +0 -114
  61. package/mapbox/layers/TrajservLayer.test.js +0 -90
  62. package/ol/Map.js +0 -109
  63. package/ol/Map.test.js +0 -34
  64. package/ol/layers/TrackerLayer.js +0 -296
  65. package/ol/layers/TrackerLayer.test.js +0 -70
  66. package/ol/layers/TrajservLayer.js +0 -190
  67. package/ol/layers/TrajservLayer.test.js +0 -113
@@ -1,71 +0,0 @@
1
- import {
2
- translateTrajCollResponse,
3
- translateTrajStationsResp,
4
- } from './TrajservAPIUtils';
5
- import API from '../../common/api/api';
6
-
7
- /**
8
- * Access to the [Realtime service](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/).
9
- *
10
- * @example
11
- * import { TrajservAPI } from 'mobility-toolbox-js/api';
12
- *
13
- * const api = new TrajservAPI({
14
- * url: 'https://api.geops.io/tracker/v1',
15
- * apiKey: [yourApiKey]
16
- * });
17
- *
18
- */
19
- class TrajservAPI extends API {
20
- /**
21
- * Constructor
22
- *
23
- * @param {Object} options Options.
24
- * @param {string} [options.url='https://api.geops.io/tracker/v1'] Service url.
25
- * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
26
- */
27
- constructor(options = {}) {
28
- super({ url: 'https://api.geops.io/tracker/v1', ...options });
29
- }
30
-
31
- /**
32
- * Fetch a trajectory by id.
33
- *
34
- * @param {GetTrajectoryByIdParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajectorybyid).
35
- * @param {AbortController} abortController Abort controller used to cancel the request.
36
- * @return {Promise<TrajservTrajectory>} A trajectory.
37
- */
38
- fetchTrajectoryById(params, abortController = {}) {
39
- return this.fetch(`/trajectorybyid`, params, {
40
- signal: abortController.signal,
41
- });
42
- }
43
-
44
- /**
45
- * Fetch trajectories.
46
- *
47
- * @param {GetTrajectoriesParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajectory_collection).
48
- * @param {AbortController} abortController Abort controller used to cancel the request.
49
- * @return {Promise<Array<Trajectory>>} A list of trajectories.
50
- */
51
- fetchTrajectories(params, abortController = {}) {
52
- return this.fetch(`/trajectory_collection`, params, {
53
- signal: abortController.signal,
54
- }).then((data) => translateTrajCollResponse(data.features));
55
- }
56
-
57
- /**
58
- * Fetch stations informations about a trajectory.
59
- *
60
- * @param {GetTrajectoryStationsParams} params Request parameters. See [Realtime service documentation](https://developer.geops.io/apis/5dcbd5c9a256d90001cf1360/#/default/get_trajstations).
61
- * @param {AbortController} abortController Abort controller used to cancel the request.
62
- * @return {Promise<Array<TrajectoryStation>>} A list of stations.
63
- */
64
- fetchTrajectoryStations(params, abortController = {}) {
65
- return this.fetch(`/trajstations`, params, {
66
- signal: abortController.signal,
67
- }).then((data) => translateTrajStationsResp(data));
68
- }
69
- }
70
-
71
- export default TrajservAPI;
@@ -1,171 +0,0 @@
1
- import fetch from 'jest-fetch-mock';
2
- import TrajservAPI from './TrajservAPI';
3
-
4
- let api;
5
-
6
- describe('TrajservAPI', () => {
7
- beforeEach(() => {
8
- global.fetch = fetch;
9
- fetch.resetMocks();
10
-
11
- api = new TrajservAPI({ apiKey: 'apiKey' });
12
- });
13
-
14
- describe('#fetchTrajectoryById', () => {
15
- test('should success', () => {
16
- fetch.mockResponseOnce(
17
- JSON.stringify(global.fetchTrajectoryByIdResponse),
18
- );
19
-
20
- return api
21
- .fetchTrajectoryById({
22
- a: '1',
23
- bbox: '917830.8141233932,5949421.787168904,926771.7516620635,5953300.375201735',
24
- btime: '5:54:7.880',
25
- cd: '1',
26
- date: '20200701',
27
- etime: '5:54:24.582',
28
- fl: '1',
29
- id: '16617:3',
30
- nm: '1',
31
- rid: '1',
32
- s: '0',
33
- time: '5:54:8.103',
34
- z: '15.248670953423606',
35
- })
36
- .then((response) => {
37
- // Correct url
38
- expect(fetch.mock.calls[0][0]).toEqual(
39
- 'https://api.geops.io/tracker/v1/trajectorybyid?a=1&bbox=917830.8141233932%2C5949421.787168904%2C926771.7516620635%2C5953300.375201735&btime=5%3A54%3A7.880&cd=1&date=20200701&etime=5%3A54%3A24.582&fl=1&id=16617%3A3&key=apiKey&nm=1&rid=1&s=0&time=5%3A54%3A8.103&z=15.248670953423606',
40
- );
41
-
42
- // Correct search result
43
- expect(response.rid).toEqual('21120.000011.101:1');
44
- });
45
- });
46
-
47
- test('should trigger error message', () => {
48
- // Mock console statement
49
- const consoleOutput = [];
50
- // eslint-disable-next-line no-console
51
- console.warn = (message, err) =>
52
- consoleOutput.push([message, err.toString()]);
53
-
54
- fetch.mockResponseOnce('invalid json');
55
-
56
- return api
57
- .fetchTrajectoryById({
58
- attr_det: '1',
59
- bbox: '922972.5439121567,5951167.694705085,923812.5648796591,5951532.096677226',
60
- btime: '5:18:31.766',
61
- etime: '5:18:41.967',
62
- date: '20200701',
63
- rid: '1',
64
- a: '1',
65
- cd: '1',
66
- nm: '1',
67
- fl: '1',
68
- s: '0',
69
- z: '18.66059982835272',
70
- })
71
- .catch((err) => {
72
- expect(err.name).toEqual('FetchError');
73
- expect(err.message).toEqual(
74
- 'invalid json response body at reason: Unexpected token i in JSON at position 0',
75
- );
76
- });
77
- });
78
- });
79
-
80
- describe('#fetchTrajectories', () => {
81
- test('should success', () => {
82
- fetch.mockResponseOnce(JSON.stringify(global.fetchTrajectoriesResponse));
83
-
84
- return api
85
- .fetchTrajectories({
86
- attr_det: '1',
87
- bbox: '922972.5439121567,5951167.694705085,923812.5648796591,5951532.096677226',
88
- btime: '5:18:31.766',
89
- etime: '5:18:41.967',
90
- date: '20200701',
91
- rid: '1',
92
- a: '1',
93
- cd: '1',
94
- nm: '1',
95
- fl: '1',
96
- s: '0',
97
- z: '18.66059982835272',
98
- })
99
- .then((features) => {
100
- // Correct url
101
- expect(fetch.mock.calls[0][0]).toEqual(
102
- 'https://api.geops.io/tracker/v1/trajectory_collection?a=1&attr_det=1&bbox=922972.5439121567%2C5951167.694705085%2C923812.5648796591%2C5951532.096677226&btime=5%3A18%3A31.766&cd=1&date=20200701&etime=5%3A18%3A41.967&fl=1&key=apiKey&nm=1&rid=1&s=0&z=18.66059982835272',
103
- );
104
-
105
- // Correct search result
106
- expect(features[0].id).toEqual(4150092);
107
- });
108
- });
109
-
110
- test('should display error message if the transformation fails', () => {
111
- fetch.mockResponseOnce(JSON.stringify({ foo: 'bar' }));
112
-
113
- return api
114
- .fetchTrajectories({
115
- attr_det: '1',
116
- bbox: '922972.5439121567,5951167.694705085,923812.5648796591,5951532.096677226',
117
- btime: '5:18:31.766',
118
- etime: '5:18:41.967',
119
- date: '20200701',
120
- rid: '1',
121
- a: '1',
122
- cd: '1',
123
- nm: '1',
124
- fl: '1',
125
- s: '0',
126
- z: '18.66059982835272',
127
- })
128
- .catch((err) => {
129
- expect(err.name).toEqual('TypeError');
130
- expect(err.message).toEqual(
131
- "Cannot read property 'length' of undefined",
132
- );
133
- });
134
- });
135
- });
136
-
137
- describe('#fetchTrajectoryStations', () => {
138
- test('should success', () => {
139
- fetch.mockResponseOnce(
140
- JSON.stringify(global.fetchTrajectoryStationsResponse),
141
- );
142
-
143
- return api
144
- .fetchTrajectoryStations({
145
- a: '1',
146
- bbox: '1059098.4179109985,5917420.543096403,1063534.5137495932,5919344.9260996',
147
- btime: '6:17:22.722',
148
- cd: '1',
149
- date: '20200701',
150
- etime: '6:17:33.526',
151
- fl: '1',
152
- id: '1714251',
153
- key: 'apiKey',
154
- nm: '1',
155
- rid: '1',
156
- s: '0',
157
- time: '6:17:23.34',
158
- z: '16.259806538265146',
159
- })
160
- .then((response) => {
161
- // Correct url
162
- expect(fetch.mock.calls[0][0]).toEqual(
163
- 'https://api.geops.io/tracker/v1/trajstations?a=1&bbox=1059098.4179109985%2C5917420.543096403%2C1063534.5137495932%2C5919344.9260996&btime=6%3A17%3A22.722&cd=1&date=20200701&etime=6%3A17%3A33.526&fl=1&id=1714251&key=apiKey&nm=1&rid=1&s=0&time=6%3A17%3A23.34&z=16.259806538265146',
164
- );
165
-
166
- // Correct search result
167
- expect(response.routeIdentifier).toEqual('01716.000072.001:1716');
168
- });
169
- });
170
- });
171
- });
@@ -1,191 +0,0 @@
1
- import { LineString } from 'ol/geom';
2
-
3
- /**
4
- * Translate the response date object into a readable object.
5
- * @return {Date[]}
6
- * @ignore
7
- */
8
- const translateDates = (dates = []) => {
9
- const newDates = [];
10
-
11
- for (let i = 0; i < dates.length; i += 1) {
12
- const { d: day, m: month, y: year } = dates[i];
13
- newDates.push({
14
- day,
15
- month,
16
- year,
17
- });
18
- }
19
- return newDates;
20
- };
21
-
22
- /**
23
- * Translate the trajstations response into a readable object.
24
- * @return {Object} returns a readable object
25
- * @private
26
- */
27
- export const translateTrajStationsResp = (data) => {
28
- const newData = { ...data };
29
-
30
- // MAke sure all property exists.
31
- ['a', 'f', 'tt'].forEach((prop) => {
32
- if (!newData[prop]) {
33
- newData[prop] = {};
34
- }
35
- });
36
-
37
- const {
38
- id,
39
- hs: destination,
40
- t: vehicleType,
41
- ln: longName,
42
- sn: shortName,
43
- wa: wheelchairAccessible,
44
- ba: bicyclesAllowed,
45
- rt: realTime,
46
- fid: feedsId,
47
- rid: routeIdentifier,
48
- c: bgColor,
49
- tc: datacolor,
50
- a: { n: operator, u: operatorUrl, tz: operatorTimeZone },
51
- f: { n: publisher, u: publisherUrl, tz: publisherTimeZone },
52
- tt: {
53
- n: dateNotOperatingDays,
54
- p: dateAdditionalOperatingDays,
55
- t: operatingPeriod,
56
- },
57
- sts: dataStations,
58
- } = newData;
59
-
60
- const notOperatingDays = translateDates(dateNotOperatingDays);
61
- const additionalOperatingDays = translateDates(dateAdditionalOperatingDays);
62
- const backgroundColor = bgColor && `#${bgColor}`;
63
- const color = datacolor && `#${datacolor}`;
64
-
65
- const stations = [];
66
- for (let i = 0; i < (dataStations || []).length; i += 1) {
67
- const {
68
- sid: stationId,
69
- n: stationName,
70
- p: coordinates,
71
- at: arrivalTime,
72
- dt: departureTime,
73
- ap: arrivalDate,
74
- dp: departureDate,
75
- ad: arrivalDelay,
76
- dd: departureDelay,
77
- dot: noDropOff,
78
- put: noPickUp,
79
- c: cancelled,
80
- wa: stWheelchairAccessible,
81
- } = dataStations[i];
82
-
83
- stations.push({
84
- stationId,
85
- stationName,
86
- coordinates,
87
- arrivalTime: arrivalTime !== -1 ? arrivalDate * 1000 : null,
88
- departureTime: departureTime !== -1 ? departureDate * 1000 : null,
89
- arrivalDelay,
90
- departureDelay,
91
- noDropOff: !!noDropOff,
92
- noPickUp: !!noPickUp,
93
- cancelled: !!cancelled,
94
- wheelchairAccessible: !!stWheelchairAccessible,
95
- });
96
- }
97
-
98
- return {
99
- id,
100
- destination,
101
- backgroundColor,
102
- color,
103
- vehicleType,
104
- routeIdentifier,
105
- longName,
106
- shortName,
107
- stations,
108
- wheelchairAccessible: !!wheelchairAccessible,
109
- bicyclesAllowed: !!bicyclesAllowed,
110
- realTime,
111
- feedsId,
112
- operatingInformations: {
113
- operatingPeriod,
114
- notOperatingDays,
115
- additionalOperatingDays,
116
- },
117
- operator,
118
- operatorUrl,
119
- operatorTimeZone,
120
- publisher,
121
- publisherUrl,
122
- publisherTimeZone,
123
- };
124
- };
125
-
126
- /**
127
- * Translate the trajectory_collection response into a js usable object.
128
- * @return {Array} returns an array of trajectories.
129
- * @ignore
130
- */
131
- export const translateTrajCollResponse = (features = []) => {
132
- const trajectories = [];
133
- for (let i = 0; i < features.length; i += 1) {
134
- const traj = features[i];
135
- const geometry = new LineString(traj.geometry.coordinates);
136
- const {
137
- ID: id,
138
- ProductIdentifier: type,
139
- PublishedLineName: name,
140
- RouteIdentifier: routeIdentifier,
141
- DirectionText: directionText,
142
- Operator: operator,
143
- OperatorURL: operatorUrl,
144
- Publisher: publisher,
145
- PublisherURL: publisherUrl,
146
- License: license,
147
- LicenseUrl: licenseUrl,
148
- LicenseNote: licenseNote,
149
- Color: color,
150
- JourneyIdentifier: journeyIdentifier,
151
- RealtimeAvailable: realtimeAvailable,
152
- OperatorProvidesRealtime: operatorProvidesRealtime,
153
- DayOfOperation: dayOfOperation,
154
- Delay: delay,
155
- TimeIntervals: timeIntervals,
156
- TextColor: textColor,
157
- Cancelled: cancelled,
158
- } = traj.properties;
159
-
160
- trajectories.push({
161
- id,
162
- type,
163
- name,
164
- routeIdentifier,
165
- directionText,
166
- operator,
167
- operatorUrl,
168
- publisher,
169
- publisherUrl,
170
- license,
171
- licenseUrl,
172
- licenseNote,
173
- journeyIdentifier,
174
- realtimeAvailable,
175
- operatorProvidesRealtime,
176
- dayOfOperation,
177
- delay,
178
- timeIntervals,
179
- color: color && `#${color}`,
180
- textColor: textColor && `#${textColor}`,
181
- geometry,
182
- cancelled,
183
- });
184
- }
185
- return trajectories;
186
- };
187
-
188
- export default {
189
- translateTrajCollResponse,
190
- translateTrajStationsResp,
191
- };
@@ -1,40 +0,0 @@
1
- import { translateTrajStationsResp } from './TrajservAPIUtils';
2
-
3
- describe('TrajservAPIUtils', () => {
4
- describe('#translateTrajStationsResp', () => {
5
- test("should success even if data doesn't have all properties set", () => {
6
- const empty = {
7
- backgroundColor: undefined,
8
- bicyclesAllowed: false,
9
- color: undefined,
10
- destination: undefined,
11
- feedsId: undefined,
12
- id: undefined,
13
- longName: undefined,
14
- operatingInformations: {
15
- additionalOperatingDays: [],
16
- notOperatingDays: [],
17
- operatingPeriod: undefined,
18
- },
19
- operator: undefined,
20
- operatorTimeZone: undefined,
21
- operatorUrl: undefined,
22
- publisher: undefined,
23
- publisherTimeZone: undefined,
24
- publisherUrl: undefined,
25
- realTime: undefined,
26
- routeIdentifier: undefined,
27
- shortName: undefined,
28
- stations: [],
29
- vehicleType: undefined,
30
- wheelchairAccessible: false,
31
- };
32
- let a = translateTrajStationsResp({});
33
- expect(a).toEqual(empty);
34
- a = translateTrajStationsResp(null);
35
- expect(a).toEqual(empty);
36
- a = translateTrajStationsResp(undefined);
37
- expect(a).toEqual(empty);
38
- });
39
- });
40
- });
@@ -1,44 +0,0 @@
1
- /**
2
- * @typedef {Object} OperatingInformations
3
- * @property {string} operatingPeriod
4
- * @property {string} notOperatingDays
5
- * @property {string} additionalOperatingDays
6
- *
7
- */
8
-
9
- /**
10
- * @typedef {Object} TrajservTrajectory
11
- * @property {string} id
12
- * @property {string} type
13
- * @property {string} name
14
- * @property {string} color
15
- * @property {string} textColor
16
- * @property {string} delay
17
- * @property {string} operator
18
- * @property {string} journeyIdentifier
19
- * @property {string} routeIdentifier
20
- * @property {string} timeIntervals
21
- * @property {ol/geom/LineString~LineString} geometry A LineString in [EPSG:4326](http://epsg.io/4326).
22
- * @property {string} cancelled
23
- */
24
-
25
- /**
26
- * @typedef {Object} TrajectoryStation
27
- * @property {string} id
28
- * @property {string} destination
29
- * @property {string} backgroundColor
30
- * @property {string} color
31
- * @property {string} vehicleType
32
- * @property {string} routeIdentifier
33
- * @property {string} longName
34
- * @property {string} shortName
35
- * @property {string} stations
36
- * @property {string} wheelchairAccessible
37
- * @property {string} bicyclesAllowed
38
- * @property {string} realTime
39
- * @property {string} feedsId
40
- * @property {OperatingInformations} operatingInformations
41
- * @property {string} operator
42
- * @property {string} operatorUrl
43
- * @property {string} operatorTimeZone
44
- */
@@ -1,103 +0,0 @@
1
- /* eslint-disable no-empty-function */
2
- /* eslint-disable no-useless-constructor */
3
- /* eslint-disable class-methods-use-this */
4
- // eslint-disable-next-line max-classes-per-file
5
- import Control from '../controls/Control';
6
-
7
- /**
8
- * Map interface.
9
- */
10
- export class MapInterface {
11
- /**
12
- * Constructor.
13
- *
14
- * @param {Object} options Map options
15
- * @param {Array<Layer>} [options.layers] Custom layers of the map.
16
- * @param {Array<Control>} [options.controls] Custom controls of the map.
17
- */
18
- // eslint-disable-next-line no-unused-vars
19
- constructor(options = {}) {}
20
-
21
- /**
22
- * Returns the HTML element of the map.
23
- * @return {HTMLElement}
24
- */
25
- getContainer() {}
26
-
27
- /**
28
- * Returns a list of mobility layers.
29
- * @return {Layer[]}
30
- */
31
- getMobilityLayers() {}
32
-
33
- /**
34
- * Returns a list of mobility controls.
35
- * @return {Control[]}
36
- */
37
- getMobilityControls() {}
38
- }
39
-
40
- /**
41
- * Mixin for MapInterface.
42
- * @ignore
43
- */
44
- const MapMixin = (Base) =>
45
- class extends Base {
46
- constructor(options = {}) {
47
- super({ ...options, layers: [], controls: [] });
48
- this.mobilityLayers = [];
49
- this.mobilityControls = [];
50
-
51
- // Add controls
52
- (options.controls || []).forEach((control) => {
53
- this.addControl(control);
54
- });
55
-
56
- // Add layers
57
- (options.layers || []).forEach((layer) => {
58
- this.addLayer(layer);
59
- });
60
- }
61
-
62
- getMobilityLayers() {
63
- return this.mobilityLayers;
64
- }
65
-
66
- getMobilityControls() {
67
- return this.mobilityControls;
68
- }
69
-
70
- addMobilityControl(control) {
71
- this.mobilityControls.push(control);
72
- // eslint-disable-next-line no-param-reassign
73
- control.map = this;
74
- }
75
-
76
- removeMobilityControl(control) {
77
- // eslint-disable-next-line no-param-reassign
78
- control.map = null;
79
- this.mobilityControls = this.mobilityControls.filter(
80
- (c) => c !== control,
81
- );
82
- }
83
-
84
- /** Documentation in inherited classes */
85
- addControl(control, position) {
86
- if (control instanceof Control) {
87
- this.addMobilityControl(control);
88
- } else {
89
- super.addControl(control, position);
90
- }
91
- }
92
-
93
- /** Documentation in inherited classes */
94
- removeControl(control) {
95
- if (control instanceof Control) {
96
- this.removeMobilityControl(control);
97
- } else {
98
- super.removeControl(control);
99
- }
100
- }
101
- };
102
-
103
- export default MapMixin;