@mapxus/mapxus-map-jp 7.2.0 → 7.4.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 (4) hide show
  1. package/README.md +12 -7
  2. package/index.d.ts +121 -34
  3. package/index.js +1 -10
  4. package/package.json +4 -4
package/README.md CHANGED
@@ -16,22 +16,27 @@ import maplibregl from 'maplibre-gl';
16
16
  import * as MapxusMap from '@mapxus/mapxus-map';
17
17
 
18
18
  const maplibreMap = new maplibregl.Map({
19
- container: 'map'
19
+ container: 'map',
20
+ zoom: 17,
20
21
  });
21
22
 
22
23
  const map = new MapxusMap.Map({
23
- map: maplibreMap,
24
- appId: 'your_appId',
25
- secret: 'your_secret',
26
- buildingId: 'building_id', // example: elements_hk_dc005f
24
+ map: maplibreMap,
25
+ appId: 'your_appId',
26
+ secret: 'your_secret',
27
+ buildingId: 'building_id', // example: elements_hk_dc005f
28
+ // or
29
+ // venueId: 'venue_id',
30
+ // floorId: 'floor_id',
31
+ // poiId: 'poi_id',
27
32
  });
28
33
  ```
29
34
 
30
- More sample page at [https://map-service.mapxus.co.jp/bssww/initMapByVenue](https://map-service.mapxus.co.jp/bssww/initMapByVenue)
35
+ More sample page at [MapxusMap Sample Web](https://map-service.mapxus.co.jp/bssww/initMapByVenue)
31
36
 
32
37
  ## Documentation
33
38
 
34
- Docs are available at [https://map-service.mapxus.co.jp/dpw/digitalMapWeb](https://map-service.mapxus.co.jp/dpw/digitalMapWeb)
39
+ Docs are available at [MapxusMap JS SDK API Docs](https://map-service.mapxus.co.jp/dpw/digitalMapWeb)
35
40
 
36
41
  ## License
37
42
 
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- // Generated by dts-bundle-generator v6.13.0
1
+ // Generated by dts-bundle-generator v8.1.2
2
2
 
3
3
  import { AxiosPromise } from 'axios';
4
- import { ControlPosition, FilterSpecification, IControl, LngLat, Map as MaplibreMap, Map as maplibreMap, MapGeoJSONFeature, MapLayerEventType, PointLike } from 'maplibre-gl';
4
+ import { ControlPosition, FilterSpecification, IControl, LngLat, Map as MaplibreMap, Map as maplibreMap, MapGeoJSONFeature, MapLayerEventType, PaddingOptions, PointLike, RequireAtLeastOne } from 'maplibre-gl';
5
5
 
6
6
  export declare enum ThemeType {
7
7
  CHRISTMAS = "christmas",
@@ -36,17 +36,52 @@ export interface IMapOption {
36
36
  secret: string;
37
37
  enableFloorControl?: boolean;
38
38
  enableBuildingSelector?: boolean;
39
+ /**
40
+ * @description 'venueId', 'buildingId', 'floorId', 'poiId' are mutually exclusive,
41
+ * the priority is: poiId > floorId > buildingId > venueId.
42
+ */
39
43
  venueId?: string;
44
+ /**
45
+ * @description 'venueId', 'buildingId', 'floorId', 'poiId' are mutually exclusive,
46
+ * the priority is: poiId > floorId > buildingId > venueId.
47
+ */
40
48
  buildingId?: string;
49
+ /**
50
+ * @description 'venueId', 'buildingId', 'floorId', 'poiId' are mutually exclusive,
51
+ * the priority is: poiId > floorId > buildingId > venueId.
52
+ */
41
53
  floorId?: string;
54
+ /**
55
+ * @description Initialize the map with POI as the center point, use it with maplibregl.Map 'zoom' option.
56
+ * 'venueId', 'buildingId', 'floorId', 'poiId' are mutually exclusive,
57
+ * the priority is: poiId > floorId > buildingId > venueId.
58
+ */
42
59
  poiId?: string;
43
60
  hiddenOutdoor?: boolean;
44
61
  theme?: ThemeType;
45
62
  collapseCopyright?: boolean;
46
63
  selectedBuildingBorderStyle?: ISelectedBuildingBorderStyle;
47
64
  floorsControlStyle?: IFloorsControlStyle;
65
+ /**
66
+ * @description Switch floors by venue/building, default by venue.
67
+ */
48
68
  floorSwitchMode?: FloorSwitchMode;
69
+ /**
70
+ * @description Whether unselected buildings are masked, default is false.
71
+ */
49
72
  maskNonSelectedAreas?: boolean;
73
+ /**
74
+ * @description Whether the boundary of the selected building fits the screen, default is false.
75
+ * Can only be used for 'floorId', 'buildingId' and 'venueId' initialization, not for 'poiId'.
76
+ * When it is true, the 'boundsPadding' option is valid, and the 'zoom' option of maplibregl.Map is invalid.
77
+ */
78
+ fitBuildingBounds?: boolean;
79
+ /**
80
+ * @description The amount of padding in pixels to add to the given bounds, default is 30.
81
+ * Requires 'fitBuildingBounds' to be 'true'.
82
+ * Parameter value ref to: https://maplibre.org/maplibre-gl-js/docs/API/types/maplibregl.PaddingOptions/
83
+ */
84
+ boundsPadding?: number | RequireAtLeastOne<PaddingOptions>;
50
85
  }
51
86
  export type Listener = (param: Object) => any;
52
87
  declare class DefinedEvent {
@@ -141,7 +176,19 @@ export declare class Indoor extends Evented {
141
176
  private _upperLevelIds;
142
177
  private _lowerLevelIds;
143
178
  private _dispatch;
144
- constructor(map: maplibreMap, isHiddenOutdoor?: boolean, floorSwitchMode?: FloorSwitchMode);
179
+ private readonly _fitBuildingBounds;
180
+ private readonly _boundsPadding;
181
+ private readonly _isInitialIndoor;
182
+ private _maplibreMapLoaded;
183
+ private _indoorMapLoaded;
184
+ constructor(props: {
185
+ map: maplibreMap;
186
+ isInitialIndoor: boolean;
187
+ isHiddenOutdoor: boolean;
188
+ floorSwitchMode: FloorSwitchMode;
189
+ fitBuildingBounds: boolean;
190
+ boundsPadding: number | RequireAtLeastOne<PaddingOptions>;
191
+ });
145
192
  /**
146
193
  * @description Turn on indoor-outdoor switching.
147
194
  */
@@ -251,7 +298,7 @@ export declare class Indoor extends Evented {
251
298
  private _getConditionsExpression;
252
299
  private _loadData;
253
300
  private _init;
254
- private _load;
301
+ private _filter;
255
302
  private _clear;
256
303
  private _updateFilter;
257
304
  private _setPoiTextColor;
@@ -325,7 +372,6 @@ export declare class Map extends Evented {
325
372
  private _poi;
326
373
  private _initialHiddenLayers;
327
374
  private _attributionControl;
328
- private _mapZoom;
329
375
  private _dispatch;
330
376
  constructor(option: IMapOption);
331
377
  /**
@@ -389,6 +435,19 @@ export declare class Map extends Evented {
389
435
  * @return {MapGeoJSONFeature | undefined}
390
436
  */
391
437
  getFeature(id: string): MapGeoJSONFeature | undefined;
438
+ /**
439
+ * @description Get features from bbox by coordinates [and ordinal].
440
+ * @param coordinates
441
+ * @param ordinal
442
+ */
443
+ getIndoorFeaturesByCoordinates(coordinates: {
444
+ lng: number;
445
+ lat: number;
446
+ }, ordinal?: number): {
447
+ venue: MapGeoJSONFeature;
448
+ building: MapGeoJSONFeature;
449
+ level: MapGeoJSONFeature;
450
+ };
392
451
  /**
393
452
  * @description Get features from bbox by id. One id may correspond to multiple features.
394
453
  * @param id
@@ -408,7 +467,7 @@ export declare class Map extends Evented {
408
467
  selectBuildingById(buildingId: string, callback?: VoidFunction): Promise<void>;
409
468
  /**
410
469
  * @description Select or exit venue by id.
411
- * @param venueId Exit venue if venueId is null.
470
+ * @param venueId 'venueId' can be string or null. Exit indoors if venueId is null.
412
471
  * @param callback Called after venue has been selected.
413
472
  */
414
473
  selectVenueById(venueId: string | null, callback?: VoidFunction): Promise<void>;
@@ -481,9 +540,15 @@ export declare class Map extends Evented {
481
540
  private _setIndoorFilter;
482
541
  private _setStyle;
483
542
  private _addControl;
484
- private _defaultSetMapZoom;
485
543
  private _selectPoiById;
486
544
  private _getBuildingIdByVenueId;
545
+ private _tilesRequestTransform;
546
+ private _checkMapZoom;
547
+ private _setMapStyle;
548
+ private _clickEventsDispatcher;
549
+ private _hideIndoorLayers;
550
+ private _showIndoorLayers;
551
+ private _updatePermission;
487
552
  }
488
553
  export type TAnchorPosition = "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
489
554
  export declare class Marker {
@@ -501,7 +566,7 @@ export declare class Marker {
501
566
  * @param callback Called when the image(from an external URL) has loaded
502
567
  * or with an error argument if there is an error.
503
568
  */
504
- setIconImage(icon: string, callback: VoidFunction): void;
569
+ setIconImage(icon: string, callback?: VoidFunction): void;
505
570
  /**
506
571
  * @description Set marker by image url.
507
572
  * @deprecated Use 'setIconImage' instead.
@@ -563,8 +628,8 @@ export declare class Marker {
563
628
  * Required 'venueId' and 'ordinal' in properties.
564
629
  * Markers not matched 'venueId' and 'ordinal' would be hidden;
565
630
  * Outdoor markers always are shown.
566
- * @param venueId {string | null | undefined}
567
- * @param ordinal {string | null | undefined}
631
+ * @param venueId {string | null | undefined} null | undefined will be treated as ''.
632
+ * @param ordinal {string | null | undefined} null | undefined will be treated as ''.
568
633
  */
569
634
  setFilterByVenue(venueId: string | null | undefined, ordinal: string | null | undefined): void;
570
635
  /**
@@ -572,8 +637,8 @@ export declare class Marker {
572
637
  * Required 'buildingId' and 'ordinal' in properties.
573
638
  * Markers not matched 'buildingId' and 'ordinal' would be hidden;
574
639
  * Outdoor markers always are shown.
575
- * @param buildingId {string | null | undefined}
576
- * @param ordinal {string | null | undefined}
640
+ * @param buildingId {string | null | undefined} null | undefined will be treated as ''.
641
+ * @param ordinal {string | null | undefined} null | undefined will be treated as ''.
577
642
  */
578
643
  setFilterByBuilding(buildingId: string | null | undefined, ordinal: string | null | undefined): void;
579
644
  /**
@@ -588,8 +653,8 @@ export declare class Marker {
588
653
  * Required 'venueId' and 'ordinal' in properties.
589
654
  * Opacities of markers matched 'venueId' and 'ordinal' are 1, others are 0.5.
590
655
  * Outdoor markers' opacity always are 1.
591
- * @param venueId {string | null | undefined}
592
- * @param ordinal {string | null | undefined}
656
+ * @param venueId {string | null | undefined} null | undefined will be treated as ''.
657
+ * @param ordinal {string | null | undefined} null | undefined will be treated as ''.
593
658
  */
594
659
  setOpacityByVenue(venueId: string | null | undefined, ordinal: string | null | undefined): void;
595
660
  /**
@@ -597,8 +662,8 @@ export declare class Marker {
597
662
  * Required 'buildingId' and 'ordinal' in properties.
598
663
  * Opacities of markers matched 'buildingId' and 'ordinal' are 1, others are 0.5.
599
664
  * Outdoor markers' opacity always are 1.
600
- * @param buildingId {string | null | undefined}
601
- * @param ordinal {string | null | undefined}
665
+ * @param buildingId {string | null | undefined} null | undefined will be treated as ''.
666
+ * @param ordinal {string | null | undefined} null | undefined will be treated as ''.
602
667
  */
603
668
  setOpacityByBuilding(buildingId: string | null | undefined, ordinal: string | null | undefined): void;
604
669
  private _createIconFeature;
@@ -718,7 +783,7 @@ export type IMultiLangAddress = Record<keyof IMultiLangName, {
718
783
  }>;
719
784
  export interface IBbox {
720
785
  maxLat: number;
721
- maxLon: string;
786
+ maxLon: number;
722
787
  minLat: number;
723
788
  minLon: number;
724
789
  }
@@ -833,6 +898,7 @@ export declare class VenuesService {
833
898
  * @param page Default is 1.
834
899
  */
835
900
  searchByGlobal(keywords: string, offset?: number, page?: number): AxiosPromise<IResponse<IResponseVenues>>;
901
+ private _changedRes;
836
902
  }
837
903
  export interface IResponseBuildings {
838
904
  buildings: IBuilding[];
@@ -904,6 +970,11 @@ export interface IResponsePois {
904
970
  pois: IPoi[];
905
971
  total: number;
906
972
  }
973
+ export declare enum DistanceSearchType {
974
+ POINT = "Point",
975
+ POLYGON = "Polygon",
976
+ GATE = "Gate"
977
+ }
907
978
  export interface IPoiCategory {
908
979
  category: string;
909
980
  description: string;
@@ -970,25 +1041,45 @@ export declare class PoisService {
970
1041
  /**
971
1042
  * @description Search poi categories by venue id, building id, or floor id.
972
1043
  * Search scope priority: floorId > buildingId > venueId.
973
- * @param venueId
974
- * @param buildingId
975
- * @param floorId
1044
+ * @param paramObject
976
1045
  */
977
- searchCategories({ venueId, buildingId, floorId, }: {
1046
+ searchCategories(paramObject: {
978
1047
  venueId?: string;
979
1048
  buildingId?: string;
980
1049
  floorId?: string;
981
1050
  }): AxiosPromise<IResponse<IPoiCategory[]>>;
982
1051
  /**
983
- * @description Search orientation and poi
984
- * @param angle The angle between cellphone's orientation and the north.
985
- * @param buildingId
986
- * @param center User's current position, [lon, lat].
987
- * @param distance Radius from center, unit is meter.
988
- * @param distanceSearchType Search type, default is DistanceSearchType.POINT.
989
- * @param floorId
1052
+ * @description Search orientation and poi.
1053
+ * BuildingId, floorId and ordinal are mutually exclusive, priority: ordinal > floorId > buildingId.
1054
+ * @param paramObj
990
1055
  */
991
- searchOrientation(angle: number, buildingId: string, center: number[], distance: number, distanceSearchType?: string, floorId?: string): AxiosPromise<IResponse<IOrientationPoi[]>>;
1056
+ searchOrientation(paramObj: {
1057
+ /**
1058
+ * User's current position, [lon, lat].
1059
+ */
1060
+ center: [
1061
+ number,
1062
+ number
1063
+ ];
1064
+ /**
1065
+ * The angle between cellphone's orientation and the north.
1066
+ */
1067
+ angle: number;
1068
+ /**
1069
+ * Radius.
1070
+ */
1071
+ distance: number;
1072
+ buildingId?: string;
1073
+ floorId?: string;
1074
+ /**
1075
+ * Floor order in physical space, e.g. '-1', '0'(ground floor), '1'...
1076
+ */
1077
+ ordinal?: string;
1078
+ /**
1079
+ * Search type.
1080
+ */
1081
+ distanceSearchType?: DistanceSearchType;
1082
+ }): AxiosPromise<IResponse<IOrientationPoi[]>>;
992
1083
  private _changedRes;
993
1084
  }
994
1085
  export interface IResponseRoute {
@@ -1115,7 +1206,7 @@ export declare class RoutePainter {
1115
1206
  */
1116
1207
  setOutdoorLineColor(color: string): this;
1117
1208
  /**
1118
- * @description Set color of dashed line which connected the start and end markers.
1209
+ * @description Set color of dashed lines which connected the start and end markers.
1119
1210
  * @param color The color type is a color in the sRGB color space.
1120
1211
  * Formats: HTML-style hex values, RGB, RGBA, HSL, and HSLA.
1121
1212
  * Predefined HTML colors names, like yellow and blue, are also permitted.
@@ -1171,10 +1262,6 @@ export declare class RoutePainter {
1171
1262
  }
1172
1263
  export declare const OFFSET: number;
1173
1264
  export declare const PAGE: number;
1174
- export declare enum DistanceSearchType {
1175
- POINT = "Point",
1176
- POLYGON = "Polygon"
1177
- }
1178
1265
  export declare const version: string;
1179
1266
  export type { ControlPosition, Map as MaplibreMap, MapLayerEventType, FilterSpecification, PointLike, } from "maplibre-gl";
1180
1267