proximiio-js-library 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -149,6 +149,9 @@ export interface Options {
149
149
  value: string;
150
150
  };
151
151
  featuresMaxBounds?: LngLatBoundsLike;
152
+ localSources?: {
153
+ features?: FeatureCollection;
154
+ };
152
155
  }
153
156
  export interface PaddingOptions {
154
157
  bottom: number;
@@ -316,22 +316,16 @@ export class Map {
316
316
  // @ts-ignore
317
317
  this.map.getSource('pointAlong').setData(pointAlong);
318
318
  }
319
- /*if (this.defaultOptions.routeAnimation.type === 'puck') {
320
- this.map
321
- .getSource('start-point')
322
- // @ts-ignore
323
- .setData(
324
- circle(
325
- pointAlong.geometry.coordinates,
326
- this.defaultOptions.routeAnimation.puckRadius ? this.defaultOptions.routeAnimation.puckRadius : 0.002,
327
- {
328
- properties: {
319
+ if (this.defaultOptions.routeAnimation.type === 'puck') {
320
+ this.map
321
+ .getSource('start-point')
322
+ // @ts-ignore
323
+ .setData(circle(pointAlong.geometry.coordinates, this.defaultOptions.routeAnimation.puckRadius ? this.defaultOptions.routeAnimation.puckRadius : 0.002, {
324
+ properties: {
329
325
  level: this.state.floor.level,
330
- },
331
326
  },
332
- ),
333
- );
334
- }*/
327
+ }));
328
+ }
335
329
  // @ts-ignore
336
330
  this.map.getSource('lineAlong').setData(lineAlong);
337
331
  if (this.defaultOptions.routeAnimation.followRoute && !animationInProgress) {
@@ -466,6 +460,7 @@ export class Map {
466
460
  useTimerangeData: this.defaultOptions.useTimerangeData,
467
461
  filter: this.defaultOptions.defaultFilter,
468
462
  featuresMaxBounds: this.defaultOptions.featuresMaxBounds,
463
+ localSources: this.defaultOptions.localSources,
469
464
  }).catch((error) => this.handleControllerError(error));
470
465
  const amenities = yield getAmenities(this.defaultOptions.amenityIdProperty).catch((error) => this.handleControllerError(error));
471
466
  const floors = yield getFloors().catch((error) => this.handleControllerError(error));
@@ -691,6 +686,7 @@ export class Map {
691
686
  useTimerangeData: this.defaultOptions.useTimerangeData,
692
687
  filter: this.defaultOptions.defaultFilter,
693
688
  featuresMaxBounds: this.defaultOptions.featuresMaxBounds,
689
+ localSources: this.defaultOptions.localSources,
694
690
  }).catch((error) => this.handleControllerError(error));
695
691
  if (features) {
696
692
  const levelChangers = features.features.filter((f) => f.properties.type === 'elevator' || f.properties.type === 'escalator' || f.properties.type === 'staircase');
@@ -1,7 +1,7 @@
1
1
  import Feature, { FeatureCollection } from '../models/feature';
2
2
  import { FeatureCollection as FCModel, Feature as FModel } from '@turf/helpers';
3
3
  import { LngLatBoundsLike } from 'maplibre-gl';
4
- export declare const getFeatures: ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, }: {
4
+ export declare const getFeatures: ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, localSources, }: {
5
5
  initPolygons?: boolean;
6
6
  polygonFeatureTypes?: string[];
7
7
  autoLabelLines?: boolean;
@@ -12,6 +12,9 @@ export declare const getFeatures: ({ initPolygons, polygonFeatureTypes, autoLabe
12
12
  value: string;
13
13
  };
14
14
  featuresMaxBounds?: LngLatBoundsLike;
15
+ localSources?: {
16
+ features?: FeatureCollection;
17
+ };
15
18
  }) => Promise<FeatureCollection>;
16
19
  export declare const getAmenities: (amenityIdProperty?: string) => Promise<any>;
17
20
  export declare const getPois: () => Promise<Feature[]>;
@@ -19,7 +22,7 @@ export declare const addFeatures: (featureCollection: FCModel) => Promise<void>;
19
22
  export declare const updateFeature: (featureData: FModel, featureId: string) => Promise<void>;
20
23
  export declare const deleteFeatures: (featureCollection: FCModel) => Promise<void>;
21
24
  declare const _default: {
22
- getFeatures: ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, }: {
25
+ getFeatures: ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, localSources, }: {
23
26
  initPolygons?: boolean;
24
27
  polygonFeatureTypes?: string[];
25
28
  autoLabelLines?: boolean;
@@ -30,6 +33,9 @@ declare const _default: {
30
33
  value: string;
31
34
  };
32
35
  featuresMaxBounds?: LngLatBoundsLike;
36
+ localSources?: {
37
+ features?: FeatureCollection;
38
+ };
33
39
  }) => Promise<FeatureCollection>;
34
40
  addFeatures: (featureCollection: FCModel<import("@turf/helpers").Geometry | import("@turf/helpers").GeometryCollection, {
35
41
  [name: string]: any;
@@ -20,12 +20,20 @@ import transformScale from '@turf/transform-scale';
20
20
  import lineIntersect from '@turf/line-intersect';
21
21
  import { lineString } from '@turf/helpers';
22
22
  import center from '@turf/center';
23
- export const getFeatures = ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, }) => __awaiter(void 0, void 0, void 0, function* () {
23
+ export const getFeatures = ({ initPolygons, polygonFeatureTypes, autoLabelLines, hiddenAmenities, useTimerangeData, filter, featuresMaxBounds, localSources, }) => __awaiter(void 0, void 0, void 0, function* () {
24
24
  let url = '/v5/geo/features';
25
25
  if (featuresMaxBounds) {
26
26
  url += `/${featuresMaxBounds[0][0]},${featuresMaxBounds[0][1]},${featuresMaxBounds[1][0]},${featuresMaxBounds[1][1]}`;
27
27
  }
28
- const res = yield axios.get(url);
28
+ let res;
29
+ if ((localSources === null || localSources === void 0 ? void 0 : localSources.features.features.length) > 0) {
30
+ res = {
31
+ data: localSources.features,
32
+ };
33
+ }
34
+ else {
35
+ res = yield axios.get(url);
36
+ }
29
37
  if (initPolygons) {
30
38
  const featuresToAdd = [];
31
39
  if (useTimerangeData) {