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;
305
308 uint32_t size;
309 uint32_t fields;
310 mln_edge_insets padding;
311 double bearing;
312 double pitch;
314
316typedef struct mln_vec3 {
317 double x;
318 double y;
319 double z;
321
323typedef struct mln_quaternion {
324 double x;
325 double y;
326 double z;
327 double w;
329
332 uint32_t size;
333 uint32_t fields;
334 mln_vec3 position;
335 mln_quaternion orientation;
337
339typedef struct mln_lat_lng {
342 double latitude;
344 double longitude;
346
348typedef enum mln_feature_state_selector_field : uint32_t {
349 MLN_FEATURE_STATE_SELECTOR_SOURCE_LAYER_ID = 1U << 0U,
350 MLN_FEATURE_STATE_SELECTOR_FEATURE_ID = 1U << 1U,
351 MLN_FEATURE_STATE_SELECTOR_STATE_KEY = 1U << 2U,
353
368
370typedef struct mln_lat_lng_bounds {
371 mln_lat_lng southwest;
372 mln_lat_lng northeast;
374
376typedef struct mln_bound_options {
377 uint32_t size;
378 uint32_t fields;
381 double min_zoom;
382 double max_zoom;
383 double min_pitch;
384 double max_pitch;
386
389 uint32_t size;
391 const char* style_url;
392 mln_lat_lng_bounds bounds;
393 double min_zoom;
398 double max_zoom;
399 float pixel_ratio;
400 bool include_ideographs;
402
405 uint32_t size;
407 const char* style_url;
410 double min_zoom;
415 double max_zoom;
416 float pixel_ratio;
417 bool include_ideographs;
419
422 uint32_t size;
424 uint32_t type;
425 union {
428 } data;
430
433 uint32_t size;
434 mln_offline_region_id id;
438 const uint8_t* metadata;
439 size_t metadata_size;
441
460 mln_runtime runtime, const mln_offline_region_definition* definition,
461 const uint8_t* metadata, size_t metadata_size,
462 mln_offline_operation_id* out_operation_id
463) MLN_NOEXCEPT;
464
481 mln_runtime runtime, mln_offline_region_id region_id,
482 mln_offline_operation_id* out_operation_id
483) MLN_NOEXCEPT;
484
497 mln_runtime runtime, mln_offline_operation_id* out_operation_id
498) MLN_NOEXCEPT;
499
515 mln_runtime runtime, const char* side_database_path,
516 mln_offline_operation_id* out_operation_id
517) MLN_NOEXCEPT;
518
534 mln_runtime runtime, mln_offline_region_id region_id, const uint8_t* metadata,
535 size_t metadata_size, mln_offline_operation_id* out_operation_id
536) MLN_NOEXCEPT;
537
550 mln_runtime runtime, mln_offline_region_id region_id,
551 mln_offline_operation_id* out_operation_id
552) MLN_NOEXCEPT;
553
571 mln_runtime runtime, mln_offline_region_id region_id, bool observed,
572 mln_offline_operation_id* out_operation_id
573) MLN_NOEXCEPT;
574
593 mln_runtime runtime, mln_offline_region_id region_id, uint32_t state,
594 mln_offline_operation_id* out_operation_id
595) MLN_NOEXCEPT;
596
611 mln_runtime runtime, mln_offline_region_id region_id,
612 mln_offline_operation_id* out_operation_id
613) MLN_NOEXCEPT;
614
629 mln_runtime runtime, mln_offline_region_id region_id,
630 mln_offline_operation_id* out_operation_id
631) MLN_NOEXCEPT;
632
656 mln_runtime runtime, mln_offline_operation_id operation_id,
657 mln_offline_region_snapshot* out_region
658) MLN_NOEXCEPT;
659
683 mln_runtime runtime, mln_offline_operation_id operation_id,
684 mln_offline_region_snapshot* out_region, bool* out_found
685) MLN_NOEXCEPT;
686
709 mln_runtime runtime, mln_offline_operation_id operation_id,
710 mln_offline_region_list* out_regions
711) MLN_NOEXCEPT;
712
735 mln_runtime runtime, mln_offline_operation_id operation_id,
736 mln_offline_region_list* out_regions
737) MLN_NOEXCEPT;
738
762 mln_runtime runtime, mln_offline_operation_id operation_id,
763 mln_offline_region_snapshot* out_region
764) MLN_NOEXCEPT;
765
788 mln_runtime runtime, mln_offline_operation_id operation_id,
789 mln_offline_region_status* out_status
790) MLN_NOEXCEPT;
791
805 mln_offline_region_snapshot snapshot, mln_offline_region_info* out_info
806) MLN_NOEXCEPT;
807
810 mln_offline_region_snapshot snapshot
811) MLN_NOEXCEPT;
812
823 mln_offline_region_list list, size_t* out_count
824) MLN_NOEXCEPT;
825
839 mln_offline_region_list list, size_t index, mln_offline_region_info* out_info
840) MLN_NOEXCEPT;
841
844 mln_offline_region_list list
845) MLN_NOEXCEPT;
846
859
866typedef struct mln_projection_mode {
867 uint32_t size;
868 uint32_t fields;
872 double x_skew;
874 double y_skew;
876
879 uint32_t size;
880 uint32_t fields;
887 mln_edge_insets frustum_offset;
889
891typedef struct mln_map_tile_options {
892 uint32_t size;
893 uint32_t fields;
896 double lod_min_radius;
897 double lod_scale;
898 double lod_pitch_threshold;
899 double lod_zoom_shift;
901 uint32_t lod_mode;
903
907MLN_API mln_map_options mln_map_options_default(void) MLN_NOEXCEPT;
908
924 mln_runtime runtime, const mln_map_options* options, mln_map* out_map
925) MLN_NOEXCEPT;
926
947 mln_map map, uint32_t* out_width, uint32_t* out_height,
948 double* out_scale_factor
949) MLN_NOEXCEPT;
950
971MLN_API mln_status mln_map_request_repaint(mln_map map) MLN_NOEXCEPT;
972
998MLN_API mln_status mln_map_request_still_image(mln_map map) MLN_NOEXCEPT;
999
1021MLN_API mln_status mln_map_destroy(mln_map map) MLN_NOEXCEPT;
1022
1041MLN_API mln_status
1042mln_map_set_style_url(mln_map map, const char* url) MLN_NOEXCEPT;
1043
1061MLN_API mln_status
1062mln_map_set_style_json(mln_map map, mln_buffer_view json) MLN_NOEXCEPT;
1063
1098 mln_map map, uint8_t* out_json, size_t json_capacity, size_t* out_json_size
1099) MLN_NOEXCEPT;
1100
1131 mln_map map, char* out_url, size_t url_capacity, size_t* out_url_size
1132) MLN_NOEXCEPT;
1133
1183MLN_API mln_status
1184mln_map_set_event_mask(mln_map map, uint64_t mask) MLN_NOEXCEPT;
1185
1202MLN_API mln_status
1203mln_map_get_event_mask(mln_map map, uint64_t* out_mask) MLN_NOEXCEPT;
1204
1205#ifdef __cplusplus
1206}
1207#endif
1208
1209#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_feature_state_selector_field
Definition map.h:348
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_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)
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:303
Definition map.h:376
mln_lat_lng_bounds bounds
Definition map.h:380
Definition base.h:103
Definition map.h:307
Definition map.h:224
mln_screen_point anchor
Definition map.h:239
Definition map.h:216
Definition map.h:355
mln_buffer_view source_id
Definition map.h:359
mln_buffer_view state_key
Definition map.h:366
mln_buffer_view source_layer_id
Definition map.h:361
mln_buffer_view feature_id
Definition map.h:364
Definition map.h:331
Definition map.h:370
Definition map.h:339
double longitude
Definition map.h:344
double latitude
Definition map.h:342
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:891
uint32_t lod_mode
Definition map.h:901
uint32_t prefetch_zoom_delta
Definition map.h:895
Definition map.h:878
uint32_t viewport_mode
Definition map.h:886
uint32_t north_orientation
Definition map.h:882
uint32_t constrain_mode
Definition map.h:884
mln_buffer_view geometry
Definition map.h:409
const char * style_url
Definition map.h:407
double max_zoom
Definition map.h:415
Definition map.h:421
uint32_t type
Definition map.h:424
Definition map.h:432
const uint8_t * metadata
Definition map.h:438
Definition runtime.h:75
const char * style_url
Definition map.h:391
double max_zoom
Definition map.h:398
Definition map.h:853
double northing
Definition map.h:855
double easting
Definition map.h:857
Definition map.h:866
double x_skew
Definition map.h:872
bool axonometric
Definition map.h:870
double y_skew
Definition map.h:874
Definition map.h:323
Definition map.h:210
Definition map.h:248
Definition map.h:316