From 79362b306408fcc4c748a8f022b27712d2bab49b Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:35:26 +0200 Subject: [PATCH 1/8] Update map-events.md --- docs/docs/map-events.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/map-events.md b/docs/docs/map-events.md index 83a2505..cf655b1 100644 --- a/docs/docs/map-events.md +++ b/docs/docs/map-events.md @@ -73,9 +73,9 @@ void _onEvent(event) { | | mouseout | | | | | | | | mouseover | | | | | | | | mouseup | | | | | | -| | move | OnCameraIsChangingListener | | | | | -| | movestart | OnCameraWillChangeListener | | | | | -| MapEventMovementStopped | moveend | OnCameraDidChangeListener | | | | | +| onCameraMoved | move | OnCameraMoveListener | | | | | +| | movestart | | | | | | +| MapEventMovementStopped | moveend | | | | | | | | pitch | | | | | | | | pitchstart | | | | | | | | pitchend | | | | | | From 355fb86d9e2e22288322e3d4642fafedfed2053b Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:11:30 +0200 Subject: [PATCH 2/8] add MapEventIdle --- .../josxha/maplibre/MapLibreMapController.kt | 20 +++-- .../com/github/josxha/maplibre/Pigeon.g.kt | 18 +++++ docs/docs/map-events.md | 6 +- example/lib/events_page.dart | 4 +- ios/Classes/Pigeon.g.swift | 21 +++++ lib/src/map_events.dart | 9 +++ lib/src/native/pigeon.g.dart | 26 +++++++ lib/src/native/widget_state.dart | 3 + lib/src/web/interop/events.dart | 7 ++ lib/src/web/widget_state.dart | 6 ++ linux/pigeon.g.cc | 78 +++++++++++++++++++ linux/pigeon.g.h | 65 ++++++++++++++++ macos/Classes/Pigeon.g.swift | 21 +++++ pigeons/pigeon.dart | 3 + windows/runner/pigeon.g.cpp | 22 ++++++ windows/runner/pigeon.g.h | 4 + 16 files changed, 301 insertions(+), 12 deletions(-) diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt index 4d73f8c..9bddff9 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt @@ -126,6 +126,7 @@ class MapLibreMapController( val camera = MapCamera(center, position.zoom, position.tilt, position.bearing) flutterApi.onCameraMoved(camera) {} } + this.mapView.addOnDidBecomeIdleListener { flutterApi.onIdle { } } val style = Style.Builder().fromUri(mapOptions.style) mapLibreMap.setStyle(style) { loadedStyle -> this.style = loadedStyle @@ -560,17 +561,22 @@ class MapLibreMapController( // remove map bounds mapLibreMap.setLatLngBoundsForCameraTarget(null) } else if (oldBounds == null && newBounds != null) { - val bounds = LatLngBounds.from(newBounds.latitudeNorth, newBounds.longitudeEast, - newBounds.latitudeSouth, newBounds.longitudeWest) + val bounds = LatLngBounds.from( + newBounds.latitudeNorth, newBounds.longitudeEast, + newBounds.latitudeSouth, newBounds.longitudeWest + ) mapLibreMap.setLatLngBoundsForCameraTarget(bounds) } else if (newBounds != null && // can get improved when https://github.com/flutter/flutter/issues/118087 is implemented (oldBounds?.latitudeNorth != newBounds.latitudeNorth - || oldBounds.latitudeSouth != newBounds.latitudeSouth - || oldBounds.longitudeEast != newBounds.longitudeEast - || oldBounds.longitudeWest != newBounds.longitudeWest)) { - val bounds = LatLngBounds.from(newBounds.latitudeNorth, newBounds.longitudeEast, - newBounds.latitudeSouth, newBounds.longitudeWest) + || oldBounds.latitudeSouth != newBounds.latitudeSouth + || oldBounds.longitudeEast != newBounds.longitudeEast + || oldBounds.longitudeWest != newBounds.longitudeWest) + ) { + val bounds = LatLngBounds.from( + newBounds.latitudeNorth, newBounds.longitudeEast, + newBounds.latitudeSouth, newBounds.longitudeWest + ) mapLibreMap.setLatLngBoundsForCameraTarget(bounds) } } diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt index 1676570..1b80f06 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt @@ -1094,6 +1094,24 @@ class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private v } } } + /** Callback when the map idles. */ + fun onIdle(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } /** * Callback when the user performs a secondary click on the map * (e.g. by default a click with the right mouse button). diff --git a/docs/docs/map-events.md b/docs/docs/map-events.md index cf655b1..234b67b 100644 --- a/docs/docs/map-events.md +++ b/docs/docs/map-events.md @@ -67,7 +67,7 @@ void _onEvent(event) { | | dragstart | | | | | | | | dragend | | | | | | | | error | | | | | | -| | idle | OnDidBecomeIdleListener | | | | | +| MapEventIdle | idle | OnDidBecomeIdleListener | | | | | | | mousedown | | | | | | | | mousemove | | | | | | | | mouseout | | | | | | @@ -75,15 +75,13 @@ void _onEvent(event) { | | mouseup | | | | | | | onCameraMoved | move | OnCameraMoveListener | | | | | | | movestart | | | | | | -| MapEventMovementStopped | moveend | | | | | | +| | moveend | | | | | | | | pitch | | | | | | | | pitchstart | | | | | | | | pitchend | | | | | | -| | pitchend | | | | | | | | rotate | | | | | | | | rotatestart | | | | | | | | rotateend | | | | | | -| | rotateend | | | | | | | | touchcancel | | | | | | | | touchend | | | | | | | | touchmove | | | | | | diff --git a/example/lib/events_page.dart b/example/lib/events_page.dart index a6b39b9..b80a836 100644 --- a/example/lib/events_page.dart +++ b/example/lib/events_page.dart @@ -20,7 +20,8 @@ class _EventsPageState extends State { appBar: AppBar(title: const Text('Events')), body: Column( children: [ - Padding( + Container( + constraints: const BoxConstraints(minHeight: 60), padding: const EdgeInsets.all(8), child: Text(_lastEventMessage, textAlign: TextAlign.center), ), @@ -51,6 +52,7 @@ class _EventsPageState extends State { _print('long clicked: ${_formatPosition(event.point)}'), MapEventSecondaryClicked() => _print('secondary clicked: ${_formatPosition(event.point)}'), + MapEventIdle() => _print('idle'), }; void _print(String message) { diff --git a/ios/Classes/Pigeon.g.swift b/ios/Classes/Pigeon.g.swift index 8dfad1a..7d8ef90 100644 --- a/ios/Classes/Pigeon.g.swift +++ b/ios/Classes/Pigeon.g.swift @@ -1029,6 +1029,8 @@ protocol MapLibreFlutterApiProtocol { func onStyleLoaded(completion: @escaping (Result) -> Void) /// Callback when the user clicks on the map. func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) @@ -1109,6 +1111,25 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { diff --git a/lib/src/map_events.dart b/lib/src/map_events.dart index 927ea6b..3f88cd0 100644 --- a/lib/src/map_events.dart +++ b/lib/src/map_events.dart @@ -65,3 +65,12 @@ final class MapEventLongClicked extends MapEventUserInput { /// Create a new [MapEventLongClicked] object. const MapEventLongClicked({required super.point}); } + +/// Emitted when the map enters an idle state. +/// +/// No camera transitions are in progress, all currently requested tiles have +/// loaded and all fade/transition animations have completed. +final class MapEventIdle extends MapEvent { + /// Create a new [MapEventIdle] object. + const MapEventIdle(); +} diff --git a/lib/src/native/pigeon.g.dart b/lib/src/native/pigeon.g.dart index 89029a6..a2e9e6c 100644 --- a/lib/src/native/pigeon.g.dart +++ b/lib/src/native/pigeon.g.dart @@ -1241,6 +1241,9 @@ abstract class MapLibreFlutterApi { /// Callback when the user clicks on the map. void onClick(LngLat point); + /// Callback when the map idles. + void onIdle(); + /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). void onSecondaryClick(LngLat point); @@ -1336,6 +1339,29 @@ abstract class MapLibreFlutterApi { }); } } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.onIdle(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } { final BasicMessageChannel< Object?> pigeonVar_channel = BasicMessageChannel< diff --git a/lib/src/native/widget_state.dart b/lib/src/native/widget_state.dart index 4f10738..1b340ec 100644 --- a/lib/src/native/widget_state.dart +++ b/lib/src/native/widget_state.dart @@ -303,6 +303,9 @@ final class MapLibreMapStateNative extends State widget.onEvent?.call(MapEventCameraMoved(camera: mapCamera)); } + @override + void onIdle() => widget.onEvent?.call(const MapEventIdle()); + @override void onDoubleClick(pigeon.LngLat point) { final position = point.toPosition(); diff --git a/lib/src/web/interop/events.dart b/lib/src/web/interop/events.dart index ac3af0c..fbc1838 100644 --- a/lib/src/web/interop/events.dart +++ b/lib/src/web/interop/events.dart @@ -45,4 +45,11 @@ abstract class MapEventType { /// Fired once the map stops moving. static const moveEnd = 'moveend'; + + /// Fired after the last frame rendered before the map enters an "idle" state: + // + // No camera transitions are in progress + // All currently requested tiles have loaded + // All fade/transition animations have completed + static const idle = 'idle'; } diff --git a/lib/src/web/widget_state.dart b/lib/src/web/widget_state.dart index 90cfe65..bd81761 100644 --- a/lib/src/web/widget_state.dart +++ b/lib/src/web/widget_state.dart @@ -142,6 +142,12 @@ final class MapLibreMapStateWeb extends State _options.onSecondaryClick?.call(point); }.toJS, ); + _map.on( + interop.MapEventType.idle, + (interop.MapMouseEvent event) { + widget.onEvent?.call(const MapEventIdle()); + }.toJS, + ); _map.on( interop.MapEventType.move, (interop.MapLibreEvent event) { diff --git a/linux/pigeon.g.cc b/linux/pigeon.g.cc index ef54f76..a2fc776 100644 --- a/linux/pigeon.g.cc +++ b/linux/pigeon.g.cc @@ -3226,6 +3226,84 @@ MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_cli return maplibre_map_libre_flutter_api_on_click_response_new(response); } +struct _MaplibreMapLibreFlutterApiOnIdleResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_idle_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_idle_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_idle_response_init(MaplibreMapLibreFlutterApiOnIdleResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_idle_response_class_init(MaplibreMapLibreFlutterApiOnIdleResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_idle_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_idle_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_idle_cb, task); +} + +MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_idle_response_new(response); +} + struct _MaplibreMapLibreFlutterApiOnSecondaryClickResponse { GObject parent_instance; diff --git a/linux/pigeon.g.h b/linux/pigeon.g.h index c6b2ac7..00dda51 100644 --- a/linux/pigeon.g.h +++ b/linux/pigeon.g.h @@ -1128,6 +1128,48 @@ const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_message( */ FlValue* maplibre_map_libre_flutter_api_on_click_response_get_error_details(MaplibreMapLibreFlutterApiOnClickResponse* response); +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_idle_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Checks if a response to MapLibreFlutterApi.onIdle is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* response); + G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE, GObject) /** @@ -1384,6 +1426,29 @@ void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* api, Ma */ MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); +/** + * maplibre_map_libre_flutter_api_on_idle: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map idles. + */ +void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_idle_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_idle() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnIdleResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + /** * maplibre_map_libre_flutter_api_on_secondary_click: * @api: a #MaplibreMapLibreFlutterApi. diff --git a/macos/Classes/Pigeon.g.swift b/macos/Classes/Pigeon.g.swift index 8dfad1a..7d8ef90 100644 --- a/macos/Classes/Pigeon.g.swift +++ b/macos/Classes/Pigeon.g.swift @@ -1029,6 +1029,8 @@ protocol MapLibreFlutterApiProtocol { func onStyleLoaded(completion: @escaping (Result) -> Void) /// Callback when the user clicks on the map. func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) @@ -1109,6 +1111,25 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { diff --git a/pigeons/pigeon.dart b/pigeons/pigeon.dart index 64961aa..4d72a83 100644 --- a/pigeons/pigeon.dart +++ b/pigeons/pigeon.dart @@ -260,6 +260,9 @@ abstract interface class MapLibreFlutterApi { /// Callback when the user clicks on the map. void onClick(LngLat point); + /// Callback when the map idles. + void onIdle(); + /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). void onSecondaryClick(LngLat point); diff --git a/windows/runner/pigeon.g.cpp b/windows/runner/pigeon.g.cpp index 32ae419..54c55b8 100644 --- a/windows/runner/pigeon.g.cpp +++ b/windows/runner/pigeon.g.cpp @@ -1864,6 +1864,28 @@ void MapLibreFlutterApi::OnClick( }); } +void MapLibreFlutterApi::OnIdle( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + void MapLibreFlutterApi::OnSecondaryClick( const LngLat& point_arg, std::function&& on_success, diff --git a/windows/runner/pigeon.g.h b/windows/runner/pigeon.g.h index db6635e..e9eb67b 100644 --- a/windows/runner/pigeon.g.h +++ b/windows/runner/pigeon.g.h @@ -589,6 +589,10 @@ class MapLibreFlutterApi { const LngLat& point, std::function&& on_success, std::function&& on_error); + // Callback when the map idles. + void OnIdle( + std::function&& on_success, + std::function&& on_error); // Callback when the user performs a secondary click on the map // (e.g. by default a click with the right mouse button). void OnSecondaryClick( From b18b9dc605c53a19ea7f07297524bd149f6f7bc6 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:23:43 +0200 Subject: [PATCH 3/8] fix: flyTo return type --- docs/docs/map-events.md | 6 ------ lib/src/web/widget_state.dart | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/docs/map-events.md b/docs/docs/map-events.md index 234b67b..77d146a 100644 --- a/docs/docs/map-events.md +++ b/docs/docs/map-events.md @@ -77,16 +77,10 @@ void _onEvent(event) { | | movestart | | | | | | | | moveend | | | | | | | | pitch | | | | | | -| | pitchstart | | | | | | -| | pitchend | | | | | | | | rotate | | | | | | -| | rotatestart | | | | | | -| | rotateend | | | | | | | | touchcancel | | | | | | -| | touchend | | | | | | | | touchmove | | | | | | | | touchstart | | | | | | | | wheel | | | | | | | | zoom | | | | | | -| | zoomstart | | | | | | | | zoomend | | | | | | diff --git a/lib/src/web/widget_state.dart b/lib/src/web/widget_state.dart index bd81761..cb84452 100644 --- a/lib/src/web/widget_state.dart +++ b/lib/src/web/widget_state.dart @@ -158,6 +158,11 @@ final class MapLibreMapStateWeb extends State bearing: _map.getBearing().toDouble(), ); widget.onEvent?.call(MapEventCameraMoved(camera: camera)); + }.toJS, + ); + _map.on( + interop.MapEventType.moveEnd, + (interop.MapLibreEvent event) { if (_moveCompleter?.isCompleted ?? true) return; _moveCompleter?.complete(event); }.toJS, From ab3cf17e5270f072848d34326c21cf7fcba646e1 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:40:23 +0200 Subject: [PATCH 4/8] show 10 most recent events --- example/lib/events_page.dart | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/example/lib/events_page.dart b/example/lib/events_page.dart index b80a836..523240f 100644 --- a/example/lib/events_page.dart +++ b/example/lib/events_page.dart @@ -12,24 +12,22 @@ class EventsPage extends StatefulWidget { } class _EventsPageState extends State { - String _lastEventMessage = ''; + final _eventMessages = []; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Events')), - body: Column( + body: Stack( children: [ + MapLibreMap( + options: MapOptions(center: Position(9.17, 47.68)), + onEvent: _onEvent, + ), Container( - constraints: const BoxConstraints(minHeight: 60), padding: const EdgeInsets.all(8), - child: Text(_lastEventMessage, textAlign: TextAlign.center), - ), - Expanded( - child: MapLibreMap( - options: MapOptions(center: Position(9.17, 47.68)), - onEvent: _onEvent, - ), + alignment: Alignment.bottomLeft, + child: Text(_eventMessages.join('\n')), ), ], ), @@ -58,10 +56,11 @@ class _EventsPageState extends State { void _print(String message) { debugPrint('[MapLibreMap] $message'); setState(() { - _lastEventMessage = message; + _eventMessages.add(message); + if (_eventMessages.length > 10) _eventMessages.removeAt(0); }); } String _formatPosition(Position point) => - '${point.lng.toStringAsFixed(6)}, ${point.lat.toStringAsFixed(6)}'; + '${point.lng.toStringAsFixed(3)}, ${point.lat.toStringAsFixed(3)}'; } From 4d3162b203bde23c8b3f2a9352b6b2ce577194d9 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:53:39 +0200 Subject: [PATCH 5/8] add camera idle event --- .../josxha/maplibre/MapLibreMapController.kt | 1 + .../com/github/josxha/maplibre/Pigeon.g.kt | 18 +++++ docs/docs/map-events.md | 3 +- example/lib/events_page.dart | 11 ++- ios/Classes/Pigeon.g.swift | 21 +++++ lib/src/map_events.dart | 9 +++ lib/src/native/pigeon.g.dart | 26 +++++++ lib/src/native/widget_state.dart | 3 + lib/src/web/widget_state.dart | 1 + linux/pigeon.g.cc | 78 +++++++++++++++++++ linux/pigeon.g.h | 65 ++++++++++++++++ macos/Classes/Pigeon.g.swift | 21 +++++ pigeons/pigeon.dart | 3 + windows/runner/pigeon.g.cpp | 22 ++++++ windows/runner/pigeon.g.h | 4 + 15 files changed, 280 insertions(+), 6 deletions(-) diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt index 9bddff9..01a9c6b 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt @@ -126,6 +126,7 @@ class MapLibreMapController( val camera = MapCamera(center, position.zoom, position.tilt, position.bearing) flutterApi.onCameraMoved(camera) {} } + this.mapLibreMap.addOnCameraIdleListener { flutterApi.onCameraIdle { } } this.mapView.addOnDidBecomeIdleListener { flutterApi.onIdle { } } val style = Style.Builder().fromUri(mapOptions.style) mapLibreMap.setStyle(style) { loadedStyle -> diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt index 1b80f06..cdb570c 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt @@ -1112,6 +1112,24 @@ class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private v } } } + /** Callback when the map camera idles. */ + fun onCameraIdle(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } /** * Callback when the user performs a secondary click on the map * (e.g. by default a click with the right mouse button). diff --git a/docs/docs/map-events.md b/docs/docs/map-events.md index 77d146a..3f07029 100644 --- a/docs/docs/map-events.md +++ b/docs/docs/map-events.md @@ -74,8 +74,7 @@ void _onEvent(event) { | | mouseover | | | | | | | | mouseup | | | | | | | onCameraMoved | move | OnCameraMoveListener | | | | | -| | movestart | | | | | | -| | moveend | | | | | | +| MapEventCameraIdle | moveend | OnCameraMoveCanceledListener | | | | | | | pitch | | | | | | | | rotate | | | | | | | | touchcancel | | | | | | diff --git a/example/lib/events_page.dart b/example/lib/events_page.dart index 523240f..f464e37 100644 --- a/example/lib/events_page.dart +++ b/example/lib/events_page.dart @@ -24,10 +24,12 @@ class _EventsPageState extends State { options: MapOptions(center: Position(9.17, 47.68)), onEvent: _onEvent, ), - Container( - padding: const EdgeInsets.all(8), - alignment: Alignment.bottomLeft, - child: Text(_eventMessages.join('\n')), + IgnorePointer( + child: Container( + padding: const EdgeInsets.all(8), + alignment: Alignment.bottomLeft, + child: Text(_eventMessages.join('\n')), + ), ), ], ), @@ -51,6 +53,7 @@ class _EventsPageState extends State { MapEventSecondaryClicked() => _print('secondary clicked: ${_formatPosition(event.point)}'), MapEventIdle() => _print('idle'), + MapEventCameraIdle() => _print('camera idle'), }; void _print(String message) { diff --git a/ios/Classes/Pigeon.g.swift b/ios/Classes/Pigeon.g.swift index 7d8ef90..be85aa8 100644 --- a/ios/Classes/Pigeon.g.swift +++ b/ios/Classes/Pigeon.g.swift @@ -1031,6 +1031,8 @@ protocol MapLibreFlutterApiProtocol { func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) /// Callback when the map idles. func onIdle(completion: @escaping (Result) -> Void) + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) @@ -1130,6 +1132,25 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { diff --git a/lib/src/map_events.dart b/lib/src/map_events.dart index 3f88cd0..fcdc2e1 100644 --- a/lib/src/map_events.dart +++ b/lib/src/map_events.dart @@ -74,3 +74,12 @@ final class MapEventIdle extends MapEvent { /// Create a new [MapEventIdle] object. const MapEventIdle(); } + +/// Emitted when the map camera enters an idle state. +/// +/// No changes to the map camera though gestures or camera transitions are +/// in progress. +final class MapEventCameraIdle extends MapEvent { + /// Create a new [MapEventCameraIdle] object. + const MapEventCameraIdle(); +} diff --git a/lib/src/native/pigeon.g.dart b/lib/src/native/pigeon.g.dart index a2e9e6c..87060c2 100644 --- a/lib/src/native/pigeon.g.dart +++ b/lib/src/native/pigeon.g.dart @@ -1244,6 +1244,9 @@ abstract class MapLibreFlutterApi { /// Callback when the map idles. void onIdle(); + /// Callback when the map camera idles. + void onCameraIdle(); + /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). void onSecondaryClick(LngLat point); @@ -1362,6 +1365,29 @@ abstract class MapLibreFlutterApi { }); } } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.onCameraIdle(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } { final BasicMessageChannel< Object?> pigeonVar_channel = BasicMessageChannel< diff --git a/lib/src/native/widget_state.dart b/lib/src/native/widget_state.dart index 1b340ec..e756b23 100644 --- a/lib/src/native/widget_state.dart +++ b/lib/src/native/widget_state.dart @@ -306,6 +306,9 @@ final class MapLibreMapStateNative extends State @override void onIdle() => widget.onEvent?.call(const MapEventIdle()); + @override + void onCameraIdle() => widget.onEvent?.call(const MapEventCameraIdle()); + @override void onDoubleClick(pigeon.LngLat point) { final position = point.toPosition(); diff --git a/lib/src/web/widget_state.dart b/lib/src/web/widget_state.dart index cb84452..01333e1 100644 --- a/lib/src/web/widget_state.dart +++ b/lib/src/web/widget_state.dart @@ -163,6 +163,7 @@ final class MapLibreMapStateWeb extends State _map.on( interop.MapEventType.moveEnd, (interop.MapLibreEvent event) { + widget.onEvent?.call(const MapEventCameraIdle()); if (_moveCompleter?.isCompleted ?? true) return; _moveCompleter?.complete(event); }.toJS, diff --git a/linux/pigeon.g.cc b/linux/pigeon.g.cc index a2fc776..bbec5c3 100644 --- a/linux/pigeon.g.cc +++ b/linux/pigeon.g.cc @@ -3304,6 +3304,84 @@ MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle return maplibre_map_libre_flutter_api_on_idle_response_new(response); } +struct _MaplibreMapLibreFlutterApiOnCameraIdleResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_idle_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_init(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_class_init(MaplibreMapLibreFlutterApiOnCameraIdleResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_idle_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_idle_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_idle_cb, task); +} + +MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_camera_idle_response_new(response); +} + struct _MaplibreMapLibreFlutterApiOnSecondaryClickResponse { GObject parent_instance; diff --git a/linux/pigeon.g.h b/linux/pigeon.g.h index 00dda51..84db585 100644 --- a/linux/pigeon.g.h +++ b/linux/pigeon.g.h @@ -1170,6 +1170,48 @@ const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(M */ FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* response); +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Checks if a response to MapLibreFlutterApi.onCameraIdle is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE, GObject) /** @@ -1449,6 +1491,29 @@ void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* api, GCa */ MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); +/** + * maplibre_map_libre_flutter_api_on_camera_idle: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map camera idles. + */ +void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_camera_idle() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + /** * maplibre_map_libre_flutter_api_on_secondary_click: * @api: a #MaplibreMapLibreFlutterApi. diff --git a/macos/Classes/Pigeon.g.swift b/macos/Classes/Pigeon.g.swift index 7d8ef90..be85aa8 100644 --- a/macos/Classes/Pigeon.g.swift +++ b/macos/Classes/Pigeon.g.swift @@ -1031,6 +1031,8 @@ protocol MapLibreFlutterApiProtocol { func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) /// Callback when the map idles. func onIdle(completion: @escaping (Result) -> Void) + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) @@ -1130,6 +1132,25 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { diff --git a/pigeons/pigeon.dart b/pigeons/pigeon.dart index 4d72a83..d0cc47e 100644 --- a/pigeons/pigeon.dart +++ b/pigeons/pigeon.dart @@ -263,6 +263,9 @@ abstract interface class MapLibreFlutterApi { /// Callback when the map idles. void onIdle(); + /// Callback when the map camera idles. + void onCameraIdle(); + /// Callback when the user performs a secondary click on the map /// (e.g. by default a click with the right mouse button). void onSecondaryClick(LngLat point); diff --git a/windows/runner/pigeon.g.cpp b/windows/runner/pigeon.g.cpp index 54c55b8..544c829 100644 --- a/windows/runner/pigeon.g.cpp +++ b/windows/runner/pigeon.g.cpp @@ -1886,6 +1886,28 @@ void MapLibreFlutterApi::OnIdle( }); } +void MapLibreFlutterApi::OnCameraIdle( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + void MapLibreFlutterApi::OnSecondaryClick( const LngLat& point_arg, std::function&& on_success, diff --git a/windows/runner/pigeon.g.h b/windows/runner/pigeon.g.h index e9eb67b..4a56e63 100644 --- a/windows/runner/pigeon.g.h +++ b/windows/runner/pigeon.g.h @@ -593,6 +593,10 @@ class MapLibreFlutterApi { void OnIdle( std::function&& on_success, std::function&& on_error); + // Callback when the map camera idles. + void OnCameraIdle( + std::function&& on_success, + std::function&& on_error); // Callback when the user performs a secondary click on the map // (e.g. by default a click with the right mouse button). void OnSecondaryClick( From e14594c93fe44fd217391748a6b1529acf9b91d1 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:07:44 +0200 Subject: [PATCH 6/8] split raw pigeon files --- .../com/github/josxha/maplibre/Pigeon.g.kt | 982 +---- ios/Classes/Pigeon.g.swift | 989 +---- lib/src/native/pigeon.g.dart | 1306 +------ linux/pigeon.g.cc | 3305 +---------------- linux/pigeon.g.h | 1371 ------- macos/Classes/Pigeon.g.swift | 989 +---- pigeons/map_options.dart | 55 + pigeons/maplibre_flutter_api.dart | 32 + pigeons/maplibre_host_api.dart | 229 ++ pigeons/pigeon.dart | 318 +- windows/runner/pigeon.g.cpp | 1692 +-------- windows/runner/pigeon.g.h | 411 -- 12 files changed, 372 insertions(+), 11307 deletions(-) create mode 100644 pigeons/map_options.dart create mode 100644 pigeons/maplibre_flutter_api.dart create mode 100644 pigeons/maplibre_host_api.dart diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt index cdb570c..5b0a1e4 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt @@ -11,29 +11,6 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer -private fun wrapResult(result: Any?): List { - return listOf(result) -} - -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) - } -} - -private fun createConnectionError(channelName: String): FlutterError { - return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} - /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @property code The error code. @@ -79,73 +56,6 @@ enum class RasterDemEncoding(val raw: Int) { } } -/** - * The map options define initial values for the MapLibre map. - * - * Generated class from Pigeon that represents data sent in messages. - */ -data class MapOptions ( - /** The URL of the used map style. */ - val style: String, - /** The initial zoom level of the map. */ - val zoom: Double, - /** The initial tilt of the map. */ - val tilt: Double, - /** The initial bearing of the map. */ - val bearing: Double, - /** The initial center coordinates of the map. */ - val center: LngLat? = null, - /** The maximum bounding box of the map camera. */ - val maxBounds: LngLatBounds? = null, - /** The minimum zoom level of the map. */ - val minZoom: Double, - /** The maximum zoom level of the map. */ - val maxZoom: Double, - /** The minimum pitch / tilt of the map. */ - val minTilt: Double, - /** The maximum pitch / tilt of the map. */ - val maxTilt: Double, - /** If the native map should listen to click events. */ - val listensOnClick: Boolean, - /** If the native map should listen to long click events. */ - val listensOnLongClick: Boolean -) - { - companion object { - fun fromList(pigeonVar_list: List): MapOptions { - val style = pigeonVar_list[0] as String - val zoom = pigeonVar_list[1] as Double - val tilt = pigeonVar_list[2] as Double - val bearing = pigeonVar_list[3] as Double - val center = pigeonVar_list[4] as LngLat? - val maxBounds = pigeonVar_list[5] as LngLatBounds? - val minZoom = pigeonVar_list[6] as Double - val maxZoom = pigeonVar_list[7] as Double - val minTilt = pigeonVar_list[8] as Double - val maxTilt = pigeonVar_list[9] as Double - val listensOnClick = pigeonVar_list[10] as Boolean - val listensOnLongClick = pigeonVar_list[11] as Boolean - return MapOptions(style, zoom, tilt, bearing, center, maxBounds, minZoom, maxZoom, minTilt, maxTilt, listensOnClick, listensOnLongClick) - } - } - fun toList(): List { - return listOf( - style, - zoom, - tilt, - bearing, - center, - maxBounds, - minZoom, - maxZoom, - minTilt, - maxTilt, - listensOnClick, - listensOnLongClick, - ) - } -} - /** * A longitude/latitude coordinate object. * @@ -275,26 +185,21 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { } } 131.toByte() -> { - return (readValue(buffer) as? List)?.let { - MapOptions.fromList(it) - } - } - 132.toByte() -> { return (readValue(buffer) as? List)?.let { LngLat.fromList(it) } } - 133.toByte() -> { + 132.toByte() -> { return (readValue(buffer) as? List)?.let { ScreenLocation.fromList(it) } } - 134.toByte() -> { + 133.toByte() -> { return (readValue(buffer) as? List)?.let { MapCamera.fromList(it) } } - 135.toByte() -> { + 134.toByte() -> { return (readValue(buffer) as? List)?.let { LngLatBounds.fromList(it) } @@ -312,24 +217,20 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { stream.write(130) writeValue(stream, value.raw) } - is MapOptions -> { - stream.write(131) - writeValue(stream, value.toList()) - } is LngLat -> { - stream.write(132) + stream.write(131) writeValue(stream, value.toList()) } is ScreenLocation -> { - stream.write(133) + stream.write(132) writeValue(stream, value.toList()) } is MapCamera -> { - stream.write(134) + stream.write(133) writeValue(stream, value.toList()) } is LngLatBounds -> { - stream.write(135) + stream.write(134) writeValue(stream, value.toList()) } else -> super.writeValue(stream, value) @@ -337,872 +238,3 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { } } - -/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ -interface MapLibreHostApi { - /** Move the viewport of the map to a new location without any animation. */ - fun jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, callback: (Result) -> Unit) - /** Animate the viewport of the map to a new location. */ - fun flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Long, callback: (Result) -> Unit) - /** - * Get the current camera position with the map center, zoom level, camera - * tilt and map rotation. - */ - fun getCamera(callback: (Result) -> Unit) - /** Get the visible region of the current map camera. */ - fun getVisibleRegion(callback: (Result) -> Unit) - /** Convert a coordinate to a location on the screen. */ - fun toScreenLocation(lng: Double, lat: Double, callback: (Result) -> Unit) - /** Convert a screen location to a coordinate. */ - fun toLngLat(x: Double, y: Double, callback: (Result) -> Unit) - /** Add a fill layer to the map style. */ - fun addFillLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a circle layer to the map style. */ - fun addCircleLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a background layer to the map style. */ - fun addBackgroundLayer(id: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a fill extrusion layer to the map style. */ - fun addFillExtrusionLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a heatmap layer to the map style. */ - fun addHeatmapLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a hillshade layer to the map style. */ - fun addHillshadeLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a line layer to the map style. */ - fun addLineLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a raster layer to the map style. */ - fun addRasterLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Add a symbol layer to the map style. */ - fun addSymbolLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) - /** Removes the layer with the given ID from the map's style. */ - fun removeLayer(id: String, callback: (Result) -> Unit) - /** Removes the source with the given ID from the map's style. */ - fun removeSource(id: String, callback: (Result) -> Unit) - /** - * Loads an image to the map. An image needs to be loaded before it can - * get used. - */ - fun loadImage(url: String, callback: (Result) -> Unit) - /** Add an image to the map. */ - fun addImage(id: String, bytes: ByteArray, callback: (Result) -> Unit) - /** Removes an image from the map */ - fun removeImage(id: String, callback: (Result) -> Unit) - /** Add a GeoJSON source to the map style. */ - fun addGeoJsonSource(id: String, data: String, callback: (Result) -> Unit) - /** Update the data of a GeoJSON source. */ - fun updateGeoJsonSource(id: String, data: String, callback: (Result) -> Unit) - /** Add a image source to the map style. */ - fun addImageSource(id: String, url: String, coordinates: List, callback: (Result) -> Unit) - /** Add a raster source to the map style. */ - fun addRasterSource(id: String, url: String?, tiles: List?, bounds: List, minZoom: Double, maxZoom: Double, tileSize: Long, scheme: TileScheme, attribution: String?, volatile: Boolean, callback: (Result) -> Unit) - /** Add a raster DEM source to the map style. */ - fun addRasterDemSource(id: String, url: String?, tiles: List?, bounds: List, minZoom: Double, maxZoom: Double, tileSize: Long, attribution: String?, encoding: RasterDemEncoding, volatile: Boolean, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, callback: (Result) -> Unit) - /** Add a vector source to the map style. */ - fun addVectorSource(id: String, url: String?, tiles: List?, bounds: List, scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Boolean, sourceLayer: String?, callback: (Result) -> Unit) - /** - * Returns the distance spanned by one pixel at the specified latitude and - * current zoom level. - */ - fun getMetersPerPixelAtLatitude(latitude: Double): Double - /** Update the map options. */ - fun updateOptions(options: MapOptions, callback: (Result) -> Unit) - - companion object { - /** The codec used by MapLibreHostApi. */ - val codec: MessageCodec by lazy { - PigeonPigeonCodec() - } - /** Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. */ - @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val centerArg = args[0] as LngLat? - val zoomArg = args[1] as Double? - val bearingArg = args[2] as Double? - val pitchArg = args[3] as Double? - api.jumpTo(centerArg, zoomArg, bearingArg, pitchArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val centerArg = args[0] as LngLat? - val zoomArg = args[1] as Double? - val bearingArg = args[2] as Double? - val pitchArg = args[3] as Double? - val durationMsArg = args[4] as Long - api.flyTo(centerArg, zoomArg, bearingArg, pitchArg, durationMsArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { _, reply -> - api.getCamera{ result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { _, reply -> - api.getVisibleRegion{ result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val lngArg = args[0] as Double - val latArg = args[1] as Double - api.toScreenLocation(lngArg, latArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val xArg = args[0] as Double - val yArg = args[1] as Double - api.toLngLat(xArg, yArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addFillLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addCircleLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val layoutArg = args[1] as Map - val paintArg = args[2] as Map - val belowLayerIdArg = args[3] as String? - api.addBackgroundLayer(idArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addFillExtrusionLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addHeatmapLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addHillshadeLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addLineLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addRasterLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val sourceIdArg = args[1] as String - val layoutArg = args[2] as Map - val paintArg = args[3] as Map - val belowLayerIdArg = args[4] as String? - api.addSymbolLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - api.removeLayer(idArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - api.removeSource(idArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val urlArg = args[0] as String - api.loadImage(urlArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val bytesArg = args[1] as ByteArray - api.addImage(idArg, bytesArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - api.removeImage(idArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val dataArg = args[1] as String - api.addGeoJsonSource(idArg, dataArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val dataArg = args[1] as String - api.updateGeoJsonSource(idArg, dataArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val urlArg = args[1] as String - val coordinatesArg = args[2] as List - api.addImageSource(idArg, urlArg, coordinatesArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val urlArg = args[1] as String? - val tilesArg = args[2] as List? - val boundsArg = args[3] as List - val minZoomArg = args[4] as Double - val maxZoomArg = args[5] as Double - val tileSizeArg = args[6] as Long - val schemeArg = args[7] as TileScheme - val attributionArg = args[8] as String? - val volatileArg = args[9] as Boolean - api.addRasterSource(idArg, urlArg, tilesArg, boundsArg, minZoomArg, maxZoomArg, tileSizeArg, schemeArg, attributionArg, volatileArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val urlArg = args[1] as String? - val tilesArg = args[2] as List? - val boundsArg = args[3] as List - val minZoomArg = args[4] as Double - val maxZoomArg = args[5] as Double - val tileSizeArg = args[6] as Long - val attributionArg = args[7] as String? - val encodingArg = args[8] as RasterDemEncoding - val volatileArg = args[9] as Boolean - val redFactorArg = args[10] as Double - val blueFactorArg = args[11] as Double - val greenFactorArg = args[12] as Double - val baseShiftArg = args[13] as Double - api.addRasterDemSource(idArg, urlArg, tilesArg, boundsArg, minZoomArg, maxZoomArg, tileSizeArg, attributionArg, encodingArg, volatileArg, redFactorArg, blueFactorArg, greenFactorArg, baseShiftArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val idArg = args[0] as String - val urlArg = args[1] as String? - val tilesArg = args[2] as List? - val boundsArg = args[3] as List - val schemeArg = args[4] as TileScheme - val minZoomArg = args[5] as Double - val maxZoomArg = args[6] as Double - val attributionArg = args[7] as String? - val volatileArg = args[8] as Boolean - val sourceLayerArg = args[9] as String? - api.addVectorSource(idArg, urlArg, tilesArg, boundsArg, schemeArg, minZoomArg, maxZoomArg, attributionArg, volatileArg, sourceLayerArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val latitudeArg = args[0] as Double - val wrapped: List = try { - listOf(api.getMetersPerPixelAtLatitude(latitudeArg)) - } catch (exception: Throwable) { - wrapError(exception) - } - reply.reply(wrapped) - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val optionsArg = args[0] as MapOptions - api.updateOptions(optionsArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(wrapError(error)) - } else { - reply.reply(wrapResult(null)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - } - } -} -/** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { - companion object { - /** The codec used by MapLibreFlutterApi. */ - val codec: MessageCodec by lazy { - PigeonPigeonCodec() - } - } - /** Get the map options from dart. */ - fun getOptions(callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(null) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else if (it[0] == null) { - callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) - } else { - val output = it[0] as MapOptions - callback(Result.success(output)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback for when the style has been loaded. */ - fun onStyleLoaded(callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(null) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the user clicks on the map. */ - fun onClick(pointArg: LngLat, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pointArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the map idles. */ - fun onIdle(callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(null) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the map camera idles. */ - fun onCameraIdle(callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(null) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** - * Callback when the user performs a secondary click on the map - * (e.g. by default a click with the right mouse button). - */ - fun onSecondaryClick(pointArg: LngLat, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pointArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the user performs a double click on the map. */ - fun onDoubleClick(pointArg: LngLat, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pointArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the user performs a long lasting click on the map. */ - fun onLongClick(pointArg: LngLat, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pointArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } - /** Callback when the map camera changes. */ - fun onCameraMoved(cameraArg: MapCamera, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$separatedMessageChannelSuffix" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(cameraArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } - } - } -} diff --git a/ios/Classes/Pigeon.g.swift b/ios/Classes/Pigeon.g.swift index be85aa8..d6711ca 100644 --- a/ios/Classes/Pigeon.g.swift +++ b/ios/Classes/Pigeon.g.swift @@ -29,36 +29,6 @@ final class PigeonError: Error { } } -private func wrapResult(_ result: Any?) -> [Any?] { - return [result] -} - -private func wrapError(_ error: Any) -> [Any?] { - if let pigeonError = error as? PigeonError { - return [ - pigeonError.code, - pigeonError.message, - pigeonError.details, - ] - } - if let flutterError = error as? FlutterError { - return [ - flutterError.code, - flutterError.message, - flutterError.details, - ] - } - return [ - "\(error)", - "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)", - ] -} - -private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") -} - private func isNullish(_ value: Any?) -> Bool { return value is NSNull || value == nil } @@ -87,85 +57,6 @@ enum RasterDemEncoding: Int { case custom = 2 } -/// The map options define initial values for the MapLibre map. -/// -/// Generated class from Pigeon that represents data sent in messages. -struct MapOptions { - /// The URL of the used map style. - var style: String - /// The initial zoom level of the map. - var zoom: Double - /// The initial tilt of the map. - var tilt: Double - /// The initial bearing of the map. - var bearing: Double - /// The initial center coordinates of the map. - var center: LngLat? = nil - /// The maximum bounding box of the map camera. - var maxBounds: LngLatBounds? = nil - /// The minimum zoom level of the map. - var minZoom: Double - /// The maximum zoom level of the map. - var maxZoom: Double - /// The minimum pitch / tilt of the map. - var minTilt: Double - /// The maximum pitch / tilt of the map. - var maxTilt: Double - /// If the native map should listen to click events. - var listensOnClick: Bool - /// If the native map should listen to long click events. - var listensOnLongClick: Bool - - - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> MapOptions? { - let style = pigeonVar_list[0] as! String - let zoom = pigeonVar_list[1] as! Double - let tilt = pigeonVar_list[2] as! Double - let bearing = pigeonVar_list[3] as! Double - let center: LngLat? = nilOrValue(pigeonVar_list[4]) - let maxBounds: LngLatBounds? = nilOrValue(pigeonVar_list[5]) - let minZoom = pigeonVar_list[6] as! Double - let maxZoom = pigeonVar_list[7] as! Double - let minTilt = pigeonVar_list[8] as! Double - let maxTilt = pigeonVar_list[9] as! Double - let listensOnClick = pigeonVar_list[10] as! Bool - let listensOnLongClick = pigeonVar_list[11] as! Bool - - return MapOptions( - style: style, - zoom: zoom, - tilt: tilt, - bearing: bearing, - center: center, - maxBounds: maxBounds, - minZoom: minZoom, - maxZoom: maxZoom, - minTilt: minTilt, - maxTilt: maxTilt, - listensOnClick: listensOnClick, - listensOnLongClick: listensOnLongClick - ) - } - func toList() -> [Any?] { - return [ - style, - zoom, - tilt, - bearing, - center, - maxBounds, - minZoom, - maxZoom, - minTilt, - maxTilt, - listensOnClick, - listensOnLongClick, - ] - } -} - /// A longitude/latitude coordinate object. /// /// Generated class from Pigeon that represents data sent in messages. @@ -310,14 +201,12 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return MapOptions.fromList(self.readValue() as! [Any?]) - case 132: return LngLat.fromList(self.readValue() as! [Any?]) - case 133: + case 132: return ScreenLocation.fromList(self.readValue() as! [Any?]) - case 134: + case 133: return MapCamera.fromList(self.readValue() as! [Any?]) - case 135: + case 134: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -333,20 +222,17 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? MapOptions { - super.writeByte(131) - super.writeValue(value.toList()) } else if let value = value as? LngLat { - super.writeByte(132) + super.writeByte(131) super.writeValue(value.toList()) } else if let value = value as? ScreenLocation { - super.writeByte(133) + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? MapCamera { - super.writeByte(134) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? LngLatBounds { - super.writeByte(135) + super.writeByte(134) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -368,864 +254,3 @@ class PigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { static let shared = PigeonPigeonCodec(readerWriter: PigeonPigeonCodecReaderWriter()) } - -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol MapLibreHostApi { - /// Move the viewport of the map to a new location without any animation. - func jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, completion: @escaping (Result) -> Void) - /// Animate the viewport of the map to a new location. - func flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Int64, completion: @escaping (Result) -> Void) - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - func getCamera(completion: @escaping (Result) -> Void) - /// Get the visible region of the current map camera. - func getVisibleRegion(completion: @escaping (Result) -> Void) - /// Convert a coordinate to a location on the screen. - func toScreenLocation(lng: Double, lat: Double, completion: @escaping (Result) -> Void) - /// Convert a screen location to a coordinate. - func toLngLat(x: Double, y: Double, completion: @escaping (Result) -> Void) - /// Add a fill layer to the map style. - func addFillLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a circle layer to the map style. - func addCircleLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a background layer to the map style. - func addBackgroundLayer(id: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a fill extrusion layer to the map style. - func addFillExtrusionLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a heatmap layer to the map style. - func addHeatmapLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a hillshade layer to the map style. - func addHillshadeLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a line layer to the map style. - func addLineLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a raster layer to the map style. - func addRasterLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a symbol layer to the map style. - func addSymbolLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Removes the layer with the given ID from the map's style. - func removeLayer(id: String, completion: @escaping (Result) -> Void) - /// Removes the source with the given ID from the map's style. - func removeSource(id: String, completion: @escaping (Result) -> Void) - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - func loadImage(url: String, completion: @escaping (Result) -> Void) - /// Add an image to the map. - func addImage(id: String, bytes: FlutterStandardTypedData, completion: @escaping (Result) -> Void) - /// Removes an image from the map - func removeImage(id: String, completion: @escaping (Result) -> Void) - /// Add a GeoJSON source to the map style. - func addGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) - /// Update the data of a GeoJSON source. - func updateGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) - /// Add a image source to the map style. - func addImageSource(id: String, url: String, coordinates: [LngLat], completion: @escaping (Result) -> Void) - /// Add a raster source to the map style. - func addRasterSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, scheme: TileScheme, attribution: String?, volatile: Bool, completion: @escaping (Result) -> Void) - /// Add a raster DEM source to the map style. - func addRasterDemSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, attribution: String?, encoding: RasterDemEncoding, volatile: Bool, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, completion: @escaping (Result) -> Void) - /// Add a vector source to the map style. - func addVectorSource(id: String, url: String?, tiles: [String]?, bounds: [Double], scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Bool, sourceLayer: String?, completion: @escaping (Result) -> Void) - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - func getMetersPerPixelAtLatitude(latitude: Double) throws -> Double - /// Update the map options. - func updateOptions(options: MapOptions, completion: @escaping (Result) -> Void) -} - -/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -class MapLibreHostApiSetup { - static var codec: FlutterStandardMessageCodec { PigeonPigeonCodec.shared } - /// Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { - let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - /// Move the viewport of the map to a new location without any animation. - let jumpToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - jumpToChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let centerArg: LngLat? = nilOrValue(args[0]) - let zoomArg: Double? = nilOrValue(args[1]) - let bearingArg: Double? = nilOrValue(args[2]) - let pitchArg: Double? = nilOrValue(args[3]) - api.jumpTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - jumpToChannel.setMessageHandler(nil) - } - /// Animate the viewport of the map to a new location. - let flyToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - flyToChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let centerArg: LngLat? = nilOrValue(args[0]) - let zoomArg: Double? = nilOrValue(args[1]) - let bearingArg: Double? = nilOrValue(args[2]) - let pitchArg: Double? = nilOrValue(args[3]) - let durationMsArg = args[4] as! Int64 - api.flyTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg, durationMs: durationMsArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - flyToChannel.setMessageHandler(nil) - } - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - let getCameraChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCameraChannel.setMessageHandler { _, reply in - api.getCamera { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getCameraChannel.setMessageHandler(nil) - } - /// Get the visible region of the current map camera. - let getVisibleRegionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getVisibleRegionChannel.setMessageHandler { _, reply in - api.getVisibleRegion { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getVisibleRegionChannel.setMessageHandler(nil) - } - /// Convert a coordinate to a location on the screen. - let toScreenLocationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - toScreenLocationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let lngArg = args[0] as! Double - let latArg = args[1] as! Double - api.toScreenLocation(lng: lngArg, lat: latArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - toScreenLocationChannel.setMessageHandler(nil) - } - /// Convert a screen location to a coordinate. - let toLngLatChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - toLngLatChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let xArg = args[0] as! Double - let yArg = args[1] as! Double - api.toLngLat(x: xArg, y: yArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - toLngLatChannel.setMessageHandler(nil) - } - /// Add a fill layer to the map style. - let addFillLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addFillLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addFillLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addFillLayerChannel.setMessageHandler(nil) - } - /// Add a circle layer to the map style. - let addCircleLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addCircleLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addCircleLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addCircleLayerChannel.setMessageHandler(nil) - } - /// Add a background layer to the map style. - let addBackgroundLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addBackgroundLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let layoutArg = args[1] as! [String: Any] - let paintArg = args[2] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[3]) - api.addBackgroundLayer(id: idArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addBackgroundLayerChannel.setMessageHandler(nil) - } - /// Add a fill extrusion layer to the map style. - let addFillExtrusionLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addFillExtrusionLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addFillExtrusionLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addFillExtrusionLayerChannel.setMessageHandler(nil) - } - /// Add a heatmap layer to the map style. - let addHeatmapLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addHeatmapLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addHeatmapLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addHeatmapLayerChannel.setMessageHandler(nil) - } - /// Add a hillshade layer to the map style. - let addHillshadeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addHillshadeLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addHillshadeLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addHillshadeLayerChannel.setMessageHandler(nil) - } - /// Add a line layer to the map style. - let addLineLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addLineLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addLineLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addLineLayerChannel.setMessageHandler(nil) - } - /// Add a raster layer to the map style. - let addRasterLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addRasterLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterLayerChannel.setMessageHandler(nil) - } - /// Add a symbol layer to the map style. - let addSymbolLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addSymbolLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addSymbolLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addSymbolLayerChannel.setMessageHandler(nil) - } - /// Removes the layer with the given ID from the map's style. - let removeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeLayer(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeLayerChannel.setMessageHandler(nil) - } - /// Removes the source with the given ID from the map's style. - let removeSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeSource(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeSourceChannel.setMessageHandler(nil) - } - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - let loadImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let urlArg = args[0] as! String - api.loadImage(url: urlArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - loadImageChannel.setMessageHandler(nil) - } - /// Add an image to the map. - let addImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let bytesArg = args[1] as! FlutterStandardTypedData - api.addImage(id: idArg, bytes: bytesArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addImageChannel.setMessageHandler(nil) - } - /// Removes an image from the map - let removeImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeImage(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeImageChannel.setMessageHandler(nil) - } - /// Add a GeoJSON source to the map style. - let addGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addGeoJsonSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let dataArg = args[1] as! String - api.addGeoJsonSource(id: idArg, data: dataArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addGeoJsonSourceChannel.setMessageHandler(nil) - } - /// Update the data of a GeoJSON source. - let updateGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - updateGeoJsonSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let dataArg = args[1] as! String - api.updateGeoJsonSource(id: idArg, data: dataArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - updateGeoJsonSourceChannel.setMessageHandler(nil) - } - /// Add a image source to the map style. - let addImageSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addImageSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg = args[1] as! String - let coordinatesArg = args[2] as! [LngLat] - api.addImageSource(id: idArg, url: urlArg, coordinates: coordinatesArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addImageSourceChannel.setMessageHandler(nil) - } - /// Add a raster source to the map style. - let addRasterSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let minZoomArg = args[4] as! Double - let maxZoomArg = args[5] as! Double - let tileSizeArg = args[6] as! Int64 - let schemeArg = args[7] as! TileScheme - let attributionArg: String? = nilOrValue(args[8]) - let volatileArg = args[9] as! Bool - api.addRasterSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, scheme: schemeArg, attribution: attributionArg, volatile: volatileArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterSourceChannel.setMessageHandler(nil) - } - /// Add a raster DEM source to the map style. - let addRasterDemSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterDemSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let minZoomArg = args[4] as! Double - let maxZoomArg = args[5] as! Double - let tileSizeArg = args[6] as! Int64 - let attributionArg: String? = nilOrValue(args[7]) - let encodingArg = args[8] as! RasterDemEncoding - let volatileArg = args[9] as! Bool - let redFactorArg = args[10] as! Double - let blueFactorArg = args[11] as! Double - let greenFactorArg = args[12] as! Double - let baseShiftArg = args[13] as! Double - api.addRasterDemSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, attribution: attributionArg, encoding: encodingArg, volatile: volatileArg, redFactor: redFactorArg, blueFactor: blueFactorArg, greenFactor: greenFactorArg, baseShift: baseShiftArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterDemSourceChannel.setMessageHandler(nil) - } - /// Add a vector source to the map style. - let addVectorSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addVectorSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let schemeArg = args[4] as! TileScheme - let minZoomArg = args[5] as! Double - let maxZoomArg = args[6] as! Double - let attributionArg: String? = nilOrValue(args[7]) - let volatileArg = args[8] as! Bool - let sourceLayerArg: String? = nilOrValue(args[9]) - api.addVectorSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, scheme: schemeArg, minZoom: minZoomArg, maxZoom: maxZoomArg, attribution: attributionArg, volatile: volatileArg, sourceLayer: sourceLayerArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addVectorSourceChannel.setMessageHandler(nil) - } - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - let getMetersPerPixelAtLatitudeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getMetersPerPixelAtLatitudeChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let latitudeArg = args[0] as! Double - do { - let result = try api.getMetersPerPixelAtLatitude(latitude: latitudeArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - getMetersPerPixelAtLatitudeChannel.setMessageHandler(nil) - } - /// Update the map options. - let updateOptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - updateOptionsChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let optionsArg = args[0] as! MapOptions - api.updateOptions(options: optionsArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - updateOptionsChannel.setMessageHandler(nil) - } - } -} -/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. -protocol MapLibreFlutterApiProtocol { - /// Get the map options from dart. - func getOptions(completion: @escaping (Result) -> Void) - /// Callback for when the style has been loaded. - func onStyleLoaded(completion: @escaping (Result) -> Void) - /// Callback when the user clicks on the map. - func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the map idles. - func onIdle(completion: @escaping (Result) -> Void) - /// Callback when the map camera idles. - func onCameraIdle(completion: @escaping (Result) -> Void) - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the user performs a double click on the map. - func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the user performs a long lasting click on the map. - func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) -} -class MapLibreFlutterApi: MapLibreFlutterApiProtocol { - private let binaryMessenger: FlutterBinaryMessenger - private let messageChannelSuffix: String - init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { - self.binaryMessenger = binaryMessenger - self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - } - var codec: PigeonPigeonCodec { - return PigeonPigeonCodec.shared - } - /// Get the map options from dart. - func getOptions(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! MapOptions - completion(.success(result)) - } - } - } - /// Callback for when the style has been loaded. - func onStyleLoaded(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user clicks on the map. - func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map idles. - func onIdle(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map camera idles. - func onCameraIdle(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a double click on the map. - func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a long lasting click on the map. - func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([cameraArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } -} diff --git a/lib/src/native/pigeon.g.dart b/lib/src/native/pigeon.g.dart index 87060c2..f545479 100644 --- a/lib/src/native/pigeon.g.dart +++ b/lib/src/native/pigeon.g.dart @@ -8,24 +8,6 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); -} - -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { - if (empty) { - return []; - } - if (error == null) { - return [result]; - } - return [error.code, error.message, error.details]; -} - /// Influences the y direction of the tile coordinates. enum TileScheme { /// Slippy map tilenames scheme. @@ -48,95 +30,6 @@ enum RasterDemEncoding { custom, } -/// The map options define initial values for the MapLibre map. -class MapOptions { - MapOptions({ - required this.style, - required this.zoom, - required this.tilt, - required this.bearing, - this.center, - this.maxBounds, - required this.minZoom, - required this.maxZoom, - required this.minTilt, - required this.maxTilt, - required this.listensOnClick, - required this.listensOnLongClick, - }); - - /// The URL of the used map style. - String style; - - /// The initial zoom level of the map. - double zoom; - - /// The initial tilt of the map. - double tilt; - - /// The initial bearing of the map. - double bearing; - - /// The initial center coordinates of the map. - LngLat? center; - - /// The maximum bounding box of the map camera. - LngLatBounds? maxBounds; - - /// The minimum zoom level of the map. - double minZoom; - - /// The maximum zoom level of the map. - double maxZoom; - - /// The minimum pitch / tilt of the map. - double minTilt; - - /// The maximum pitch / tilt of the map. - double maxTilt; - - /// If the native map should listen to click events. - bool listensOnClick; - - /// If the native map should listen to long click events. - bool listensOnLongClick; - - Object encode() { - return [ - style, - zoom, - tilt, - bearing, - center, - maxBounds, - minZoom, - maxZoom, - minTilt, - maxTilt, - listensOnClick, - listensOnLongClick, - ]; - } - - static MapOptions decode(Object result) { - result as List; - return MapOptions( - style: result[0]! as String, - zoom: result[1]! as double, - tilt: result[2]! as double, - bearing: result[3]! as double, - center: result[4] as LngLat?, - maxBounds: result[5] as LngLatBounds?, - minZoom: result[6]! as double, - maxZoom: result[7]! as double, - minTilt: result[8]! as double, - maxTilt: result[9]! as double, - listensOnClick: result[10]! as bool, - listensOnLongClick: result[11]! as bool, - ); - } -} - /// A longitude/latitude coordinate object. class LngLat { LngLat({ @@ -282,20 +175,17 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is RasterDemEncoding) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is MapOptions) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); } else if (value is LngLat) { - buffer.putUint8(132); + buffer.putUint8(131); writeValue(buffer, value.encode()); } else if (value is ScreenLocation) { - buffer.putUint8(133); + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is MapCamera) { - buffer.putUint8(134); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else if (value is LngLatBounds) { - buffer.putUint8(135); + buffer.putUint8(134); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -312,1197 +202,15 @@ class _PigeonCodec extends StandardMessageCodec { final int? value = readValue(buffer) as int?; return value == null ? null : RasterDemEncoding.values[value]; case 131: - return MapOptions.decode(readValue(buffer)!); - case 132: return LngLat.decode(readValue(buffer)!); - case 133: + case 132: return ScreenLocation.decode(readValue(buffer)!); - case 134: + case 133: return MapCamera.decode(readValue(buffer)!); - case 135: + case 134: return LngLatBounds.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } } } - -class MapLibreHostApi { - /// Constructor for [MapLibreHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - MapLibreHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; - - static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - - final String pigeonVar_messageChannelSuffix; - - /// Move the viewport of the map to a new location without any animation. - Future jumpTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([center, zoom, bearing, pitch]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Animate the viewport of the map to a new location. - Future flyTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - required int durationMs, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([center, zoom, bearing, pitch, durationMs]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - Future getCamera() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as MapCamera?)!; - } - } - - /// Get the visible region of the current map camera. - Future getVisibleRegion() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as LngLatBounds?)!; - } - } - - /// Convert a coordinate to a location on the screen. - Future toScreenLocation(double lng, double lat) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([lng, lat]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as ScreenLocation?)!; - } - } - - /// Convert a screen location to a coordinate. - Future toLngLat(double x, double y) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([x, y]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as LngLat?)!; - } - } - - /// Add a fill layer to the map style. - Future addFillLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a circle layer to the map style. - Future addCircleLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a background layer to the map style. - Future addBackgroundLayer({ - required String id, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, layout, paint, belowLayerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a fill extrusion layer to the map style. - Future addFillExtrusionLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a heatmap layer to the map style. - Future addHeatmapLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a hillshade layer to the map style. - Future addHillshadeLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a line layer to the map style. - Future addLineLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a raster layer to the map style. - Future addRasterLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a symbol layer to the map style. - Future addSymbolLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, sourceId, layout, paint, belowLayerId]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Removes the layer with the given ID from the map's style. - Future removeLayer(String id) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Removes the source with the given ID from the map's style. - Future removeSource(String id) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - Future loadImage(String url) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([url]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Uint8List?)!; - } - } - - /// Add an image to the map. - Future addImage(String id, Uint8List bytes) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id, bytes]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Removes an image from the map - Future removeImage(String id) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a GeoJSON source to the map style. - Future addGeoJsonSource( - {required String id, required String data}) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id, data]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Update the data of a GeoJSON source. - Future updateGeoJsonSource( - {required String id, required String data}) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([id, data]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a image source to the map style. - Future addImageSource({ - required String id, - required String url, - required List coordinates, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([id, url, coordinates]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a raster source to the map style. - Future addRasterSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required TileScheme scheme, - required String? attribution, - required bool volatile, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([ - id, - url, - tiles, - bounds, - minZoom, - maxZoom, - tileSize, - scheme, - attribution, - volatile - ]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a raster DEM source to the map style. - Future addRasterDemSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required String? attribution, - required RasterDemEncoding encoding, - required bool volatile, - double redFactor = 1, - double blueFactor = 1, - double greenFactor = 1, - double baseShift = 0, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([ - id, - url, - tiles, - bounds, - minZoom, - maxZoom, - tileSize, - attribution, - encoding, - volatile, - redFactor, - blueFactor, - greenFactor, - baseShift - ]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Add a vector source to the map style. - Future addVectorSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required TileScheme scheme, - required double minZoom, - required double maxZoom, - required String? attribution, - required bool volatile, - required String? sourceLayer, - }) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([ - id, - url, - tiles, - bounds, - scheme, - minZoom, - maxZoom, - attribution, - volatile, - sourceLayer - ]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } - - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - Future getMetersPerPixelAtLatitude(double latitude) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([latitude]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as double?)!; - } - } - - /// Update the map options. - Future updateOptions(MapOptions options) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([options]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } - } -} - -abstract class MapLibreFlutterApi { - static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - - /// Get the map options from dart. - MapOptions getOptions(); - - /// Callback for when the style has been loaded. - void onStyleLoaded(); - - /// Callback when the user clicks on the map. - void onClick(LngLat point); - - /// Callback when the map idles. - void onIdle(); - - /// Callback when the map camera idles. - void onCameraIdle(); - - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - void onSecondaryClick(LngLat point); - - /// Callback when the user performs a double click on the map. - void onDoubleClick(LngLat point); - - /// Callback when the user performs a long lasting click on the map. - void onLongClick(LngLat point); - - /// Callback when the map camera changes. - void onCameraMoved(MapCamera camera); - - static void setUp( - MapLibreFlutterApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - try { - final MapOptions output = api.getOptions(); - return wrapResponse(result: output); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - try { - api.onStyleLoaded(); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null.'); - final List args = (message as List?)!; - final LngLat? arg_point = (args[0] as LngLat?); - assert(arg_point != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null, expected non-null LngLat.'); - try { - api.onClick(arg_point!); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - try { - api.onIdle(); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - try { - api.onCameraIdle(); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null.'); - final List args = (message as List?)!; - final LngLat? arg_point = (args[0] as LngLat?); - assert(arg_point != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null, expected non-null LngLat.'); - try { - api.onSecondaryClick(arg_point!); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null.'); - final List args = (message as List?)!; - final LngLat? arg_point = (args[0] as LngLat?); - assert(arg_point != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null, expected non-null LngLat.'); - try { - api.onDoubleClick(arg_point!); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null.'); - final List args = (message as List?)!; - final LngLat? arg_point = (args[0] as LngLat?); - assert(arg_point != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null, expected non-null LngLat.'); - try { - api.onLongClick(arg_point!); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (api == null) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null.'); - final List args = (message as List?)!; - final MapCamera? arg_camera = (args[0] as MapCamera?); - assert(arg_camera != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null, expected non-null MapCamera.'); - try { - api.onCameraMoved(arg_camera!); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - } -} diff --git a/linux/pigeon.g.cc b/linux/pigeon.g.cc index bbec5c3..42e47d4 100644 --- a/linux/pigeon.g.cc +++ b/linux/pigeon.g.cc @@ -3,178 +3,6 @@ #include "pigeon.g.h" -struct _MaplibreMapOptions { - GObject parent_instance; - - gchar* style; - double zoom; - double tilt; - double bearing; - MaplibreLngLat* center; - MaplibreLngLatBounds* max_bounds; - double min_zoom; - double max_zoom; - double min_tilt; - double max_tilt; - gboolean listens_on_click; - gboolean listens_on_long_click; -}; - -G_DEFINE_TYPE(MaplibreMapOptions, maplibre_map_options, G_TYPE_OBJECT) - -static void maplibre_map_options_dispose(GObject* object) { - MaplibreMapOptions* self = MAPLIBRE_MAP_OPTIONS(object); - g_clear_pointer(&self->style, g_free); - g_clear_object(&self->center); - g_clear_object(&self->max_bounds); - G_OBJECT_CLASS(maplibre_map_options_parent_class)->dispose(object); -} - -static void maplibre_map_options_init(MaplibreMapOptions* self) { -} - -static void maplibre_map_options_class_init(MaplibreMapOptionsClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_options_dispose; -} - -MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double tilt, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_tilt, double max_tilt, gboolean listens_on_click, gboolean listens_on_long_click) { - MaplibreMapOptions* self = MAPLIBRE_MAP_OPTIONS(g_object_new(maplibre_map_options_get_type(), nullptr)); - self->style = g_strdup(style); - self->zoom = zoom; - self->tilt = tilt; - self->bearing = bearing; - if (center != nullptr) { - self->center = MAPLIBRE_LNG_LAT(g_object_ref(center)); - } - else { - self->center = nullptr; - } - if (max_bounds != nullptr) { - self->max_bounds = MAPLIBRE_LNG_LAT_BOUNDS(g_object_ref(max_bounds)); - } - else { - self->max_bounds = nullptr; - } - self->min_zoom = min_zoom; - self->max_zoom = max_zoom; - self->min_tilt = min_tilt; - self->max_tilt = max_tilt; - self->listens_on_click = listens_on_click; - self->listens_on_long_click = listens_on_long_click; - return self; -} - -const gchar* maplibre_map_options_get_style(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); - return self->style; -} - -double maplibre_map_options_get_zoom(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->zoom; -} - -double maplibre_map_options_get_tilt(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->tilt; -} - -double maplibre_map_options_get_bearing(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->bearing; -} - -MaplibreLngLat* maplibre_map_options_get_center(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); - return self->center; -} - -MaplibreLngLatBounds* maplibre_map_options_get_max_bounds(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); - return self->max_bounds; -} - -double maplibre_map_options_get_min_zoom(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->min_zoom; -} - -double maplibre_map_options_get_max_zoom(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->max_zoom; -} - -double maplibre_map_options_get_min_tilt(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->min_tilt; -} - -double maplibre_map_options_get_max_tilt(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); - return self->max_tilt; -} - -gboolean maplibre_map_options_get_listens_on_click(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE); - return self->listens_on_click; -} - -gboolean maplibre_map_options_get_listens_on_long_click(MaplibreMapOptions* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE); - return self->listens_on_long_click; -} - -static FlValue* maplibre_map_options_to_list(MaplibreMapOptions* self) { - FlValue* values = fl_value_new_list(); - fl_value_append_take(values, fl_value_new_string(self->style)); - fl_value_append_take(values, fl_value_new_float(self->zoom)); - fl_value_append_take(values, fl_value_new_float(self->tilt)); - fl_value_append_take(values, fl_value_new_float(self->bearing)); - fl_value_append_take(values, self->center != nullptr ? fl_value_new_custom_object(132, G_OBJECT(self->center)) : fl_value_new_null()); - fl_value_append_take(values, self->max_bounds != nullptr ? fl_value_new_custom_object(135, G_OBJECT(self->max_bounds)) : fl_value_new_null()); - fl_value_append_take(values, fl_value_new_float(self->min_zoom)); - fl_value_append_take(values, fl_value_new_float(self->max_zoom)); - fl_value_append_take(values, fl_value_new_float(self->min_tilt)); - fl_value_append_take(values, fl_value_new_float(self->max_tilt)); - fl_value_append_take(values, fl_value_new_bool(self->listens_on_click)); - fl_value_append_take(values, fl_value_new_bool(self->listens_on_long_click)); - return values; -} - -static MaplibreMapOptions* maplibre_map_options_new_from_list(FlValue* values) { - FlValue* value0 = fl_value_get_list_value(values, 0); - const gchar* style = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(values, 1); - double zoom = fl_value_get_float(value1); - FlValue* value2 = fl_value_get_list_value(values, 2); - double tilt = fl_value_get_float(value2); - FlValue* value3 = fl_value_get_list_value(values, 3); - double bearing = fl_value_get_float(value3); - FlValue* value4 = fl_value_get_list_value(values, 4); - MaplibreLngLat* center = nullptr; - if (fl_value_get_type(value4) != FL_VALUE_TYPE_NULL) { - center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value4)); - } - FlValue* value5 = fl_value_get_list_value(values, 5); - MaplibreLngLatBounds* max_bounds = nullptr; - if (fl_value_get_type(value5) != FL_VALUE_TYPE_NULL) { - max_bounds = MAPLIBRE_LNG_LAT_BOUNDS(fl_value_get_custom_value_object(value5)); - } - FlValue* value6 = fl_value_get_list_value(values, 6); - double min_zoom = fl_value_get_float(value6); - FlValue* value7 = fl_value_get_list_value(values, 7); - double max_zoom = fl_value_get_float(value7); - FlValue* value8 = fl_value_get_list_value(values, 8); - double min_tilt = fl_value_get_float(value8); - FlValue* value9 = fl_value_get_list_value(values, 9); - double max_tilt = fl_value_get_float(value9); - FlValue* value10 = fl_value_get_list_value(values, 10); - gboolean listens_on_click = fl_value_get_bool(value10); - FlValue* value11 = fl_value_get_list_value(values, 11); - gboolean listens_on_long_click = fl_value_get_bool(value11); - return maplibre_map_options_new(style, zoom, tilt, bearing, center, max_bounds, min_zoom, max_zoom, min_tilt, max_tilt, listens_on_click, listens_on_long_click); -} - struct _MaplibreLngLat { GObject parent_instance; @@ -334,7 +162,7 @@ double maplibre_map_camera_get_bearing(MaplibreMapCamera* self) { static FlValue* maplibre_map_camera_to_list(MaplibreMapCamera* self) { FlValue* values = fl_value_new_list(); - fl_value_append_take(values, fl_value_new_custom_object(132, G_OBJECT(self->center))); + fl_value_append_take(values, fl_value_new_custom_object(131, G_OBJECT(self->center))); fl_value_append_take(values, fl_value_new_float(self->zoom)); fl_value_append_take(values, fl_value_new_float(self->tilt)); fl_value_append_take(values, fl_value_new_float(self->bearing)); @@ -446,36 +274,29 @@ static gboolean maplibre_message_codec_write_maplibre_raster_dem_encoding(FlStan return fl_standard_message_codec_write_value(codec, buffer, value, error); } -static gboolean maplibre_message_codec_write_maplibre_map_options(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapOptions* value, GError** error) { - uint8_t type = 131; - g_byte_array_append(buffer, &type, sizeof(uint8_t)); - g_autoptr(FlValue) values = maplibre_map_options_to_list(value); - return fl_standard_message_codec_write_value(codec, buffer, values, error); -} - static gboolean maplibre_message_codec_write_maplibre_lng_lat(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLat* value, GError** error) { - uint8_t type = 132; + uint8_t type = 131; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_screen_location(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreScreenLocation* value, GError** error) { - uint8_t type = 133; + uint8_t type = 132; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_screen_location_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_map_camera(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapCamera* value, GError** error) { - uint8_t type = 134; + uint8_t type = 133; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_map_camera_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLatBounds* value, GError** error) { - uint8_t type = 135; + uint8_t type = 134; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_bounds_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); @@ -489,14 +310,12 @@ static gboolean maplibre_message_codec_write_value(FlStandardMessageCodec* codec case 130: return maplibre_message_codec_write_maplibre_raster_dem_encoding(codec, buffer, reinterpret_cast(const_cast(fl_value_get_custom_value(value))), error); case 131: - return maplibre_message_codec_write_maplibre_map_options(codec, buffer, MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value)), error); - case 132: return maplibre_message_codec_write_maplibre_lng_lat(codec, buffer, MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value)), error); - case 133: + case 132: return maplibre_message_codec_write_maplibre_screen_location(codec, buffer, MAPLIBRE_SCREEN_LOCATION(fl_value_get_custom_value_object(value)), error); - case 134: + case 133: return maplibre_message_codec_write_maplibre_map_camera(codec, buffer, MAPLIBRE_MAP_CAMERA(fl_value_get_custom_value_object(value)), error); - case 135: + case 134: return maplibre_message_codec_write_maplibre_lng_lat_bounds(codec, buffer, MAPLIBRE_LNG_LAT_BOUNDS(fl_value_get_custom_value_object(value)), error); } } @@ -512,21 +331,6 @@ static FlValue* maplibre_message_codec_read_maplibre_raster_dem_encoding(FlStand return fl_value_new_custom(130, fl_standard_message_codec_read_value(codec, buffer, offset, error), (GDestroyNotify)fl_value_unref); } -static FlValue* maplibre_message_codec_read_maplibre_map_options(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { - g_autoptr(FlValue) values = fl_standard_message_codec_read_value(codec, buffer, offset, error); - if (values == nullptr) { - return nullptr; - } - - g_autoptr(MaplibreMapOptions) value = maplibre_map_options_new_from_list(values); - if (value == nullptr) { - g_set_error(error, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_FAILED, "Invalid data received for MessageData"); - return nullptr; - } - - return fl_value_new_custom_object(131, G_OBJECT(value)); -} - static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { g_autoptr(FlValue) values = fl_standard_message_codec_read_value(codec, buffer, offset, error); if (values == nullptr) { @@ -539,7 +343,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCo return nullptr; } - return fl_value_new_custom_object(132, G_OBJECT(value)); + return fl_value_new_custom_object(131, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -554,7 +358,7 @@ static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardM return nullptr; } - return fl_value_new_custom_object(133, G_OBJECT(value)); + return fl_value_new_custom_object(132, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -569,7 +373,7 @@ static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessag return nullptr; } - return fl_value_new_custom_object(134, G_OBJECT(value)); + return fl_value_new_custom_object(133, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -584,7 +388,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMe return nullptr; } - return fl_value_new_custom_object(135, G_OBJECT(value)); + return fl_value_new_custom_object(134, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, int type, GError** error) { @@ -594,14 +398,12 @@ static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec case 130: return maplibre_message_codec_read_maplibre_raster_dem_encoding(codec, buffer, offset, error); case 131: - return maplibre_message_codec_read_maplibre_map_options(codec, buffer, offset, error); - case 132: return maplibre_message_codec_read_maplibre_lng_lat(codec, buffer, offset, error); - case 133: + case 132: return maplibre_message_codec_read_maplibre_screen_location(codec, buffer, offset, error); - case 134: + case 133: return maplibre_message_codec_read_maplibre_map_camera(codec, buffer, offset, error); - case 135: + case 134: return maplibre_message_codec_read_maplibre_lng_lat_bounds(codec, buffer, offset, error); default: return FL_STANDARD_MESSAGE_CODEC_CLASS(maplibre_message_codec_parent_class)->read_value_of_type(codec, buffer, offset, type, error); @@ -620,3080 +422,3 @@ static MaplibreMessageCodec* maplibre_message_codec_new() { MaplibreMessageCodec* self = MAPLIBRE_MESSAGE_CODEC(g_object_new(maplibre_message_codec_get_type(), nullptr)); return self; } - -struct _MaplibreMapLibreHostApiResponseHandle { - GObject parent_instance; - - FlBasicMessageChannel* channel; - FlBasicMessageChannelResponseHandle* response_handle; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiResponseHandle, maplibre_map_libre_host_api_response_handle, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_response_handle_dispose(GObject* object) { - MaplibreMapLibreHostApiResponseHandle* self = MAPLIBRE_MAP_LIBRE_HOST_API_RESPONSE_HANDLE(object); - g_clear_object(&self->channel); - g_clear_object(&self->response_handle); - G_OBJECT_CLASS(maplibre_map_libre_host_api_response_handle_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_response_handle_init(MaplibreMapLibreHostApiResponseHandle* self) { -} - -static void maplibre_map_libre_host_api_response_handle_class_init(MaplibreMapLibreHostApiResponseHandleClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_response_handle_dispose; -} - -static MaplibreMapLibreHostApiResponseHandle* maplibre_map_libre_host_api_response_handle_new(FlBasicMessageChannel* channel, FlBasicMessageChannelResponseHandle* response_handle) { - MaplibreMapLibreHostApiResponseHandle* self = MAPLIBRE_MAP_LIBRE_HOST_API_RESPONSE_HANDLE(g_object_new(maplibre_map_libre_host_api_response_handle_get_type(), nullptr)); - self->channel = FL_BASIC_MESSAGE_CHANNEL(g_object_ref(channel)); - self->response_handle = FL_BASIC_MESSAGE_CHANNEL_RESPONSE_HANDLE(g_object_ref(response_handle)); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiJumpToResponse, maplibre_map_libre_host_api_jump_to_response, MAPLIBRE, MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiJumpToResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiJumpToResponse, maplibre_map_libre_host_api_jump_to_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_jump_to_response_dispose(GObject* object) { - MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_jump_to_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_jump_to_response_init(MaplibreMapLibreHostApiJumpToResponse* self) { -} - -static void maplibre_map_libre_host_api_jump_to_response_class_init(MaplibreMapLibreHostApiJumpToResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_jump_to_response_dispose; -} - -static MaplibreMapLibreHostApiJumpToResponse* maplibre_map_libre_host_api_jump_to_response_new() { - MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_jump_to_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiJumpToResponse* maplibre_map_libre_host_api_jump_to_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_jump_to_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiFlyToResponse, maplibre_map_libre_host_api_fly_to_response, MAPLIBRE, MAP_LIBRE_HOST_API_FLY_TO_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiFlyToResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiFlyToResponse, maplibre_map_libre_host_api_fly_to_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_fly_to_response_dispose(GObject* object) { - MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_fly_to_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_fly_to_response_init(MaplibreMapLibreHostApiFlyToResponse* self) { -} - -static void maplibre_map_libre_host_api_fly_to_response_class_init(MaplibreMapLibreHostApiFlyToResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_fly_to_response_dispose; -} - -static MaplibreMapLibreHostApiFlyToResponse* maplibre_map_libre_host_api_fly_to_response_new() { - MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_fly_to_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiFlyToResponse* maplibre_map_libre_host_api_fly_to_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_fly_to_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetCameraResponse, maplibre_map_libre_host_api_get_camera_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiGetCameraResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiGetCameraResponse, maplibre_map_libre_host_api_get_camera_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_get_camera_response_dispose(GObject* object) { - MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_get_camera_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_get_camera_response_init(MaplibreMapLibreHostApiGetCameraResponse* self) { -} - -static void maplibre_map_libre_host_api_get_camera_response_class_init(MaplibreMapLibreHostApiGetCameraResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_camera_response_dispose; -} - -static MaplibreMapLibreHostApiGetCameraResponse* maplibre_map_libre_host_api_get_camera_response_new(MaplibreMapCamera* return_value) { - MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_camera_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(134, G_OBJECT(return_value))); - return self; -} - -static MaplibreMapLibreHostApiGetCameraResponse* maplibre_map_libre_host_api_get_camera_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_camera_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetVisibleRegionResponse, maplibre_map_libre_host_api_get_visible_region_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiGetVisibleRegionResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiGetVisibleRegionResponse, maplibre_map_libre_host_api_get_visible_region_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_get_visible_region_response_dispose(GObject* object) { - MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_get_visible_region_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_get_visible_region_response_init(MaplibreMapLibreHostApiGetVisibleRegionResponse* self) { -} - -static void maplibre_map_libre_host_api_get_visible_region_response_class_init(MaplibreMapLibreHostApiGetVisibleRegionResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_visible_region_response_dispose; -} - -static MaplibreMapLibreHostApiGetVisibleRegionResponse* maplibre_map_libre_host_api_get_visible_region_response_new(MaplibreLngLatBounds* return_value) { - MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_visible_region_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(135, G_OBJECT(return_value))); - return self; -} - -static MaplibreMapLibreHostApiGetVisibleRegionResponse* maplibre_map_libre_host_api_get_visible_region_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_visible_region_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiToScreenLocationResponse, maplibre_map_libre_host_api_to_screen_location_response, MAPLIBRE, MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiToScreenLocationResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiToScreenLocationResponse, maplibre_map_libre_host_api_to_screen_location_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_to_screen_location_response_dispose(GObject* object) { - MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_to_screen_location_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_to_screen_location_response_init(MaplibreMapLibreHostApiToScreenLocationResponse* self) { -} - -static void maplibre_map_libre_host_api_to_screen_location_response_class_init(MaplibreMapLibreHostApiToScreenLocationResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_to_screen_location_response_dispose; -} - -static MaplibreMapLibreHostApiToScreenLocationResponse* maplibre_map_libre_host_api_to_screen_location_response_new(MaplibreScreenLocation* return_value) { - MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_screen_location_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(133, G_OBJECT(return_value))); - return self; -} - -static MaplibreMapLibreHostApiToScreenLocationResponse* maplibre_map_libre_host_api_to_screen_location_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_screen_location_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiToLngLatResponse, maplibre_map_libre_host_api_to_lng_lat_response, MAPLIBRE, MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiToLngLatResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiToLngLatResponse, maplibre_map_libre_host_api_to_lng_lat_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_to_lng_lat_response_dispose(GObject* object) { - MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_to_lng_lat_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_to_lng_lat_response_init(MaplibreMapLibreHostApiToLngLatResponse* self) { -} - -static void maplibre_map_libre_host_api_to_lng_lat_response_class_init(MaplibreMapLibreHostApiToLngLatResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_to_lng_lat_response_dispose; -} - -static MaplibreMapLibreHostApiToLngLatResponse* maplibre_map_libre_host_api_to_lng_lat_response_new(MaplibreLngLat* return_value) { - MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_lng_lat_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(132, G_OBJECT(return_value))); - return self; -} - -static MaplibreMapLibreHostApiToLngLatResponse* maplibre_map_libre_host_api_to_lng_lat_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_lng_lat_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddFillLayerResponse, maplibre_map_libre_host_api_add_fill_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddFillLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddFillLayerResponse, maplibre_map_libre_host_api_add_fill_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_fill_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_fill_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_fill_layer_response_init(MaplibreMapLibreHostApiAddFillLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_fill_layer_response_class_init(MaplibreMapLibreHostApiAddFillLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_fill_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddFillLayerResponse* maplibre_map_libre_host_api_add_fill_layer_response_new() { - MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddFillLayerResponse* maplibre_map_libre_host_api_add_fill_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddCircleLayerResponse, maplibre_map_libre_host_api_add_circle_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddCircleLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddCircleLayerResponse, maplibre_map_libre_host_api_add_circle_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_circle_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_circle_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_circle_layer_response_init(MaplibreMapLibreHostApiAddCircleLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_circle_layer_response_class_init(MaplibreMapLibreHostApiAddCircleLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_circle_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddCircleLayerResponse* maplibre_map_libre_host_api_add_circle_layer_response_new() { - MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_circle_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddCircleLayerResponse* maplibre_map_libre_host_api_add_circle_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_circle_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddBackgroundLayerResponse, maplibre_map_libre_host_api_add_background_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddBackgroundLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddBackgroundLayerResponse, maplibre_map_libre_host_api_add_background_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_background_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_background_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_background_layer_response_init(MaplibreMapLibreHostApiAddBackgroundLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_background_layer_response_class_init(MaplibreMapLibreHostApiAddBackgroundLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_background_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddBackgroundLayerResponse* maplibre_map_libre_host_api_add_background_layer_response_new() { - MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_background_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddBackgroundLayerResponse* maplibre_map_libre_host_api_add_background_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_background_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse, maplibre_map_libre_host_api_add_fill_extrusion_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddFillExtrusionLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse, maplibre_map_libre_host_api_add_fill_extrusion_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_init(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_class_init(MaplibreMapLibreHostApiAddFillExtrusionLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new() { - MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddHeatmapLayerResponse, maplibre_map_libre_host_api_add_heatmap_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddHeatmapLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddHeatmapLayerResponse, maplibre_map_libre_host_api_add_heatmap_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_heatmap_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_heatmap_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_heatmap_layer_response_init(MaplibreMapLibreHostApiAddHeatmapLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_heatmap_layer_response_class_init(MaplibreMapLibreHostApiAddHeatmapLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_heatmap_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddHeatmapLayerResponse* maplibre_map_libre_host_api_add_heatmap_layer_response_new() { - MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_heatmap_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddHeatmapLayerResponse* maplibre_map_libre_host_api_add_heatmap_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_heatmap_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddHillshadeLayerResponse, maplibre_map_libre_host_api_add_hillshade_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddHillshadeLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddHillshadeLayerResponse, maplibre_map_libre_host_api_add_hillshade_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_hillshade_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_hillshade_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_hillshade_layer_response_init(MaplibreMapLibreHostApiAddHillshadeLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_hillshade_layer_response_class_init(MaplibreMapLibreHostApiAddHillshadeLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_hillshade_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddHillshadeLayerResponse* maplibre_map_libre_host_api_add_hillshade_layer_response_new() { - MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_hillshade_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddHillshadeLayerResponse* maplibre_map_libre_host_api_add_hillshade_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_hillshade_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddLineLayerResponse, maplibre_map_libre_host_api_add_line_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddLineLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddLineLayerResponse, maplibre_map_libre_host_api_add_line_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_line_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_line_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_line_layer_response_init(MaplibreMapLibreHostApiAddLineLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_line_layer_response_class_init(MaplibreMapLibreHostApiAddLineLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_line_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddLineLayerResponse* maplibre_map_libre_host_api_add_line_layer_response_new() { - MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_line_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddLineLayerResponse* maplibre_map_libre_host_api_add_line_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_line_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterLayerResponse, maplibre_map_libre_host_api_add_raster_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddRasterLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterLayerResponse, maplibre_map_libre_host_api_add_raster_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_raster_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_raster_layer_response_init(MaplibreMapLibreHostApiAddRasterLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_raster_layer_response_class_init(MaplibreMapLibreHostApiAddRasterLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddRasterLayerResponse* maplibre_map_libre_host_api_add_raster_layer_response_new() { - MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddRasterLayerResponse* maplibre_map_libre_host_api_add_raster_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddSymbolLayerResponse, maplibre_map_libre_host_api_add_symbol_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddSymbolLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddSymbolLayerResponse, maplibre_map_libre_host_api_add_symbol_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_symbol_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_symbol_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_symbol_layer_response_init(MaplibreMapLibreHostApiAddSymbolLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_add_symbol_layer_response_class_init(MaplibreMapLibreHostApiAddSymbolLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_symbol_layer_response_dispose; -} - -static MaplibreMapLibreHostApiAddSymbolLayerResponse* maplibre_map_libre_host_api_add_symbol_layer_response_new() { - MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_symbol_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddSymbolLayerResponse* maplibre_map_libre_host_api_add_symbol_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_symbol_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveLayerResponse, maplibre_map_libre_host_api_remove_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiRemoveLayerResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveLayerResponse, maplibre_map_libre_host_api_remove_layer_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_remove_layer_response_dispose(GObject* object) { - MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_layer_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_remove_layer_response_init(MaplibreMapLibreHostApiRemoveLayerResponse* self) { -} - -static void maplibre_map_libre_host_api_remove_layer_response_class_init(MaplibreMapLibreHostApiRemoveLayerResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_layer_response_dispose; -} - -static MaplibreMapLibreHostApiRemoveLayerResponse* maplibre_map_libre_host_api_remove_layer_response_new() { - MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiRemoveLayerResponse* maplibre_map_libre_host_api_remove_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_layer_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveSourceResponse, maplibre_map_libre_host_api_remove_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiRemoveSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveSourceResponse, maplibre_map_libre_host_api_remove_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_remove_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_remove_source_response_init(MaplibreMapLibreHostApiRemoveSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_remove_source_response_class_init(MaplibreMapLibreHostApiRemoveSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_source_response_dispose; -} - -static MaplibreMapLibreHostApiRemoveSourceResponse* maplibre_map_libre_host_api_remove_source_response_new() { - MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiRemoveSourceResponse* maplibre_map_libre_host_api_remove_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiLoadImageResponse, maplibre_map_libre_host_api_load_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiLoadImageResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiLoadImageResponse, maplibre_map_libre_host_api_load_image_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_load_image_response_dispose(GObject* object) { - MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_load_image_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_load_image_response_init(MaplibreMapLibreHostApiLoadImageResponse* self) { -} - -static void maplibre_map_libre_host_api_load_image_response_class_init(MaplibreMapLibreHostApiLoadImageResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_load_image_response_dispose; -} - -static MaplibreMapLibreHostApiLoadImageResponse* maplibre_map_libre_host_api_load_image_response_new(const uint8_t* return_value, size_t return_value_length) { - MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_load_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_uint8_list(return_value, return_value_length)); - return self; -} - -static MaplibreMapLibreHostApiLoadImageResponse* maplibre_map_libre_host_api_load_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_load_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddImageResponse, maplibre_map_libre_host_api_add_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddImageResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddImageResponse, maplibre_map_libre_host_api_add_image_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_image_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_image_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_image_response_init(MaplibreMapLibreHostApiAddImageResponse* self) { -} - -static void maplibre_map_libre_host_api_add_image_response_class_init(MaplibreMapLibreHostApiAddImageResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_image_response_dispose; -} - -static MaplibreMapLibreHostApiAddImageResponse* maplibre_map_libre_host_api_add_image_response_new() { - MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddImageResponse* maplibre_map_libre_host_api_add_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveImageResponse, maplibre_map_libre_host_api_remove_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiRemoveImageResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveImageResponse, maplibre_map_libre_host_api_remove_image_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_remove_image_response_dispose(GObject* object) { - MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_image_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_remove_image_response_init(MaplibreMapLibreHostApiRemoveImageResponse* self) { -} - -static void maplibre_map_libre_host_api_remove_image_response_class_init(MaplibreMapLibreHostApiRemoveImageResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_image_response_dispose; -} - -static MaplibreMapLibreHostApiRemoveImageResponse* maplibre_map_libre_host_api_remove_image_response_new() { - MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiRemoveImageResponse* maplibre_map_libre_host_api_remove_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_image_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddGeoJsonSourceResponse, maplibre_map_libre_host_api_add_geo_json_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddGeoJsonSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddGeoJsonSourceResponse, maplibre_map_libre_host_api_add_geo_json_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_geo_json_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_geo_json_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_geo_json_source_response_init(MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_add_geo_json_source_response_class_init(MaplibreMapLibreHostApiAddGeoJsonSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_geo_json_source_response_dispose; -} - -static MaplibreMapLibreHostApiAddGeoJsonSourceResponse* maplibre_map_libre_host_api_add_geo_json_source_response_new() { - MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_geo_json_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddGeoJsonSourceResponse* maplibre_map_libre_host_api_add_geo_json_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_geo_json_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse, maplibre_map_libre_host_api_update_geo_json_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse, maplibre_map_libre_host_api_update_geo_json_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_update_geo_json_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_update_geo_json_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_update_geo_json_source_response_init(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_update_geo_json_source_response_class_init(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_update_geo_json_source_response_dispose; -} - -static MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* maplibre_map_libre_host_api_update_geo_json_source_response_new() { - MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_geo_json_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* maplibre_map_libre_host_api_update_geo_json_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_geo_json_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddImageSourceResponse, maplibre_map_libre_host_api_add_image_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddImageSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddImageSourceResponse, maplibre_map_libre_host_api_add_image_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_image_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_image_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_image_source_response_init(MaplibreMapLibreHostApiAddImageSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_add_image_source_response_class_init(MaplibreMapLibreHostApiAddImageSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_image_source_response_dispose; -} - -static MaplibreMapLibreHostApiAddImageSourceResponse* maplibre_map_libre_host_api_add_image_source_response_new() { - MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddImageSourceResponse* maplibre_map_libre_host_api_add_image_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterSourceResponse, maplibre_map_libre_host_api_add_raster_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddRasterSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterSourceResponse, maplibre_map_libre_host_api_add_raster_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_raster_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_raster_source_response_init(MaplibreMapLibreHostApiAddRasterSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_add_raster_source_response_class_init(MaplibreMapLibreHostApiAddRasterSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_source_response_dispose; -} - -static MaplibreMapLibreHostApiAddRasterSourceResponse* maplibre_map_libre_host_api_add_raster_source_response_new() { - MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddRasterSourceResponse* maplibre_map_libre_host_api_add_raster_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterDemSourceResponse, maplibre_map_libre_host_api_add_raster_dem_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddRasterDemSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterDemSourceResponse, maplibre_map_libre_host_api_add_raster_dem_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_raster_dem_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_dem_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_raster_dem_source_response_init(MaplibreMapLibreHostApiAddRasterDemSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_add_raster_dem_source_response_class_init(MaplibreMapLibreHostApiAddRasterDemSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_dem_source_response_dispose; -} - -static MaplibreMapLibreHostApiAddRasterDemSourceResponse* maplibre_map_libre_host_api_add_raster_dem_source_response_new() { - MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_dem_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddRasterDemSourceResponse* maplibre_map_libre_host_api_add_raster_dem_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_dem_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddVectorSourceResponse, maplibre_map_libre_host_api_add_vector_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiAddVectorSourceResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiAddVectorSourceResponse, maplibre_map_libre_host_api_add_vector_source_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_add_vector_source_response_dispose(GObject* object) { - MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_add_vector_source_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_add_vector_source_response_init(MaplibreMapLibreHostApiAddVectorSourceResponse* self) { -} - -static void maplibre_map_libre_host_api_add_vector_source_response_class_init(MaplibreMapLibreHostApiAddVectorSourceResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_vector_source_response_dispose; -} - -static MaplibreMapLibreHostApiAddVectorSourceResponse* maplibre_map_libre_host_api_add_vector_source_response_new() { - MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_vector_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiAddVectorSourceResponse* maplibre_map_libre_host_api_add_vector_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_vector_source_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -struct _MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_dispose(GObject* object) { - MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_init(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self) { -} - -static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_class_init(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_dispose; -} - -MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new(double return_value) { - MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_float(return_value)); - return self; -} - -MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiUpdateOptionsResponse, maplibre_map_libre_host_api_update_options_response, MAPLIBRE, MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE, GObject) - -struct _MaplibreMapLibreHostApiUpdateOptionsResponse { - GObject parent_instance; - - FlValue* value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApiUpdateOptionsResponse, maplibre_map_libre_host_api_update_options_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_update_options_response_dispose(GObject* object) { - MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(object); - g_clear_pointer(&self->value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_host_api_update_options_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_update_options_response_init(MaplibreMapLibreHostApiUpdateOptionsResponse* self) { -} - -static void maplibre_map_libre_host_api_update_options_response_class_init(MaplibreMapLibreHostApiUpdateOptionsResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_update_options_response_dispose; -} - -static MaplibreMapLibreHostApiUpdateOptionsResponse* maplibre_map_libre_host_api_update_options_response_new() { - MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_options_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_null()); - return self; -} - -static MaplibreMapLibreHostApiUpdateOptionsResponse* maplibre_map_libre_host_api_update_options_response_new_error(const gchar* code, const gchar* message, FlValue* details) { - MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_options_response_get_type(), nullptr)); - self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_string(code)); - fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); - fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); - return self; -} - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApi, maplibre_map_libre_host_api, MAPLIBRE, MAP_LIBRE_HOST_API, GObject) - -struct _MaplibreMapLibreHostApi { - GObject parent_instance; - - const MaplibreMapLibreHostApiVTable* vtable; - gpointer user_data; - GDestroyNotify user_data_free_func; -}; - -G_DEFINE_TYPE(MaplibreMapLibreHostApi, maplibre_map_libre_host_api, G_TYPE_OBJECT) - -static void maplibre_map_libre_host_api_dispose(GObject* object) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(object); - if (self->user_data != nullptr) { - self->user_data_free_func(self->user_data); - } - self->user_data = nullptr; - G_OBJECT_CLASS(maplibre_map_libre_host_api_parent_class)->dispose(object); -} - -static void maplibre_map_libre_host_api_init(MaplibreMapLibreHostApi* self) { -} - -static void maplibre_map_libre_host_api_class_init(MaplibreMapLibreHostApiClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_dispose; -} - -static MaplibreMapLibreHostApi* maplibre_map_libre_host_api_new(const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(g_object_new(maplibre_map_libre_host_api_get_type(), nullptr)); - self->vtable = vtable; - self->user_data = user_data; - self->user_data_free_func = user_data_free_func; - return self; -} - -static void maplibre_map_libre_host_api_jump_to_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->jump_to == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - MaplibreLngLat* center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value0)); - FlValue* value1 = fl_value_get_list_value(message_, 1); - double* zoom = nullptr; - double zoom_value; - if (fl_value_get_type(value1) != FL_VALUE_TYPE_NULL) { - zoom_value = fl_value_get_float(value1); - zoom = &zoom_value; - } - FlValue* value2 = fl_value_get_list_value(message_, 2); - double* bearing = nullptr; - double bearing_value; - if (fl_value_get_type(value2) != FL_VALUE_TYPE_NULL) { - bearing_value = fl_value_get_float(value2); - bearing = &bearing_value; - } - FlValue* value3 = fl_value_get_list_value(message_, 3); - double* pitch = nullptr; - double pitch_value; - if (fl_value_get_type(value3) != FL_VALUE_TYPE_NULL) { - pitch_value = fl_value_get_float(value3); - pitch = &pitch_value; - } - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->jump_to(center, zoom, bearing, pitch, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_fly_to_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->fly_to == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - MaplibreLngLat* center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value0)); - FlValue* value1 = fl_value_get_list_value(message_, 1); - double* zoom = nullptr; - double zoom_value; - if (fl_value_get_type(value1) != FL_VALUE_TYPE_NULL) { - zoom_value = fl_value_get_float(value1); - zoom = &zoom_value; - } - FlValue* value2 = fl_value_get_list_value(message_, 2); - double* bearing = nullptr; - double bearing_value; - if (fl_value_get_type(value2) != FL_VALUE_TYPE_NULL) { - bearing_value = fl_value_get_float(value2); - bearing = &bearing_value; - } - FlValue* value3 = fl_value_get_list_value(message_, 3); - double* pitch = nullptr; - double pitch_value; - if (fl_value_get_type(value3) != FL_VALUE_TYPE_NULL) { - pitch_value = fl_value_get_float(value3); - pitch = &pitch_value; - } - FlValue* value4 = fl_value_get_list_value(message_, 4); - int64_t duration_ms = fl_value_get_int(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->fly_to(center, zoom, bearing, pitch, duration_ms, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_get_camera_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->get_camera == nullptr) { - return; - } - - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->get_camera(handle, self->user_data); -} - -static void maplibre_map_libre_host_api_get_visible_region_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->get_visible_region == nullptr) { - return; - } - - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->get_visible_region(handle, self->user_data); -} - -static void maplibre_map_libre_host_api_to_screen_location_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->to_screen_location == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - double lng = fl_value_get_float(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - double lat = fl_value_get_float(value1); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->to_screen_location(lng, lat, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_to_lng_lat_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->to_lng_lat == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - double x = fl_value_get_float(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - double y = fl_value_get_float(value1); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->to_lng_lat(x, y, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_fill_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_fill_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_fill_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_circle_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_circle_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_circle_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_background_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_background_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - FlValue* layout = value1; - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* paint = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - const gchar* below_layer_id = fl_value_get_string(value3); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_background_layer(id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_fill_extrusion_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_fill_extrusion_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_fill_extrusion_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_heatmap_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_heatmap_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_heatmap_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_hillshade_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_hillshade_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_hillshade_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_line_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_line_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_line_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_raster_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_raster_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_raster_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_symbol_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_symbol_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* source_id = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* layout = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* paint = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - const gchar* below_layer_id = fl_value_get_string(value4); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_symbol_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_remove_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->remove_layer == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->remove_layer(id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_remove_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->remove_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->remove_source(id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_load_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->load_image == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* url = fl_value_get_string(value0); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->load_image(url, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_image == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const uint8_t* bytes = fl_value_get_uint8_list(value1); - size_t bytes_length = fl_value_get_length(value1); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_image(id, bytes, bytes_length, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_remove_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->remove_image == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->remove_image(id, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_geo_json_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_geo_json_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* data = fl_value_get_string(value1); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_geo_json_source(id, data, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_update_geo_json_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->update_geo_json_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* data = fl_value_get_string(value1); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->update_geo_json_source(id, data, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_image_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_image_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* url = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* coordinates = value2; - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_image_source(id, url, coordinates, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_raster_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_raster_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* url = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* tiles = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* bounds = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - double min_zoom = fl_value_get_float(value4); - FlValue* value5 = fl_value_get_list_value(message_, 5); - double max_zoom = fl_value_get_float(value5); - FlValue* value6 = fl_value_get_list_value(message_, 6); - int64_t tile_size = fl_value_get_int(value6); - FlValue* value7 = fl_value_get_list_value(message_, 7); - MaplibreTileScheme scheme = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value7))))); - FlValue* value8 = fl_value_get_list_value(message_, 8); - const gchar* attribution = fl_value_get_string(value8); - FlValue* value9 = fl_value_get_list_value(message_, 9); - gboolean volatile = fl_value_get_bool(value9); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_raster_source(id, url, tiles, bounds, min_zoom, max_zoom, tile_size, scheme, attribution, volatile, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_raster_dem_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_raster_dem_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* url = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* tiles = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* bounds = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - double min_zoom = fl_value_get_float(value4); - FlValue* value5 = fl_value_get_list_value(message_, 5); - double max_zoom = fl_value_get_float(value5); - FlValue* value6 = fl_value_get_list_value(message_, 6); - int64_t tile_size = fl_value_get_int(value6); - FlValue* value7 = fl_value_get_list_value(message_, 7); - const gchar* attribution = fl_value_get_string(value7); - FlValue* value8 = fl_value_get_list_value(message_, 8); - MaplibreRasterDemEncoding encoding = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value8))))); - FlValue* value9 = fl_value_get_list_value(message_, 9); - gboolean volatile = fl_value_get_bool(value9); - FlValue* value10 = fl_value_get_list_value(message_, 10); - double red_factor = fl_value_get_float(value10); - FlValue* value11 = fl_value_get_list_value(message_, 11); - double blue_factor = fl_value_get_float(value11); - FlValue* value12 = fl_value_get_list_value(message_, 12); - double green_factor = fl_value_get_float(value12); - FlValue* value13 = fl_value_get_list_value(message_, 13); - double base_shift = fl_value_get_float(value13); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_raster_dem_source(id, url, tiles, bounds, min_zoom, max_zoom, tile_size, attribution, encoding, volatile, red_factor, blue_factor, green_factor, base_shift, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_add_vector_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->add_vector_source == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - const gchar* id = fl_value_get_string(value0); - FlValue* value1 = fl_value_get_list_value(message_, 1); - const gchar* url = fl_value_get_string(value1); - FlValue* value2 = fl_value_get_list_value(message_, 2); - FlValue* tiles = value2; - FlValue* value3 = fl_value_get_list_value(message_, 3); - FlValue* bounds = value3; - FlValue* value4 = fl_value_get_list_value(message_, 4); - MaplibreTileScheme scheme = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value4))))); - FlValue* value5 = fl_value_get_list_value(message_, 5); - double min_zoom = fl_value_get_float(value5); - FlValue* value6 = fl_value_get_list_value(message_, 6); - double max_zoom = fl_value_get_float(value6); - FlValue* value7 = fl_value_get_list_value(message_, 7); - const gchar* attribution = fl_value_get_string(value7); - FlValue* value8 = fl_value_get_list_value(message_, 8); - gboolean volatile = fl_value_get_bool(value8); - FlValue* value9 = fl_value_get_list_value(message_, 9); - const gchar* source_layer = fl_value_get_string(value9); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->add_vector_source(id, url, tiles, bounds, scheme, min_zoom, max_zoom, attribution, volatile, source_layer, handle, self->user_data); -} - -static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->get_meters_per_pixel_at_latitude == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - double latitude = fl_value_get_float(value0); - g_autoptr(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse) response = self->vtable->get_meters_per_pixel_at_latitude(latitude, self->user_data); - if (response == nullptr) { - g_warning("No response returned to %s.%s", "MapLibreHostApi", "getMetersPerPixelAtLatitude"); - return; - } - - g_autoptr(GError) error = NULL; - if (!fl_basic_message_channel_respond(channel, response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getMetersPerPixelAtLatitude", error->message); - } -} - -static void maplibre_map_libre_host_api_update_options_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { - MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); - - if (self->vtable == nullptr || self->vtable->update_options == nullptr) { - return; - } - - FlValue* value0 = fl_value_get_list_value(message_, 0); - MaplibreMapOptions* options = MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value0)); - g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); - self->vtable->update_options(options, handle, self->user_data); -} - -void maplibre_map_libre_host_api_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func) { - g_autofree gchar* dot_suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); - g_autoptr(MaplibreMapLibreHostApi) api_data = maplibre_map_libre_host_api_new(vtable, user_data, user_data_free_func); - - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - g_autofree gchar* jump_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) jump_to_channel = fl_basic_message_channel_new(messenger, jump_to_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(jump_to_channel, maplibre_map_libre_host_api_jump_to_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* fly_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) fly_to_channel = fl_basic_message_channel_new(messenger, fly_to_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(fly_to_channel, maplibre_map_libre_host_api_fly_to_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* get_camera_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_camera_channel = fl_basic_message_channel_new(messenger, get_camera_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_camera_channel, maplibre_map_libre_host_api_get_camera_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* get_visible_region_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_visible_region_channel = fl_basic_message_channel_new(messenger, get_visible_region_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_visible_region_channel, maplibre_map_libre_host_api_get_visible_region_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* to_screen_location_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) to_screen_location_channel = fl_basic_message_channel_new(messenger, to_screen_location_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(to_screen_location_channel, maplibre_map_libre_host_api_to_screen_location_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* to_lng_lat_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) to_lng_lat_channel = fl_basic_message_channel_new(messenger, to_lng_lat_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(to_lng_lat_channel, maplibre_map_libre_host_api_to_lng_lat_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_fill_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_fill_layer_channel = fl_basic_message_channel_new(messenger, add_fill_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_fill_layer_channel, maplibre_map_libre_host_api_add_fill_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_circle_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_circle_layer_channel = fl_basic_message_channel_new(messenger, add_circle_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_circle_layer_channel, maplibre_map_libre_host_api_add_circle_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_background_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_background_layer_channel = fl_basic_message_channel_new(messenger, add_background_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_background_layer_channel, maplibre_map_libre_host_api_add_background_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_fill_extrusion_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_fill_extrusion_layer_channel = fl_basic_message_channel_new(messenger, add_fill_extrusion_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_fill_extrusion_layer_channel, maplibre_map_libre_host_api_add_fill_extrusion_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_heatmap_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_heatmap_layer_channel = fl_basic_message_channel_new(messenger, add_heatmap_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_heatmap_layer_channel, maplibre_map_libre_host_api_add_heatmap_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_hillshade_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_hillshade_layer_channel = fl_basic_message_channel_new(messenger, add_hillshade_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_hillshade_layer_channel, maplibre_map_libre_host_api_add_hillshade_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_line_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_line_layer_channel = fl_basic_message_channel_new(messenger, add_line_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_line_layer_channel, maplibre_map_libre_host_api_add_line_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_raster_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_layer_channel = fl_basic_message_channel_new(messenger, add_raster_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_layer_channel, maplibre_map_libre_host_api_add_raster_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_symbol_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_symbol_layer_channel = fl_basic_message_channel_new(messenger, add_symbol_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_symbol_layer_channel, maplibre_map_libre_host_api_add_symbol_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* remove_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_layer_channel = fl_basic_message_channel_new(messenger, remove_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_layer_channel, maplibre_map_libre_host_api_remove_layer_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* remove_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_source_channel = fl_basic_message_channel_new(messenger, remove_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_source_channel, maplibre_map_libre_host_api_remove_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* load_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) load_image_channel = fl_basic_message_channel_new(messenger, load_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(load_image_channel, maplibre_map_libre_host_api_load_image_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_image_channel = fl_basic_message_channel_new(messenger, add_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_image_channel, maplibre_map_libre_host_api_add_image_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* remove_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_image_channel = fl_basic_message_channel_new(messenger, remove_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_image_channel, maplibre_map_libre_host_api_remove_image_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_geo_json_source_channel = fl_basic_message_channel_new(messenger, add_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_geo_json_source_channel, maplibre_map_libre_host_api_add_geo_json_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* update_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) update_geo_json_source_channel = fl_basic_message_channel_new(messenger, update_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(update_geo_json_source_channel, maplibre_map_libre_host_api_update_geo_json_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_image_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_image_source_channel = fl_basic_message_channel_new(messenger, add_image_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_image_source_channel, maplibre_map_libre_host_api_add_image_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_raster_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_source_channel = fl_basic_message_channel_new(messenger, add_raster_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_source_channel, maplibre_map_libre_host_api_add_raster_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_raster_dem_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_dem_source_channel = fl_basic_message_channel_new(messenger, add_raster_dem_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_dem_source_channel, maplibre_map_libre_host_api_add_raster_dem_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* add_vector_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_vector_source_channel = fl_basic_message_channel_new(messenger, add_vector_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_vector_source_channel, maplibre_map_libre_host_api_add_vector_source_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* get_meters_per_pixel_at_latitude_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_meters_per_pixel_at_latitude_channel = fl_basic_message_channel_new(messenger, get_meters_per_pixel_at_latitude_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_meters_per_pixel_at_latitude_channel, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_cb, g_object_ref(api_data), g_object_unref); - g_autofree gchar* update_options_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) update_options_channel = fl_basic_message_channel_new(messenger, update_options_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(update_options_channel, maplibre_map_libre_host_api_update_options_cb, g_object_ref(api_data), g_object_unref); -} - -void maplibre_map_libre_host_api_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) { - g_autofree gchar* dot_suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); - - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - g_autofree gchar* jump_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) jump_to_channel = fl_basic_message_channel_new(messenger, jump_to_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(jump_to_channel, nullptr, nullptr, nullptr); - g_autofree gchar* fly_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) fly_to_channel = fl_basic_message_channel_new(messenger, fly_to_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(fly_to_channel, nullptr, nullptr, nullptr); - g_autofree gchar* get_camera_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_camera_channel = fl_basic_message_channel_new(messenger, get_camera_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_camera_channel, nullptr, nullptr, nullptr); - g_autofree gchar* get_visible_region_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_visible_region_channel = fl_basic_message_channel_new(messenger, get_visible_region_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_visible_region_channel, nullptr, nullptr, nullptr); - g_autofree gchar* to_screen_location_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) to_screen_location_channel = fl_basic_message_channel_new(messenger, to_screen_location_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(to_screen_location_channel, nullptr, nullptr, nullptr); - g_autofree gchar* to_lng_lat_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) to_lng_lat_channel = fl_basic_message_channel_new(messenger, to_lng_lat_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(to_lng_lat_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_fill_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_fill_layer_channel = fl_basic_message_channel_new(messenger, add_fill_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_fill_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_circle_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_circle_layer_channel = fl_basic_message_channel_new(messenger, add_circle_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_circle_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_background_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_background_layer_channel = fl_basic_message_channel_new(messenger, add_background_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_background_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_fill_extrusion_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_fill_extrusion_layer_channel = fl_basic_message_channel_new(messenger, add_fill_extrusion_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_fill_extrusion_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_heatmap_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_heatmap_layer_channel = fl_basic_message_channel_new(messenger, add_heatmap_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_heatmap_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_hillshade_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_hillshade_layer_channel = fl_basic_message_channel_new(messenger, add_hillshade_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_hillshade_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_line_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_line_layer_channel = fl_basic_message_channel_new(messenger, add_line_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_line_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_raster_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_layer_channel = fl_basic_message_channel_new(messenger, add_raster_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_symbol_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_symbol_layer_channel = fl_basic_message_channel_new(messenger, add_symbol_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_symbol_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* remove_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_layer_channel = fl_basic_message_channel_new(messenger, remove_layer_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_layer_channel, nullptr, nullptr, nullptr); - g_autofree gchar* remove_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_source_channel = fl_basic_message_channel_new(messenger, remove_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* load_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) load_image_channel = fl_basic_message_channel_new(messenger, load_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(load_image_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_image_channel = fl_basic_message_channel_new(messenger, add_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_image_channel, nullptr, nullptr, nullptr); - g_autofree gchar* remove_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) remove_image_channel = fl_basic_message_channel_new(messenger, remove_image_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(remove_image_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_geo_json_source_channel = fl_basic_message_channel_new(messenger, add_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_geo_json_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* update_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) update_geo_json_source_channel = fl_basic_message_channel_new(messenger, update_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(update_geo_json_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_image_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_image_source_channel = fl_basic_message_channel_new(messenger, add_image_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_image_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_raster_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_source_channel = fl_basic_message_channel_new(messenger, add_raster_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_raster_dem_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_raster_dem_source_channel = fl_basic_message_channel_new(messenger, add_raster_dem_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_raster_dem_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* add_vector_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) add_vector_source_channel = fl_basic_message_channel_new(messenger, add_vector_source_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(add_vector_source_channel, nullptr, nullptr, nullptr); - g_autofree gchar* get_meters_per_pixel_at_latitude_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) get_meters_per_pixel_at_latitude_channel = fl_basic_message_channel_new(messenger, get_meters_per_pixel_at_latitude_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(get_meters_per_pixel_at_latitude_channel, nullptr, nullptr, nullptr); - g_autofree gchar* update_options_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions%s", dot_suffix); - g_autoptr(FlBasicMessageChannel) update_options_channel = fl_basic_message_channel_new(messenger, update_options_channel_name, FL_MESSAGE_CODEC(codec)); - fl_basic_message_channel_set_message_handler(update_options_channel, nullptr, nullptr, nullptr); -} - -void maplibre_map_libre_host_api_respond_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiJumpToResponse) response = maplibre_map_libre_host_api_jump_to_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "jumpTo", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiJumpToResponse) response = maplibre_map_libre_host_api_jump_to_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "jumpTo", error->message); - } -} - -void maplibre_map_libre_host_api_respond_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiFlyToResponse) response = maplibre_map_libre_host_api_fly_to_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "flyTo", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiFlyToResponse) response = maplibre_map_libre_host_api_fly_to_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "flyTo", error->message); - } -} - -void maplibre_map_libre_host_api_respond_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreMapCamera* return_value) { - g_autoptr(MaplibreMapLibreHostApiGetCameraResponse) response = maplibre_map_libre_host_api_get_camera_response_new(return_value); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getCamera", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiGetCameraResponse) response = maplibre_map_libre_host_api_get_camera_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getCamera", error->message); - } -} - -void maplibre_map_libre_host_api_respond_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLatBounds* return_value) { - g_autoptr(MaplibreMapLibreHostApiGetVisibleRegionResponse) response = maplibre_map_libre_host_api_get_visible_region_response_new(return_value); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getVisibleRegion", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiGetVisibleRegionResponse) response = maplibre_map_libre_host_api_get_visible_region_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getVisibleRegion", error->message); - } -} - -void maplibre_map_libre_host_api_respond_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreScreenLocation* return_value) { - g_autoptr(MaplibreMapLibreHostApiToScreenLocationResponse) response = maplibre_map_libre_host_api_to_screen_location_response_new(return_value); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toScreenLocation", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiToScreenLocationResponse) response = maplibre_map_libre_host_api_to_screen_location_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toScreenLocation", error->message); - } -} - -void maplibre_map_libre_host_api_respond_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLat* return_value) { - g_autoptr(MaplibreMapLibreHostApiToLngLatResponse) response = maplibre_map_libre_host_api_to_lng_lat_response_new(return_value); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toLngLat", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiToLngLatResponse) response = maplibre_map_libre_host_api_to_lng_lat_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toLngLat", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddFillLayerResponse) response = maplibre_map_libre_host_api_add_fill_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddFillLayerResponse) response = maplibre_map_libre_host_api_add_fill_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddCircleLayerResponse) response = maplibre_map_libre_host_api_add_circle_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addCircleLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddCircleLayerResponse) response = maplibre_map_libre_host_api_add_circle_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addCircleLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddBackgroundLayerResponse) response = maplibre_map_libre_host_api_add_background_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addBackgroundLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddBackgroundLayerResponse) response = maplibre_map_libre_host_api_add_background_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addBackgroundLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse) response = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillExtrusionLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse) response = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillExtrusionLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddHeatmapLayerResponse) response = maplibre_map_libre_host_api_add_heatmap_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHeatmapLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddHeatmapLayerResponse) response = maplibre_map_libre_host_api_add_heatmap_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHeatmapLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddHillshadeLayerResponse) response = maplibre_map_libre_host_api_add_hillshade_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHillshadeLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddHillshadeLayerResponse) response = maplibre_map_libre_host_api_add_hillshade_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHillshadeLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddLineLayerResponse) response = maplibre_map_libre_host_api_add_line_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addLineLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddLineLayerResponse) response = maplibre_map_libre_host_api_add_line_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addLineLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddRasterLayerResponse) response = maplibre_map_libre_host_api_add_raster_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddRasterLayerResponse) response = maplibre_map_libre_host_api_add_raster_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddSymbolLayerResponse) response = maplibre_map_libre_host_api_add_symbol_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addSymbolLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddSymbolLayerResponse) response = maplibre_map_libre_host_api_add_symbol_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addSymbolLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiRemoveLayerResponse) response = maplibre_map_libre_host_api_remove_layer_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiRemoveLayerResponse) response = maplibre_map_libre_host_api_remove_layer_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeLayer", error->message); - } -} - -void maplibre_map_libre_host_api_respond_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiRemoveSourceResponse) response = maplibre_map_libre_host_api_remove_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiRemoveSourceResponse) response = maplibre_map_libre_host_api_remove_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const uint8_t* return_value, size_t return_value_length) { - g_autoptr(MaplibreMapLibreHostApiLoadImageResponse) response = maplibre_map_libre_host_api_load_image_response_new(return_value, return_value_length); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "loadImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiLoadImageResponse) response = maplibre_map_libre_host_api_load_image_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "loadImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddImageResponse) response = maplibre_map_libre_host_api_add_image_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddImageResponse) response = maplibre_map_libre_host_api_add_image_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiRemoveImageResponse) response = maplibre_map_libre_host_api_remove_image_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiRemoveImageResponse) response = maplibre_map_libre_host_api_remove_image_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeImage", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddGeoJsonSourceResponse) response = maplibre_map_libre_host_api_add_geo_json_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addGeoJsonSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddGeoJsonSourceResponse) response = maplibre_map_libre_host_api_add_geo_json_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addGeoJsonSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse) response = maplibre_map_libre_host_api_update_geo_json_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateGeoJsonSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse) response = maplibre_map_libre_host_api_update_geo_json_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateGeoJsonSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddImageSourceResponse) response = maplibre_map_libre_host_api_add_image_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImageSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddImageSourceResponse) response = maplibre_map_libre_host_api_add_image_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImageSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddRasterSourceResponse) response = maplibre_map_libre_host_api_add_raster_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddRasterSourceResponse) response = maplibre_map_libre_host_api_add_raster_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddRasterDemSourceResponse) response = maplibre_map_libre_host_api_add_raster_dem_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterDemSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddRasterDemSourceResponse) response = maplibre_map_libre_host_api_add_raster_dem_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterDemSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiAddVectorSourceResponse) response = maplibre_map_libre_host_api_add_vector_source_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addVectorSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiAddVectorSourceResponse) response = maplibre_map_libre_host_api_add_vector_source_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addVectorSource", error->message); - } -} - -void maplibre_map_libre_host_api_respond_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle) { - g_autoptr(MaplibreMapLibreHostApiUpdateOptionsResponse) response = maplibre_map_libre_host_api_update_options_response_new(); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateOptions", error->message); - } -} - -void maplibre_map_libre_host_api_respond_error_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { - g_autoptr(MaplibreMapLibreHostApiUpdateOptionsResponse) response = maplibre_map_libre_host_api_update_options_response_new_error(code, message, details); - g_autoptr(GError) error = nullptr; - if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { - g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateOptions", error->message); - } -} - -struct _MaplibreMapLibreFlutterApi { - GObject parent_instance; - - FlBinaryMessenger* messenger; - gchar *suffix; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApi, maplibre_map_libre_flutter_api, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_dispose(GObject* object) { - MaplibreMapLibreFlutterApi* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API(object); - g_clear_object(&self->messenger); - g_clear_pointer(&self->suffix, g_free); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_init(MaplibreMapLibreFlutterApi* self) { -} - -static void maplibre_map_libre_flutter_api_class_init(MaplibreMapLibreFlutterApiClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_dispose; -} - -MaplibreMapLibreFlutterApi* maplibre_map_libre_flutter_api_new(FlBinaryMessenger* messenger, const gchar* suffix) { - MaplibreMapLibreFlutterApi* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API(g_object_new(maplibre_map_libre_flutter_api_get_type(), nullptr)); - self->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger)); - self->suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); - return self; -} - -struct _MaplibreMapLibreFlutterApiGetOptionsResponse { - GObject parent_instance; - - FlValue* error; - FlValue* return_value; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiGetOptionsResponse, maplibre_map_libre_flutter_api_get_options_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_get_options_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiGetOptionsResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - g_clear_pointer(&self->return_value, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_get_options_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_get_options_response_init(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { -} - -static void maplibre_map_libre_flutter_api_get_options_response_class_init(MaplibreMapLibreFlutterApiGetOptionsResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_get_options_response_dispose; -} - -static MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiGetOptionsResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_get_options_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - else { - FlValue* value = fl_value_get_list_value(response, 0); - self->return_value = fl_value_ref(value); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_get_options_response_is_error(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_code(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_message(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_get_options_response_get_error_details(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -MaplibreMapOptions* maplibre_map_libre_flutter_api_get_options_response_get_return_value(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); - g_assert(!maplibre_map_libre_flutter_api_get_options_response_is_error(self)); - return MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(self->return_value)); -} - -static void maplibre_map_libre_flutter_api_get_options_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_get_options(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_get_options_cb, task); -} - -MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_get_options_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnStyleLoadedResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnStyleLoadedResponse, maplibre_map_libre_flutter_api_on_style_loaded_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_style_loaded_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_style_loaded_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_style_loaded_response_init(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_style_loaded_response_class_init(MaplibreMapLibreFlutterApiOnStyleLoadedResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_style_loaded_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_style_loaded_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_style_loaded_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_style_loaded(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_style_loaded_cb, task); -} - -MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_style_loaded_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnClickResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnClickResponse, maplibre_map_libre_flutter_api_on_click_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_click_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_click_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_click_response_init(MaplibreMapLibreFlutterApiOnClickResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_click_response_class_init(MaplibreMapLibreFlutterApiOnClickResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_click_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_click_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_click_response_is_error(MaplibreMapLibreFlutterApiOnClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_code(MaplibreMapLibreFlutterApiOnClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_message(MaplibreMapLibreFlutterApiOnClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_click_response_get_error_details(MaplibreMapLibreFlutterApiOnClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_click_cb, task); -} - -MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_click_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnIdleResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_idle_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_idle_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_idle_response_init(MaplibreMapLibreFlutterApiOnIdleResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_idle_response_class_init(MaplibreMapLibreFlutterApiOnIdleResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_idle_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_idle_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_idle_cb, task); -} - -MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_idle_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnCameraIdleResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_camera_idle_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_idle_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_camera_idle_response_init(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_camera_idle_response_class_init(MaplibreMapLibreFlutterApiOnCameraIdleResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_idle_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_idle_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_camera_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_idle_cb, task); -} - -MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_camera_idle_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnSecondaryClickResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_secondary_click_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_secondary_click_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_secondary_click_response_init(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_secondary_click_response_class_init(MaplibreMapLibreFlutterApiOnSecondaryClickResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_secondary_click_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_secondary_click_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_secondary_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_secondary_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_secondary_click_cb, task); -} - -MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_secondary_click_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnDoubleClickResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnDoubleClickResponse, maplibre_map_libre_flutter_api_on_double_click_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_double_click_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnDoubleClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_double_click_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_double_click_response_init(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_double_click_response_class_init(MaplibreMapLibreFlutterApiOnDoubleClickResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_double_click_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnDoubleClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_double_click_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_double_click_response_is_error(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_code(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_message(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_double_click_response_get_error_details(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_double_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_double_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_double_click_cb, task); -} - -MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_double_click_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnLongClickResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnLongClickResponse, maplibre_map_libre_flutter_api_on_long_click_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_long_click_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnLongClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_long_click_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_long_click_response_init(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_long_click_response_class_init(MaplibreMapLibreFlutterApiOnLongClickResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_long_click_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnLongClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_long_click_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_long_click_response_is_error(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_code(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_message(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_long_click_response_get_error_details(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_long_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_long_click_cb, task); -} - -MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_long_click_response_new(response); -} - -struct _MaplibreMapLibreFlutterApiOnCameraMovedResponse { - GObject parent_instance; - - FlValue* error; -}; - -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, G_TYPE_OBJECT) - -static void maplibre_map_libre_flutter_api_on_camera_moved_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(object); - g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_moved_response_parent_class)->dispose(object); -} - -static void maplibre_map_libre_flutter_api_on_camera_moved_response_init(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { -} - -static void maplibre_map_libre_flutter_api_on_camera_moved_response_class_init(MaplibreMapLibreFlutterApiOnCameraMovedResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_moved_response_dispose; -} - -static MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_moved_response_get_type(), nullptr)); - if (fl_value_get_length(response) > 1) { - self->error = fl_value_ref(response); - } - return self; -} - -gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), FALSE); - return self->error != nullptr; -} - -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 0)); -} - -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); - return fl_value_get_string(fl_value_get_list_value(self->error, 1)); -} - -FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); - return fl_value_get_list_value(self->error, 2); -} - -static void maplibre_map_libre_flutter_api_on_camera_moved_cb(GObject* object, GAsyncResult* result, gpointer user_data) { - GTask* task = G_TASK(user_data); - g_task_return_pointer(task, result, g_object_unref); -} - -void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* self, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { - g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(134, G_OBJECT(camera))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved%s", self->suffix); - g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); - FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); - GTask* task = g_task_new(self, cancellable, callback, user_data); - g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_moved_cb, task); -} - -MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { - g_autoptr(GTask) task = G_TASK(result); - GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); - FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); - g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); - if (response == nullptr) { - return nullptr; - } - return maplibre_map_libre_flutter_api_on_camera_moved_response_new(response); -} diff --git a/linux/pigeon.g.h b/linux/pigeon.g.h index 84db585..55cd5ca 100644 --- a/linux/pigeon.g.h +++ b/linux/pigeon.g.h @@ -40,155 +40,6 @@ typedef enum { MAPLIBRE_RASTER_DEM_ENCODING_CUSTOM = 2 } MaplibreRasterDemEncoding; -/** - * MaplibreMapOptions: - * - * The map options define initial values for the MapLibre map. - */ - -G_DECLARE_FINAL_TYPE(MaplibreMapOptions, maplibre_map_options, MAPLIBRE, MAP_OPTIONS, GObject) - -/** - * maplibre_map_options_new: - * style: field in this object. - * zoom: field in this object. - * tilt: field in this object. - * bearing: field in this object. - * center: field in this object. - * max_bounds: field in this object. - * min_zoom: field in this object. - * max_zoom: field in this object. - * min_tilt: field in this object. - * max_tilt: field in this object. - * listens_on_click: field in this object. - * listens_on_long_click: field in this object. - * - * Creates a new #MapOptions object. - * - * Returns: a new #MaplibreMapOptions - */ -MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double tilt, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_tilt, double max_tilt, gboolean listens_on_click, gboolean listens_on_long_click); - -/** - * maplibre_map_options_get_style - * @object: a #MaplibreMapOptions. - * - * The URL of the used map style. - * - * Returns: the field value. - */ -const gchar* maplibre_map_options_get_style(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_zoom - * @object: a #MaplibreMapOptions. - * - * The initial zoom level of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_zoom(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_tilt - * @object: a #MaplibreMapOptions. - * - * The initial tilt of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_tilt(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_bearing - * @object: a #MaplibreMapOptions. - * - * The initial bearing of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_bearing(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_center - * @object: a #MaplibreMapOptions. - * - * The initial center coordinates of the map. - * - * Returns: the field value. - */ -MaplibreLngLat* maplibre_map_options_get_center(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_max_bounds - * @object: a #MaplibreMapOptions. - * - * The maximum bounding box of the map camera. - * - * Returns: the field value. - */ -MaplibreLngLatBounds* maplibre_map_options_get_max_bounds(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_min_zoom - * @object: a #MaplibreMapOptions. - * - * The minimum zoom level of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_min_zoom(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_max_zoom - * @object: a #MaplibreMapOptions. - * - * The maximum zoom level of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_max_zoom(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_min_tilt - * @object: a #MaplibreMapOptions. - * - * The minimum pitch / tilt of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_min_tilt(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_max_tilt - * @object: a #MaplibreMapOptions. - * - * The maximum pitch / tilt of the map. - * - * Returns: the field value. - */ -double maplibre_map_options_get_max_tilt(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_listens_on_click - * @object: a #MaplibreMapOptions. - * - * If the native map should listen to click events. - * - * Returns: the field value. - */ -gboolean maplibre_map_options_get_listens_on_click(MaplibreMapOptions* object); - -/** - * maplibre_map_options_get_listens_on_long_click - * @object: a #MaplibreMapOptions. - * - * If the native map should listen to long click events. - * - * Returns: the field value. - */ -gboolean maplibre_map_options_get_listens_on_long_click(MaplibreMapOptions* object); - /** * MaplibreLngLat: * @@ -389,1228 +240,6 @@ double maplibre_lng_lat_bounds_get_latitude_south(MaplibreLngLatBounds* object); */ double maplibre_lng_lat_bounds_get_latitude_north(MaplibreLngLatBounds* object); -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiResponseHandle, maplibre_map_libre_host_api_response_handle, MAPLIBRE, MAP_LIBRE_HOST_API_RESPONSE_HANDLE, GObject) - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE, GObject) - -/** - * maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new: - * - * Creates a new response to MapLibreHostApi.getMetersPerPixelAtLatitude. - * - * Returns: a new #MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse - */ -MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new(double return_value); - -/** - * maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error: - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Creates a new error response to MapLibreHostApi.getMetersPerPixelAtLatitude. - * - * Returns: a new #MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse - */ -MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error(const gchar* code, const gchar* message, FlValue* details); - -/** - * MaplibreMapLibreHostApiVTable: - * - * Table of functions exposed by MapLibreHostApi to be implemented by the API provider. - */ -typedef struct { - void (*jump_to)(MaplibreLngLat* center, double* zoom, double* bearing, double* pitch, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*fly_to)(MaplibreLngLat* center, double* zoom, double* bearing, double* pitch, int64_t duration_ms, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*get_camera)(MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*get_visible_region)(MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*to_screen_location)(double lng, double lat, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*to_lng_lat)(double x, double y, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_fill_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_circle_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_background_layer)(const gchar* id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_fill_extrusion_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_heatmap_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_hillshade_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_line_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_raster_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_symbol_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*remove_layer)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*remove_source)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*load_image)(const gchar* url, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_image)(const gchar* id, const uint8_t* bytes, size_t bytes_length, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*remove_image)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_geo_json_source)(const gchar* id, const gchar* data, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*update_geo_json_source)(const gchar* id, const gchar* data, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_image_source)(const gchar* id, const gchar* url, FlValue* coordinates, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_raster_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, double min_zoom, double max_zoom, int64_t tile_size, MaplibreTileScheme scheme, const gchar* attribution, gboolean volatile, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_raster_dem_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, double min_zoom, double max_zoom, int64_t tile_size, const gchar* attribution, MaplibreRasterDemEncoding encoding, gboolean volatile, double red_factor, double blue_factor, double green_factor, double base_shift, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - void (*add_vector_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, MaplibreTileScheme scheme, double min_zoom, double max_zoom, const gchar* attribution, gboolean volatile, const gchar* source_layer, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); - MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* (*get_meters_per_pixel_at_latitude)(double latitude, gpointer user_data); - void (*update_options)(MaplibreMapOptions* options, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); -} MaplibreMapLibreHostApiVTable; - -/** - * maplibre_map_libre_host_api_set_method_handlers: - * - * @messenger: an #FlBinaryMessenger. - * @suffix: (allow-none): a suffix to add to the API or %NULL for none. - * @vtable: implementations of the methods in this API. - * @user_data: (closure): user data to pass to the functions in @vtable. - * @user_data_free_func: (allow-none): a function which gets called to free @user_data, or %NULL. - * - * Connects the method handlers in the MapLibreHostApi API. - */ -void maplibre_map_libre_host_api_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func); - -/** - * maplibre_map_libre_host_api_clear_method_handlers: - * - * @messenger: an #FlBinaryMessenger. - * @suffix: (allow-none): a suffix to add to the API or %NULL for none. - * - * Clears the method handlers in the MapLibreHostApi API. - */ -void maplibre_map_libre_host_api_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix); - -/** - * maplibre_map_libre_host_api_respond_jump_to: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.jumpTo. - */ -void maplibre_map_libre_host_api_respond_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_jump_to: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.jumpTo. - */ -void maplibre_map_libre_host_api_respond_error_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_fly_to: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.flyTo. - */ -void maplibre_map_libre_host_api_respond_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_fly_to: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.flyTo. - */ -void maplibre_map_libre_host_api_respond_error_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_get_camera: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @return_value: location to write the value returned by this method. - * - * Responds to MapLibreHostApi.getCamera. - */ -void maplibre_map_libre_host_api_respond_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreMapCamera* return_value); - -/** - * maplibre_map_libre_host_api_respond_error_get_camera: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.getCamera. - */ -void maplibre_map_libre_host_api_respond_error_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_get_visible_region: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @return_value: location to write the value returned by this method. - * - * Responds to MapLibreHostApi.getVisibleRegion. - */ -void maplibre_map_libre_host_api_respond_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLatBounds* return_value); - -/** - * maplibre_map_libre_host_api_respond_error_get_visible_region: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.getVisibleRegion. - */ -void maplibre_map_libre_host_api_respond_error_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_to_screen_location: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @return_value: location to write the value returned by this method. - * - * Responds to MapLibreHostApi.toScreenLocation. - */ -void maplibre_map_libre_host_api_respond_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreScreenLocation* return_value); - -/** - * maplibre_map_libre_host_api_respond_error_to_screen_location: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.toScreenLocation. - */ -void maplibre_map_libre_host_api_respond_error_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_to_lng_lat: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @return_value: location to write the value returned by this method. - * - * Responds to MapLibreHostApi.toLngLat. - */ -void maplibre_map_libre_host_api_respond_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLat* return_value); - -/** - * maplibre_map_libre_host_api_respond_error_to_lng_lat: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.toLngLat. - */ -void maplibre_map_libre_host_api_respond_error_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_fill_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addFillLayer. - */ -void maplibre_map_libre_host_api_respond_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_fill_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addFillLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_circle_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addCircleLayer. - */ -void maplibre_map_libre_host_api_respond_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_circle_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addCircleLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_background_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addBackgroundLayer. - */ -void maplibre_map_libre_host_api_respond_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_background_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addBackgroundLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_fill_extrusion_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addFillExtrusionLayer. - */ -void maplibre_map_libre_host_api_respond_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addFillExtrusionLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_heatmap_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addHeatmapLayer. - */ -void maplibre_map_libre_host_api_respond_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_heatmap_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addHeatmapLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_hillshade_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addHillshadeLayer. - */ -void maplibre_map_libre_host_api_respond_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_hillshade_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addHillshadeLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_line_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addLineLayer. - */ -void maplibre_map_libre_host_api_respond_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_line_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addLineLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_raster_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addRasterLayer. - */ -void maplibre_map_libre_host_api_respond_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_raster_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addRasterLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_symbol_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addSymbolLayer. - */ -void maplibre_map_libre_host_api_respond_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_symbol_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addSymbolLayer. - */ -void maplibre_map_libre_host_api_respond_error_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_remove_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.removeLayer. - */ -void maplibre_map_libre_host_api_respond_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_remove_layer: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.removeLayer. - */ -void maplibre_map_libre_host_api_respond_error_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_remove_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.removeSource. - */ -void maplibre_map_libre_host_api_respond_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_remove_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.removeSource. - */ -void maplibre_map_libre_host_api_respond_error_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_load_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @return_value: location to write the value returned by this method. - * @return_value_length: (allow-none): location to write length of @return_value or %NULL to ignore. - * - * Responds to MapLibreHostApi.loadImage. - */ -void maplibre_map_libre_host_api_respond_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const uint8_t* return_value, size_t return_value_length); - -/** - * maplibre_map_libre_host_api_respond_error_load_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.loadImage. - */ -void maplibre_map_libre_host_api_respond_error_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addImage. - */ -void maplibre_map_libre_host_api_respond_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addImage. - */ -void maplibre_map_libre_host_api_respond_error_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_remove_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.removeImage. - */ -void maplibre_map_libre_host_api_respond_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_remove_image: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.removeImage. - */ -void maplibre_map_libre_host_api_respond_error_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_geo_json_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addGeoJsonSource. - */ -void maplibre_map_libre_host_api_respond_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_geo_json_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addGeoJsonSource. - */ -void maplibre_map_libre_host_api_respond_error_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_update_geo_json_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.updateGeoJsonSource. - */ -void maplibre_map_libre_host_api_respond_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_update_geo_json_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.updateGeoJsonSource. - */ -void maplibre_map_libre_host_api_respond_error_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_image_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addImageSource. - */ -void maplibre_map_libre_host_api_respond_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_image_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addImageSource. - */ -void maplibre_map_libre_host_api_respond_error_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_raster_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addRasterSource. - */ -void maplibre_map_libre_host_api_respond_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_raster_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addRasterSource. - */ -void maplibre_map_libre_host_api_respond_error_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_raster_dem_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addRasterDemSource. - */ -void maplibre_map_libre_host_api_respond_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_raster_dem_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addRasterDemSource. - */ -void maplibre_map_libre_host_api_respond_error_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_add_vector_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.addVectorSource. - */ -void maplibre_map_libre_host_api_respond_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_add_vector_source: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.addVectorSource. - */ -void maplibre_map_libre_host_api_respond_error_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -/** - * maplibre_map_libre_host_api_respond_update_options: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * - * Responds to MapLibreHostApi.updateOptions. - */ -void maplibre_map_libre_host_api_respond_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle); - -/** - * maplibre_map_libre_host_api_respond_error_update_options: - * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. - * @code: error code. - * @message: error message. - * @details: (allow-none): error details or %NULL. - * - * Responds with an error to MapLibreHostApi.updateOptions. - */ -void maplibre_map_libre_host_api_respond_error_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiGetOptionsResponse, maplibre_map_libre_flutter_api_get_options_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_get_options_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. - * - * Checks if a response to MapLibreFlutterApi.getOptions is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_get_options_response_is_error(MaplibreMapLibreFlutterApiGetOptionsResponse* response); - -/** - * maplibre_map_libre_flutter_api_get_options_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_code(MaplibreMapLibreFlutterApiGetOptionsResponse* response); - -/** - * maplibre_map_libre_flutter_api_get_options_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_message(MaplibreMapLibreFlutterApiGetOptionsResponse* response); - -/** - * maplibre_map_libre_flutter_api_get_options_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_get_options_response_get_error_details(MaplibreMapLibreFlutterApiGetOptionsResponse* response); - -/** - * maplibre_map_libre_flutter_api_get_options_response_get_return_value: - * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. - * - * Get the return value for this response. - * - * Returns: a return value. - */ -MaplibreMapOptions* maplibre_map_libre_flutter_api_get_options_response_get_return_value(MaplibreMapLibreFlutterApiGetOptionsResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnStyleLoadedResponse, maplibre_map_libre_flutter_api_on_style_loaded_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_style_loaded_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. - * - * Checks if a response to MapLibreFlutterApi.onStyleLoaded is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnClickResponse, maplibre_map_libre_flutter_api_on_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_click_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. - * - * Checks if a response to MapLibreFlutterApi.onClick is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_click_response_is_error(MaplibreMapLibreFlutterApiOnClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_click_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_code(MaplibreMapLibreFlutterApiOnClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_click_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_message(MaplibreMapLibreFlutterApiOnClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_click_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_click_response_get_error_details(MaplibreMapLibreFlutterApiOnClickResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_idle_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. - * - * Checks if a response to MapLibreFlutterApi.onIdle is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_idle_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_idle_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_idle_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_camera_idle_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. - * - * Checks if a response to MapLibreFlutterApi.onCameraIdle is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_secondary_click_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. - * - * Checks if a response to MapLibreFlutterApi.onSecondaryClick is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnDoubleClickResponse, maplibre_map_libre_flutter_api_on_double_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_double_click_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. - * - * Checks if a response to MapLibreFlutterApi.onDoubleClick is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_double_click_response_is_error(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_double_click_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_code(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_double_click_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_message(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_double_click_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_double_click_response_get_error_details(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnLongClickResponse, maplibre_map_libre_flutter_api_on_long_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_long_click_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. - * - * Checks if a response to MapLibreFlutterApi.onLongClick is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_long_click_response_is_error(MaplibreMapLibreFlutterApiOnLongClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_long_click_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_code(MaplibreMapLibreFlutterApiOnLongClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_long_click_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_message(MaplibreMapLibreFlutterApiOnLongClickResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_long_click_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_long_click_response_get_error_details(MaplibreMapLibreFlutterApiOnLongClickResponse* response); - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE, GObject) - -/** - * maplibre_map_libre_flutter_api_on_camera_moved_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. - * - * Checks if a response to MapLibreFlutterApi.onCameraMoved is an error. - * - * Returns: a %TRUE if this response is an error. - */ -gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. - * - * Get the error code for this response. - * - * Returns: an error code or %NULL if not an error. - */ -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. - * - * Get the error message for this response. - * - * Returns: an error message. - */ -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); - -/** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. - * - * Get the error details for this response. - * - * Returns: (allow-none): an error details or %NULL. - */ -FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); - -/** - * MaplibreMapLibreFlutterApi: - * - */ - -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApi, maplibre_map_libre_flutter_api, MAPLIBRE, MAP_LIBRE_FLUTTER_API, GObject) - -/** - * maplibre_map_libre_flutter_api_new: - * @messenger: an #FlBinaryMessenger. - * @suffix: (allow-none): a suffix to add to the API or %NULL for none. - * - * Creates a new object to access the MapLibreFlutterApi API. - * - * Returns: a new #MaplibreMapLibreFlutterApi - */ -MaplibreMapLibreFlutterApi* maplibre_map_libre_flutter_api_new(FlBinaryMessenger* messenger, const gchar* suffix); - -/** - * maplibre_map_libre_flutter_api_get_options: - * @api: a #MaplibreMapLibreFlutterApi. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Get the map options from dart. - */ -void maplibre_map_libre_flutter_api_get_options(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_get_options_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_get_options() call. - * - * Returns: a #MaplibreMapLibreFlutterApiGetOptionsResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_style_loaded: - * @api: a #MaplibreMapLibreFlutterApi. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback for when the style has been loaded. - */ -void maplibre_map_libre_flutter_api_on_style_loaded(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_style_loaded_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_style_loaded() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_click: - * @api: a #MaplibreMapLibreFlutterApi. - * @point: parameter for this method. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the user clicks on the map. - */ -void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_click_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_click() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnClickResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_idle: - * @api: a #MaplibreMapLibreFlutterApi. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the map idles. - */ -void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_idle_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_idle() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnIdleResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_camera_idle: - * @api: a #MaplibreMapLibreFlutterApi. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the map camera idles. - */ -void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_camera_idle_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_camera_idle() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_secondary_click: - * @api: a #MaplibreMapLibreFlutterApi. - * @point: parameter for this method. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the user performs a secondary click on the map - * (e.g. by default a click with the right mouse button). - */ -void maplibre_map_libre_flutter_api_on_secondary_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_secondary_click_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_secondary_click() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_double_click: - * @api: a #MaplibreMapLibreFlutterApi. - * @point: parameter for this method. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the user performs a double click on the map. - */ -void maplibre_map_libre_flutter_api_on_double_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_double_click_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_double_click() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_long_click: - * @api: a #MaplibreMapLibreFlutterApi. - * @point: parameter for this method. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the user performs a long lasting click on the map. - */ -void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_long_click_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_long_click() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnLongClickResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - -/** - * maplibre_map_libre_flutter_api_on_camera_moved: - * @api: a #MaplibreMapLibreFlutterApi. - * @camera: parameter for this method. - * @cancellable: (allow-none): a #GCancellable or %NULL. - * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. - * @user_data: (closure): user data to pass to @callback. - * - * Callback when the map camera changes. - */ -void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* api, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); - -/** - * maplibre_map_libre_flutter_api_on_camera_moved_finish: - * @api: a #MaplibreMapLibreFlutterApi. - * @result: a #GAsyncResult. - * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. - * - * Completes a maplibre_map_libre_flutter_api_on_camera_moved() call. - * - * Returns: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse or %NULL on error. - */ -MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); - G_END_DECLS #endif // PIGEON_PIGEON_G_H_ diff --git a/macos/Classes/Pigeon.g.swift b/macos/Classes/Pigeon.g.swift index be85aa8..d6711ca 100644 --- a/macos/Classes/Pigeon.g.swift +++ b/macos/Classes/Pigeon.g.swift @@ -29,36 +29,6 @@ final class PigeonError: Error { } } -private func wrapResult(_ result: Any?) -> [Any?] { - return [result] -} - -private func wrapError(_ error: Any) -> [Any?] { - if let pigeonError = error as? PigeonError { - return [ - pigeonError.code, - pigeonError.message, - pigeonError.details, - ] - } - if let flutterError = error as? FlutterError { - return [ - flutterError.code, - flutterError.message, - flutterError.details, - ] - } - return [ - "\(error)", - "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)", - ] -} - -private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") -} - private func isNullish(_ value: Any?) -> Bool { return value is NSNull || value == nil } @@ -87,85 +57,6 @@ enum RasterDemEncoding: Int { case custom = 2 } -/// The map options define initial values for the MapLibre map. -/// -/// Generated class from Pigeon that represents data sent in messages. -struct MapOptions { - /// The URL of the used map style. - var style: String - /// The initial zoom level of the map. - var zoom: Double - /// The initial tilt of the map. - var tilt: Double - /// The initial bearing of the map. - var bearing: Double - /// The initial center coordinates of the map. - var center: LngLat? = nil - /// The maximum bounding box of the map camera. - var maxBounds: LngLatBounds? = nil - /// The minimum zoom level of the map. - var minZoom: Double - /// The maximum zoom level of the map. - var maxZoom: Double - /// The minimum pitch / tilt of the map. - var minTilt: Double - /// The maximum pitch / tilt of the map. - var maxTilt: Double - /// If the native map should listen to click events. - var listensOnClick: Bool - /// If the native map should listen to long click events. - var listensOnLongClick: Bool - - - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> MapOptions? { - let style = pigeonVar_list[0] as! String - let zoom = pigeonVar_list[1] as! Double - let tilt = pigeonVar_list[2] as! Double - let bearing = pigeonVar_list[3] as! Double - let center: LngLat? = nilOrValue(pigeonVar_list[4]) - let maxBounds: LngLatBounds? = nilOrValue(pigeonVar_list[5]) - let minZoom = pigeonVar_list[6] as! Double - let maxZoom = pigeonVar_list[7] as! Double - let minTilt = pigeonVar_list[8] as! Double - let maxTilt = pigeonVar_list[9] as! Double - let listensOnClick = pigeonVar_list[10] as! Bool - let listensOnLongClick = pigeonVar_list[11] as! Bool - - return MapOptions( - style: style, - zoom: zoom, - tilt: tilt, - bearing: bearing, - center: center, - maxBounds: maxBounds, - minZoom: minZoom, - maxZoom: maxZoom, - minTilt: minTilt, - maxTilt: maxTilt, - listensOnClick: listensOnClick, - listensOnLongClick: listensOnLongClick - ) - } - func toList() -> [Any?] { - return [ - style, - zoom, - tilt, - bearing, - center, - maxBounds, - minZoom, - maxZoom, - minTilt, - maxTilt, - listensOnClick, - listensOnLongClick, - ] - } -} - /// A longitude/latitude coordinate object. /// /// Generated class from Pigeon that represents data sent in messages. @@ -310,14 +201,12 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return MapOptions.fromList(self.readValue() as! [Any?]) - case 132: return LngLat.fromList(self.readValue() as! [Any?]) - case 133: + case 132: return ScreenLocation.fromList(self.readValue() as! [Any?]) - case 134: + case 133: return MapCamera.fromList(self.readValue() as! [Any?]) - case 135: + case 134: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -333,20 +222,17 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? MapOptions { - super.writeByte(131) - super.writeValue(value.toList()) } else if let value = value as? LngLat { - super.writeByte(132) + super.writeByte(131) super.writeValue(value.toList()) } else if let value = value as? ScreenLocation { - super.writeByte(133) + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? MapCamera { - super.writeByte(134) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? LngLatBounds { - super.writeByte(135) + super.writeByte(134) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -368,864 +254,3 @@ class PigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { static let shared = PigeonPigeonCodec(readerWriter: PigeonPigeonCodecReaderWriter()) } - -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol MapLibreHostApi { - /// Move the viewport of the map to a new location without any animation. - func jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, completion: @escaping (Result) -> Void) - /// Animate the viewport of the map to a new location. - func flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Int64, completion: @escaping (Result) -> Void) - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - func getCamera(completion: @escaping (Result) -> Void) - /// Get the visible region of the current map camera. - func getVisibleRegion(completion: @escaping (Result) -> Void) - /// Convert a coordinate to a location on the screen. - func toScreenLocation(lng: Double, lat: Double, completion: @escaping (Result) -> Void) - /// Convert a screen location to a coordinate. - func toLngLat(x: Double, y: Double, completion: @escaping (Result) -> Void) - /// Add a fill layer to the map style. - func addFillLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a circle layer to the map style. - func addCircleLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a background layer to the map style. - func addBackgroundLayer(id: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a fill extrusion layer to the map style. - func addFillExtrusionLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a heatmap layer to the map style. - func addHeatmapLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a hillshade layer to the map style. - func addHillshadeLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a line layer to the map style. - func addLineLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a raster layer to the map style. - func addRasterLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Add a symbol layer to the map style. - func addSymbolLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) - /// Removes the layer with the given ID from the map's style. - func removeLayer(id: String, completion: @escaping (Result) -> Void) - /// Removes the source with the given ID from the map's style. - func removeSource(id: String, completion: @escaping (Result) -> Void) - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - func loadImage(url: String, completion: @escaping (Result) -> Void) - /// Add an image to the map. - func addImage(id: String, bytes: FlutterStandardTypedData, completion: @escaping (Result) -> Void) - /// Removes an image from the map - func removeImage(id: String, completion: @escaping (Result) -> Void) - /// Add a GeoJSON source to the map style. - func addGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) - /// Update the data of a GeoJSON source. - func updateGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) - /// Add a image source to the map style. - func addImageSource(id: String, url: String, coordinates: [LngLat], completion: @escaping (Result) -> Void) - /// Add a raster source to the map style. - func addRasterSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, scheme: TileScheme, attribution: String?, volatile: Bool, completion: @escaping (Result) -> Void) - /// Add a raster DEM source to the map style. - func addRasterDemSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, attribution: String?, encoding: RasterDemEncoding, volatile: Bool, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, completion: @escaping (Result) -> Void) - /// Add a vector source to the map style. - func addVectorSource(id: String, url: String?, tiles: [String]?, bounds: [Double], scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Bool, sourceLayer: String?, completion: @escaping (Result) -> Void) - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - func getMetersPerPixelAtLatitude(latitude: Double) throws -> Double - /// Update the map options. - func updateOptions(options: MapOptions, completion: @escaping (Result) -> Void) -} - -/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -class MapLibreHostApiSetup { - static var codec: FlutterStandardMessageCodec { PigeonPigeonCodec.shared } - /// Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { - let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - /// Move the viewport of the map to a new location without any animation. - let jumpToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - jumpToChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let centerArg: LngLat? = nilOrValue(args[0]) - let zoomArg: Double? = nilOrValue(args[1]) - let bearingArg: Double? = nilOrValue(args[2]) - let pitchArg: Double? = nilOrValue(args[3]) - api.jumpTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - jumpToChannel.setMessageHandler(nil) - } - /// Animate the viewport of the map to a new location. - let flyToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - flyToChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let centerArg: LngLat? = nilOrValue(args[0]) - let zoomArg: Double? = nilOrValue(args[1]) - let bearingArg: Double? = nilOrValue(args[2]) - let pitchArg: Double? = nilOrValue(args[3]) - let durationMsArg = args[4] as! Int64 - api.flyTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg, durationMs: durationMsArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - flyToChannel.setMessageHandler(nil) - } - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - let getCameraChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCameraChannel.setMessageHandler { _, reply in - api.getCamera { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getCameraChannel.setMessageHandler(nil) - } - /// Get the visible region of the current map camera. - let getVisibleRegionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getVisibleRegionChannel.setMessageHandler { _, reply in - api.getVisibleRegion { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getVisibleRegionChannel.setMessageHandler(nil) - } - /// Convert a coordinate to a location on the screen. - let toScreenLocationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - toScreenLocationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let lngArg = args[0] as! Double - let latArg = args[1] as! Double - api.toScreenLocation(lng: lngArg, lat: latArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - toScreenLocationChannel.setMessageHandler(nil) - } - /// Convert a screen location to a coordinate. - let toLngLatChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - toLngLatChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let xArg = args[0] as! Double - let yArg = args[1] as! Double - api.toLngLat(x: xArg, y: yArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - toLngLatChannel.setMessageHandler(nil) - } - /// Add a fill layer to the map style. - let addFillLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addFillLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addFillLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addFillLayerChannel.setMessageHandler(nil) - } - /// Add a circle layer to the map style. - let addCircleLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addCircleLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addCircleLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addCircleLayerChannel.setMessageHandler(nil) - } - /// Add a background layer to the map style. - let addBackgroundLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addBackgroundLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let layoutArg = args[1] as! [String: Any] - let paintArg = args[2] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[3]) - api.addBackgroundLayer(id: idArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addBackgroundLayerChannel.setMessageHandler(nil) - } - /// Add a fill extrusion layer to the map style. - let addFillExtrusionLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addFillExtrusionLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addFillExtrusionLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addFillExtrusionLayerChannel.setMessageHandler(nil) - } - /// Add a heatmap layer to the map style. - let addHeatmapLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addHeatmapLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addHeatmapLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addHeatmapLayerChannel.setMessageHandler(nil) - } - /// Add a hillshade layer to the map style. - let addHillshadeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addHillshadeLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addHillshadeLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addHillshadeLayerChannel.setMessageHandler(nil) - } - /// Add a line layer to the map style. - let addLineLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addLineLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addLineLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addLineLayerChannel.setMessageHandler(nil) - } - /// Add a raster layer to the map style. - let addRasterLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addRasterLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterLayerChannel.setMessageHandler(nil) - } - /// Add a symbol layer to the map style. - let addSymbolLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addSymbolLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let sourceIdArg = args[1] as! String - let layoutArg = args[2] as! [String: Any] - let paintArg = args[3] as! [String: Any] - let belowLayerIdArg: String? = nilOrValue(args[4]) - api.addSymbolLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addSymbolLayerChannel.setMessageHandler(nil) - } - /// Removes the layer with the given ID from the map's style. - let removeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeLayerChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeLayer(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeLayerChannel.setMessageHandler(nil) - } - /// Removes the source with the given ID from the map's style. - let removeSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeSource(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeSourceChannel.setMessageHandler(nil) - } - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - let loadImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let urlArg = args[0] as! String - api.loadImage(url: urlArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - loadImageChannel.setMessageHandler(nil) - } - /// Add an image to the map. - let addImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let bytesArg = args[1] as! FlutterStandardTypedData - api.addImage(id: idArg, bytes: bytesArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addImageChannel.setMessageHandler(nil) - } - /// Removes an image from the map - let removeImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - removeImageChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - api.removeImage(id: idArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - removeImageChannel.setMessageHandler(nil) - } - /// Add a GeoJSON source to the map style. - let addGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addGeoJsonSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let dataArg = args[1] as! String - api.addGeoJsonSource(id: idArg, data: dataArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addGeoJsonSourceChannel.setMessageHandler(nil) - } - /// Update the data of a GeoJSON source. - let updateGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - updateGeoJsonSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let dataArg = args[1] as! String - api.updateGeoJsonSource(id: idArg, data: dataArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - updateGeoJsonSourceChannel.setMessageHandler(nil) - } - /// Add a image source to the map style. - let addImageSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addImageSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg = args[1] as! String - let coordinatesArg = args[2] as! [LngLat] - api.addImageSource(id: idArg, url: urlArg, coordinates: coordinatesArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addImageSourceChannel.setMessageHandler(nil) - } - /// Add a raster source to the map style. - let addRasterSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let minZoomArg = args[4] as! Double - let maxZoomArg = args[5] as! Double - let tileSizeArg = args[6] as! Int64 - let schemeArg = args[7] as! TileScheme - let attributionArg: String? = nilOrValue(args[8]) - let volatileArg = args[9] as! Bool - api.addRasterSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, scheme: schemeArg, attribution: attributionArg, volatile: volatileArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterSourceChannel.setMessageHandler(nil) - } - /// Add a raster DEM source to the map style. - let addRasterDemSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addRasterDemSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let minZoomArg = args[4] as! Double - let maxZoomArg = args[5] as! Double - let tileSizeArg = args[6] as! Int64 - let attributionArg: String? = nilOrValue(args[7]) - let encodingArg = args[8] as! RasterDemEncoding - let volatileArg = args[9] as! Bool - let redFactorArg = args[10] as! Double - let blueFactorArg = args[11] as! Double - let greenFactorArg = args[12] as! Double - let baseShiftArg = args[13] as! Double - api.addRasterDemSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, attribution: attributionArg, encoding: encodingArg, volatile: volatileArg, redFactor: redFactorArg, blueFactor: blueFactorArg, greenFactor: greenFactorArg, baseShift: baseShiftArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addRasterDemSourceChannel.setMessageHandler(nil) - } - /// Add a vector source to the map style. - let addVectorSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - addVectorSourceChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let idArg = args[0] as! String - let urlArg: String? = nilOrValue(args[1]) - let tilesArg: [String]? = nilOrValue(args[2]) - let boundsArg = args[3] as! [Double] - let schemeArg = args[4] as! TileScheme - let minZoomArg = args[5] as! Double - let maxZoomArg = args[6] as! Double - let attributionArg: String? = nilOrValue(args[7]) - let volatileArg = args[8] as! Bool - let sourceLayerArg: String? = nilOrValue(args[9]) - api.addVectorSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, scheme: schemeArg, minZoom: minZoomArg, maxZoom: maxZoomArg, attribution: attributionArg, volatile: volatileArg, sourceLayer: sourceLayerArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - addVectorSourceChannel.setMessageHandler(nil) - } - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - let getMetersPerPixelAtLatitudeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getMetersPerPixelAtLatitudeChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let latitudeArg = args[0] as! Double - do { - let result = try api.getMetersPerPixelAtLatitude(latitude: latitudeArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - getMetersPerPixelAtLatitudeChannel.setMessageHandler(nil) - } - /// Update the map options. - let updateOptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - updateOptionsChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let optionsArg = args[0] as! MapOptions - api.updateOptions(options: optionsArg) { result in - switch result { - case .success: - reply(wrapResult(nil)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - updateOptionsChannel.setMessageHandler(nil) - } - } -} -/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. -protocol MapLibreFlutterApiProtocol { - /// Get the map options from dart. - func getOptions(completion: @escaping (Result) -> Void) - /// Callback for when the style has been loaded. - func onStyleLoaded(completion: @escaping (Result) -> Void) - /// Callback when the user clicks on the map. - func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the map idles. - func onIdle(completion: @escaping (Result) -> Void) - /// Callback when the map camera idles. - func onCameraIdle(completion: @escaping (Result) -> Void) - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the user performs a double click on the map. - func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the user performs a long lasting click on the map. - func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) - /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) -} -class MapLibreFlutterApi: MapLibreFlutterApiProtocol { - private let binaryMessenger: FlutterBinaryMessenger - private let messageChannelSuffix: String - init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { - self.binaryMessenger = binaryMessenger - self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" - } - var codec: PigeonPigeonCodec { - return PigeonPigeonCodec.shared - } - /// Get the map options from dart. - func getOptions(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) - } else { - let result = listResponse[0] as! MapOptions - completion(.success(result)) - } - } - } - /// Callback for when the style has been loaded. - func onStyleLoaded(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user clicks on the map. - func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map idles. - func onIdle(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map camera idles. - func onCameraIdle(completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage(nil) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a double click on the map. - func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the user performs a long lasting click on the map. - func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pointArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([cameraArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } -} diff --git a/pigeons/map_options.dart b/pigeons/map_options.dart new file mode 100644 index 0000000..7e2eaf9 --- /dev/null +++ b/pigeons/map_options.dart @@ -0,0 +1,55 @@ +part of 'pigeon.dart'; + +/// The map options define initial values for the MapLibre map. +class MapOptions { + const MapOptions({ + required this.style, + required this.zoom, + required this.center, + required this.tilt, + required this.bearing, + required this.maxBounds, + required this.minZoom, + required this.maxZoom, + required this.minTilt, + required this.maxTilt, + required this.listensOnClick, + required this.listensOnLongClick, + }); + + /// The URL of the used map style. + final String style; + + /// The initial zoom level of the map. + final double zoom; + + /// The initial tilt of the map. + final double tilt; + + /// The initial bearing of the map. + final double bearing; + + /// The initial center coordinates of the map. + final LngLat? center; + + /// The maximum bounding box of the map camera. + final LngLatBounds? maxBounds; + + /// The minimum zoom level of the map. + final double minZoom; + + /// The maximum zoom level of the map. + final double maxZoom; + + /// The minimum pitch / tilt of the map. + final double minTilt; + + /// The maximum pitch / tilt of the map. + final double maxTilt; + + /// If the native map should listen to click events. + final bool listensOnClick; + + /// If the native map should listen to long click events. + final bool listensOnLongClick; +} diff --git a/pigeons/maplibre_flutter_api.dart b/pigeons/maplibre_flutter_api.dart new file mode 100644 index 0000000..2411dfe --- /dev/null +++ b/pigeons/maplibre_flutter_api.dart @@ -0,0 +1,32 @@ +part of 'pigeon.dart'; + +@FlutterApi() +abstract interface class MapLibreFlutterApi { + /// Get the map options from dart. + MapOptions getOptions(); + + /// Callback for when the style has been loaded. + void onStyleLoaded(); + + /// Callback when the user clicks on the map. + void onClick(LngLat point); + + /// Callback when the map idles. + void onIdle(); + + /// Callback when the map camera idles. + void onCameraIdle(); + + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + void onSecondaryClick(LngLat point); + + /// Callback when the user performs a double click on the map. + void onDoubleClick(LngLat point); + + /// Callback when the user performs a long lasting click on the map. + void onLongClick(LngLat point); + + /// Callback when the map camera changes. + void onCameraMoved(MapCamera camera); +} diff --git a/pigeons/maplibre_host_api.dart b/pigeons/maplibre_host_api.dart new file mode 100644 index 0000000..f45882b --- /dev/null +++ b/pigeons/maplibre_host_api.dart @@ -0,0 +1,229 @@ +part of 'pigeon.dart'; + +@HostApi() +abstract interface class MapLibreHostApi { + /// Move the viewport of the map to a new location without any animation. + @async + void jumpTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + }); + + /// Animate the viewport of the map to a new location. + @async + void flyTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + required int durationMs, + }); + + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + @async + MapCamera getCamera(); + + /// Get the visible region of the current map camera. + @async + LngLatBounds getVisibleRegion(); + + /// Convert a coordinate to a location on the screen. + @async + ScreenLocation toScreenLocation(double lng, double lat); + + /// Convert a screen location to a coordinate. + @async + LngLat toLngLat(double x, double y); + + /// Add a fill layer to the map style. + @async + void addFillLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a circle layer to the map style. + @async + void addCircleLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a background layer to the map style. + @async + void addBackgroundLayer({ + required String id, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a fill extrusion layer to the map style. + @async + void addFillExtrusionLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a heatmap layer to the map style. + @async + void addHeatmapLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a hillshade layer to the map style. + @async + void addHillshadeLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a line layer to the map style. + @async + void addLineLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a raster layer to the map style. + @async + void addRasterLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a symbol layer to the map style. + @async + void addSymbolLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Removes the layer with the given ID from the map's style. + @async + void removeLayer(String id); + + /// Removes the source with the given ID from the map's style. + @async + void removeSource(String id); + + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + @async + Uint8List loadImage(String url); + + /// Add an image to the map. + @async + void addImage(String id, Uint8List bytes); + + /// Removes an image from the map + @async + void removeImage(String id); + + /// Add a GeoJSON source to the map style. + @async + void addGeoJsonSource({ + required String id, + required String data, + }); + + /// Update the data of a GeoJSON source. + @async + void updateGeoJsonSource({ + required String id, + required String data, + }); + + /// Add a image source to the map style. + @async + void addImageSource({ + required String id, + required String url, + required List coordinates, + }); + + /// Add a raster source to the map style. + @async + void addRasterSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required TileScheme scheme, + required String? attribution, + required bool volatile, + }); + + /// Add a raster DEM source to the map style. + @async + void addRasterDemSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required String? attribution, + required RasterDemEncoding encoding, + required bool volatile, + double redFactor = 1, + double blueFactor = 1, + double greenFactor = 1, + double baseShift = 0, + }); + + /// Add a vector source to the map style. + @async + void addVectorSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required TileScheme scheme, + required double minZoom, + required double maxZoom, + required String? attribution, + required bool volatile, + required String? sourceLayer, + }); + + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + double getMetersPerPixelAtLatitude(double latitude); + + /// Update the map options. + @async + void updateOptions(MapOptions options); +} diff --git a/pigeons/pigeon.dart b/pigeons/pigeon.dart index d0cc47e..8207416 100644 --- a/pigeons/pigeon.dart +++ b/pigeons/pigeon.dart @@ -1,5 +1,11 @@ import 'package:pigeon/pigeon.dart'; +part 'maplibre_flutter_api.dart'; + +part 'maplibre_host_api.dart'; + +part 'map_options.dart'; + @ConfigurePigeon( PigeonOptions( dartOut: 'lib/src/native/pigeon.g.dart', @@ -21,318 +27,6 @@ import 'package:pigeon/pigeon.dart'; swiftOptions: SwiftOptions(), ), ) -@HostApi() -abstract interface class MapLibreHostApi { - /// Move the viewport of the map to a new location without any animation. - @async - void jumpTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - }); - - /// Animate the viewport of the map to a new location. - @async - void flyTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - required int durationMs, - }); - - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - @async - MapCamera getCamera(); - - /// Get the visible region of the current map camera. - @async - LngLatBounds getVisibleRegion(); - - /// Convert a coordinate to a location on the screen. - @async - ScreenLocation toScreenLocation(double lng, double lat); - - /// Convert a screen location to a coordinate. - @async - LngLat toLngLat(double x, double y); - - /// Add a fill layer to the map style. - @async - void addFillLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a circle layer to the map style. - @async - void addCircleLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a background layer to the map style. - @async - void addBackgroundLayer({ - required String id, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a fill extrusion layer to the map style. - @async - void addFillExtrusionLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a heatmap layer to the map style. - @async - void addHeatmapLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a hillshade layer to the map style. - @async - void addHillshadeLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a line layer to the map style. - @async - void addLineLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a raster layer to the map style. - @async - void addRasterLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a symbol layer to the map style. - @async - void addSymbolLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Removes the layer with the given ID from the map's style. - @async - void removeLayer(String id); - - /// Removes the source with the given ID from the map's style. - @async - void removeSource(String id); - - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - @async - Uint8List loadImage(String url); - - /// Add an image to the map. - @async - void addImage(String id, Uint8List bytes); - - /// Removes an image from the map - @async - void removeImage(String id); - - /// Add a GeoJSON source to the map style. - @async - void addGeoJsonSource({ - required String id, - required String data, - }); - - /// Update the data of a GeoJSON source. - @async - void updateGeoJsonSource({ - required String id, - required String data, - }); - - /// Add a image source to the map style. - @async - void addImageSource({ - required String id, - required String url, - required List coordinates, - }); - - /// Add a raster source to the map style. - @async - void addRasterSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required TileScheme scheme, - required String? attribution, - required bool volatile, - }); - - /// Add a raster DEM source to the map style. - @async - void addRasterDemSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required String? attribution, - required RasterDemEncoding encoding, - required bool volatile, - double redFactor = 1, - double blueFactor = 1, - double greenFactor = 1, - double baseShift = 0, - }); - - /// Add a vector source to the map style. - @async - void addVectorSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required TileScheme scheme, - required double minZoom, - required double maxZoom, - required String? attribution, - required bool volatile, - required String? sourceLayer, - }); - - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - double getMetersPerPixelAtLatitude(double latitude); - - /// Update the map options. - @async - void updateOptions(MapOptions options); -} - -@FlutterApi() -abstract interface class MapLibreFlutterApi { - /// Get the map options from dart. - MapOptions getOptions(); - - /// Callback for when the style has been loaded. - void onStyleLoaded(); - - /// Callback when the user clicks on the map. - void onClick(LngLat point); - - /// Callback when the map idles. - void onIdle(); - - /// Callback when the map camera idles. - void onCameraIdle(); - - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - void onSecondaryClick(LngLat point); - - /// Callback when the user performs a double click on the map. - void onDoubleClick(LngLat point); - - /// Callback when the user performs a long lasting click on the map. - void onLongClick(LngLat point); - - /// Callback when the map camera changes. - void onCameraMoved(MapCamera camera); -} - -/// The map options define initial values for the MapLibre map. -class MapOptions { - const MapOptions({ - required this.style, - required this.zoom, - required this.center, - required this.tilt, - required this.bearing, - required this.maxBounds, - required this.minZoom, - required this.maxZoom, - required this.minTilt, - required this.maxTilt, - required this.listensOnClick, - required this.listensOnLongClick, - }); - - /// The URL of the used map style. - final String style; - - /// The initial zoom level of the map. - final double zoom; - - /// The initial tilt of the map. - final double tilt; - - /// The initial bearing of the map. - final double bearing; - - /// The initial center coordinates of the map. - final LngLat? center; - - /// The maximum bounding box of the map camera. - final LngLatBounds? maxBounds; - - /// The minimum zoom level of the map. - final double minZoom; - - /// The maximum zoom level of the map. - final double maxZoom; - - /// The minimum pitch / tilt of the map. - final double minTilt; - - /// The maximum pitch / tilt of the map. - final double maxTilt; - - /// If the native map should listen to click events. - final bool listensOnClick; - - /// If the native map should listen to long click events. - final bool listensOnLongClick; -} /// A longitude/latitude coordinate object. class LngLat { diff --git a/windows/runner/pigeon.g.cpp b/windows/runner/pigeon.g.cpp index 544c829..cdec36f 100644 --- a/windows/runner/pigeon.g.cpp +++ b/windows/runner/pigeon.g.cpp @@ -28,243 +28,6 @@ FlutterError CreateConnectionError(const std::string channel_name) { EncodableValue("")); } -// MapOptions - -MapOptions::MapOptions( - const std::string& style, - double zoom, - double tilt, - double bearing, - double min_zoom, - double max_zoom, - double min_tilt, - double max_tilt, - bool listens_on_click, - bool listens_on_long_click) - : style_(style), - zoom_(zoom), - tilt_(tilt), - bearing_(bearing), - min_zoom_(min_zoom), - max_zoom_(max_zoom), - min_tilt_(min_tilt), - max_tilt_(max_tilt), - listens_on_click_(listens_on_click), - listens_on_long_click_(listens_on_long_click) {} - -MapOptions::MapOptions( - const std::string& style, - double zoom, - double tilt, - double bearing, - const LngLat* center, - const LngLatBounds* max_bounds, - double min_zoom, - double max_zoom, - double min_tilt, - double max_tilt, - bool listens_on_click, - bool listens_on_long_click) - : style_(style), - zoom_(zoom), - tilt_(tilt), - bearing_(bearing), - center_(center ? std::make_unique(*center) : nullptr), - max_bounds_(max_bounds ? std::make_unique(*max_bounds) : nullptr), - min_zoom_(min_zoom), - max_zoom_(max_zoom), - min_tilt_(min_tilt), - max_tilt_(max_tilt), - listens_on_click_(listens_on_click), - listens_on_long_click_(listens_on_long_click) {} - -MapOptions::MapOptions(const MapOptions& other) - : style_(other.style_), - zoom_(other.zoom_), - tilt_(other.tilt_), - bearing_(other.bearing_), - center_(other.center_ ? std::make_unique(*other.center_) : nullptr), - max_bounds_(other.max_bounds_ ? std::make_unique(*other.max_bounds_) : nullptr), - min_zoom_(other.min_zoom_), - max_zoom_(other.max_zoom_), - min_tilt_(other.min_tilt_), - max_tilt_(other.max_tilt_), - listens_on_click_(other.listens_on_click_), - listens_on_long_click_(other.listens_on_long_click_) {} - -MapOptions& MapOptions::operator=(const MapOptions& other) { - style_ = other.style_; - zoom_ = other.zoom_; - tilt_ = other.tilt_; - bearing_ = other.bearing_; - center_ = other.center_ ? std::make_unique(*other.center_) : nullptr; - max_bounds_ = other.max_bounds_ ? std::make_unique(*other.max_bounds_) : nullptr; - min_zoom_ = other.min_zoom_; - max_zoom_ = other.max_zoom_; - min_tilt_ = other.min_tilt_; - max_tilt_ = other.max_tilt_; - listens_on_click_ = other.listens_on_click_; - listens_on_long_click_ = other.listens_on_long_click_; - return *this; -} - -const std::string& MapOptions::style() const { - return style_; -} - -void MapOptions::set_style(std::string_view value_arg) { - style_ = value_arg; -} - - -double MapOptions::zoom() const { - return zoom_; -} - -void MapOptions::set_zoom(double value_arg) { - zoom_ = value_arg; -} - - -double MapOptions::tilt() const { - return tilt_; -} - -void MapOptions::set_tilt(double value_arg) { - tilt_ = value_arg; -} - - -double MapOptions::bearing() const { - return bearing_; -} - -void MapOptions::set_bearing(double value_arg) { - bearing_ = value_arg; -} - - -const LngLat* MapOptions::center() const { - return center_.get(); -} - -void MapOptions::set_center(const LngLat* value_arg) { - center_ = value_arg ? std::make_unique(*value_arg) : nullptr; -} - -void MapOptions::set_center(const LngLat& value_arg) { - center_ = std::make_unique(value_arg); -} - - -const LngLatBounds* MapOptions::max_bounds() const { - return max_bounds_.get(); -} - -void MapOptions::set_max_bounds(const LngLatBounds* value_arg) { - max_bounds_ = value_arg ? std::make_unique(*value_arg) : nullptr; -} - -void MapOptions::set_max_bounds(const LngLatBounds& value_arg) { - max_bounds_ = std::make_unique(value_arg); -} - - -double MapOptions::min_zoom() const { - return min_zoom_; -} - -void MapOptions::set_min_zoom(double value_arg) { - min_zoom_ = value_arg; -} - - -double MapOptions::max_zoom() const { - return max_zoom_; -} - -void MapOptions::set_max_zoom(double value_arg) { - max_zoom_ = value_arg; -} - - -double MapOptions::min_tilt() const { - return min_tilt_; -} - -void MapOptions::set_min_tilt(double value_arg) { - min_tilt_ = value_arg; -} - - -double MapOptions::max_tilt() const { - return max_tilt_; -} - -void MapOptions::set_max_tilt(double value_arg) { - max_tilt_ = value_arg; -} - - -bool MapOptions::listens_on_click() const { - return listens_on_click_; -} - -void MapOptions::set_listens_on_click(bool value_arg) { - listens_on_click_ = value_arg; -} - - -bool MapOptions::listens_on_long_click() const { - return listens_on_long_click_; -} - -void MapOptions::set_listens_on_long_click(bool value_arg) { - listens_on_long_click_ = value_arg; -} - - -EncodableList MapOptions::ToEncodableList() const { - EncodableList list; - list.reserve(12); - list.push_back(EncodableValue(style_)); - list.push_back(EncodableValue(zoom_)); - list.push_back(EncodableValue(tilt_)); - list.push_back(EncodableValue(bearing_)); - list.push_back(center_ ? CustomEncodableValue(*center_) : EncodableValue()); - list.push_back(max_bounds_ ? CustomEncodableValue(*max_bounds_) : EncodableValue()); - list.push_back(EncodableValue(min_zoom_)); - list.push_back(EncodableValue(max_zoom_)); - list.push_back(EncodableValue(min_tilt_)); - list.push_back(EncodableValue(max_tilt_)); - list.push_back(EncodableValue(listens_on_click_)); - list.push_back(EncodableValue(listens_on_long_click_)); - return list; -} - -MapOptions MapOptions::FromEncodableList(const EncodableList& list) { - MapOptions decoded( - std::get(list[0]), - std::get(list[1]), - std::get(list[2]), - std::get(list[3]), - std::get(list[6]), - std::get(list[7]), - std::get(list[8]), - std::get(list[9]), - std::get(list[10]), - std::get(list[11])); - auto& encodable_center = list[4]; - if (!encodable_center.IsNull()) { - decoded.set_center(std::any_cast(std::get(encodable_center))); - } - auto& encodable_max_bounds = list[5]; - if (!encodable_max_bounds.IsNull()) { - decoded.set_max_bounds(std::any_cast(std::get(encodable_max_bounds))); - } - return decoded; -} - // LngLat LngLat::LngLat( @@ -513,18 +276,15 @@ EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast(enum_arg_value)); } case 131: { - return CustomEncodableValue(MapOptions::FromEncodableList(std::get(ReadValue(stream)))); - } - case 132: { return CustomEncodableValue(LngLat::FromEncodableList(std::get(ReadValue(stream)))); } - case 133: { + case 132: { return CustomEncodableValue(ScreenLocation::FromEncodableList(std::get(ReadValue(stream)))); } - case 134: { + case 133: { return CustomEncodableValue(MapCamera::FromEncodableList(std::get(ReadValue(stream)))); } - case 135: { + case 134: { return CustomEncodableValue(LngLatBounds::FromEncodableList(std::get(ReadValue(stream)))); } default: @@ -546,28 +306,23 @@ void PigeonInternalCodecSerializer::WriteValue( WriteValue(EncodableValue(static_cast(std::any_cast(*custom_value))), stream); return; } - if (custom_value->type() == typeid(MapOptions)) { - stream->WriteByte(131); - WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); - return; - } if (custom_value->type() == typeid(LngLat)) { - stream->WriteByte(132); + stream->WriteByte(131); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(ScreenLocation)) { - stream->WriteByte(133); + stream->WriteByte(132); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(MapCamera)) { - stream->WriteByte(134); + stream->WriteByte(133); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(LngLatBounds)) { - stream->WriteByte(135); + stream->WriteByte(134); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } @@ -575,1437 +330,4 @@ void PigeonInternalCodecSerializer::WriteValue( flutter::StandardCodecSerializer::WriteValue(value, stream); } -/// The codec used by MapLibreHostApi. -const flutter::StandardMessageCodec& MapLibreHostApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); -} - -// Sets up an instance of `MapLibreHostApi` to handle messages through the `binary_messenger`. -void MapLibreHostApi::SetUp( - flutter::BinaryMessenger* binary_messenger, - MapLibreHostApi* api) { - MapLibreHostApi::SetUp(binary_messenger, api, ""); -} - -void MapLibreHostApi::SetUp( - flutter::BinaryMessenger* binary_messenger, - MapLibreHostApi* api, - const std::string& message_channel_suffix) { - const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_center_arg = args.at(0); - const auto* center_arg = encodable_center_arg.IsNull() ? nullptr : &(std::any_cast(std::get(encodable_center_arg))); - const auto& encodable_zoom_arg = args.at(1); - const auto* zoom_arg = std::get_if(&encodable_zoom_arg); - const auto& encodable_bearing_arg = args.at(2); - const auto* bearing_arg = std::get_if(&encodable_bearing_arg); - const auto& encodable_pitch_arg = args.at(3); - const auto* pitch_arg = std::get_if(&encodable_pitch_arg); - api->JumpTo(center_arg, zoom_arg, bearing_arg, pitch_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_center_arg = args.at(0); - const auto* center_arg = encodable_center_arg.IsNull() ? nullptr : &(std::any_cast(std::get(encodable_center_arg))); - const auto& encodable_zoom_arg = args.at(1); - const auto* zoom_arg = std::get_if(&encodable_zoom_arg); - const auto& encodable_bearing_arg = args.at(2); - const auto* bearing_arg = std::get_if(&encodable_bearing_arg); - const auto& encodable_pitch_arg = args.at(3); - const auto* pitch_arg = std::get_if(&encodable_pitch_arg); - const auto& encodable_duration_ms_arg = args.at(4); - if (encodable_duration_ms_arg.IsNull()) { - reply(WrapError("duration_ms_arg unexpectedly null.")); - return; - } - const int64_t duration_ms_arg = encodable_duration_ms_arg.LongValue(); - api->FlyTo(center_arg, zoom_arg, bearing_arg, pitch_arg, duration_ms_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->GetCamera([reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - api->GetVisibleRegion([reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_lng_arg = args.at(0); - if (encodable_lng_arg.IsNull()) { - reply(WrapError("lng_arg unexpectedly null.")); - return; - } - const auto& lng_arg = std::get(encodable_lng_arg); - const auto& encodable_lat_arg = args.at(1); - if (encodable_lat_arg.IsNull()) { - reply(WrapError("lat_arg unexpectedly null.")); - return; - } - const auto& lat_arg = std::get(encodable_lat_arg); - api->ToScreenLocation(lng_arg, lat_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_x_arg = args.at(0); - if (encodable_x_arg.IsNull()) { - reply(WrapError("x_arg unexpectedly null.")); - return; - } - const auto& x_arg = std::get(encodable_x_arg); - const auto& encodable_y_arg = args.at(1); - if (encodable_y_arg.IsNull()) { - reply(WrapError("y_arg unexpectedly null.")); - return; - } - const auto& y_arg = std::get(encodable_y_arg); - api->ToLngLat(x_arg, y_arg, [reply](ErrorOr&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddFillLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddCircleLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_layout_arg = args.at(1); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(2); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(3); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddBackgroundLayer(id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddFillExtrusionLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddHeatmapLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddHillshadeLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddLineLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddRasterLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_source_id_arg = args.at(1); - if (encodable_source_id_arg.IsNull()) { - reply(WrapError("source_id_arg unexpectedly null.")); - return; - } - const auto& source_id_arg = std::get(encodable_source_id_arg); - const auto& encodable_layout_arg = args.at(2); - if (encodable_layout_arg.IsNull()) { - reply(WrapError("layout_arg unexpectedly null.")); - return; - } - const auto& layout_arg = std::get(encodable_layout_arg); - const auto& encodable_paint_arg = args.at(3); - if (encodable_paint_arg.IsNull()) { - reply(WrapError("paint_arg unexpectedly null.")); - return; - } - const auto& paint_arg = std::get(encodable_paint_arg); - const auto& encodable_below_layer_id_arg = args.at(4); - const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); - api->AddSymbolLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - api->RemoveLayer(id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - api->RemoveSource(id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_url_arg = args.at(0); - if (encodable_url_arg.IsNull()) { - reply(WrapError("url_arg unexpectedly null.")); - return; - } - const auto& url_arg = std::get(encodable_url_arg); - api->LoadImage(url_arg, [reply](ErrorOr>&& output) { - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_bytes_arg = args.at(1); - if (encodable_bytes_arg.IsNull()) { - reply(WrapError("bytes_arg unexpectedly null.")); - return; - } - const auto& bytes_arg = std::get>(encodable_bytes_arg); - api->AddImage(id_arg, bytes_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - api->RemoveImage(id_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_data_arg = args.at(1); - if (encodable_data_arg.IsNull()) { - reply(WrapError("data_arg unexpectedly null.")); - return; - } - const auto& data_arg = std::get(encodable_data_arg); - api->AddGeoJsonSource(id_arg, data_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_data_arg = args.at(1); - if (encodable_data_arg.IsNull()) { - reply(WrapError("data_arg unexpectedly null.")); - return; - } - const auto& data_arg = std::get(encodable_data_arg); - api->UpdateGeoJsonSource(id_arg, data_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_url_arg = args.at(1); - if (encodable_url_arg.IsNull()) { - reply(WrapError("url_arg unexpectedly null.")); - return; - } - const auto& url_arg = std::get(encodable_url_arg); - const auto& encodable_coordinates_arg = args.at(2); - if (encodable_coordinates_arg.IsNull()) { - reply(WrapError("coordinates_arg unexpectedly null.")); - return; - } - const auto& coordinates_arg = std::get(encodable_coordinates_arg); - api->AddImageSource(id_arg, url_arg, coordinates_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_url_arg = args.at(1); - const auto* url_arg = std::get_if(&encodable_url_arg); - const auto& encodable_tiles_arg = args.at(2); - const auto* tiles_arg = std::get_if(&encodable_tiles_arg); - const auto& encodable_bounds_arg = args.at(3); - if (encodable_bounds_arg.IsNull()) { - reply(WrapError("bounds_arg unexpectedly null.")); - return; - } - const auto& bounds_arg = std::get(encodable_bounds_arg); - const auto& encodable_min_zoom_arg = args.at(4); - if (encodable_min_zoom_arg.IsNull()) { - reply(WrapError("min_zoom_arg unexpectedly null.")); - return; - } - const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); - const auto& encodable_max_zoom_arg = args.at(5); - if (encodable_max_zoom_arg.IsNull()) { - reply(WrapError("max_zoom_arg unexpectedly null.")); - return; - } - const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); - const auto& encodable_tile_size_arg = args.at(6); - if (encodable_tile_size_arg.IsNull()) { - reply(WrapError("tile_size_arg unexpectedly null.")); - return; - } - const int64_t tile_size_arg = encodable_tile_size_arg.LongValue(); - const auto& encodable_scheme_arg = args.at(7); - if (encodable_scheme_arg.IsNull()) { - reply(WrapError("scheme_arg unexpectedly null.")); - return; - } - const auto& scheme_arg = std::any_cast(std::get(encodable_scheme_arg)); - const auto& encodable_attribution_arg = args.at(8); - const auto* attribution_arg = std::get_if(&encodable_attribution_arg); - const auto& encodable_volatile_arg = args.at(9); - if (encodable_volatile_arg.IsNull()) { - reply(WrapError("volatile_arg unexpectedly null.")); - return; - } - const auto& volatile_arg = std::get(encodable_volatile_arg); - api->AddRasterSource(id_arg, url_arg, tiles_arg, bounds_arg, min_zoom_arg, max_zoom_arg, tile_size_arg, scheme_arg, attribution_arg, volatile_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_url_arg = args.at(1); - const auto* url_arg = std::get_if(&encodable_url_arg); - const auto& encodable_tiles_arg = args.at(2); - const auto* tiles_arg = std::get_if(&encodable_tiles_arg); - const auto& encodable_bounds_arg = args.at(3); - if (encodable_bounds_arg.IsNull()) { - reply(WrapError("bounds_arg unexpectedly null.")); - return; - } - const auto& bounds_arg = std::get(encodable_bounds_arg); - const auto& encodable_min_zoom_arg = args.at(4); - if (encodable_min_zoom_arg.IsNull()) { - reply(WrapError("min_zoom_arg unexpectedly null.")); - return; - } - const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); - const auto& encodable_max_zoom_arg = args.at(5); - if (encodable_max_zoom_arg.IsNull()) { - reply(WrapError("max_zoom_arg unexpectedly null.")); - return; - } - const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); - const auto& encodable_tile_size_arg = args.at(6); - if (encodable_tile_size_arg.IsNull()) { - reply(WrapError("tile_size_arg unexpectedly null.")); - return; - } - const int64_t tile_size_arg = encodable_tile_size_arg.LongValue(); - const auto& encodable_attribution_arg = args.at(7); - const auto* attribution_arg = std::get_if(&encodable_attribution_arg); - const auto& encodable_encoding_arg = args.at(8); - if (encodable_encoding_arg.IsNull()) { - reply(WrapError("encoding_arg unexpectedly null.")); - return; - } - const auto& encoding_arg = std::any_cast(std::get(encodable_encoding_arg)); - const auto& encodable_volatile_arg = args.at(9); - if (encodable_volatile_arg.IsNull()) { - reply(WrapError("volatile_arg unexpectedly null.")); - return; - } - const auto& volatile_arg = std::get(encodable_volatile_arg); - const auto& encodable_red_factor_arg = args.at(10); - if (encodable_red_factor_arg.IsNull()) { - reply(WrapError("red_factor_arg unexpectedly null.")); - return; - } - const auto& red_factor_arg = std::get(encodable_red_factor_arg); - const auto& encodable_blue_factor_arg = args.at(11); - if (encodable_blue_factor_arg.IsNull()) { - reply(WrapError("blue_factor_arg unexpectedly null.")); - return; - } - const auto& blue_factor_arg = std::get(encodable_blue_factor_arg); - const auto& encodable_green_factor_arg = args.at(12); - if (encodable_green_factor_arg.IsNull()) { - reply(WrapError("green_factor_arg unexpectedly null.")); - return; - } - const auto& green_factor_arg = std::get(encodable_green_factor_arg); - const auto& encodable_base_shift_arg = args.at(13); - if (encodable_base_shift_arg.IsNull()) { - reply(WrapError("base_shift_arg unexpectedly null.")); - return; - } - const auto& base_shift_arg = std::get(encodable_base_shift_arg); - api->AddRasterDemSource(id_arg, url_arg, tiles_arg, bounds_arg, min_zoom_arg, max_zoom_arg, tile_size_arg, attribution_arg, encoding_arg, volatile_arg, red_factor_arg, blue_factor_arg, green_factor_arg, base_shift_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_id_arg = args.at(0); - if (encodable_id_arg.IsNull()) { - reply(WrapError("id_arg unexpectedly null.")); - return; - } - const auto& id_arg = std::get(encodable_id_arg); - const auto& encodable_url_arg = args.at(1); - const auto* url_arg = std::get_if(&encodable_url_arg); - const auto& encodable_tiles_arg = args.at(2); - const auto* tiles_arg = std::get_if(&encodable_tiles_arg); - const auto& encodable_bounds_arg = args.at(3); - if (encodable_bounds_arg.IsNull()) { - reply(WrapError("bounds_arg unexpectedly null.")); - return; - } - const auto& bounds_arg = std::get(encodable_bounds_arg); - const auto& encodable_scheme_arg = args.at(4); - if (encodable_scheme_arg.IsNull()) { - reply(WrapError("scheme_arg unexpectedly null.")); - return; - } - const auto& scheme_arg = std::any_cast(std::get(encodable_scheme_arg)); - const auto& encodable_min_zoom_arg = args.at(5); - if (encodable_min_zoom_arg.IsNull()) { - reply(WrapError("min_zoom_arg unexpectedly null.")); - return; - } - const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); - const auto& encodable_max_zoom_arg = args.at(6); - if (encodable_max_zoom_arg.IsNull()) { - reply(WrapError("max_zoom_arg unexpectedly null.")); - return; - } - const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); - const auto& encodable_attribution_arg = args.at(7); - const auto* attribution_arg = std::get_if(&encodable_attribution_arg); - const auto& encodable_volatile_arg = args.at(8); - if (encodable_volatile_arg.IsNull()) { - reply(WrapError("volatile_arg unexpectedly null.")); - return; - } - const auto& volatile_arg = std::get(encodable_volatile_arg); - const auto& encodable_source_layer_arg = args.at(9); - const auto* source_layer_arg = std::get_if(&encodable_source_layer_arg); - api->AddVectorSource(id_arg, url_arg, tiles_arg, bounds_arg, scheme_arg, min_zoom_arg, max_zoom_arg, attribution_arg, volatile_arg, source_layer_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_latitude_arg = args.at(0); - if (encodable_latitude_arg.IsNull()) { - reply(WrapError("latitude_arg unexpectedly null.")); - return; - } - const auto& latitude_arg = std::get(encodable_latitude_arg); - ErrorOr output = api->GetMetersPerPixelAtLatitude(latitude_arg); - if (output.has_error()) { - reply(WrapError(output.error())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue(std::move(output).TakeValue())); - reply(EncodableValue(std::move(wrapped))); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } - { - BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions" + prepended_suffix, &GetCodec()); - if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { - try { - const auto& args = std::get(message); - const auto& encodable_options_arg = args.at(0); - if (encodable_options_arg.IsNull()) { - reply(WrapError("options_arg unexpectedly null.")); - return; - } - const auto& options_arg = std::any_cast(std::get(encodable_options_arg)); - api->UpdateOptions(options_arg, [reply](std::optional&& output) { - if (output.has_value()) { - reply(WrapError(output.value())); - return; - } - EncodableList wrapped; - wrapped.push_back(EncodableValue()); - reply(EncodableValue(std::move(wrapped))); - }); - } catch (const std::exception& exception) { - reply(WrapError(exception.what())); - } - }); - } else { - channel.SetMessageHandler(nullptr); - } - } -} - -EncodableValue MapLibreHostApi::WrapError(std::string_view error_message) { - return EncodableValue(EncodableList{ - EncodableValue(std::string(error_message)), - EncodableValue("Error"), - EncodableValue() - }); -} - -EncodableValue MapLibreHostApi::WrapError(const FlutterError& error) { - return EncodableValue(EncodableList{ - EncodableValue(error.code()), - EncodableValue(error.message()), - error.details() - }); -} - -// Generated class from Pigeon that represents Flutter messages that can be called from C++. -MapLibreFlutterApi::MapLibreFlutterApi(flutter::BinaryMessenger* binary_messenger) - : binary_messenger_(binary_messenger), - message_channel_suffix_("") {} - -MapLibreFlutterApi::MapLibreFlutterApi( - flutter::BinaryMessenger* binary_messenger, - const std::string& message_channel_suffix) - : binary_messenger_(binary_messenger), - message_channel_suffix_(message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : "") {} - -const flutter::StandardMessageCodec& MapLibreFlutterApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); -} - -void MapLibreFlutterApi::GetOptions( - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - const auto& return_value = std::any_cast(std::get(list_return_value->at(0))); - on_success(return_value); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnStyleLoaded( - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnClick( - const LngLat& point_arg, - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ - CustomEncodableValue(point_arg), - }); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnIdle( - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnCameraIdle( - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnSecondaryClick( - const LngLat& point_arg, - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ - CustomEncodableValue(point_arg), - }); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnDoubleClick( - const LngLat& point_arg, - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ - CustomEncodableValue(point_arg), - }); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnLongClick( - const LngLat& point_arg, - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ - CustomEncodableValue(point_arg), - }); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - -void MapLibreFlutterApi::OnCameraMoved( - const MapCamera& camera_arg, - std::function&& on_success, - std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved" + message_channel_suffix_; - BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); - EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ - CustomEncodableValue(camera_arg), - }); - channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { - std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); - const auto& encodable_return_value = *response; - const auto* list_return_value = std::get_if(&encodable_return_value); - if (list_return_value) { - if (list_return_value->size() > 1) { - on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); - } else { - on_success(); - } - } else { - on_error(CreateConnectionError(channel_name)); - } - }); -} - } // namespace pigeon_maplibre diff --git a/windows/runner/pigeon.g.h b/windows/runner/pigeon.g.h index 4a56e63..6242927 100644 --- a/windows/runner/pigeon.g.h +++ b/windows/runner/pigeon.g.h @@ -36,27 +36,6 @@ class FlutterError { flutter::EncodableValue details_; }; -template class ErrorOr { - public: - ErrorOr(const T& rhs) : v_(rhs) {} - ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} - ErrorOr(const FlutterError& rhs) : v_(rhs) {} - ErrorOr(const FlutterError&& rhs) : v_(std::move(rhs)) {} - - bool has_error() const { return std::holds_alternative(v_); } - const T& value() const { return std::get(v_); }; - const FlutterError& error() const { return std::get(v_); }; - - private: - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; - ErrorOr() = default; - T TakeValue() && { return std::get(std::move(v_)); } - - std::variant v_; -}; - - // Influences the y direction of the tile coordinates. enum class TileScheme { // Slippy map tilenames scheme. @@ -77,117 +56,6 @@ enum class RasterDemEncoding { }; -// The map options define initial values for the MapLibre map. -// -// Generated class from Pigeon that represents data sent in messages. -class MapOptions { - public: - // Constructs an object setting all non-nullable fields. - explicit MapOptions( - const std::string& style, - double zoom, - double tilt, - double bearing, - double min_zoom, - double max_zoom, - double min_tilt, - double max_tilt, - bool listens_on_click, - bool listens_on_long_click); - - // Constructs an object setting all fields. - explicit MapOptions( - const std::string& style, - double zoom, - double tilt, - double bearing, - const LngLat* center, - const LngLatBounds* max_bounds, - double min_zoom, - double max_zoom, - double min_tilt, - double max_tilt, - bool listens_on_click, - bool listens_on_long_click); - - ~MapOptions() = default; - MapOptions(const MapOptions& other); - MapOptions& operator=(const MapOptions& other); - MapOptions(MapOptions&& other) = default; - MapOptions& operator=(MapOptions&& other) noexcept = default; - // The URL of the used map style. - const std::string& style() const; - void set_style(std::string_view value_arg); - - // The initial zoom level of the map. - double zoom() const; - void set_zoom(double value_arg); - - // The initial tilt of the map. - double tilt() const; - void set_tilt(double value_arg); - - // The initial bearing of the map. - double bearing() const; - void set_bearing(double value_arg); - - // The initial center coordinates of the map. - const LngLat* center() const; - void set_center(const LngLat* value_arg); - void set_center(const LngLat& value_arg); - - // The maximum bounding box of the map camera. - const LngLatBounds* max_bounds() const; - void set_max_bounds(const LngLatBounds* value_arg); - void set_max_bounds(const LngLatBounds& value_arg); - - // The minimum zoom level of the map. - double min_zoom() const; - void set_min_zoom(double value_arg); - - // The maximum zoom level of the map. - double max_zoom() const; - void set_max_zoom(double value_arg); - - // The minimum pitch / tilt of the map. - double min_tilt() const; - void set_min_tilt(double value_arg); - - // The maximum pitch / tilt of the map. - double max_tilt() const; - void set_max_tilt(double value_arg); - - // If the native map should listen to click events. - bool listens_on_click() const; - void set_listens_on_click(bool value_arg); - - // If the native map should listen to long click events. - bool listens_on_long_click() const; - void set_listens_on_long_click(bool value_arg); - - - private: - static MapOptions FromEncodableList(const flutter::EncodableList& list); - flutter::EncodableList ToEncodableList() const; - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; - friend class PigeonInternalCodecSerializer; - std::string style_; - double zoom_; - double tilt_; - double bearing_; - std::unique_ptr center_; - std::unique_ptr max_bounds_; - double min_zoom_; - double max_zoom_; - double min_tilt_; - double max_tilt_; - bool listens_on_click_; - bool listens_on_long_click_; - -}; - - // A longitude/latitude coordinate object. // // Generated class from Pigeon that represents data sent in messages. @@ -210,10 +78,7 @@ class LngLat { private: static LngLat FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; - friend class MapOptions; friend class MapCamera; - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double lng_; double lat_; @@ -243,8 +108,6 @@ class ScreenLocation { private: static ScreenLocation FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double x_; double y_; @@ -285,8 +148,6 @@ class MapCamera { private: static MapCamera FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; std::unique_ptr center_; double zoom_; @@ -324,9 +185,6 @@ class LngLatBounds { private: static LngLatBounds FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; - friend class MapOptions; - friend class MapLibreHostApi; - friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double longitude_west_; double longitude_east_; @@ -355,274 +213,5 @@ class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { }; -// Generated interface from Pigeon that represents a handler of messages from Flutter. -class MapLibreHostApi { - public: - MapLibreHostApi(const MapLibreHostApi&) = delete; - MapLibreHostApi& operator=(const MapLibreHostApi&) = delete; - virtual ~MapLibreHostApi() {} - // Move the viewport of the map to a new location without any animation. - virtual void JumpTo( - const LngLat* center, - const double* zoom, - const double* bearing, - const double* pitch, - std::function reply)> result) = 0; - // Animate the viewport of the map to a new location. - virtual void FlyTo( - const LngLat* center, - const double* zoom, - const double* bearing, - const double* pitch, - int64_t duration_ms, - std::function reply)> result) = 0; - // Get the current camera position with the map center, zoom level, camera - // tilt and map rotation. - virtual void GetCamera(std::function reply)> result) = 0; - // Get the visible region of the current map camera. - virtual void GetVisibleRegion(std::function reply)> result) = 0; - // Convert a coordinate to a location on the screen. - virtual void ToScreenLocation( - double lng, - double lat, - std::function reply)> result) = 0; - // Convert a screen location to a coordinate. - virtual void ToLngLat( - double x, - double y, - std::function reply)> result) = 0; - // Add a fill layer to the map style. - virtual void AddFillLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a circle layer to the map style. - virtual void AddCircleLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a background layer to the map style. - virtual void AddBackgroundLayer( - const std::string& id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a fill extrusion layer to the map style. - virtual void AddFillExtrusionLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a heatmap layer to the map style. - virtual void AddHeatmapLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a hillshade layer to the map style. - virtual void AddHillshadeLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a line layer to the map style. - virtual void AddLineLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a raster layer to the map style. - virtual void AddRasterLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Add a symbol layer to the map style. - virtual void AddSymbolLayer( - const std::string& id, - const std::string& source_id, - const flutter::EncodableMap& layout, - const flutter::EncodableMap& paint, - const std::string* below_layer_id, - std::function reply)> result) = 0; - // Removes the layer with the given ID from the map's style. - virtual void RemoveLayer( - const std::string& id, - std::function reply)> result) = 0; - // Removes the source with the given ID from the map's style. - virtual void RemoveSource( - const std::string& id, - std::function reply)> result) = 0; - // Loads an image to the map. An image needs to be loaded before it can - // get used. - virtual void LoadImage( - const std::string& url, - std::function> reply)> result) = 0; - // Add an image to the map. - virtual void AddImage( - const std::string& id, - const std::vector& bytes, - std::function reply)> result) = 0; - // Removes an image from the map - virtual void RemoveImage( - const std::string& id, - std::function reply)> result) = 0; - // Add a GeoJSON source to the map style. - virtual void AddGeoJsonSource( - const std::string& id, - const std::string& data, - std::function reply)> result) = 0; - // Update the data of a GeoJSON source. - virtual void UpdateGeoJsonSource( - const std::string& id, - const std::string& data, - std::function reply)> result) = 0; - // Add a image source to the map style. - virtual void AddImageSource( - const std::string& id, - const std::string& url, - const flutter::EncodableList& coordinates, - std::function reply)> result) = 0; - // Add a raster source to the map style. - virtual void AddRasterSource( - const std::string& id, - const std::string* url, - const flutter::EncodableList* tiles, - const flutter::EncodableList& bounds, - double min_zoom, - double max_zoom, - int64_t tile_size, - const TileScheme& scheme, - const std::string* attribution, - bool volatile, - std::function reply)> result) = 0; - // Add a raster DEM source to the map style. - virtual void AddRasterDemSource( - const std::string& id, - const std::string* url, - const flutter::EncodableList* tiles, - const flutter::EncodableList& bounds, - double min_zoom, - double max_zoom, - int64_t tile_size, - const std::string* attribution, - const RasterDemEncoding& encoding, - bool volatile, - double red_factor, - double blue_factor, - double green_factor, - double base_shift, - std::function reply)> result) = 0; - // Add a vector source to the map style. - virtual void AddVectorSource( - const std::string& id, - const std::string* url, - const flutter::EncodableList* tiles, - const flutter::EncodableList& bounds, - const TileScheme& scheme, - double min_zoom, - double max_zoom, - const std::string* attribution, - bool volatile, - const std::string* source_layer, - std::function reply)> result) = 0; - // Returns the distance spanned by one pixel at the specified latitude and - // current zoom level. - virtual ErrorOr GetMetersPerPixelAtLatitude(double latitude) = 0; - // Update the map options. - virtual void UpdateOptions( - const MapOptions& options, - std::function reply)> result) = 0; - - // The codec used by MapLibreHostApi. - static const flutter::StandardMessageCodec& GetCodec(); - // Sets up an instance of `MapLibreHostApi` to handle messages through the `binary_messenger`. - static void SetUp( - flutter::BinaryMessenger* binary_messenger, - MapLibreHostApi* api); - static void SetUp( - flutter::BinaryMessenger* binary_messenger, - MapLibreHostApi* api, - const std::string& message_channel_suffix); - static flutter::EncodableValue WrapError(std::string_view error_message); - static flutter::EncodableValue WrapError(const FlutterError& error); - - protected: - MapLibreHostApi() = default; - -}; -// Generated class from Pigeon that represents Flutter messages that can be called from C++. -class MapLibreFlutterApi { - public: - MapLibreFlutterApi(flutter::BinaryMessenger* binary_messenger); - MapLibreFlutterApi( - flutter::BinaryMessenger* binary_messenger, - const std::string& message_channel_suffix); - static const flutter::StandardMessageCodec& GetCodec(); - // Get the map options from dart. - void GetOptions( - std::function&& on_success, - std::function&& on_error); - // Callback for when the style has been loaded. - void OnStyleLoaded( - std::function&& on_success, - std::function&& on_error); - // Callback when the user clicks on the map. - void OnClick( - const LngLat& point, - std::function&& on_success, - std::function&& on_error); - // Callback when the map idles. - void OnIdle( - std::function&& on_success, - std::function&& on_error); - // Callback when the map camera idles. - void OnCameraIdle( - std::function&& on_success, - std::function&& on_error); - // Callback when the user performs a secondary click on the map - // (e.g. by default a click with the right mouse button). - void OnSecondaryClick( - const LngLat& point, - std::function&& on_success, - std::function&& on_error); - // Callback when the user performs a double click on the map. - void OnDoubleClick( - const LngLat& point, - std::function&& on_success, - std::function&& on_error); - // Callback when the user performs a long lasting click on the map. - void OnLongClick( - const LngLat& point, - std::function&& on_success, - std::function&& on_error); - // Callback when the map camera changes. - void OnCameraMoved( - const MapCamera& camera, - std::function&& on_success, - std::function&& on_error); - - private: - flutter::BinaryMessenger* binary_messenger_; - std::string message_channel_suffix_; -}; - } // namespace pigeon_maplibre #endif // PIGEON_PIGEON_G_H_ From 355fbb2bc4231bcd4ad00ab85aded3767dd82557 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:12:54 +0200 Subject: [PATCH 7/8] Revert "split raw pigeon files" This reverts commit e14594c93fe44fd217391748a6b1529acf9b91d1. --- .../com/github/josxha/maplibre/Pigeon.g.kt | 982 ++++- ios/Classes/Pigeon.g.swift | 989 ++++- lib/src/native/pigeon.g.dart | 1306 ++++++- linux/pigeon.g.cc | 3305 ++++++++++++++++- linux/pigeon.g.h | 1371 +++++++ macos/Classes/Pigeon.g.swift | 989 ++++- pigeons/map_options.dart | 55 - pigeons/maplibre_flutter_api.dart | 32 - pigeons/maplibre_host_api.dart | 229 -- pigeons/pigeon.dart | 318 +- windows/runner/pigeon.g.cpp | 1692 ++++++++- windows/runner/pigeon.g.h | 411 ++ 12 files changed, 11307 insertions(+), 372 deletions(-) delete mode 100644 pigeons/map_options.dart delete mode 100644 pigeons/maplibre_flutter_api.dart delete mode 100644 pigeons/maplibre_host_api.dart diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt index 5b0a1e4..cdb570c 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt @@ -11,6 +11,29 @@ import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private fun wrapResult(result: Any?): List { + return listOf(result) +} + +private fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf( + exception.code, + exception.message, + exception.details + ) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } +} + +private fun createConnectionError(channelName: String): FlutterError { + return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} + /** * Error class for passing custom error details to Flutter via a thrown PlatformException. * @property code The error code. @@ -56,6 +79,73 @@ enum class RasterDemEncoding(val raw: Int) { } } +/** + * The map options define initial values for the MapLibre map. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class MapOptions ( + /** The URL of the used map style. */ + val style: String, + /** The initial zoom level of the map. */ + val zoom: Double, + /** The initial tilt of the map. */ + val tilt: Double, + /** The initial bearing of the map. */ + val bearing: Double, + /** The initial center coordinates of the map. */ + val center: LngLat? = null, + /** The maximum bounding box of the map camera. */ + val maxBounds: LngLatBounds? = null, + /** The minimum zoom level of the map. */ + val minZoom: Double, + /** The maximum zoom level of the map. */ + val maxZoom: Double, + /** The minimum pitch / tilt of the map. */ + val minTilt: Double, + /** The maximum pitch / tilt of the map. */ + val maxTilt: Double, + /** If the native map should listen to click events. */ + val listensOnClick: Boolean, + /** If the native map should listen to long click events. */ + val listensOnLongClick: Boolean +) + { + companion object { + fun fromList(pigeonVar_list: List): MapOptions { + val style = pigeonVar_list[0] as String + val zoom = pigeonVar_list[1] as Double + val tilt = pigeonVar_list[2] as Double + val bearing = pigeonVar_list[3] as Double + val center = pigeonVar_list[4] as LngLat? + val maxBounds = pigeonVar_list[5] as LngLatBounds? + val minZoom = pigeonVar_list[6] as Double + val maxZoom = pigeonVar_list[7] as Double + val minTilt = pigeonVar_list[8] as Double + val maxTilt = pigeonVar_list[9] as Double + val listensOnClick = pigeonVar_list[10] as Boolean + val listensOnLongClick = pigeonVar_list[11] as Boolean + return MapOptions(style, zoom, tilt, bearing, center, maxBounds, minZoom, maxZoom, minTilt, maxTilt, listensOnClick, listensOnLongClick) + } + } + fun toList(): List { + return listOf( + style, + zoom, + tilt, + bearing, + center, + maxBounds, + minZoom, + maxZoom, + minTilt, + maxTilt, + listensOnClick, + listensOnLongClick, + ) + } +} + /** * A longitude/latitude coordinate object. * @@ -186,20 +276,25 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { } 131.toByte() -> { return (readValue(buffer) as? List)?.let { - LngLat.fromList(it) + MapOptions.fromList(it) } } 132.toByte() -> { return (readValue(buffer) as? List)?.let { - ScreenLocation.fromList(it) + LngLat.fromList(it) } } 133.toByte() -> { return (readValue(buffer) as? List)?.let { - MapCamera.fromList(it) + ScreenLocation.fromList(it) } } 134.toByte() -> { + return (readValue(buffer) as? List)?.let { + MapCamera.fromList(it) + } + } + 135.toByte() -> { return (readValue(buffer) as? List)?.let { LngLatBounds.fromList(it) } @@ -217,24 +312,897 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { stream.write(130) writeValue(stream, value.raw) } - is LngLat -> { + is MapOptions -> { stream.write(131) writeValue(stream, value.toList()) } - is ScreenLocation -> { + is LngLat -> { stream.write(132) writeValue(stream, value.toList()) } - is MapCamera -> { + is ScreenLocation -> { stream.write(133) writeValue(stream, value.toList()) } - is LngLatBounds -> { + is MapCamera -> { stream.write(134) writeValue(stream, value.toList()) } + is LngLatBounds -> { + stream.write(135) + writeValue(stream, value.toList()) + } else -> super.writeValue(stream, value) } } } + +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface MapLibreHostApi { + /** Move the viewport of the map to a new location without any animation. */ + fun jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, callback: (Result) -> Unit) + /** Animate the viewport of the map to a new location. */ + fun flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Long, callback: (Result) -> Unit) + /** + * Get the current camera position with the map center, zoom level, camera + * tilt and map rotation. + */ + fun getCamera(callback: (Result) -> Unit) + /** Get the visible region of the current map camera. */ + fun getVisibleRegion(callback: (Result) -> Unit) + /** Convert a coordinate to a location on the screen. */ + fun toScreenLocation(lng: Double, lat: Double, callback: (Result) -> Unit) + /** Convert a screen location to a coordinate. */ + fun toLngLat(x: Double, y: Double, callback: (Result) -> Unit) + /** Add a fill layer to the map style. */ + fun addFillLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a circle layer to the map style. */ + fun addCircleLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a background layer to the map style. */ + fun addBackgroundLayer(id: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a fill extrusion layer to the map style. */ + fun addFillExtrusionLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a heatmap layer to the map style. */ + fun addHeatmapLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a hillshade layer to the map style. */ + fun addHillshadeLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a line layer to the map style. */ + fun addLineLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a raster layer to the map style. */ + fun addRasterLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Add a symbol layer to the map style. */ + fun addSymbolLayer(id: String, sourceId: String, layout: Map, paint: Map, belowLayerId: String?, callback: (Result) -> Unit) + /** Removes the layer with the given ID from the map's style. */ + fun removeLayer(id: String, callback: (Result) -> Unit) + /** Removes the source with the given ID from the map's style. */ + fun removeSource(id: String, callback: (Result) -> Unit) + /** + * Loads an image to the map. An image needs to be loaded before it can + * get used. + */ + fun loadImage(url: String, callback: (Result) -> Unit) + /** Add an image to the map. */ + fun addImage(id: String, bytes: ByteArray, callback: (Result) -> Unit) + /** Removes an image from the map */ + fun removeImage(id: String, callback: (Result) -> Unit) + /** Add a GeoJSON source to the map style. */ + fun addGeoJsonSource(id: String, data: String, callback: (Result) -> Unit) + /** Update the data of a GeoJSON source. */ + fun updateGeoJsonSource(id: String, data: String, callback: (Result) -> Unit) + /** Add a image source to the map style. */ + fun addImageSource(id: String, url: String, coordinates: List, callback: (Result) -> Unit) + /** Add a raster source to the map style. */ + fun addRasterSource(id: String, url: String?, tiles: List?, bounds: List, minZoom: Double, maxZoom: Double, tileSize: Long, scheme: TileScheme, attribution: String?, volatile: Boolean, callback: (Result) -> Unit) + /** Add a raster DEM source to the map style. */ + fun addRasterDemSource(id: String, url: String?, tiles: List?, bounds: List, minZoom: Double, maxZoom: Double, tileSize: Long, attribution: String?, encoding: RasterDemEncoding, volatile: Boolean, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, callback: (Result) -> Unit) + /** Add a vector source to the map style. */ + fun addVectorSource(id: String, url: String?, tiles: List?, bounds: List, scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Boolean, sourceLayer: String?, callback: (Result) -> Unit) + /** + * Returns the distance spanned by one pixel at the specified latitude and + * current zoom level. + */ + fun getMetersPerPixelAtLatitude(latitude: Double): Double + /** Update the map options. */ + fun updateOptions(options: MapOptions, callback: (Result) -> Unit) + + companion object { + /** The codec used by MapLibreHostApi. */ + val codec: MessageCodec by lazy { + PigeonPigeonCodec() + } + /** Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val centerArg = args[0] as LngLat? + val zoomArg = args[1] as Double? + val bearingArg = args[2] as Double? + val pitchArg = args[3] as Double? + api.jumpTo(centerArg, zoomArg, bearingArg, pitchArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val centerArg = args[0] as LngLat? + val zoomArg = args[1] as Double? + val bearingArg = args[2] as Double? + val pitchArg = args[3] as Double? + val durationMsArg = args[4] as Long + api.flyTo(centerArg, zoomArg, bearingArg, pitchArg, durationMsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + api.getCamera{ result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + api.getVisibleRegion{ result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val lngArg = args[0] as Double + val latArg = args[1] as Double + api.toScreenLocation(lngArg, latArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val xArg = args[0] as Double + val yArg = args[1] as Double + api.toLngLat(xArg, yArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addFillLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addCircleLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val layoutArg = args[1] as Map + val paintArg = args[2] as Map + val belowLayerIdArg = args[3] as String? + api.addBackgroundLayer(idArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addFillExtrusionLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addHeatmapLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addHillshadeLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addLineLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addRasterLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val sourceIdArg = args[1] as String + val layoutArg = args[2] as Map + val paintArg = args[3] as Map + val belowLayerIdArg = args[4] as String? + api.addSymbolLayer(idArg, sourceIdArg, layoutArg, paintArg, belowLayerIdArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + api.removeLayer(idArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + api.removeSource(idArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val urlArg = args[0] as String + api.loadImage(urlArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val bytesArg = args[1] as ByteArray + api.addImage(idArg, bytesArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + api.removeImage(idArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val dataArg = args[1] as String + api.addGeoJsonSource(idArg, dataArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val dataArg = args[1] as String + api.updateGeoJsonSource(idArg, dataArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val urlArg = args[1] as String + val coordinatesArg = args[2] as List + api.addImageSource(idArg, urlArg, coordinatesArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val urlArg = args[1] as String? + val tilesArg = args[2] as List? + val boundsArg = args[3] as List + val minZoomArg = args[4] as Double + val maxZoomArg = args[5] as Double + val tileSizeArg = args[6] as Long + val schemeArg = args[7] as TileScheme + val attributionArg = args[8] as String? + val volatileArg = args[9] as Boolean + api.addRasterSource(idArg, urlArg, tilesArg, boundsArg, minZoomArg, maxZoomArg, tileSizeArg, schemeArg, attributionArg, volatileArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val urlArg = args[1] as String? + val tilesArg = args[2] as List? + val boundsArg = args[3] as List + val minZoomArg = args[4] as Double + val maxZoomArg = args[5] as Double + val tileSizeArg = args[6] as Long + val attributionArg = args[7] as String? + val encodingArg = args[8] as RasterDemEncoding + val volatileArg = args[9] as Boolean + val redFactorArg = args[10] as Double + val blueFactorArg = args[11] as Double + val greenFactorArg = args[12] as Double + val baseShiftArg = args[13] as Double + api.addRasterDemSource(idArg, urlArg, tilesArg, boundsArg, minZoomArg, maxZoomArg, tileSizeArg, attributionArg, encodingArg, volatileArg, redFactorArg, blueFactorArg, greenFactorArg, baseShiftArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val idArg = args[0] as String + val urlArg = args[1] as String? + val tilesArg = args[2] as List? + val boundsArg = args[3] as List + val schemeArg = args[4] as TileScheme + val minZoomArg = args[5] as Double + val maxZoomArg = args[6] as Double + val attributionArg = args[7] as String? + val volatileArg = args[8] as Boolean + val sourceLayerArg = args[9] as String? + api.addVectorSource(idArg, urlArg, tilesArg, boundsArg, schemeArg, minZoomArg, maxZoomArg, attributionArg, volatileArg, sourceLayerArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val latitudeArg = args[0] as Double + val wrapped: List = try { + listOf(api.getMetersPerPixelAtLatitude(latitudeArg)) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val optionsArg = args[0] as MapOptions + api.updateOptions(optionsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(wrapError(error)) + } else { + reply.reply(wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ +class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { + companion object { + /** The codec used by MapLibreFlutterApi. */ + val codec: MessageCodec by lazy { + PigeonPigeonCodec() + } + } + /** Get the map options from dart. */ + fun getOptions(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""))) + } else { + val output = it[0] as MapOptions + callback(Result.success(output)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback for when the style has been loaded. */ + fun onStyleLoaded(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the user clicks on the map. */ + fun onClick(pointArg: LngLat, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pointArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the map idles. */ + fun onIdle(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the map camera idles. */ + fun onCameraIdle(callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** + * Callback when the user performs a secondary click on the map + * (e.g. by default a click with the right mouse button). + */ + fun onSecondaryClick(pointArg: LngLat, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pointArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the user performs a double click on the map. */ + fun onDoubleClick(pointArg: LngLat, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pointArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the user performs a long lasting click on the map. */ + fun onLongClick(pointArg: LngLat, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pointArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } + /** Callback when the map camera changes. */ + fun onCameraMoved(cameraArg: MapCamera, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(cameraArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } +} diff --git a/ios/Classes/Pigeon.g.swift b/ios/Classes/Pigeon.g.swift index d6711ca..be85aa8 100644 --- a/ios/Classes/Pigeon.g.swift +++ b/ios/Classes/Pigeon.g.swift @@ -29,6 +29,36 @@ final class PigeonError: Error { } } +private func wrapResult(_ result: Any?) -> [Any?] { + return [result] +} + +private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } + if let flutterError = error as? FlutterError { + return [ + flutterError.code, + flutterError.message, + flutterError.details, + ] + } + return [ + "\(error)", + "\(type(of: error))", + "Stacktrace: \(Thread.callStackSymbols)", + ] +} + +private func createConnectionError(withChannelName channelName: String) -> PigeonError { + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") +} + private func isNullish(_ value: Any?) -> Bool { return value is NSNull || value == nil } @@ -57,6 +87,85 @@ enum RasterDemEncoding: Int { case custom = 2 } +/// The map options define initial values for the MapLibre map. +/// +/// Generated class from Pigeon that represents data sent in messages. +struct MapOptions { + /// The URL of the used map style. + var style: String + /// The initial zoom level of the map. + var zoom: Double + /// The initial tilt of the map. + var tilt: Double + /// The initial bearing of the map. + var bearing: Double + /// The initial center coordinates of the map. + var center: LngLat? = nil + /// The maximum bounding box of the map camera. + var maxBounds: LngLatBounds? = nil + /// The minimum zoom level of the map. + var minZoom: Double + /// The maximum zoom level of the map. + var maxZoom: Double + /// The minimum pitch / tilt of the map. + var minTilt: Double + /// The maximum pitch / tilt of the map. + var maxTilt: Double + /// If the native map should listen to click events. + var listensOnClick: Bool + /// If the native map should listen to long click events. + var listensOnLongClick: Bool + + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> MapOptions? { + let style = pigeonVar_list[0] as! String + let zoom = pigeonVar_list[1] as! Double + let tilt = pigeonVar_list[2] as! Double + let bearing = pigeonVar_list[3] as! Double + let center: LngLat? = nilOrValue(pigeonVar_list[4]) + let maxBounds: LngLatBounds? = nilOrValue(pigeonVar_list[5]) + let minZoom = pigeonVar_list[6] as! Double + let maxZoom = pigeonVar_list[7] as! Double + let minTilt = pigeonVar_list[8] as! Double + let maxTilt = pigeonVar_list[9] as! Double + let listensOnClick = pigeonVar_list[10] as! Bool + let listensOnLongClick = pigeonVar_list[11] as! Bool + + return MapOptions( + style: style, + zoom: zoom, + tilt: tilt, + bearing: bearing, + center: center, + maxBounds: maxBounds, + minZoom: minZoom, + maxZoom: maxZoom, + minTilt: minTilt, + maxTilt: maxTilt, + listensOnClick: listensOnClick, + listensOnLongClick: listensOnLongClick + ) + } + func toList() -> [Any?] { + return [ + style, + zoom, + tilt, + bearing, + center, + maxBounds, + minZoom, + maxZoom, + minTilt, + maxTilt, + listensOnClick, + listensOnLongClick, + ] + } +} + /// A longitude/latitude coordinate object. /// /// Generated class from Pigeon that represents data sent in messages. @@ -201,12 +310,14 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return LngLat.fromList(self.readValue() as! [Any?]) + return MapOptions.fromList(self.readValue() as! [Any?]) case 132: - return ScreenLocation.fromList(self.readValue() as! [Any?]) + return LngLat.fromList(self.readValue() as! [Any?]) case 133: - return MapCamera.fromList(self.readValue() as! [Any?]) + return ScreenLocation.fromList(self.readValue() as! [Any?]) case 134: + return MapCamera.fromList(self.readValue() as! [Any?]) + case 135: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -222,18 +333,21 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? LngLat { + } else if let value = value as? MapOptions { super.writeByte(131) super.writeValue(value.toList()) - } else if let value = value as? ScreenLocation { + } else if let value = value as? LngLat { super.writeByte(132) super.writeValue(value.toList()) - } else if let value = value as? MapCamera { + } else if let value = value as? ScreenLocation { super.writeByte(133) super.writeValue(value.toList()) - } else if let value = value as? LngLatBounds { + } else if let value = value as? MapCamera { super.writeByte(134) super.writeValue(value.toList()) + } else if let value = value as? LngLatBounds { + super.writeByte(135) + super.writeValue(value.toList()) } else { super.writeValue(value) } @@ -254,3 +368,864 @@ class PigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { static let shared = PigeonPigeonCodec(readerWriter: PigeonPigeonCodecReaderWriter()) } + +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MapLibreHostApi { + /// Move the viewport of the map to a new location without any animation. + func jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, completion: @escaping (Result) -> Void) + /// Animate the viewport of the map to a new location. + func flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Int64, completion: @escaping (Result) -> Void) + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + func getCamera(completion: @escaping (Result) -> Void) + /// Get the visible region of the current map camera. + func getVisibleRegion(completion: @escaping (Result) -> Void) + /// Convert a coordinate to a location on the screen. + func toScreenLocation(lng: Double, lat: Double, completion: @escaping (Result) -> Void) + /// Convert a screen location to a coordinate. + func toLngLat(x: Double, y: Double, completion: @escaping (Result) -> Void) + /// Add a fill layer to the map style. + func addFillLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a circle layer to the map style. + func addCircleLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a background layer to the map style. + func addBackgroundLayer(id: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a fill extrusion layer to the map style. + func addFillExtrusionLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a heatmap layer to the map style. + func addHeatmapLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a hillshade layer to the map style. + func addHillshadeLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a line layer to the map style. + func addLineLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a raster layer to the map style. + func addRasterLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a symbol layer to the map style. + func addSymbolLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Removes the layer with the given ID from the map's style. + func removeLayer(id: String, completion: @escaping (Result) -> Void) + /// Removes the source with the given ID from the map's style. + func removeSource(id: String, completion: @escaping (Result) -> Void) + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + func loadImage(url: String, completion: @escaping (Result) -> Void) + /// Add an image to the map. + func addImage(id: String, bytes: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + /// Removes an image from the map + func removeImage(id: String, completion: @escaping (Result) -> Void) + /// Add a GeoJSON source to the map style. + func addGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) + /// Update the data of a GeoJSON source. + func updateGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) + /// Add a image source to the map style. + func addImageSource(id: String, url: String, coordinates: [LngLat], completion: @escaping (Result) -> Void) + /// Add a raster source to the map style. + func addRasterSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, scheme: TileScheme, attribution: String?, volatile: Bool, completion: @escaping (Result) -> Void) + /// Add a raster DEM source to the map style. + func addRasterDemSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, attribution: String?, encoding: RasterDemEncoding, volatile: Bool, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, completion: @escaping (Result) -> Void) + /// Add a vector source to the map style. + func addVectorSource(id: String, url: String?, tiles: [String]?, bounds: [Double], scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Bool, sourceLayer: String?, completion: @escaping (Result) -> Void) + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + func getMetersPerPixelAtLatitude(latitude: Double) throws -> Double + /// Update the map options. + func updateOptions(options: MapOptions, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MapLibreHostApiSetup { + static var codec: FlutterStandardMessageCodec { PigeonPigeonCodec.shared } + /// Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + /// Move the viewport of the map to a new location without any animation. + let jumpToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + jumpToChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let centerArg: LngLat? = nilOrValue(args[0]) + let zoomArg: Double? = nilOrValue(args[1]) + let bearingArg: Double? = nilOrValue(args[2]) + let pitchArg: Double? = nilOrValue(args[3]) + api.jumpTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + jumpToChannel.setMessageHandler(nil) + } + /// Animate the viewport of the map to a new location. + let flyToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + flyToChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let centerArg: LngLat? = nilOrValue(args[0]) + let zoomArg: Double? = nilOrValue(args[1]) + let bearingArg: Double? = nilOrValue(args[2]) + let pitchArg: Double? = nilOrValue(args[3]) + let durationMsArg = args[4] as! Int64 + api.flyTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg, durationMs: durationMsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + flyToChannel.setMessageHandler(nil) + } + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + let getCameraChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCameraChannel.setMessageHandler { _, reply in + api.getCamera { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getCameraChannel.setMessageHandler(nil) + } + /// Get the visible region of the current map camera. + let getVisibleRegionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getVisibleRegionChannel.setMessageHandler { _, reply in + api.getVisibleRegion { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getVisibleRegionChannel.setMessageHandler(nil) + } + /// Convert a coordinate to a location on the screen. + let toScreenLocationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + toScreenLocationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let lngArg = args[0] as! Double + let latArg = args[1] as! Double + api.toScreenLocation(lng: lngArg, lat: latArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + toScreenLocationChannel.setMessageHandler(nil) + } + /// Convert a screen location to a coordinate. + let toLngLatChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + toLngLatChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let xArg = args[0] as! Double + let yArg = args[1] as! Double + api.toLngLat(x: xArg, y: yArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + toLngLatChannel.setMessageHandler(nil) + } + /// Add a fill layer to the map style. + let addFillLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addFillLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addFillLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addFillLayerChannel.setMessageHandler(nil) + } + /// Add a circle layer to the map style. + let addCircleLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addCircleLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addCircleLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addCircleLayerChannel.setMessageHandler(nil) + } + /// Add a background layer to the map style. + let addBackgroundLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addBackgroundLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let layoutArg = args[1] as! [String: Any] + let paintArg = args[2] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[3]) + api.addBackgroundLayer(id: idArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addBackgroundLayerChannel.setMessageHandler(nil) + } + /// Add a fill extrusion layer to the map style. + let addFillExtrusionLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addFillExtrusionLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addFillExtrusionLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addFillExtrusionLayerChannel.setMessageHandler(nil) + } + /// Add a heatmap layer to the map style. + let addHeatmapLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addHeatmapLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addHeatmapLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addHeatmapLayerChannel.setMessageHandler(nil) + } + /// Add a hillshade layer to the map style. + let addHillshadeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addHillshadeLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addHillshadeLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addHillshadeLayerChannel.setMessageHandler(nil) + } + /// Add a line layer to the map style. + let addLineLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addLineLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addLineLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addLineLayerChannel.setMessageHandler(nil) + } + /// Add a raster layer to the map style. + let addRasterLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addRasterLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterLayerChannel.setMessageHandler(nil) + } + /// Add a symbol layer to the map style. + let addSymbolLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addSymbolLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addSymbolLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addSymbolLayerChannel.setMessageHandler(nil) + } + /// Removes the layer with the given ID from the map's style. + let removeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeLayer(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeLayerChannel.setMessageHandler(nil) + } + /// Removes the source with the given ID from the map's style. + let removeSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeSource(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeSourceChannel.setMessageHandler(nil) + } + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + let loadImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let urlArg = args[0] as! String + api.loadImage(url: urlArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + loadImageChannel.setMessageHandler(nil) + } + /// Add an image to the map. + let addImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let bytesArg = args[1] as! FlutterStandardTypedData + api.addImage(id: idArg, bytes: bytesArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addImageChannel.setMessageHandler(nil) + } + /// Removes an image from the map + let removeImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeImage(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeImageChannel.setMessageHandler(nil) + } + /// Add a GeoJSON source to the map style. + let addGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addGeoJsonSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let dataArg = args[1] as! String + api.addGeoJsonSource(id: idArg, data: dataArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addGeoJsonSourceChannel.setMessageHandler(nil) + } + /// Update the data of a GeoJSON source. + let updateGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateGeoJsonSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let dataArg = args[1] as! String + api.updateGeoJsonSource(id: idArg, data: dataArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateGeoJsonSourceChannel.setMessageHandler(nil) + } + /// Add a image source to the map style. + let addImageSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addImageSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg = args[1] as! String + let coordinatesArg = args[2] as! [LngLat] + api.addImageSource(id: idArg, url: urlArg, coordinates: coordinatesArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addImageSourceChannel.setMessageHandler(nil) + } + /// Add a raster source to the map style. + let addRasterSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let minZoomArg = args[4] as! Double + let maxZoomArg = args[5] as! Double + let tileSizeArg = args[6] as! Int64 + let schemeArg = args[7] as! TileScheme + let attributionArg: String? = nilOrValue(args[8]) + let volatileArg = args[9] as! Bool + api.addRasterSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, scheme: schemeArg, attribution: attributionArg, volatile: volatileArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterSourceChannel.setMessageHandler(nil) + } + /// Add a raster DEM source to the map style. + let addRasterDemSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterDemSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let minZoomArg = args[4] as! Double + let maxZoomArg = args[5] as! Double + let tileSizeArg = args[6] as! Int64 + let attributionArg: String? = nilOrValue(args[7]) + let encodingArg = args[8] as! RasterDemEncoding + let volatileArg = args[9] as! Bool + let redFactorArg = args[10] as! Double + let blueFactorArg = args[11] as! Double + let greenFactorArg = args[12] as! Double + let baseShiftArg = args[13] as! Double + api.addRasterDemSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, attribution: attributionArg, encoding: encodingArg, volatile: volatileArg, redFactor: redFactorArg, blueFactor: blueFactorArg, greenFactor: greenFactorArg, baseShift: baseShiftArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterDemSourceChannel.setMessageHandler(nil) + } + /// Add a vector source to the map style. + let addVectorSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addVectorSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let schemeArg = args[4] as! TileScheme + let minZoomArg = args[5] as! Double + let maxZoomArg = args[6] as! Double + let attributionArg: String? = nilOrValue(args[7]) + let volatileArg = args[8] as! Bool + let sourceLayerArg: String? = nilOrValue(args[9]) + api.addVectorSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, scheme: schemeArg, minZoom: minZoomArg, maxZoom: maxZoomArg, attribution: attributionArg, volatile: volatileArg, sourceLayer: sourceLayerArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addVectorSourceChannel.setMessageHandler(nil) + } + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + let getMetersPerPixelAtLatitudeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getMetersPerPixelAtLatitudeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let latitudeArg = args[0] as! Double + do { + let result = try api.getMetersPerPixelAtLatitude(latitude: latitudeArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getMetersPerPixelAtLatitudeChannel.setMessageHandler(nil) + } + /// Update the map options. + let updateOptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateOptionsChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let optionsArg = args[0] as! MapOptions + api.updateOptions(options: optionsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateOptionsChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. +protocol MapLibreFlutterApiProtocol { + /// Get the map options from dart. + func getOptions(completion: @escaping (Result) -> Void) + /// Callback for when the style has been loaded. + func onStyleLoaded(completion: @escaping (Result) -> Void) + /// Callback when the user clicks on the map. + func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the user performs a double click on the map. + func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the user performs a long lasting click on the map. + func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map camera changes. + func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) +} +class MapLibreFlutterApi: MapLibreFlutterApiProtocol { + private let binaryMessenger: FlutterBinaryMessenger + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { + self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + } + var codec: PigeonPigeonCodec { + return PigeonPigeonCodec.shared + } + /// Get the map options from dart. + func getOptions(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! MapOptions + completion(.success(result)) + } + } + } + /// Callback for when the style has been loaded. + func onStyleLoaded(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user clicks on the map. + func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a double click on the map. + func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a long lasting click on the map. + func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map camera changes. + func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([cameraArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } +} diff --git a/lib/src/native/pigeon.g.dart b/lib/src/native/pigeon.g.dart index f545479..87060c2 100644 --- a/lib/src/native/pigeon.g.dart +++ b/lib/src/native/pigeon.g.dart @@ -8,6 +8,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + /// Influences the y direction of the tile coordinates. enum TileScheme { /// Slippy map tilenames scheme. @@ -30,6 +48,95 @@ enum RasterDemEncoding { custom, } +/// The map options define initial values for the MapLibre map. +class MapOptions { + MapOptions({ + required this.style, + required this.zoom, + required this.tilt, + required this.bearing, + this.center, + this.maxBounds, + required this.minZoom, + required this.maxZoom, + required this.minTilt, + required this.maxTilt, + required this.listensOnClick, + required this.listensOnLongClick, + }); + + /// The URL of the used map style. + String style; + + /// The initial zoom level of the map. + double zoom; + + /// The initial tilt of the map. + double tilt; + + /// The initial bearing of the map. + double bearing; + + /// The initial center coordinates of the map. + LngLat? center; + + /// The maximum bounding box of the map camera. + LngLatBounds? maxBounds; + + /// The minimum zoom level of the map. + double minZoom; + + /// The maximum zoom level of the map. + double maxZoom; + + /// The minimum pitch / tilt of the map. + double minTilt; + + /// The maximum pitch / tilt of the map. + double maxTilt; + + /// If the native map should listen to click events. + bool listensOnClick; + + /// If the native map should listen to long click events. + bool listensOnLongClick; + + Object encode() { + return [ + style, + zoom, + tilt, + bearing, + center, + maxBounds, + minZoom, + maxZoom, + minTilt, + maxTilt, + listensOnClick, + listensOnLongClick, + ]; + } + + static MapOptions decode(Object result) { + result as List; + return MapOptions( + style: result[0]! as String, + zoom: result[1]! as double, + tilt: result[2]! as double, + bearing: result[3]! as double, + center: result[4] as LngLat?, + maxBounds: result[5] as LngLatBounds?, + minZoom: result[6]! as double, + maxZoom: result[7]! as double, + minTilt: result[8]! as double, + maxTilt: result[9]! as double, + listensOnClick: result[10]! as bool, + listensOnLongClick: result[11]! as bool, + ); + } +} + /// A longitude/latitude coordinate object. class LngLat { LngLat({ @@ -175,18 +282,21 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is RasterDemEncoding) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is LngLat) { + } else if (value is MapOptions) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is ScreenLocation) { + } else if (value is LngLat) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is MapCamera) { + } else if (value is ScreenLocation) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is LngLatBounds) { + } else if (value is MapCamera) { buffer.putUint8(134); writeValue(buffer, value.encode()); + } else if (value is LngLatBounds) { + buffer.putUint8(135); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -202,15 +312,1197 @@ class _PigeonCodec extends StandardMessageCodec { final int? value = readValue(buffer) as int?; return value == null ? null : RasterDemEncoding.values[value]; case 131: - return LngLat.decode(readValue(buffer)!); + return MapOptions.decode(readValue(buffer)!); case 132: - return ScreenLocation.decode(readValue(buffer)!); + return LngLat.decode(readValue(buffer)!); case 133: - return MapCamera.decode(readValue(buffer)!); + return ScreenLocation.decode(readValue(buffer)!); case 134: + return MapCamera.decode(readValue(buffer)!); + case 135: return LngLatBounds.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } } } + +class MapLibreHostApi { + /// Constructor for [MapLibreHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + MapLibreHostApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; + + /// Move the viewport of the map to a new location without any animation. + Future jumpTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([center, zoom, bearing, pitch]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Animate the viewport of the map to a new location. + Future flyTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + required int durationMs, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([center, zoom, bearing, pitch, durationMs]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + Future getCamera() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as MapCamera?)!; + } + } + + /// Get the visible region of the current map camera. + Future getVisibleRegion() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as LngLatBounds?)!; + } + } + + /// Convert a coordinate to a location on the screen. + Future toScreenLocation(double lng, double lat) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([lng, lat]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as ScreenLocation?)!; + } + } + + /// Convert a screen location to a coordinate. + Future toLngLat(double x, double y) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([x, y]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as LngLat?)!; + } + } + + /// Add a fill layer to the map style. + Future addFillLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a circle layer to the map style. + Future addCircleLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a background layer to the map style. + Future addBackgroundLayer({ + required String id, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, layout, paint, belowLayerId]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a fill extrusion layer to the map style. + Future addFillExtrusionLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a heatmap layer to the map style. + Future addHeatmapLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a hillshade layer to the map style. + Future addHillshadeLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a line layer to the map style. + Future addLineLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a raster layer to the map style. + Future addRasterLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a symbol layer to the map style. + Future addSymbolLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, sourceId, layout, paint, belowLayerId]) + as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Removes the layer with the given ID from the map's style. + Future removeLayer(String id) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Removes the source with the given ID from the map's style. + Future removeSource(String id) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + Future loadImage(String url) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([url]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as Uint8List?)!; + } + } + + /// Add an image to the map. + Future addImage(String id, Uint8List bytes) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id, bytes]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Removes an image from the map + Future removeImage(String id) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a GeoJSON source to the map style. + Future addGeoJsonSource( + {required String id, required String data}) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id, data]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Update the data of a GeoJSON source. + Future updateGeoJsonSource( + {required String id, required String data}) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([id, data]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a image source to the map style. + Future addImageSource({ + required String id, + required String url, + required List coordinates, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = await pigeonVar_channel + .send([id, url, coordinates]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a raster source to the map style. + Future addRasterSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required TileScheme scheme, + required String? attribution, + required bool volatile, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([ + id, + url, + tiles, + bounds, + minZoom, + maxZoom, + tileSize, + scheme, + attribution, + volatile + ]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a raster DEM source to the map style. + Future addRasterDemSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required String? attribution, + required RasterDemEncoding encoding, + required bool volatile, + double redFactor = 1, + double blueFactor = 1, + double greenFactor = 1, + double baseShift = 0, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([ + id, + url, + tiles, + bounds, + minZoom, + maxZoom, + tileSize, + attribution, + encoding, + volatile, + redFactor, + blueFactor, + greenFactor, + baseShift + ]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Add a vector source to the map style. + Future addVectorSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required TileScheme scheme, + required double minZoom, + required double maxZoom, + required String? attribution, + required bool volatile, + required String? sourceLayer, + }) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([ + id, + url, + tiles, + bounds, + scheme, + minZoom, + maxZoom, + attribution, + volatile, + sourceLayer + ]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + Future getMetersPerPixelAtLatitude(double latitude) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([latitude]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as double?)!; + } + } + + /// Update the map options. + Future updateOptions(MapOptions options) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([options]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } +} + +abstract class MapLibreFlutterApi { + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + /// Get the map options from dart. + MapOptions getOptions(); + + /// Callback for when the style has been loaded. + void onStyleLoaded(); + + /// Callback when the user clicks on the map. + void onClick(LngLat point); + + /// Callback when the map idles. + void onIdle(); + + /// Callback when the map camera idles. + void onCameraIdle(); + + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + void onSecondaryClick(LngLat point); + + /// Callback when the user performs a double click on the map. + void onDoubleClick(LngLat point); + + /// Callback when the user performs a long lasting click on the map. + void onLongClick(LngLat point); + + /// Callback when the map camera changes. + void onCameraMoved(MapCamera camera); + + static void setUp( + MapLibreFlutterApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + final MapOptions output = api.getOptions(); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.onStyleLoaded(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null.'); + final List args = (message as List?)!; + final LngLat? arg_point = (args[0] as LngLat?); + assert(arg_point != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null, expected non-null LngLat.'); + try { + api.onClick(arg_point!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.onIdle(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + try { + api.onCameraIdle(); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null.'); + final List args = (message as List?)!; + final LngLat? arg_point = (args[0] as LngLat?); + assert(arg_point != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null, expected non-null LngLat.'); + try { + api.onSecondaryClick(arg_point!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null.'); + final List args = (message as List?)!; + final LngLat? arg_point = (args[0] as LngLat?); + assert(arg_point != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null, expected non-null LngLat.'); + try { + api.onDoubleClick(arg_point!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null.'); + final List args = (message as List?)!; + final LngLat? arg_point = (args[0] as LngLat?); + assert(arg_point != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null, expected non-null LngLat.'); + try { + api.onLongClick(arg_point!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null.'); + final List args = (message as List?)!; + final MapCamera? arg_camera = (args[0] as MapCamera?); + assert(arg_camera != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null, expected non-null MapCamera.'); + try { + api.onCameraMoved(arg_camera!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } +} diff --git a/linux/pigeon.g.cc b/linux/pigeon.g.cc index 42e47d4..bbec5c3 100644 --- a/linux/pigeon.g.cc +++ b/linux/pigeon.g.cc @@ -3,6 +3,178 @@ #include "pigeon.g.h" +struct _MaplibreMapOptions { + GObject parent_instance; + + gchar* style; + double zoom; + double tilt; + double bearing; + MaplibreLngLat* center; + MaplibreLngLatBounds* max_bounds; + double min_zoom; + double max_zoom; + double min_tilt; + double max_tilt; + gboolean listens_on_click; + gboolean listens_on_long_click; +}; + +G_DEFINE_TYPE(MaplibreMapOptions, maplibre_map_options, G_TYPE_OBJECT) + +static void maplibre_map_options_dispose(GObject* object) { + MaplibreMapOptions* self = MAPLIBRE_MAP_OPTIONS(object); + g_clear_pointer(&self->style, g_free); + g_clear_object(&self->center); + g_clear_object(&self->max_bounds); + G_OBJECT_CLASS(maplibre_map_options_parent_class)->dispose(object); +} + +static void maplibre_map_options_init(MaplibreMapOptions* self) { +} + +static void maplibre_map_options_class_init(MaplibreMapOptionsClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_options_dispose; +} + +MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double tilt, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_tilt, double max_tilt, gboolean listens_on_click, gboolean listens_on_long_click) { + MaplibreMapOptions* self = MAPLIBRE_MAP_OPTIONS(g_object_new(maplibre_map_options_get_type(), nullptr)); + self->style = g_strdup(style); + self->zoom = zoom; + self->tilt = tilt; + self->bearing = bearing; + if (center != nullptr) { + self->center = MAPLIBRE_LNG_LAT(g_object_ref(center)); + } + else { + self->center = nullptr; + } + if (max_bounds != nullptr) { + self->max_bounds = MAPLIBRE_LNG_LAT_BOUNDS(g_object_ref(max_bounds)); + } + else { + self->max_bounds = nullptr; + } + self->min_zoom = min_zoom; + self->max_zoom = max_zoom; + self->min_tilt = min_tilt; + self->max_tilt = max_tilt; + self->listens_on_click = listens_on_click; + self->listens_on_long_click = listens_on_long_click; + return self; +} + +const gchar* maplibre_map_options_get_style(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); + return self->style; +} + +double maplibre_map_options_get_zoom(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->zoom; +} + +double maplibre_map_options_get_tilt(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->tilt; +} + +double maplibre_map_options_get_bearing(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->bearing; +} + +MaplibreLngLat* maplibre_map_options_get_center(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); + return self->center; +} + +MaplibreLngLatBounds* maplibre_map_options_get_max_bounds(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), nullptr); + return self->max_bounds; +} + +double maplibre_map_options_get_min_zoom(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->min_zoom; +} + +double maplibre_map_options_get_max_zoom(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->max_zoom; +} + +double maplibre_map_options_get_min_tilt(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->min_tilt; +} + +double maplibre_map_options_get_max_tilt(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), 0.0); + return self->max_tilt; +} + +gboolean maplibre_map_options_get_listens_on_click(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE); + return self->listens_on_click; +} + +gboolean maplibre_map_options_get_listens_on_long_click(MaplibreMapOptions* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE); + return self->listens_on_long_click; +} + +static FlValue* maplibre_map_options_to_list(MaplibreMapOptions* self) { + FlValue* values = fl_value_new_list(); + fl_value_append_take(values, fl_value_new_string(self->style)); + fl_value_append_take(values, fl_value_new_float(self->zoom)); + fl_value_append_take(values, fl_value_new_float(self->tilt)); + fl_value_append_take(values, fl_value_new_float(self->bearing)); + fl_value_append_take(values, self->center != nullptr ? fl_value_new_custom_object(132, G_OBJECT(self->center)) : fl_value_new_null()); + fl_value_append_take(values, self->max_bounds != nullptr ? fl_value_new_custom_object(135, G_OBJECT(self->max_bounds)) : fl_value_new_null()); + fl_value_append_take(values, fl_value_new_float(self->min_zoom)); + fl_value_append_take(values, fl_value_new_float(self->max_zoom)); + fl_value_append_take(values, fl_value_new_float(self->min_tilt)); + fl_value_append_take(values, fl_value_new_float(self->max_tilt)); + fl_value_append_take(values, fl_value_new_bool(self->listens_on_click)); + fl_value_append_take(values, fl_value_new_bool(self->listens_on_long_click)); + return values; +} + +static MaplibreMapOptions* maplibre_map_options_new_from_list(FlValue* values) { + FlValue* value0 = fl_value_get_list_value(values, 0); + const gchar* style = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(values, 1); + double zoom = fl_value_get_float(value1); + FlValue* value2 = fl_value_get_list_value(values, 2); + double tilt = fl_value_get_float(value2); + FlValue* value3 = fl_value_get_list_value(values, 3); + double bearing = fl_value_get_float(value3); + FlValue* value4 = fl_value_get_list_value(values, 4); + MaplibreLngLat* center = nullptr; + if (fl_value_get_type(value4) != FL_VALUE_TYPE_NULL) { + center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value4)); + } + FlValue* value5 = fl_value_get_list_value(values, 5); + MaplibreLngLatBounds* max_bounds = nullptr; + if (fl_value_get_type(value5) != FL_VALUE_TYPE_NULL) { + max_bounds = MAPLIBRE_LNG_LAT_BOUNDS(fl_value_get_custom_value_object(value5)); + } + FlValue* value6 = fl_value_get_list_value(values, 6); + double min_zoom = fl_value_get_float(value6); + FlValue* value7 = fl_value_get_list_value(values, 7); + double max_zoom = fl_value_get_float(value7); + FlValue* value8 = fl_value_get_list_value(values, 8); + double min_tilt = fl_value_get_float(value8); + FlValue* value9 = fl_value_get_list_value(values, 9); + double max_tilt = fl_value_get_float(value9); + FlValue* value10 = fl_value_get_list_value(values, 10); + gboolean listens_on_click = fl_value_get_bool(value10); + FlValue* value11 = fl_value_get_list_value(values, 11); + gboolean listens_on_long_click = fl_value_get_bool(value11); + return maplibre_map_options_new(style, zoom, tilt, bearing, center, max_bounds, min_zoom, max_zoom, min_tilt, max_tilt, listens_on_click, listens_on_long_click); +} + struct _MaplibreLngLat { GObject parent_instance; @@ -162,7 +334,7 @@ double maplibre_map_camera_get_bearing(MaplibreMapCamera* self) { static FlValue* maplibre_map_camera_to_list(MaplibreMapCamera* self) { FlValue* values = fl_value_new_list(); - fl_value_append_take(values, fl_value_new_custom_object(131, G_OBJECT(self->center))); + fl_value_append_take(values, fl_value_new_custom_object(132, G_OBJECT(self->center))); fl_value_append_take(values, fl_value_new_float(self->zoom)); fl_value_append_take(values, fl_value_new_float(self->tilt)); fl_value_append_take(values, fl_value_new_float(self->bearing)); @@ -274,29 +446,36 @@ static gboolean maplibre_message_codec_write_maplibre_raster_dem_encoding(FlStan return fl_standard_message_codec_write_value(codec, buffer, value, error); } -static gboolean maplibre_message_codec_write_maplibre_lng_lat(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLat* value, GError** error) { +static gboolean maplibre_message_codec_write_maplibre_map_options(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapOptions* value, GError** error) { uint8_t type = 131; g_byte_array_append(buffer, &type, sizeof(uint8_t)); + g_autoptr(FlValue) values = maplibre_map_options_to_list(value); + return fl_standard_message_codec_write_value(codec, buffer, values, error); +} + +static gboolean maplibre_message_codec_write_maplibre_lng_lat(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLat* value, GError** error) { + uint8_t type = 132; + g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_screen_location(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreScreenLocation* value, GError** error) { - uint8_t type = 132; + uint8_t type = 133; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_screen_location_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_map_camera(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapCamera* value, GError** error) { - uint8_t type = 133; + uint8_t type = 134; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_map_camera_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLatBounds* value, GError** error) { - uint8_t type = 134; + uint8_t type = 135; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_bounds_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); @@ -310,12 +489,14 @@ static gboolean maplibre_message_codec_write_value(FlStandardMessageCodec* codec case 130: return maplibre_message_codec_write_maplibre_raster_dem_encoding(codec, buffer, reinterpret_cast(const_cast(fl_value_get_custom_value(value))), error); case 131: - return maplibre_message_codec_write_maplibre_lng_lat(codec, buffer, MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_map_options(codec, buffer, MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value)), error); case 132: - return maplibre_message_codec_write_maplibre_screen_location(codec, buffer, MAPLIBRE_SCREEN_LOCATION(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_lng_lat(codec, buffer, MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value)), error); case 133: - return maplibre_message_codec_write_maplibre_map_camera(codec, buffer, MAPLIBRE_MAP_CAMERA(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_screen_location(codec, buffer, MAPLIBRE_SCREEN_LOCATION(fl_value_get_custom_value_object(value)), error); case 134: + return maplibre_message_codec_write_maplibre_map_camera(codec, buffer, MAPLIBRE_MAP_CAMERA(fl_value_get_custom_value_object(value)), error); + case 135: return maplibre_message_codec_write_maplibre_lng_lat_bounds(codec, buffer, MAPLIBRE_LNG_LAT_BOUNDS(fl_value_get_custom_value_object(value)), error); } } @@ -331,6 +512,21 @@ static FlValue* maplibre_message_codec_read_maplibre_raster_dem_encoding(FlStand return fl_value_new_custom(130, fl_standard_message_codec_read_value(codec, buffer, offset, error), (GDestroyNotify)fl_value_unref); } +static FlValue* maplibre_message_codec_read_maplibre_map_options(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { + g_autoptr(FlValue) values = fl_standard_message_codec_read_value(codec, buffer, offset, error); + if (values == nullptr) { + return nullptr; + } + + g_autoptr(MaplibreMapOptions) value = maplibre_map_options_new_from_list(values); + if (value == nullptr) { + g_set_error(error, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_FAILED, "Invalid data received for MessageData"); + return nullptr; + } + + return fl_value_new_custom_object(131, G_OBJECT(value)); +} + static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { g_autoptr(FlValue) values = fl_standard_message_codec_read_value(codec, buffer, offset, error); if (values == nullptr) { @@ -343,7 +539,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCo return nullptr; } - return fl_value_new_custom_object(131, G_OBJECT(value)); + return fl_value_new_custom_object(132, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -358,7 +554,7 @@ static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardM return nullptr; } - return fl_value_new_custom_object(132, G_OBJECT(value)); + return fl_value_new_custom_object(133, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -373,7 +569,7 @@ static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessag return nullptr; } - return fl_value_new_custom_object(133, G_OBJECT(value)); + return fl_value_new_custom_object(134, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -388,7 +584,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMe return nullptr; } - return fl_value_new_custom_object(134, G_OBJECT(value)); + return fl_value_new_custom_object(135, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, int type, GError** error) { @@ -398,12 +594,14 @@ static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec case 130: return maplibre_message_codec_read_maplibre_raster_dem_encoding(codec, buffer, offset, error); case 131: - return maplibre_message_codec_read_maplibre_lng_lat(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_map_options(codec, buffer, offset, error); case 132: - return maplibre_message_codec_read_maplibre_screen_location(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_lng_lat(codec, buffer, offset, error); case 133: - return maplibre_message_codec_read_maplibre_map_camera(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_screen_location(codec, buffer, offset, error); case 134: + return maplibre_message_codec_read_maplibre_map_camera(codec, buffer, offset, error); + case 135: return maplibre_message_codec_read_maplibre_lng_lat_bounds(codec, buffer, offset, error); default: return FL_STANDARD_MESSAGE_CODEC_CLASS(maplibre_message_codec_parent_class)->read_value_of_type(codec, buffer, offset, type, error); @@ -422,3 +620,3080 @@ static MaplibreMessageCodec* maplibre_message_codec_new() { MaplibreMessageCodec* self = MAPLIBRE_MESSAGE_CODEC(g_object_new(maplibre_message_codec_get_type(), nullptr)); return self; } + +struct _MaplibreMapLibreHostApiResponseHandle { + GObject parent_instance; + + FlBasicMessageChannel* channel; + FlBasicMessageChannelResponseHandle* response_handle; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiResponseHandle, maplibre_map_libre_host_api_response_handle, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_response_handle_dispose(GObject* object) { + MaplibreMapLibreHostApiResponseHandle* self = MAPLIBRE_MAP_LIBRE_HOST_API_RESPONSE_HANDLE(object); + g_clear_object(&self->channel); + g_clear_object(&self->response_handle); + G_OBJECT_CLASS(maplibre_map_libre_host_api_response_handle_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_response_handle_init(MaplibreMapLibreHostApiResponseHandle* self) { +} + +static void maplibre_map_libre_host_api_response_handle_class_init(MaplibreMapLibreHostApiResponseHandleClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_response_handle_dispose; +} + +static MaplibreMapLibreHostApiResponseHandle* maplibre_map_libre_host_api_response_handle_new(FlBasicMessageChannel* channel, FlBasicMessageChannelResponseHandle* response_handle) { + MaplibreMapLibreHostApiResponseHandle* self = MAPLIBRE_MAP_LIBRE_HOST_API_RESPONSE_HANDLE(g_object_new(maplibre_map_libre_host_api_response_handle_get_type(), nullptr)); + self->channel = FL_BASIC_MESSAGE_CHANNEL(g_object_ref(channel)); + self->response_handle = FL_BASIC_MESSAGE_CHANNEL_RESPONSE_HANDLE(g_object_ref(response_handle)); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiJumpToResponse, maplibre_map_libre_host_api_jump_to_response, MAPLIBRE, MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiJumpToResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiJumpToResponse, maplibre_map_libre_host_api_jump_to_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_jump_to_response_dispose(GObject* object) { + MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_jump_to_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_jump_to_response_init(MaplibreMapLibreHostApiJumpToResponse* self) { +} + +static void maplibre_map_libre_host_api_jump_to_response_class_init(MaplibreMapLibreHostApiJumpToResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_jump_to_response_dispose; +} + +static MaplibreMapLibreHostApiJumpToResponse* maplibre_map_libre_host_api_jump_to_response_new() { + MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_jump_to_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiJumpToResponse* maplibre_map_libre_host_api_jump_to_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiJumpToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_JUMP_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_jump_to_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiFlyToResponse, maplibre_map_libre_host_api_fly_to_response, MAPLIBRE, MAP_LIBRE_HOST_API_FLY_TO_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiFlyToResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiFlyToResponse, maplibre_map_libre_host_api_fly_to_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_fly_to_response_dispose(GObject* object) { + MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_fly_to_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_fly_to_response_init(MaplibreMapLibreHostApiFlyToResponse* self) { +} + +static void maplibre_map_libre_host_api_fly_to_response_class_init(MaplibreMapLibreHostApiFlyToResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_fly_to_response_dispose; +} + +static MaplibreMapLibreHostApiFlyToResponse* maplibre_map_libre_host_api_fly_to_response_new() { + MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_fly_to_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiFlyToResponse* maplibre_map_libre_host_api_fly_to_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiFlyToResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_FLY_TO_RESPONSE(g_object_new(maplibre_map_libre_host_api_fly_to_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetCameraResponse, maplibre_map_libre_host_api_get_camera_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiGetCameraResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiGetCameraResponse, maplibre_map_libre_host_api_get_camera_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_get_camera_response_dispose(GObject* object) { + MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_get_camera_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_get_camera_response_init(MaplibreMapLibreHostApiGetCameraResponse* self) { +} + +static void maplibre_map_libre_host_api_get_camera_response_class_init(MaplibreMapLibreHostApiGetCameraResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_camera_response_dispose; +} + +static MaplibreMapLibreHostApiGetCameraResponse* maplibre_map_libre_host_api_get_camera_response_new(MaplibreMapCamera* return_value) { + MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_camera_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_custom_object(134, G_OBJECT(return_value))); + return self; +} + +static MaplibreMapLibreHostApiGetCameraResponse* maplibre_map_libre_host_api_get_camera_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_camera_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetVisibleRegionResponse, maplibre_map_libre_host_api_get_visible_region_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiGetVisibleRegionResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiGetVisibleRegionResponse, maplibre_map_libre_host_api_get_visible_region_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_get_visible_region_response_dispose(GObject* object) { + MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_get_visible_region_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_get_visible_region_response_init(MaplibreMapLibreHostApiGetVisibleRegionResponse* self) { +} + +static void maplibre_map_libre_host_api_get_visible_region_response_class_init(MaplibreMapLibreHostApiGetVisibleRegionResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_visible_region_response_dispose; +} + +static MaplibreMapLibreHostApiGetVisibleRegionResponse* maplibre_map_libre_host_api_get_visible_region_response_new(MaplibreLngLatBounds* return_value) { + MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_visible_region_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_custom_object(135, G_OBJECT(return_value))); + return self; +} + +static MaplibreMapLibreHostApiGetVisibleRegionResponse* maplibre_map_libre_host_api_get_visible_region_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_visible_region_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiToScreenLocationResponse, maplibre_map_libre_host_api_to_screen_location_response, MAPLIBRE, MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiToScreenLocationResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiToScreenLocationResponse, maplibre_map_libre_host_api_to_screen_location_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_to_screen_location_response_dispose(GObject* object) { + MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_to_screen_location_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_to_screen_location_response_init(MaplibreMapLibreHostApiToScreenLocationResponse* self) { +} + +static void maplibre_map_libre_host_api_to_screen_location_response_class_init(MaplibreMapLibreHostApiToScreenLocationResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_to_screen_location_response_dispose; +} + +static MaplibreMapLibreHostApiToScreenLocationResponse* maplibre_map_libre_host_api_to_screen_location_response_new(MaplibreScreenLocation* return_value) { + MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_screen_location_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_custom_object(133, G_OBJECT(return_value))); + return self; +} + +static MaplibreMapLibreHostApiToScreenLocationResponse* maplibre_map_libre_host_api_to_screen_location_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_screen_location_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiToLngLatResponse, maplibre_map_libre_host_api_to_lng_lat_response, MAPLIBRE, MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiToLngLatResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiToLngLatResponse, maplibre_map_libre_host_api_to_lng_lat_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_to_lng_lat_response_dispose(GObject* object) { + MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_to_lng_lat_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_to_lng_lat_response_init(MaplibreMapLibreHostApiToLngLatResponse* self) { +} + +static void maplibre_map_libre_host_api_to_lng_lat_response_class_init(MaplibreMapLibreHostApiToLngLatResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_to_lng_lat_response_dispose; +} + +static MaplibreMapLibreHostApiToLngLatResponse* maplibre_map_libre_host_api_to_lng_lat_response_new(MaplibreLngLat* return_value) { + MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_lng_lat_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_custom_object(132, G_OBJECT(return_value))); + return self; +} + +static MaplibreMapLibreHostApiToLngLatResponse* maplibre_map_libre_host_api_to_lng_lat_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_lng_lat_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddFillLayerResponse, maplibre_map_libre_host_api_add_fill_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddFillLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddFillLayerResponse, maplibre_map_libre_host_api_add_fill_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_fill_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_fill_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_fill_layer_response_init(MaplibreMapLibreHostApiAddFillLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_fill_layer_response_class_init(MaplibreMapLibreHostApiAddFillLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_fill_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddFillLayerResponse* maplibre_map_libre_host_api_add_fill_layer_response_new() { + MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddFillLayerResponse* maplibre_map_libre_host_api_add_fill_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddFillLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddCircleLayerResponse, maplibre_map_libre_host_api_add_circle_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddCircleLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddCircleLayerResponse, maplibre_map_libre_host_api_add_circle_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_circle_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_circle_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_circle_layer_response_init(MaplibreMapLibreHostApiAddCircleLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_circle_layer_response_class_init(MaplibreMapLibreHostApiAddCircleLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_circle_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddCircleLayerResponse* maplibre_map_libre_host_api_add_circle_layer_response_new() { + MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_circle_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddCircleLayerResponse* maplibre_map_libre_host_api_add_circle_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddCircleLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_CIRCLE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_circle_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddBackgroundLayerResponse, maplibre_map_libre_host_api_add_background_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddBackgroundLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddBackgroundLayerResponse, maplibre_map_libre_host_api_add_background_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_background_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_background_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_background_layer_response_init(MaplibreMapLibreHostApiAddBackgroundLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_background_layer_response_class_init(MaplibreMapLibreHostApiAddBackgroundLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_background_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddBackgroundLayerResponse* maplibre_map_libre_host_api_add_background_layer_response_new() { + MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_background_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddBackgroundLayerResponse* maplibre_map_libre_host_api_add_background_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddBackgroundLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_BACKGROUND_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_background_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse, maplibre_map_libre_host_api_add_fill_extrusion_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddFillExtrusionLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse, maplibre_map_libre_host_api_add_fill_extrusion_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_init(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_fill_extrusion_layer_response_class_init(MaplibreMapLibreHostApiAddFillExtrusionLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new() { + MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddFillExtrusionLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_FILL_EXTRUSION_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_fill_extrusion_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddHeatmapLayerResponse, maplibre_map_libre_host_api_add_heatmap_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddHeatmapLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddHeatmapLayerResponse, maplibre_map_libre_host_api_add_heatmap_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_heatmap_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_heatmap_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_heatmap_layer_response_init(MaplibreMapLibreHostApiAddHeatmapLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_heatmap_layer_response_class_init(MaplibreMapLibreHostApiAddHeatmapLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_heatmap_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddHeatmapLayerResponse* maplibre_map_libre_host_api_add_heatmap_layer_response_new() { + MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_heatmap_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddHeatmapLayerResponse* maplibre_map_libre_host_api_add_heatmap_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddHeatmapLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HEATMAP_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_heatmap_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddHillshadeLayerResponse, maplibre_map_libre_host_api_add_hillshade_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddHillshadeLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddHillshadeLayerResponse, maplibre_map_libre_host_api_add_hillshade_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_hillshade_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_hillshade_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_hillshade_layer_response_init(MaplibreMapLibreHostApiAddHillshadeLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_hillshade_layer_response_class_init(MaplibreMapLibreHostApiAddHillshadeLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_hillshade_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddHillshadeLayerResponse* maplibre_map_libre_host_api_add_hillshade_layer_response_new() { + MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_hillshade_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddHillshadeLayerResponse* maplibre_map_libre_host_api_add_hillshade_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddHillshadeLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_HILLSHADE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_hillshade_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddLineLayerResponse, maplibre_map_libre_host_api_add_line_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddLineLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddLineLayerResponse, maplibre_map_libre_host_api_add_line_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_line_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_line_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_line_layer_response_init(MaplibreMapLibreHostApiAddLineLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_line_layer_response_class_init(MaplibreMapLibreHostApiAddLineLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_line_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddLineLayerResponse* maplibre_map_libre_host_api_add_line_layer_response_new() { + MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_line_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddLineLayerResponse* maplibre_map_libre_host_api_add_line_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddLineLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_LINE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_line_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterLayerResponse, maplibre_map_libre_host_api_add_raster_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddRasterLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterLayerResponse, maplibre_map_libre_host_api_add_raster_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_raster_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_raster_layer_response_init(MaplibreMapLibreHostApiAddRasterLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_raster_layer_response_class_init(MaplibreMapLibreHostApiAddRasterLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddRasterLayerResponse* maplibre_map_libre_host_api_add_raster_layer_response_new() { + MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddRasterLayerResponse* maplibre_map_libre_host_api_add_raster_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddRasterLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddSymbolLayerResponse, maplibre_map_libre_host_api_add_symbol_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddSymbolLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddSymbolLayerResponse, maplibre_map_libre_host_api_add_symbol_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_symbol_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_symbol_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_symbol_layer_response_init(MaplibreMapLibreHostApiAddSymbolLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_add_symbol_layer_response_class_init(MaplibreMapLibreHostApiAddSymbolLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_symbol_layer_response_dispose; +} + +static MaplibreMapLibreHostApiAddSymbolLayerResponse* maplibre_map_libre_host_api_add_symbol_layer_response_new() { + MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_symbol_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddSymbolLayerResponse* maplibre_map_libre_host_api_add_symbol_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddSymbolLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_SYMBOL_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_symbol_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveLayerResponse, maplibre_map_libre_host_api_remove_layer_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiRemoveLayerResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveLayerResponse, maplibre_map_libre_host_api_remove_layer_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_remove_layer_response_dispose(GObject* object) { + MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_layer_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_remove_layer_response_init(MaplibreMapLibreHostApiRemoveLayerResponse* self) { +} + +static void maplibre_map_libre_host_api_remove_layer_response_class_init(MaplibreMapLibreHostApiRemoveLayerResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_layer_response_dispose; +} + +static MaplibreMapLibreHostApiRemoveLayerResponse* maplibre_map_libre_host_api_remove_layer_response_new() { + MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiRemoveLayerResponse* maplibre_map_libre_host_api_remove_layer_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiRemoveLayerResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_LAYER_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_layer_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveSourceResponse, maplibre_map_libre_host_api_remove_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiRemoveSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveSourceResponse, maplibre_map_libre_host_api_remove_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_remove_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_remove_source_response_init(MaplibreMapLibreHostApiRemoveSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_remove_source_response_class_init(MaplibreMapLibreHostApiRemoveSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_source_response_dispose; +} + +static MaplibreMapLibreHostApiRemoveSourceResponse* maplibre_map_libre_host_api_remove_source_response_new() { + MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiRemoveSourceResponse* maplibre_map_libre_host_api_remove_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiRemoveSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiLoadImageResponse, maplibre_map_libre_host_api_load_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiLoadImageResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiLoadImageResponse, maplibre_map_libre_host_api_load_image_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_load_image_response_dispose(GObject* object) { + MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_load_image_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_load_image_response_init(MaplibreMapLibreHostApiLoadImageResponse* self) { +} + +static void maplibre_map_libre_host_api_load_image_response_class_init(MaplibreMapLibreHostApiLoadImageResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_load_image_response_dispose; +} + +static MaplibreMapLibreHostApiLoadImageResponse* maplibre_map_libre_host_api_load_image_response_new(const uint8_t* return_value, size_t return_value_length) { + MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_load_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_uint8_list(return_value, return_value_length)); + return self; +} + +static MaplibreMapLibreHostApiLoadImageResponse* maplibre_map_libre_host_api_load_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiLoadImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_LOAD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_load_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddImageResponse, maplibre_map_libre_host_api_add_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddImageResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddImageResponse, maplibre_map_libre_host_api_add_image_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_image_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_image_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_image_response_init(MaplibreMapLibreHostApiAddImageResponse* self) { +} + +static void maplibre_map_libre_host_api_add_image_response_class_init(MaplibreMapLibreHostApiAddImageResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_image_response_dispose; +} + +static MaplibreMapLibreHostApiAddImageResponse* maplibre_map_libre_host_api_add_image_response_new() { + MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddImageResponse* maplibre_map_libre_host_api_add_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiRemoveImageResponse, maplibre_map_libre_host_api_remove_image_response, MAPLIBRE, MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiRemoveImageResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiRemoveImageResponse, maplibre_map_libre_host_api_remove_image_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_remove_image_response_dispose(GObject* object) { + MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_remove_image_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_remove_image_response_init(MaplibreMapLibreHostApiRemoveImageResponse* self) { +} + +static void maplibre_map_libre_host_api_remove_image_response_class_init(MaplibreMapLibreHostApiRemoveImageResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_remove_image_response_dispose; +} + +static MaplibreMapLibreHostApiRemoveImageResponse* maplibre_map_libre_host_api_remove_image_response_new() { + MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiRemoveImageResponse* maplibre_map_libre_host_api_remove_image_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiRemoveImageResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_REMOVE_IMAGE_RESPONSE(g_object_new(maplibre_map_libre_host_api_remove_image_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddGeoJsonSourceResponse, maplibre_map_libre_host_api_add_geo_json_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddGeoJsonSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddGeoJsonSourceResponse, maplibre_map_libre_host_api_add_geo_json_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_geo_json_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_geo_json_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_geo_json_source_response_init(MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_add_geo_json_source_response_class_init(MaplibreMapLibreHostApiAddGeoJsonSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_geo_json_source_response_dispose; +} + +static MaplibreMapLibreHostApiAddGeoJsonSourceResponse* maplibre_map_libre_host_api_add_geo_json_source_response_new() { + MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_geo_json_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddGeoJsonSourceResponse* maplibre_map_libre_host_api_add_geo_json_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_geo_json_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse, maplibre_map_libre_host_api_update_geo_json_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse, maplibre_map_libre_host_api_update_geo_json_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_update_geo_json_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_update_geo_json_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_update_geo_json_source_response_init(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_update_geo_json_source_response_class_init(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_update_geo_json_source_response_dispose; +} + +static MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* maplibre_map_libre_host_api_update_geo_json_source_response_new() { + MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_geo_json_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* maplibre_map_libre_host_api_update_geo_json_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_GEO_JSON_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_geo_json_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddImageSourceResponse, maplibre_map_libre_host_api_add_image_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddImageSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddImageSourceResponse, maplibre_map_libre_host_api_add_image_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_image_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_image_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_image_source_response_init(MaplibreMapLibreHostApiAddImageSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_add_image_source_response_class_init(MaplibreMapLibreHostApiAddImageSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_image_source_response_dispose; +} + +static MaplibreMapLibreHostApiAddImageSourceResponse* maplibre_map_libre_host_api_add_image_source_response_new() { + MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddImageSourceResponse* maplibre_map_libre_host_api_add_image_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddImageSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_IMAGE_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_image_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterSourceResponse, maplibre_map_libre_host_api_add_raster_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddRasterSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterSourceResponse, maplibre_map_libre_host_api_add_raster_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_raster_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_raster_source_response_init(MaplibreMapLibreHostApiAddRasterSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_add_raster_source_response_class_init(MaplibreMapLibreHostApiAddRasterSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_source_response_dispose; +} + +static MaplibreMapLibreHostApiAddRasterSourceResponse* maplibre_map_libre_host_api_add_raster_source_response_new() { + MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddRasterSourceResponse* maplibre_map_libre_host_api_add_raster_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddRasterSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddRasterDemSourceResponse, maplibre_map_libre_host_api_add_raster_dem_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddRasterDemSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddRasterDemSourceResponse, maplibre_map_libre_host_api_add_raster_dem_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_raster_dem_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_raster_dem_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_raster_dem_source_response_init(MaplibreMapLibreHostApiAddRasterDemSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_add_raster_dem_source_response_class_init(MaplibreMapLibreHostApiAddRasterDemSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_raster_dem_source_response_dispose; +} + +static MaplibreMapLibreHostApiAddRasterDemSourceResponse* maplibre_map_libre_host_api_add_raster_dem_source_response_new() { + MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_dem_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddRasterDemSourceResponse* maplibre_map_libre_host_api_add_raster_dem_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddRasterDemSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_RASTER_DEM_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_raster_dem_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiAddVectorSourceResponse, maplibre_map_libre_host_api_add_vector_source_response, MAPLIBRE, MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiAddVectorSourceResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiAddVectorSourceResponse, maplibre_map_libre_host_api_add_vector_source_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_add_vector_source_response_dispose(GObject* object) { + MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_add_vector_source_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_add_vector_source_response_init(MaplibreMapLibreHostApiAddVectorSourceResponse* self) { +} + +static void maplibre_map_libre_host_api_add_vector_source_response_class_init(MaplibreMapLibreHostApiAddVectorSourceResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_add_vector_source_response_dispose; +} + +static MaplibreMapLibreHostApiAddVectorSourceResponse* maplibre_map_libre_host_api_add_vector_source_response_new() { + MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_vector_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiAddVectorSourceResponse* maplibre_map_libre_host_api_add_vector_source_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiAddVectorSourceResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_ADD_VECTOR_SOURCE_RESPONSE(g_object_new(maplibre_map_libre_host_api_add_vector_source_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +struct _MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_dispose(GObject* object) { + MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_init(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self) { +} + +static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_class_init(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_dispose; +} + +MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new(double return_value) { + MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_float(return_value)); + return self; +} + +MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiUpdateOptionsResponse, maplibre_map_libre_host_api_update_options_response, MAPLIBRE, MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE, GObject) + +struct _MaplibreMapLibreHostApiUpdateOptionsResponse { + GObject parent_instance; + + FlValue* value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApiUpdateOptionsResponse, maplibre_map_libre_host_api_update_options_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_update_options_response_dispose(GObject* object) { + MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(object); + g_clear_pointer(&self->value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_host_api_update_options_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_update_options_response_init(MaplibreMapLibreHostApiUpdateOptionsResponse* self) { +} + +static void maplibre_map_libre_host_api_update_options_response_class_init(MaplibreMapLibreHostApiUpdateOptionsResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_update_options_response_dispose; +} + +static MaplibreMapLibreHostApiUpdateOptionsResponse* maplibre_map_libre_host_api_update_options_response_new() { + MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_options_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_null()); + return self; +} + +static MaplibreMapLibreHostApiUpdateOptionsResponse* maplibre_map_libre_host_api_update_options_response_new_error(const gchar* code, const gchar* message, FlValue* details) { + MaplibreMapLibreHostApiUpdateOptionsResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_UPDATE_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_host_api_update_options_response_get_type(), nullptr)); + self->value = fl_value_new_list(); + fl_value_append_take(self->value, fl_value_new_string(code)); + fl_value_append_take(self->value, fl_value_new_string(message != nullptr ? message : "")); + fl_value_append_take(self->value, details != nullptr ? fl_value_ref(details) : fl_value_new_null()); + return self; +} + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApi, maplibre_map_libre_host_api, MAPLIBRE, MAP_LIBRE_HOST_API, GObject) + +struct _MaplibreMapLibreHostApi { + GObject parent_instance; + + const MaplibreMapLibreHostApiVTable* vtable; + gpointer user_data; + GDestroyNotify user_data_free_func; +}; + +G_DEFINE_TYPE(MaplibreMapLibreHostApi, maplibre_map_libre_host_api, G_TYPE_OBJECT) + +static void maplibre_map_libre_host_api_dispose(GObject* object) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(object); + if (self->user_data != nullptr) { + self->user_data_free_func(self->user_data); + } + self->user_data = nullptr; + G_OBJECT_CLASS(maplibre_map_libre_host_api_parent_class)->dispose(object); +} + +static void maplibre_map_libre_host_api_init(MaplibreMapLibreHostApi* self) { +} + +static void maplibre_map_libre_host_api_class_init(MaplibreMapLibreHostApiClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_host_api_dispose; +} + +static MaplibreMapLibreHostApi* maplibre_map_libre_host_api_new(const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(g_object_new(maplibre_map_libre_host_api_get_type(), nullptr)); + self->vtable = vtable; + self->user_data = user_data; + self->user_data_free_func = user_data_free_func; + return self; +} + +static void maplibre_map_libre_host_api_jump_to_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->jump_to == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + MaplibreLngLat* center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value0)); + FlValue* value1 = fl_value_get_list_value(message_, 1); + double* zoom = nullptr; + double zoom_value; + if (fl_value_get_type(value1) != FL_VALUE_TYPE_NULL) { + zoom_value = fl_value_get_float(value1); + zoom = &zoom_value; + } + FlValue* value2 = fl_value_get_list_value(message_, 2); + double* bearing = nullptr; + double bearing_value; + if (fl_value_get_type(value2) != FL_VALUE_TYPE_NULL) { + bearing_value = fl_value_get_float(value2); + bearing = &bearing_value; + } + FlValue* value3 = fl_value_get_list_value(message_, 3); + double* pitch = nullptr; + double pitch_value; + if (fl_value_get_type(value3) != FL_VALUE_TYPE_NULL) { + pitch_value = fl_value_get_float(value3); + pitch = &pitch_value; + } + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->jump_to(center, zoom, bearing, pitch, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_fly_to_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->fly_to == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + MaplibreLngLat* center = MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value0)); + FlValue* value1 = fl_value_get_list_value(message_, 1); + double* zoom = nullptr; + double zoom_value; + if (fl_value_get_type(value1) != FL_VALUE_TYPE_NULL) { + zoom_value = fl_value_get_float(value1); + zoom = &zoom_value; + } + FlValue* value2 = fl_value_get_list_value(message_, 2); + double* bearing = nullptr; + double bearing_value; + if (fl_value_get_type(value2) != FL_VALUE_TYPE_NULL) { + bearing_value = fl_value_get_float(value2); + bearing = &bearing_value; + } + FlValue* value3 = fl_value_get_list_value(message_, 3); + double* pitch = nullptr; + double pitch_value; + if (fl_value_get_type(value3) != FL_VALUE_TYPE_NULL) { + pitch_value = fl_value_get_float(value3); + pitch = &pitch_value; + } + FlValue* value4 = fl_value_get_list_value(message_, 4); + int64_t duration_ms = fl_value_get_int(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->fly_to(center, zoom, bearing, pitch, duration_ms, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_get_camera_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->get_camera == nullptr) { + return; + } + + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->get_camera(handle, self->user_data); +} + +static void maplibre_map_libre_host_api_get_visible_region_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->get_visible_region == nullptr) { + return; + } + + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->get_visible_region(handle, self->user_data); +} + +static void maplibre_map_libre_host_api_to_screen_location_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->to_screen_location == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + double lng = fl_value_get_float(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + double lat = fl_value_get_float(value1); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->to_screen_location(lng, lat, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_to_lng_lat_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->to_lng_lat == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + double x = fl_value_get_float(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + double y = fl_value_get_float(value1); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->to_lng_lat(x, y, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_fill_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_fill_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_fill_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_circle_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_circle_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_circle_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_background_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_background_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + FlValue* layout = value1; + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* paint = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + const gchar* below_layer_id = fl_value_get_string(value3); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_background_layer(id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_fill_extrusion_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_fill_extrusion_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_fill_extrusion_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_heatmap_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_heatmap_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_heatmap_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_hillshade_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_hillshade_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_hillshade_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_line_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_line_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_line_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_raster_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_raster_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_raster_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_symbol_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_symbol_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* source_id = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* layout = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* paint = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + const gchar* below_layer_id = fl_value_get_string(value4); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_symbol_layer(id, source_id, layout, paint, below_layer_id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_remove_layer_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->remove_layer == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->remove_layer(id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_remove_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->remove_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->remove_source(id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_load_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->load_image == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* url = fl_value_get_string(value0); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->load_image(url, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_image == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const uint8_t* bytes = fl_value_get_uint8_list(value1); + size_t bytes_length = fl_value_get_length(value1); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_image(id, bytes, bytes_length, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_remove_image_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->remove_image == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->remove_image(id, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_geo_json_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_geo_json_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* data = fl_value_get_string(value1); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_geo_json_source(id, data, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_update_geo_json_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->update_geo_json_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* data = fl_value_get_string(value1); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->update_geo_json_source(id, data, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_image_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_image_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* url = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* coordinates = value2; + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_image_source(id, url, coordinates, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_raster_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_raster_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* url = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* tiles = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* bounds = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + double min_zoom = fl_value_get_float(value4); + FlValue* value5 = fl_value_get_list_value(message_, 5); + double max_zoom = fl_value_get_float(value5); + FlValue* value6 = fl_value_get_list_value(message_, 6); + int64_t tile_size = fl_value_get_int(value6); + FlValue* value7 = fl_value_get_list_value(message_, 7); + MaplibreTileScheme scheme = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value7))))); + FlValue* value8 = fl_value_get_list_value(message_, 8); + const gchar* attribution = fl_value_get_string(value8); + FlValue* value9 = fl_value_get_list_value(message_, 9); + gboolean volatile = fl_value_get_bool(value9); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_raster_source(id, url, tiles, bounds, min_zoom, max_zoom, tile_size, scheme, attribution, volatile, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_raster_dem_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_raster_dem_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* url = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* tiles = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* bounds = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + double min_zoom = fl_value_get_float(value4); + FlValue* value5 = fl_value_get_list_value(message_, 5); + double max_zoom = fl_value_get_float(value5); + FlValue* value6 = fl_value_get_list_value(message_, 6); + int64_t tile_size = fl_value_get_int(value6); + FlValue* value7 = fl_value_get_list_value(message_, 7); + const gchar* attribution = fl_value_get_string(value7); + FlValue* value8 = fl_value_get_list_value(message_, 8); + MaplibreRasterDemEncoding encoding = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value8))))); + FlValue* value9 = fl_value_get_list_value(message_, 9); + gboolean volatile = fl_value_get_bool(value9); + FlValue* value10 = fl_value_get_list_value(message_, 10); + double red_factor = fl_value_get_float(value10); + FlValue* value11 = fl_value_get_list_value(message_, 11); + double blue_factor = fl_value_get_float(value11); + FlValue* value12 = fl_value_get_list_value(message_, 12); + double green_factor = fl_value_get_float(value12); + FlValue* value13 = fl_value_get_list_value(message_, 13); + double base_shift = fl_value_get_float(value13); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_raster_dem_source(id, url, tiles, bounds, min_zoom, max_zoom, tile_size, attribution, encoding, volatile, red_factor, blue_factor, green_factor, base_shift, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_add_vector_source_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->add_vector_source == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + const gchar* id = fl_value_get_string(value0); + FlValue* value1 = fl_value_get_list_value(message_, 1); + const gchar* url = fl_value_get_string(value1); + FlValue* value2 = fl_value_get_list_value(message_, 2); + FlValue* tiles = value2; + FlValue* value3 = fl_value_get_list_value(message_, 3); + FlValue* bounds = value3; + FlValue* value4 = fl_value_get_list_value(message_, 4); + MaplibreTileScheme scheme = static_cast(fl_value_get_int(reinterpret_cast(const_cast(fl_value_get_custom_value(value4))))); + FlValue* value5 = fl_value_get_list_value(message_, 5); + double min_zoom = fl_value_get_float(value5); + FlValue* value6 = fl_value_get_list_value(message_, 6); + double max_zoom = fl_value_get_float(value6); + FlValue* value7 = fl_value_get_list_value(message_, 7); + const gchar* attribution = fl_value_get_string(value7); + FlValue* value8 = fl_value_get_list_value(message_, 8); + gboolean volatile = fl_value_get_bool(value8); + FlValue* value9 = fl_value_get_list_value(message_, 9); + const gchar* source_layer = fl_value_get_string(value9); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->add_vector_source(id, url, tiles, bounds, scheme, min_zoom, max_zoom, attribution, volatile, source_layer, handle, self->user_data); +} + +static void maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->get_meters_per_pixel_at_latitude == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + double latitude = fl_value_get_float(value0); + g_autoptr(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse) response = self->vtable->get_meters_per_pixel_at_latitude(latitude, self->user_data); + if (response == nullptr) { + g_warning("No response returned to %s.%s", "MapLibreHostApi", "getMetersPerPixelAtLatitude"); + return; + } + + g_autoptr(GError) error = NULL; + if (!fl_basic_message_channel_respond(channel, response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getMetersPerPixelAtLatitude", error->message); + } +} + +static void maplibre_map_libre_host_api_update_options_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) { + MaplibreMapLibreHostApi* self = MAPLIBRE_MAP_LIBRE_HOST_API(user_data); + + if (self->vtable == nullptr || self->vtable->update_options == nullptr) { + return; + } + + FlValue* value0 = fl_value_get_list_value(message_, 0); + MaplibreMapOptions* options = MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value0)); + g_autoptr(MaplibreMapLibreHostApiResponseHandle) handle = maplibre_map_libre_host_api_response_handle_new(channel, response_handle); + self->vtable->update_options(options, handle, self->user_data); +} + +void maplibre_map_libre_host_api_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func) { + g_autofree gchar* dot_suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); + g_autoptr(MaplibreMapLibreHostApi) api_data = maplibre_map_libre_host_api_new(vtable, user_data, user_data_free_func); + + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + g_autofree gchar* jump_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) jump_to_channel = fl_basic_message_channel_new(messenger, jump_to_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(jump_to_channel, maplibre_map_libre_host_api_jump_to_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* fly_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) fly_to_channel = fl_basic_message_channel_new(messenger, fly_to_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(fly_to_channel, maplibre_map_libre_host_api_fly_to_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* get_camera_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_camera_channel = fl_basic_message_channel_new(messenger, get_camera_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_camera_channel, maplibre_map_libre_host_api_get_camera_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* get_visible_region_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_visible_region_channel = fl_basic_message_channel_new(messenger, get_visible_region_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_visible_region_channel, maplibre_map_libre_host_api_get_visible_region_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* to_screen_location_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) to_screen_location_channel = fl_basic_message_channel_new(messenger, to_screen_location_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(to_screen_location_channel, maplibre_map_libre_host_api_to_screen_location_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* to_lng_lat_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) to_lng_lat_channel = fl_basic_message_channel_new(messenger, to_lng_lat_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(to_lng_lat_channel, maplibre_map_libre_host_api_to_lng_lat_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_fill_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_fill_layer_channel = fl_basic_message_channel_new(messenger, add_fill_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_fill_layer_channel, maplibre_map_libre_host_api_add_fill_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_circle_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_circle_layer_channel = fl_basic_message_channel_new(messenger, add_circle_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_circle_layer_channel, maplibre_map_libre_host_api_add_circle_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_background_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_background_layer_channel = fl_basic_message_channel_new(messenger, add_background_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_background_layer_channel, maplibre_map_libre_host_api_add_background_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_fill_extrusion_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_fill_extrusion_layer_channel = fl_basic_message_channel_new(messenger, add_fill_extrusion_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_fill_extrusion_layer_channel, maplibre_map_libre_host_api_add_fill_extrusion_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_heatmap_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_heatmap_layer_channel = fl_basic_message_channel_new(messenger, add_heatmap_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_heatmap_layer_channel, maplibre_map_libre_host_api_add_heatmap_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_hillshade_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_hillshade_layer_channel = fl_basic_message_channel_new(messenger, add_hillshade_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_hillshade_layer_channel, maplibre_map_libre_host_api_add_hillshade_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_line_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_line_layer_channel = fl_basic_message_channel_new(messenger, add_line_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_line_layer_channel, maplibre_map_libre_host_api_add_line_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_raster_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_layer_channel = fl_basic_message_channel_new(messenger, add_raster_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_layer_channel, maplibre_map_libre_host_api_add_raster_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_symbol_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_symbol_layer_channel = fl_basic_message_channel_new(messenger, add_symbol_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_symbol_layer_channel, maplibre_map_libre_host_api_add_symbol_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* remove_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_layer_channel = fl_basic_message_channel_new(messenger, remove_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_layer_channel, maplibre_map_libre_host_api_remove_layer_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* remove_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_source_channel = fl_basic_message_channel_new(messenger, remove_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_source_channel, maplibre_map_libre_host_api_remove_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* load_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) load_image_channel = fl_basic_message_channel_new(messenger, load_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(load_image_channel, maplibre_map_libre_host_api_load_image_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_image_channel = fl_basic_message_channel_new(messenger, add_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_image_channel, maplibre_map_libre_host_api_add_image_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* remove_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_image_channel = fl_basic_message_channel_new(messenger, remove_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_image_channel, maplibre_map_libre_host_api_remove_image_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_geo_json_source_channel = fl_basic_message_channel_new(messenger, add_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_geo_json_source_channel, maplibre_map_libre_host_api_add_geo_json_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* update_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) update_geo_json_source_channel = fl_basic_message_channel_new(messenger, update_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(update_geo_json_source_channel, maplibre_map_libre_host_api_update_geo_json_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_image_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_image_source_channel = fl_basic_message_channel_new(messenger, add_image_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_image_source_channel, maplibre_map_libre_host_api_add_image_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_raster_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_source_channel = fl_basic_message_channel_new(messenger, add_raster_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_source_channel, maplibre_map_libre_host_api_add_raster_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_raster_dem_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_dem_source_channel = fl_basic_message_channel_new(messenger, add_raster_dem_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_dem_source_channel, maplibre_map_libre_host_api_add_raster_dem_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* add_vector_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_vector_source_channel = fl_basic_message_channel_new(messenger, add_vector_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_vector_source_channel, maplibre_map_libre_host_api_add_vector_source_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* get_meters_per_pixel_at_latitude_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_meters_per_pixel_at_latitude_channel = fl_basic_message_channel_new(messenger, get_meters_per_pixel_at_latitude_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_meters_per_pixel_at_latitude_channel, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_cb, g_object_ref(api_data), g_object_unref); + g_autofree gchar* update_options_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) update_options_channel = fl_basic_message_channel_new(messenger, update_options_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(update_options_channel, maplibre_map_libre_host_api_update_options_cb, g_object_ref(api_data), g_object_unref); +} + +void maplibre_map_libre_host_api_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) { + g_autofree gchar* dot_suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); + + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + g_autofree gchar* jump_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) jump_to_channel = fl_basic_message_channel_new(messenger, jump_to_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(jump_to_channel, nullptr, nullptr, nullptr); + g_autofree gchar* fly_to_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) fly_to_channel = fl_basic_message_channel_new(messenger, fly_to_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(fly_to_channel, nullptr, nullptr, nullptr); + g_autofree gchar* get_camera_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_camera_channel = fl_basic_message_channel_new(messenger, get_camera_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_camera_channel, nullptr, nullptr, nullptr); + g_autofree gchar* get_visible_region_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_visible_region_channel = fl_basic_message_channel_new(messenger, get_visible_region_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_visible_region_channel, nullptr, nullptr, nullptr); + g_autofree gchar* to_screen_location_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) to_screen_location_channel = fl_basic_message_channel_new(messenger, to_screen_location_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(to_screen_location_channel, nullptr, nullptr, nullptr); + g_autofree gchar* to_lng_lat_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) to_lng_lat_channel = fl_basic_message_channel_new(messenger, to_lng_lat_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(to_lng_lat_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_fill_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_fill_layer_channel = fl_basic_message_channel_new(messenger, add_fill_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_fill_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_circle_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_circle_layer_channel = fl_basic_message_channel_new(messenger, add_circle_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_circle_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_background_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_background_layer_channel = fl_basic_message_channel_new(messenger, add_background_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_background_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_fill_extrusion_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_fill_extrusion_layer_channel = fl_basic_message_channel_new(messenger, add_fill_extrusion_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_fill_extrusion_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_heatmap_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_heatmap_layer_channel = fl_basic_message_channel_new(messenger, add_heatmap_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_heatmap_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_hillshade_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_hillshade_layer_channel = fl_basic_message_channel_new(messenger, add_hillshade_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_hillshade_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_line_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_line_layer_channel = fl_basic_message_channel_new(messenger, add_line_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_line_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_raster_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_layer_channel = fl_basic_message_channel_new(messenger, add_raster_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_symbol_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_symbol_layer_channel = fl_basic_message_channel_new(messenger, add_symbol_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_symbol_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* remove_layer_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_layer_channel = fl_basic_message_channel_new(messenger, remove_layer_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_layer_channel, nullptr, nullptr, nullptr); + g_autofree gchar* remove_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_source_channel = fl_basic_message_channel_new(messenger, remove_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* load_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) load_image_channel = fl_basic_message_channel_new(messenger, load_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(load_image_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_image_channel = fl_basic_message_channel_new(messenger, add_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_image_channel, nullptr, nullptr, nullptr); + g_autofree gchar* remove_image_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) remove_image_channel = fl_basic_message_channel_new(messenger, remove_image_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(remove_image_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_geo_json_source_channel = fl_basic_message_channel_new(messenger, add_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_geo_json_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* update_geo_json_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) update_geo_json_source_channel = fl_basic_message_channel_new(messenger, update_geo_json_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(update_geo_json_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_image_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_image_source_channel = fl_basic_message_channel_new(messenger, add_image_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_image_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_raster_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_source_channel = fl_basic_message_channel_new(messenger, add_raster_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_raster_dem_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_raster_dem_source_channel = fl_basic_message_channel_new(messenger, add_raster_dem_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_raster_dem_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* add_vector_source_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) add_vector_source_channel = fl_basic_message_channel_new(messenger, add_vector_source_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(add_vector_source_channel, nullptr, nullptr, nullptr); + g_autofree gchar* get_meters_per_pixel_at_latitude_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) get_meters_per_pixel_at_latitude_channel = fl_basic_message_channel_new(messenger, get_meters_per_pixel_at_latitude_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(get_meters_per_pixel_at_latitude_channel, nullptr, nullptr, nullptr); + g_autofree gchar* update_options_channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions%s", dot_suffix); + g_autoptr(FlBasicMessageChannel) update_options_channel = fl_basic_message_channel_new(messenger, update_options_channel_name, FL_MESSAGE_CODEC(codec)); + fl_basic_message_channel_set_message_handler(update_options_channel, nullptr, nullptr, nullptr); +} + +void maplibre_map_libre_host_api_respond_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiJumpToResponse) response = maplibre_map_libre_host_api_jump_to_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "jumpTo", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiJumpToResponse) response = maplibre_map_libre_host_api_jump_to_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "jumpTo", error->message); + } +} + +void maplibre_map_libre_host_api_respond_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiFlyToResponse) response = maplibre_map_libre_host_api_fly_to_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "flyTo", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiFlyToResponse) response = maplibre_map_libre_host_api_fly_to_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "flyTo", error->message); + } +} + +void maplibre_map_libre_host_api_respond_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreMapCamera* return_value) { + g_autoptr(MaplibreMapLibreHostApiGetCameraResponse) response = maplibre_map_libre_host_api_get_camera_response_new(return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getCamera", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiGetCameraResponse) response = maplibre_map_libre_host_api_get_camera_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getCamera", error->message); + } +} + +void maplibre_map_libre_host_api_respond_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLatBounds* return_value) { + g_autoptr(MaplibreMapLibreHostApiGetVisibleRegionResponse) response = maplibre_map_libre_host_api_get_visible_region_response_new(return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getVisibleRegion", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiGetVisibleRegionResponse) response = maplibre_map_libre_host_api_get_visible_region_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "getVisibleRegion", error->message); + } +} + +void maplibre_map_libre_host_api_respond_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreScreenLocation* return_value) { + g_autoptr(MaplibreMapLibreHostApiToScreenLocationResponse) response = maplibre_map_libre_host_api_to_screen_location_response_new(return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toScreenLocation", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiToScreenLocationResponse) response = maplibre_map_libre_host_api_to_screen_location_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toScreenLocation", error->message); + } +} + +void maplibre_map_libre_host_api_respond_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLat* return_value) { + g_autoptr(MaplibreMapLibreHostApiToLngLatResponse) response = maplibre_map_libre_host_api_to_lng_lat_response_new(return_value); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toLngLat", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiToLngLatResponse) response = maplibre_map_libre_host_api_to_lng_lat_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "toLngLat", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddFillLayerResponse) response = maplibre_map_libre_host_api_add_fill_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddFillLayerResponse) response = maplibre_map_libre_host_api_add_fill_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddCircleLayerResponse) response = maplibre_map_libre_host_api_add_circle_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addCircleLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddCircleLayerResponse) response = maplibre_map_libre_host_api_add_circle_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addCircleLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddBackgroundLayerResponse) response = maplibre_map_libre_host_api_add_background_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addBackgroundLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddBackgroundLayerResponse) response = maplibre_map_libre_host_api_add_background_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addBackgroundLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse) response = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillExtrusionLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddFillExtrusionLayerResponse) response = maplibre_map_libre_host_api_add_fill_extrusion_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addFillExtrusionLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddHeatmapLayerResponse) response = maplibre_map_libre_host_api_add_heatmap_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHeatmapLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddHeatmapLayerResponse) response = maplibre_map_libre_host_api_add_heatmap_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHeatmapLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddHillshadeLayerResponse) response = maplibre_map_libre_host_api_add_hillshade_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHillshadeLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddHillshadeLayerResponse) response = maplibre_map_libre_host_api_add_hillshade_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addHillshadeLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddLineLayerResponse) response = maplibre_map_libre_host_api_add_line_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addLineLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddLineLayerResponse) response = maplibre_map_libre_host_api_add_line_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addLineLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddRasterLayerResponse) response = maplibre_map_libre_host_api_add_raster_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddRasterLayerResponse) response = maplibre_map_libre_host_api_add_raster_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddSymbolLayerResponse) response = maplibre_map_libre_host_api_add_symbol_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addSymbolLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddSymbolLayerResponse) response = maplibre_map_libre_host_api_add_symbol_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addSymbolLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiRemoveLayerResponse) response = maplibre_map_libre_host_api_remove_layer_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiRemoveLayerResponse) response = maplibre_map_libre_host_api_remove_layer_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeLayer", error->message); + } +} + +void maplibre_map_libre_host_api_respond_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiRemoveSourceResponse) response = maplibre_map_libre_host_api_remove_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiRemoveSourceResponse) response = maplibre_map_libre_host_api_remove_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const uint8_t* return_value, size_t return_value_length) { + g_autoptr(MaplibreMapLibreHostApiLoadImageResponse) response = maplibre_map_libre_host_api_load_image_response_new(return_value, return_value_length); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "loadImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiLoadImageResponse) response = maplibre_map_libre_host_api_load_image_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "loadImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddImageResponse) response = maplibre_map_libre_host_api_add_image_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddImageResponse) response = maplibre_map_libre_host_api_add_image_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiRemoveImageResponse) response = maplibre_map_libre_host_api_remove_image_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiRemoveImageResponse) response = maplibre_map_libre_host_api_remove_image_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "removeImage", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddGeoJsonSourceResponse) response = maplibre_map_libre_host_api_add_geo_json_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addGeoJsonSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddGeoJsonSourceResponse) response = maplibre_map_libre_host_api_add_geo_json_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addGeoJsonSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse) response = maplibre_map_libre_host_api_update_geo_json_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateGeoJsonSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiUpdateGeoJsonSourceResponse) response = maplibre_map_libre_host_api_update_geo_json_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateGeoJsonSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddImageSourceResponse) response = maplibre_map_libre_host_api_add_image_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImageSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddImageSourceResponse) response = maplibre_map_libre_host_api_add_image_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addImageSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddRasterSourceResponse) response = maplibre_map_libre_host_api_add_raster_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddRasterSourceResponse) response = maplibre_map_libre_host_api_add_raster_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddRasterDemSourceResponse) response = maplibre_map_libre_host_api_add_raster_dem_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterDemSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddRasterDemSourceResponse) response = maplibre_map_libre_host_api_add_raster_dem_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addRasterDemSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiAddVectorSourceResponse) response = maplibre_map_libre_host_api_add_vector_source_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addVectorSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiAddVectorSourceResponse) response = maplibre_map_libre_host_api_add_vector_source_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "addVectorSource", error->message); + } +} + +void maplibre_map_libre_host_api_respond_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle) { + g_autoptr(MaplibreMapLibreHostApiUpdateOptionsResponse) response = maplibre_map_libre_host_api_update_options_response_new(); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateOptions", error->message); + } +} + +void maplibre_map_libre_host_api_respond_error_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details) { + g_autoptr(MaplibreMapLibreHostApiUpdateOptionsResponse) response = maplibre_map_libre_host_api_update_options_response_new_error(code, message, details); + g_autoptr(GError) error = nullptr; + if (!fl_basic_message_channel_respond(response_handle->channel, response_handle->response_handle, response->value, &error)) { + g_warning("Failed to send response to %s.%s: %s", "MapLibreHostApi", "updateOptions", error->message); + } +} + +struct _MaplibreMapLibreFlutterApi { + GObject parent_instance; + + FlBinaryMessenger* messenger; + gchar *suffix; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApi, maplibre_map_libre_flutter_api, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_dispose(GObject* object) { + MaplibreMapLibreFlutterApi* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API(object); + g_clear_object(&self->messenger); + g_clear_pointer(&self->suffix, g_free); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_init(MaplibreMapLibreFlutterApi* self) { +} + +static void maplibre_map_libre_flutter_api_class_init(MaplibreMapLibreFlutterApiClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_dispose; +} + +MaplibreMapLibreFlutterApi* maplibre_map_libre_flutter_api_new(FlBinaryMessenger* messenger, const gchar* suffix) { + MaplibreMapLibreFlutterApi* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API(g_object_new(maplibre_map_libre_flutter_api_get_type(), nullptr)); + self->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger)); + self->suffix = suffix != nullptr ? g_strdup_printf(".%s", suffix) : g_strdup(""); + return self; +} + +struct _MaplibreMapLibreFlutterApiGetOptionsResponse { + GObject parent_instance; + + FlValue* error; + FlValue* return_value; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiGetOptionsResponse, maplibre_map_libre_flutter_api_get_options_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_get_options_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiGetOptionsResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + g_clear_pointer(&self->return_value, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_get_options_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_get_options_response_init(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { +} + +static void maplibre_map_libre_flutter_api_get_options_response_class_init(MaplibreMapLibreFlutterApiGetOptionsResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_get_options_response_dispose; +} + +static MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiGetOptionsResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_get_options_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + else { + FlValue* value = fl_value_get_list_value(response, 0); + self->return_value = fl_value_ref(value); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_get_options_response_is_error(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_code(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_message(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_get_options_response_get_error_details(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_get_options_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +MaplibreMapOptions* maplibre_map_libre_flutter_api_get_options_response_get_return_value(MaplibreMapLibreFlutterApiGetOptionsResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE(self), nullptr); + g_assert(!maplibre_map_libre_flutter_api_get_options_response_is_error(self)); + return MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(self->return_value)); +} + +static void maplibre_map_libre_flutter_api_get_options_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_get_options(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_get_options_cb, task); +} + +MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_get_options_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnStyleLoadedResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnStyleLoadedResponse, maplibre_map_libre_flutter_api_on_style_loaded_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_style_loaded_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_style_loaded_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_style_loaded_response_init(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_style_loaded_response_class_init(MaplibreMapLibreFlutterApiOnStyleLoadedResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_style_loaded_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_style_loaded_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_style_loaded_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_style_loaded(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_style_loaded_cb, task); +} + +MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_style_loaded_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnClickResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnClickResponse, maplibre_map_libre_flutter_api_on_click_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_click_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_click_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_click_response_init(MaplibreMapLibreFlutterApiOnClickResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_click_response_class_init(MaplibreMapLibreFlutterApiOnClickResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_click_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_click_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_click_response_is_error(MaplibreMapLibreFlutterApiOnClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_code(MaplibreMapLibreFlutterApiOnClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_message(MaplibreMapLibreFlutterApiOnClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_click_response_get_error_details(MaplibreMapLibreFlutterApiOnClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_click_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_click_cb, task); +} + +MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_click_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnIdleResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_idle_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_idle_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_idle_response_init(MaplibreMapLibreFlutterApiOnIdleResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_idle_response_class_init(MaplibreMapLibreFlutterApiOnIdleResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_idle_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_idle_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_idle_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_idle_cb, task); +} + +MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_idle_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnCameraIdleResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_idle_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_init(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_response_class_init(MaplibreMapLibreFlutterApiOnCameraIdleResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_idle_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnCameraIdleResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_idle_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_camera_idle_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* self, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_idle_cb, task); +} + +MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_camera_idle_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnSecondaryClickResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_secondary_click_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_secondary_click_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_secondary_click_response_init(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_secondary_click_response_class_init(MaplibreMapLibreFlutterApiOnSecondaryClickResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_secondary_click_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_secondary_click_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_secondary_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_secondary_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_secondary_click_cb, task); +} + +MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_secondary_click_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnDoubleClickResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnDoubleClickResponse, maplibre_map_libre_flutter_api_on_double_click_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_double_click_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnDoubleClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_double_click_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_double_click_response_init(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_double_click_response_class_init(MaplibreMapLibreFlutterApiOnDoubleClickResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_double_click_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnDoubleClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_double_click_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_double_click_response_is_error(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_code(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_message(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_double_click_response_get_error_details(MaplibreMapLibreFlutterApiOnDoubleClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_double_click_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_double_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_double_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_double_click_cb, task); +} + +MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_double_click_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnLongClickResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnLongClickResponse, maplibre_map_libre_flutter_api_on_long_click_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_long_click_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnLongClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_long_click_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_long_click_response_init(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_long_click_response_class_init(MaplibreMapLibreFlutterApiOnLongClickResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_long_click_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnLongClickResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_long_click_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_long_click_response_is_error(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_code(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_message(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_long_click_response_get_error_details(MaplibreMapLibreFlutterApiOnLongClickResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_long_click_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_long_click_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_long_click_cb, task); +} + +MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_long_click_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnCameraMovedResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_camera_moved_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_moved_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_camera_moved_response_init(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_camera_moved_response_class_init(MaplibreMapLibreFlutterApiOnCameraMovedResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_moved_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_moved_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_camera_moved_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* self, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(134, G_OBJECT(camera))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_moved_cb, task); +} + +MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_camera_moved_response_new(response); +} diff --git a/linux/pigeon.g.h b/linux/pigeon.g.h index 55cd5ca..84db585 100644 --- a/linux/pigeon.g.h +++ b/linux/pigeon.g.h @@ -40,6 +40,155 @@ typedef enum { MAPLIBRE_RASTER_DEM_ENCODING_CUSTOM = 2 } MaplibreRasterDemEncoding; +/** + * MaplibreMapOptions: + * + * The map options define initial values for the MapLibre map. + */ + +G_DECLARE_FINAL_TYPE(MaplibreMapOptions, maplibre_map_options, MAPLIBRE, MAP_OPTIONS, GObject) + +/** + * maplibre_map_options_new: + * style: field in this object. + * zoom: field in this object. + * tilt: field in this object. + * bearing: field in this object. + * center: field in this object. + * max_bounds: field in this object. + * min_zoom: field in this object. + * max_zoom: field in this object. + * min_tilt: field in this object. + * max_tilt: field in this object. + * listens_on_click: field in this object. + * listens_on_long_click: field in this object. + * + * Creates a new #MapOptions object. + * + * Returns: a new #MaplibreMapOptions + */ +MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double tilt, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_tilt, double max_tilt, gboolean listens_on_click, gboolean listens_on_long_click); + +/** + * maplibre_map_options_get_style + * @object: a #MaplibreMapOptions. + * + * The URL of the used map style. + * + * Returns: the field value. + */ +const gchar* maplibre_map_options_get_style(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_zoom + * @object: a #MaplibreMapOptions. + * + * The initial zoom level of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_zoom(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_tilt + * @object: a #MaplibreMapOptions. + * + * The initial tilt of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_tilt(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_bearing + * @object: a #MaplibreMapOptions. + * + * The initial bearing of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_bearing(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_center + * @object: a #MaplibreMapOptions. + * + * The initial center coordinates of the map. + * + * Returns: the field value. + */ +MaplibreLngLat* maplibre_map_options_get_center(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_max_bounds + * @object: a #MaplibreMapOptions. + * + * The maximum bounding box of the map camera. + * + * Returns: the field value. + */ +MaplibreLngLatBounds* maplibre_map_options_get_max_bounds(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_min_zoom + * @object: a #MaplibreMapOptions. + * + * The minimum zoom level of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_min_zoom(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_max_zoom + * @object: a #MaplibreMapOptions. + * + * The maximum zoom level of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_max_zoom(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_min_tilt + * @object: a #MaplibreMapOptions. + * + * The minimum pitch / tilt of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_min_tilt(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_max_tilt + * @object: a #MaplibreMapOptions. + * + * The maximum pitch / tilt of the map. + * + * Returns: the field value. + */ +double maplibre_map_options_get_max_tilt(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_listens_on_click + * @object: a #MaplibreMapOptions. + * + * If the native map should listen to click events. + * + * Returns: the field value. + */ +gboolean maplibre_map_options_get_listens_on_click(MaplibreMapOptions* object); + +/** + * maplibre_map_options_get_listens_on_long_click + * @object: a #MaplibreMapOptions. + * + * If the native map should listen to long click events. + * + * Returns: the field value. + */ +gboolean maplibre_map_options_get_listens_on_long_click(MaplibreMapOptions* object); + /** * MaplibreLngLat: * @@ -240,6 +389,1228 @@ double maplibre_lng_lat_bounds_get_latitude_south(MaplibreLngLatBounds* object); */ double maplibre_lng_lat_bounds_get_latitude_north(MaplibreLngLatBounds* object); +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiResponseHandle, maplibre_map_libre_host_api_response_handle, MAPLIBRE, MAP_LIBRE_HOST_API_RESPONSE_HANDLE, GObject) + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse, maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response, MAPLIBRE, MAP_LIBRE_HOST_API_GET_METERS_PER_PIXEL_AT_LATITUDE_RESPONSE, GObject) + +/** + * maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new: + * + * Creates a new response to MapLibreHostApi.getMetersPerPixelAtLatitude. + * + * Returns: a new #MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse + */ +MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new(double return_value); + +/** + * maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error: + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Creates a new error response to MapLibreHostApi.getMetersPerPixelAtLatitude. + * + * Returns: a new #MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse + */ +MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* maplibre_map_libre_host_api_get_meters_per_pixel_at_latitude_response_new_error(const gchar* code, const gchar* message, FlValue* details); + +/** + * MaplibreMapLibreHostApiVTable: + * + * Table of functions exposed by MapLibreHostApi to be implemented by the API provider. + */ +typedef struct { + void (*jump_to)(MaplibreLngLat* center, double* zoom, double* bearing, double* pitch, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*fly_to)(MaplibreLngLat* center, double* zoom, double* bearing, double* pitch, int64_t duration_ms, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*get_camera)(MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*get_visible_region)(MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*to_screen_location)(double lng, double lat, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*to_lng_lat)(double x, double y, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_fill_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_circle_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_background_layer)(const gchar* id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_fill_extrusion_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_heatmap_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_hillshade_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_line_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_raster_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_symbol_layer)(const gchar* id, const gchar* source_id, FlValue* layout, FlValue* paint, const gchar* below_layer_id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*remove_layer)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*remove_source)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*load_image)(const gchar* url, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_image)(const gchar* id, const uint8_t* bytes, size_t bytes_length, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*remove_image)(const gchar* id, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_geo_json_source)(const gchar* id, const gchar* data, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*update_geo_json_source)(const gchar* id, const gchar* data, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_image_source)(const gchar* id, const gchar* url, FlValue* coordinates, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_raster_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, double min_zoom, double max_zoom, int64_t tile_size, MaplibreTileScheme scheme, const gchar* attribution, gboolean volatile, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_raster_dem_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, double min_zoom, double max_zoom, int64_t tile_size, const gchar* attribution, MaplibreRasterDemEncoding encoding, gboolean volatile, double red_factor, double blue_factor, double green_factor, double base_shift, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + void (*add_vector_source)(const gchar* id, const gchar* url, FlValue* tiles, FlValue* bounds, MaplibreTileScheme scheme, double min_zoom, double max_zoom, const gchar* attribution, gboolean volatile, const gchar* source_layer, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); + MaplibreMapLibreHostApiGetMetersPerPixelAtLatitudeResponse* (*get_meters_per_pixel_at_latitude)(double latitude, gpointer user_data); + void (*update_options)(MaplibreMapOptions* options, MaplibreMapLibreHostApiResponseHandle* response_handle, gpointer user_data); +} MaplibreMapLibreHostApiVTable; + +/** + * maplibre_map_libre_host_api_set_method_handlers: + * + * @messenger: an #FlBinaryMessenger. + * @suffix: (allow-none): a suffix to add to the API or %NULL for none. + * @vtable: implementations of the methods in this API. + * @user_data: (closure): user data to pass to the functions in @vtable. + * @user_data_free_func: (allow-none): a function which gets called to free @user_data, or %NULL. + * + * Connects the method handlers in the MapLibreHostApi API. + */ +void maplibre_map_libre_host_api_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const MaplibreMapLibreHostApiVTable* vtable, gpointer user_data, GDestroyNotify user_data_free_func); + +/** + * maplibre_map_libre_host_api_clear_method_handlers: + * + * @messenger: an #FlBinaryMessenger. + * @suffix: (allow-none): a suffix to add to the API or %NULL for none. + * + * Clears the method handlers in the MapLibreHostApi API. + */ +void maplibre_map_libre_host_api_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix); + +/** + * maplibre_map_libre_host_api_respond_jump_to: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.jumpTo. + */ +void maplibre_map_libre_host_api_respond_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_jump_to: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.jumpTo. + */ +void maplibre_map_libre_host_api_respond_error_jump_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_fly_to: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.flyTo. + */ +void maplibre_map_libre_host_api_respond_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_fly_to: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.flyTo. + */ +void maplibre_map_libre_host_api_respond_error_fly_to(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_get_camera: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to MapLibreHostApi.getCamera. + */ +void maplibre_map_libre_host_api_respond_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreMapCamera* return_value); + +/** + * maplibre_map_libre_host_api_respond_error_get_camera: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.getCamera. + */ +void maplibre_map_libre_host_api_respond_error_get_camera(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_get_visible_region: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to MapLibreHostApi.getVisibleRegion. + */ +void maplibre_map_libre_host_api_respond_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLatBounds* return_value); + +/** + * maplibre_map_libre_host_api_respond_error_get_visible_region: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.getVisibleRegion. + */ +void maplibre_map_libre_host_api_respond_error_get_visible_region(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_to_screen_location: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to MapLibreHostApi.toScreenLocation. + */ +void maplibre_map_libre_host_api_respond_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreScreenLocation* return_value); + +/** + * maplibre_map_libre_host_api_respond_error_to_screen_location: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.toScreenLocation. + */ +void maplibre_map_libre_host_api_respond_error_to_screen_location(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_to_lng_lat: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @return_value: location to write the value returned by this method. + * + * Responds to MapLibreHostApi.toLngLat. + */ +void maplibre_map_libre_host_api_respond_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, MaplibreLngLat* return_value); + +/** + * maplibre_map_libre_host_api_respond_error_to_lng_lat: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.toLngLat. + */ +void maplibre_map_libre_host_api_respond_error_to_lng_lat(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_fill_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addFillLayer. + */ +void maplibre_map_libre_host_api_respond_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_fill_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addFillLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_fill_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_circle_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addCircleLayer. + */ +void maplibre_map_libre_host_api_respond_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_circle_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addCircleLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_circle_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_background_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addBackgroundLayer. + */ +void maplibre_map_libre_host_api_respond_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_background_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addBackgroundLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_background_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_fill_extrusion_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addFillExtrusionLayer. + */ +void maplibre_map_libre_host_api_respond_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addFillExtrusionLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_fill_extrusion_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_heatmap_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addHeatmapLayer. + */ +void maplibre_map_libre_host_api_respond_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_heatmap_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addHeatmapLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_heatmap_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_hillshade_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addHillshadeLayer. + */ +void maplibre_map_libre_host_api_respond_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_hillshade_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addHillshadeLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_hillshade_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_line_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addLineLayer. + */ +void maplibre_map_libre_host_api_respond_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_line_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addLineLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_line_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_raster_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addRasterLayer. + */ +void maplibre_map_libre_host_api_respond_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_raster_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addRasterLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_raster_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_symbol_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addSymbolLayer. + */ +void maplibre_map_libre_host_api_respond_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_symbol_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addSymbolLayer. + */ +void maplibre_map_libre_host_api_respond_error_add_symbol_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_remove_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.removeLayer. + */ +void maplibre_map_libre_host_api_respond_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_remove_layer: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.removeLayer. + */ +void maplibre_map_libre_host_api_respond_error_remove_layer(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_remove_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.removeSource. + */ +void maplibre_map_libre_host_api_respond_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_remove_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.removeSource. + */ +void maplibre_map_libre_host_api_respond_error_remove_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_load_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @return_value: location to write the value returned by this method. + * @return_value_length: (allow-none): location to write length of @return_value or %NULL to ignore. + * + * Responds to MapLibreHostApi.loadImage. + */ +void maplibre_map_libre_host_api_respond_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const uint8_t* return_value, size_t return_value_length); + +/** + * maplibre_map_libre_host_api_respond_error_load_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.loadImage. + */ +void maplibre_map_libre_host_api_respond_error_load_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addImage. + */ +void maplibre_map_libre_host_api_respond_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addImage. + */ +void maplibre_map_libre_host_api_respond_error_add_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_remove_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.removeImage. + */ +void maplibre_map_libre_host_api_respond_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_remove_image: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.removeImage. + */ +void maplibre_map_libre_host_api_respond_error_remove_image(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_geo_json_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addGeoJsonSource. + */ +void maplibre_map_libre_host_api_respond_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_geo_json_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addGeoJsonSource. + */ +void maplibre_map_libre_host_api_respond_error_add_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_update_geo_json_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.updateGeoJsonSource. + */ +void maplibre_map_libre_host_api_respond_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_update_geo_json_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.updateGeoJsonSource. + */ +void maplibre_map_libre_host_api_respond_error_update_geo_json_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_image_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addImageSource. + */ +void maplibre_map_libre_host_api_respond_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_image_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addImageSource. + */ +void maplibre_map_libre_host_api_respond_error_add_image_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_raster_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addRasterSource. + */ +void maplibre_map_libre_host_api_respond_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_raster_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addRasterSource. + */ +void maplibre_map_libre_host_api_respond_error_add_raster_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_raster_dem_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addRasterDemSource. + */ +void maplibre_map_libre_host_api_respond_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_raster_dem_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addRasterDemSource. + */ +void maplibre_map_libre_host_api_respond_error_add_raster_dem_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_add_vector_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.addVectorSource. + */ +void maplibre_map_libre_host_api_respond_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_add_vector_source: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.addVectorSource. + */ +void maplibre_map_libre_host_api_respond_error_add_vector_source(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +/** + * maplibre_map_libre_host_api_respond_update_options: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * + * Responds to MapLibreHostApi.updateOptions. + */ +void maplibre_map_libre_host_api_respond_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle); + +/** + * maplibre_map_libre_host_api_respond_error_update_options: + * @response_handle: a #MaplibreMapLibreHostApiResponseHandle. + * @code: error code. + * @message: error message. + * @details: (allow-none): error details or %NULL. + * + * Responds with an error to MapLibreHostApi.updateOptions. + */ +void maplibre_map_libre_host_api_respond_error_update_options(MaplibreMapLibreHostApiResponseHandle* response_handle, const gchar* code, const gchar* message, FlValue* details); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiGetOptionsResponse, maplibre_map_libre_flutter_api_get_options_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_GET_OPTIONS_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_get_options_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. + * + * Checks if a response to MapLibreFlutterApi.getOptions is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_get_options_response_is_error(MaplibreMapLibreFlutterApiGetOptionsResponse* response); + +/** + * maplibre_map_libre_flutter_api_get_options_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_code(MaplibreMapLibreFlutterApiGetOptionsResponse* response); + +/** + * maplibre_map_libre_flutter_api_get_options_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_get_options_response_get_error_message(MaplibreMapLibreFlutterApiGetOptionsResponse* response); + +/** + * maplibre_map_libre_flutter_api_get_options_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_get_options_response_get_error_details(MaplibreMapLibreFlutterApiGetOptionsResponse* response); + +/** + * maplibre_map_libre_flutter_api_get_options_response_get_return_value: + * @response: a #MaplibreMapLibreFlutterApiGetOptionsResponse. + * + * Get the return value for this response. + * + * Returns: a return value. + */ +MaplibreMapOptions* maplibre_map_libre_flutter_api_get_options_response_get_return_value(MaplibreMapLibreFlutterApiGetOptionsResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnStyleLoadedResponse, maplibre_map_libre_flutter_api_on_style_loaded_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_STYLE_LOADED_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_style_loaded_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. + * + * Checks if a response to MapLibreFlutterApi.onStyleLoaded is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_style_loaded_response_is_error(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_code(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_message(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_style_loaded_response_get_error_details(MaplibreMapLibreFlutterApiOnStyleLoadedResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnClickResponse, maplibre_map_libre_flutter_api_on_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CLICK_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_click_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. + * + * Checks if a response to MapLibreFlutterApi.onClick is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_click_response_is_error(MaplibreMapLibreFlutterApiOnClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_click_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_code(MaplibreMapLibreFlutterApiOnClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_click_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_click_response_get_error_message(MaplibreMapLibreFlutterApiOnClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_click_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnClickResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_click_response_get_error_details(MaplibreMapLibreFlutterApiOnClickResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnIdleResponse, maplibre_map_libre_flutter_api_on_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_IDLE_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_idle_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Checks if a response to MapLibreFlutterApi.onIdle is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_idle_response_is_error(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_idle_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnIdleResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnIdleResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraIdleResponse, maplibre_map_libre_flutter_api_on_camera_idle_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_IDLE_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Checks if a response to MapLibreFlutterApi.onCameraIdle is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_camera_idle_response_is_error(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_camera_idle_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraIdleResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnSecondaryClickResponse, maplibre_map_libre_flutter_api_on_secondary_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_SECONDARY_CLICK_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_secondary_click_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. + * + * Checks if a response to MapLibreFlutterApi.onSecondaryClick is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_secondary_click_response_is_error(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_code(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_message(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_secondary_click_response_get_error_details(MaplibreMapLibreFlutterApiOnSecondaryClickResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnDoubleClickResponse, maplibre_map_libre_flutter_api_on_double_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_DOUBLE_CLICK_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_double_click_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. + * + * Checks if a response to MapLibreFlutterApi.onDoubleClick is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_double_click_response_is_error(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_double_click_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_code(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_double_click_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_double_click_response_get_error_message(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_double_click_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_double_click_response_get_error_details(MaplibreMapLibreFlutterApiOnDoubleClickResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnLongClickResponse, maplibre_map_libre_flutter_api_on_long_click_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_LONG_CLICK_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_long_click_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. + * + * Checks if a response to MapLibreFlutterApi.onLongClick is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_long_click_response_is_error(MaplibreMapLibreFlutterApiOnLongClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_long_click_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_code(MaplibreMapLibreFlutterApiOnLongClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_long_click_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_message(MaplibreMapLibreFlutterApiOnLongClickResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_long_click_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnLongClickResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_long_click_response_get_error_details(MaplibreMapLibreFlutterApiOnLongClickResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_camera_moved_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * + * Checks if a response to MapLibreFlutterApi.onCameraMoved is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); + +/** + * MaplibreMapLibreFlutterApi: + * + */ + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApi, maplibre_map_libre_flutter_api, MAPLIBRE, MAP_LIBRE_FLUTTER_API, GObject) + +/** + * maplibre_map_libre_flutter_api_new: + * @messenger: an #FlBinaryMessenger. + * @suffix: (allow-none): a suffix to add to the API or %NULL for none. + * + * Creates a new object to access the MapLibreFlutterApi API. + * + * Returns: a new #MaplibreMapLibreFlutterApi + */ +MaplibreMapLibreFlutterApi* maplibre_map_libre_flutter_api_new(FlBinaryMessenger* messenger, const gchar* suffix); + +/** + * maplibre_map_libre_flutter_api_get_options: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Get the map options from dart. + */ +void maplibre_map_libre_flutter_api_get_options(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_get_options_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_get_options() call. + * + * Returns: a #MaplibreMapLibreFlutterApiGetOptionsResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiGetOptionsResponse* maplibre_map_libre_flutter_api_get_options_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_style_loaded: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback for when the style has been loaded. + */ +void maplibre_map_libre_flutter_api_on_style_loaded(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_style_loaded_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_style_loaded() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnStyleLoadedResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnStyleLoadedResponse* maplibre_map_libre_flutter_api_on_style_loaded_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_click: + * @api: a #MaplibreMapLibreFlutterApi. + * @point: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the user clicks on the map. + */ +void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_click_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_click() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnClickResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnClickResponse* maplibre_map_libre_flutter_api_on_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_idle: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map idles. + */ +void maplibre_map_libre_flutter_api_on_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_idle_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_idle() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnIdleResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnIdleResponse* maplibre_map_libre_flutter_api_on_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle: + * @api: a #MaplibreMapLibreFlutterApi. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map camera idles. + */ +void maplibre_map_libre_flutter_api_on_camera_idle(MaplibreMapLibreFlutterApi* api, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_camera_idle_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_camera_idle() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnCameraIdleResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnCameraIdleResponse* maplibre_map_libre_flutter_api_on_camera_idle_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_secondary_click: + * @api: a #MaplibreMapLibreFlutterApi. + * @point: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the user performs a secondary click on the map + * (e.g. by default a click with the right mouse button). + */ +void maplibre_map_libre_flutter_api_on_secondary_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_secondary_click_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_secondary_click() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnSecondaryClickResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnSecondaryClickResponse* maplibre_map_libre_flutter_api_on_secondary_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_double_click: + * @api: a #MaplibreMapLibreFlutterApi. + * @point: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the user performs a double click on the map. + */ +void maplibre_map_libre_flutter_api_on_double_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_double_click_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_double_click() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnDoubleClickResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnDoubleClickResponse* maplibre_map_libre_flutter_api_on_double_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_long_click: + * @api: a #MaplibreMapLibreFlutterApi. + * @point: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the user performs a long lasting click on the map. + */ +void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* api, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_long_click_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_long_click() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnLongClickResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_camera_moved: + * @api: a #MaplibreMapLibreFlutterApi. + * @camera: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map camera changes. + */ +void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* api, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_camera_moved_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_camera_moved() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + G_END_DECLS #endif // PIGEON_PIGEON_G_H_ diff --git a/macos/Classes/Pigeon.g.swift b/macos/Classes/Pigeon.g.swift index d6711ca..be85aa8 100644 --- a/macos/Classes/Pigeon.g.swift +++ b/macos/Classes/Pigeon.g.swift @@ -29,6 +29,36 @@ final class PigeonError: Error { } } +private func wrapResult(_ result: Any?) -> [Any?] { + return [result] +} + +private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } + if let flutterError = error as? FlutterError { + return [ + flutterError.code, + flutterError.message, + flutterError.details, + ] + } + return [ + "\(error)", + "\(type(of: error))", + "Stacktrace: \(Thread.callStackSymbols)", + ] +} + +private func createConnectionError(withChannelName channelName: String) -> PigeonError { + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") +} + private func isNullish(_ value: Any?) -> Bool { return value is NSNull || value == nil } @@ -57,6 +87,85 @@ enum RasterDemEncoding: Int { case custom = 2 } +/// The map options define initial values for the MapLibre map. +/// +/// Generated class from Pigeon that represents data sent in messages. +struct MapOptions { + /// The URL of the used map style. + var style: String + /// The initial zoom level of the map. + var zoom: Double + /// The initial tilt of the map. + var tilt: Double + /// The initial bearing of the map. + var bearing: Double + /// The initial center coordinates of the map. + var center: LngLat? = nil + /// The maximum bounding box of the map camera. + var maxBounds: LngLatBounds? = nil + /// The minimum zoom level of the map. + var minZoom: Double + /// The maximum zoom level of the map. + var maxZoom: Double + /// The minimum pitch / tilt of the map. + var minTilt: Double + /// The maximum pitch / tilt of the map. + var maxTilt: Double + /// If the native map should listen to click events. + var listensOnClick: Bool + /// If the native map should listen to long click events. + var listensOnLongClick: Bool + + + + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ pigeonVar_list: [Any?]) -> MapOptions? { + let style = pigeonVar_list[0] as! String + let zoom = pigeonVar_list[1] as! Double + let tilt = pigeonVar_list[2] as! Double + let bearing = pigeonVar_list[3] as! Double + let center: LngLat? = nilOrValue(pigeonVar_list[4]) + let maxBounds: LngLatBounds? = nilOrValue(pigeonVar_list[5]) + let minZoom = pigeonVar_list[6] as! Double + let maxZoom = pigeonVar_list[7] as! Double + let minTilt = pigeonVar_list[8] as! Double + let maxTilt = pigeonVar_list[9] as! Double + let listensOnClick = pigeonVar_list[10] as! Bool + let listensOnLongClick = pigeonVar_list[11] as! Bool + + return MapOptions( + style: style, + zoom: zoom, + tilt: tilt, + bearing: bearing, + center: center, + maxBounds: maxBounds, + minZoom: minZoom, + maxZoom: maxZoom, + minTilt: minTilt, + maxTilt: maxTilt, + listensOnClick: listensOnClick, + listensOnLongClick: listensOnLongClick + ) + } + func toList() -> [Any?] { + return [ + style, + zoom, + tilt, + bearing, + center, + maxBounds, + minZoom, + maxZoom, + minTilt, + maxTilt, + listensOnClick, + listensOnLongClick, + ] + } +} + /// A longitude/latitude coordinate object. /// /// Generated class from Pigeon that represents data sent in messages. @@ -201,12 +310,14 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return LngLat.fromList(self.readValue() as! [Any?]) + return MapOptions.fromList(self.readValue() as! [Any?]) case 132: - return ScreenLocation.fromList(self.readValue() as! [Any?]) + return LngLat.fromList(self.readValue() as! [Any?]) case 133: - return MapCamera.fromList(self.readValue() as! [Any?]) + return ScreenLocation.fromList(self.readValue() as! [Any?]) case 134: + return MapCamera.fromList(self.readValue() as! [Any?]) + case 135: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -222,18 +333,21 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? LngLat { + } else if let value = value as? MapOptions { super.writeByte(131) super.writeValue(value.toList()) - } else if let value = value as? ScreenLocation { + } else if let value = value as? LngLat { super.writeByte(132) super.writeValue(value.toList()) - } else if let value = value as? MapCamera { + } else if let value = value as? ScreenLocation { super.writeByte(133) super.writeValue(value.toList()) - } else if let value = value as? LngLatBounds { + } else if let value = value as? MapCamera { super.writeByte(134) super.writeValue(value.toList()) + } else if let value = value as? LngLatBounds { + super.writeByte(135) + super.writeValue(value.toList()) } else { super.writeValue(value) } @@ -254,3 +368,864 @@ class PigeonPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { static let shared = PigeonPigeonCodec(readerWriter: PigeonPigeonCodecReaderWriter()) } + +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol MapLibreHostApi { + /// Move the viewport of the map to a new location without any animation. + func jumpTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, completion: @escaping (Result) -> Void) + /// Animate the viewport of the map to a new location. + func flyTo(center: LngLat?, zoom: Double?, bearing: Double?, pitch: Double?, durationMs: Int64, completion: @escaping (Result) -> Void) + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + func getCamera(completion: @escaping (Result) -> Void) + /// Get the visible region of the current map camera. + func getVisibleRegion(completion: @escaping (Result) -> Void) + /// Convert a coordinate to a location on the screen. + func toScreenLocation(lng: Double, lat: Double, completion: @escaping (Result) -> Void) + /// Convert a screen location to a coordinate. + func toLngLat(x: Double, y: Double, completion: @escaping (Result) -> Void) + /// Add a fill layer to the map style. + func addFillLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a circle layer to the map style. + func addCircleLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a background layer to the map style. + func addBackgroundLayer(id: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a fill extrusion layer to the map style. + func addFillExtrusionLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a heatmap layer to the map style. + func addHeatmapLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a hillshade layer to the map style. + func addHillshadeLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a line layer to the map style. + func addLineLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a raster layer to the map style. + func addRasterLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Add a symbol layer to the map style. + func addSymbolLayer(id: String, sourceId: String, layout: [String: Any], paint: [String: Any], belowLayerId: String?, completion: @escaping (Result) -> Void) + /// Removes the layer with the given ID from the map's style. + func removeLayer(id: String, completion: @escaping (Result) -> Void) + /// Removes the source with the given ID from the map's style. + func removeSource(id: String, completion: @escaping (Result) -> Void) + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + func loadImage(url: String, completion: @escaping (Result) -> Void) + /// Add an image to the map. + func addImage(id: String, bytes: FlutterStandardTypedData, completion: @escaping (Result) -> Void) + /// Removes an image from the map + func removeImage(id: String, completion: @escaping (Result) -> Void) + /// Add a GeoJSON source to the map style. + func addGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) + /// Update the data of a GeoJSON source. + func updateGeoJsonSource(id: String, data: String, completion: @escaping (Result) -> Void) + /// Add a image source to the map style. + func addImageSource(id: String, url: String, coordinates: [LngLat], completion: @escaping (Result) -> Void) + /// Add a raster source to the map style. + func addRasterSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, scheme: TileScheme, attribution: String?, volatile: Bool, completion: @escaping (Result) -> Void) + /// Add a raster DEM source to the map style. + func addRasterDemSource(id: String, url: String?, tiles: [String]?, bounds: [Double], minZoom: Double, maxZoom: Double, tileSize: Int64, attribution: String?, encoding: RasterDemEncoding, volatile: Bool, redFactor: Double, blueFactor: Double, greenFactor: Double, baseShift: Double, completion: @escaping (Result) -> Void) + /// Add a vector source to the map style. + func addVectorSource(id: String, url: String?, tiles: [String]?, bounds: [Double], scheme: TileScheme, minZoom: Double, maxZoom: Double, attribution: String?, volatile: Bool, sourceLayer: String?, completion: @escaping (Result) -> Void) + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + func getMetersPerPixelAtLatitude(latitude: Double) throws -> Double + /// Update the map options. + func updateOptions(options: MapOptions, completion: @escaping (Result) -> Void) +} + +/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. +class MapLibreHostApiSetup { + static var codec: FlutterStandardMessageCodec { PigeonPigeonCodec.shared } + /// Sets up an instance of `MapLibreHostApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MapLibreHostApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + /// Move the viewport of the map to a new location without any animation. + let jumpToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + jumpToChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let centerArg: LngLat? = nilOrValue(args[0]) + let zoomArg: Double? = nilOrValue(args[1]) + let bearingArg: Double? = nilOrValue(args[2]) + let pitchArg: Double? = nilOrValue(args[3]) + api.jumpTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + jumpToChannel.setMessageHandler(nil) + } + /// Animate the viewport of the map to a new location. + let flyToChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + flyToChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let centerArg: LngLat? = nilOrValue(args[0]) + let zoomArg: Double? = nilOrValue(args[1]) + let bearingArg: Double? = nilOrValue(args[2]) + let pitchArg: Double? = nilOrValue(args[3]) + let durationMsArg = args[4] as! Int64 + api.flyTo(center: centerArg, zoom: zoomArg, bearing: bearingArg, pitch: pitchArg, durationMs: durationMsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + flyToChannel.setMessageHandler(nil) + } + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + let getCameraChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCameraChannel.setMessageHandler { _, reply in + api.getCamera { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getCameraChannel.setMessageHandler(nil) + } + /// Get the visible region of the current map camera. + let getVisibleRegionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getVisibleRegionChannel.setMessageHandler { _, reply in + api.getVisibleRegion { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + getVisibleRegionChannel.setMessageHandler(nil) + } + /// Convert a coordinate to a location on the screen. + let toScreenLocationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + toScreenLocationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let lngArg = args[0] as! Double + let latArg = args[1] as! Double + api.toScreenLocation(lng: lngArg, lat: latArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + toScreenLocationChannel.setMessageHandler(nil) + } + /// Convert a screen location to a coordinate. + let toLngLatChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + toLngLatChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let xArg = args[0] as! Double + let yArg = args[1] as! Double + api.toLngLat(x: xArg, y: yArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + toLngLatChannel.setMessageHandler(nil) + } + /// Add a fill layer to the map style. + let addFillLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addFillLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addFillLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addFillLayerChannel.setMessageHandler(nil) + } + /// Add a circle layer to the map style. + let addCircleLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addCircleLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addCircleLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addCircleLayerChannel.setMessageHandler(nil) + } + /// Add a background layer to the map style. + let addBackgroundLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addBackgroundLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let layoutArg = args[1] as! [String: Any] + let paintArg = args[2] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[3]) + api.addBackgroundLayer(id: idArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addBackgroundLayerChannel.setMessageHandler(nil) + } + /// Add a fill extrusion layer to the map style. + let addFillExtrusionLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addFillExtrusionLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addFillExtrusionLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addFillExtrusionLayerChannel.setMessageHandler(nil) + } + /// Add a heatmap layer to the map style. + let addHeatmapLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addHeatmapLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addHeatmapLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addHeatmapLayerChannel.setMessageHandler(nil) + } + /// Add a hillshade layer to the map style. + let addHillshadeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addHillshadeLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addHillshadeLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addHillshadeLayerChannel.setMessageHandler(nil) + } + /// Add a line layer to the map style. + let addLineLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addLineLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addLineLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addLineLayerChannel.setMessageHandler(nil) + } + /// Add a raster layer to the map style. + let addRasterLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addRasterLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterLayerChannel.setMessageHandler(nil) + } + /// Add a symbol layer to the map style. + let addSymbolLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addSymbolLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let sourceIdArg = args[1] as! String + let layoutArg = args[2] as! [String: Any] + let paintArg = args[3] as! [String: Any] + let belowLayerIdArg: String? = nilOrValue(args[4]) + api.addSymbolLayer(id: idArg, sourceId: sourceIdArg, layout: layoutArg, paint: paintArg, belowLayerId: belowLayerIdArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addSymbolLayerChannel.setMessageHandler(nil) + } + /// Removes the layer with the given ID from the map's style. + let removeLayerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeLayerChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeLayer(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeLayerChannel.setMessageHandler(nil) + } + /// Removes the source with the given ID from the map's style. + let removeSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeSource(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeSourceChannel.setMessageHandler(nil) + } + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + let loadImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let urlArg = args[0] as! String + api.loadImage(url: urlArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + loadImageChannel.setMessageHandler(nil) + } + /// Add an image to the map. + let addImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let bytesArg = args[1] as! FlutterStandardTypedData + api.addImage(id: idArg, bytes: bytesArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addImageChannel.setMessageHandler(nil) + } + /// Removes an image from the map + let removeImageChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + removeImageChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + api.removeImage(id: idArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + removeImageChannel.setMessageHandler(nil) + } + /// Add a GeoJSON source to the map style. + let addGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addGeoJsonSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let dataArg = args[1] as! String + api.addGeoJsonSource(id: idArg, data: dataArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addGeoJsonSourceChannel.setMessageHandler(nil) + } + /// Update the data of a GeoJSON source. + let updateGeoJsonSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateGeoJsonSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let dataArg = args[1] as! String + api.updateGeoJsonSource(id: idArg, data: dataArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateGeoJsonSourceChannel.setMessageHandler(nil) + } + /// Add a image source to the map style. + let addImageSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addImageSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg = args[1] as! String + let coordinatesArg = args[2] as! [LngLat] + api.addImageSource(id: idArg, url: urlArg, coordinates: coordinatesArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addImageSourceChannel.setMessageHandler(nil) + } + /// Add a raster source to the map style. + let addRasterSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let minZoomArg = args[4] as! Double + let maxZoomArg = args[5] as! Double + let tileSizeArg = args[6] as! Int64 + let schemeArg = args[7] as! TileScheme + let attributionArg: String? = nilOrValue(args[8]) + let volatileArg = args[9] as! Bool + api.addRasterSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, scheme: schemeArg, attribution: attributionArg, volatile: volatileArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterSourceChannel.setMessageHandler(nil) + } + /// Add a raster DEM source to the map style. + let addRasterDemSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addRasterDemSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let minZoomArg = args[4] as! Double + let maxZoomArg = args[5] as! Double + let tileSizeArg = args[6] as! Int64 + let attributionArg: String? = nilOrValue(args[7]) + let encodingArg = args[8] as! RasterDemEncoding + let volatileArg = args[9] as! Bool + let redFactorArg = args[10] as! Double + let blueFactorArg = args[11] as! Double + let greenFactorArg = args[12] as! Double + let baseShiftArg = args[13] as! Double + api.addRasterDemSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, minZoom: minZoomArg, maxZoom: maxZoomArg, tileSize: tileSizeArg, attribution: attributionArg, encoding: encodingArg, volatile: volatileArg, redFactor: redFactorArg, blueFactor: blueFactorArg, greenFactor: greenFactorArg, baseShift: baseShiftArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addRasterDemSourceChannel.setMessageHandler(nil) + } + /// Add a vector source to the map style. + let addVectorSourceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + addVectorSourceChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let idArg = args[0] as! String + let urlArg: String? = nilOrValue(args[1]) + let tilesArg: [String]? = nilOrValue(args[2]) + let boundsArg = args[3] as! [Double] + let schemeArg = args[4] as! TileScheme + let minZoomArg = args[5] as! Double + let maxZoomArg = args[6] as! Double + let attributionArg: String? = nilOrValue(args[7]) + let volatileArg = args[8] as! Bool + let sourceLayerArg: String? = nilOrValue(args[9]) + api.addVectorSource(id: idArg, url: urlArg, tiles: tilesArg, bounds: boundsArg, scheme: schemeArg, minZoom: minZoomArg, maxZoom: maxZoomArg, attribution: attributionArg, volatile: volatileArg, sourceLayer: sourceLayerArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + addVectorSourceChannel.setMessageHandler(nil) + } + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + let getMetersPerPixelAtLatitudeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getMetersPerPixelAtLatitudeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let latitudeArg = args[0] as! Double + do { + let result = try api.getMetersPerPixelAtLatitude(latitude: latitudeArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getMetersPerPixelAtLatitudeChannel.setMessageHandler(nil) + } + /// Update the map options. + let updateOptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + updateOptionsChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let optionsArg = args[0] as! MapOptions + api.updateOptions(options: optionsArg) { result in + switch result { + case .success: + reply(wrapResult(nil)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + updateOptionsChannel.setMessageHandler(nil) + } + } +} +/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. +protocol MapLibreFlutterApiProtocol { + /// Get the map options from dart. + func getOptions(completion: @escaping (Result) -> Void) + /// Callback for when the style has been loaded. + func onStyleLoaded(completion: @escaping (Result) -> Void) + /// Callback when the user clicks on the map. + func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the user performs a double click on the map. + func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the user performs a long lasting click on the map. + func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) + /// Callback when the map camera changes. + func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) +} +class MapLibreFlutterApi: MapLibreFlutterApiProtocol { + private let binaryMessenger: FlutterBinaryMessenger + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { + self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + } + var codec: PigeonPigeonCodec { + return PigeonPigeonCodec.shared + } + /// Get the map options from dart. + func getOptions(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else if listResponse[0] == nil { + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + } else { + let result = listResponse[0] as! MapOptions + completion(.success(result)) + } + } + } + /// Callback for when the style has been loaded. + func onStyleLoaded(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user clicks on the map. + func onClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map idles. + func onIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map camera idles. + func onCameraIdle(completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage(nil) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + func onSecondaryClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a double click on the map. + func onDoubleClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the user performs a long lasting click on the map. + func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pointArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } + /// Callback when the map camera changes. + func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([cameraArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } +} diff --git a/pigeons/map_options.dart b/pigeons/map_options.dart deleted file mode 100644 index 7e2eaf9..0000000 --- a/pigeons/map_options.dart +++ /dev/null @@ -1,55 +0,0 @@ -part of 'pigeon.dart'; - -/// The map options define initial values for the MapLibre map. -class MapOptions { - const MapOptions({ - required this.style, - required this.zoom, - required this.center, - required this.tilt, - required this.bearing, - required this.maxBounds, - required this.minZoom, - required this.maxZoom, - required this.minTilt, - required this.maxTilt, - required this.listensOnClick, - required this.listensOnLongClick, - }); - - /// The URL of the used map style. - final String style; - - /// The initial zoom level of the map. - final double zoom; - - /// The initial tilt of the map. - final double tilt; - - /// The initial bearing of the map. - final double bearing; - - /// The initial center coordinates of the map. - final LngLat? center; - - /// The maximum bounding box of the map camera. - final LngLatBounds? maxBounds; - - /// The minimum zoom level of the map. - final double minZoom; - - /// The maximum zoom level of the map. - final double maxZoom; - - /// The minimum pitch / tilt of the map. - final double minTilt; - - /// The maximum pitch / tilt of the map. - final double maxTilt; - - /// If the native map should listen to click events. - final bool listensOnClick; - - /// If the native map should listen to long click events. - final bool listensOnLongClick; -} diff --git a/pigeons/maplibre_flutter_api.dart b/pigeons/maplibre_flutter_api.dart deleted file mode 100644 index 2411dfe..0000000 --- a/pigeons/maplibre_flutter_api.dart +++ /dev/null @@ -1,32 +0,0 @@ -part of 'pigeon.dart'; - -@FlutterApi() -abstract interface class MapLibreFlutterApi { - /// Get the map options from dart. - MapOptions getOptions(); - - /// Callback for when the style has been loaded. - void onStyleLoaded(); - - /// Callback when the user clicks on the map. - void onClick(LngLat point); - - /// Callback when the map idles. - void onIdle(); - - /// Callback when the map camera idles. - void onCameraIdle(); - - /// Callback when the user performs a secondary click on the map - /// (e.g. by default a click with the right mouse button). - void onSecondaryClick(LngLat point); - - /// Callback when the user performs a double click on the map. - void onDoubleClick(LngLat point); - - /// Callback when the user performs a long lasting click on the map. - void onLongClick(LngLat point); - - /// Callback when the map camera changes. - void onCameraMoved(MapCamera camera); -} diff --git a/pigeons/maplibre_host_api.dart b/pigeons/maplibre_host_api.dart deleted file mode 100644 index f45882b..0000000 --- a/pigeons/maplibre_host_api.dart +++ /dev/null @@ -1,229 +0,0 @@ -part of 'pigeon.dart'; - -@HostApi() -abstract interface class MapLibreHostApi { - /// Move the viewport of the map to a new location without any animation. - @async - void jumpTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - }); - - /// Animate the viewport of the map to a new location. - @async - void flyTo({ - required LngLat? center, - required double? zoom, - required double? bearing, - required double? pitch, - required int durationMs, - }); - - /// Get the current camera position with the map center, zoom level, camera - /// tilt and map rotation. - @async - MapCamera getCamera(); - - /// Get the visible region of the current map camera. - @async - LngLatBounds getVisibleRegion(); - - /// Convert a coordinate to a location on the screen. - @async - ScreenLocation toScreenLocation(double lng, double lat); - - /// Convert a screen location to a coordinate. - @async - LngLat toLngLat(double x, double y); - - /// Add a fill layer to the map style. - @async - void addFillLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a circle layer to the map style. - @async - void addCircleLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a background layer to the map style. - @async - void addBackgroundLayer({ - required String id, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a fill extrusion layer to the map style. - @async - void addFillExtrusionLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a heatmap layer to the map style. - @async - void addHeatmapLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a hillshade layer to the map style. - @async - void addHillshadeLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a line layer to the map style. - @async - void addLineLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a raster layer to the map style. - @async - void addRasterLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Add a symbol layer to the map style. - @async - void addSymbolLayer({ - required String id, - required String sourceId, - required Map layout, - required Map paint, - String? belowLayerId, - }); - - /// Removes the layer with the given ID from the map's style. - @async - void removeLayer(String id); - - /// Removes the source with the given ID from the map's style. - @async - void removeSource(String id); - - /// Loads an image to the map. An image needs to be loaded before it can - /// get used. - @async - Uint8List loadImage(String url); - - /// Add an image to the map. - @async - void addImage(String id, Uint8List bytes); - - /// Removes an image from the map - @async - void removeImage(String id); - - /// Add a GeoJSON source to the map style. - @async - void addGeoJsonSource({ - required String id, - required String data, - }); - - /// Update the data of a GeoJSON source. - @async - void updateGeoJsonSource({ - required String id, - required String data, - }); - - /// Add a image source to the map style. - @async - void addImageSource({ - required String id, - required String url, - required List coordinates, - }); - - /// Add a raster source to the map style. - @async - void addRasterSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required TileScheme scheme, - required String? attribution, - required bool volatile, - }); - - /// Add a raster DEM source to the map style. - @async - void addRasterDemSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required double minZoom, - required double maxZoom, - required int tileSize, - required String? attribution, - required RasterDemEncoding encoding, - required bool volatile, - double redFactor = 1, - double blueFactor = 1, - double greenFactor = 1, - double baseShift = 0, - }); - - /// Add a vector source to the map style. - @async - void addVectorSource({ - required String id, - required String? url, - required List? tiles, - required List bounds, - required TileScheme scheme, - required double minZoom, - required double maxZoom, - required String? attribution, - required bool volatile, - required String? sourceLayer, - }); - - /// Returns the distance spanned by one pixel at the specified latitude and - /// current zoom level. - double getMetersPerPixelAtLatitude(double latitude); - - /// Update the map options. - @async - void updateOptions(MapOptions options); -} diff --git a/pigeons/pigeon.dart b/pigeons/pigeon.dart index 8207416..d0cc47e 100644 --- a/pigeons/pigeon.dart +++ b/pigeons/pigeon.dart @@ -1,11 +1,5 @@ import 'package:pigeon/pigeon.dart'; -part 'maplibre_flutter_api.dart'; - -part 'maplibre_host_api.dart'; - -part 'map_options.dart'; - @ConfigurePigeon( PigeonOptions( dartOut: 'lib/src/native/pigeon.g.dart', @@ -27,6 +21,318 @@ part 'map_options.dart'; swiftOptions: SwiftOptions(), ), ) +@HostApi() +abstract interface class MapLibreHostApi { + /// Move the viewport of the map to a new location without any animation. + @async + void jumpTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + }); + + /// Animate the viewport of the map to a new location. + @async + void flyTo({ + required LngLat? center, + required double? zoom, + required double? bearing, + required double? pitch, + required int durationMs, + }); + + /// Get the current camera position with the map center, zoom level, camera + /// tilt and map rotation. + @async + MapCamera getCamera(); + + /// Get the visible region of the current map camera. + @async + LngLatBounds getVisibleRegion(); + + /// Convert a coordinate to a location on the screen. + @async + ScreenLocation toScreenLocation(double lng, double lat); + + /// Convert a screen location to a coordinate. + @async + LngLat toLngLat(double x, double y); + + /// Add a fill layer to the map style. + @async + void addFillLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a circle layer to the map style. + @async + void addCircleLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a background layer to the map style. + @async + void addBackgroundLayer({ + required String id, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a fill extrusion layer to the map style. + @async + void addFillExtrusionLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a heatmap layer to the map style. + @async + void addHeatmapLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a hillshade layer to the map style. + @async + void addHillshadeLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a line layer to the map style. + @async + void addLineLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a raster layer to the map style. + @async + void addRasterLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Add a symbol layer to the map style. + @async + void addSymbolLayer({ + required String id, + required String sourceId, + required Map layout, + required Map paint, + String? belowLayerId, + }); + + /// Removes the layer with the given ID from the map's style. + @async + void removeLayer(String id); + + /// Removes the source with the given ID from the map's style. + @async + void removeSource(String id); + + /// Loads an image to the map. An image needs to be loaded before it can + /// get used. + @async + Uint8List loadImage(String url); + + /// Add an image to the map. + @async + void addImage(String id, Uint8List bytes); + + /// Removes an image from the map + @async + void removeImage(String id); + + /// Add a GeoJSON source to the map style. + @async + void addGeoJsonSource({ + required String id, + required String data, + }); + + /// Update the data of a GeoJSON source. + @async + void updateGeoJsonSource({ + required String id, + required String data, + }); + + /// Add a image source to the map style. + @async + void addImageSource({ + required String id, + required String url, + required List coordinates, + }); + + /// Add a raster source to the map style. + @async + void addRasterSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required TileScheme scheme, + required String? attribution, + required bool volatile, + }); + + /// Add a raster DEM source to the map style. + @async + void addRasterDemSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required double minZoom, + required double maxZoom, + required int tileSize, + required String? attribution, + required RasterDemEncoding encoding, + required bool volatile, + double redFactor = 1, + double blueFactor = 1, + double greenFactor = 1, + double baseShift = 0, + }); + + /// Add a vector source to the map style. + @async + void addVectorSource({ + required String id, + required String? url, + required List? tiles, + required List bounds, + required TileScheme scheme, + required double minZoom, + required double maxZoom, + required String? attribution, + required bool volatile, + required String? sourceLayer, + }); + + /// Returns the distance spanned by one pixel at the specified latitude and + /// current zoom level. + double getMetersPerPixelAtLatitude(double latitude); + + /// Update the map options. + @async + void updateOptions(MapOptions options); +} + +@FlutterApi() +abstract interface class MapLibreFlutterApi { + /// Get the map options from dart. + MapOptions getOptions(); + + /// Callback for when the style has been loaded. + void onStyleLoaded(); + + /// Callback when the user clicks on the map. + void onClick(LngLat point); + + /// Callback when the map idles. + void onIdle(); + + /// Callback when the map camera idles. + void onCameraIdle(); + + /// Callback when the user performs a secondary click on the map + /// (e.g. by default a click with the right mouse button). + void onSecondaryClick(LngLat point); + + /// Callback when the user performs a double click on the map. + void onDoubleClick(LngLat point); + + /// Callback when the user performs a long lasting click on the map. + void onLongClick(LngLat point); + + /// Callback when the map camera changes. + void onCameraMoved(MapCamera camera); +} + +/// The map options define initial values for the MapLibre map. +class MapOptions { + const MapOptions({ + required this.style, + required this.zoom, + required this.center, + required this.tilt, + required this.bearing, + required this.maxBounds, + required this.minZoom, + required this.maxZoom, + required this.minTilt, + required this.maxTilt, + required this.listensOnClick, + required this.listensOnLongClick, + }); + + /// The URL of the used map style. + final String style; + + /// The initial zoom level of the map. + final double zoom; + + /// The initial tilt of the map. + final double tilt; + + /// The initial bearing of the map. + final double bearing; + + /// The initial center coordinates of the map. + final LngLat? center; + + /// The maximum bounding box of the map camera. + final LngLatBounds? maxBounds; + + /// The minimum zoom level of the map. + final double minZoom; + + /// The maximum zoom level of the map. + final double maxZoom; + + /// The minimum pitch / tilt of the map. + final double minTilt; + + /// The maximum pitch / tilt of the map. + final double maxTilt; + + /// If the native map should listen to click events. + final bool listensOnClick; + + /// If the native map should listen to long click events. + final bool listensOnLongClick; +} /// A longitude/latitude coordinate object. class LngLat { diff --git a/windows/runner/pigeon.g.cpp b/windows/runner/pigeon.g.cpp index cdec36f..544c829 100644 --- a/windows/runner/pigeon.g.cpp +++ b/windows/runner/pigeon.g.cpp @@ -28,6 +28,243 @@ FlutterError CreateConnectionError(const std::string channel_name) { EncodableValue("")); } +// MapOptions + +MapOptions::MapOptions( + const std::string& style, + double zoom, + double tilt, + double bearing, + double min_zoom, + double max_zoom, + double min_tilt, + double max_tilt, + bool listens_on_click, + bool listens_on_long_click) + : style_(style), + zoom_(zoom), + tilt_(tilt), + bearing_(bearing), + min_zoom_(min_zoom), + max_zoom_(max_zoom), + min_tilt_(min_tilt), + max_tilt_(max_tilt), + listens_on_click_(listens_on_click), + listens_on_long_click_(listens_on_long_click) {} + +MapOptions::MapOptions( + const std::string& style, + double zoom, + double tilt, + double bearing, + const LngLat* center, + const LngLatBounds* max_bounds, + double min_zoom, + double max_zoom, + double min_tilt, + double max_tilt, + bool listens_on_click, + bool listens_on_long_click) + : style_(style), + zoom_(zoom), + tilt_(tilt), + bearing_(bearing), + center_(center ? std::make_unique(*center) : nullptr), + max_bounds_(max_bounds ? std::make_unique(*max_bounds) : nullptr), + min_zoom_(min_zoom), + max_zoom_(max_zoom), + min_tilt_(min_tilt), + max_tilt_(max_tilt), + listens_on_click_(listens_on_click), + listens_on_long_click_(listens_on_long_click) {} + +MapOptions::MapOptions(const MapOptions& other) + : style_(other.style_), + zoom_(other.zoom_), + tilt_(other.tilt_), + bearing_(other.bearing_), + center_(other.center_ ? std::make_unique(*other.center_) : nullptr), + max_bounds_(other.max_bounds_ ? std::make_unique(*other.max_bounds_) : nullptr), + min_zoom_(other.min_zoom_), + max_zoom_(other.max_zoom_), + min_tilt_(other.min_tilt_), + max_tilt_(other.max_tilt_), + listens_on_click_(other.listens_on_click_), + listens_on_long_click_(other.listens_on_long_click_) {} + +MapOptions& MapOptions::operator=(const MapOptions& other) { + style_ = other.style_; + zoom_ = other.zoom_; + tilt_ = other.tilt_; + bearing_ = other.bearing_; + center_ = other.center_ ? std::make_unique(*other.center_) : nullptr; + max_bounds_ = other.max_bounds_ ? std::make_unique(*other.max_bounds_) : nullptr; + min_zoom_ = other.min_zoom_; + max_zoom_ = other.max_zoom_; + min_tilt_ = other.min_tilt_; + max_tilt_ = other.max_tilt_; + listens_on_click_ = other.listens_on_click_; + listens_on_long_click_ = other.listens_on_long_click_; + return *this; +} + +const std::string& MapOptions::style() const { + return style_; +} + +void MapOptions::set_style(std::string_view value_arg) { + style_ = value_arg; +} + + +double MapOptions::zoom() const { + return zoom_; +} + +void MapOptions::set_zoom(double value_arg) { + zoom_ = value_arg; +} + + +double MapOptions::tilt() const { + return tilt_; +} + +void MapOptions::set_tilt(double value_arg) { + tilt_ = value_arg; +} + + +double MapOptions::bearing() const { + return bearing_; +} + +void MapOptions::set_bearing(double value_arg) { + bearing_ = value_arg; +} + + +const LngLat* MapOptions::center() const { + return center_.get(); +} + +void MapOptions::set_center(const LngLat* value_arg) { + center_ = value_arg ? std::make_unique(*value_arg) : nullptr; +} + +void MapOptions::set_center(const LngLat& value_arg) { + center_ = std::make_unique(value_arg); +} + + +const LngLatBounds* MapOptions::max_bounds() const { + return max_bounds_.get(); +} + +void MapOptions::set_max_bounds(const LngLatBounds* value_arg) { + max_bounds_ = value_arg ? std::make_unique(*value_arg) : nullptr; +} + +void MapOptions::set_max_bounds(const LngLatBounds& value_arg) { + max_bounds_ = std::make_unique(value_arg); +} + + +double MapOptions::min_zoom() const { + return min_zoom_; +} + +void MapOptions::set_min_zoom(double value_arg) { + min_zoom_ = value_arg; +} + + +double MapOptions::max_zoom() const { + return max_zoom_; +} + +void MapOptions::set_max_zoom(double value_arg) { + max_zoom_ = value_arg; +} + + +double MapOptions::min_tilt() const { + return min_tilt_; +} + +void MapOptions::set_min_tilt(double value_arg) { + min_tilt_ = value_arg; +} + + +double MapOptions::max_tilt() const { + return max_tilt_; +} + +void MapOptions::set_max_tilt(double value_arg) { + max_tilt_ = value_arg; +} + + +bool MapOptions::listens_on_click() const { + return listens_on_click_; +} + +void MapOptions::set_listens_on_click(bool value_arg) { + listens_on_click_ = value_arg; +} + + +bool MapOptions::listens_on_long_click() const { + return listens_on_long_click_; +} + +void MapOptions::set_listens_on_long_click(bool value_arg) { + listens_on_long_click_ = value_arg; +} + + +EncodableList MapOptions::ToEncodableList() const { + EncodableList list; + list.reserve(12); + list.push_back(EncodableValue(style_)); + list.push_back(EncodableValue(zoom_)); + list.push_back(EncodableValue(tilt_)); + list.push_back(EncodableValue(bearing_)); + list.push_back(center_ ? CustomEncodableValue(*center_) : EncodableValue()); + list.push_back(max_bounds_ ? CustomEncodableValue(*max_bounds_) : EncodableValue()); + list.push_back(EncodableValue(min_zoom_)); + list.push_back(EncodableValue(max_zoom_)); + list.push_back(EncodableValue(min_tilt_)); + list.push_back(EncodableValue(max_tilt_)); + list.push_back(EncodableValue(listens_on_click_)); + list.push_back(EncodableValue(listens_on_long_click_)); + return list; +} + +MapOptions MapOptions::FromEncodableList(const EncodableList& list) { + MapOptions decoded( + std::get(list[0]), + std::get(list[1]), + std::get(list[2]), + std::get(list[3]), + std::get(list[6]), + std::get(list[7]), + std::get(list[8]), + std::get(list[9]), + std::get(list[10]), + std::get(list[11])); + auto& encodable_center = list[4]; + if (!encodable_center.IsNull()) { + decoded.set_center(std::any_cast(std::get(encodable_center))); + } + auto& encodable_max_bounds = list[5]; + if (!encodable_max_bounds.IsNull()) { + decoded.set_max_bounds(std::any_cast(std::get(encodable_max_bounds))); + } + return decoded; +} + // LngLat LngLat::LngLat( @@ -276,15 +513,18 @@ EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast(enum_arg_value)); } case 131: { - return CustomEncodableValue(LngLat::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(MapOptions::FromEncodableList(std::get(ReadValue(stream)))); } case 132: { - return CustomEncodableValue(ScreenLocation::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(LngLat::FromEncodableList(std::get(ReadValue(stream)))); } case 133: { - return CustomEncodableValue(MapCamera::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(ScreenLocation::FromEncodableList(std::get(ReadValue(stream)))); } case 134: { + return CustomEncodableValue(MapCamera::FromEncodableList(std::get(ReadValue(stream)))); + } + case 135: { return CustomEncodableValue(LngLatBounds::FromEncodableList(std::get(ReadValue(stream)))); } default: @@ -306,23 +546,28 @@ void PigeonInternalCodecSerializer::WriteValue( WriteValue(EncodableValue(static_cast(std::any_cast(*custom_value))), stream); return; } - if (custom_value->type() == typeid(LngLat)) { + if (custom_value->type() == typeid(MapOptions)) { stream->WriteByte(131); + WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); + return; + } + if (custom_value->type() == typeid(LngLat)) { + stream->WriteByte(132); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(ScreenLocation)) { - stream->WriteByte(132); + stream->WriteByte(133); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(MapCamera)) { - stream->WriteByte(133); + stream->WriteByte(134); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(LngLatBounds)) { - stream->WriteByte(134); + stream->WriteByte(135); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } @@ -330,4 +575,1437 @@ void PigeonInternalCodecSerializer::WriteValue( flutter::StandardCodecSerializer::WriteValue(value, stream); } +/// The codec used by MapLibreHostApi. +const flutter::StandardMessageCodec& MapLibreHostApi::GetCodec() { + return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); +} + +// Sets up an instance of `MapLibreHostApi` to handle messages through the `binary_messenger`. +void MapLibreHostApi::SetUp( + flutter::BinaryMessenger* binary_messenger, + MapLibreHostApi* api) { + MapLibreHostApi::SetUp(binary_messenger, api, ""); +} + +void MapLibreHostApi::SetUp( + flutter::BinaryMessenger* binary_messenger, + MapLibreHostApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_center_arg = args.at(0); + const auto* center_arg = encodable_center_arg.IsNull() ? nullptr : &(std::any_cast(std::get(encodable_center_arg))); + const auto& encodable_zoom_arg = args.at(1); + const auto* zoom_arg = std::get_if(&encodable_zoom_arg); + const auto& encodable_bearing_arg = args.at(2); + const auto* bearing_arg = std::get_if(&encodable_bearing_arg); + const auto& encodable_pitch_arg = args.at(3); + const auto* pitch_arg = std::get_if(&encodable_pitch_arg); + api->JumpTo(center_arg, zoom_arg, bearing_arg, pitch_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_center_arg = args.at(0); + const auto* center_arg = encodable_center_arg.IsNull() ? nullptr : &(std::any_cast(std::get(encodable_center_arg))); + const auto& encodable_zoom_arg = args.at(1); + const auto* zoom_arg = std::get_if(&encodable_zoom_arg); + const auto& encodable_bearing_arg = args.at(2); + const auto* bearing_arg = std::get_if(&encodable_bearing_arg); + const auto& encodable_pitch_arg = args.at(3); + const auto* pitch_arg = std::get_if(&encodable_pitch_arg); + const auto& encodable_duration_ms_arg = args.at(4); + if (encodable_duration_ms_arg.IsNull()) { + reply(WrapError("duration_ms_arg unexpectedly null.")); + return; + } + const int64_t duration_ms_arg = encodable_duration_ms_arg.LongValue(); + api->FlyTo(center_arg, zoom_arg, bearing_arg, pitch_arg, duration_ms_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getCamera" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + api->GetCamera([reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getVisibleRegion" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + api->GetVisibleRegion([reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_lng_arg = args.at(0); + if (encodable_lng_arg.IsNull()) { + reply(WrapError("lng_arg unexpectedly null.")); + return; + } + const auto& lng_arg = std::get(encodable_lng_arg); + const auto& encodable_lat_arg = args.at(1); + if (encodable_lat_arg.IsNull()) { + reply(WrapError("lat_arg unexpectedly null.")); + return; + } + const auto& lat_arg = std::get(encodable_lat_arg); + api->ToScreenLocation(lng_arg, lat_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_x_arg = args.at(0); + if (encodable_x_arg.IsNull()) { + reply(WrapError("x_arg unexpectedly null.")); + return; + } + const auto& x_arg = std::get(encodable_x_arg); + const auto& encodable_y_arg = args.at(1); + if (encodable_y_arg.IsNull()) { + reply(WrapError("y_arg unexpectedly null.")); + return; + } + const auto& y_arg = std::get(encodable_y_arg); + api->ToLngLat(x_arg, y_arg, [reply](ErrorOr&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(CustomEncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddFillLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddCircleLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addBackgroundLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_layout_arg = args.at(1); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(2); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(3); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddBackgroundLayer(id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillExtrusionLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddFillExtrusionLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHeatmapLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddHeatmapLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addHillshadeLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddHillshadeLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addLineLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddLineLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddRasterLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addSymbolLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_source_id_arg = args.at(1); + if (encodable_source_id_arg.IsNull()) { + reply(WrapError("source_id_arg unexpectedly null.")); + return; + } + const auto& source_id_arg = std::get(encodable_source_id_arg); + const auto& encodable_layout_arg = args.at(2); + if (encodable_layout_arg.IsNull()) { + reply(WrapError("layout_arg unexpectedly null.")); + return; + } + const auto& layout_arg = std::get(encodable_layout_arg); + const auto& encodable_paint_arg = args.at(3); + if (encodable_paint_arg.IsNull()) { + reply(WrapError("paint_arg unexpectedly null.")); + return; + } + const auto& paint_arg = std::get(encodable_paint_arg); + const auto& encodable_below_layer_id_arg = args.at(4); + const auto* below_layer_id_arg = std::get_if(&encodable_below_layer_id_arg); + api->AddSymbolLayer(id_arg, source_id_arg, layout_arg, paint_arg, below_layer_id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeLayer" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + api->RemoveLayer(id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + api->RemoveSource(id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.loadImage" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_url_arg = args.at(0); + if (encodable_url_arg.IsNull()) { + reply(WrapError("url_arg unexpectedly null.")); + return; + } + const auto& url_arg = std::get(encodable_url_arg); + api->LoadImage(url_arg, [reply](ErrorOr>&& output) { + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImage" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_bytes_arg = args.at(1); + if (encodable_bytes_arg.IsNull()) { + reply(WrapError("bytes_arg unexpectedly null.")); + return; + } + const auto& bytes_arg = std::get>(encodable_bytes_arg); + api->AddImage(id_arg, bytes_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.removeImage" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + api->RemoveImage(id_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_data_arg = args.at(1); + if (encodable_data_arg.IsNull()) { + reply(WrapError("data_arg unexpectedly null.")); + return; + } + const auto& data_arg = std::get(encodable_data_arg); + api->AddGeoJsonSource(id_arg, data_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateGeoJsonSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_data_arg = args.at(1); + if (encodable_data_arg.IsNull()) { + reply(WrapError("data_arg unexpectedly null.")); + return; + } + const auto& data_arg = std::get(encodable_data_arg); + api->UpdateGeoJsonSource(id_arg, data_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addImageSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_url_arg = args.at(1); + if (encodable_url_arg.IsNull()) { + reply(WrapError("url_arg unexpectedly null.")); + return; + } + const auto& url_arg = std::get(encodable_url_arg); + const auto& encodable_coordinates_arg = args.at(2); + if (encodable_coordinates_arg.IsNull()) { + reply(WrapError("coordinates_arg unexpectedly null.")); + return; + } + const auto& coordinates_arg = std::get(encodable_coordinates_arg); + api->AddImageSource(id_arg, url_arg, coordinates_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_url_arg = args.at(1); + const auto* url_arg = std::get_if(&encodable_url_arg); + const auto& encodable_tiles_arg = args.at(2); + const auto* tiles_arg = std::get_if(&encodable_tiles_arg); + const auto& encodable_bounds_arg = args.at(3); + if (encodable_bounds_arg.IsNull()) { + reply(WrapError("bounds_arg unexpectedly null.")); + return; + } + const auto& bounds_arg = std::get(encodable_bounds_arg); + const auto& encodable_min_zoom_arg = args.at(4); + if (encodable_min_zoom_arg.IsNull()) { + reply(WrapError("min_zoom_arg unexpectedly null.")); + return; + } + const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); + const auto& encodable_max_zoom_arg = args.at(5); + if (encodable_max_zoom_arg.IsNull()) { + reply(WrapError("max_zoom_arg unexpectedly null.")); + return; + } + const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); + const auto& encodable_tile_size_arg = args.at(6); + if (encodable_tile_size_arg.IsNull()) { + reply(WrapError("tile_size_arg unexpectedly null.")); + return; + } + const int64_t tile_size_arg = encodable_tile_size_arg.LongValue(); + const auto& encodable_scheme_arg = args.at(7); + if (encodable_scheme_arg.IsNull()) { + reply(WrapError("scheme_arg unexpectedly null.")); + return; + } + const auto& scheme_arg = std::any_cast(std::get(encodable_scheme_arg)); + const auto& encodable_attribution_arg = args.at(8); + const auto* attribution_arg = std::get_if(&encodable_attribution_arg); + const auto& encodable_volatile_arg = args.at(9); + if (encodable_volatile_arg.IsNull()) { + reply(WrapError("volatile_arg unexpectedly null.")); + return; + } + const auto& volatile_arg = std::get(encodable_volatile_arg); + api->AddRasterSource(id_arg, url_arg, tiles_arg, bounds_arg, min_zoom_arg, max_zoom_arg, tile_size_arg, scheme_arg, attribution_arg, volatile_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addRasterDemSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_url_arg = args.at(1); + const auto* url_arg = std::get_if(&encodable_url_arg); + const auto& encodable_tiles_arg = args.at(2); + const auto* tiles_arg = std::get_if(&encodable_tiles_arg); + const auto& encodable_bounds_arg = args.at(3); + if (encodable_bounds_arg.IsNull()) { + reply(WrapError("bounds_arg unexpectedly null.")); + return; + } + const auto& bounds_arg = std::get(encodable_bounds_arg); + const auto& encodable_min_zoom_arg = args.at(4); + if (encodable_min_zoom_arg.IsNull()) { + reply(WrapError("min_zoom_arg unexpectedly null.")); + return; + } + const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); + const auto& encodable_max_zoom_arg = args.at(5); + if (encodable_max_zoom_arg.IsNull()) { + reply(WrapError("max_zoom_arg unexpectedly null.")); + return; + } + const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); + const auto& encodable_tile_size_arg = args.at(6); + if (encodable_tile_size_arg.IsNull()) { + reply(WrapError("tile_size_arg unexpectedly null.")); + return; + } + const int64_t tile_size_arg = encodable_tile_size_arg.LongValue(); + const auto& encodable_attribution_arg = args.at(7); + const auto* attribution_arg = std::get_if(&encodable_attribution_arg); + const auto& encodable_encoding_arg = args.at(8); + if (encodable_encoding_arg.IsNull()) { + reply(WrapError("encoding_arg unexpectedly null.")); + return; + } + const auto& encoding_arg = std::any_cast(std::get(encodable_encoding_arg)); + const auto& encodable_volatile_arg = args.at(9); + if (encodable_volatile_arg.IsNull()) { + reply(WrapError("volatile_arg unexpectedly null.")); + return; + } + const auto& volatile_arg = std::get(encodable_volatile_arg); + const auto& encodable_red_factor_arg = args.at(10); + if (encodable_red_factor_arg.IsNull()) { + reply(WrapError("red_factor_arg unexpectedly null.")); + return; + } + const auto& red_factor_arg = std::get(encodable_red_factor_arg); + const auto& encodable_blue_factor_arg = args.at(11); + if (encodable_blue_factor_arg.IsNull()) { + reply(WrapError("blue_factor_arg unexpectedly null.")); + return; + } + const auto& blue_factor_arg = std::get(encodable_blue_factor_arg); + const auto& encodable_green_factor_arg = args.at(12); + if (encodable_green_factor_arg.IsNull()) { + reply(WrapError("green_factor_arg unexpectedly null.")); + return; + } + const auto& green_factor_arg = std::get(encodable_green_factor_arg); + const auto& encodable_base_shift_arg = args.at(13); + if (encodable_base_shift_arg.IsNull()) { + reply(WrapError("base_shift_arg unexpectedly null.")); + return; + } + const auto& base_shift_arg = std::get(encodable_base_shift_arg); + api->AddRasterDemSource(id_arg, url_arg, tiles_arg, bounds_arg, min_zoom_arg, max_zoom_arg, tile_size_arg, attribution_arg, encoding_arg, volatile_arg, red_factor_arg, blue_factor_arg, green_factor_arg, base_shift_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.addVectorSource" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_id_arg = args.at(0); + if (encodable_id_arg.IsNull()) { + reply(WrapError("id_arg unexpectedly null.")); + return; + } + const auto& id_arg = std::get(encodable_id_arg); + const auto& encodable_url_arg = args.at(1); + const auto* url_arg = std::get_if(&encodable_url_arg); + const auto& encodable_tiles_arg = args.at(2); + const auto* tiles_arg = std::get_if(&encodable_tiles_arg); + const auto& encodable_bounds_arg = args.at(3); + if (encodable_bounds_arg.IsNull()) { + reply(WrapError("bounds_arg unexpectedly null.")); + return; + } + const auto& bounds_arg = std::get(encodable_bounds_arg); + const auto& encodable_scheme_arg = args.at(4); + if (encodable_scheme_arg.IsNull()) { + reply(WrapError("scheme_arg unexpectedly null.")); + return; + } + const auto& scheme_arg = std::any_cast(std::get(encodable_scheme_arg)); + const auto& encodable_min_zoom_arg = args.at(5); + if (encodable_min_zoom_arg.IsNull()) { + reply(WrapError("min_zoom_arg unexpectedly null.")); + return; + } + const auto& min_zoom_arg = std::get(encodable_min_zoom_arg); + const auto& encodable_max_zoom_arg = args.at(6); + if (encodable_max_zoom_arg.IsNull()) { + reply(WrapError("max_zoom_arg unexpectedly null.")); + return; + } + const auto& max_zoom_arg = std::get(encodable_max_zoom_arg); + const auto& encodable_attribution_arg = args.at(7); + const auto* attribution_arg = std::get_if(&encodable_attribution_arg); + const auto& encodable_volatile_arg = args.at(8); + if (encodable_volatile_arg.IsNull()) { + reply(WrapError("volatile_arg unexpectedly null.")); + return; + } + const auto& volatile_arg = std::get(encodable_volatile_arg); + const auto& encodable_source_layer_arg = args.at(9); + const auto* source_layer_arg = std::get_if(&encodable_source_layer_arg); + api->AddVectorSource(id_arg, url_arg, tiles_arg, bounds_arg, scheme_arg, min_zoom_arg, max_zoom_arg, attribution_arg, volatile_arg, source_layer_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.getMetersPerPixelAtLatitude" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_latitude_arg = args.at(0); + if (encodable_latitude_arg.IsNull()) { + reply(WrapError("latitude_arg unexpectedly null.")); + return; + } + const auto& latitude_arg = std::get(encodable_latitude_arg); + ErrorOr output = api->GetMetersPerPixelAtLatitude(latitude_arg); + if (output.has_error()) { + reply(WrapError(output.error())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue(std::move(output).TakeValue())); + reply(EncodableValue(std::move(wrapped))); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } + { + BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.maplibre.MapLibreHostApi.updateOptions" + prepended_suffix, &GetCodec()); + if (api != nullptr) { + channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + try { + const auto& args = std::get(message); + const auto& encodable_options_arg = args.at(0); + if (encodable_options_arg.IsNull()) { + reply(WrapError("options_arg unexpectedly null.")); + return; + } + const auto& options_arg = std::any_cast(std::get(encodable_options_arg)); + api->UpdateOptions(options_arg, [reply](std::optional&& output) { + if (output.has_value()) { + reply(WrapError(output.value())); + return; + } + EncodableList wrapped; + wrapped.push_back(EncodableValue()); + reply(EncodableValue(std::move(wrapped))); + }); + } catch (const std::exception& exception) { + reply(WrapError(exception.what())); + } + }); + } else { + channel.SetMessageHandler(nullptr); + } + } +} + +EncodableValue MapLibreHostApi::WrapError(std::string_view error_message) { + return EncodableValue(EncodableList{ + EncodableValue(std::string(error_message)), + EncodableValue("Error"), + EncodableValue() + }); +} + +EncodableValue MapLibreHostApi::WrapError(const FlutterError& error) { + return EncodableValue(EncodableList{ + EncodableValue(error.code()), + EncodableValue(error.message()), + error.details() + }); +} + +// Generated class from Pigeon that represents Flutter messages that can be called from C++. +MapLibreFlutterApi::MapLibreFlutterApi(flutter::BinaryMessenger* binary_messenger) + : binary_messenger_(binary_messenger), + message_channel_suffix_("") {} + +MapLibreFlutterApi::MapLibreFlutterApi( + flutter::BinaryMessenger* binary_messenger, + const std::string& message_channel_suffix) + : binary_messenger_(binary_messenger), + message_channel_suffix_(message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : "") {} + +const flutter::StandardMessageCodec& MapLibreFlutterApi::GetCodec() { + return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); +} + +void MapLibreFlutterApi::GetOptions( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + const auto& return_value = std::any_cast(std::get(list_return_value->at(0))); + on_success(return_value); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnStyleLoaded( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnClick( + const LngLat& point_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(point_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnIdle( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onIdle" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnCameraIdle( + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraIdle" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnSecondaryClick( + const LngLat& point_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(point_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnDoubleClick( + const LngLat& point_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(point_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnLongClick( + const LngLat& point_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(point_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + +void MapLibreFlutterApi::OnCameraMoved( + const MapCamera& camera_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(camera_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + } // namespace pigeon_maplibre diff --git a/windows/runner/pigeon.g.h b/windows/runner/pigeon.g.h index 6242927..4a56e63 100644 --- a/windows/runner/pigeon.g.h +++ b/windows/runner/pigeon.g.h @@ -36,6 +36,27 @@ class FlutterError { flutter::EncodableValue details_; }; +template class ErrorOr { + public: + ErrorOr(const T& rhs) : v_(rhs) {} + ErrorOr(const T&& rhs) : v_(std::move(rhs)) {} + ErrorOr(const FlutterError& rhs) : v_(rhs) {} + ErrorOr(const FlutterError&& rhs) : v_(std::move(rhs)) {} + + bool has_error() const { return std::holds_alternative(v_); } + const T& value() const { return std::get(v_); }; + const FlutterError& error() const { return std::get(v_); }; + + private: + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; + ErrorOr() = default; + T TakeValue() && { return std::get(std::move(v_)); } + + std::variant v_; +}; + + // Influences the y direction of the tile coordinates. enum class TileScheme { // Slippy map tilenames scheme. @@ -56,6 +77,117 @@ enum class RasterDemEncoding { }; +// The map options define initial values for the MapLibre map. +// +// Generated class from Pigeon that represents data sent in messages. +class MapOptions { + public: + // Constructs an object setting all non-nullable fields. + explicit MapOptions( + const std::string& style, + double zoom, + double tilt, + double bearing, + double min_zoom, + double max_zoom, + double min_tilt, + double max_tilt, + bool listens_on_click, + bool listens_on_long_click); + + // Constructs an object setting all fields. + explicit MapOptions( + const std::string& style, + double zoom, + double tilt, + double bearing, + const LngLat* center, + const LngLatBounds* max_bounds, + double min_zoom, + double max_zoom, + double min_tilt, + double max_tilt, + bool listens_on_click, + bool listens_on_long_click); + + ~MapOptions() = default; + MapOptions(const MapOptions& other); + MapOptions& operator=(const MapOptions& other); + MapOptions(MapOptions&& other) = default; + MapOptions& operator=(MapOptions&& other) noexcept = default; + // The URL of the used map style. + const std::string& style() const; + void set_style(std::string_view value_arg); + + // The initial zoom level of the map. + double zoom() const; + void set_zoom(double value_arg); + + // The initial tilt of the map. + double tilt() const; + void set_tilt(double value_arg); + + // The initial bearing of the map. + double bearing() const; + void set_bearing(double value_arg); + + // The initial center coordinates of the map. + const LngLat* center() const; + void set_center(const LngLat* value_arg); + void set_center(const LngLat& value_arg); + + // The maximum bounding box of the map camera. + const LngLatBounds* max_bounds() const; + void set_max_bounds(const LngLatBounds* value_arg); + void set_max_bounds(const LngLatBounds& value_arg); + + // The minimum zoom level of the map. + double min_zoom() const; + void set_min_zoom(double value_arg); + + // The maximum zoom level of the map. + double max_zoom() const; + void set_max_zoom(double value_arg); + + // The minimum pitch / tilt of the map. + double min_tilt() const; + void set_min_tilt(double value_arg); + + // The maximum pitch / tilt of the map. + double max_tilt() const; + void set_max_tilt(double value_arg); + + // If the native map should listen to click events. + bool listens_on_click() const; + void set_listens_on_click(bool value_arg); + + // If the native map should listen to long click events. + bool listens_on_long_click() const; + void set_listens_on_long_click(bool value_arg); + + + private: + static MapOptions FromEncodableList(const flutter::EncodableList& list); + flutter::EncodableList ToEncodableList() const; + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; + friend class PigeonInternalCodecSerializer; + std::string style_; + double zoom_; + double tilt_; + double bearing_; + std::unique_ptr center_; + std::unique_ptr max_bounds_; + double min_zoom_; + double max_zoom_; + double min_tilt_; + double max_tilt_; + bool listens_on_click_; + bool listens_on_long_click_; + +}; + + // A longitude/latitude coordinate object. // // Generated class from Pigeon that represents data sent in messages. @@ -78,7 +210,10 @@ class LngLat { private: static LngLat FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; + friend class MapOptions; friend class MapCamera; + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double lng_; double lat_; @@ -108,6 +243,8 @@ class ScreenLocation { private: static ScreenLocation FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double x_; double y_; @@ -148,6 +285,8 @@ class MapCamera { private: static MapCamera FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; std::unique_ptr center_; double zoom_; @@ -185,6 +324,9 @@ class LngLatBounds { private: static LngLatBounds FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; + friend class MapOptions; + friend class MapLibreHostApi; + friend class MapLibreFlutterApi; friend class PigeonInternalCodecSerializer; double longitude_west_; double longitude_east_; @@ -213,5 +355,274 @@ class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { }; +// Generated interface from Pigeon that represents a handler of messages from Flutter. +class MapLibreHostApi { + public: + MapLibreHostApi(const MapLibreHostApi&) = delete; + MapLibreHostApi& operator=(const MapLibreHostApi&) = delete; + virtual ~MapLibreHostApi() {} + // Move the viewport of the map to a new location without any animation. + virtual void JumpTo( + const LngLat* center, + const double* zoom, + const double* bearing, + const double* pitch, + std::function reply)> result) = 0; + // Animate the viewport of the map to a new location. + virtual void FlyTo( + const LngLat* center, + const double* zoom, + const double* bearing, + const double* pitch, + int64_t duration_ms, + std::function reply)> result) = 0; + // Get the current camera position with the map center, zoom level, camera + // tilt and map rotation. + virtual void GetCamera(std::function reply)> result) = 0; + // Get the visible region of the current map camera. + virtual void GetVisibleRegion(std::function reply)> result) = 0; + // Convert a coordinate to a location on the screen. + virtual void ToScreenLocation( + double lng, + double lat, + std::function reply)> result) = 0; + // Convert a screen location to a coordinate. + virtual void ToLngLat( + double x, + double y, + std::function reply)> result) = 0; + // Add a fill layer to the map style. + virtual void AddFillLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a circle layer to the map style. + virtual void AddCircleLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a background layer to the map style. + virtual void AddBackgroundLayer( + const std::string& id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a fill extrusion layer to the map style. + virtual void AddFillExtrusionLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a heatmap layer to the map style. + virtual void AddHeatmapLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a hillshade layer to the map style. + virtual void AddHillshadeLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a line layer to the map style. + virtual void AddLineLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a raster layer to the map style. + virtual void AddRasterLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Add a symbol layer to the map style. + virtual void AddSymbolLayer( + const std::string& id, + const std::string& source_id, + const flutter::EncodableMap& layout, + const flutter::EncodableMap& paint, + const std::string* below_layer_id, + std::function reply)> result) = 0; + // Removes the layer with the given ID from the map's style. + virtual void RemoveLayer( + const std::string& id, + std::function reply)> result) = 0; + // Removes the source with the given ID from the map's style. + virtual void RemoveSource( + const std::string& id, + std::function reply)> result) = 0; + // Loads an image to the map. An image needs to be loaded before it can + // get used. + virtual void LoadImage( + const std::string& url, + std::function> reply)> result) = 0; + // Add an image to the map. + virtual void AddImage( + const std::string& id, + const std::vector& bytes, + std::function reply)> result) = 0; + // Removes an image from the map + virtual void RemoveImage( + const std::string& id, + std::function reply)> result) = 0; + // Add a GeoJSON source to the map style. + virtual void AddGeoJsonSource( + const std::string& id, + const std::string& data, + std::function reply)> result) = 0; + // Update the data of a GeoJSON source. + virtual void UpdateGeoJsonSource( + const std::string& id, + const std::string& data, + std::function reply)> result) = 0; + // Add a image source to the map style. + virtual void AddImageSource( + const std::string& id, + const std::string& url, + const flutter::EncodableList& coordinates, + std::function reply)> result) = 0; + // Add a raster source to the map style. + virtual void AddRasterSource( + const std::string& id, + const std::string* url, + const flutter::EncodableList* tiles, + const flutter::EncodableList& bounds, + double min_zoom, + double max_zoom, + int64_t tile_size, + const TileScheme& scheme, + const std::string* attribution, + bool volatile, + std::function reply)> result) = 0; + // Add a raster DEM source to the map style. + virtual void AddRasterDemSource( + const std::string& id, + const std::string* url, + const flutter::EncodableList* tiles, + const flutter::EncodableList& bounds, + double min_zoom, + double max_zoom, + int64_t tile_size, + const std::string* attribution, + const RasterDemEncoding& encoding, + bool volatile, + double red_factor, + double blue_factor, + double green_factor, + double base_shift, + std::function reply)> result) = 0; + // Add a vector source to the map style. + virtual void AddVectorSource( + const std::string& id, + const std::string* url, + const flutter::EncodableList* tiles, + const flutter::EncodableList& bounds, + const TileScheme& scheme, + double min_zoom, + double max_zoom, + const std::string* attribution, + bool volatile, + const std::string* source_layer, + std::function reply)> result) = 0; + // Returns the distance spanned by one pixel at the specified latitude and + // current zoom level. + virtual ErrorOr GetMetersPerPixelAtLatitude(double latitude) = 0; + // Update the map options. + virtual void UpdateOptions( + const MapOptions& options, + std::function reply)> result) = 0; + + // The codec used by MapLibreHostApi. + static const flutter::StandardMessageCodec& GetCodec(); + // Sets up an instance of `MapLibreHostApi` to handle messages through the `binary_messenger`. + static void SetUp( + flutter::BinaryMessenger* binary_messenger, + MapLibreHostApi* api); + static void SetUp( + flutter::BinaryMessenger* binary_messenger, + MapLibreHostApi* api, + const std::string& message_channel_suffix); + static flutter::EncodableValue WrapError(std::string_view error_message); + static flutter::EncodableValue WrapError(const FlutterError& error); + + protected: + MapLibreHostApi() = default; + +}; +// Generated class from Pigeon that represents Flutter messages that can be called from C++. +class MapLibreFlutterApi { + public: + MapLibreFlutterApi(flutter::BinaryMessenger* binary_messenger); + MapLibreFlutterApi( + flutter::BinaryMessenger* binary_messenger, + const std::string& message_channel_suffix); + static const flutter::StandardMessageCodec& GetCodec(); + // Get the map options from dart. + void GetOptions( + std::function&& on_success, + std::function&& on_error); + // Callback for when the style has been loaded. + void OnStyleLoaded( + std::function&& on_success, + std::function&& on_error); + // Callback when the user clicks on the map. + void OnClick( + const LngLat& point, + std::function&& on_success, + std::function&& on_error); + // Callback when the map idles. + void OnIdle( + std::function&& on_success, + std::function&& on_error); + // Callback when the map camera idles. + void OnCameraIdle( + std::function&& on_success, + std::function&& on_error); + // Callback when the user performs a secondary click on the map + // (e.g. by default a click with the right mouse button). + void OnSecondaryClick( + const LngLat& point, + std::function&& on_success, + std::function&& on_error); + // Callback when the user performs a double click on the map. + void OnDoubleClick( + const LngLat& point, + std::function&& on_success, + std::function&& on_error); + // Callback when the user performs a long lasting click on the map. + void OnLongClick( + const LngLat& point, + std::function&& on_success, + std::function&& on_error); + // Callback when the map camera changes. + void OnCameraMoved( + const MapCamera& camera, + std::function&& on_success, + std::function&& on_error); + + private: + flutter::BinaryMessenger* binary_messenger_; + std::string message_channel_suffix_; +}; + } // namespace pigeon_maplibre #endif // PIGEON_PIGEON_G_H_ From d4a2003c6fe475f88d813a90ddd795a7e18b8614 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:19:45 +0200 Subject: [PATCH 8/8] add MapEventStartMoveCamera event --- .../josxha/maplibre/MapLibreMapController.kt | 14 +- .../com/github/josxha/maplibre/Pigeon.g.kt | 65 +++++- docs/docs/map-events.md | 23 +- example/lib/events_page.dart | 14 +- ios/Classes/Pigeon.g.swift | 64 +++++- lib/src/map_events.dart | 51 +++-- lib/src/native/pigeon.g.dart | 79 +++++-- lib/src/native/widget_state.dart | 23 +- lib/src/web/interop/events.dart | 3 + lib/src/web/widget_state.dart | 50 +++-- linux/pigeon.g.cc | 207 +++++++++++++----- linux/pigeon.g.h | 123 +++++++++-- macos/Classes/Pigeon.g.swift | 64 +++++- pigeons/pigeon.dart | 17 +- windows/runner/pigeon.g.cpp | 57 ++++- windows/runner/pigeon.g.h | 17 +- 16 files changed, 670 insertions(+), 201 deletions(-) diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt index 01a9c6b..4a5d00e 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreMapController.kt @@ -25,6 +25,9 @@ import org.maplibre.android.geometry.LatLng import org.maplibre.android.geometry.LatLngBounds import org.maplibre.android.geometry.LatLngQuad import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_ANIMATION +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_GESTURE +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION import org.maplibre.android.maps.MapLibreMapOptions import org.maplibre.android.maps.MapView import org.maplibre.android.maps.OnMapReadyCallback @@ -124,10 +127,19 @@ class MapLibreMapController( val target = mapLibreMap.cameraPosition.target!! val center = LngLat(target.longitude, target.latitude) val camera = MapCamera(center, position.zoom, position.tilt, position.bearing) - flutterApi.onCameraMoved(camera) {} + flutterApi.onMoveCamera(camera) {} } this.mapLibreMap.addOnCameraIdleListener { flutterApi.onCameraIdle { } } this.mapView.addOnDidBecomeIdleListener { flutterApi.onIdle { } } + this.mapLibreMap.addOnCameraMoveStartedListener { reason -> + val changeReason = when (reason) { + REASON_API_ANIMATION -> CameraChangeReason.API_ANIMATION + REASON_API_GESTURE -> CameraChangeReason.API_GESTURE + REASON_DEVELOPER_ANIMATION -> CameraChangeReason.DEVELOPER_ANIMATION + else -> null + } + if (changeReason != null) flutterApi.onStartMoveCamera(changeReason) { } + } val style = Style.Builder().fromUri(mapOptions.style) mapLibreMap.setStyle(style) { loadedStyle -> this.style = loadedStyle diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt index cdb570c..70076ba 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt @@ -79,6 +79,22 @@ enum class RasterDemEncoding(val raw: Int) { } } +/** The reason the camera is changing. */ +enum class CameraChangeReason(val raw: Int) { + /** Developer animation. */ + DEVELOPER_ANIMATION(0), + /** API animation. */ + API_ANIMATION(1), + /** API gesture */ + API_GESTURE(2); + + companion object { + fun ofRaw(raw: Int): CameraChangeReason? { + return values().firstOrNull { it.raw == raw } + } + } +} + /** * The map options define initial values for the MapLibre map. * @@ -275,26 +291,31 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { } } 131.toByte() -> { + return (readValue(buffer) as Long?)?.let { + CameraChangeReason.ofRaw(it.toInt()) + } + } + 132.toByte() -> { return (readValue(buffer) as? List)?.let { MapOptions.fromList(it) } } - 132.toByte() -> { + 133.toByte() -> { return (readValue(buffer) as? List)?.let { LngLat.fromList(it) } } - 133.toByte() -> { + 134.toByte() -> { return (readValue(buffer) as? List)?.let { ScreenLocation.fromList(it) } } - 134.toByte() -> { + 135.toByte() -> { return (readValue(buffer) as? List)?.let { MapCamera.fromList(it) } } - 135.toByte() -> { + 136.toByte() -> { return (readValue(buffer) as? List)?.let { LngLatBounds.fromList(it) } @@ -312,24 +333,28 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { stream.write(130) writeValue(stream, value.raw) } - is MapOptions -> { + is CameraChangeReason -> { stream.write(131) + writeValue(stream, value.raw) + } + is MapOptions -> { + stream.write(132) writeValue(stream, value.toList()) } is LngLat -> { - stream.write(132) + stream.write(133) writeValue(stream, value.toList()) } is ScreenLocation -> { - stream.write(133) + stream.write(134) writeValue(stream, value.toList()) } is MapCamera -> { - stream.write(134) + stream.write(135) writeValue(stream, value.toList()) } is LngLatBounds -> { - stream.write(135) + stream.write(136) writeValue(stream, value.toList()) } else -> super.writeValue(stream, value) @@ -1188,10 +1213,10 @@ class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private v } } /** Callback when the map camera changes. */ - fun onCameraMoved(cameraArg: MapCamera, callback: (Result) -> Unit) + fun onMoveCamera(cameraArg: MapCamera, callback: (Result) -> Unit) { val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$separatedMessageChannelSuffix" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(cameraArg)) { if (it is List<*>) { @@ -1205,4 +1230,22 @@ class MapLibreFlutterApi(private val binaryMessenger: BinaryMessenger, private v } } } + /** Callback when the map camera starts changing. */ + fun onStartMoveCamera(reasonArg: CameraChangeReason, callback: (Result) -> Unit) +{ + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(reasonArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(createConnectionError(channelName))) + } + } + } } diff --git a/docs/docs/map-events.md b/docs/docs/map-events.md index 3f07029..235e630 100644 --- a/docs/docs/map-events.md +++ b/docs/docs/map-events.md @@ -59,27 +59,12 @@ void _onEvent(event) { |--------------------------|-------------|-----------------------------------|-----|---------|-------|-------| | MapEventMapCreated | | | | | | | | MapEventStyleLoaded | load | (OnDidFinishLoadingStyleListener) | | | | | -| MapEventClicked | click | | | | | | +| MapEventClicked | click | OnMapClickListener | | | | | | MapEventDoubleClicked | dblclick | | | | | | | MapEventSecondaryClicked | contextmenu | | | | | | -| MapEventLongClicked | | | | | | | -| | drag | | | | | | -| | dragstart | | | | | | -| | dragend | | | | | | -| | error | | | | | | +| MapEventLongClicked | | OnMapLongClickListener | | | | | | MapEventIdle | idle | OnDidBecomeIdleListener | | | | | | | mousedown | | | | | | -| | mousemove | | | | | | -| | mouseout | | | | | | -| | mouseover | | | | | | -| | mouseup | | | | | | -| onCameraMoved | move | OnCameraMoveListener | | | | | +| MapEventStartMoveCamera | | OnCameraMoveStartedListener | | | | | +| MapEventMoveCamera | move | OnCameraMoveListener | | | | | | MapEventCameraIdle | moveend | OnCameraMoveCanceledListener | | | | | -| | pitch | | | | | | -| | rotate | | | | | | -| | touchcancel | | | | | | -| | touchmove | | | | | | -| | touchstart | | | | | | -| | wheel | | | | | | -| | zoom | | | | | | -| | zoomend | | | | | | diff --git a/example/lib/events_page.dart b/example/lib/events_page.dart index f464e37..6ffb07c 100644 --- a/example/lib/events_page.dart +++ b/example/lib/events_page.dart @@ -39,18 +39,20 @@ class _EventsPageState extends State { void _onEvent(MapEvent event) => switch (event) { MapEventMapCreated() => _print('map created'), MapEventStyleLoaded() => _print('style loaded'), - MapEventCameraMoved() => _print( - 'camera moved: center ${_formatPosition(event.camera.center)}, ' + MapEventMoveCamera() => _print( + 'move camera: center ${_formatPosition(event.camera.center)}, ' 'zoom ${event.camera.zoom.toStringAsFixed(2)}, ' 'tilt ${event.camera.tilt.toStringAsFixed(2)}, ' 'bearing ${event.camera.bearing.toStringAsFixed(2)}', ), - MapEventClicked() => _print('clicked: ${_formatPosition(event.point)}'), - MapEventDoubleClicked() => + MapEventStartMoveCamera() => + _print('start move camera, reason: ${event.reason.name}'), + MapEventClick() => _print('clicked: ${_formatPosition(event.point)}'), + MapEventDoubleClick() => _print('double clicked: ${_formatPosition(event.point)}'), - MapEventLongClicked() => + MapEventLongClick() => _print('long clicked: ${_formatPosition(event.point)}'), - MapEventSecondaryClicked() => + MapEventSecondaryClick() => _print('secondary clicked: ${_formatPosition(event.point)}'), MapEventIdle() => _print('idle'), MapEventCameraIdle() => _print('camera idle'), diff --git a/ios/Classes/Pigeon.g.swift b/ios/Classes/Pigeon.g.swift index be85aa8..e0a6b48 100644 --- a/ios/Classes/Pigeon.g.swift +++ b/ios/Classes/Pigeon.g.swift @@ -87,6 +87,16 @@ enum RasterDemEncoding: Int { case custom = 2 } +/// The reason the camera is changing. +enum CameraChangeReason: Int { + /// Developer animation. + case developerAnimation = 0 + /// API animation. + case apiAnimation = 1 + /// API gesture + case apiGesture = 2 +} + /// The map options define initial values for the MapLibre map. /// /// Generated class from Pigeon that represents data sent in messages. @@ -310,14 +320,20 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return MapOptions.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) + if let enumResultAsInt = enumResultAsInt { + return CameraChangeReason(rawValue: enumResultAsInt) + } + return nil case 132: - return LngLat.fromList(self.readValue() as! [Any?]) + return MapOptions.fromList(self.readValue() as! [Any?]) case 133: - return ScreenLocation.fromList(self.readValue() as! [Any?]) + return LngLat.fromList(self.readValue() as! [Any?]) case 134: - return MapCamera.fromList(self.readValue() as! [Any?]) + return ScreenLocation.fromList(self.readValue() as! [Any?]) case 135: + return MapCamera.fromList(self.readValue() as! [Any?]) + case 136: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -333,20 +349,23 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? MapOptions { + } else if let value = value as? CameraChangeReason { super.writeByte(131) + super.writeValue(value.rawValue) + } else if let value = value as? MapOptions { + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? LngLat { - super.writeByte(132) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? ScreenLocation { - super.writeByte(133) + super.writeByte(134) super.writeValue(value.toList()) } else if let value = value as? MapCamera { - super.writeByte(134) + super.writeByte(135) super.writeValue(value.toList()) } else if let value = value as? LngLatBounds { - super.writeByte(135) + super.writeByte(136) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -1041,7 +1060,9 @@ protocol MapLibreFlutterApiProtocol { /// Callback when the user performs a long lasting click on the map. func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) + func onMoveCamera(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) + /// Callback when the map camera starts changing. + func onStartMoveCamera(reason reasonArg: CameraChangeReason, completion: @escaping (Result) -> Void) } class MapLibreFlutterApi: MapLibreFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger @@ -1210,8 +1231,8 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" + func onMoveCamera(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([cameraArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -1228,4 +1249,23 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map camera starts changing. + func onStartMoveCamera(reason reasonArg: CameraChangeReason, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([reasonArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } } diff --git a/lib/src/map_events.dart b/lib/src/map_events.dart index fcdc2e1..41a64dc 100644 --- a/lib/src/map_events.dart +++ b/lib/src/map_events.dart @@ -22,14 +22,35 @@ final class MapEventMapCreated extends MapEvent { } /// Emitted when the map camera changes. -final class MapEventCameraMoved extends MapEvent { - /// Create a new [MapEventCameraMoved] object. - const MapEventCameraMoved({required this.camera}); +final class MapEventMoveCamera extends MapEvent { + /// Create a new [MapEventMoveCamera] object. + const MapEventMoveCamera({required this.camera}); /// The new [MapCamera]. final MapCamera camera; } +/// Emitted when the map camera changes. +final class MapEventStartMoveCamera extends MapEvent { + /// Create a new [MapEventStartMoveCamera] object. + const MapEventStartMoveCamera({required this.reason}); + + /// The reason the camera is changed. + final CameraChangeReason reason; +} + +/// The reason the camera is changing. +enum CameraChangeReason { + /// The developer programmatically caused the change of the camera. + developerAnimation, + + /// The camera change is caused by the SDK. + apiAnimation, + + /// The user caused the camera change by a gesture input. + apiGesture; +} + /// Emitted when the user interacts with the map in any way. Use this class if /// you don't care about the type of gesture. sealed class MapEventUserInput extends MapEvent { @@ -41,29 +62,29 @@ sealed class MapEventUserInput extends MapEvent { } /// Emitted when the user clicks on the map. -final class MapEventClicked extends MapEventUserInput { - /// Create a new [MapEventClicked] object. - const MapEventClicked({required super.point}); +final class MapEventClick extends MapEventUserInput { + /// Create a new [MapEventClick] object. + const MapEventClick({required super.point}); } /// Emitted when the user clicks twice in a short amount of time on the map. -final class MapEventDoubleClicked extends MapEventUserInput { - /// Create a new [MapEventDoubleClicked] object. - const MapEventDoubleClicked({required super.point}); +final class MapEventDoubleClick extends MapEventUserInput { + /// Create a new [MapEventDoubleClick] object. + const MapEventDoubleClick({required super.point}); } /// Emitted when the user clicks with the secondary button on the map. This /// would be classically the right mouse button. -final class MapEventSecondaryClicked extends MapEventUserInput { - /// Create a new [MapEventSecondaryClicked] object. - const MapEventSecondaryClicked({required super.point}); +final class MapEventSecondaryClick extends MapEventUserInput { + /// Create a new [MapEventSecondaryClick] object. + const MapEventSecondaryClick({required super.point}); } /// Emitted when the user clicks on the map and holds button down at the same /// location for some time. -final class MapEventLongClicked extends MapEventUserInput { - /// Create a new [MapEventLongClicked] object. - const MapEventLongClicked({required super.point}); +final class MapEventLongClick extends MapEventUserInput { + /// Create a new [MapEventLongClick] object. + const MapEventLongClick({required super.point}); } /// Emitted when the map enters an idle state. diff --git a/lib/src/native/pigeon.g.dart b/lib/src/native/pigeon.g.dart index 87060c2..e6d83d3 100644 --- a/lib/src/native/pigeon.g.dart +++ b/lib/src/native/pigeon.g.dart @@ -48,6 +48,18 @@ enum RasterDemEncoding { custom, } +/// The reason the camera is changing. +enum CameraChangeReason { + /// Developer animation. + developerAnimation, + + /// API animation. + apiAnimation, + + /// API gesture + apiGesture, +} + /// The map options define initial values for the MapLibre map. class MapOptions { MapOptions({ @@ -282,20 +294,23 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is RasterDemEncoding) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is MapOptions) { + } else if (value is CameraChangeReason) { buffer.putUint8(131); + writeValue(buffer, value.index); + } else if (value is MapOptions) { + buffer.putUint8(132); writeValue(buffer, value.encode()); } else if (value is LngLat) { - buffer.putUint8(132); + buffer.putUint8(133); writeValue(buffer, value.encode()); } else if (value is ScreenLocation) { - buffer.putUint8(133); + buffer.putUint8(134); writeValue(buffer, value.encode()); } else if (value is MapCamera) { - buffer.putUint8(134); + buffer.putUint8(135); writeValue(buffer, value.encode()); } else if (value is LngLatBounds) { - buffer.putUint8(135); + buffer.putUint8(136); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -312,14 +327,17 @@ class _PigeonCodec extends StandardMessageCodec { final int? value = readValue(buffer) as int?; return value == null ? null : RasterDemEncoding.values[value]; case 131: - return MapOptions.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : CameraChangeReason.values[value]; case 132: - return LngLat.decode(readValue(buffer)!); + return MapOptions.decode(readValue(buffer)!); case 133: - return ScreenLocation.decode(readValue(buffer)!); + return LngLat.decode(readValue(buffer)!); case 134: - return MapCamera.decode(readValue(buffer)!); + return ScreenLocation.decode(readValue(buffer)!); case 135: + return MapCamera.decode(readValue(buffer)!); + case 136: return LngLatBounds.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1258,7 +1276,10 @@ abstract class MapLibreFlutterApi { void onLongClick(LngLat point); /// Callback when the map camera changes. - void onCameraMoved(MapCamera camera); + void onMoveCamera(MapCamera camera); + + /// Callback when the map camera starts changing. + void onStartMoveCamera(CameraChangeReason reason); static void setUp( MapLibreFlutterApi? api, { @@ -1479,7 +1500,7 @@ abstract class MapLibreFlutterApi { final BasicMessageChannel< Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved$messageChannelSuffix', + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1487,13 +1508,43 @@ abstract class MapLibreFlutterApi { } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null.'); + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera was null.'); final List args = (message as List?)!; final MapCamera? arg_camera = (args[0] as MapCamera?); assert(arg_camera != null, - 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved was null, expected non-null MapCamera.'); + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera was null, expected non-null MapCamera.'); + try { + api.onMoveCamera(arg_camera!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (api == null) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera was null.'); + final List args = (message as List?)!; + final CameraChangeReason? arg_reason = + (args[0] as CameraChangeReason?); + assert(arg_reason != null, + 'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera was null, expected non-null CameraChangeReason.'); try { - api.onCameraMoved(arg_camera!); + api.onStartMoveCamera(arg_reason!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); diff --git a/lib/src/native/widget_state.dart b/lib/src/native/widget_state.dart index e756b23..e3bcc5d 100644 --- a/lib/src/native/widget_state.dart +++ b/lib/src/native/widget_state.dart @@ -293,14 +293,25 @@ final class MapLibreMapStateNative extends State } @override - void onCameraMoved(pigeon.MapCamera camera) { + void onMoveCamera(pigeon.MapCamera camera) { final mapCamera = MapCamera( center: camera.center.toPosition(), zoom: camera.zoom, tilt: camera.tilt, bearing: camera.bearing, ); - widget.onEvent?.call(MapEventCameraMoved(camera: mapCamera)); + widget.onEvent?.call(MapEventMoveCamera(camera: mapCamera)); + } + + @override + void onStartMoveCamera(pigeon.CameraChangeReason reason) { + final changeReason = switch (reason) { + pigeon.CameraChangeReason.apiAnimation => CameraChangeReason.apiAnimation, + pigeon.CameraChangeReason.apiGesture => CameraChangeReason.apiGesture, + pigeon.CameraChangeReason.developerAnimation => + CameraChangeReason.developerAnimation, + }; + widget.onEvent?.call(MapEventStartMoveCamera(reason: changeReason)); } @override @@ -312,7 +323,7 @@ final class MapLibreMapStateNative extends State @override void onDoubleClick(pigeon.LngLat point) { final position = point.toPosition(); - widget.onEvent?.call(MapEventClicked(point: position)); + widget.onEvent?.call(MapEventClick(point: position)); // ignore: deprecated_member_use_from_same_package _options.onDoubleClick?.call(position); } @@ -320,7 +331,7 @@ final class MapLibreMapStateNative extends State @override void onSecondaryClick(pigeon.LngLat point) { final position = point.toPosition(); - widget.onEvent?.call(MapEventClicked(point: position)); + widget.onEvent?.call(MapEventClick(point: position)); // ignore: deprecated_member_use_from_same_package _options.onSecondaryClick?.call(position); } @@ -328,7 +339,7 @@ final class MapLibreMapStateNative extends State @override void onClick(pigeon.LngLat point) { final position = point.toPosition(); - widget.onEvent?.call(MapEventClicked(point: position)); + widget.onEvent?.call(MapEventClick(point: position)); // ignore: deprecated_member_use_from_same_package _options.onClick?.call(position); } @@ -336,7 +347,7 @@ final class MapLibreMapStateNative extends State @override void onLongClick(pigeon.LngLat point) { final position = point.toPosition(); - widget.onEvent?.call(MapEventLongClicked(point: position)); + widget.onEvent?.call(MapEventLongClick(point: position)); // ignore: deprecated_member_use_from_same_package _options.onLongClick?.call(position); } diff --git a/lib/src/web/interop/events.dart b/lib/src/web/interop/events.dart index fbc1838..1a35a2c 100644 --- a/lib/src/web/interop/events.dart +++ b/lib/src/web/interop/events.dart @@ -46,6 +46,9 @@ abstract class MapEventType { /// Fired once the map stops moving. static const moveEnd = 'moveend'; + /// Fired once the map starts moving. + static const moveStart = 'movestart'; + /// Fired after the last frame rendered before the map enters an "idle" state: // // No camera transitions are in progress diff --git a/lib/src/web/widget_state.dart b/lib/src/web/widget_state.dart index 01333e1..3194014 100644 --- a/lib/src/web/widget_state.dart +++ b/lib/src/web/widget_state.dart @@ -19,6 +19,7 @@ final class MapLibreMapStateWeb extends State late HTMLDivElement _htmlElement; late interop.JsMap _map; Completer? _moveCompleter; + bool _nextGestureCausedByController = false; MapOptions get _options => widget.options; @@ -119,7 +120,7 @@ final class MapLibreMapStateWeb extends State interop.MapEventType.click, (interop.MapMouseEvent event) { final point = event.lngLat.toPosition(); - widget.onEvent?.call(MapEventClicked(point: point)); + widget.onEvent?.call(MapEventClick(point: point)); // ignore: deprecated_member_use_from_same_package _options.onClick?.call(point); }.toJS, @@ -128,7 +129,7 @@ final class MapLibreMapStateWeb extends State interop.MapEventType.dblclick, (interop.MapMouseEvent event) { final point = event.lngLat.toPosition(); - widget.onEvent?.call(MapEventDoubleClicked(point: point)); + widget.onEvent?.call(MapEventDoubleClick(point: point)); // ignore: deprecated_member_use_from_same_package _options.onDoubleClick?.call(point); }.toJS, @@ -137,7 +138,7 @@ final class MapLibreMapStateWeb extends State interop.MapEventType.contextmenu, (interop.MapMouseEvent event) { final point = event.lngLat.toPosition(); - widget.onEvent?.call(MapEventSecondaryClicked(point: point)); + widget.onEvent?.call(MapEventSecondaryClick(point: point)); // ignore: deprecated_member_use_from_same_package _options.onSecondaryClick?.call(point); }.toJS, @@ -148,6 +149,21 @@ final class MapLibreMapStateWeb extends State widget.onEvent?.call(const MapEventIdle()); }.toJS, ); + _map.on( + interop.MapEventType.moveStart, + (interop.MapLibreEvent event) { + final CameraChangeReason reason; + if (_nextGestureCausedByController) { + _nextGestureCausedByController = false; + reason = CameraChangeReason.developerAnimation; + } else if (event.originalEvent != null) { + reason = CameraChangeReason.apiGesture; + } else { + reason = CameraChangeReason.apiAnimation; + } + widget.onEvent?.call(MapEventStartMoveCamera(reason: reason)); + }.toJS, + ); _map.on( interop.MapEventType.move, (interop.MapLibreEvent event) { @@ -157,15 +173,16 @@ final class MapLibreMapStateWeb extends State tilt: _map.getPitch().toDouble(), bearing: _map.getBearing().toDouble(), ); - widget.onEvent?.call(MapEventCameraMoved(camera: camera)); + widget.onEvent?.call(MapEventMoveCamera(camera: camera)); }.toJS, ); _map.on( interop.MapEventType.moveEnd, (interop.MapLibreEvent event) { widget.onEvent?.call(const MapEventCameraIdle()); - if (_moveCompleter?.isCompleted ?? true) return; - _moveCompleter?.complete(event); + if (!(_moveCompleter?.isCompleted ?? true)) { + _moveCompleter?.complete(event); + } }.toJS, ); @@ -251,15 +268,17 @@ final class MapLibreMapStateWeb extends State double? zoom, double? bearing, double? tilt, - }) async => - _map.jumpTo( - interop.JumpToOptions( - center: center?.toLngLat(), - zoom: zoom, - bearing: bearing, - pitch: tilt, - ), - ); + }) async { + _nextGestureCausedByController = true; + _map.jumpTo( + interop.JumpToOptions( + center: center?.toLngLat(), + zoom: zoom, + bearing: bearing, + pitch: tilt, + ), + ); + } @override Future flyTo({ @@ -272,6 +291,7 @@ final class MapLibreMapStateWeb extends State Duration? maxDuration, }) async { final destination = center?.toLngLat(); + _nextGestureCausedByController = true; _map.flyTo( interop.FlyToOptions( center: destination, diff --git a/linux/pigeon.g.cc b/linux/pigeon.g.cc index bbec5c3..0e9f4dc 100644 --- a/linux/pigeon.g.cc +++ b/linux/pigeon.g.cc @@ -130,8 +130,8 @@ static FlValue* maplibre_map_options_to_list(MaplibreMapOptions* self) { fl_value_append_take(values, fl_value_new_float(self->zoom)); fl_value_append_take(values, fl_value_new_float(self->tilt)); fl_value_append_take(values, fl_value_new_float(self->bearing)); - fl_value_append_take(values, self->center != nullptr ? fl_value_new_custom_object(132, G_OBJECT(self->center)) : fl_value_new_null()); - fl_value_append_take(values, self->max_bounds != nullptr ? fl_value_new_custom_object(135, G_OBJECT(self->max_bounds)) : fl_value_new_null()); + fl_value_append_take(values, self->center != nullptr ? fl_value_new_custom_object(133, G_OBJECT(self->center)) : fl_value_new_null()); + fl_value_append_take(values, self->max_bounds != nullptr ? fl_value_new_custom_object(136, G_OBJECT(self->max_bounds)) : fl_value_new_null()); fl_value_append_take(values, fl_value_new_float(self->min_zoom)); fl_value_append_take(values, fl_value_new_float(self->max_zoom)); fl_value_append_take(values, fl_value_new_float(self->min_tilt)); @@ -334,7 +334,7 @@ double maplibre_map_camera_get_bearing(MaplibreMapCamera* self) { static FlValue* maplibre_map_camera_to_list(MaplibreMapCamera* self) { FlValue* values = fl_value_new_list(); - fl_value_append_take(values, fl_value_new_custom_object(132, G_OBJECT(self->center))); + fl_value_append_take(values, fl_value_new_custom_object(133, G_OBJECT(self->center))); fl_value_append_take(values, fl_value_new_float(self->zoom)); fl_value_append_take(values, fl_value_new_float(self->tilt)); fl_value_append_take(values, fl_value_new_float(self->bearing)); @@ -446,36 +446,42 @@ static gboolean maplibre_message_codec_write_maplibre_raster_dem_encoding(FlStan return fl_standard_message_codec_write_value(codec, buffer, value, error); } -static gboolean maplibre_message_codec_write_maplibre_map_options(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapOptions* value, GError** error) { +static gboolean maplibre_message_codec_write_maplibre_camera_change_reason(FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, GError** error) { uint8_t type = 131; g_byte_array_append(buffer, &type, sizeof(uint8_t)); + return fl_standard_message_codec_write_value(codec, buffer, value, error); +} + +static gboolean maplibre_message_codec_write_maplibre_map_options(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapOptions* value, GError** error) { + uint8_t type = 132; + g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_map_options_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_lng_lat(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLat* value, GError** error) { - uint8_t type = 132; + uint8_t type = 133; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_screen_location(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreScreenLocation* value, GError** error) { - uint8_t type = 133; + uint8_t type = 134; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_screen_location_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_map_camera(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreMapCamera* value, GError** error) { - uint8_t type = 134; + uint8_t type = 135; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_map_camera_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); } static gboolean maplibre_message_codec_write_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GByteArray* buffer, MaplibreLngLatBounds* value, GError** error) { - uint8_t type = 135; + uint8_t type = 136; g_byte_array_append(buffer, &type, sizeof(uint8_t)); g_autoptr(FlValue) values = maplibre_lng_lat_bounds_to_list(value); return fl_standard_message_codec_write_value(codec, buffer, values, error); @@ -489,14 +495,16 @@ static gboolean maplibre_message_codec_write_value(FlStandardMessageCodec* codec case 130: return maplibre_message_codec_write_maplibre_raster_dem_encoding(codec, buffer, reinterpret_cast(const_cast(fl_value_get_custom_value(value))), error); case 131: - return maplibre_message_codec_write_maplibre_map_options(codec, buffer, MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_camera_change_reason(codec, buffer, reinterpret_cast(const_cast(fl_value_get_custom_value(value))), error); case 132: - return maplibre_message_codec_write_maplibre_lng_lat(codec, buffer, MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_map_options(codec, buffer, MAPLIBRE_MAP_OPTIONS(fl_value_get_custom_value_object(value)), error); case 133: - return maplibre_message_codec_write_maplibre_screen_location(codec, buffer, MAPLIBRE_SCREEN_LOCATION(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_lng_lat(codec, buffer, MAPLIBRE_LNG_LAT(fl_value_get_custom_value_object(value)), error); case 134: - return maplibre_message_codec_write_maplibre_map_camera(codec, buffer, MAPLIBRE_MAP_CAMERA(fl_value_get_custom_value_object(value)), error); + return maplibre_message_codec_write_maplibre_screen_location(codec, buffer, MAPLIBRE_SCREEN_LOCATION(fl_value_get_custom_value_object(value)), error); case 135: + return maplibre_message_codec_write_maplibre_map_camera(codec, buffer, MAPLIBRE_MAP_CAMERA(fl_value_get_custom_value_object(value)), error); + case 136: return maplibre_message_codec_write_maplibre_lng_lat_bounds(codec, buffer, MAPLIBRE_LNG_LAT_BOUNDS(fl_value_get_custom_value_object(value)), error); } } @@ -512,6 +520,10 @@ static FlValue* maplibre_message_codec_read_maplibre_raster_dem_encoding(FlStand return fl_value_new_custom(130, fl_standard_message_codec_read_value(codec, buffer, offset, error), (GDestroyNotify)fl_value_unref); } +static FlValue* maplibre_message_codec_read_maplibre_camera_change_reason(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { + return fl_value_new_custom(131, fl_standard_message_codec_read_value(codec, buffer, offset, error), (GDestroyNotify)fl_value_unref); +} + static FlValue* maplibre_message_codec_read_maplibre_map_options(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { g_autoptr(FlValue) values = fl_standard_message_codec_read_value(codec, buffer, offset, error); if (values == nullptr) { @@ -524,7 +536,7 @@ static FlValue* maplibre_message_codec_read_maplibre_map_options(FlStandardMessa return nullptr; } - return fl_value_new_custom_object(131, G_OBJECT(value)); + return fl_value_new_custom_object(132, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -539,7 +551,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat(FlStandardMessageCo return nullptr; } - return fl_value_new_custom_object(132, G_OBJECT(value)); + return fl_value_new_custom_object(133, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -554,7 +566,7 @@ static FlValue* maplibre_message_codec_read_maplibre_screen_location(FlStandardM return nullptr; } - return fl_value_new_custom_object(133, G_OBJECT(value)); + return fl_value_new_custom_object(134, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -569,7 +581,7 @@ static FlValue* maplibre_message_codec_read_maplibre_map_camera(FlStandardMessag return nullptr; } - return fl_value_new_custom_object(134, G_OBJECT(value)); + return fl_value_new_custom_object(135, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, GError** error) { @@ -584,7 +596,7 @@ static FlValue* maplibre_message_codec_read_maplibre_lng_lat_bounds(FlStandardMe return nullptr; } - return fl_value_new_custom_object(135, G_OBJECT(value)); + return fl_value_new_custom_object(136, G_OBJECT(value)); } static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec* codec, GBytes* buffer, size_t* offset, int type, GError** error) { @@ -594,14 +606,16 @@ static FlValue* maplibre_message_codec_read_value_of_type(FlStandardMessageCodec case 130: return maplibre_message_codec_read_maplibre_raster_dem_encoding(codec, buffer, offset, error); case 131: - return maplibre_message_codec_read_maplibre_map_options(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_camera_change_reason(codec, buffer, offset, error); case 132: - return maplibre_message_codec_read_maplibre_lng_lat(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_map_options(codec, buffer, offset, error); case 133: - return maplibre_message_codec_read_maplibre_screen_location(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_lng_lat(codec, buffer, offset, error); case 134: - return maplibre_message_codec_read_maplibre_map_camera(codec, buffer, offset, error); + return maplibre_message_codec_read_maplibre_screen_location(codec, buffer, offset, error); case 135: + return maplibre_message_codec_read_maplibre_map_camera(codec, buffer, offset, error); + case 136: return maplibre_message_codec_read_maplibre_lng_lat_bounds(codec, buffer, offset, error); default: return FL_STANDARD_MESSAGE_CODEC_CLASS(maplibre_message_codec_parent_class)->read_value_of_type(codec, buffer, offset, type, error); @@ -755,7 +769,7 @@ static void maplibre_map_libre_host_api_get_camera_response_class_init(MaplibreM static MaplibreMapLibreHostApiGetCameraResponse* maplibre_map_libre_host_api_get_camera_response_new(MaplibreMapCamera* return_value) { MaplibreMapLibreHostApiGetCameraResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_camera_response_get_type(), nullptr)); self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(134, G_OBJECT(return_value))); + fl_value_append_take(self->value, fl_value_new_custom_object(135, G_OBJECT(return_value))); return self; } @@ -794,7 +808,7 @@ static void maplibre_map_libre_host_api_get_visible_region_response_class_init(M static MaplibreMapLibreHostApiGetVisibleRegionResponse* maplibre_map_libre_host_api_get_visible_region_response_new(MaplibreLngLatBounds* return_value) { MaplibreMapLibreHostApiGetVisibleRegionResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_GET_VISIBLE_REGION_RESPONSE(g_object_new(maplibre_map_libre_host_api_get_visible_region_response_get_type(), nullptr)); self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(135, G_OBJECT(return_value))); + fl_value_append_take(self->value, fl_value_new_custom_object(136, G_OBJECT(return_value))); return self; } @@ -833,7 +847,7 @@ static void maplibre_map_libre_host_api_to_screen_location_response_class_init(M static MaplibreMapLibreHostApiToScreenLocationResponse* maplibre_map_libre_host_api_to_screen_location_response_new(MaplibreScreenLocation* return_value) { MaplibreMapLibreHostApiToScreenLocationResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_SCREEN_LOCATION_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_screen_location_response_get_type(), nullptr)); self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(133, G_OBJECT(return_value))); + fl_value_append_take(self->value, fl_value_new_custom_object(134, G_OBJECT(return_value))); return self; } @@ -872,7 +886,7 @@ static void maplibre_map_libre_host_api_to_lng_lat_response_class_init(MaplibreM static MaplibreMapLibreHostApiToLngLatResponse* maplibre_map_libre_host_api_to_lng_lat_response_new(MaplibreLngLat* return_value) { MaplibreMapLibreHostApiToLngLatResponse* self = MAPLIBRE_MAP_LIBRE_HOST_API_TO_LNG_LAT_RESPONSE(g_object_new(maplibre_map_libre_host_api_to_lng_lat_response_get_type(), nullptr)); self->value = fl_value_new_list(); - fl_value_append_take(self->value, fl_value_new_custom_object(132, G_OBJECT(return_value))); + fl_value_append_take(self->value, fl_value_new_custom_object(133, G_OBJECT(return_value))); return self; } @@ -3206,7 +3220,7 @@ static void maplibre_map_libre_flutter_api_on_click_cb(GObject* object, GAsyncRe void maplibre_map_libre_flutter_api_on_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + fl_value_append_take(args, fl_value_new_custom_object(133, G_OBJECT(point))); g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick%s", self->suffix); g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); @@ -3441,7 +3455,7 @@ static void maplibre_map_libre_flutter_api_on_secondary_click_cb(GObject* object void maplibre_map_libre_flutter_api_on_secondary_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + fl_value_append_take(args, fl_value_new_custom_object(133, G_OBJECT(point))); g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick%s", self->suffix); g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); @@ -3520,7 +3534,7 @@ static void maplibre_map_libre_flutter_api_on_double_click_cb(GObject* object, G void maplibre_map_libre_flutter_api_on_double_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + fl_value_append_take(args, fl_value_new_custom_object(133, G_OBJECT(point))); g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick%s", self->suffix); g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); @@ -3599,7 +3613,7 @@ static void maplibre_map_libre_flutter_api_on_long_click_cb(GObject* object, GAs void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* self, MaplibreLngLat* point, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(132, G_OBJECT(point))); + fl_value_append_take(args, fl_value_new_custom_object(133, G_OBJECT(point))); g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick%s", self->suffix); g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); @@ -3619,75 +3633,154 @@ MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on return maplibre_map_libre_flutter_api_on_long_click_response_new(response); } -struct _MaplibreMapLibreFlutterApiOnCameraMovedResponse { +struct _MaplibreMapLibreFlutterApiOnMoveCameraResponse { + GObject parent_instance; + + FlValue* error; +}; + +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnMoveCameraResponse, maplibre_map_libre_flutter_api_on_move_camera_response, G_TYPE_OBJECT) + +static void maplibre_map_libre_flutter_api_on_move_camera_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnMoveCameraResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(object); + g_clear_pointer(&self->error, fl_value_unref); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_move_camera_response_parent_class)->dispose(object); +} + +static void maplibre_map_libre_flutter_api_on_move_camera_response_init(MaplibreMapLibreFlutterApiOnMoveCameraResponse* self) { +} + +static void maplibre_map_libre_flutter_api_on_move_camera_response_class_init(MaplibreMapLibreFlutterApiOnMoveCameraResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_move_camera_response_dispose; +} + +static MaplibreMapLibreFlutterApiOnMoveCameraResponse* maplibre_map_libre_flutter_api_on_move_camera_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnMoveCameraResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_move_camera_response_get_type(), nullptr)); + if (fl_value_get_length(response) > 1) { + self->error = fl_value_ref(response); + } + return self; +} + +gboolean maplibre_map_libre_flutter_api_on_move_camera_response_is_error(MaplibreMapLibreFlutterApiOnMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(self), FALSE); + return self->error != nullptr; +} + +const gchar* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_code(MaplibreMapLibreFlutterApiOnMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_move_camera_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 0)); +} + +const gchar* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_message(MaplibreMapLibreFlutterApiOnMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_move_camera_response_is_error(self)); + return fl_value_get_string(fl_value_get_list_value(self->error, 1)); +} + +FlValue* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_details(MaplibreMapLibreFlutterApiOnMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_move_camera_response_is_error(self)); + return fl_value_get_list_value(self->error, 2); +} + +static void maplibre_map_libre_flutter_api_on_move_camera_cb(GObject* object, GAsyncResult* result, gpointer user_data) { + GTask* task = G_TASK(user_data); + g_task_return_pointer(task, result, g_object_unref); +} + +void maplibre_map_libre_flutter_api_on_move_camera(MaplibreMapLibreFlutterApi* self, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { + g_autoptr(FlValue) args = fl_value_new_list(); + fl_value_append_take(args, fl_value_new_custom_object(135, G_OBJECT(camera))); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera%s", self->suffix); + g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); + FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); + GTask* task = g_task_new(self, cancellable, callback, user_data); + g_task_set_task_data(task, channel, g_object_unref); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_move_camera_cb, task); +} + +MaplibreMapLibreFlutterApiOnMoveCameraResponse* maplibre_map_libre_flutter_api_on_move_camera_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { + g_autoptr(GTask) task = G_TASK(result); + GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); + FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); + g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error); + if (response == nullptr) { + return nullptr; + } + return maplibre_map_libre_flutter_api_on_move_camera_response_new(response); +} + +struct _MaplibreMapLibreFlutterApiOnStartMoveCameraResponse { GObject parent_instance; FlValue* error; }; -G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, G_TYPE_OBJECT) +G_DEFINE_TYPE(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse, maplibre_map_libre_flutter_api_on_start_move_camera_response, G_TYPE_OBJECT) -static void maplibre_map_libre_flutter_api_on_camera_moved_response_dispose(GObject* object) { - MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(object); +static void maplibre_map_libre_flutter_api_on_start_move_camera_response_dispose(GObject* object) { + MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(object); g_clear_pointer(&self->error, fl_value_unref); - G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_camera_moved_response_parent_class)->dispose(object); + G_OBJECT_CLASS(maplibre_map_libre_flutter_api_on_start_move_camera_response_parent_class)->dispose(object); } -static void maplibre_map_libre_flutter_api_on_camera_moved_response_init(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { +static void maplibre_map_libre_flutter_api_on_start_move_camera_response_init(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self) { } -static void maplibre_map_libre_flutter_api_on_camera_moved_response_class_init(MaplibreMapLibreFlutterApiOnCameraMovedResponseClass* klass) { - G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_camera_moved_response_dispose; +static void maplibre_map_libre_flutter_api_on_start_move_camera_response_class_init(MaplibreMapLibreFlutterApiOnStartMoveCameraResponseClass* klass) { + G_OBJECT_CLASS(klass)->dispose = maplibre_map_libre_flutter_api_on_start_move_camera_response_dispose; } -static MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_response_new(FlValue* response) { - MaplibreMapLibreFlutterApiOnCameraMovedResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_camera_moved_response_get_type(), nullptr)); +static MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* maplibre_map_libre_flutter_api_on_start_move_camera_response_new(FlValue* response) { + MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self = MAPLIBRE_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(g_object_new(maplibre_map_libre_flutter_api_on_start_move_camera_response_get_type(), nullptr)); if (fl_value_get_length(response) > 1) { self->error = fl_value_ref(response); } return self; } -gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), FALSE); +gboolean maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(self), FALSE); return self->error != nullptr; } -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); +const gchar* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_code(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error(self)); return fl_value_get_string(fl_value_get_list_value(self->error, 0)); } -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); +const gchar* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_message(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error(self)); return fl_value_get_string(fl_value_get_list_value(self->error, 1)); } -FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* self) { - g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE(self), nullptr); - g_assert(maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(self)); +FlValue* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_details(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* self) { + g_return_val_if_fail(MAPLIBRE_IS_MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE(self), nullptr); + g_assert(maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error(self)); return fl_value_get_list_value(self->error, 2); } -static void maplibre_map_libre_flutter_api_on_camera_moved_cb(GObject* object, GAsyncResult* result, gpointer user_data) { +static void maplibre_map_libre_flutter_api_on_start_move_camera_cb(GObject* object, GAsyncResult* result, gpointer user_data) { GTask* task = G_TASK(user_data); g_task_return_pointer(task, result, g_object_unref); } -void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* self, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { +void maplibre_map_libre_flutter_api_on_start_move_camera(MaplibreMapLibreFlutterApi* self, MaplibreCameraChangeReason reason, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(FlValue) args = fl_value_new_list(); - fl_value_append_take(args, fl_value_new_custom_object(134, G_OBJECT(camera))); - g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved%s", self->suffix); + fl_value_append_take(args, fl_value_new_custom(131, fl_value_new_int(reason), (GDestroyNotify)fl_value_unref)); + g_autofree gchar* channel_name = g_strdup_printf("dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera%s", self->suffix); g_autoptr(MaplibreMessageCodec) codec = maplibre_message_codec_new(); FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec)); GTask* task = g_task_new(self, cancellable, callback, user_data); g_task_set_task_data(task, channel, g_object_unref); - fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_camera_moved_cb, task); + fl_basic_message_channel_send(channel, args, cancellable, maplibre_map_libre_flutter_api_on_start_move_camera_cb, task); } -MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { +MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* maplibre_map_libre_flutter_api_on_start_move_camera_finish(MaplibreMapLibreFlutterApi* self, GAsyncResult* result, GError** error) { g_autoptr(GTask) task = G_TASK(result); GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr)); FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task)); @@ -3695,5 +3788,5 @@ MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_ if (response == nullptr) { return nullptr; } - return maplibre_map_libre_flutter_api_on_camera_moved_response_new(response); + return maplibre_map_libre_flutter_api_on_start_move_camera_response_new(response); } diff --git a/linux/pigeon.g.h b/linux/pigeon.g.h index 84db585..ad6dc6b 100644 --- a/linux/pigeon.g.h +++ b/linux/pigeon.g.h @@ -40,6 +40,23 @@ typedef enum { MAPLIBRE_RASTER_DEM_ENCODING_CUSTOM = 2 } MaplibreRasterDemEncoding; +/** + * MaplibreCameraChangeReason: + * MAPLIBRE_CAMERA_CHANGE_REASON_DEVELOPER_ANIMATION: + * Developer animation. + * MAPLIBRE_CAMERA_CHANGE_REASON_API_ANIMATION: + * API animation. + * MAPLIBRE_CAMERA_CHANGE_REASON_API_GESTURE: + * API gesture + * + * The reason the camera is changing. + */ +typedef enum { + MAPLIBRE_CAMERA_CHANGE_REASON_DEVELOPER_ANIMATION = 0, + MAPLIBRE_CAMERA_CHANGE_REASON_API_ANIMATION = 1, + MAPLIBRE_CAMERA_CHANGE_REASON_API_GESTURE = 2 +} MaplibreCameraChangeReason; + /** * MaplibreMapOptions: * @@ -1338,47 +1355,89 @@ const gchar* maplibre_map_libre_flutter_api_on_long_click_response_get_error_mes */ FlValue* maplibre_map_libre_flutter_api_on_long_click_response_get_error_details(MaplibreMapLibreFlutterApiOnLongClickResponse* response); -G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnCameraMovedResponse, maplibre_map_libre_flutter_api_on_camera_moved_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_CAMERA_MOVED_RESPONSE, GObject) +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnMoveCameraResponse, maplibre_map_libre_flutter_api_on_move_camera_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_MOVE_CAMERA_RESPONSE, GObject) /** - * maplibre_map_libre_flutter_api_on_camera_moved_response_is_error: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * maplibre_map_libre_flutter_api_on_move_camera_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnMoveCameraResponse. * - * Checks if a response to MapLibreFlutterApi.onCameraMoved is an error. + * Checks if a response to MapLibreFlutterApi.onMoveCamera is an error. * * Returns: a %TRUE if this response is an error. */ -gboolean maplibre_map_libre_flutter_api_on_camera_moved_response_is_error(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); +gboolean maplibre_map_libre_flutter_api_on_move_camera_response_is_error(MaplibreMapLibreFlutterApiOnMoveCameraResponse* response); /** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * maplibre_map_libre_flutter_api_on_move_camera_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnMoveCameraResponse. * * Get the error code for this response. * * Returns: an error code or %NULL if not an error. */ -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_code(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); +const gchar* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_code(MaplibreMapLibreFlutterApiOnMoveCameraResponse* response); /** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * maplibre_map_libre_flutter_api_on_move_camera_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnMoveCameraResponse. * * Get the error message for this response. * * Returns: an error message. */ -const gchar* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_message(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); +const gchar* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_message(MaplibreMapLibreFlutterApiOnMoveCameraResponse* response); /** - * maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details: - * @response: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse. + * maplibre_map_libre_flutter_api_on_move_camera_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnMoveCameraResponse. * * Get the error details for this response. * * Returns: (allow-none): an error details or %NULL. */ -FlValue* maplibre_map_libre_flutter_api_on_camera_moved_response_get_error_details(MaplibreMapLibreFlutterApiOnCameraMovedResponse* response); +FlValue* maplibre_map_libre_flutter_api_on_move_camera_response_get_error_details(MaplibreMapLibreFlutterApiOnMoveCameraResponse* response); + +G_DECLARE_FINAL_TYPE(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse, maplibre_map_libre_flutter_api_on_start_move_camera_response, MAPLIBRE, MAP_LIBRE_FLUTTER_API_ON_START_MOVE_CAMERA_RESPONSE, GObject) + +/** + * maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error: + * @response: a #MaplibreMapLibreFlutterApiOnStartMoveCameraResponse. + * + * Checks if a response to MapLibreFlutterApi.onStartMoveCamera is an error. + * + * Returns: a %TRUE if this response is an error. + */ +gboolean maplibre_map_libre_flutter_api_on_start_move_camera_response_is_error(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_code: + * @response: a #MaplibreMapLibreFlutterApiOnStartMoveCameraResponse. + * + * Get the error code for this response. + * + * Returns: an error code or %NULL if not an error. + */ +const gchar* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_code(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_message: + * @response: a #MaplibreMapLibreFlutterApiOnStartMoveCameraResponse. + * + * Get the error message for this response. + * + * Returns: an error message. + */ +const gchar* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_message(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* response); + +/** + * maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_details: + * @response: a #MaplibreMapLibreFlutterApiOnStartMoveCameraResponse. + * + * Get the error details for this response. + * + * Returns: (allow-none): an error details or %NULL. + */ +FlValue* maplibre_map_libre_flutter_api_on_start_move_camera_response_get_error_details(MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* response); /** * MaplibreMapLibreFlutterApi: @@ -1588,7 +1647,7 @@ void maplibre_map_libre_flutter_api_on_long_click(MaplibreMapLibreFlutterApi* ap MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on_long_click_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); /** - * maplibre_map_libre_flutter_api_on_camera_moved: + * maplibre_map_libre_flutter_api_on_move_camera: * @api: a #MaplibreMapLibreFlutterApi. * @camera: parameter for this method. * @cancellable: (allow-none): a #GCancellable or %NULL. @@ -1597,19 +1656,43 @@ MaplibreMapLibreFlutterApiOnLongClickResponse* maplibre_map_libre_flutter_api_on * * Callback when the map camera changes. */ -void maplibre_map_libre_flutter_api_on_camera_moved(MaplibreMapLibreFlutterApi* api, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); +void maplibre_map_libre_flutter_api_on_move_camera(MaplibreMapLibreFlutterApi* api, MaplibreMapCamera* camera, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); + +/** + * maplibre_map_libre_flutter_api_on_move_camera_finish: + * @api: a #MaplibreMapLibreFlutterApi. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. + * + * Completes a maplibre_map_libre_flutter_api_on_move_camera() call. + * + * Returns: a #MaplibreMapLibreFlutterApiOnMoveCameraResponse or %NULL on error. + */ +MaplibreMapLibreFlutterApiOnMoveCameraResponse* maplibre_map_libre_flutter_api_on_move_camera_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); + +/** + * maplibre_map_libre_flutter_api_on_start_move_camera: + * @api: a #MaplibreMapLibreFlutterApi. + * @reason: parameter for this method. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when the call is complete or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Callback when the map camera starts changing. + */ +void maplibre_map_libre_flutter_api_on_start_move_camera(MaplibreMapLibreFlutterApi* api, MaplibreCameraChangeReason reason, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data); /** - * maplibre_map_libre_flutter_api_on_camera_moved_finish: + * maplibre_map_libre_flutter_api_on_start_move_camera_finish: * @api: a #MaplibreMapLibreFlutterApi. * @result: a #GAsyncResult. * @error: (allow-none): #GError location to store the error occurring, or %NULL to ignore. * - * Completes a maplibre_map_libre_flutter_api_on_camera_moved() call. + * Completes a maplibre_map_libre_flutter_api_on_start_move_camera() call. * - * Returns: a #MaplibreMapLibreFlutterApiOnCameraMovedResponse or %NULL on error. + * Returns: a #MaplibreMapLibreFlutterApiOnStartMoveCameraResponse or %NULL on error. */ -MaplibreMapLibreFlutterApiOnCameraMovedResponse* maplibre_map_libre_flutter_api_on_camera_moved_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); +MaplibreMapLibreFlutterApiOnStartMoveCameraResponse* maplibre_map_libre_flutter_api_on_start_move_camera_finish(MaplibreMapLibreFlutterApi* api, GAsyncResult* result, GError** error); G_END_DECLS diff --git a/macos/Classes/Pigeon.g.swift b/macos/Classes/Pigeon.g.swift index be85aa8..e0a6b48 100644 --- a/macos/Classes/Pigeon.g.swift +++ b/macos/Classes/Pigeon.g.swift @@ -87,6 +87,16 @@ enum RasterDemEncoding: Int { case custom = 2 } +/// The reason the camera is changing. +enum CameraChangeReason: Int { + /// Developer animation. + case developerAnimation = 0 + /// API animation. + case apiAnimation = 1 + /// API gesture + case apiGesture = 2 +} + /// The map options define initial values for the MapLibre map. /// /// Generated class from Pigeon that represents data sent in messages. @@ -310,14 +320,20 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 131: - return MapOptions.fromList(self.readValue() as! [Any?]) + let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) + if let enumResultAsInt = enumResultAsInt { + return CameraChangeReason(rawValue: enumResultAsInt) + } + return nil case 132: - return LngLat.fromList(self.readValue() as! [Any?]) + return MapOptions.fromList(self.readValue() as! [Any?]) case 133: - return ScreenLocation.fromList(self.readValue() as! [Any?]) + return LngLat.fromList(self.readValue() as! [Any?]) case 134: - return MapCamera.fromList(self.readValue() as! [Any?]) + return ScreenLocation.fromList(self.readValue() as! [Any?]) case 135: + return MapCamera.fromList(self.readValue() as! [Any?]) + case 136: return LngLatBounds.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -333,20 +349,23 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? RasterDemEncoding { super.writeByte(130) super.writeValue(value.rawValue) - } else if let value = value as? MapOptions { + } else if let value = value as? CameraChangeReason { super.writeByte(131) + super.writeValue(value.rawValue) + } else if let value = value as? MapOptions { + super.writeByte(132) super.writeValue(value.toList()) } else if let value = value as? LngLat { - super.writeByte(132) + super.writeByte(133) super.writeValue(value.toList()) } else if let value = value as? ScreenLocation { - super.writeByte(133) + super.writeByte(134) super.writeValue(value.toList()) } else if let value = value as? MapCamera { - super.writeByte(134) + super.writeByte(135) super.writeValue(value.toList()) } else if let value = value as? LngLatBounds { - super.writeByte(135) + super.writeByte(136) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -1041,7 +1060,9 @@ protocol MapLibreFlutterApiProtocol { /// Callback when the user performs a long lasting click on the map. func onLongClick(point pointArg: LngLat, completion: @escaping (Result) -> Void) /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) + func onMoveCamera(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) + /// Callback when the map camera starts changing. + func onStartMoveCamera(reason reasonArg: CameraChangeReason, completion: @escaping (Result) -> Void) } class MapLibreFlutterApi: MapLibreFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger @@ -1210,8 +1231,8 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } /// Callback when the map camera changes. - func onCameraMoved(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved\(messageChannelSuffix)" + func onMoveCamera(camera cameraArg: MapCamera, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([cameraArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -1228,4 +1249,23 @@ class MapLibreFlutterApi: MapLibreFlutterApiProtocol { } } } + /// Callback when the map camera starts changing. + func onStartMoveCamera(reason reasonArg: CameraChangeReason, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera\(messageChannelSuffix)" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([reasonArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(Void())) + } + } + } } diff --git a/pigeons/pigeon.dart b/pigeons/pigeon.dart index d0cc47e..9e30500 100644 --- a/pigeons/pigeon.dart +++ b/pigeons/pigeon.dart @@ -277,7 +277,10 @@ abstract interface class MapLibreFlutterApi { void onLongClick(LngLat point); /// Callback when the map camera changes. - void onCameraMoved(MapCamera camera); + void onMoveCamera(MapCamera camera); + + /// Callback when the map camera starts changing. + void onStartMoveCamera(CameraChangeReason reason); } /// The map options define initial values for the MapLibre map. @@ -407,3 +410,15 @@ enum RasterDemEncoding { /// parameters. custom; } + +/// The reason the camera is changing. +enum CameraChangeReason { + /// Developer animation. + developerAnimation, + + /// API animation. + apiAnimation, + + /// API gesture + apiGesture; +} diff --git a/windows/runner/pigeon.g.cpp b/windows/runner/pigeon.g.cpp index 544c829..91f1f34 100644 --- a/windows/runner/pigeon.g.cpp +++ b/windows/runner/pigeon.g.cpp @@ -513,18 +513,23 @@ EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast(enum_arg_value)); } case 131: { - return CustomEncodableValue(MapOptions::FromEncodableList(std::get(ReadValue(stream)))); + const auto& encodable_enum_arg = ReadValue(stream); + const int64_t enum_arg_value = encodable_enum_arg.IsNull() ? 0 : encodable_enum_arg.LongValue(); + return encodable_enum_arg.IsNull() ? EncodableValue() : CustomEncodableValue(static_cast(enum_arg_value)); } case 132: { - return CustomEncodableValue(LngLat::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(MapOptions::FromEncodableList(std::get(ReadValue(stream)))); } case 133: { - return CustomEncodableValue(ScreenLocation::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(LngLat::FromEncodableList(std::get(ReadValue(stream)))); } case 134: { - return CustomEncodableValue(MapCamera::FromEncodableList(std::get(ReadValue(stream)))); + return CustomEncodableValue(ScreenLocation::FromEncodableList(std::get(ReadValue(stream)))); } case 135: { + return CustomEncodableValue(MapCamera::FromEncodableList(std::get(ReadValue(stream)))); + } + case 136: { return CustomEncodableValue(LngLatBounds::FromEncodableList(std::get(ReadValue(stream)))); } default: @@ -546,28 +551,33 @@ void PigeonInternalCodecSerializer::WriteValue( WriteValue(EncodableValue(static_cast(std::any_cast(*custom_value))), stream); return; } - if (custom_value->type() == typeid(MapOptions)) { + if (custom_value->type() == typeid(CameraChangeReason)) { stream->WriteByte(131); + WriteValue(EncodableValue(static_cast(std::any_cast(*custom_value))), stream); + return; + } + if (custom_value->type() == typeid(MapOptions)) { + stream->WriteByte(132); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(LngLat)) { - stream->WriteByte(132); + stream->WriteByte(133); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(ScreenLocation)) { - stream->WriteByte(133); + stream->WriteByte(134); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(MapCamera)) { - stream->WriteByte(134); + stream->WriteByte(135); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(LngLatBounds)) { - stream->WriteByte(135); + stream->WriteByte(136); WriteValue(EncodableValue(std::any_cast(*custom_value).ToEncodableList()), stream); return; } @@ -1983,11 +1993,11 @@ void MapLibreFlutterApi::OnLongClick( }); } -void MapLibreFlutterApi::OnCameraMoved( +void MapLibreFlutterApi::OnMoveCamera( const MapCamera& camera_arg, std::function&& on_success, std::function&& on_error) { - const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onCameraMoved" + message_channel_suffix_; + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onMoveCamera" + message_channel_suffix_; BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ CustomEncodableValue(camera_arg), @@ -2008,4 +2018,29 @@ void MapLibreFlutterApi::OnCameraMoved( }); } +void MapLibreFlutterApi::OnStartMoveCamera( + const CameraChangeReason& reason_arg, + std::function&& on_success, + std::function&& on_error) { + const std::string channel_name = "dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStartMoveCamera" + message_channel_suffix_; + BasicMessageChannel<> channel(binary_messenger_, channel_name, &GetCodec()); + EncodableValue encoded_api_arguments = EncodableValue(EncodableList{ + CustomEncodableValue(reason_arg), + }); + channel.Send(encoded_api_arguments, [channel_name, on_success = std::move(on_success), on_error = std::move(on_error)](const uint8_t* reply, size_t reply_size) { + std::unique_ptr response = GetCodec().DecodeMessage(reply, reply_size); + const auto& encodable_return_value = *response; + const auto* list_return_value = std::get_if(&encodable_return_value); + if (list_return_value) { + if (list_return_value->size() > 1) { + on_error(FlutterError(std::get(list_return_value->at(0)), std::get(list_return_value->at(1)), list_return_value->at(2))); + } else { + on_success(); + } + } else { + on_error(CreateConnectionError(channel_name)); + } + }); +} + } // namespace pigeon_maplibre diff --git a/windows/runner/pigeon.g.h b/windows/runner/pigeon.g.h index 4a56e63..a05a8d6 100644 --- a/windows/runner/pigeon.g.h +++ b/windows/runner/pigeon.g.h @@ -76,6 +76,16 @@ enum class RasterDemEncoding { kCustom = 2 }; +// The reason the camera is changing. +enum class CameraChangeReason { + // Developer animation. + kDeveloperAnimation = 0, + // API animation. + kApiAnimation = 1, + // API gesture + kApiGesture = 2 +}; + // The map options define initial values for the MapLibre map. // @@ -614,10 +624,15 @@ class MapLibreFlutterApi { std::function&& on_success, std::function&& on_error); // Callback when the map camera changes. - void OnCameraMoved( + void OnMoveCamera( const MapCamera& camera, std::function&& on_success, std::function&& on_error); + // Callback when the map camera starts changing. + void OnStartMoveCamera( + const CameraChangeReason& reason, + std::function&& on_success, + std::function&& on_error); private: flutter::BinaryMessenger* binary_messenger_;