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,
44
46typedef enum mln_camera_fit_option_field : uint32_t {
47 MLN_CAMERA_FIT_OPTION_PADDING = 1U << 0U,
48 MLN_CAMERA_FIT_OPTION_BEARING = 1U << 1U,
49 MLN_CAMERA_FIT_OPTION_PITCH = 1U << 2U,
51
53typedef enum mln_bound_option_field : uint32_t {
54 MLN_BOUND_OPTION_BOUNDS = 1U << 0U,
55 MLN_BOUND_OPTION_MIN_ZOOM = 1U << 1U,
56 MLN_BOUND_OPTION_MAX_ZOOM = 1U << 2U,
57 MLN_BOUND_OPTION_MIN_PITCH = 1U << 3U,
58 MLN_BOUND_OPTION_MAX_PITCH = 1U << 4U,
60
62typedef enum mln_free_camera_option_field : uint32_t {
63 MLN_FREE_CAMERA_OPTION_POSITION = 1U << 0U,
64 MLN_FREE_CAMERA_OPTION_ORIENTATION = 1U << 1U,
66
68typedef enum mln_projection_mode_field : uint32_t {
69 MLN_PROJECTION_MODE_AXONOMETRIC = 1U << 0U,
70 MLN_PROJECTION_MODE_X_SKEW = 1U << 1U,
71 MLN_PROJECTION_MODE_Y_SKEW = 1U << 2U,
73
75typedef enum mln_map_debug_option : uint32_t {
76 MLN_MAP_DEBUG_TILE_BORDERS = 1U << 1U,
77 MLN_MAP_DEBUG_PARSE_STATUS = 1U << 2U,
78 MLN_MAP_DEBUG_TIMESTAMPS = 1U << 3U,
79 MLN_MAP_DEBUG_COLLISION = 1U << 4U,
80 MLN_MAP_DEBUG_OVERDRAW = 1U << 5U,
81 MLN_MAP_DEBUG_STENCIL_CLIP = 1U << 6U,
82 MLN_MAP_DEBUG_DEPTH_BUFFER = 1U << 7U,
84
86typedef enum mln_north_orientation : uint32_t {
87 MLN_NORTH_ORIENTATION_UP = 0,
88 MLN_NORTH_ORIENTATION_RIGHT = 1,
89 MLN_NORTH_ORIENTATION_DOWN = 2,
90 MLN_NORTH_ORIENTATION_LEFT = 3,
92
94typedef enum mln_constrain_mode : uint32_t {
95 MLN_CONSTRAIN_MODE_NONE = 0,
96 MLN_CONSTRAIN_MODE_HEIGHT_ONLY = 1,
97 MLN_CONSTRAIN_MODE_WIDTH_AND_HEIGHT = 2,
98 MLN_CONSTRAIN_MODE_SCREEN = 3,
100
102typedef enum mln_viewport_mode : uint32_t {
103 MLN_VIEWPORT_MODE_DEFAULT = 0,
104 MLN_VIEWPORT_MODE_FLIPPED_Y = 1,
106
108typedef enum mln_map_viewport_option_field : uint32_t {
109 MLN_MAP_VIEWPORT_OPTION_NORTH_ORIENTATION = 1U << 0U,
110 MLN_MAP_VIEWPORT_OPTION_CONSTRAIN_MODE = 1U << 1U,
111 MLN_MAP_VIEWPORT_OPTION_VIEWPORT_MODE = 1U << 2U,
112 MLN_MAP_VIEWPORT_OPTION_FRUSTUM_OFFSET = 1U << 3U,
114
116typedef enum mln_tile_lod_mode : uint32_t {
117 MLN_TILE_LOD_MODE_DEFAULT = 0,
118 MLN_TILE_LOD_MODE_DISTANCE = 1,
120
122typedef enum mln_map_tile_option_field : uint32_t {
123 MLN_MAP_TILE_OPTION_PREFETCH_ZOOM_DELTA = 1U << 0U,
124 MLN_MAP_TILE_OPTION_LOD_MIN_RADIUS = 1U << 1U,
125 MLN_MAP_TILE_OPTION_LOD_SCALE = 1U << 2U,
126 MLN_MAP_TILE_OPTION_LOD_PITCH_THRESHOLD = 1U << 3U,
127 MLN_MAP_TILE_OPTION_LOD_ZOOM_SHIFT = 1U << 4U,
128 MLN_MAP_TILE_OPTION_LOD_MODE = 1U << 5U,
130
140
142typedef struct mln_map_options {
143 uint32_t size;
144 uint32_t width;
145 uint32_t height;
146 double scale_factor;
148 uint32_t map_mode;
150
152typedef struct mln_screen_point {
153 double x;
154 double y;
156
158typedef struct mln_edge_insets {
159 double top;
160 double left;
161 double bottom;
162 double right;
164
166typedef struct mln_camera_options {
167 uint32_t size;
168 uint32_t fields;
169 double latitude;
170 double longitude;
171 double center_altitude;
172 mln_edge_insets padding;
173 mln_screen_point anchor;
174 double zoom;
175 double bearing;
176 double pitch;
177 double roll;
178 double field_of_view;
180
182typedef struct mln_unit_bezier {
183 double x1;
184 double y1;
185 double x2;
186 double y2;
188
190typedef struct mln_animation_options {
191 uint32_t size;
192 uint32_t fields;
199 double velocity;
201 double min_zoom;
202 mln_unit_bezier easing;
204
207 uint32_t size;
208 uint32_t fields;
209 mln_edge_insets padding;
210 double bearing;
211 double pitch;
213
215typedef struct mln_vec3 {
216 double x;
217 double y;
218 double z;
219} mln_vec3;
220
222typedef struct mln_quaternion {
223 double x;
224 double y;
225 double z;
226 double w;
228
231 uint32_t size;
232 uint32_t fields;
233 mln_vec3 position;
234 mln_quaternion orientation;
236
238typedef struct mln_lat_lng {
241 double latitude;
243 double longitude;
245
247typedef struct mln_string_view {
249 const char* data;
250 size_t size;
252
253typedef struct mln_json_value mln_json_value;
254typedef struct mln_geometry mln_geometry;
255
257typedef enum mln_geometry_type : uint32_t {
258 MLN_GEOMETRY_TYPE_EMPTY = 0,
259 MLN_GEOMETRY_TYPE_POINT = 1,
260 MLN_GEOMETRY_TYPE_LINE_STRING = 2,
261 MLN_GEOMETRY_TYPE_POLYGON = 3,
262 MLN_GEOMETRY_TYPE_MULTI_POINT = 4,
263 MLN_GEOMETRY_TYPE_MULTI_LINE_STRING = 5,
264 MLN_GEOMETRY_TYPE_MULTI_POLYGON = 6,
265 MLN_GEOMETRY_TYPE_GEOMETRY_COLLECTION = 7,
267
269typedef struct mln_coordinate_span {
272 size_t coordinate_count;
274
276typedef struct mln_polygon_geometry {
279 size_t ring_count;
281
286 size_t line_count;
288
293 size_t polygon_count;
295
300 size_t geometry_count;
302
312typedef struct mln_geometry {
313 uint32_t size;
315 uint32_t type;
316 union {
317 mln_lat_lng point;
318 mln_coordinate_span line_string;
319 mln_polygon_geometry polygon;
320 mln_coordinate_span multi_point;
321 mln_multi_line_geometry multi_line_string;
322 mln_multi_polygon_geometry multi_polygon;
323 mln_geometry_collection geometry_collection;
324 } data;
326
328typedef enum mln_json_value_type : uint32_t {
329 MLN_JSON_VALUE_TYPE_NULL = 0,
330 MLN_JSON_VALUE_TYPE_BOOL = 1,
331 MLN_JSON_VALUE_TYPE_UINT = 2,
332 MLN_JSON_VALUE_TYPE_INT = 3,
333 MLN_JSON_VALUE_TYPE_DOUBLE = 4,
334 MLN_JSON_VALUE_TYPE_STRING = 5,
335 MLN_JSON_VALUE_TYPE_ARRAY = 6,
336 MLN_JSON_VALUE_TYPE_OBJECT = 7,
338
340typedef struct mln_json_array {
343 size_t value_count;
345
352
354typedef struct mln_json_object {
357 size_t member_count;
359
369typedef struct mln_json_value {
370 uint32_t size;
372 uint32_t type;
373 union {
374 bool bool_value;
375 uint64_t uint_value;
376 int64_t int_value;
377 double double_value;
378 mln_string_view string_value;
379 mln_json_array array_value;
380 mln_json_object object_value;
381 } data;
383
385typedef enum mln_feature_state_selector_field : uint32_t {
386 MLN_FEATURE_STATE_SELECTOR_SOURCE_LAYER_ID = 1U << 0U,
387 MLN_FEATURE_STATE_SELECTOR_FEATURE_ID = 1U << 1U,
388 MLN_FEATURE_STATE_SELECTOR_STATE_KEY = 1U << 2U,
390
405
407typedef enum mln_feature_identifier_type : uint32_t {
408 MLN_FEATURE_IDENTIFIER_TYPE_NULL = 0,
409 MLN_FEATURE_IDENTIFIER_TYPE_UINT = 1,
410 MLN_FEATURE_IDENTIFIER_TYPE_INT = 2,
411 MLN_FEATURE_IDENTIFIER_TYPE_DOUBLE = 3,
412 MLN_FEATURE_IDENTIFIER_TYPE_STRING = 4,
414
416typedef struct mln_feature {
417 uint32_t size;
425 size_t property_count;
428 union {
429 uint64_t uint_value;
430 int64_t int_value;
431 double double_value;
432 mln_string_view string_value;
433 } identifier;
435
437typedef enum mln_geojson_type : uint32_t {
438 MLN_GEOJSON_TYPE_GEOMETRY = 1,
439 MLN_GEOJSON_TYPE_FEATURE = 2,
440 MLN_GEOJSON_TYPE_FEATURE_COLLECTION = 3,
442
447 size_t feature_count;
449
455typedef struct mln_geojson {
456 uint32_t size;
458 uint32_t type;
459 union {
470 mln_feature_collection feature_collection;
471 } data;
473
475typedef struct mln_lat_lng_bounds {
476 mln_lat_lng southwest;
477 mln_lat_lng northeast;
479
481typedef struct mln_bound_options {
482 uint32_t size;
483 uint32_t fields;
484 mln_lat_lng_bounds bounds;
485 double min_zoom;
486 double max_zoom;
487 double min_pitch;
488 double max_pitch;
490
493 uint32_t size;
495 const char* style_url;
496 mln_lat_lng_bounds bounds;
497 double min_zoom;
502 double max_zoom;
503 float pixel_ratio;
504 bool include_ideographs;
506
509 uint32_t size;
511 const char* style_url;
514 double min_zoom;
519 double max_zoom;
520 float pixel_ratio;
521 bool include_ideographs;
523
526 uint32_t size;
528 uint32_t type;
529 union {
532 } data;
534
537 uint32_t size;
538 mln_offline_region_id id;
542 const uint8_t* metadata;
543 size_t metadata_size;
545
564 mln_runtime* runtime, const mln_offline_region_definition* definition,
565 const uint8_t* metadata, size_t metadata_size,
566 mln_offline_operation_id* out_operation_id
567) MLN_NOEXCEPT;
568
585 mln_runtime* runtime, mln_offline_region_id region_id,
586 mln_offline_operation_id* out_operation_id
587) MLN_NOEXCEPT;
588
601 mln_runtime* runtime, mln_offline_operation_id* out_operation_id
602) MLN_NOEXCEPT;
603
619 mln_runtime* runtime, const char* side_database_path,
620 mln_offline_operation_id* out_operation_id
621) MLN_NOEXCEPT;
622
638 mln_runtime* runtime, mln_offline_region_id region_id,
639 const uint8_t* metadata, size_t metadata_size,
640 mln_offline_operation_id* out_operation_id
641) MLN_NOEXCEPT;
642
655 mln_runtime* runtime, mln_offline_region_id region_id,
656 mln_offline_operation_id* out_operation_id
657) MLN_NOEXCEPT;
658
676 mln_runtime* runtime, mln_offline_region_id region_id, bool observed,
677 mln_offline_operation_id* out_operation_id
678) MLN_NOEXCEPT;
679
698 mln_runtime* runtime, mln_offline_region_id region_id, uint32_t state,
699 mln_offline_operation_id* out_operation_id
700) MLN_NOEXCEPT;
701
716 mln_runtime* runtime, mln_offline_region_id region_id,
717 mln_offline_operation_id* out_operation_id
718) MLN_NOEXCEPT;
719
734 mln_runtime* runtime, mln_offline_region_id region_id,
735 mln_offline_operation_id* out_operation_id
736) MLN_NOEXCEPT;
737
759 mln_runtime* runtime, mln_offline_operation_id operation_id,
760 mln_offline_region_snapshot** out_region
761) MLN_NOEXCEPT;
762
784 mln_runtime* runtime, mln_offline_operation_id operation_id,
785 mln_offline_region_snapshot** out_region, bool* out_found
786) MLN_NOEXCEPT;
787
808 mln_runtime* runtime, mln_offline_operation_id operation_id,
809 mln_offline_region_list** out_regions
810) MLN_NOEXCEPT;
811
832 mln_runtime* runtime, mln_offline_operation_id operation_id,
833 mln_offline_region_list** out_regions
834) MLN_NOEXCEPT;
835
857 mln_runtime* runtime, mln_offline_operation_id operation_id,
858 mln_offline_region_snapshot** out_region
859) MLN_NOEXCEPT;
860
881 mln_runtime* runtime, mln_offline_operation_id operation_id,
882 mln_offline_region_status* out_status
883) MLN_NOEXCEPT;
884
898 const mln_offline_region_snapshot* snapshot, mln_offline_region_info* out_info
899) MLN_NOEXCEPT;
900
903 mln_offline_region_snapshot* snapshot
904) MLN_NOEXCEPT;
905
916 const mln_offline_region_list* list, size_t* out_count
917) MLN_NOEXCEPT;
918
932 const mln_offline_region_list* list, size_t index,
934) MLN_NOEXCEPT;
935
938 mln_offline_region_list* list
939) MLN_NOEXCEPT;
940
953
960typedef struct mln_projection_mode {
961 uint32_t size;
962 uint32_t fields;
966 double x_skew;
968 double y_skew;
970
973 uint32_t size;
974 uint32_t fields;
981 mln_edge_insets frustum_offset;
983
985typedef struct mln_map_tile_options {
986 uint32_t size;
987 uint32_t fields;
990 double lod_min_radius;
991 double lod_scale;
992 double lod_pitch_threshold;
993 double lod_zoom_shift;
995 uint32_t lod_mode;
997
1001MLN_API mln_map_options mln_map_options_default(void) MLN_NOEXCEPT;
1002
1017 mln_runtime* runtime, const mln_map_options* options, mln_map** out_map
1018) MLN_NOEXCEPT;
1019
1038MLN_API mln_status mln_map_request_repaint(mln_map* map) MLN_NOEXCEPT;
1039
1063MLN_API mln_status mln_map_request_still_image(mln_map* map) MLN_NOEXCEPT;
1064
1079MLN_API mln_status mln_map_destroy(mln_map* map) MLN_NOEXCEPT;
1080
1096MLN_API mln_status
1097mln_map_set_style_url(mln_map* map, const char* url) MLN_NOEXCEPT;
1098
1115MLN_API mln_status
1116mln_map_set_style_json(mln_map* map, const char* json) MLN_NOEXCEPT;
1117
1118#ifdef __cplusplus
1119}
1120#endif
1121
1122#endif // MAPLIBRE_NATIVE_C_MAP_H
mln_status
Definition base.h:37
void mln_offline_region_list_destroy(mln_offline_region_list *list)
mln_geometry_type
Definition map.h:257
mln_status mln_offline_region_list_count(const mln_offline_region_list *list, size_t *out_count)
mln_geojson_type
Definition map.h:437
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:132
@ MLN_MAP_MODE_STATIC
Definition map.h:136
@ MLN_MAP_MODE_TILE
Definition map.h:138
@ MLN_MAP_MODE_CONTINUOUS
Definition map.h:134
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_feature_identifier_type
Definition map.h:407
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_request_repaint(mln_map *map)
mln_status mln_offline_region_list_get(const mln_offline_region_list *list, size_t index, mln_offline_region_info *out_info)
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_map_options mln_map_options_default(void)
mln_feature_state_selector_field
Definition map.h:385
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_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_merge_database_take_result(mln_runtime *runtime, mln_offline_operation_id operation_id, mln_offline_region_list **out_regions)
mln_camera_option_field
Definition map.h:25
mln_viewport_mode
Definition map.h:102
mln_projection_mode_field
Definition map.h:68
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_camera_fit_option_field
Definition map.h:46
void mln_offline_region_snapshot_destroy(mln_offline_region_snapshot *snapshot)
mln_tile_lod_mode
Definition map.h:116
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_map_set_style_url(mln_map *map, const char *url)
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_bound_option_field
Definition map.h:53
mln_status mln_map_destroy(mln_map *map)
mln_map_viewport_option_field
Definition map.h:108
mln_animation_option_field
Definition map.h:38
mln_constrain_mode
Definition map.h:94
mln_map_tile_option_field
Definition map.h:122
mln_status mln_runtime_offline_regions_list_start(mln_runtime *runtime, mln_offline_operation_id *out_operation_id)
mln_status mln_map_request_still_image(mln_map *map)
mln_json_value_type
Definition map.h:328
mln_map_debug_option
Definition map.h:75
mln_north_orientation
Definition map.h:86
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_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_map_create(mln_runtime *runtime, const mln_map_options *options, mln_map **out_map)
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_free_camera_option_field
Definition map.h:62
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_status mln_offline_region_snapshot_get(const mln_offline_region_snapshot *snapshot, mln_offline_region_info *out_info)
mln_status mln_map_set_style_json(mln_map *map, const char *json)
uint64_t mln_offline_operation_id
Definition runtime.h:51
Definition map.h:190
double duration_ms
Definition map.h:197
double velocity
Definition map.h:199
double min_zoom
Definition map.h:201
Definition map.h:481
Definition map.h:206
Definition map.h:166
Definition map.h:269
const mln_lat_lng * coordinates
Definition map.h:271
Definition map.h:158
Definition map.h:444
const mln_feature * features
Definition map.h:446
Definition map.h:392
mln_string_view source_id
Definition map.h:396
mln_string_view source_layer_id
Definition map.h:398
mln_string_view feature_id
Definition map.h:401
mln_string_view state_key
Definition map.h:403
Definition map.h:416
uint32_t identifier_type
Definition map.h:427
const mln_json_member * properties
Definition map.h:424
const mln_geometry * geometry
Definition map.h:422
Definition map.h:230
Definition map.h:455
const mln_feature * feature
Definition map.h:469
const mln_geometry * geometry
Definition map.h:464
uint32_t type
Definition map.h:458
Definition map.h:297
const mln_geometry * geometries
Definition map.h:299
Definition map.h:312
uint32_t type
Definition map.h:315
Definition map.h:340
const mln_json_value * values
Definition map.h:342
Definition map.h:347
const mln_json_value * value
Definition map.h:350
Definition map.h:354
const mln_json_member * members
Definition map.h:356
Definition map.h:369
uint32_t type
Definition map.h:372
Definition map.h:475
Definition map.h:238
double longitude
Definition map.h:243
double latitude
Definition map.h:241
Definition map.h:142
uint32_t map_mode
Definition map.h:148
Definition map.h:985
uint32_t lod_mode
Definition map.h:995
uint32_t prefetch_zoom_delta
Definition map.h:989
Definition map.h:972
uint32_t viewport_mode
Definition map.h:980
uint32_t north_orientation
Definition map.h:976
uint32_t constrain_mode
Definition map.h:978
Definition map.h:283
const mln_coordinate_span * lines
Definition map.h:285
Definition map.h:290
const mln_polygon_geometry * polygons
Definition map.h:292
const mln_geometry * geometry
Definition map.h:513
const char * style_url
Definition map.h:511
double max_zoom
Definition map.h:519
Definition map.h:525
uint32_t type
Definition map.h:528
Definition map.h:536
const uint8_t * metadata
Definition map.h:542
Definition runtime.h:78
const char * style_url
Definition map.h:495
double max_zoom
Definition map.h:502
Definition map.h:276
const mln_coordinate_span * rings
Definition map.h:278
Definition map.h:947
double northing
Definition map.h:949
double easting
Definition map.h:951
Definition map.h:960
double x_skew
Definition map.h:966
bool axonometric
Definition map.h:964
double y_skew
Definition map.h:968
Definition map.h:222
Definition map.h:152
Definition map.h:247
const char * data
Definition map.h:249
Definition map.h:182
Definition map.h:215