proximiio-js-library 1.2.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 (100) hide show
  1. package/README.md +719 -0
  2. package/assets/proximiio-js-library.css +520 -0
  3. package/assets/tbtnav.js +3 -0
  4. package/assets/wayfinding.d.ts +3 -0
  5. package/assets/wayfinding.js +1586 -0
  6. package/lib/common.d.ts +7 -0
  7. package/lib/common.js +49 -0
  8. package/lib/components/map/constants.d.ts +6 -0
  9. package/lib/components/map/constants.js +30 -0
  10. package/lib/components/map/custom-layers.d.ts +5 -0
  11. package/lib/components/map/custom-layers.js +74 -0
  12. package/lib/components/map/icons.d.ts +23 -0
  13. package/lib/components/map/icons.js +64 -0
  14. package/lib/components/map/layers/any_layer.d.ts +9 -0
  15. package/lib/components/map/layers/any_layer.js +2 -0
  16. package/lib/components/map/layers/background_layer.d.ts +16 -0
  17. package/lib/components/map/layers/background_layer.js +52 -0
  18. package/lib/components/map/layers/base_layer.d.ts +18 -0
  19. package/lib/components/map/layers/base_layer.js +127 -0
  20. package/lib/components/map/layers/circle_layer.d.ts +25 -0
  21. package/lib/components/map/layers/circle_layer.js +62 -0
  22. package/lib/components/map/layers/fill_extrusion_layer.d.ts +21 -0
  23. package/lib/components/map/layers/fill_extrusion_layer.js +57 -0
  24. package/lib/components/map/layers/fill_layer.d.ts +21 -0
  25. package/lib/components/map/layers/fill_layer.js +57 -0
  26. package/lib/components/map/layers/heatmap_layer.d.ts +18 -0
  27. package/lib/components/map/layers/heatmap_layer.js +54 -0
  28. package/lib/components/map/layers/hillshade_layer.d.ts +19 -0
  29. package/lib/components/map/layers/hillshade_layer.js +55 -0
  30. package/lib/components/map/layers/line_layer.d.ts +28 -0
  31. package/lib/components/map/layers/line_layer.js +64 -0
  32. package/lib/components/map/layers/raster_layer.d.ts +21 -0
  33. package/lib/components/map/layers/raster_layer.js +57 -0
  34. package/lib/components/map/layers/symbol_layer.d.ts +71 -0
  35. package/lib/components/map/layers/symbol_layer.js +153 -0
  36. package/lib/components/map/main.d.ts +625 -0
  37. package/lib/components/map/main.js +1765 -0
  38. package/lib/components/map/metadata.d.ts +134 -0
  39. package/lib/components/map/metadata.js +135 -0
  40. package/lib/components/map/routing.d.ts +12 -0
  41. package/lib/components/map/routing.js +74 -0
  42. package/lib/components/map/sources/base_source.d.ts +10 -0
  43. package/lib/components/map/sources/base_source.js +38 -0
  44. package/lib/components/map/sources/cluster_source.d.ts +7 -0
  45. package/lib/components/map/sources/cluster_source.js +30 -0
  46. package/lib/components/map/sources/data_source.d.ts +17 -0
  47. package/lib/components/map/sources/data_source.js +46 -0
  48. package/lib/components/map/sources/geojson_source.d.ts +16 -0
  49. package/lib/components/map/sources/geojson_source.js +77 -0
  50. package/lib/components/map/sources/image_source_manager.d.ts +16 -0
  51. package/lib/components/map/sources/image_source_manager.js +131 -0
  52. package/lib/components/map/sources/routing_source.d.ts +22 -0
  53. package/lib/components/map/sources/routing_source.js +131 -0
  54. package/lib/components/map/sources/synthetic_source.d.ts +7 -0
  55. package/lib/components/map/sources/synthetic_source.js +32 -0
  56. package/lib/components/map/sources/vector_source.d.ts +8 -0
  57. package/lib/components/map/sources/vector_source.js +31 -0
  58. package/lib/components/select/main.d.ts +66 -0
  59. package/lib/components/select/main.js +195 -0
  60. package/lib/controllers/auth.d.ts +48 -0
  61. package/lib/controllers/auth.js +156 -0
  62. package/lib/controllers/floors.d.ts +14 -0
  63. package/lib/controllers/floors.js +105 -0
  64. package/lib/controllers/geo.d.ts +10 -0
  65. package/lib/controllers/geo.js +131 -0
  66. package/lib/controllers/places.d.ts +14 -0
  67. package/lib/controllers/places.js +108 -0
  68. package/lib/controllers/repository.d.ts +24 -0
  69. package/lib/controllers/repository.js +68 -0
  70. package/lib/controllers/style.d.ts +4 -0
  71. package/lib/controllers/style.js +76 -0
  72. package/lib/eventable.d.ts +7 -0
  73. package/lib/eventable.js +29 -0
  74. package/lib/index.d.ts +26 -0
  75. package/lib/index.js +14 -0
  76. package/lib/models/amenity.d.ts +11 -0
  77. package/lib/models/amenity.js +41 -0
  78. package/lib/models/auth-data.d.ts +4 -0
  79. package/lib/models/auth-data.js +2 -0
  80. package/lib/models/base.d.ts +7 -0
  81. package/lib/models/base.js +18 -0
  82. package/lib/models/feature.d.ts +46 -0
  83. package/lib/models/feature.js +277 -0
  84. package/lib/models/floor.d.ts +30 -0
  85. package/lib/models/floor.js +51 -0
  86. package/lib/models/geopoint.d.ts +6 -0
  87. package/lib/models/geopoint.js +2 -0
  88. package/lib/models/mapbox-options.d.ts +171 -0
  89. package/lib/models/mapbox-options.js +2 -0
  90. package/lib/models/person.d.ts +8 -0
  91. package/lib/models/person.js +18 -0
  92. package/lib/models/place.d.ts +14 -0
  93. package/lib/models/place.js +40 -0
  94. package/lib/models/poi_type.d.ts +19 -0
  95. package/lib/models/poi_type.js +25 -0
  96. package/lib/models/style.d.ts +53 -0
  97. package/lib/models/style.js +424 -0
  98. package/lib/proximiio.js +2 -0
  99. package/lib/proximiio.js.LICENSE.txt +79 -0
  100. package/package.json +61 -0
@@ -0,0 +1,134 @@
1
+ declare const _default: {
2
+ 'proximiio:languages': {
3
+ en: {
4
+ title: string;
5
+ level: {
6
+ zero: string;
7
+ one: string;
8
+ two: string;
9
+ few: string;
10
+ many: string;
11
+ other: string;
12
+ };
13
+ meter: {
14
+ zero: string;
15
+ one: string;
16
+ two: string;
17
+ few: string;
18
+ many: string;
19
+ other: string;
20
+ };
21
+ turn_before: string;
22
+ turn_prepare: string;
23
+ turn_now: string;
24
+ continue: string;
25
+ levelchange: string;
26
+ turn_left_hard: string;
27
+ turn_left: string;
28
+ turn_left_slight: string;
29
+ turn_straight: string;
30
+ turn_right_slight: string;
31
+ turn_right: string;
32
+ turn_right_hard: string;
33
+ turn_around: string;
34
+ destination_nearing: string;
35
+ destination_reached: string;
36
+ canceled: string;
37
+ calculating: string;
38
+ recalculating: string;
39
+ path_not_found: string;
40
+ level_change_down: string;
41
+ level_change_up: string;
42
+ passing_poi: string;
43
+ left: string;
44
+ right: string;
45
+ };
46
+ fi: {
47
+ title: string;
48
+ level: {
49
+ zero: string;
50
+ one: string;
51
+ two: string;
52
+ few: string;
53
+ many: string;
54
+ other: string;
55
+ };
56
+ meter: {
57
+ zero: string;
58
+ one: string;
59
+ two: string;
60
+ few: string;
61
+ many: string;
62
+ other: string;
63
+ };
64
+ turn_before: string;
65
+ turn_prepare: string;
66
+ turn_now: string;
67
+ continue: string;
68
+ levelchange: string;
69
+ turn_left_hard: string;
70
+ turn_left: string;
71
+ turn_left_slight: string;
72
+ turn_straight: string;
73
+ turn_right_slight: string;
74
+ turn_right: string;
75
+ turn_right_hard: string;
76
+ turn_around: string;
77
+ destination_nearing: string;
78
+ destination_reached: string;
79
+ canceled: string;
80
+ calculating: string;
81
+ recalculating: string;
82
+ path_not_found: string;
83
+ level_change_down: string;
84
+ level_change_up: string;
85
+ passing_poi: string;
86
+ left: string;
87
+ right: string;
88
+ };
89
+ };
90
+ en: {
91
+ title: string;
92
+ level: {
93
+ zero: string;
94
+ one: string;
95
+ two: string;
96
+ few: string;
97
+ many: string;
98
+ other: string;
99
+ };
100
+ meter: {
101
+ zero: string;
102
+ one: string;
103
+ two: string;
104
+ few: string;
105
+ many: string;
106
+ other: string;
107
+ };
108
+ turn_before: string;
109
+ turn_prepare: string;
110
+ turn_now: string;
111
+ continue: string;
112
+ levelchange: string;
113
+ turn_left_hard: string;
114
+ turn_left: string;
115
+ turn_left_slight: string;
116
+ turn_straight: string;
117
+ turn_right_slight: string;
118
+ turn_right: string;
119
+ turn_right_hard: string;
120
+ turn_around: string;
121
+ destination_nearing: string;
122
+ destination_reached: string;
123
+ canceled: string;
124
+ calculating: string;
125
+ recalculating: string;
126
+ path_not_found: string;
127
+ level_change_down: string;
128
+ level_change_up: string;
129
+ passing_poi: string;
130
+ left: string;
131
+ right: string;
132
+ };
133
+ };
134
+ export default _default;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ 'proximiio:languages': {
5
+ en: {
6
+ title: 'English',
7
+ level: {
8
+ zero: 'levels',
9
+ one: 'level',
10
+ two: 'levels',
11
+ few: 'levels',
12
+ many: 'levels',
13
+ other: 'levels',
14
+ },
15
+ meter: {
16
+ zero: 'meters',
17
+ one: 'meter',
18
+ two: 'meters',
19
+ few: 'meters',
20
+ many: 'meters',
21
+ other: 'meters',
22
+ },
23
+ turn_before: 'In %d %s %s.',
24
+ turn_prepare: 'Prepare to %s in %d %s.',
25
+ turn_now: '%s.',
26
+ continue: 'Continue %d %s.',
27
+ levelchange: 'Use %s to get to %d %s.',
28
+ turn_left_hard: 'turn hard left',
29
+ turn_left: 'turn left',
30
+ turn_left_slight: 'turn slight left',
31
+ turn_straight: 'continue straight',
32
+ turn_right_slight: 'turn slight right',
33
+ turn_right: 'turn right',
34
+ turn_right_hard: 'turn right',
35
+ turn_around: 'turn around',
36
+ destination_nearing: 'In %d %s you will arrive at your destination.',
37
+ destination_reached: 'You have reached your destination',
38
+ canceled: 'Navigation was canceled.',
39
+ calculating: 'Calculating route...',
40
+ recalculating: 'Recalculating route...',
41
+ path_not_found: 'Unable to find path.',
42
+ level_change_down: 'go %d %s up to %s %d.',
43
+ level_change_up: 'go %d %s up to %s %d.',
44
+ passing_poi: 'Passing %s on your %s',
45
+ left: 'left',
46
+ right: 'right',
47
+ },
48
+ fi: {
49
+ title: 'English',
50
+ level: {
51
+ zero: 'levels',
52
+ one: 'level',
53
+ two: 'levels',
54
+ few: 'levels',
55
+ many: 'levels',
56
+ other: 'levels',
57
+ },
58
+ meter: {
59
+ zero: 'meters',
60
+ one: 'meter',
61
+ two: 'meters',
62
+ few: 'meters',
63
+ many: 'meters',
64
+ other: 'meters',
65
+ },
66
+ turn_before: 'In %d %s %s.',
67
+ turn_prepare: 'Prepare to %s in %d %s.',
68
+ turn_now: '%s.',
69
+ continue: 'Continue %d %s.',
70
+ levelchange: 'Use %s to get to %d %s.',
71
+ turn_left_hard: 'turn hard left',
72
+ turn_left: 'turn left',
73
+ turn_left_slight: 'turn slight left',
74
+ turn_straight: 'continue straight',
75
+ turn_right_slight: 'turn slight right',
76
+ turn_right: 'turn right',
77
+ turn_right_hard: 'turn right',
78
+ turn_around: 'turn around',
79
+ destination_nearing: 'In %d %s you will arrive at your destination.',
80
+ destination_reached: 'You have reached your destination',
81
+ canceled: 'Navigation was canceled.',
82
+ calculating: 'Calculating route...',
83
+ recalculating: 'Recalculating route...',
84
+ path_not_found: 'Unable to find path.',
85
+ level_change_down: 'go %d %s up to %s %d.',
86
+ level_change_up: 'go %d %s up to %s %d.',
87
+ passing_poi: 'Passing %s on your %s',
88
+ left: 'left',
89
+ right: 'right',
90
+ },
91
+ },
92
+ en: {
93
+ title: 'English',
94
+ level: {
95
+ zero: 'levels',
96
+ one: 'level',
97
+ two: 'levels',
98
+ few: 'levels',
99
+ many: 'levels',
100
+ other: 'levels',
101
+ },
102
+ meter: {
103
+ zero: 'meters',
104
+ one: 'meter',
105
+ two: 'meters',
106
+ few: 'meters',
107
+ many: 'meters',
108
+ other: 'meters',
109
+ },
110
+ turn_before: 'In %d %s %s.',
111
+ turn_prepare: 'Prepare to %s in %d %s.',
112
+ turn_now: '%s.',
113
+ continue: 'Continue %d %s.',
114
+ levelchange: 'Use %s to get to %d %s.',
115
+ turn_left_hard: 'turn hard left',
116
+ turn_left: 'turn left',
117
+ turn_left_slight: 'turn slight left',
118
+ turn_straight: 'continue straight',
119
+ turn_right_slight: 'turn slight right',
120
+ turn_right: 'turn right',
121
+ turn_right_hard: 'turn right',
122
+ turn_around: 'turn around',
123
+ destination_nearing: 'In %d %s you will arrive at your destination.',
124
+ destination_reached: 'You have reached your destination',
125
+ canceled: 'Navigation was canceled.',
126
+ calculating: 'Calculating route...',
127
+ recalculating: 'Recalculating route...',
128
+ path_not_found: 'Unable to find path.',
129
+ level_change_down: 'go %d %s up to %s %d.',
130
+ level_change_up: 'go %d %s up to %s %d.',
131
+ passing_poi: 'Passing %s on your %s',
132
+ left: 'left',
133
+ right: 'right',
134
+ },
135
+ };
@@ -0,0 +1,12 @@
1
+ import Feature, { FeatureCollection } from '../../models/feature';
2
+ export default class Routing {
3
+ data: FeatureCollection;
4
+ wayfinding: any;
5
+ constructor();
6
+ setData(collection: FeatureCollection): void;
7
+ toggleOnlyAccessible(onlyAccessible: any): void;
8
+ route(start: Feature, finish: Feature): {
9
+ levelPaths: any;
10
+ points: any;
11
+ };
12
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // @ts-ignore
4
+ var wayfinding_1 = require("../../../assets/wayfinding");
5
+ var feature_1 = require("../../models/feature");
6
+ var helpers_1 = require("@turf/helpers");
7
+ var Routing = /** @class */ (function () {
8
+ function Routing() {
9
+ this.data = new feature_1.FeatureCollection({});
10
+ }
11
+ Routing.prototype.setData = function (collection) {
12
+ this.data = collection;
13
+ this.wayfinding = new wayfinding_1.Wayfinding(this.data);
14
+ this.wayfinding.preprocess();
15
+ // pathfinding.load(neighbourList, wallOffsets);
16
+ // this.pathFinder.setConfiguration({
17
+ // avoidEscalators: true,
18
+ // avoidNarrowPaths: true,
19
+ // avoidRevolvingDoors: true
20
+ // });
21
+ };
22
+ Routing.prototype.toggleOnlyAccessible = function (onlyAccessible) {
23
+ if (onlyAccessible) {
24
+ this.wayfinding.setConfiguration({
25
+ avoidStaircases: true,
26
+ avoidBarriers: true,
27
+ avoidNarrowPaths: true,
28
+ avoidRevolvingDoors: true,
29
+ avoidTicketGates: true,
30
+ });
31
+ }
32
+ else {
33
+ this.wayfinding.setConfiguration({
34
+ avoidElevators: false,
35
+ avoidEscalators: false,
36
+ avoidStaircases: false,
37
+ avoidRamps: false,
38
+ avoidNarrowPaths: false,
39
+ avoidRevolvingDoors: false,
40
+ avoidTicketGates: false,
41
+ avoidBarriers: false,
42
+ });
43
+ }
44
+ };
45
+ Routing.prototype.route = function (start, finish) {
46
+ var points = this.wayfinding.runAStar(start, finish);
47
+ if (!points) {
48
+ return null;
49
+ }
50
+ var levelPoints = {};
51
+ // tslint:disable-next-line:no-shadowed-variable
52
+ points.forEach(function (point) {
53
+ if (typeof levelPoints[point.properties.level] === 'undefined') {
54
+ levelPoints[point.properties.level] = [];
55
+ }
56
+ levelPoints[point.properties.level].push(point);
57
+ });
58
+ var levels = Object.keys(levelPoints);
59
+ var levelPaths = {};
60
+ levels.forEach(function (level) {
61
+ if (levelPoints[level].length > 1) {
62
+ // tslint:disable-next-line:no-shadowed-variable
63
+ levelPaths[level] = new feature_1.default(helpers_1.lineString(levelPoints[level].map(function (point) { return point.geometry.coordinates; })));
64
+ }
65
+ else {
66
+ // tslint:disable-next-line:no-shadowed-variable
67
+ levelPaths[level] = new feature_1.default(helpers_1.point(levelPoints[level].map(function (point) { return point.geometry.coordinates; })));
68
+ }
69
+ });
70
+ return { levelPaths: levelPaths, points: points };
71
+ };
72
+ return Routing;
73
+ }());
74
+ exports.default = Routing;
@@ -0,0 +1,10 @@
1
+ import { Eventable } from '../../../eventable';
2
+ export declare type BaseSourceType = 'vector' | 'raster' | 'raster-dem' | 'geojson' | 'image' | 'video';
3
+ export default class BaseSource extends Eventable {
4
+ id: string;
5
+ type: BaseSourceType;
6
+ constructor(id: string, type: BaseSourceType);
7
+ get source(): {
8
+ type: BaseSourceType;
9
+ };
10
+ }
@@ -0,0 +1,38 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var eventable_1 = require("../../../eventable");
19
+ var BaseSource = /** @class */ (function (_super) {
20
+ __extends(BaseSource, _super);
21
+ function BaseSource(id, type) {
22
+ var _this = _super.call(this) || this;
23
+ _this.id = id;
24
+ _this.type = type;
25
+ return _this;
26
+ }
27
+ Object.defineProperty(BaseSource.prototype, "source", {
28
+ get: function () {
29
+ return {
30
+ type: this.type,
31
+ };
32
+ },
33
+ enumerable: false,
34
+ configurable: true
35
+ });
36
+ return BaseSource;
37
+ }(eventable_1.Eventable));
38
+ exports.default = BaseSource;
@@ -0,0 +1,7 @@
1
+ import DataSource from './data_source';
2
+ import { FeatureCollection } from '../../../models/feature';
3
+ export default class ClusterSource extends DataSource {
4
+ cluster: boolean;
5
+ data: FeatureCollection;
6
+ constructor();
7
+ }
@@ -0,0 +1,30 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var data_source_1 = require("./data_source");
19
+ var feature_1 = require("../../../models/feature");
20
+ var ClusterSource = /** @class */ (function (_super) {
21
+ __extends(ClusterSource, _super);
22
+ function ClusterSource() {
23
+ var _this = _super.call(this, 'clusters') || this;
24
+ _this.cluster = true;
25
+ _this.data = new feature_1.FeatureCollection({});
26
+ return _this;
27
+ }
28
+ return ClusterSource;
29
+ }(data_source_1.default));
30
+ exports.default = ClusterSource;
@@ -0,0 +1,17 @@
1
+ import BaseSource from './base_source';
2
+ import { FeatureCollection } from '../../../models/feature';
3
+ export default class DataSource extends BaseSource {
4
+ data: FeatureCollection;
5
+ cluster: boolean;
6
+ clusterRadius: number;
7
+ clusterMaxZoom: number;
8
+ isEditable: boolean;
9
+ constructor(id: string, data?: FeatureCollection);
10
+ get source(): {
11
+ type: import("./base_source").BaseSourceType;
12
+ data: FeatureCollection;
13
+ cluster: boolean;
14
+ clusterMaxZoom: number;
15
+ clusterRadius: number;
16
+ };
17
+ }
@@ -0,0 +1,46 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var base_source_1 = require("./base_source");
19
+ var feature_1 = require("../../../models/feature");
20
+ var DataSource = /** @class */ (function (_super) {
21
+ __extends(DataSource, _super);
22
+ function DataSource(id, data) {
23
+ var _this = _super.call(this, id, 'geojson') || this;
24
+ _this.cluster = false;
25
+ _this.clusterRadius = 50;
26
+ _this.clusterMaxZoom = 19;
27
+ _this.isEditable = true;
28
+ _this.data = data || new feature_1.FeatureCollection({});
29
+ return _this;
30
+ }
31
+ Object.defineProperty(DataSource.prototype, "source", {
32
+ get: function () {
33
+ return {
34
+ type: this.type,
35
+ data: this.data,
36
+ cluster: this.cluster,
37
+ clusterMaxZoom: this.clusterMaxZoom,
38
+ clusterRadius: this.clusterRadius,
39
+ };
40
+ },
41
+ enumerable: false,
42
+ configurable: true
43
+ });
44
+ return DataSource;
45
+ }(base_source_1.default));
46
+ exports.default = DataSource;
@@ -0,0 +1,16 @@
1
+ import DataSource from './data_source';
2
+ import Feature, { FeatureCollection } from '../../../models/feature';
3
+ export default class GeoJSONSource extends DataSource {
4
+ language: string;
5
+ constructor(features: FeatureCollection);
6
+ fetch(data: any): void;
7
+ create(feature: Feature): void;
8
+ update(feature: Feature): void;
9
+ delete(id: string): void;
10
+ mapLanguage(): void;
11
+ mapFeatureLanguage(feature: Feature, language: string): void;
12
+ query(query: string, level?: number): Feature[];
13
+ get(id: string): Feature;
14
+ getInternal(id: string): Feature;
15
+ get collection(): FeatureCollection;
16
+ }
@@ -0,0 +1,77 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var data_source_1 = require("./data_source");
19
+ var feature_1 = require("../../../models/feature");
20
+ var GeoJSONSource = /** @class */ (function (_super) {
21
+ __extends(GeoJSONSource, _super);
22
+ function GeoJSONSource(features) {
23
+ var _this = _super.call(this, 'main') || this;
24
+ _this.language = 'en';
25
+ return _this;
26
+ }
27
+ GeoJSONSource.prototype.fetch = function (data) {
28
+ this.data = new feature_1.FeatureCollection(data);
29
+ this.mapLanguage();
30
+ };
31
+ GeoJSONSource.prototype.create = function (feature) {
32
+ this.data.features.push(feature);
33
+ };
34
+ GeoJSONSource.prototype.update = function (feature) {
35
+ var foundIndex = this.data.features.findIndex(function (x) { return x.id === feature.id || x.properties.id === feature.id; });
36
+ this.data.features[foundIndex] = feature;
37
+ };
38
+ GeoJSONSource.prototype.delete = function (id) {
39
+ var foundIndex = this.data.features.findIndex(function (x) { return x.id === id || x.properties.id === id; });
40
+ this.data.features.splice(foundIndex, 1);
41
+ };
42
+ GeoJSONSource.prototype.mapLanguage = function () {
43
+ var _this = this;
44
+ var features = this.data.features.filter(function (f) { return typeof f.properties.title_i18n === 'object'; });
45
+ features.forEach(function (feature) { return _this.mapFeatureLanguage(feature, _this.language); });
46
+ };
47
+ GeoJSONSource.prototype.mapFeatureLanguage = function (feature, language) {
48
+ if (typeof feature.properties.title_i18n === 'string') {
49
+ feature.properties.title_i18n = JSON.parse(feature.properties.title_i18n);
50
+ }
51
+ if (typeof feature.properties.title_i18n === 'object') {
52
+ feature.properties.title = feature.properties.title_i18n[language];
53
+ }
54
+ };
55
+ GeoJSONSource.prototype.query = function (query, level) {
56
+ if (level === void 0) { level = 0; }
57
+ return this.data.features.filter(function (f) { return f.properties.title && f.properties.title.toLowerCase().match(query.toLowerCase()); });
58
+ };
59
+ GeoJSONSource.prototype.get = function (id) {
60
+ return this.data.features.find(function (f) { return f.id === id; });
61
+ };
62
+ GeoJSONSource.prototype.getInternal = function (id) {
63
+ return this.data.features.find(function (f) { return f.properties.id === id; });
64
+ };
65
+ Object.defineProperty(GeoJSONSource.prototype, "collection", {
66
+ get: function () {
67
+ return {
68
+ type: 'FeatureCollection',
69
+ features: this.data.features.map(function (f) { return f.json; }),
70
+ };
71
+ },
72
+ enumerable: false,
73
+ configurable: true
74
+ });
75
+ return GeoJSONSource;
76
+ }(data_source_1.default));
77
+ exports.default = GeoJSONSource;
@@ -0,0 +1,16 @@
1
+ /// <reference types="mapbox-gl" />
2
+ import { Eventable } from '../../../eventable';
3
+ import { FloorModel } from '../../../models/floor';
4
+ export default class ImageSourceManager extends Eventable {
5
+ sources: string[];
6
+ layers: string[];
7
+ floors: {
8
+ data: FloorModel[];
9
+ total: number;
10
+ };
11
+ belowLayer: string;
12
+ enabled: boolean;
13
+ constructor();
14
+ initialize(): Promise<void>;
15
+ setLevel(map: mapboxgl.Map, level: number): void;
16
+ }