@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,69 @@
1
+ import { MPPoint, MPLocationPropertyNames } from "../../index";
2
+
3
+ /**
4
+ * A collection of query parameters used to query entities in MapsIndoors.
5
+ *
6
+ * @export
7
+ * @class MPQuery
8
+ * @typedef {MPQuery}
9
+ */
10
+ export default class MPQuery {
11
+
12
+ /**
13
+ * Creates an instance of MPQuery.
14
+ *
15
+ * @constructor
16
+ * @private
17
+ * @param {?string} [query] The queried text (search text).
18
+ * @param {?MPPoint} [near] The query is restricted to entities near this point.
19
+ * @param {?string[]} [queryProperties] A list of properties for this query, Uses {@link MPLocationPropertyNames}.
20
+ */
21
+ private constructor(
22
+ public readonly query?: string,
23
+ public readonly near?: MPPoint,
24
+ public readonly queryProperties?: string[],
25
+ ) { }
26
+
27
+ /**
28
+ * Creator for MPQuery, used to decode JSON from the MapsIndoors SDK.
29
+ *
30
+ * @static
31
+ * @param {?MPQueryParams} [object]
32
+ * @returns {MPQuery}
33
+ */
34
+ static create(object?: MPQueryParams): MPQuery {
35
+ return new MPQuery(
36
+ object?.query,
37
+ object?.near,
38
+ object?.queryProperties
39
+ );
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Parameter interface for {@link MPQuery}.
45
+ *
46
+ * @export
47
+ * @interface MPQueryParams
48
+ * @typedef {MPQueryParams}
49
+ */
50
+ export interface MPQueryParams {
51
+ /**
52
+ * The queried text (search text).
53
+ *
54
+ * @type {?string}
55
+ */
56
+ query?: string,
57
+ /**
58
+ * The query is restricted to entities near this point.
59
+ *
60
+ * @type {?MPPoint}
61
+ */
62
+ near?: MPPoint,
63
+ /**
64
+ * A list of properties for this query, Uses {@link MPLocationPropertyNames}.
65
+ *
66
+ * @type {?string[]}
67
+ */
68
+ queryProperties?: string[],
69
+ }
@@ -0,0 +1,105 @@
1
+ import { MPBounds, MPRouteLeg, MPBoundsParams, MPRouteLegParams } from "../../index";
2
+
3
+ /**
4
+ * A route from a origin to a destination broken up into {@link legs}.
5
+ *
6
+ * @export
7
+ * @class MPRoute
8
+ * @typedef {MPRoute}
9
+ */
10
+ export default class MPRoute {
11
+ /**
12
+ * Creates an instance of MPRoute.
13
+ *
14
+ * @constructor
15
+ * @private
16
+ * @param {?MPRouteLeg[]} [legs] The legs the route consists of.
17
+ * @param {?string} [copyrights] The copyrights for this route, if any exists.
18
+ * @param {?string} [summary] A summary of the route.
19
+ * @param {?string[]} [warnings] Any warnings issued for any paths on the route.
20
+ * @param {?string[]} [restrictions] All restrictions in place for the route.
21
+ * @param {?MPBounds} [bounds] The outer bounds of the route.
22
+ * @param {?number[]} [orderedStopIndexes] The original indexes of the stops in the route.
23
+ */
24
+ private constructor(
25
+ public readonly legs?: MPRouteLeg[],
26
+ public readonly copyrights?: string,
27
+ public readonly summary?: string,
28
+ public readonly warnings?: string[],
29
+ public readonly restrictions?: string[],
30
+ public readonly bounds?: MPBounds,
31
+ public readonly ordered_stop_indexes?: number[],
32
+ ) { }
33
+
34
+ /**
35
+ * Creator for MPRoute, used to decode JSON from the MapsIndoors SDK.
36
+ *
37
+ * @static
38
+ * @param {MPRouteParams} object
39
+ * @returns {MPRoute}
40
+ */
41
+ static create(object: MPRouteParams): MPRoute {
42
+ return new MPRoute(
43
+ object?.legs ? object?.legs.map((leg: any) => MPRouteLeg.create(leg)) : undefined,
44
+ object?.copyrights,
45
+ object?.summary,
46
+ object?.warnings,
47
+ object?.restrictions,
48
+ object?.bounds ? MPBounds.create(object?.bounds) : undefined,
49
+ object?.ordered_stop_indexes,
50
+ );
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Parameter interface for {@link MPRoute}.
56
+ *
57
+ * @export
58
+ * @interface MPRouteParams
59
+ * @typedef {MPRouteParams}
60
+ */
61
+ export interface MPRouteParams {
62
+ /**
63
+ * The legs the route consists of.
64
+ *
65
+ * @type {?MPRouteLegParams[]}
66
+ */
67
+ legs?: MPRouteLegParams[],
68
+ /**
69
+ * The copyrights for this route, if any exists.
70
+ *
71
+ * @type {?string}
72
+ */
73
+ copyrights?: string,
74
+ /**
75
+ * A summary of the route.
76
+ *
77
+ * @type {?string}
78
+ */
79
+ summary?: string,
80
+ /**
81
+ * Any warnings issued for any paths on the route.
82
+ *
83
+ * @type {?string[]}
84
+ */
85
+ warnings?: string[],
86
+ /**
87
+ * All restrictions in place for the route.
88
+ *
89
+ * @type {?string[]}
90
+ */
91
+ restrictions?: string[],
92
+ /**
93
+ * The outer bounds of the route.
94
+ *
95
+ * @type {?MPBoundsParams}
96
+ */
97
+ bounds?: MPBoundsParams,
98
+
99
+ /**
100
+ * The original indexes of the stops in the route.
101
+ *
102
+ * @type {?number[]}
103
+ */
104
+ ordered_stop_indexes?: number[],
105
+ }
@@ -0,0 +1,95 @@
1
+ import MPRouteStep from "../../index";
2
+
3
+ /**
4
+ * A coordinate used for routing, it is contained within a {@link MPRouteStep}.
5
+ *
6
+ * @export
7
+ * @class MPRouteCoordinate
8
+ * @typedef {MPRouteCoordinate}
9
+ */
10
+ export default class MPRouteCoordinate {
11
+
12
+ /**
13
+ * Creates an instance of MPRouteCoordinate.
14
+ *
15
+ * @constructor
16
+ * @private
17
+ * @param {?number} [latitude] The latitude part of the coordinate.
18
+ * @param {?number} [longitude] The longitude part of the coordinate.
19
+ * @param {?number} [floorIndex] The index of the floor the coordinate is on.
20
+ * @param {?string} [floorName] The name of the floor the coordinate is on.
21
+ */
22
+ private constructor(
23
+ public readonly latitude?: number,
24
+ public readonly longitude?: number,
25
+ public readonly floorIndex?: number,
26
+ public readonly floorName?: string,
27
+ ) { }
28
+
29
+ /**
30
+ * Creator for MPRouteCoordinate, used to decode JSON from the MapsIndoors SDK.
31
+ *
32
+ * @public
33
+ * @static
34
+ * @param {MPRouteCoordinateParams} object
35
+ * @returns {MPRouteCoordinate}
36
+ */
37
+ public static create(object: MPRouteCoordinateParams): MPRouteCoordinate {
38
+ return new MPRouteCoordinate(
39
+ object?.lat,
40
+ object?.lng,
41
+ object?.zLevel,
42
+ object?.floor_name,
43
+ );
44
+ }
45
+
46
+
47
+ /**
48
+ * Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
49
+ *
50
+ * @public
51
+ * @returns {MPRouteCoordinateParams}
52
+ */
53
+ public toJSON(): MPRouteCoordinateParams {
54
+ return {
55
+ lat: this.latitude,
56
+ lng: this.longitude,
57
+ zLevel: this.floorIndex,
58
+ floor_name: this.floorName,
59
+ };
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Parameter interface for {@link MPRouteCoordinate}.
65
+ *
66
+ * @export
67
+ * @interface MPRouteCoordinateParams
68
+ * @typedef {MPRouteCoordinateParams}
69
+ */
70
+ export interface MPRouteCoordinateParams {
71
+ /**
72
+ * The latitude part of the coordinate.
73
+ *
74
+ * @type {?number}
75
+ */
76
+ lat?: number;
77
+ /**
78
+ * The longitude part of the coordinate.
79
+ *
80
+ * @type {?number}
81
+ */
82
+ lng?: number;
83
+ /**
84
+ * The index of the floor the coordinate is on.
85
+ *
86
+ * @type {?number}
87
+ */
88
+ zLevel?: number;
89
+ /**
90
+ * The name of the floor the coordinate is on.
91
+ *
92
+ * @type {?string}
93
+ */
94
+ floor_name?: string;
95
+ }
@@ -0,0 +1,158 @@
1
+ import { MPRouteStep, MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams, MPRoute } from "../../index";
2
+
3
+ /**
4
+ * A leg of a {@link MPRoute} is defined as all steps between any context shifts (entering/exiting buildings, changing floors).
5
+ *
6
+ * A leg is comprised of a list of {@link steps} as well as a {@link startLocation} and an {@link endLocation}.
7
+ *
8
+ * @export
9
+ * @class MPRouteLeg
10
+ * @typedef {MPRouteLeg}
11
+ */
12
+ export default class MPRouteLeg {
13
+
14
+ /**
15
+ * Creates an instance of MPRouteLeg.
16
+ *
17
+ * @constructor
18
+ * @private
19
+ * @param {?MPRouteStep[]} [steps] The steps the leg consists of.
20
+ * @param {?MPRouteProperty} [distance] The distance of the leg.
21
+ * @param {?MPRouteProperty} [duration] The expected time it takes to traverse the leg.
22
+ * @param {?string} [startAddress] The address at the start of the leg.
23
+ * @param {?string} [endAdress] The address at the end of the leg.
24
+ * @param {?MPRouteCoordinate} [startLocation] The start coordinate of the leg.
25
+ * @param {?MPRouteCoordinate} [endLocation] The end coordinate of the leg.
26
+ * @param {?string} [legStartReason] The reason for the start of the leg.
27
+ * @param {?string} [legEndReason] The reason for the end of the leg.
28
+ * @param {?number} [stopIndex] The index of the stop.
29
+ */
30
+ private constructor(
31
+ public readonly steps?: MPRouteStep[],
32
+ public readonly distance?: MPRouteProperty,
33
+ public readonly duration?: MPRouteProperty,
34
+ public readonly startAddress?: string,
35
+ public readonly endAdress?: string,
36
+ public readonly startLocation?: MPRouteCoordinate,
37
+ public readonly endLocation?: MPRouteCoordinate,
38
+ public readonly legStartReason?: string,
39
+ public readonly legEndReason?: string,
40
+ public readonly stopIndex?: number,
41
+ ) { }
42
+
43
+
44
+ /**
45
+ * Creator for MPRouteLeg, used to decode JSON from the MapsIndoors SDK.
46
+ *
47
+ * @public
48
+ * @static
49
+ * @param {MPRouteLegParams} object
50
+ * @returns {MPRouteLeg}
51
+ */
52
+ public static create(object: MPRouteLegParams): MPRouteLeg {
53
+ return new MPRouteLeg(
54
+ object?.steps ? object?.steps.map((step: any) => MPRouteStep.create(step)) : undefined,
55
+ MPRouteProperty.create(object?.distance as MPRoutePropertyParams),
56
+ MPRouteProperty.create(object?.duration as MPRoutePropertyParams),
57
+ object?.start_address,
58
+ object?.end_address,
59
+ MPRouteCoordinate.create(object?.start_location as MPRouteCoordinateParams),
60
+ MPRouteCoordinate.create(object?.end_location as MPRouteCoordinateParams),
61
+ object?.leg_start_reason,
62
+ object?.leg_end_reason,
63
+ object?.stop_index,
64
+ );
65
+ }
66
+
67
+
68
+ /**
69
+ * Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
70
+ *
71
+ * @public
72
+ * @returns {MPRouteLegParams}
73
+ */
74
+ public toJSON(): MPRouteLegParams {
75
+ return {
76
+ start_address: this.startAddress,
77
+ end_address: this.endAdress,
78
+ start_location: this.startLocation,
79
+ end_location: this.endLocation,
80
+ steps: this.steps,
81
+ distance: this.distance,
82
+ duration: this.duration,
83
+ leg_start_reason: this.legStartReason,
84
+ leg_end_reason: this.legEndReason,
85
+ stop_index: this.stopIndex,
86
+ };
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Parameter interface for {@link MPRouteLeg}.
92
+ *
93
+ * @export
94
+ * @interface MPRouteLegParams
95
+ * @typedef {MPRouteLegParams}
96
+ */
97
+ export interface MPRouteLegParams {
98
+ /**
99
+ * The steps the leg consists of.
100
+ *
101
+ * @type {?MPRouteStep[]}
102
+ */
103
+ steps?: MPRouteStep[];
104
+ /**
105
+ * The distance of the leg.
106
+ *
107
+ * @type {?MPRouteProperty}
108
+ */
109
+ distance?: MPRouteProperty;
110
+ /**
111
+ * The expected time it takes to traverse the leg.
112
+ *
113
+ * @type {?MPRouteProperty}
114
+ */
115
+ duration?: MPRouteProperty;
116
+ /**
117
+ * The address at the start of the leg.
118
+ *
119
+ * @type {?string}
120
+ */
121
+ start_address?: string;
122
+ /**
123
+ * The address at the end of the leg.
124
+ *
125
+ * @type {?string}
126
+ */
127
+ end_address?: string;
128
+ /**
129
+ * The start coordinate of the leg.
130
+ *
131
+ * @type {?MPRouteCoordinate}
132
+ */
133
+ start_location?: MPRouteCoordinate;
134
+ /**
135
+ * The end coordinate of the leg.
136
+ *
137
+ * @type {?MPRouteCoordinate}
138
+ */
139
+ end_location?: MPRouteCoordinate;
140
+ /**
141
+ * The reason for the start of the leg.
142
+ *
143
+ * @type {?string}
144
+ */
145
+ leg_start_reason?: string;
146
+ /**
147
+ * The reason for the end of the leg.
148
+ *
149
+ * @type {?string}
150
+ */
151
+ leg_end_reason?: string;
152
+ /**
153
+ * The index of the stop.
154
+ *
155
+ * @type {?number}
156
+ */
157
+ stop_index?: number;
158
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * A property of of a route.
3
+ *
4
+ * @export
5
+ * @class MPRouteProperty
6
+ * @typedef {MPRouteProperty}
7
+ */
8
+ export default class MPRouteProperty {
9
+
10
+ /**
11
+ * Creates an instance of MPRouteProperty.
12
+ *
13
+ * @constructor
14
+ * @private
15
+ * @param {?string} [text]
16
+ * @param {?number} [value]
17
+ * @param {?string} [timeZone]
18
+ */
19
+ private constructor(
20
+ public readonly value?: number,
21
+ public readonly text?: string,
22
+ public readonly timeZone?: string,
23
+ ) { }
24
+
25
+ /**
26
+ * Creator for MPRouteProperty, used to decode JSON from the MapsIndoors SDK.
27
+ *
28
+ * @public
29
+ * @static
30
+ * @param {MPRoutePropertyParams} object
31
+ * @returns {MPRouteProperty}
32
+ */
33
+ public static create(object: MPRoutePropertyParams): MPRouteProperty {
34
+ return new MPRouteProperty(
35
+ object?.value,
36
+ object?.text,
37
+ object?.time_zone,
38
+ );
39
+ }
40
+
41
+
42
+ /**
43
+ * Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
44
+ *
45
+ * @public
46
+ * @returns {MPRoutePropertyParams}
47
+ */
48
+ public toJSON(): MPRoutePropertyParams {
49
+ return {
50
+ value: this.value,
51
+ text: this.text,
52
+ time_zone: this.timeZone,
53
+ };
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Parameter interface for {@link MPRouteProperty}.
59
+ *
60
+ * @export
61
+ * @interface MPRoutePropertyParams
62
+ * @typedef {MPRoutePropertyParams}
63
+ */
64
+ export interface MPRoutePropertyParams {
65
+ /**
66
+ * The value of the property.
67
+ *
68
+ * @type {?number}
69
+ */
70
+ value?: number,
71
+ /**
72
+ * Accompanying text to the value.
73
+ *
74
+ * @type {?string}
75
+ */
76
+ text?: string,
77
+ /**
78
+ * The timezone of the property.
79
+ *
80
+ * @type {?string}
81
+ */
82
+ time_zone?: string,
83
+ }
@@ -0,0 +1,186 @@
1
+ import { Platform } from "react-native";
2
+ import { MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams } from "../../index";
3
+
4
+ /**
5
+ * Description placeholder.
6
+ *
7
+ * @export
8
+ * @class MPRouteStep
9
+ * @typedef {MPRouteStep}
10
+ */
11
+ export default class MPRouteStep {
12
+
13
+ /**
14
+ * Creates an instance of MPRouteStep.
15
+ *
16
+ * @constructor
17
+ * @private
18
+ * @param {?MPRouteProperty} [distance]
19
+ * @param {?MPRouteProperty} [duration]
20
+ * @param {?MPRouteStep[]} [steps]
21
+ * @param {?MPRouteCoordinate[]} [geometry]
22
+ * @param {?string} [highway]
23
+ * @param {?string} [abutters]
24
+ * @param {?string} [maneuver]
25
+ * @param {?MPRouteCoordinate} [startLocation]
26
+ * @param {?MPRouteCoordinate} [endLocation]
27
+ * @param {?string} [htmlInstructions]
28
+ * @param {?string} [travelMode]
29
+ * @param {?string[]} [availableTravelModes]
30
+ */
31
+ private constructor(
32
+ public readonly distance?: MPRouteProperty,
33
+ public readonly duration?: MPRouteProperty,
34
+ public readonly steps?: MPRouteStep[],
35
+ public readonly geometry?: MPRouteCoordinate[],
36
+ public readonly highway?: string,
37
+ public readonly abutters?: string,
38
+ public readonly maneuver?: string,
39
+ public readonly startLocation?: MPRouteCoordinate,
40
+ public readonly endLocation?: MPRouteCoordinate,
41
+ public readonly htmlInstructions?: string,
42
+ public readonly travelMode?: string,
43
+ public readonly availableTravelModes?: string[],
44
+ ) { }
45
+
46
+
47
+ /**
48
+ * Creator for MPRouteStep, used to decode JSON from the MapsIndoors SDK.
49
+ *
50
+ * @public
51
+ * @static
52
+ * @param {MPRouteStepParams} object
53
+ * @returns {MPRouteStep}
54
+ */
55
+ public static create(object: MPRouteStepParams): MPRouteStep {
56
+ return new MPRouteStep(
57
+ MPRouteProperty.create(object?.distance as MPRoutePropertyParams),
58
+ MPRouteProperty.create(object?.duration as MPRoutePropertyParams),
59
+ object?.steps ? object?.steps.map((subStep: any) => MPRouteStep.create(subStep)): undefined,
60
+ object?.geometry ? object?.geometry.map((geo: any) => MPRouteCoordinate.create(geo)): undefined,
61
+ Platform.OS === "ios" ? (object as any).highway?.type: object?.highway,
62
+ object?.abutters,
63
+ object?.maneuver,
64
+ MPRouteCoordinate.create(object?.start_location as MPRouteCoordinateParams),
65
+ MPRouteCoordinate.create(object?.end_location as MPRouteCoordinateParams),
66
+ object?.html_instructions,
67
+ object?.travel_mode,
68
+ object?.available_travel_modes,
69
+ );
70
+ }
71
+
72
+
73
+ /**
74
+ * Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
75
+ *
76
+ * @public
77
+ * @returns {MPRouteStepParams}
78
+ */
79
+ public toJSON(): MPRouteStepParams {
80
+ return {
81
+ distance: this.distance,
82
+ duration: this.duration,
83
+ start_location: this.startLocation,
84
+ end_location: this.endLocation,
85
+ geometry: this.geometry,
86
+ highway: this.highway,
87
+ abutters: this.abutters,
88
+ html_instructions: this.htmlInstructions,
89
+ maneuver: this.maneuver,
90
+ travel_mode: this.travelMode,
91
+ steps: this.steps,
92
+ available_travel_modes: this.availableTravelModes,
93
+ };
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Parameter interface for {@link MPRouteStep}.
99
+ *
100
+ * @export
101
+ * @interface MPRouteStepParams
102
+ * @typedef {MPRouteStepParams}
103
+ */
104
+ export interface MPRouteStepParams {
105
+ /**
106
+ * The distance of the route step.
107
+ *
108
+ * @type {?MPRouteProperty}
109
+ */
110
+ distance?: MPRouteProperty,
111
+ /**
112
+ * The duration of the route step.
113
+ *
114
+ * @type {?MPRouteProperty}
115
+ */
116
+ duration?: MPRouteProperty,
117
+ /**
118
+ * An array of sub-steps for the route step.
119
+ *
120
+ * @type {?MPRouteStep[]}
121
+ */
122
+ steps?: MPRouteStep[],
123
+ /**
124
+ * An array of coordinates representing the geometry of the route step.
125
+ *
126
+ * @type {?MPRouteCoordinate[]}
127
+ */
128
+ geometry?: MPRouteCoordinate[],
129
+ /**
130
+ * The highway associated with the route step.
131
+ *
132
+ * @type {?string}
133
+ */
134
+ highway?: string,
135
+ /**
136
+ * The abutters associated with the route step.
137
+ *
138
+ * @type {?string}
139
+ */
140
+ abutters?: string,
141
+ /**
142
+ * The maneuver associated with the route step.
143
+ *
144
+ * Possible values incldue:
145
+ * - "turn-left"
146
+ * - "turn-right"
147
+ * - "straight"
148
+ * - "uturn-left"
149
+ * - "uturn-right"
150
+ * - "turn-sharp-left"
151
+ * - "turn-sharp-right"
152
+ *
153
+ * @type {?string}
154
+ */
155
+ maneuver?: string,
156
+ /**
157
+ * The starting location of the route step.
158
+ *
159
+ * @type {?MPRouteCoordinate}
160
+ */
161
+ start_location?: MPRouteCoordinate,
162
+ /**
163
+ * The ending location of the route step.
164
+ *
165
+ * @type {?MPRouteCoordinate}
166
+ */
167
+ end_location?: MPRouteCoordinate,
168
+ /**
169
+ * Textual instructions for the step
170
+ *
171
+ * @type {?string}
172
+ */
173
+ html_instructions?: string,
174
+ /**
175
+ * The travel mode for the route step.
176
+ *
177
+ * @type {?string}
178
+ */
179
+ travel_mode?: string,
180
+ /**
181
+ * An array of available travel modes for the route step.
182
+ *
183
+ * @type {?string[]}
184
+ */
185
+ available_travel_modes?: string[],
186
+ }