@mapsindoors/react-native-maps-indoors-mapbox 2.6.1 → 2.6.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.
Files changed (132) hide show
  1. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +322 -0
  2. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +166 -0
  3. package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +1699 -0
  4. package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +761 -0
  5. package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +410 -0
  6. package/android/src/main/java/com/mapsindoorsrn/core/RCMapView.java +16 -0
  7. package/android/src/main/java/com/mapsindoorsrn/core/README.md +3 -0
  8. package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +227 -0
  9. package/android/src/main/java/com/mapsindoorsrn/core/models/BitmapStopIconConfig.java +22 -0
  10. package/android/src/main/java/com/mapsindoorsrn/core/models/Bounds.java +19 -0
  11. package/android/src/main/java/com/mapsindoorsrn/core/models/Filter.java +77 -0
  12. package/android/src/main/java/com/mapsindoorsrn/core/models/Location.java +17 -0
  13. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraPosition.java +34 -0
  14. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraUpdate.java +68 -0
  15. package/android/src/main/java/com/mapsindoorsrn/core/models/MPError.java +38 -0
  16. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionProvider.java +46 -0
  17. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionResult.java +117 -0
  18. package/android/src/main/java/com/mapsindoorsrn/core/models/Query.java +30 -0
  19. package/android/src/main/java/com/mapsindoorsrn/core/models/RouteStopIconConfigModel.java +35 -0
  20. package/ios/core/CameraPosition.swift +15 -0
  21. package/ios/core/CameraUpdate.swift +19 -0
  22. package/ios/core/CameraUpdateError.swift +11 -0
  23. package/ios/core/DirectionsRendererBridge.m +59 -0
  24. package/ios/core/DirectionsRendererModule.swift +359 -0
  25. package/ios/core/DirectionsServiceBridge.m +55 -0
  26. package/ios/core/DirectionsServiceModule.swift +186 -0
  27. package/ios/core/IconStopUrl.swift +17 -0
  28. package/ios/core/LabelGraphic.swift +15 -0
  29. package/ios/core/MPDisplayRuleBridge.m +696 -0
  30. package/ios/core/MPDisplayRuleModule.swift +1704 -0
  31. package/ios/core/MapControlBridge.m +213 -0
  32. package/ios/core/MapControlModule.swift +702 -0
  33. package/ios/core/MapsIndoorsBridge.m +128 -0
  34. package/ios/core/MapsIndoorsData.swift +288 -0
  35. package/ios/core/MapsIndoorsModule.swift +363 -0
  36. package/ios/core/RCMapView.swift +16 -0
  37. package/ios/core/README.md +3 -0
  38. package/ios/core/ReactPositionProvider.swift +27 -0
  39. package/ios/core/RouteIcon.swift +34 -0
  40. package/ios/core/UtilsBridge.m +73 -0
  41. package/ios/core/UtilsModule.swift +182 -0
  42. package/ios/core/helpers.swift +57 -0
  43. package/package.json +1 -1
  44. package/src/core/EventNames.ts +21 -0
  45. package/src/core/MPAdditionalDetail.ts +102 -0
  46. package/src/core/MPBadgePosition.ts +12 -0
  47. package/src/core/MPBounds.ts +155 -0
  48. package/src/core/MPBuilding.ts +333 -0
  49. package/src/core/MPBuildingCollection.ts +57 -0
  50. package/src/core/MPBuildingInfo.ts +63 -0
  51. package/src/core/MPCameraEvent.ts +17 -0
  52. package/src/core/MPCameraEventListener.ts +17 -0
  53. package/src/core/MPCameraPosition.ts +82 -0
  54. package/src/core/MPCameraUpdate.ts +174 -0
  55. package/src/core/MPCameraViewFitMode.ts +25 -0
  56. package/src/core/MPCategory.ts +85 -0
  57. package/src/core/MPCategoryCollection.ts +62 -0
  58. package/src/core/MPCollection.ts +59 -0
  59. package/src/core/MPCollisionHandling.ts +12 -0
  60. package/src/core/MPDailyOpeningHours.ts +67 -0
  61. package/src/core/MPDataField.ts +69 -0
  62. package/src/core/MPDetailType.ts +73 -0
  63. package/src/core/MPDirectionsRenderer.ts +238 -0
  64. package/src/core/MPDirectionsService.ts +152 -0
  65. package/src/core/MPDisplayRule.ts +1823 -0
  66. package/src/core/MPEntity.ts +60 -0
  67. package/src/core/MPEntityInfo.ts +28 -0
  68. package/src/core/MPError.ts +122 -0
  69. package/src/core/MPFeatureTypes.ts +8 -0
  70. package/src/core/MPFilter.ts +168 -0
  71. package/src/core/MPFilterBehavior.ts +115 -0
  72. package/src/core/MPFloor.ts +170 -0
  73. package/src/core/MPFloorSelectorInterface.ts +63 -0
  74. package/src/core/MPGeometry.ts +91 -0
  75. package/src/core/MPHighlightBehavior.ts +115 -0
  76. package/src/core/MPHighway.ts +14 -0
  77. package/src/core/MPIconPlacement.ts +13 -0
  78. package/src/core/MPIconSize.ts +39 -0
  79. package/src/core/MPLabelGraphic.ts +24 -0
  80. package/src/core/MPLabelPosition.ts +12 -0
  81. package/src/core/MPLabelType.ts +11 -0
  82. package/src/core/MPLocation.ts +440 -0
  83. package/src/core/MPLocationPropertyNames.ts +30 -0
  84. package/src/core/MPLocationSettings.ts +40 -0
  85. package/src/core/MPLocationType.ts +16 -0
  86. package/src/core/MPMapConfig.ts +280 -0
  87. package/src/core/MPMapStyle.ts +57 -0
  88. package/src/core/MPMultiPolygon.ts +218 -0
  89. package/src/core/MPOpeningHours.ts +48 -0
  90. package/src/core/MPPOIType.ts +43 -0
  91. package/src/core/MPPoint.ts +169 -0
  92. package/src/core/MPPolygon.ts +219 -0
  93. package/src/core/MPPositionProviderInterface.ts +45 -0
  94. package/src/core/MPPositionResultInterface.ts +42 -0
  95. package/src/core/MPPropertyData.ts +234 -0
  96. package/src/core/MPQuery.ts +69 -0
  97. package/src/core/MPRoute.ts +105 -0
  98. package/src/core/MPRouteCoordinate.ts +95 -0
  99. package/src/core/MPRouteLeg.ts +158 -0
  100. package/src/core/MPRouteProperty.ts +83 -0
  101. package/src/core/MPRouteStep.ts +186 -0
  102. package/src/core/MPRouteStopIconConfig.ts +82 -0
  103. package/src/core/MPSelectionBehavior.ts +114 -0
  104. package/src/core/MPSelectionMode.ts +4 -0
  105. package/src/core/MPSettings3D.ts +107 -0
  106. package/src/core/MPSize.ts +21 -0
  107. package/src/core/MPSolution.ts +189 -0
  108. package/src/core/MPSolutionConfig.ts +188 -0
  109. package/src/core/MPSolutionDisplayRule.ts +15 -0
  110. package/src/core/MPUserRole.ts +60 -0
  111. package/src/core/MPUserRoleCollection.ts +37 -0
  112. package/src/core/MPUtils.ts +178 -0
  113. package/src/core/MPVenue.ts +294 -0
  114. package/src/core/MPVenueCollection.ts +58 -0
  115. package/src/core/MPVenueInfo.ts +62 -0
  116. package/src/core/MPWeeklyOpeningHours.ts +129 -0
  117. package/src/core/MapControl.ts +961 -0
  118. package/src/core/MapView.tsx +34 -0
  119. package/src/core/MapsIndoors.ts +571 -0
  120. package/src/core/OnBuildingFoundAtCameraTargetListener.ts +17 -0
  121. package/src/core/OnFloorSelectionChangedListener.ts +17 -0
  122. package/src/core/OnFloorUpdateListener.ts +16 -0
  123. package/src/core/OnLegSelectedListener.ts +17 -0
  124. package/src/core/OnLiveLocationUpdateListener.ts +17 -0
  125. package/src/core/OnLocationSelectedListener.ts +17 -0
  126. package/src/core/OnMapClickListener.ts +20 -0
  127. package/src/core/OnMarkerClickListener.ts +17 -0
  128. package/src/core/OnMarkerInfoWindowClickListener.ts +17 -0
  129. package/src/core/OnPositionUpdateListener.ts +17 -0
  130. package/src/core/OnVenueFoundAtCameraTargetListener.ts +17 -0
  131. package/src/core/README.md +3 -0
  132. package/src/core/RouteStopIconConfig.ts +10 -0
@@ -0,0 +1,60 @@
1
+ import { MPPoint } from "../../index";
2
+
3
+ /**
4
+ * An interface describing trivial properties of a MapsIndoors geographical entities.
5
+ *
6
+ * @export
7
+ * @abstract
8
+ * @class MPEntity
9
+ * @typedef {MPEntity}
10
+ */
11
+ export default abstract class MPEntity {
12
+ /**
13
+ * The position of the entity, oftenmost its anchorpoint.
14
+ *
15
+ * @public
16
+ * @abstract
17
+ * @type {?MPPoint}
18
+ */
19
+ public abstract position?: MPPoint;
20
+
21
+ /**
22
+ * Whether the entity's geometry is a point.
23
+ *
24
+ * @public
25
+ * @abstract
26
+ * @readonly
27
+ * @type {boolean}
28
+ */
29
+ public abstract get isPoint(): boolean;
30
+ /**
31
+ * The type of the entity (eg. MPLocation).
32
+ *
33
+ * @public
34
+ * @readonly
35
+ * @type {string}
36
+ */
37
+ public readonly type: string;
38
+
39
+ /**
40
+ * Creates an instance of MPEntity.
41
+ *
42
+ * @constructor
43
+ * @protected
44
+ * @param {string} type
45
+ * @param {?boolean} [isPoint]
46
+ */
47
+ protected constructor(type: string) {
48
+ this.type = type;
49
+ }
50
+
51
+ /**
52
+ * Stringifies the entity.
53
+ *
54
+ * @public
55
+ * @returns {string}
56
+ */
57
+ public toJson(): string {
58
+ return JSON.stringify(this);
59
+ }
60
+ }
@@ -0,0 +1,28 @@
1
+ import { MPDataField } from "../../index";
2
+
3
+ /**
4
+ * An interface describing base properties of entity info collections.
5
+ *
6
+ * @export
7
+ * @abstract
8
+ * @class MPEntityInfo
9
+ * @typedef {MPEntityInfo}
10
+ */
11
+ export abstract class MPEntityInfo {
12
+ /**
13
+ * Creates an instance of MPEntityInfo.
14
+ *
15
+ * @constructor
16
+ * @protected
17
+ * @param {string} name The name of the Entity
18
+ * @param {?string[]} [aliases] The aliases the Entity uses
19
+ * @param {?Map<string, MPDataField>} [fields] The Entity's data fields.
20
+ * @param {?string} [language] The current language of the Entity.
21
+ */
22
+ protected constructor(
23
+ public readonly name: string,
24
+ public readonly aliases?: string[],
25
+ public readonly fields?: Map<string, MPDataField>,
26
+ public readonly language?: string,
27
+ ) { }
28
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * A class of errors that can occur when using the MapsIndoors SDK.
3
+ *
4
+ * @export
5
+ * @class MPError
6
+ * @typedef {MPError}
7
+ */
8
+ export default class MPError {
9
+
10
+
11
+
12
+ /**
13
+ * Occurs when an internet connection is required, or if the content server is unresponsive.
14
+ *
15
+ * @static
16
+ * @readonly
17
+ * @type {number}
18
+ */
19
+ static readonly networkError: number = 10;
20
+
21
+ /**
22
+ * Occurs if an unknown exception is caught.
23
+ *
24
+ * @static
25
+ * @readonly
26
+ * @type {number}
27
+ */
28
+ static readonly unknownError: number = 20;
29
+
30
+ /**
31
+ * Occurs if some functions are called before the SDK has been initialized.
32
+ *
33
+ * @static
34
+ * @readonly
35
+ * @type {number}
36
+ */
37
+ static readonly sdkNotInitialized: number = 22;
38
+
39
+ /**
40
+ * Occurs if the supplied API key is not a valid MapsIndoors key.
41
+ *
42
+ * @static
43
+ * @readonly
44
+ * @type {number}
45
+ */
46
+ static readonly invalidApiKey: number = 100;
47
+
48
+ /**
49
+ * Creates an instance of MPError.
50
+ *
51
+ * @constructor
52
+ * @param {number} code The errors code, this will be a MapsIndoors error code.
53
+ *
54
+ * If unsure of the code, check the native SDK.
55
+ *
56
+ * @param {string} message A descriptive message of what caused the error.
57
+ * @param {?number} [status] An optional status code, this will in case of network issues be the response code.
58
+ * @param {?*} [tag] Optional object tag.
59
+ */
60
+ constructor(
61
+ public readonly code: number,
62
+ public readonly message: string,
63
+ public readonly status?: number,
64
+ public readonly tag?: any,
65
+ ) { }
66
+
67
+ /**
68
+ * Creator for MPError, used to decode JSON from the MapsIndoors SDK.
69
+ *
70
+ * @public
71
+ * @static
72
+ * @param {MPErrorParams} object
73
+ * @returns {MPError}
74
+ */
75
+ public static create(object: MPErrorParams): MPError {
76
+ return new MPError(
77
+ object.code,
78
+ object.message,
79
+ object?.status,
80
+ object?.tag
81
+ );
82
+ }
83
+
84
+ public static parse(error: Error): MPError {
85
+ return MPError.create(JSON.parse(error.message))
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Parameter interface for {@link MPError}.
91
+ *
92
+ * @interface MPErrorParams
93
+ * @typedef {MPErrorParams}
94
+ */
95
+ interface MPErrorParams {
96
+ /**
97
+ * The errors code, this will be a MapsIndoors error code.
98
+ *
99
+ * If unsure of the code, check the native SDK.
100
+ *
101
+ * @type {number}
102
+ */
103
+ code: number,
104
+ /**
105
+ * A descriptive message of what caused the error.
106
+ *
107
+ * @type {string}
108
+ */
109
+ message: string,
110
+ /**
111
+ * An optional status code, this will in case of network issues be the response code.
112
+ *
113
+ * @type {?number}
114
+ */
115
+ status?: number,
116
+ /**
117
+ * Optional object tag.
118
+ *
119
+ * @type {?*}
120
+ */
121
+ tag?: any,
122
+ }
@@ -0,0 +1,8 @@
1
+ export enum MPFeatureType {
2
+ model_2d,
3
+ walls_2d,
4
+ model_3d,
5
+ walls_3d,
6
+ extrusion_3d,
7
+ extruded_building,
8
+ }
@@ -0,0 +1,168 @@
1
+ import { MPBounds, MPLocation } from "../../index";
2
+
3
+ /**
4
+ * A filter that can be applied during search, this will limit the returned {@link MPEntity}s to those that
5
+ * fulfills the filter.
6
+ *
7
+ * @export
8
+ * @class MPFilter
9
+ * @typedef {MPFilter}
10
+ */
11
+ export default class MPFilter {
12
+ /**
13
+ * Creates an instance of MPFilter.
14
+ *
15
+ * @constructor
16
+ * @private
17
+ * @param {?number} [take] How many of the applicable locations to include.
18
+ * @param {?number} [skip] How many of the applicable locations to skip.
19
+ * @param {?number} [depth] The depth property makes it possible to get the n'th descendant of a parent location.
20
+ *
21
+ * Thus, the depth property only applies to filters that has set one or more parents.
22
+ * The hierarchical tree of data is generally structured as Venue &gt; Building &gt; Floor &gt; Room &gt; POI.
23
+ *
24
+ * For example, this means that a Floor is the 1st descendant of a Building.
25
+ * So to get all locations inside a Building, set the [depth] to 3.
26
+ *
27
+ * The default value is 1, giving you only the immediate descendant of the specified parents.
28
+ *
29
+ * @param {?number} [floorIndex] The floorIndex property makes it possible to get the locations on a specific floor.
30
+ * @param {?string[]} [categories] A list of categories (keys) from, for example, {@link MPLocation#categories}.
31
+ * @param {?string[]} [locations] A list of location ids to search in.
32
+ * @param {?string[]} [types] A list of location types to search in.
33
+ * @param {?string[]} [parents] A list of parent ids.
34
+ * @param {?MPBounds} [mapExtend] The outer bounds of the query.
35
+ * @param {?MPBounds} [geometry] A geometry to search inside.
36
+ * @param {?boolean} [ignoreLocationSearchableStatus] Allows queries to return results that are marked as non-searchable.
37
+ * @param {?boolean} [ignoreLocationActiveStatus] Allows queries to return results that are marked as inactive using the active from/to mechanism.
38
+ */
39
+ private constructor(
40
+ public take?: number,
41
+ public skip?: number,
42
+ public depth?: number,
43
+ public floorIndex?: number,
44
+ public categories?: string[],
45
+ public locations?: string[],
46
+ public types?: string[],
47
+ public parents?: string[],
48
+ public mapExtend?: MPBounds,
49
+ public geometry?: MPBounds,
50
+ public ignoreLocationSearchableStatus?: boolean,
51
+ public ignoreLocationActiveStatus?: boolean,
52
+ ) { }
53
+
54
+ /**
55
+ * Creator for MPError, invoke with 0 parameters to apply an empty filter.
56
+ *
57
+ * @public
58
+ * @static
59
+ * @param {?MPFilterParams} [object]
60
+ * @returns {MPFilter}
61
+ */
62
+ public static create(object?: MPFilterParams): MPFilter {
63
+ return new MPFilter(
64
+ object?.take,
65
+ object?.skip,
66
+ object?.depth,
67
+ object?.floorIndex,
68
+ object?.categories,
69
+ object?.locations,
70
+ object?.types,
71
+ object?.parents,
72
+ object?.mapExtend,
73
+ object?.geometry,
74
+ object?.ignoreLocationSearchableStatus,
75
+ object?.ignoreLocationActiveStatus,
76
+ );
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Parameter interface for {@link MPFilter}.
82
+ *
83
+ * @export
84
+ * @interface MPFilterParams
85
+ * @typedef {MPFilterParams}
86
+ */
87
+ export interface MPFilterParams {
88
+ /**
89
+ * How many of the applicable locations to include.
90
+ *
91
+ * @type {?number}
92
+ */
93
+ take?: number;
94
+ /**
95
+ * How many of the applicable locations to skip.
96
+ *
97
+ * @type {?number}
98
+ */
99
+ skip?: number;
100
+ /**
101
+ * The depth property makes it possible to get the n'th descendant of a parent location.
102
+ *
103
+ * Thus, the depth property only applies to filters that has set one or more parents.
104
+ * The hierarchical tree of data is generally structured as Venue &gt; Building &gt; Floor &gt; Room &gt; POI.
105
+ *
106
+ * For example, this means that a Floor is the 1st descendant of a Building.
107
+ * So to get all locations inside a Building, set the [depth] to 3.
108
+ *
109
+ * The default value is 1, giving you only the immediate descendant of the specified parents.
110
+ *
111
+ * @type {?number}
112
+ */
113
+ depth?: number;
114
+ /**
115
+ * The floorIndex property makes it possible to get the locations on a specific floor.
116
+ *
117
+ * @type {?number}
118
+ */
119
+ floorIndex?: number;
120
+ /**
121
+ * A list of categories (keys) from, for example, {@link MPLocation#categories}.
122
+ *
123
+ * @type {?string[]}
124
+ */
125
+ categories?: string[];
126
+ /**
127
+ * A list of location ids to search in.
128
+ *
129
+ * @type {?string[]}
130
+ */
131
+ locations?: string[];
132
+ /**
133
+ * A list of location types to search in.
134
+ *
135
+ * @type {?string[]}
136
+ */
137
+ types?: string[];
138
+ /**
139
+ * A list of parent ids.
140
+ *
141
+ * @type {?string[]}
142
+ */
143
+ parents?: string[];
144
+ /**
145
+ * The outer bounds of the query.
146
+ *
147
+ * @type {?MPBounds}
148
+ */
149
+ mapExtend?: MPBounds;
150
+ /**
151
+ * A geometry to search inside.
152
+ *
153
+ * @type {?MPBounds}
154
+ */
155
+ geometry?: MPBounds;
156
+ /**
157
+ * Allows queries to return results that are marked as non-searchable.
158
+ *
159
+ * @type {?boolean}
160
+ */
161
+ ignoreLocationSearchableStatus?: boolean;
162
+ /**
163
+ * Allows queries to return results that are marked as inactive using the active from/to mechanism.
164
+ *
165
+ * @type {?boolean}
166
+ */
167
+ ignoreLocationActiveStatus?: boolean;
168
+ }
@@ -0,0 +1,115 @@
1
+ import MapControl from "../../index";
2
+ import { Platform } from 'react-native';
3
+
4
+ /**
5
+ * Sets a behavior for the map when calling {@link MapControl#setFilter}.
6
+ *
7
+ * Has a default behavior:
8
+ * * MoveCamera = false
9
+ * * ShowInfoWindow = false
10
+ * * AnimationDuration = 0
11
+ * * AllowFloorChange = false
12
+ * * ZoomToFit = true
13
+ *
14
+ * @export
15
+ * @class MPFilterBehavior
16
+ * @typedef {MPFilterBehavior}
17
+ */
18
+ export default class MPFilterBehavior {
19
+
20
+ /**
21
+ * Creates an instance of MPFilterBehavior.
22
+ *
23
+ * @constructor
24
+ * @private
25
+ * @param {boolean} allowFloorChange Whether the filtering is allowed to change the floor if no results are visible on the current floor.
26
+ * @param {boolean} moveCamera Whether the filtering should move the camera to encompass the results.
27
+ * @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
28
+ * @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
29
+ * @param {boolean} zoomToFit Whether the filtering is allowed to zoom in/out the camera.
30
+ * @param {number} maxZoom The maximum zoom level to zoom to when zoomToFit is enabled.
31
+ */
32
+ private constructor(
33
+ public allowFloorChange: boolean,
34
+ public moveCamera: boolean,
35
+ public animationDuration: number,
36
+ public showInfoWindow: boolean,
37
+ public zoomToFit: boolean,
38
+ public maxZoom?: number
39
+ ) { }
40
+
41
+ /**
42
+ * Creator for MPFilterBehavior, invoke with 0 parameters to use default behavior.
43
+ *
44
+ * @public
45
+ * @static
46
+ * @param {MPFilterBehaviorParams} object
47
+ * @returns {MPFilterBehavior}
48
+ */
49
+ public static create(object?: MPFilterBehaviorParams): MPFilterBehavior {
50
+ if(Platform.OS === 'ios') {
51
+ return new MPFilterBehavior(
52
+ object?.allowFloorChange ?? false,
53
+ object?.moveCamera ?? false,
54
+ object?.animationDuration ?? 0,
55
+ object?.showInfoWindow ?? false,
56
+ object?.zoomToFit ?? true,
57
+ object?.maxZoom ?? 999
58
+ );
59
+ }
60
+ return new MPFilterBehavior(
61
+ object?.allowFloorChange ? object.allowFloorChange : false,
62
+ object?.moveCamera ? object.moveCamera : false,
63
+ object?.animationDuration ? object.animationDuration : 0,
64
+ object?.showInfoWindow ? object.showInfoWindow : false,
65
+ object?.zoomToFit ? object?.zoomToFit : true,
66
+ object?.maxZoom
67
+ );
68
+ };
69
+ }
70
+
71
+ /**
72
+ * Parameter interface for {@link MPFilterBehavior}.
73
+ *
74
+ * @export
75
+ * @interface MPFilterBehaviorParams
76
+ * @typedef {MPFilterBehaviorParams}
77
+ */
78
+ export interface MPFilterBehaviorParams {
79
+ /**
80
+ * Whether the filtering is allowed to change the floor if no results are visible on the current floor.
81
+ *
82
+ * @type {?boolean}
83
+ */
84
+ allowFloorChange?: boolean,
85
+ /**
86
+ * Whether the filtering should move the camera to encompass the results.
87
+ *
88
+ * @type {?boolean}
89
+ */
90
+ moveCamera?: boolean,
91
+ /**
92
+ * How long the camera movement should be animated for, set to 0 disables animation.
93
+ *
94
+ * @type {?number}
95
+ */
96
+ animationDuration?: number,
97
+ /**
98
+ * Whether to open the info window if a single result is returned.
99
+ *
100
+ * @type {?boolean}
101
+ */
102
+ showInfoWindow?: boolean,
103
+ /**
104
+ * Whether the filtering is allowed to zoom in/out the camera.
105
+ *
106
+ * @type {?boolean}
107
+ */
108
+ zoomToFit?: boolean,
109
+ /**
110
+ * The maximum zoom level to zoom to when zoomToFit is enabled.
111
+ *
112
+ * @type {?number}
113
+ */
114
+ maxZoom?: number
115
+ }
@@ -0,0 +1,170 @@
1
+ import MPEntity from "./MPEntity";
2
+ import { MPMultiPolygon, MPMultiPolygonParams, MPBounds, MPPoint, MPBuilding } from "../../index";
3
+ import { Platform } from "react-native";
4
+
5
+ /**
6
+ * A MapsIndoors geographical entity. A floor is contained within a {@link MPBuilding}.
7
+ *
8
+ * @export
9
+ * @class MPFloor
10
+ * @typedef {MPFloor}
11
+ * @extends {MPEntity}
12
+ */
13
+ export default class MPFloor extends MPEntity {
14
+
15
+ /**
16
+ * The default floor index is 0, as that is the index of ground floors and any point outside a building.
17
+ *
18
+ * @public
19
+ * @static
20
+ * @readonly
21
+ * @type {number}
22
+ */
23
+ public static readonly defaultGroundFloorIndex: number = 0;
24
+
25
+ /**
26
+ * Creates an instance of MPFloor.
27
+ *
28
+ * @constructor
29
+ * @private
30
+ * @param {string} [id] The floor's ID.
31
+ * @param {string} [name] The floor's name.
32
+ * @param {?MPMultiPolygon} [geometry] The geometry of the floor.
33
+ * @param {?string[]} [aliases] An array of aliases used by the floor.
34
+ * @param {?number} [floorIndex] The floor index of the floor.
35
+ * @param {?string} [buildingId] The ID of the building this floor lies within.
36
+ */
37
+ private constructor(
38
+ private readonly id: string,
39
+ private readonly name: string,
40
+ public readonly geometry?: MPMultiPolygon,
41
+ public readonly aliases?: string[],
42
+ public readonly floorIndex?: number,
43
+ public buildingId?: string,
44
+
45
+ ) {
46
+ super("MPFloor");
47
+ }
48
+
49
+ public get isPoint(): boolean {
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * Creator for MPFloor, used to decode JSON from the MapsIndoors SDK.
55
+ *
56
+ * @public
57
+ * @static
58
+ * @param {MPFloorParams} object
59
+ * @returns {MPFloor}
60
+ */
61
+ public static create(object: MPFloorParams): MPFloor {
62
+ var multiPolygon;
63
+ if (Platform.OS === 'ios') {
64
+ multiPolygon = MPMultiPolygon.create({coordinates: object?.geometry?.coordinates, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
65
+ }else {
66
+ multiPolygon = MPMultiPolygon.create(object?.geometry);
67
+ }
68
+ return new MPFloor(
69
+ object?.id,
70
+ object?.name,
71
+ multiPolygon,
72
+ object?.aliases,
73
+ object?.floorIndex,
74
+ object?.buildingId,
75
+ );
76
+ }
77
+
78
+ /**
79
+ * Get the floor's id.
80
+ *
81
+ * @public
82
+ * @readonly
83
+ * @type {string}
84
+ */
85
+ public get floorId(): string {
86
+ return this.id;
87
+ }
88
+
89
+ /**
90
+ * Get the floor's displayName.
91
+ *
92
+ * @public
93
+ * @readonly
94
+ * @type {string}
95
+ */
96
+ public get displayName(): string {
97
+ return this.name;
98
+ }
99
+
100
+ /**
101
+ * Get the floor's bounds.
102
+ *
103
+ * @public
104
+ * @readonly
105
+ * @type {MPBounds}
106
+ */
107
+ public get bounds(): MPBounds {
108
+ return this.geometry!.bounds;
109
+ }
110
+
111
+ /**
112
+ * Get the floor's position, this is usually the center of the floors {@link geometry}.
113
+ *
114
+ * @public
115
+ * @readonly
116
+ * @type {MPPoint}
117
+ */
118
+ public get position(): MPPoint {
119
+ return this.geometry!.bounds.center;
120
+ }
121
+
122
+ }
123
+
124
+ /**
125
+ * Parameter interface for {@link MPFloor}.
126
+ *
127
+ * @export
128
+ * @interface MPFloorParams
129
+ * @typedef {MPFloorParams}
130
+ */
131
+ export interface MPFloorParams {
132
+ /**
133
+ * The floor's ID.
134
+ *
135
+ * @type {string}
136
+ */
137
+ id: string,
138
+ /**
139
+ * The floor's name.
140
+ *
141
+ * @type {string}
142
+ */
143
+ name: string,
144
+ /**
145
+ * The geometry of the floor.
146
+ *
147
+ * @type {?MPMultiPolygon}
148
+ */
149
+ geometry: MPMultiPolygon | any,
150
+ /**
151
+ * An array of aliases used by the floor.
152
+ *
153
+ * @type {?string[]}
154
+ */
155
+ aliases?: string[],
156
+ /**
157
+ * The floor index of the floor.
158
+ *
159
+ * @type {?number}
160
+ */
161
+ floorIndex?: number,
162
+ /**
163
+ * The ID of the building this floor lies within.
164
+ *
165
+ * @type {?string}
166
+ */
167
+ buildingId?: string,
168
+
169
+ entityBounds: any
170
+ }