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.
- package/README.md +719 -0
- package/assets/proximiio-js-library.css +520 -0
- package/assets/tbtnav.js +3 -0
- package/assets/wayfinding.d.ts +3 -0
- package/assets/wayfinding.js +1586 -0
- package/lib/common.d.ts +7 -0
- package/lib/common.js +49 -0
- package/lib/components/map/constants.d.ts +6 -0
- package/lib/components/map/constants.js +30 -0
- package/lib/components/map/custom-layers.d.ts +5 -0
- package/lib/components/map/custom-layers.js +74 -0
- package/lib/components/map/icons.d.ts +23 -0
- package/lib/components/map/icons.js +64 -0
- package/lib/components/map/layers/any_layer.d.ts +9 -0
- package/lib/components/map/layers/any_layer.js +2 -0
- package/lib/components/map/layers/background_layer.d.ts +16 -0
- package/lib/components/map/layers/background_layer.js +52 -0
- package/lib/components/map/layers/base_layer.d.ts +18 -0
- package/lib/components/map/layers/base_layer.js +127 -0
- package/lib/components/map/layers/circle_layer.d.ts +25 -0
- package/lib/components/map/layers/circle_layer.js +62 -0
- package/lib/components/map/layers/fill_extrusion_layer.d.ts +21 -0
- package/lib/components/map/layers/fill_extrusion_layer.js +57 -0
- package/lib/components/map/layers/fill_layer.d.ts +21 -0
- package/lib/components/map/layers/fill_layer.js +57 -0
- package/lib/components/map/layers/heatmap_layer.d.ts +18 -0
- package/lib/components/map/layers/heatmap_layer.js +54 -0
- package/lib/components/map/layers/hillshade_layer.d.ts +19 -0
- package/lib/components/map/layers/hillshade_layer.js +55 -0
- package/lib/components/map/layers/line_layer.d.ts +28 -0
- package/lib/components/map/layers/line_layer.js +64 -0
- package/lib/components/map/layers/raster_layer.d.ts +21 -0
- package/lib/components/map/layers/raster_layer.js +57 -0
- package/lib/components/map/layers/symbol_layer.d.ts +71 -0
- package/lib/components/map/layers/symbol_layer.js +153 -0
- package/lib/components/map/main.d.ts +625 -0
- package/lib/components/map/main.js +1765 -0
- package/lib/components/map/metadata.d.ts +134 -0
- package/lib/components/map/metadata.js +135 -0
- package/lib/components/map/routing.d.ts +12 -0
- package/lib/components/map/routing.js +74 -0
- package/lib/components/map/sources/base_source.d.ts +10 -0
- package/lib/components/map/sources/base_source.js +38 -0
- package/lib/components/map/sources/cluster_source.d.ts +7 -0
- package/lib/components/map/sources/cluster_source.js +30 -0
- package/lib/components/map/sources/data_source.d.ts +17 -0
- package/lib/components/map/sources/data_source.js +46 -0
- package/lib/components/map/sources/geojson_source.d.ts +16 -0
- package/lib/components/map/sources/geojson_source.js +77 -0
- package/lib/components/map/sources/image_source_manager.d.ts +16 -0
- package/lib/components/map/sources/image_source_manager.js +131 -0
- package/lib/components/map/sources/routing_source.d.ts +22 -0
- package/lib/components/map/sources/routing_source.js +131 -0
- package/lib/components/map/sources/synthetic_source.d.ts +7 -0
- package/lib/components/map/sources/synthetic_source.js +32 -0
- package/lib/components/map/sources/vector_source.d.ts +8 -0
- package/lib/components/map/sources/vector_source.js +31 -0
- package/lib/components/select/main.d.ts +66 -0
- package/lib/components/select/main.js +195 -0
- package/lib/controllers/auth.d.ts +48 -0
- package/lib/controllers/auth.js +156 -0
- package/lib/controllers/floors.d.ts +14 -0
- package/lib/controllers/floors.js +105 -0
- package/lib/controllers/geo.d.ts +10 -0
- package/lib/controllers/geo.js +131 -0
- package/lib/controllers/places.d.ts +14 -0
- package/lib/controllers/places.js +108 -0
- package/lib/controllers/repository.d.ts +24 -0
- package/lib/controllers/repository.js +68 -0
- package/lib/controllers/style.d.ts +4 -0
- package/lib/controllers/style.js +76 -0
- package/lib/eventable.d.ts +7 -0
- package/lib/eventable.js +29 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +14 -0
- package/lib/models/amenity.d.ts +11 -0
- package/lib/models/amenity.js +41 -0
- package/lib/models/auth-data.d.ts +4 -0
- package/lib/models/auth-data.js +2 -0
- package/lib/models/base.d.ts +7 -0
- package/lib/models/base.js +18 -0
- package/lib/models/feature.d.ts +46 -0
- package/lib/models/feature.js +277 -0
- package/lib/models/floor.d.ts +30 -0
- package/lib/models/floor.js +51 -0
- package/lib/models/geopoint.d.ts +6 -0
- package/lib/models/geopoint.js +2 -0
- package/lib/models/mapbox-options.d.ts +171 -0
- package/lib/models/mapbox-options.js +2 -0
- package/lib/models/person.d.ts +8 -0
- package/lib/models/person.js +18 -0
- package/lib/models/place.d.ts +14 -0
- package/lib/models/place.js +40 -0
- package/lib/models/poi_type.d.ts +19 -0
- package/lib/models/poi_type.js +25 -0
- package/lib/models/style.d.ts +53 -0
- package/lib/models/style.js +424 -0
- package/lib/proximiio.js +2 -0
- package/lib/proximiio.js.LICENSE.txt +79 -0
- package/package.json +61 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getPackage = void 0;
|
|
40
|
+
var places_1 = require("./places");
|
|
41
|
+
var floors_1 = require("./floors");
|
|
42
|
+
var style_1 = require("./style");
|
|
43
|
+
var geo_1 = require("./geo");
|
|
44
|
+
var getPackage = function (initPolygons) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var result, promises;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
result = {};
|
|
50
|
+
promises = [
|
|
51
|
+
places_1.getPlaces().then(function (places) { return (result.places = places.data); }),
|
|
52
|
+
floors_1.getFloors().then(function (floors) { return (result.floors = floors.data); }),
|
|
53
|
+
style_1.getStyle().then(function (style) { return (result.style = style); }),
|
|
54
|
+
style_1.getStyles().then(function (styles) { return (result.styles = styles); }),
|
|
55
|
+
geo_1.getFeatures(initPolygons).then(function (features) { return (result.features = features); }),
|
|
56
|
+
geo_1.getAmenities().then(function (amenities) { return (result.amenities = amenities); }),
|
|
57
|
+
];
|
|
58
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
59
|
+
case 1:
|
|
60
|
+
_a.sent();
|
|
61
|
+
return [2 /*return*/, result];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}); };
|
|
65
|
+
exports.getPackage = getPackage;
|
|
66
|
+
exports.default = {
|
|
67
|
+
getPackage: exports.getPackage,
|
|
68
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getStyleUrl = exports.getStyles = exports.getStyle = void 0;
|
|
40
|
+
var common_1 = require("../common");
|
|
41
|
+
var style_1 = require("../models/style");
|
|
42
|
+
var getStyle = function (id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var url, res;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
url = '/v5/geo/style';
|
|
48
|
+
if (id) {
|
|
49
|
+
url += "s/" + id;
|
|
50
|
+
}
|
|
51
|
+
return [4 /*yield*/, common_1.axios.get(url)];
|
|
52
|
+
case 1:
|
|
53
|
+
res = _a.sent();
|
|
54
|
+
return [2 /*return*/, new style_1.default(res.data)];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}); };
|
|
58
|
+
exports.getStyle = getStyle;
|
|
59
|
+
var getStyles = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
var url, res;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
url = '/v5/geo/styles';
|
|
65
|
+
return [4 /*yield*/, common_1.axios.get(url)];
|
|
66
|
+
case 1:
|
|
67
|
+
res = _a.sent();
|
|
68
|
+
return [2 /*return*/, res.data.map(function (item) { return new style_1.default(item); })];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
exports.getStyles = getStyles;
|
|
73
|
+
var getStyleUrl = function () {
|
|
74
|
+
return "https://api.proximi.fi/v5/geo/style?token=" + common_1.axios.defaults.headers.common.Authorization;
|
|
75
|
+
};
|
|
76
|
+
exports.getStyleUrl = getStyleUrl;
|
package/lib/eventable.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Eventable = void 0;
|
|
4
|
+
var Eventable = /** @class */ (function () {
|
|
5
|
+
function Eventable() {
|
|
6
|
+
this._observers = [];
|
|
7
|
+
}
|
|
8
|
+
Eventable.prototype.on = function (observer) {
|
|
9
|
+
if (this._observers) {
|
|
10
|
+
this._observers.push(observer);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
Eventable.prototype.off = function (observer) {
|
|
14
|
+
var index = this._observers ? this._observers.findIndex(function (o) { return o === observer; }) : 0;
|
|
15
|
+
if (index >= 0) {
|
|
16
|
+
if (this._observers) {
|
|
17
|
+
this._observers.splice(index, 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
Eventable.prototype.notify = function (event, data) {
|
|
22
|
+
var _this = this;
|
|
23
|
+
if (this._observers) {
|
|
24
|
+
this._observers.forEach(function (observer) { return observer(event, data, _this); });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return Eventable;
|
|
28
|
+
}());
|
|
29
|
+
exports.Eventable = Eventable;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Map } from './components/map/main';
|
|
2
|
+
import { Select } from './components/select/main';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Auth: {
|
|
5
|
+
login: (email: string, password: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
6
|
+
loginWithToken: (token: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
7
|
+
getUserConfig: () => Promise<any>;
|
|
8
|
+
};
|
|
9
|
+
Places: {
|
|
10
|
+
getPlaces: (limit?: number, skip?: number, order?: string, dir?: string, filterByIndex?: string, q?: string, filter?: string) => Promise<{
|
|
11
|
+
data: import("./models/place").PlaceModel[];
|
|
12
|
+
total: number;
|
|
13
|
+
}>;
|
|
14
|
+
getPlaceById: (placeId: string) => Promise<import("./models/place").PlaceModel>;
|
|
15
|
+
};
|
|
16
|
+
Floors: {
|
|
17
|
+
getFloors: (limit?: number, skip?: number, order?: string, dir?: string, filterByIndex?: string, q?: string) => Promise<{
|
|
18
|
+
data: import("./models/floor").FloorModel[];
|
|
19
|
+
total: number;
|
|
20
|
+
}>;
|
|
21
|
+
getPlaceFloors: (placeId: string) => Promise<import("./models/floor").FloorModel[]>;
|
|
22
|
+
};
|
|
23
|
+
Map: typeof Map;
|
|
24
|
+
Select: typeof Select;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var auth_1 = require("./controllers/auth");
|
|
4
|
+
var places_1 = require("./controllers/places");
|
|
5
|
+
var floors_1 = require("./controllers/floors");
|
|
6
|
+
var main_1 = require("./components/map/main");
|
|
7
|
+
var main_2 = require("./components/select/main");
|
|
8
|
+
exports.default = {
|
|
9
|
+
Auth: auth_1.default,
|
|
10
|
+
Places: places_1.default,
|
|
11
|
+
Floors: floors_1.default,
|
|
12
|
+
Map: main_1.Map,
|
|
13
|
+
Select: main_2.Select,
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import BaseModel from './base';
|
|
2
|
+
export declare class AmenityModel extends BaseModel {
|
|
3
|
+
category: string;
|
|
4
|
+
iconOffset: [number, number];
|
|
5
|
+
list: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
constructor(data: any);
|
|
10
|
+
get hasIcon(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
exports.AmenityModel = void 0;
|
|
19
|
+
var base_1 = require("./base");
|
|
20
|
+
var AmenityModel = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AmenityModel, _super);
|
|
22
|
+
function AmenityModel(data) {
|
|
23
|
+
var _this = _super.call(this, data) || this;
|
|
24
|
+
_this.category = data.category;
|
|
25
|
+
_this.iconOffset = data.iconOffset;
|
|
26
|
+
_this.list = data.list;
|
|
27
|
+
_this.title = data.title;
|
|
28
|
+
_this.description = data.description;
|
|
29
|
+
_this.icon = data.icon;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(AmenityModel.prototype, "hasIcon", {
|
|
33
|
+
get: function () {
|
|
34
|
+
return !!this.icon;
|
|
35
|
+
},
|
|
36
|
+
enumerable: false,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
return AmenityModel;
|
|
40
|
+
}(base_1.default));
|
|
41
|
+
exports.AmenityModel = AmenityModel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BaseModel = /** @class */ (function () {
|
|
4
|
+
function BaseModel(data) {
|
|
5
|
+
this.id = data.id || (data.properties ? data.properties.id : undefined);
|
|
6
|
+
this.createdAt = data.createdAt;
|
|
7
|
+
this.updatedAt = data.updatedAt;
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(BaseModel.prototype, "exists", {
|
|
10
|
+
get: function () {
|
|
11
|
+
return typeof this.id !== 'undefined';
|
|
12
|
+
},
|
|
13
|
+
enumerable: false,
|
|
14
|
+
configurable: true
|
|
15
|
+
});
|
|
16
|
+
return BaseModel;
|
|
17
|
+
}());
|
|
18
|
+
exports.default = BaseModel;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import BaseModel from './base';
|
|
2
|
+
export declare class Geometry {
|
|
3
|
+
type: string;
|
|
4
|
+
coordinates: any[];
|
|
5
|
+
constructor(data: any);
|
|
6
|
+
}
|
|
7
|
+
export declare class FeatureCollection {
|
|
8
|
+
type: string;
|
|
9
|
+
features: Feature[];
|
|
10
|
+
constructor(data: any);
|
|
11
|
+
get json(): {
|
|
12
|
+
type: string;
|
|
13
|
+
features: any[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export default class Feature extends BaseModel {
|
|
17
|
+
type: 'Feature';
|
|
18
|
+
id: string;
|
|
19
|
+
geometry: Geometry;
|
|
20
|
+
properties: any;
|
|
21
|
+
constructor(data: any);
|
|
22
|
+
get isEditable(): boolean;
|
|
23
|
+
get isPoint(): boolean;
|
|
24
|
+
get isPolygon(): boolean;
|
|
25
|
+
get isLineString(): boolean;
|
|
26
|
+
get isHazard(): boolean;
|
|
27
|
+
get isLandmark(): boolean;
|
|
28
|
+
get isDoor(): boolean;
|
|
29
|
+
get isEntrance(): boolean;
|
|
30
|
+
get isDecisionPoint(): boolean;
|
|
31
|
+
get isTicketGate(): boolean;
|
|
32
|
+
get isElevator(): boolean;
|
|
33
|
+
get isEscalator(): boolean;
|
|
34
|
+
get isStairCase(): boolean;
|
|
35
|
+
get isLevelChanger(): boolean;
|
|
36
|
+
get isText(): boolean;
|
|
37
|
+
get isSynthetic(): boolean;
|
|
38
|
+
get isRoom(): any;
|
|
39
|
+
get isRouting(): boolean;
|
|
40
|
+
get getTitle(): any;
|
|
41
|
+
get getTitleWithLevel(): string;
|
|
42
|
+
get json(): any;
|
|
43
|
+
static point(id: string, latitude: number, longitude: number, properties?: any): Feature;
|
|
44
|
+
setTitle(title: string, lang?: string): void;
|
|
45
|
+
hasLevel(level: number): any;
|
|
46
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
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
|
+
exports.FeatureCollection = exports.Geometry = void 0;
|
|
19
|
+
var base_1 = require("./base");
|
|
20
|
+
var poi_type_1 = require("./poi_type");
|
|
21
|
+
var Geometry = /** @class */ (function () {
|
|
22
|
+
function Geometry(data) {
|
|
23
|
+
this.type = data.type;
|
|
24
|
+
this.coordinates = data.coordinates;
|
|
25
|
+
}
|
|
26
|
+
return Geometry;
|
|
27
|
+
}());
|
|
28
|
+
exports.Geometry = Geometry;
|
|
29
|
+
var FeatureCollection = /** @class */ (function () {
|
|
30
|
+
function FeatureCollection(data) {
|
|
31
|
+
this.type = 'FeatureCollection';
|
|
32
|
+
this.features = (data.features || []).map(function (f) { return new Feature(f).json; });
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(FeatureCollection.prototype, "json", {
|
|
35
|
+
get: function () {
|
|
36
|
+
return {
|
|
37
|
+
type: 'FeatureCollection',
|
|
38
|
+
features: this.features.map(function (feature) { return feature.json; }),
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
enumerable: false,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
return FeatureCollection;
|
|
45
|
+
}());
|
|
46
|
+
exports.FeatureCollection = FeatureCollection;
|
|
47
|
+
var Feature = /** @class */ (function (_super) {
|
|
48
|
+
__extends(Feature, _super);
|
|
49
|
+
function Feature(data) {
|
|
50
|
+
var _this = _super.call(this, data) || this;
|
|
51
|
+
_this.type = 'Feature';
|
|
52
|
+
_this.id = data.id;
|
|
53
|
+
_this.geometry = new Geometry(data.geometry);
|
|
54
|
+
_this.properties = data.properties || {};
|
|
55
|
+
if (typeof _this.properties.title_i18n === 'string') {
|
|
56
|
+
_this.properties.title_i18n = JSON.parse(_this.properties.title_i18n);
|
|
57
|
+
}
|
|
58
|
+
if (_this.isPoint) {
|
|
59
|
+
if (!_this.properties.images) {
|
|
60
|
+
_this.properties.images = [];
|
|
61
|
+
}
|
|
62
|
+
if (!_this.properties.range) {
|
|
63
|
+
_this.properties.range = 3;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (typeof _this.properties.images === 'string') {
|
|
67
|
+
_this.properties.images = JSON.parse(_this.properties.images);
|
|
68
|
+
}
|
|
69
|
+
if (_this.isLevelChanger && Array.isArray(_this.properties.levels)) {
|
|
70
|
+
_this.properties.levels.forEach(function (level) { return (_this.properties["__level_" + level] = true); });
|
|
71
|
+
}
|
|
72
|
+
if (_this.properties.type === 'text' && Array.isArray(_this.properties.textFont)) {
|
|
73
|
+
_this.properties.textFont = _this.properties.textFont[0];
|
|
74
|
+
}
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
Object.defineProperty(Feature.prototype, "isEditable", {
|
|
78
|
+
get: function () {
|
|
79
|
+
return this.isPoint || this.isLineString || this.isPolygon;
|
|
80
|
+
},
|
|
81
|
+
enumerable: false,
|
|
82
|
+
configurable: true
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(Feature.prototype, "isPoint", {
|
|
85
|
+
get: function () {
|
|
86
|
+
return this.geometry.type === 'Point';
|
|
87
|
+
},
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(Feature.prototype, "isPolygon", {
|
|
92
|
+
get: function () {
|
|
93
|
+
return this.geometry.type === 'Polygon' || this.geometry.type === 'MultiPolygon';
|
|
94
|
+
},
|
|
95
|
+
enumerable: false,
|
|
96
|
+
configurable: true
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(Feature.prototype, "isLineString", {
|
|
99
|
+
get: function () {
|
|
100
|
+
return this.geometry.type === 'LineString' || this.geometry.type === 'MultiLineString';
|
|
101
|
+
},
|
|
102
|
+
enumerable: false,
|
|
103
|
+
configurable: true
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(Feature.prototype, "isHazard", {
|
|
106
|
+
get: function () {
|
|
107
|
+
return this.properties.type === poi_type_1.POI_TYPE.HAZARD;
|
|
108
|
+
},
|
|
109
|
+
enumerable: false,
|
|
110
|
+
configurable: true
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(Feature.prototype, "isLandmark", {
|
|
113
|
+
get: function () {
|
|
114
|
+
return this.properties.type === poi_type_1.POI_TYPE.LANDMARK;
|
|
115
|
+
},
|
|
116
|
+
enumerable: false,
|
|
117
|
+
configurable: true
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(Feature.prototype, "isDoor", {
|
|
120
|
+
get: function () {
|
|
121
|
+
return this.properties.type === poi_type_1.POI_TYPE.DOOR;
|
|
122
|
+
},
|
|
123
|
+
enumerable: false,
|
|
124
|
+
configurable: true
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(Feature.prototype, "isEntrance", {
|
|
127
|
+
get: function () {
|
|
128
|
+
return this.properties.type === poi_type_1.POI_TYPE.ENTRANCE;
|
|
129
|
+
},
|
|
130
|
+
enumerable: false,
|
|
131
|
+
configurable: true
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(Feature.prototype, "isDecisionPoint", {
|
|
134
|
+
get: function () {
|
|
135
|
+
return this.properties.type === poi_type_1.POI_TYPE.DECISION;
|
|
136
|
+
},
|
|
137
|
+
enumerable: false,
|
|
138
|
+
configurable: true
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(Feature.prototype, "isTicketGate", {
|
|
141
|
+
get: function () {
|
|
142
|
+
return this.properties.type === poi_type_1.POI_TYPE.TICKET_GATE;
|
|
143
|
+
},
|
|
144
|
+
enumerable: false,
|
|
145
|
+
configurable: true
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(Feature.prototype, "isElevator", {
|
|
148
|
+
get: function () {
|
|
149
|
+
return this.properties.type === poi_type_1.POI_TYPE.ELEVATOR;
|
|
150
|
+
},
|
|
151
|
+
enumerable: false,
|
|
152
|
+
configurable: true
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(Feature.prototype, "isEscalator", {
|
|
155
|
+
get: function () {
|
|
156
|
+
return this.properties.type === poi_type_1.POI_TYPE.ESCALATOR;
|
|
157
|
+
},
|
|
158
|
+
enumerable: false,
|
|
159
|
+
configurable: true
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(Feature.prototype, "isStairCase", {
|
|
162
|
+
get: function () {
|
|
163
|
+
return this.properties.type === poi_type_1.POI_TYPE.STAIRCASE;
|
|
164
|
+
},
|
|
165
|
+
enumerable: false,
|
|
166
|
+
configurable: true
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(Feature.prototype, "isLevelChanger", {
|
|
169
|
+
get: function () {
|
|
170
|
+
return this.isElevator || this.isEscalator || this.isStairCase;
|
|
171
|
+
},
|
|
172
|
+
enumerable: false,
|
|
173
|
+
configurable: true
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(Feature.prototype, "isText", {
|
|
176
|
+
get: function () {
|
|
177
|
+
return this.properties.type === 'text';
|
|
178
|
+
},
|
|
179
|
+
enumerable: false,
|
|
180
|
+
configurable: true
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(Feature.prototype, "isSynthetic", {
|
|
183
|
+
get: function () {
|
|
184
|
+
var keys = ['id', 'place_id', 'floor_id', 'level'];
|
|
185
|
+
if (this.geometry.type === 'LineString' || this.geometry.type === 'MultiLineString') {
|
|
186
|
+
keys.push('class');
|
|
187
|
+
}
|
|
188
|
+
return (Object.keys(this.properties)
|
|
189
|
+
.map(function (key) { return !keys.includes(key); })
|
|
190
|
+
.filter(function (i) { return i; }).length === 0);
|
|
191
|
+
},
|
|
192
|
+
enumerable: false,
|
|
193
|
+
configurable: true
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(Feature.prototype, "isRoom", {
|
|
196
|
+
get: function () {
|
|
197
|
+
return this.properties.room;
|
|
198
|
+
},
|
|
199
|
+
enumerable: false,
|
|
200
|
+
configurable: true
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(Feature.prototype, "isRouting", {
|
|
203
|
+
get: function () {
|
|
204
|
+
return this.properties.usecase === 'routing';
|
|
205
|
+
},
|
|
206
|
+
enumerable: false,
|
|
207
|
+
configurable: true
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(Feature.prototype, "getTitle", {
|
|
210
|
+
get: function () {
|
|
211
|
+
return this.properties.title;
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(Feature.prototype, "getTitleWithLevel", {
|
|
217
|
+
get: function () {
|
|
218
|
+
return this.properties.title + " - Level: " + this.properties.level;
|
|
219
|
+
},
|
|
220
|
+
enumerable: false,
|
|
221
|
+
configurable: true
|
|
222
|
+
});
|
|
223
|
+
Object.defineProperty(Feature.prototype, "json", {
|
|
224
|
+
get: function () {
|
|
225
|
+
if (this.properties.cameFrom) {
|
|
226
|
+
delete this.properties.cameFrom;
|
|
227
|
+
}
|
|
228
|
+
if (this.properties.fixedPointMap) {
|
|
229
|
+
delete this.properties.fixedPointMap;
|
|
230
|
+
}
|
|
231
|
+
var clone = JSON.parse(JSON.stringify(this));
|
|
232
|
+
if (clone.properties.metadata && typeof clone.properties.metadata !== 'object') {
|
|
233
|
+
try {
|
|
234
|
+
clone.properties.metadata = JSON.parse(clone.properties.metadata);
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
console.log('feature parsing failed:', clone.properties.metadata);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
Object.keys(clone.properties).forEach(function (key) {
|
|
241
|
+
if (key.match('__level')) {
|
|
242
|
+
delete clone.properties.key;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return clone;
|
|
246
|
+
},
|
|
247
|
+
enumerable: false,
|
|
248
|
+
configurable: true
|
|
249
|
+
});
|
|
250
|
+
Feature.point = function (id, latitude, longitude, properties) {
|
|
251
|
+
return new Feature({
|
|
252
|
+
id: id,
|
|
253
|
+
geometry: {
|
|
254
|
+
type: 'Point',
|
|
255
|
+
coordinates: [longitude, latitude],
|
|
256
|
+
},
|
|
257
|
+
properties: properties,
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
Feature.prototype.setTitle = function (title, lang) {
|
|
261
|
+
if (lang === void 0) { lang = 'en'; }
|
|
262
|
+
if (typeof this.properties.title_18n === 'undefined') {
|
|
263
|
+
this.properties.title_18n = {};
|
|
264
|
+
}
|
|
265
|
+
this.properties.title_18n[lang] = title;
|
|
266
|
+
};
|
|
267
|
+
Feature.prototype.hasLevel = function (level) {
|
|
268
|
+
if (this.isLevelChanger) {
|
|
269
|
+
return this.properties.levels.includes(level);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
return this.properties.level === level;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
return Feature;
|
|
276
|
+
}(base_1.default));
|
|
277
|
+
exports.default = Feature;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import BaseModel from './base';
|
|
2
|
+
import { Geopoint } from './geopoint';
|
|
3
|
+
export interface FloorEditorModel {
|
|
4
|
+
angle: number;
|
|
5
|
+
center: Geopoint;
|
|
6
|
+
opacity: number;
|
|
7
|
+
scale?: number;
|
|
8
|
+
url?: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
coordinates?: {
|
|
11
|
+
c1: Geopoint;
|
|
12
|
+
c2: Geopoint;
|
|
13
|
+
c3: Geopoint;
|
|
14
|
+
c4: Geopoint;
|
|
15
|
+
} | number[][];
|
|
16
|
+
}
|
|
17
|
+
export declare type Coordinates = [number, number];
|
|
18
|
+
export declare class FloorModel extends BaseModel {
|
|
19
|
+
name: string;
|
|
20
|
+
placeId: string;
|
|
21
|
+
placeName?: string;
|
|
22
|
+
floorplanImageUrl: string;
|
|
23
|
+
level: number;
|
|
24
|
+
anchors?: [Coordinates, Coordinates, Coordinates, Coordinates];
|
|
25
|
+
editor?: FloorEditorModel;
|
|
26
|
+
geopoint?: [number, number];
|
|
27
|
+
remoteId?: string;
|
|
28
|
+
constructor(data: any);
|
|
29
|
+
get hasFloorplan(): boolean;
|
|
30
|
+
}
|