MBMMapEvents.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. // This file is generated and will be overwritten automatically.
  2. #import <Foundation/Foundation.h>
  3. /**
  4. * List of supported event types by the `map` and `map snapshotter` objects,
  5. * and event data format specification for each event.
  6. *
  7. * ``` text
  8. * Simplified diagram for events emitted by the map object.
  9. *
  10. * ┌─────────────┐ ┌─────────┐ ┌──────────────┐
  11. * │ Application │ │ Map │ │ResourceLoader│
  12. * └──────┬──────┘ └────┬────┘ └───────┬──────┘
  13. * │ │ │
  14. * ├───────setStyleURI────────▶│ │
  15. * │ ├───────────get style───────────▶│
  16. * │ │ │
  17. * │ │◀─────────style data────────────┤
  18. * │ │ │
  19. * │ ├─parse style─┐ │
  20. * │ │ │ │
  21. * │ StyleDataLoaded ◀─────────────┘ │
  22. * │◀────{"type": "style"}─────┤ │
  23. * │ ├─────────get sprite────────────▶│
  24. * │ │ │
  25. * │ │◀────────sprite data────────────┤
  26. * │ │ │
  27. * │ ├──────parse sprite───────┐ │
  28. * │ │ │ │
  29. * │ StyleDataLoaded ◀─────────────────────────┘ │
  30. * │◀───{"type": "sprite"}─────┤ │
  31. * │ ├─────get source TileJSON(s)────▶│
  32. * │ │ │
  33. * │ SourceDataLoaded │◀─────parse TileJSON data───────┤
  34. * │◀──{"type": "metadata"}────┤ │
  35. * │ │ │
  36. * │ │ │
  37. * │ StyleDataLoaded │ │
  38. * │◀───{"type": "sources"}────┤ │
  39. * │ ├──────────get tiles────────────▶│
  40. * │ │ │
  41. * │◀───────StyleLoaded────────┤ │
  42. * │ │ │
  43. * │ SourceDataLoaded │◀─────────tile data─────────────┤
  44. * │◀────{"type": "tile"}──────┤ │
  45. * │ │ │
  46. * │ │ │
  47. * │◀────RenderFrameStarted────┤ │
  48. * │ ├─────render─────┐ │
  49. * │ │ │ │
  50. * │ ◀────────────────┘ │
  51. * │◀───RenderFrameFinished────┤ │
  52. * │ ├──render, all tiles loaded──┐ │
  53. * │ │ │ │
  54. * │ ◀────────────────────────────┘ │
  55. * │◀────────MapLoaded─────────┤ │
  56. * │ │ │
  57. * │ │ │
  58. * │◀─────────MapIdle──────────┤ │
  59. * │ ┌ ─── ─┴─ ─── ┐ │
  60. * │ │ offline │ │
  61. * │ └ ─── ─┬─ ─── ┘ │
  62. * │ │ │
  63. * ├─────────setCamera────────▶│ │
  64. * │ ├───────────get tiles───────────▶│
  65. * │ │ │
  66. * │ │┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
  67. * │◀─────────MapIdle──────────┤ waiting for connectivity │ │
  68. * │ ││ Map renders cached data │
  69. * │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ │
  70. * │ │ │
  71. * ```
  72. */
  73. NS_SWIFT_NAME(MapEvents)
  74. __attribute__((visibility ("default")))
  75. @interface MBMMapEvents : NSObject
  76. /**
  77. * The style has been fully loaded, and the `map` has rendered all visible tiles.
  78. *
  79. * ``` text
  80. * Event data format (Object).
  81. * ```
  82. */
  83. @property (nonatomic, class, readonly) NSString * MapLoaded;
  84. /**
  85. * Describes an error that has occurred while loading the Map. The `type` property defines what resource could
  86. * not be loaded and the `message` property will contain a descriptive error message.
  87. * In case of `source` or `tile` loading errors, `source-id` will contain the id of the source failing.
  88. * In case of `tile` loading errors, `tile-id` will contain the id of the tile
  89. *
  90. * ``` text
  91. * Event data format (Object):
  92. * .
  93. * ├── type - String ("style" | "sprite" | "source" | "tile" | "glyphs")
  94. * ├── message - String
  95. * ├── source-id - optional String
  96. * └── tile-id - optional Object
  97. * ├── z Number (zoom level)
  98. * ├── x Number (x coordinate)
  99. * └── y Number (y coordinate)
  100. * ```
  101. */
  102. @property (nonatomic, class, readonly) NSString * MapLoadingError;
  103. /**
  104. * The `map` has entered the idle state. The `map` is in the idle state when there are no ongoing transitions
  105. * and the `map` has rendered all requested non-volatile tiles. The event will not be emitted if `setUserAnimationInProgress`
  106. * and / or `setGestureInProgress` is set to `true`.
  107. *
  108. * ``` text
  109. * Event data format (Object).
  110. * ```
  111. */
  112. @property (nonatomic, class, readonly) NSString * MapIdle;
  113. /**
  114. * The requested style data has been loaded. The `type` property defines what kind of style data has been loaded.
  115. * Event may be emitted synchronously, for example, when `setStyleJSON` is used to load style.
  116. *
  117. * Based on an event data `type` property value, following use-cases may be implemented:
  118. * - `style`: Style is parsed, style layer properties could be read and modified, style layers and sources could be
  119. * added or removed before rendering is started.
  120. * - `sprite`: Style's sprite sheet is parsed and it is possible to add or update images.
  121. * - `sources`: All sources defined by the style are loaded and their properties could be read and updated if needed.
  122. *
  123. * ``` text
  124. * Event data format (Object):
  125. * .
  126. * └── type - String ("style" | "sprite" | "sources")
  127. * ```
  128. */
  129. @property (nonatomic, class, readonly) NSString * StyleDataLoaded;
  130. /**
  131. * The requested style has been fully loaded, including the style, specified sprite and sources' metadata.
  132. *
  133. * ``` text
  134. * Event data format (Object).
  135. * ```
  136. *
  137. * Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via `MapLoadingError`).
  138. * Sprite loading error is not fatal and we don't want it to block the map rendering, thus this event will still be emitted if style and sources are fully loaded.
  139. *
  140. */
  141. @property (nonatomic, class, readonly) NSString * StyleLoaded;
  142. /**
  143. * A style has a missing image. This event is emitted when the `map` renders visible tiles and
  144. * one of the required images is missing in the sprite sheet. Subscriber has to provide the missing image
  145. * by calling `addStyleImage` method.
  146. *
  147. * ``` text
  148. * Event data format (Object):
  149. * .
  150. * └── id - String
  151. * ```
  152. */
  153. @property (nonatomic, class, readonly) NSString * StyleImageMissing;
  154. /**
  155. * An image added to the style is no longer needed and can be removed using `removeStyleImage` method.
  156. *
  157. * ``` text
  158. * Event data format (Object):
  159. * .
  160. * └── id - String
  161. * ```
  162. */
  163. @property (nonatomic, class, readonly) NSString * StyleImageRemoveUnused;
  164. /**
  165. * A source data has been loaded.
  166. * Event may be emitted synchronously in cases when source's metadata is available when source is added to the style.
  167. *
  168. * The `id` property defines the source id.
  169. *
  170. * The `type` property defines if source's metadata (e.g., TileJSON) or tile has been loaded. The property of `metadata`
  171. * value might be useful to identify when particular source's metadata is loaded, thus all source's properties are
  172. * readable and can be updated before `map` will start requesting data to be rendered.
  173. *
  174. * The `loaded` property will be set to `true` if all source's data required for visible viewport of the `map`, are loaded.
  175. * The `tile-id` property defines the tile id if the `type` field equals `tile`.
  176. *
  177. * ``` text
  178. * Event data format (Object):
  179. * .
  180. * ├── id - String
  181. * ├── type - String ("metadata" | "tile")
  182. * ├── loaded - optional Boolean
  183. * └── tile-id - optional Object
  184. * ├── z Number (zoom level)
  185. * ├── x Number (x coordinate)
  186. * └── y Number (y coordinate)
  187. * ```
  188. */
  189. @property (nonatomic, class, readonly) NSString * SourceDataLoaded;
  190. /**
  191. * The source has been added with `addStyleSource` method.
  192. * The event is emitted synchronously, therefore, it is possible to immediately
  193. * read added source's properties.
  194. *
  195. * ``` text
  196. * Event data format (Object):
  197. * .
  198. * └── id - String
  199. * ```
  200. */
  201. @property (nonatomic, class, readonly) NSString * SourceAdded;
  202. /**
  203. * The source has been removed with `removeStyleSource` method.
  204. * The event is emitted synchronously, thus, `getStyleSources` will be
  205. * in sync when the `observer` receives the notification.
  206. *
  207. * ``` text
  208. * Event data format (Object):
  209. * .
  210. * └── id - String
  211. * ```
  212. */
  213. @property (nonatomic, class, readonly) NSString * SourceRemoved;
  214. /**
  215. * The `map` started rendering a frame.
  216. *
  217. * Event data format (Object).
  218. */
  219. @property (nonatomic, class, readonly) NSString * RenderFrameStarted;
  220. /**
  221. * The `map` finished rendering a frame.
  222. * The `render-mode` property tells whether the `map` has all data (`full`) required to render the visible viewport.
  223. * The `needs-repaint` property provides information about ongoing transitions that trigger `map` repaint.
  224. * The `placement-changed` property tells if the symbol placement has been changed in the visible viewport.
  225. *
  226. * ``` text
  227. * Event data format (Object):
  228. * .
  229. * ├── render-mode - String ("partial" | "full")
  230. * ├── needs-repaint - Boolean
  231. * └── placement-changed - Boolean
  232. * ```
  233. */
  234. @property (nonatomic, class, readonly) NSString * RenderFrameFinished;
  235. /**
  236. * The camera has changed. This event is emitted whenever the visible viewport
  237. * changes due to the invocation of `setSize`, `setBounds` methods or when the camera
  238. * is modified by calling camera methods. The event is emitted synchronously,
  239. * so that an updated camera state can be fetched immediately.
  240. *
  241. * ``` text
  242. * Event data format (Object).
  243. * ```
  244. */
  245. @property (nonatomic, class, readonly) NSString * CameraChanged;
  246. /**
  247. * The `ResourceRequest` event allows client to observe resource requests made by a
  248. * `map` or `map snapshotter` objects.
  249. *
  250. * ``` text
  251. * Event data format (Object):
  252. * .
  253. * ├── data-source - String ("resource-loader" | "network" | "database" | "asset" | "file-system")
  254. * ├── request - Object
  255. * │ ├── url - String
  256. * │ ├── kind - String ("unknown" | "style" | "source" | "tile" | "glyphs" | "sprite-image" | "sprite-json" | "image")
  257. * │ ├── priority - String ("regular" | "low")
  258. * │ └── loading-method - Array ["cache" | "network"]
  259. * ├── response - optional Object
  260. * │ ├── no-content - Boolean
  261. * │ ├── not-modified - Boolean
  262. * │ ├── must-revalidate - Boolean
  263. * │ ├── source - String ("network" | "cache" | "tile-store" | "local-file")
  264. * │ ├── size - Number (size in bytes)
  265. * │ ├── modified - optional String, rfc1123 timestamp
  266. * │ ├── expires - optional String, rfc1123 timestamp
  267. * │ ├── etag - optional String
  268. * │ └── error - optional Object
  269. * │ ├── reason - String ("success" | "not-found" | "server" | "connection" | "rate-limit" | "in-offline-mode" | "other")
  270. * │ └── message - String
  271. * └── cancelled - Boolean
  272. * ```
  273. */
  274. @property (nonatomic, class, readonly) NSString * ResourceRequest;
  275. @end