From d0d9783b78fe86a9422622f1ae10f2a530e37924 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Wed, 25 Sep 2024 23:23:05 +0200 Subject: [PATCH] americana / osm liberty merge --- lib/l10n/app_en.arb | 4 +- lib/model/app/dependencies.dart | 10 ++ lib/view/src/settings/enums.dart | 2 +- lib/widgets/common/map/attribution.dart | 4 +- lib/widgets/common/map/geo_map.dart | 2 +- lib/widgets/common/map/leaflet/map.dart | 4 +- .../common/map/leaflet/tile_layers.dart | 57 ++++++--- .../leaflet/vector_style_reader_extra.dart | 113 ++++++++++++++++++ plugins/aves_map/lib/src/style.dart | 2 +- pubspec.lock | 11 +- pubspec.yaml | 4 +- 11 files changed, 180 insertions(+), 33 deletions(-) create mode 100644 lib/widgets/common/map/leaflet/vector_style_reader_extra.dart diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 9850e3b03..94dc5179e 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -238,7 +238,7 @@ "mapStyleGoogleNormal": "Google Maps", "mapStyleGoogleHybrid": "Google Maps (Hybrid)", "mapStyleGoogleTerrain": "Google Maps (Terrain)", - "mapStyleOsmAmericana": "OSM Americana", + "mapStyleOsmLiberty": "OSM Liberty", "mapStyleOpenTopoMap": "OpenTopoMap", "mapStyleOsmHot": "Humanitarian OSM", "mapStyleStamenWatercolor": "Stamen Watercolor", @@ -1034,7 +1034,7 @@ "mapZoomInTooltip": "Zoom in", "mapZoomOutTooltip": "Zoom out", "mapPointNorthUpTooltip": "Point north up", - "mapAttributionOsmAmericana": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [OpenMapTiles](https://www.openmaptiles.org/), [CC BY](http://creativecommons.org/licenses/by/4.0)", + "mapAttributionOsmLiberty": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [OpenMapTiles](https://www.openmaptiles.org/), [CC BY](http://creativecommons.org/licenses/by/4.0) • Hosted by [OSM Americana](https://tile.ourmap.us)", "mapAttributionOpenTopoMap": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • [SRTM](https://www.earthdata.nasa.gov/sensors/srtm) | Tiles by [OpenTopoMap](https://opentopomap.org/), [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/)", "mapAttributionOsmHot": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [HOT](https://www.hotosm.org/) • Hosted by [OSM France](https://openstreetmap.fr/)", "mapAttributionStamen": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [Stamen Design](https://stamen.com), [CC BY 3.0](https://creativecommons.org/licenses/by/3.0)", diff --git a/lib/model/app/dependencies.dart b/lib/model/app/dependencies.dart index 613cb940b..d09b2b933 100644 --- a/lib/model/app/dependencies.dart +++ b/lib/model/app/dependencies.dart @@ -289,6 +289,11 @@ class Dependencies { license: bsd3, sourceUrl: 'https://github.com/greensopinion/flutter-vector-map-tiles', ), + Dependency( + name: 'Vector Tile Renderer', + license: bsd3, + sourceUrl: 'https://github.com/greensopinion/dart-vector-tile-renderer', + ), ]; static const List dartPackages = [ @@ -333,6 +338,11 @@ class Dependencies { license: mit, sourceUrl: 'https://github.com/fluttercommunity/get_it', ), + Dependency( + name: 'HTTP', + license: bsd3, + sourceUrl: 'https://github.com/dart-lang/http', + ), Dependency( name: 'Intl', license: bsd3, diff --git a/lib/view/src/settings/enums.dart b/lib/view/src/settings/enums.dart index 485142707..64c41c1d5 100644 --- a/lib/view/src/settings/enums.dart +++ b/lib/view/src/settings/enums.dart @@ -68,7 +68,7 @@ extension ExtraEntryMapStyleView on EntryMapStyle { EntryMapStyle.googleNormal => l10n.mapStyleGoogleNormal, EntryMapStyle.googleHybrid => l10n.mapStyleGoogleHybrid, EntryMapStyle.googleTerrain => l10n.mapStyleGoogleTerrain, - EntryMapStyle.osmAmericana => l10n.mapStyleOsmAmericana, + EntryMapStyle.osmLiberty => l10n.mapStyleOsmLiberty, EntryMapStyle.openTopoMap => l10n.mapStyleOpenTopoMap, EntryMapStyle.osmHot => l10n.mapStyleOsmHot, EntryMapStyle.stamenWatercolor => l10n.mapStyleStamenWatercolor, diff --git a/lib/widgets/common/map/attribution.dart b/lib/widgets/common/map/attribution.dart index 3628c7044..80f6bb07a 100644 --- a/lib/widgets/common/map/attribution.dart +++ b/lib/widgets/common/map/attribution.dart @@ -16,8 +16,8 @@ class Attribution extends StatelessWidget { @override Widget build(BuildContext context) { switch (style) { - case EntryMapStyle.osmAmericana: - return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmAmericana); + case EntryMapStyle.osmLiberty: + return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmLiberty); case EntryMapStyle.openTopoMap: return _buildAttributionMarkdown(context, context.l10n.mapAttributionOpenTopoMap); case EntryMapStyle.osmHot: diff --git a/lib/widgets/common/map/geo_map.dart b/lib/widgets/common/map/geo_map.dart index 477e19dc8..28bdc0089 100644 --- a/lib/widgets/common/map/geo_map.dart +++ b/lib/widgets/common/map/geo_map.dart @@ -185,7 +185,7 @@ class _GeoMapState extends State { onMarkerTap: _onMarkerTap, onMarkerLongPress: onMarkerLongPress, ); - case EntryMapStyle.osmAmericana: + case EntryMapStyle.osmLiberty: case EntryMapStyle.openTopoMap: case EntryMapStyle.osmHot: case EntryMapStyle.stamenWatercolor: diff --git a/lib/widgets/common/map/leaflet/map.dart b/lib/widgets/common/map/leaflet/map.dart index cd83263f5..96f775e2b 100644 --- a/lib/widgets/common/map/leaflet/map.dart +++ b/lib/widgets/common/map/leaflet/map.dart @@ -198,8 +198,8 @@ class _EntryLeafletMapState extends State> with TickerProv Widget _buildMapLayer() { switch (widget.style) { - case EntryMapStyle.osmAmericana: - return const OsmAmericanaLayer(); + case EntryMapStyle.osmLiberty: + return const OsmLibertyLayer(); case EntryMapStyle.openTopoMap: return const OpenTopoMapLayer(); case EntryMapStyle.osmHot: diff --git a/lib/widgets/common/map/leaflet/tile_layers.dart b/lib/widgets/common/map/leaflet/tile_layers.dart index 19fe35472..ac184c02d 100644 --- a/lib/widgets/common/map/leaflet/tile_layers.dart +++ b/lib/widgets/common/map/leaflet/tile_layers.dart @@ -1,4 +1,5 @@ import 'package:aves/model/device.dart'; +import 'package:aves/widgets/common/map/leaflet/vector_style_reader_extra.dart'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:vector_map_tiles/vector_map_tiles.dart'; @@ -45,39 +46,61 @@ class StamenWatercolorLayer extends StatelessWidget { } } -class OsmAmericanaLayer extends StatefulWidget { - const OsmAmericanaLayer({super.key}); +class OsmLibertyLayer extends StatefulWidget { + const OsmLibertyLayer({super.key}); @override - State createState() => _OsmAmericanaLayerState(); + State createState() => _OsmLibertyLayerState(); } -class _OsmAmericanaLayerState extends State { - late final Future