MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
style.h
Go to the documentation of this file.
1
5
6#ifndef MAPLIBRE_NATIVE_C_STYLE_H
7#define MAPLIBRE_NATIVE_C_STYLE_H
8
9#ifndef __cplusplus
10#include <stdbool.h>
11#endif
12
13#include <stddef.h>
14#include <stdint.h>
15
16#include "base.h"
17#include "map.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23typedef struct mln_style_id_list mln_style_id_list;
24
26typedef enum mln_style_source_type : uint32_t {
27 MLN_STYLE_SOURCE_TYPE_UNKNOWN = 0,
28 MLN_STYLE_SOURCE_TYPE_VECTOR = 1,
29 MLN_STYLE_SOURCE_TYPE_RASTER = 2,
30 MLN_STYLE_SOURCE_TYPE_RASTER_DEM = 3,
31 MLN_STYLE_SOURCE_TYPE_GEOJSON = 4,
32 MLN_STYLE_SOURCE_TYPE_IMAGE = 5,
33 MLN_STYLE_SOURCE_TYPE_VIDEO = 6,
34 MLN_STYLE_SOURCE_TYPE_ANNOTATIONS = 7,
35 MLN_STYLE_SOURCE_TYPE_CUSTOM_VECTOR = 8,
37
39typedef enum mln_style_tile_source_option_field : uint32_t {
40 MLN_STYLE_TILE_SOURCE_OPTION_MIN_ZOOM = 1U << 0U,
41 MLN_STYLE_TILE_SOURCE_OPTION_MAX_ZOOM = 1U << 1U,
42 MLN_STYLE_TILE_SOURCE_OPTION_ATTRIBUTION = 1U << 2U,
43 MLN_STYLE_TILE_SOURCE_OPTION_SCHEME = 1U << 3U,
44 MLN_STYLE_TILE_SOURCE_OPTION_BOUNDS = 1U << 4U,
45 MLN_STYLE_TILE_SOURCE_OPTION_TILE_SIZE = 1U << 5U,
46 MLN_STYLE_TILE_SOURCE_OPTION_VECTOR_ENCODING = 1U << 6U,
47 MLN_STYLE_TILE_SOURCE_OPTION_RASTER_ENCODING = 1U << 7U,
49
51typedef enum mln_style_tile_scheme : uint32_t {
52 MLN_STYLE_TILE_SCHEME_XYZ = 0,
53 MLN_STYLE_TILE_SCHEME_TMS = 1,
55
57typedef enum mln_style_vector_tile_encoding : uint32_t {
58 MLN_STYLE_VECTOR_TILE_ENCODING_MVT = 0,
59 MLN_STYLE_VECTOR_TILE_ENCODING_MLT = 1,
61
63typedef enum mln_style_raster_dem_encoding : uint32_t {
64 MLN_STYLE_RASTER_DEM_ENCODING_MAPBOX = 0,
65 MLN_STYLE_RASTER_DEM_ENCODING_TERRARIUM = 1,
67
70 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_MIN_ZOOM = 1U << 0U,
71 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_MAX_ZOOM = 1U << 1U,
72 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_TOLERANCE = 1U << 2U,
73 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_TILE_SIZE = 1U << 3U,
74 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_BUFFER = 1U << 4U,
75 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_CLIP = 1U << 5U,
76 MLN_CUSTOM_GEOMETRY_SOURCE_OPTION_WRAP = 1U << 6U,
78
80typedef enum mln_style_image_option_field : uint32_t {
81 MLN_STYLE_IMAGE_OPTION_PIXEL_RATIO = 1U << 0U,
82 MLN_STYLE_IMAGE_OPTION_SDF = 1U << 1U,
84
86typedef enum mln_location_indicator_image_kind : uint32_t {
87 MLN_LOCATION_INDICATOR_IMAGE_KIND_TOP = 0,
88 MLN_LOCATION_INDICATOR_IMAGE_KIND_BEARING = 1,
89 MLN_LOCATION_INDICATOR_IMAGE_KIND_SHADOW = 2,
91
93typedef struct mln_style_source_info {
94 uint32_t size;
96 uint32_t type;
98 size_t id_size;
99 bool is_volatile;
100 bool has_attribution;
104
107 uint32_t size;
108 uint32_t fields;
109 double min_zoom;
110 double max_zoom;
111 mln_string_view attribution;
113 uint32_t scheme;
114 mln_lat_lng_bounds bounds;
116 uint32_t tile_size;
122
124typedef struct mln_canonical_tile_id {
125 uint32_t z;
126 uint32_t x;
127 uint32_t y;
129
132 void* user_data, mln_canonical_tile_id tile_id
133);
134
137 uint32_t size;
138 uint32_t fields;
145 double min_zoom;
146 double max_zoom;
147 double tolerance;
148 uint32_t tile_size;
149 uint32_t buffer;
150 bool clip;
151 bool wrap;
153
156 uint32_t size;
157 uint32_t width;
158 uint32_t height;
160 uint32_t stride;
162 const uint8_t* pixels;
166
169 uint32_t size;
170 uint32_t fields;
174 bool sdf;
176
178typedef struct mln_style_image_info {
179 uint32_t size;
180 uint32_t width;
181 uint32_t height;
183 uint32_t stride;
184 size_t byte_length;
185 float pixel_ratio;
186 bool sdf;
188
192
196
200
204
207
218 const mln_style_id_list* list, size_t* out_count
219) MLN_NOEXCEPT;
220
234 const mln_style_id_list* list, size_t index, mln_string_view* out_id
235) MLN_NOEXCEPT;
236
238MLN_API void mln_style_id_list_destroy(mln_style_id_list* list) MLN_NOEXCEPT;
239
258 mln_map* map, mln_string_view source_id, const mln_json_value* source_json
259) MLN_NOEXCEPT;
260
277 mln_map* map, mln_string_view source_id, bool* out_removed
278) MLN_NOEXCEPT;
279
292 mln_map* map, mln_string_view source_id, bool* out_exists
293) MLN_NOEXCEPT;
294
310 mln_map* map, mln_string_view source_id, uint32_t* out_source_type,
311 bool* out_found
312) MLN_NOEXCEPT;
313
332 mln_map* map, mln_string_view source_id, mln_style_source_info* out_info,
333 bool* out_found
334) MLN_NOEXCEPT;
335
355 mln_map* map, mln_string_view source_id, char* out_attribution,
356 size_t attribution_capacity, size_t* out_attribution_size, bool* out_found
357) MLN_NOEXCEPT;
358
374 mln_map* map, mln_style_id_list** out_source_ids
375) MLN_NOEXCEPT;
376
392 mln_map* map, mln_string_view source_id, mln_string_view url
393) MLN_NOEXCEPT;
394
410 mln_map* map, mln_string_view source_id, const mln_geojson* data
411) MLN_NOEXCEPT;
412
428 mln_map* map, mln_string_view source_id, mln_string_view url
429) MLN_NOEXCEPT;
430
447 mln_map* map, mln_string_view source_id, const mln_geojson* data
448) MLN_NOEXCEPT;
449
466 mln_map* map, mln_string_view source_id, mln_string_view url,
467 const mln_style_tile_source_options* options
468) MLN_NOEXCEPT;
469
487 mln_map* map, mln_string_view source_id, const mln_string_view* tiles,
488 size_t tile_count, const mln_style_tile_source_options* options
489) MLN_NOEXCEPT;
490
506 mln_map* map, mln_string_view source_id, mln_string_view url,
507 const mln_style_tile_source_options* options
508) MLN_NOEXCEPT;
509
527 mln_map* map, mln_string_view source_id, const mln_string_view* tiles,
528 size_t tile_count, const mln_style_tile_source_options* options
529) MLN_NOEXCEPT;
530
547 mln_map* map, mln_string_view source_id, mln_string_view url,
548 const mln_style_tile_source_options* options
549) MLN_NOEXCEPT;
550
568 mln_map* map, mln_string_view source_id, const mln_string_view* tiles,
569 size_t tile_count, const mln_style_tile_source_options* options
570) MLN_NOEXCEPT;
571
604 mln_map* map, mln_string_view source_id,
606) MLN_NOEXCEPT;
607
624 mln_map* map, mln_string_view source_id, mln_canonical_tile_id tile_id,
625 const mln_geojson* data
626) MLN_NOEXCEPT;
627
641 mln_map* map, mln_string_view source_id, mln_canonical_tile_id tile_id
642) MLN_NOEXCEPT;
643
657 mln_map* map, mln_string_view source_id, mln_lat_lng_bounds bounds
658) MLN_NOEXCEPT;
659
680 mln_map* map, mln_string_view image_id,
682 const mln_style_image_options* options
683) MLN_NOEXCEPT;
684
700 mln_map* map, mln_string_view image_id, bool* out_removed
701) MLN_NOEXCEPT;
702
715 mln_map* map, mln_string_view image_id, bool* out_exists
716) MLN_NOEXCEPT;
717
734 mln_map* map, mln_string_view image_id, mln_style_image_info* out_info,
735 bool* out_found
736) MLN_NOEXCEPT;
737
759 mln_map* map, mln_string_view image_id, uint8_t* out_pixels,
760 size_t pixel_capacity, size_t* out_byte_length, bool* out_found
761) MLN_NOEXCEPT;
762
785 mln_map* map, mln_string_view source_id, const mln_lat_lng* coordinates,
786 size_t coordinate_count, mln_string_view url
787) MLN_NOEXCEPT;
788
811 mln_map* map, mln_string_view source_id, const mln_lat_lng* coordinates,
812 size_t coordinate_count, const mln_premultiplied_rgba8_image* image
813) MLN_NOEXCEPT;
814
831 mln_map* map, mln_string_view source_id, mln_string_view url
832) MLN_NOEXCEPT;
833
851 mln_map* map, mln_string_view source_id,
853) MLN_NOEXCEPT;
854
872 mln_map* map, mln_string_view source_id, const mln_lat_lng* coordinates,
873 size_t coordinate_count
874) MLN_NOEXCEPT;
875
895 mln_map* map, mln_string_view source_id, mln_lat_lng* out_coordinates,
896 size_t coordinate_capacity, size_t* out_coordinate_count, bool* out_found
897) MLN_NOEXCEPT;
898
917 mln_map* map, mln_string_view layer_id, mln_string_view source_id,
918 mln_string_view before_layer_id
919) MLN_NOEXCEPT;
920
940 mln_map* map, mln_string_view layer_id, mln_string_view source_id,
941 mln_string_view before_layer_id
942) MLN_NOEXCEPT;
943
961 mln_map* map, mln_string_view layer_id, mln_string_view before_layer_id
962) MLN_NOEXCEPT;
963
980 mln_map* map, mln_string_view layer_id, mln_lat_lng coordinate,
981 double altitude
982) MLN_NOEXCEPT;
983
997 mln_map* map, mln_string_view layer_id, double bearing
998) MLN_NOEXCEPT;
999
1013 mln_map* map, mln_string_view layer_id, double radius
1014) MLN_NOEXCEPT;
1015
1032 mln_map* map, mln_string_view layer_id, uint32_t image_kind,
1033 mln_string_view image_id
1034) MLN_NOEXCEPT;
1035
1053 mln_map* map, const mln_json_value* layer_json,
1054 mln_string_view before_layer_id
1055) MLN_NOEXCEPT;
1056
1072 mln_map* map, mln_string_view layer_id, bool* out_removed
1073) MLN_NOEXCEPT;
1074
1087 mln_map* map, mln_string_view layer_id, bool* out_exists
1088) MLN_NOEXCEPT;
1089
1105 mln_map* map, mln_string_view layer_id, mln_string_view* out_layer_type,
1106 bool* out_found
1107) MLN_NOEXCEPT;
1108
1124 mln_map* map, mln_style_id_list** out_layer_ids
1125) MLN_NOEXCEPT;
1126
1143 mln_map* map, mln_string_view layer_id, mln_string_view before_layer_id
1144) MLN_NOEXCEPT;
1145
1162 mln_map* map, mln_string_view layer_id, mln_json_snapshot** out_layer,
1163 bool* out_found
1164) MLN_NOEXCEPT;
1165
1181 mln_map* map, const mln_json_value* light_json
1182) MLN_NOEXCEPT;
1183
1201 mln_map* map, mln_string_view property_name, const mln_json_value* value
1202) MLN_NOEXCEPT;
1203
1221 mln_map* map, mln_string_view property_name, mln_json_snapshot** out_value
1222) MLN_NOEXCEPT;
1223
1243 mln_map* map, mln_string_view layer_id, mln_string_view property_name,
1244 const mln_json_value* value
1245) MLN_NOEXCEPT;
1246
1265 mln_map* map, mln_string_view layer_id, mln_string_view property_name,
1266 mln_json_snapshot** out_value
1267) MLN_NOEXCEPT;
1268
1287 mln_map* map, mln_string_view layer_id, const mln_json_value* filter
1288) MLN_NOEXCEPT;
1289
1307 mln_map* map, mln_string_view layer_id, mln_json_snapshot** out_filter
1308) MLN_NOEXCEPT;
1309
1310#ifdef __cplusplus
1311}
1312#endif
1313
1314#endif // MAPLIBRE_NATIVE_C_STYLE_H
mln_status
Definition base.h:37
Definition style.h:124
void * user_data
Definition style.h:144
mln_custom_geometry_source_tile_callback fetch_tile
Definition style.h:140
mln_custom_geometry_source_tile_callback cancel_tile
Definition style.h:142
Definition map.h:455
Definition map.h:369
Definition map.h:475
Definition map.h:238
Definition style.h:155
const uint8_t * pixels
Definition style.h:162
uint32_t stride
Definition style.h:160
size_t byte_length
Definition style.h:164
Definition map.h:247
Definition style.h:178
uint32_t stride
Definition style.h:183
Definition style.h:168
float pixel_ratio
Definition style.h:172
bool sdf
Definition style.h:174
Definition style.h:93
uint32_t type
Definition style.h:96
size_t id_size
Definition style.h:98
size_t attribution_size
Definition style.h:102
Definition style.h:106
uint32_t raster_encoding
Definition style.h:120
uint32_t scheme
Definition style.h:113
uint32_t tile_size
Definition style.h:116
uint32_t vector_encoding
Definition style.h:118
mln_style_image_option_field
Definition style.h:80
mln_status mln_map_set_layer_property(mln_map *map, mln_string_view layer_id, mln_string_view property_name, const mln_json_value *value)
mln_style_image_options mln_style_image_options_default(void)
mln_status mln_map_get_style_light_property(mln_map *map, mln_string_view property_name, mln_json_snapshot **out_value)
mln_status mln_map_add_custom_geometry_source(mln_map *map, mln_string_view source_id, const mln_custom_geometry_source_options *options)
mln_status mln_map_set_style_light_json(mln_map *map, const mln_json_value *light_json)
mln_status mln_map_add_vector_source_tiles(mln_map *map, mln_string_view source_id, const mln_string_view *tiles, size_t tile_count, const mln_style_tile_source_options *options)
mln_status mln_map_style_layer_exists(mln_map *map, mln_string_view layer_id, bool *out_exists)
mln_style_tile_source_option_field
Definition style.h:39
mln_status mln_map_set_geojson_source_data(mln_map *map, mln_string_view source_id, const mln_geojson *data)
mln_status mln_map_move_style_layer(mln_map *map, mln_string_view layer_id, mln_string_view before_layer_id)
mln_status mln_map_set_layer_filter(mln_map *map, mln_string_view layer_id, const mln_json_value *filter)
mln_status mln_map_add_hillshade_layer(mln_map *map, mln_string_view layer_id, mln_string_view source_id, mln_string_view before_layer_id)
mln_status mln_map_add_image_source_url(mln_map *map, mln_string_view source_id, const mln_lat_lng *coordinates, size_t coordinate_count, mln_string_view url)
mln_status mln_map_set_image_source_url(mln_map *map, mln_string_view source_id, mln_string_view url)
mln_status mln_map_set_style_image(mln_map *map, mln_string_view image_id, const mln_premultiplied_rgba8_image *image, const mln_style_image_options *options)
mln_status mln_map_get_style_image_info(mln_map *map, mln_string_view image_id, mln_style_image_info *out_info, bool *out_found)
mln_status mln_map_add_raster_source_url(mln_map *map, mln_string_view source_id, mln_string_view url, const mln_style_tile_source_options *options)
mln_status mln_map_style_image_exists(mln_map *map, mln_string_view image_id, bool *out_exists)
mln_status mln_map_add_raster_dem_source_tiles(mln_map *map, mln_string_view source_id, const mln_string_view *tiles, size_t tile_count, const mln_style_tile_source_options *options)
mln_status mln_map_set_location_indicator_accuracy_radius(mln_map *map, mln_string_view layer_id, double radius)
mln_status mln_map_remove_style_layer(mln_map *map, mln_string_view layer_id, bool *out_removed)
mln_status mln_map_get_style_layer_json(mln_map *map, mln_string_view layer_id, mln_json_snapshot **out_layer, bool *out_found)
mln_status mln_map_get_style_layer_type(mln_map *map, mln_string_view layer_id, mln_string_view *out_layer_type, bool *out_found)
mln_status mln_map_get_image_source_coordinates(mln_map *map, mln_string_view source_id, mln_lat_lng *out_coordinates, size_t coordinate_capacity, size_t *out_coordinate_count, bool *out_found)
mln_premultiplied_rgba8_image mln_premultiplied_rgba8_image_default(void)
mln_status mln_map_set_geojson_source_url(mln_map *map, mln_string_view source_id, mln_string_view url)
mln_status mln_map_remove_style_image(mln_map *map, mln_string_view image_id, bool *out_removed)
mln_status mln_map_set_location_indicator_bearing(mln_map *map, mln_string_view layer_id, double bearing)
mln_status mln_map_set_image_source_image(mln_map *map, mln_string_view source_id, const mln_premultiplied_rgba8_image *image)
mln_style_vector_tile_encoding
Definition style.h:57
mln_status mln_map_add_geojson_source_url(mln_map *map, mln_string_view source_id, mln_string_view url)
mln_status mln_map_set_location_indicator_location(mln_map *map, mln_string_view layer_id, mln_lat_lng coordinate, double altitude)
mln_status mln_map_add_color_relief_layer(mln_map *map, mln_string_view layer_id, mln_string_view source_id, mln_string_view before_layer_id)
mln_status mln_map_invalidate_custom_geometry_source_region(mln_map *map, mln_string_view source_id, mln_lat_lng_bounds bounds)
mln_status mln_map_get_layer_property(mln_map *map, mln_string_view layer_id, mln_string_view property_name, mln_json_snapshot **out_value)
mln_status mln_map_copy_style_image_premultiplied_rgba8(mln_map *map, mln_string_view image_id, uint8_t *out_pixels, size_t pixel_capacity, size_t *out_byte_length, bool *out_found)
mln_style_tile_scheme
Definition style.h:51
mln_status mln_map_list_style_layer_ids(mln_map *map, mln_style_id_list **out_layer_ids)
void mln_style_id_list_destroy(mln_style_id_list *list)
mln_status mln_map_remove_style_source(mln_map *map, mln_string_view source_id, bool *out_removed)
mln_status mln_map_add_location_indicator_layer(mln_map *map, mln_string_view layer_id, mln_string_view before_layer_id)
mln_style_source_type
Definition style.h:26
mln_custom_geometry_source_options mln_custom_geometry_source_options_default(void)
mln_status mln_map_style_source_exists(mln_map *map, mln_string_view source_id, bool *out_exists)
mln_status mln_map_add_geojson_source_data(mln_map *map, mln_string_view source_id, const mln_geojson *data)
mln_status mln_map_set_style_light_property(mln_map *map, mln_string_view property_name, const mln_json_value *value)
mln_status mln_map_get_style_source_info(mln_map *map, mln_string_view source_id, mln_style_source_info *out_info, bool *out_found)
mln_status mln_map_get_style_source_type(mln_map *map, mln_string_view source_id, uint32_t *out_source_type, bool *out_found)
mln_status mln_map_list_style_source_ids(mln_map *map, mln_style_id_list **out_source_ids)
mln_status mln_map_add_vector_source_url(mln_map *map, mln_string_view source_id, mln_string_view url, const mln_style_tile_source_options *options)
mln_status mln_map_set_location_indicator_image_name(mln_map *map, mln_string_view layer_id, uint32_t image_kind, mln_string_view image_id)
mln_status mln_map_copy_style_source_attribution(mln_map *map, mln_string_view source_id, char *out_attribution, size_t attribution_capacity, size_t *out_attribution_size, bool *out_found)
mln_style_tile_source_options mln_style_tile_source_options_default(void)
mln_style_raster_dem_encoding
Definition style.h:63
mln_style_image_info mln_style_image_info_default(void)
mln_status mln_style_id_list_get(const mln_style_id_list *list, size_t index, mln_string_view *out_id)
mln_status mln_map_get_layer_filter(mln_map *map, mln_string_view layer_id, mln_json_snapshot **out_filter)
mln_status mln_style_id_list_count(const mln_style_id_list *list, size_t *out_count)
mln_custom_geometry_source_option_field
Definition style.h:69
mln_status mln_map_add_raster_source_tiles(mln_map *map, mln_string_view source_id, const mln_string_view *tiles, size_t tile_count, const mln_style_tile_source_options *options)
mln_status mln_map_add_raster_dem_source_url(mln_map *map, mln_string_view source_id, mln_string_view url, const mln_style_tile_source_options *options)
mln_status mln_map_invalidate_custom_geometry_source_tile(mln_map *map, mln_string_view source_id, mln_canonical_tile_id tile_id)
mln_location_indicator_image_kind
Definition style.h:86
mln_status mln_map_set_image_source_coordinates(mln_map *map, mln_string_view source_id, const mln_lat_lng *coordinates, size_t coordinate_count)
mln_status mln_map_set_custom_geometry_source_tile_data(mln_map *map, mln_string_view source_id, mln_canonical_tile_id tile_id, const mln_geojson *data)
mln_status mln_map_add_style_source_json(mln_map *map, mln_string_view source_id, const mln_json_value *source_json)
mln_status mln_map_add_style_layer_json(mln_map *map, const mln_json_value *layer_json, mln_string_view before_layer_id)
mln_status mln_map_add_image_source_image(mln_map *map, mln_string_view source_id, const mln_lat_lng *coordinates, size_t coordinate_count, const mln_premultiplied_rgba8_image *image)
void(* mln_custom_geometry_source_tile_callback)(void *user_data, mln_canonical_tile_id tile_id)
Definition style.h:131