MBMStyleManager.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. // This file is generated and will be overwritten automatically.
  2. #import <Foundation/Foundation.h>
  3. @class MBXExpected<__covariant Value, __covariant Error>;
  4. @class MBXFeature;
  5. #import <MapboxCoreMaps/MBMObservable.h>
  6. @class MBMCameraOptions;
  7. @class MBMCanonicalTileID;
  8. @class MBMCoordinateBounds;
  9. @class MBMCustomGeometrySourceOptions;
  10. @class MBMImage;
  11. @class MBMImageContent;
  12. @class MBMImageStretches;
  13. @class MBMLayerPosition;
  14. @class MBMStyleObjectInfo;
  15. @class MBMStylePropertyValue;
  16. @class MBMTransitionOptions;
  17. @protocol MBMCustomLayerHost;
  18. /** Interface for managing style of the `map`. */
  19. NS_SWIFT_NAME(StyleManager)
  20. __attribute__((visibility ("default")))
  21. @interface MBMStyleManager : MBMObservable
  22. /**
  23. * Get the URI of the current style in use.
  24. *
  25. * @return A string containing a style URI.
  26. */
  27. - (nonnull NSString *)getStyleURI __attribute((ns_returns_retained));
  28. /**
  29. * Load style from provided URI.
  30. *
  31. * This is an asynchronous call. To check the result of this operation the user must register an observer observing
  32. * `MapLoaded` or `MapLoadingError` events. In case of successful style load, `StyleLoaded` event will be also emitted.
  33. *
  34. * @param uri URI where the style should be loaded from.
  35. */
  36. - (void)setStyleURIForUri:(nonnull NSString *)uri;
  37. /**
  38. * Get the JSON serialization string of the current style in use.
  39. *
  40. * @return A JSON string containing a serialized style.
  41. */
  42. - (nonnull NSString *)getStyleJSON __attribute((ns_returns_retained));
  43. /**
  44. * Load the style from a provided JSON string.
  45. *
  46. * @param json A JSON string containing a serialized style.
  47. */
  48. - (void)setStyleJSONForJson:(nonnull NSString *)json;
  49. /**
  50. * Returns the map style's default camera, if any, or a default camera otherwise.
  51. * The map style's default camera is defined as follows:
  52. * - [center](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-center)
  53. * - [zoom](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-zoom)
  54. * - [bearing](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-bearing)
  55. * - [pitch](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-pitch)
  56. *
  57. * The style default camera is re-evaluated when a new style is loaded.
  58. *
  59. * @return The default `camera options` of the current style in use.
  60. */
  61. - (nonnull MBMCameraOptions *)getStyleDefaultCamera __attribute((ns_returns_retained));
  62. /**
  63. * Returns the map style's transition options. By default, the style parser will attempt
  64. * to read the style default transition options, if any, fallbacking to an immediate transition
  65. * otherwise. Transition options can be overriden via `setStyleTransition`, but the options are
  66. * reset once a new style has been loaded.
  67. *
  68. * The style transition is re-evaluated when a new style is loaded.
  69. *
  70. * @return The `transition options` of the current style in use.
  71. */
  72. - (nonnull MBMTransitionOptions *)getStyleTransition __attribute((ns_returns_retained));
  73. /**
  74. * Overrides the map style's transition options with user-provided options.
  75. *
  76. * The style transition is re-evaluated when a new style is loaded.
  77. *
  78. * @param transitionOptions The `transition options`.
  79. */
  80. - (void)setStyleTransitionForTransitionOptions:(nonnull MBMTransitionOptions *)transitionOptions;
  81. /**
  82. * Checks whether a given style layer exists.
  83. *
  84. * @param layerId Style layer identifier.
  85. *
  86. * @return A `true` value if the given style layer exists, `false` otherwise.
  87. */
  88. - (BOOL)styleLayerExistsForLayerId:(nonnull NSString *)layerId;
  89. /**
  90. * Returns the existing style layers.
  91. *
  92. * @return The list containing the information about existing style layer objects.
  93. */
  94. - (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleLayers __attribute((ns_returns_retained));
  95. /**
  96. * Gets the value of style layer property.
  97. *
  98. * @param layerId A style layer identifier.
  99. * @param property The style layer property name.
  100. * @return The `style property value`.
  101. */
  102. - (nonnull MBMStylePropertyValue *)getStyleLayerPropertyForLayerId:(nonnull NSString *)layerId
  103. property:(nonnull NSString *)property __attribute((ns_returns_retained));
  104. /**
  105. * Gets the default value of style layer property
  106. *
  107. * @param layerType A style [layer type](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).
  108. * @param property The style layer property name.
  109. * @return The default `style property value` for a given `layerType` and `property` name.
  110. */
  111. + (nonnull MBMStylePropertyValue *)getStyleLayerPropertyDefaultValueForLayerType:(nonnull NSString *)layerType
  112. property:(nonnull NSString *)property __attribute((ns_returns_retained));
  113. /**
  114. * Gets the value of style source property.
  115. *
  116. * @param sourceId A style source identifier.
  117. * @param property The style source property name.
  118. * @return The value of a `property` in the source with a `sourceId`.
  119. */
  120. - (nonnull MBMStylePropertyValue *)getStyleSourcePropertyForSourceId:(nonnull NSString *)sourceId
  121. property:(nonnull NSString *)property __attribute((ns_returns_retained));
  122. /**
  123. * Gets the default value of style source property.
  124. *
  125. * @param sourceType A style source type.
  126. * @param property The style source property name.
  127. * @return The default value of a `property` for the sources with of a `sourceType` type.
  128. */
  129. + (nonnull MBMStylePropertyValue *)getStyleSourcePropertyDefaultValueForSourceType:(nonnull NSString *)sourceType
  130. property:(nonnull NSString *)property __attribute((ns_returns_retained));
  131. /**
  132. * Checks whether a given style source exists.
  133. *
  134. * @param sourceId A style source identifier.
  135. *
  136. * @return `true` if the given source exists, `false` otherwise.
  137. */
  138. - (BOOL)styleSourceExistsForSourceId:(nonnull NSString *)sourceId;
  139. /**
  140. * Returns the existing style sources.
  141. *
  142. * @return The list containing the information about existing style source objects.
  143. */
  144. - (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleSources __attribute((ns_returns_retained));
  145. /**
  146. * Gets the value of a style light property.
  147. *
  148. * @param property The style light property name.
  149. * @return The style light property value.
  150. */
  151. - (nonnull MBMStylePropertyValue *)getStyleLightPropertyForProperty:(nonnull NSString *)property __attribute((ns_returns_retained));
  152. /**
  153. * Gets the value of a style atmosphere property.
  154. *
  155. * @param property The style atmosphere property name.
  156. * @return The style atmosphere property value.
  157. */
  158. - (nonnull MBMStylePropertyValue *)getStyleAtmospherePropertyForProperty:(nonnull NSString *)property __attribute((ns_returns_retained));
  159. /**
  160. * Gets the value of a style terrain property.
  161. *
  162. * @param property The style terrain property name.
  163. * @return The style terrain property value.
  164. */
  165. - (nonnull MBMStylePropertyValue *)getStyleTerrainPropertyForProperty:(nonnull NSString *)property __attribute((ns_returns_retained));
  166. /**
  167. * Gets the value of a style projection property.
  168. *
  169. * @param property The style projection property name.
  170. * @return The style projection property value.
  171. */
  172. - (nonnull MBMStylePropertyValue *)getStyleProjectionPropertyForProperty:(nonnull NSString *)property __attribute((ns_returns_retained));
  173. /**
  174. * Get an `image` from the style.
  175. *
  176. * @param imageId The identifier of the `image`.
  177. *
  178. * @return The `image` for the given `imageId`, or empty if no image is associated with the `imageId`.
  179. */
  180. - (nullable MBMImage *)getStyleImageForImageId:(nonnull NSString *)imageId __attribute((ns_returns_retained));
  181. /**
  182. * Checks whether an image exists.
  183. *
  184. * @param imageId The identifier of the image.
  185. *
  186. * @return True if image exists, false otherwise.
  187. */
  188. - (BOOL)hasStyleImageForImageId:(nonnull NSString *)imageId;
  189. /**
  190. * Checks whether a model exists.
  191. *
  192. * @param modelId The identifier of the model.
  193. *
  194. * @return True if model exists, false otherwise.
  195. */
  196. - (BOOL)hasStyleModelForModelId:(nonnull NSString *)modelId;
  197. /**
  198. * Check if the style is completely loaded.
  199. *
  200. * Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via `MapLoadingError`).
  201. * Sprite loading error is not fatal and we don't want it to block the map rendering, thus the function will still return `true` if style and sources are fully loaded.
  202. *
  203. * @return `true` iff the style JSON contents, the style specified sprite and sources are all loaded, otherwise returns `false`.
  204. *
  205. */
  206. - (BOOL)isStyleLoaded;
  207. @end