MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
map.h
Go to the documentation of this file.
1
6
7#ifndef MAPLIBRE_NATIVE_C_MAP_H
8#define MAPLIBRE_NATIVE_C_MAP_H
9
10#ifndef __cplusplus
11#include <stdbool.h>
12#endif
13
14#include <stddef.h>
15#include <stdint.h>
16
17#include "base.h"
18#include "runtime.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25typedef enum mln_camera_option_field : uint32_t {
26 MLN_CAMERA_OPTION_CENTER = 1U << 0U,
27 MLN_CAMERA_OPTION_ZOOM = 1U << 1U,
28 MLN_CAMERA_OPTION_BEARING = 1U << 2U,
29 MLN_CAMERA_OPTION_PITCH = 1U << 3U,
30 MLN_CAMERA_OPTION_CENTER_ALTITUDE = 1U << 4U,
31 MLN_CAMERA_OPTION_PADDING = 1U << 5U,
32 MLN_CAMERA_OPTION_ANCHOR = 1U << 6U,
33 MLN_CAMERA_OPTION_ROLL = 1U << 7U,
34 MLN_CAMERA_OPTION_FOV = 1U << 8U,
36
38typedef enum mln_animation_option_field : uint32_t {
39 MLN_ANIMATION_OPTION_DURATION = 1U << 0U,
40 MLN_ANIMATION_OPTION_VELOCITY = 1U << 1U,
41 MLN_ANIMATION_OPTION_MIN_ZOOM = 1U << 2U,
42 MLN_ANIMATION_OPTION_EASING = 1U << 3U,
43 MLN_ANIMATION_OPTION_TRANSITION_ID = 1U << 4U,
45
47typedef enum mln_camera_fit_option_field : uint32_t {
48 MLN_CAMERA_FIT_OPTION_PADDING = 1U << 0U,
49 MLN_CAMERA_FIT_OPTION_BEARING = 1U << 1U,
50 MLN_CAMERA_FIT_OPTION_PITCH = 1U << 2U,
52
54typedef enum mln_bound_option_field : uint32_t {
61 MLN_BOUND_OPTION_MIN_ZOOM = 1U << 1U,
62 MLN_BOUND_OPTION_MAX_ZOOM = 1U << 2U,
63 MLN_BOUND_OPTION_MIN_PITCH = 1U << 3U,
64 MLN_BOUND_OPTION_MAX_PITCH = 1U << 4U,
74
76typedef enum mln_free_camera_option_field : uint32_t {
77 MLN_FREE_CAMERA_OPTION_POSITION = 1U << 0U,
78 MLN_FREE_CAMERA_OPTION_ORIENTATION = 1U << 1U,
80
82typedef enum mln_projection_mode_field : uint32_t {
83 MLN_PROJECTION_MODE_AXONOMETRIC = 1U << 0U,
84 MLN_PROJECTION_MODE_X_SKEW = 1U << 1U,
85 MLN_PROJECTION_MODE_Y_SKEW = 1U << 2U,
87
89typedef enum mln_map_debug_option : uint32_t {
90 MLN_MAP_DEBUG_TILE_BORDERS = 1U << 1U,
91 MLN_MAP_DEBUG_PARSE_STATUS = 1U << 2U,
92 MLN_MAP_DEBUG_TIMESTAMPS = 1U << 3U,
93 MLN_MAP_DEBUG_COLLISION = 1U << 4U,
94 MLN_MAP_DEBUG_OVERDRAW = 1U << 5U,
95 MLN_MAP_DEBUG_STENCIL_CLIP = 1U << 6U,
96 MLN_MAP_DEBUG_DEPTH_BUFFER = 1U << 7U,
98
100typedef enum mln_north_orientation : uint32_t {
101 MLN_NORTH_ORIENTATION_UP = 0,
102 MLN_NORTH_ORIENTATION_RIGHT = 1,
103 MLN_NORTH_ORIENTATION_DOWN = 2,
104 MLN_NORTH_ORIENTATION_LEFT = 3,
106
108typedef enum mln_constrain_mode : uint32_t {
109 MLN_CONSTRAIN_MODE_NONE = 0,
110 MLN_CONSTRAIN_MODE_HEIGHT_ONLY = 1,
111 MLN_CONSTRAIN_MODE_WIDTH_AND_HEIGHT = 2,
112 MLN_CONSTRAIN_MODE_SCREEN = 3,
114
116typedef enum mln_viewport_mode : uint32_t {
117 MLN_VIEWPORT_MODE_DEFAULT = 0,
118 MLN_VIEWPORT_MODE_FLIPPED_Y = 1,
120
122typedef enum mln_map_viewport_option_field : uint32_t {
123 MLN_MAP_VIEWPORT_OPTION_NORTH_ORIENTATION = 1U << 0U,
124 MLN_MAP_VIEWPORT_OPTION_CONSTRAIN_MODE = 1U << 1U,
125 MLN_MAP_VIEWPORT_OPTION_VIEWPORT_MODE = 1U << 2U,
126 MLN_MAP_VIEWPORT_OPTION_FRUSTUM_OFFSET = 1U << 3U,
128
130typedef enum mln_tile_lod_mode : uint32_t {
131 MLN_TILE_LOD_MODE_DEFAULT = 0,
132 MLN_TILE_LOD_MODE_DISTANCE = 1,
134
136typedef enum mln_map_tile_option_field : uint32_t {
137 MLN_MAP_TILE_OPTION_PREFETCH_ZOOM_DELTA = 1U << 0U,
138 MLN_MAP_TILE_OPTION_LOD_MIN_RADIUS = 1U << 1U,
139 MLN_MAP_TILE_OPTION_LOD_SCALE = 1U << 2U,
140 MLN_MAP_TILE_OPTION_LOD_PITCH_THRESHOLD = 1U << 3U,
141 MLN_MAP_TILE_OPTION_LOD_ZOOM_SHIFT = 1U << 4U,
142 MLN_MAP_TILE_OPTION_LOD_MODE = 1U << 5U,
144
154
156typedef struct mln_map_options {
157 uint32_t size;
167 uint32_t width;
169 uint32_t height;
182 uint32_t map_mode;
206 uint64_t event_mask;
208
210typedef struct mln_screen_point {
211 double x;
212 double y;
214
216typedef struct mln_edge_insets {
217 double top;
218 double left;
219 double bottom;
220 double right;
222
224typedef struct mln_camera_options {
225 uint32_t size;
226 uint32_t fields;
227 double latitude;
228 double longitude;
229 double center_altitude;
230 mln_edge_insets padding;
240 double zoom;
241 double bearing;
242 double pitch;
243 double roll;
244 double field_of_view;
246
248typedef struct mln_unit_bezier {
249 double x1;
250 double y1;
251 double x2;
252 double y2;
254
256typedef struct mln_animation_options {
257 uint32_t size;
258 uint32_t fields;
272 double velocity;
274 double min_zoom;
275 mln_unit_bezier easing;
306
309 uint32_t size;
310 uint32_t fields;
311 mln_edge_insets padding;
312 double bearing;
313 double pitch;
315
317typedef struct mln_vec3 {
318 double x;
319 double y;
320 double z;
322
324typedef struct mln_quaternion {
325 double x;
326 double y;
327 double z;
328 double w;
330
333 uint32_t size;
334 uint32_t fields;
335 mln_vec3 position;
336 mln_quaternion orientation;
338
340typedef struct mln_lat_lng {
343 double latitude;
345 double longitude;
347
349typedef enum mln_feature_state_selector_field : uint32_t {
350 MLN_FEATURE_STATE_SELECTOR_SOURCE_LAYER_ID = 1U << 0U,
351 MLN_FEATURE_STATE_SELECTOR_FEATURE_ID = 1U << 1U,
352 MLN_FEATURE_STATE_SELECTOR_STATE_KEY = 1U << 2U,
354
369
371typedef struct mln_lat_lng_bounds {
372 mln_lat_lng southwest;
373 mln_lat_lng northeast;
375
377typedef struct mln_bound_options {
378 uint32_t size;
379 uint32_t fields;
382 double min_zoom;
383 double max_zoom;
384 double min_pitch;
385 double max_pitch;
387
390 uint32_t size;
392 const char* style_url;
393 mln_lat_lng_bounds bounds;
394 double min_zoom;
399 double max_zoom;
400 float pixel_ratio;
401 bool include_ideographs;
403
406 uint32_t size;
408 const char* style_url;
411 double min_zoom;
416 double max_zoom;
417 float pixel_ratio;
418 bool include_ideographs;
420
423 uint32_t size;
425 uint32_t type;
426 union {
429 } data;
431
434 uint32_t size;
435 mln_offline_region_id id;
439 const uint8_t* metadata;
440 size_t metadata_size;
442
461 mln_runtime runtime, const mln_offline_region_definition* definition,
462 const uint8_t* metadata, size_t metadata_size,
463 mln_offline_operation_id* out_operation_id
464) MLN_NOEXCEPT;
465
482 mln_runtime runtime, mln_offline_region_id region_id,
483 mln_offline_operation_id* out_operation_id
484) MLN_NOEXCEPT;
485
498 mln_runtime runtime, mln_offline_operation_id* out_operation_id
499) MLN_NOEXCEPT;
500
527 mln_runtime runtime, const char* side_database_path,
528 mln_offline_operation_id* out_operation_id
529) MLN_NOEXCEPT;
530
546 mln_runtime runtime, mln_offline_region_id region_id, const uint8_t* metadata,
547 size_t metadata_size, mln_offline_operation_id* out_operation_id
548) MLN_NOEXCEPT;
549
562 mln_runtime runtime, mln_offline_region_id region_id,
563 mln_offline_operation_id* out_operation_id
564) MLN_NOEXCEPT;
565
583 mln_runtime runtime, mln_offline_region_id region_id, bool observed,
584 mln_offline_operation_id* out_operation_id
585) MLN_NOEXCEPT;
586
605 mln_runtime runtime, mln_offline_region_id region_id, uint32_t state,
606 mln_offline_operation_id* out_operation_id
607) MLN_NOEXCEPT;
608
623 mln_runtime runtime, mln_offline_region_id region_id,
624 mln_offline_operation_id* out_operation_id
625) MLN_NOEXCEPT;
626
641 mln_runtime runtime, mln_offline_region_id region_id,
642 mln_offline_operation_id* out_operation_id
643) MLN_NOEXCEPT;
644
668 mln_runtime runtime, mln_offline_operation_id operation_id,
669 mln_offline_region_snapshot* out_region
670) MLN_NOEXCEPT;
671
695 mln_runtime runtime, mln_offline_operation_id operation_id,
696 mln_offline_region_snapshot* out_region, bool* out_found
697) MLN_NOEXCEPT;
698
721 mln_runtime runtime, mln_offline_operation_id operation_id,
722 mln_offline_region_list* out_regions
723) MLN_NOEXCEPT;
724
747 mln_runtime runtime, mln_offline_operation_id operation_id,
748 mln_offline_region_list* out_regions
749) MLN_NOEXCEPT;
750
774 mln_runtime runtime, mln_offline_operation_id operation_id,
775 mln_offline_region_snapshot* out_region
776) MLN_NOEXCEPT;
777
800 mln_runtime runtime, mln_offline_operation_id operation_id,
801 mln_offline_region_status* out_status
802) MLN_NOEXCEPT;
803
817 mln_offline_region_snapshot snapshot, mln_offline_region_info* out_info
818) MLN_NOEXCEPT;
819
822 mln_offline_region_snapshot snapshot
823) MLN_NOEXCEPT;
824
835 mln_offline_region_list list, size_t* out_count
836) MLN_NOEXCEPT;
837
851 mln_offline_region_list list, size_t index, mln_offline_region_info* out_info
852) MLN_NOEXCEPT;
853
856 mln_offline_region_list list
857) MLN_NOEXCEPT;
858
871
878typedef struct mln_projection_mode {
879 uint32_t size;
880 uint32_t fields;
884 double x_skew;
886 double y_skew;
888
891 uint32_t size;
892 uint32_t fields;
899 mln_edge_insets frustum_offset;
901
903typedef struct mln_map_tile_options {
904 uint32_t size;
905 uint32_t fields;
908 double lod_min_radius;
909 double lod_scale;
910 double lod_pitch_threshold;
911 double lod_zoom_shift;
913 uint32_t lod_mode;
915
919MLN_API mln_map_options mln_map_options_default(void) MLN_NOEXCEPT;
920
936 mln_runtime runtime, const mln_map_options* options, mln_map* out_map
937) MLN_NOEXCEPT;
938
959 mln_map map, uint32_t* out_width, uint32_t* out_height,
960 double* out_scale_factor
961) MLN_NOEXCEPT;
962
986MLN_API mln_status mln_map_request_repaint(mln_map map) MLN_NOEXCEPT;
987
1010 mln_map map, const mln_feature_state_selector* selector, mln_buffer_view state
1011) MLN_NOEXCEPT;
1012
1032 mln_map map, const mln_feature_state_selector* selector, mln_buffer* out_state
1033) MLN_NOEXCEPT;
1034
1054 mln_map map, const mln_feature_state_selector* selector
1055) MLN_NOEXCEPT;
1056
1082MLN_API mln_status mln_map_request_still_image(mln_map map) MLN_NOEXCEPT;
1083
1105MLN_API mln_status mln_map_destroy(mln_map map) MLN_NOEXCEPT;
1106
1125MLN_API mln_status
1126mln_map_set_style_url(mln_map map, const char* url) MLN_NOEXCEPT;
1127
1145MLN_API mln_status
1146mln_map_set_style_json(mln_map map, mln_buffer_view json) MLN_NOEXCEPT;
1147
1182 mln_map map, uint8_t* out_json, size_t json_capacity, size_t* out_json_size
1183) MLN_NOEXCEPT;
1184
1215 mln_map map, char* out_url, size_t url_capacity, size_t* out_url_size
1216) MLN_NOEXCEPT;
1217
1266MLN_API mln_status
1267mln_map_set_event_mask(mln_map map, uint64_t mask) MLN_NOEXCEPT;
1268
1285MLN_API mln_status
1286mln_map_get_event_mask(mln_map map, uint64_t* out_mask) MLN_NOEXCEPT;
1287
1288#ifdef __cplusplus
1289}
1290#endif
1291
1292#endif // MAPLIBRE_NATIVE_C_MAP_H
uint64_t mln_runtime
Definition base.h:86
mln_status
Definition base.h:39
mln_status mln_runtime_offline_region_set_download_state_start(mln_runtime runtime, mln_offline_region_id region_id, uint32_t state, mln_offline_operation_id *out_operation_id)
mln_map_mode
Definition map.h:146
@ MLN_MAP_MODE_STATIC
Definition map.h:150
@ MLN_MAP_MODE_TILE
Definition map.h:152
@ MLN_MAP_MODE_CONTINUOUS
Definition map.h:148
mln_status mln_runtime_offline_region_get_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_snapshot *out_region, bool *out_found)
mln_status mln_runtime_offline_regions_list_start(mln_runtime runtime, mln_offline_operation_id *out_operation_id)
void mln_offline_region_list_destroy(mln_offline_region_list list)
mln_status mln_offline_region_list_get(mln_offline_region_list list, size_t index, mln_offline_region_info *out_info)
mln_status mln_map_request_repaint(mln_map map)
mln_map_options mln_map_options_default(void)
mln_status mln_map_set_feature_state(mln_map map, const mln_feature_state_selector *selector, mln_buffer_view state)
mln_feature_state_selector_field
Definition map.h:349
mln_status mln_map_get_size(mln_map map, uint32_t *out_width, uint32_t *out_height, double *out_scale_factor)
mln_status mln_runtime_offline_regions_merge_database_start(mln_runtime runtime, const char *side_database_path, mln_offline_operation_id *out_operation_id)
mln_status mln_runtime_offline_regions_list_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_list *out_regions)
mln_status mln_offline_region_snapshot_get(mln_offline_region_snapshot snapshot, mln_offline_region_info *out_info)
mln_camera_option_field
Definition map.h:25
mln_viewport_mode
Definition map.h:116
mln_projection_mode_field
Definition map.h:82
mln_status mln_map_request_still_image(mln_map map)
mln_status mln_map_get_feature_state(mln_map map, const mln_feature_state_selector *selector, mln_buffer *out_state)
mln_status mln_runtime_offline_region_set_observed_start(mln_runtime runtime, mln_offline_region_id region_id, bool observed, mln_offline_operation_id *out_operation_id)
mln_camera_fit_option_field
Definition map.h:47
mln_status mln_runtime_offline_region_update_metadata_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_snapshot *out_region)
mln_status mln_runtime_offline_region_create_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_snapshot *out_region)
mln_tile_lod_mode
Definition map.h:130
mln_status mln_runtime_offline_region_update_metadata_start(mln_runtime runtime, mln_offline_region_id region_id, const uint8_t *metadata, size_t metadata_size, mln_offline_operation_id *out_operation_id)
mln_status mln_map_set_style_json(mln_map map, mln_buffer_view json)
mln_status mln_runtime_offline_region_get_start(mln_runtime runtime, mln_offline_region_id region_id, mln_offline_operation_id *out_operation_id)
mln_status mln_map_set_style_url(mln_map map, const char *url)
mln_status mln_map_copy_loaded_style_json(mln_map map, uint8_t *out_json, size_t json_capacity, size_t *out_json_size)
mln_status mln_map_copy_style_url(mln_map map, char *out_url, size_t url_capacity, size_t *out_url_size)
mln_status mln_runtime_offline_regions_merge_database_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_list *out_regions)
mln_status mln_map_get_event_mask(mln_map map, uint64_t *out_mask)
mln_status mln_map_destroy(mln_map map)
mln_status mln_offline_region_list_count(mln_offline_region_list list, size_t *out_count)
mln_status mln_map_create(mln_runtime runtime, const mln_map_options *options, mln_map *out_map)
mln_bound_option_field
Definition map.h:54
@ MLN_BOUND_OPTION_UNBOUNDED
Definition map.h:72
@ MLN_BOUND_OPTION_BOUNDS
Definition map.h:60
mln_status mln_runtime_offline_region_delete_start(mln_runtime runtime, mln_offline_region_id region_id, mln_offline_operation_id *out_operation_id)
mln_status mln_runtime_offline_region_get_status_start(mln_runtime runtime, mln_offline_region_id region_id, mln_offline_operation_id *out_operation_id)
mln_status mln_map_remove_feature_state(mln_map map, const mln_feature_state_selector *selector)
void mln_offline_region_snapshot_destroy(mln_offline_region_snapshot snapshot)
mln_map_viewport_option_field
Definition map.h:122
mln_animation_option_field
Definition map.h:38
mln_constrain_mode
Definition map.h:108
mln_map_tile_option_field
Definition map.h:136
mln_status mln_runtime_offline_region_get_status_take_result(mln_runtime runtime, mln_offline_operation_id operation_id, mln_offline_region_status *out_status)
mln_status mln_runtime_offline_region_invalidate_start(mln_runtime runtime, mln_offline_region_id region_id, mln_offline_operation_id *out_operation_id)
mln_map_debug_option
Definition map.h:89
mln_status mln_runtime_offline_region_create_start(mln_runtime runtime, const mln_offline_region_definition *definition, const uint8_t *metadata, size_t metadata_size, mln_offline_operation_id *out_operation_id)
mln_north_orientation
Definition map.h:100
mln_status mln_map_set_event_mask(mln_map map, uint64_t mask)
mln_free_camera_option_field
Definition map.h:76
uint64_t mln_offline_operation_id
Definition runtime.h:47
Definition map.h:256
double duration_ms
Definition map.h:267
double velocity
Definition map.h:272
double min_zoom
Definition map.h:274
uint64_t transition_id
Definition map.h:304
Definition map.h:377
mln_lat_lng_bounds bounds
Definition map.h:381
Definition base.h:103
Definition map.h:308
Definition map.h:224
mln_screen_point anchor
Definition map.h:239
Definition map.h:216
Definition map.h:356
mln_buffer_view source_id
Definition map.h:360
mln_buffer_view state_key
Definition map.h:367
mln_buffer_view source_layer_id
Definition map.h:362
mln_buffer_view feature_id
Definition map.h:365
Definition map.h:332
Definition map.h:371
Definition map.h:340
double longitude
Definition map.h:345
double latitude
Definition map.h:343
Definition map.h:156
uint32_t height
Definition map.h:169
uint32_t map_mode
Definition map.h:182
double scale_factor
Definition map.h:180
bool fast_pfor_enabled
Definition map.h:193
uint32_t width
Definition map.h:167
uint64_t event_mask
Definition map.h:206
Definition map.h:903
uint32_t lod_mode
Definition map.h:913
uint32_t prefetch_zoom_delta
Definition map.h:907
Definition map.h:890
uint32_t viewport_mode
Definition map.h:898
uint32_t north_orientation
Definition map.h:894
uint32_t constrain_mode
Definition map.h:896
mln_buffer_view geometry
Definition map.h:410
const char * style_url
Definition map.h:408
double max_zoom
Definition map.h:416
Definition map.h:422
uint32_t type
Definition map.h:425
Definition map.h:433
const uint8_t * metadata
Definition map.h:439
Definition runtime.h:75
const char * style_url
Definition map.h:392
double max_zoom
Definition map.h:399
Definition map.h:865
double northing
Definition map.h:867
double easting
Definition map.h:869
Definition map.h:878
double x_skew
Definition map.h:884
bool axonometric
Definition map.h:882
double y_skew
Definition map.h:886
Definition map.h:324
Definition map.h:210
Definition map.h:248
Definition map.h:317