11package com.mapbox.navigation.core.navigator
22
33import com.mapbox.common.TilesetDescriptor
4+ import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
45import com.mapbox.navigation.base.options.RoutingTilesOptions
56import com.mapbox.navigator.CacheHandle
67
@@ -38,6 +39,33 @@ class TilesetDescriptorFactory internal constructor(
3839 tilesVersion ? : routingTilesOptions.tilesVersion,
3940 )
4041
42+ /* *
43+ * Creates TilesetDescriptor using the specified dataset, profile and version.
44+ *
45+ * @param tilesDataset string built out of `<account>[.<graph>]` variables.
46+ * Account can be `mapbox` for default datasets or your username for other.
47+ * Graph can be left blank if you don't target any custom datasets.
48+ * If null [RoutingTilesOptions.tilesDataset] will be used.
49+ * @param tilesProfile profile of the dataset.
50+ * If null [RoutingTilesOptions.tilesProfile] will be used.
51+ * @param tilesVersion tiles version
52+ * If null [RoutingTilesOptions.tilesVersion] will be used.
53+ * @param includeAdas Whether to include ADAS tiles.
54+ */
55+ @ExperimentalPreviewMapboxNavigationAPI
56+ @JvmOverloads
57+ fun build (
58+ tilesDataset : String? = null,
59+ tilesProfile : String? = null,
60+ tilesVersion : String? = null,
61+ includeAdas : Boolean ,
62+ ): TilesetDescriptor =
63+ nativeFactoryWrapper.build(
64+ combineDatasetWithProfile(tilesDataset, tilesProfile),
65+ tilesVersion ? : routingTilesOptions.tilesVersion,
66+ includeAdas,
67+ )
68+
4169 /* *
4270 * Gets TilesetDescriptor which corresponds to the currently used routing tiles dataset
4371 * and the specified `tilesVersion`.
@@ -46,6 +74,16 @@ class TilesetDescriptorFactory internal constructor(
4674 fun getSpecificVersion (tilesVersion : String ): TilesetDescriptor =
4775 nativeFactoryWrapper.getSpecificVersion(cache, tilesVersion)
4876
77+ /* *
78+ * Gets TilesetDescriptor which corresponds to the currently used routing tiles dataset
79+ * and the specified `tilesVersion`.
80+ * @param tilesVersion TilesetDescriptor version
81+ * @param includeAdas Whether to include ADAS tiles.
82+ */
83+ @ExperimentalPreviewMapboxNavigationAPI
84+ fun getSpecificVersion (tilesVersion : String , includeAdas : Boolean ): TilesetDescriptor =
85+ nativeFactoryWrapper.getSpecificVersion(cache, tilesVersion, includeAdas)
86+
4987 /* *
5088 * Gets TilesetDescriptor which corresponds to the latest available version of routing tiles.
5189 */
@@ -69,12 +107,24 @@ class TilesetDescriptorFactory internal constructor(
69107 tilesVersion : String ,
70108 ): TilesetDescriptor
71109
110+ fun getSpecificVersion (
111+ cache : CacheHandle ,
112+ tilesVersion : String ,
113+ includeAdas : Boolean ,
114+ ): TilesetDescriptor
115+
72116 fun getLatest (cache : CacheHandle ): TilesetDescriptor
73117
74118 fun build (
75119 tilesDatasetAndProfile : String ,
76120 tilesVersion : String ,
77121 ): TilesetDescriptor
122+
123+ fun build (
124+ tilesDatasetAndProfile : String ,
125+ tilesVersion : String ,
126+ includeAdas : Boolean ,
127+ ): TilesetDescriptor
78128 }
79129
80130 internal class NativeFactoryWrapperImpl : NativeFactoryWrapper {
@@ -89,6 +139,18 @@ class TilesetDescriptorFactory internal constructor(
89139 )
90140 }
91141
142+ override fun getSpecificVersion (
143+ cache : CacheHandle ,
144+ tilesVersion : String ,
145+ includeAdas : Boolean ,
146+ ): TilesetDescriptor {
147+ return NativeTilesetDescriptorFactory .getSpecificVersion(
148+ cache,
149+ tilesVersion,
150+ includeAdas,
151+ )
152+ }
153+
92154 override fun getLatest (cache : CacheHandle ): TilesetDescriptor {
93155 return NativeTilesetDescriptorFactory .getLatest(cache)
94156 }
@@ -102,5 +164,17 @@ class TilesetDescriptorFactory internal constructor(
102164 tilesVersion,
103165 )
104166 }
167+
168+ override fun build (
169+ tilesDatasetAndProfile : String ,
170+ tilesVersion : String ,
171+ includeAdas : Boolean ,
172+ ): TilesetDescriptor {
173+ return NativeTilesetDescriptorFactory .build(
174+ tilesDatasetAndProfile,
175+ tilesVersion,
176+ includeAdas,
177+ )
178+ }
105179 }
106180}
0 commit comments