diff --git a/data/maps.gresource.xml b/data/maps.gresource.xml index d967c7a..0db1b4d 100644 --- a/data/maps.gresource.xml +++ b/data/maps.gresource.xml @@ -4,6 +4,13 @@ Application.css + + tiles/sprites.json + tiles/sprites@2x.json + tiles/sprites.png + tiles/sprites@2x.png + + icons/pointer.svg icons/48/explore.svg diff --git a/data/tiles/LICENSE.md b/data/tiles/LICENSE.md new file mode 100644 index 0000000..7061be1 --- /dev/null +++ b/data/tiles/LICENSE.md @@ -0,0 +1,39 @@ +## Code License + +The Mapbox GL Style JSON file is originally derived from [OSM Bright from Mapbox Open Styles](https://github.com/mapbox/mapbox-gl-styles/blob/master/LICENSE.md). The modified Mapbox GL Style JSON retains the same BSD license. + +> Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +> * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +* Neither the name of Mapbox nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## Design License + +The look and feel of the OSM liberty map design is also derived (although heavily altered) from [OSM Bright from Mapbox Open Styles](https://github.com/mapbox/mapbox-gl-styles/blob/master/LICENSE.md) which is licensed under the Creative Commons Attribution 3.0 license. + +The map is displaying and styling the data from [OpenMapTiles](https://openmaptiles.org/) with [CC-BY 4.0 design license](https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md). + +The products or services using this map style need to visibly credit "OpenMapTiles.org" or reference "OpenMapTiles" with a link to http://openmaptiles.org/. For a browsable electronic map based on OpenMapTiles and OpenStreetMap data, the credit should appear in the corner of the map. For example: + +[© OpenMapTiles](https://openmaptiles.org/) +[© OpenStreetMap contributors](https://www.openstreetmap.org/copyright) + +For printed and static maps a similar attribution should be made in a textual description near the image, in the same fashion as if you cite a photograph. + +## Icons + +OSM Liberty is using the [Maki POI icon set](https://github.com/mapbox/maki/blob/master/LICENSE.txt) which is licensed under CC0 1.0 Universal. + +The right arrow was derived from [Wikipedia][wiki_arrow] which is in the public domain. + +[wiki_arrow]: https://commons.wikimedia.org/wiki/File:Arrowright.svg + +## Fonts + +OSM Liberty is using the Roboto font family (Copyright 2011 Google). +Roboto is licensed under the [Apache License, Version 2.0](https://github.com/google/roboto/blob/master/LICENSE). + diff --git a/data/tiles/sprites.json b/data/tiles/sprites.json new file mode 100644 index 0000000..72cefa3 --- /dev/null +++ b/data/tiles/sprites.json @@ -0,0 +1,1689 @@ +{ + "aerialway_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 284, + "y": 127 + }, + "aerialway_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 80, + "y": 190 + }, + "airfield_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 299, + "y": 127 + }, + "airfield_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 99, + "y": 190 + }, + "airport_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 314, + "y": 127 + }, + "airport_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 118, + "y": 190 + }, + "alcohol_shop_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 381, + "y": 210 + }, + "alcohol_shop_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 64, + "y": 0 + }, + "america_football_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 398, + "y": 210 + }, + "america_football_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 85, + "y": 0 + }, + "amusement_park_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 415, + "y": 210 + }, + "amusement_park_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 106, + "y": 0 + }, + "aquarium_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 432, + "y": 210 + }, + "aquarium_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 64 + }, + "arrow": { + "height": 7, + "pixelRatio": 1, + "width": 20, + "x": 486, + "y": 148 + }, + "art_gallery_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 449, + "y": 210 + }, + "art_gallery_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 64 + }, + "attraction_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 466, + "y": 210 + }, + "attraction_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 64 + }, + "bakery_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 483, + "y": 210 + }, + "bakery_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 64 + }, + "bank_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 227, + "y": 229 + }, + "bank_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 64 + }, + "bar_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 244, + "y": 229 + }, + "bar_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 64 + }, + "baseball_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 261, + "y": 229 + }, + "baseball_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 85 + }, + "basketball_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 278, + "y": 229 + }, + "basketball_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 85 + }, + "beer_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 295, + "y": 229 + }, + "beer_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 85 + }, + "bicycle_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 312, + "y": 229 + }, + "bicycle_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 85 + }, + "bicycle_rental_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 329, + "y": 229 + }, + "bicycle_rental_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 85 + }, + "building_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 329, + "y": 127 + }, + "building_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 137, + "y": 190 + }, + "bus_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 344, + "y": 127 + }, + "bus_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 156, + "y": 190 + }, + "butcher_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 346, + "y": 229 + }, + "butcher_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 85 + }, + "cafe_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 363, + "y": 229 + }, + "cafe_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 106 + }, + "campsite_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 380, + "y": 229 + }, + "campsite_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 106 + }, + "car_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 359, + "y": 127 + }, + "car_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 175, + "y": 190 + }, + "castle_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 397, + "y": 229 + }, + "castle_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 106 + }, + "cemetery_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 414, + "y": 229 + }, + "cemetery_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 106 + }, + "cinema_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 431, + "y": 229 + }, + "cinema_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 106 + }, + "circle-stroked_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 374, + "y": 127 + }, + "circle-stroked_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 194, + "y": 190 + }, + "circle_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 389, + "y": 127 + }, + "circle_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 213, + "y": 190 + }, + "clothing_store_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 448, + "y": 229 + }, + "clothing_store_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 106 + }, + "college_11": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 473, + "y": 106 + }, + "college_15": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 0, + "y": 190 + }, + "commercial_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 404, + "y": 127 + }, + "commercial_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 232, + "y": 190 + }, + "cricket_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 465, + "y": 229 + }, + "cricket_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 64 + }, + "cross_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 419, + "y": 127 + }, + "cross_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 0, + "y": 210 + }, + "dam_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 434, + "y": 127 + }, + "dam_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 19, + "y": 210 + }, + "danger_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 482, + "y": 229 + }, + "danger_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 64 + }, + "default_1": { + "height": 18, + "pixelRatio": 1, + "width": 18, + "x": 152, + "y": 229 + }, + "default_2": { + "height": 18, + "pixelRatio": 1, + "width": 25, + "x": 170, + "y": 229 + }, + "default_3": { + "height": 18, + "pixelRatio": 1, + "width": 32, + "x": 195, + "y": 229 + }, + "default_4": { + "height": 18, + "pixelRatio": 1, + "width": 39, + "x": 247, + "y": 210 + }, + "default_5": { + "height": 18, + "pixelRatio": 1, + "width": 45, + "x": 286, + "y": 210 + }, + "default_6": { + "height": 18, + "pixelRatio": 1, + "width": 50, + "x": 331, + "y": 210 + }, + "dentist_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 251, + "y": 190 + }, + "dentist_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 64 + }, + "doctor_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 268, + "y": 190 + }, + "doctor_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 64 + }, + "dog_park_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 285, + "y": 190 + }, + "dog_park_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 64 + }, + "dot_10": { + "height": 10, + "pixelRatio": 1, + "width": 10, + "x": 499, + "y": 229 + }, + "dot_11": { + "height": 11, + "pixelRatio": 1, + "width": 11, + "x": 500, + "y": 210 + }, + "dot_9": { + "height": 9, + "pixelRatio": 1, + "width": 9, + "x": 477, + "y": 148 + }, + "drinking-water_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 302, + "y": 190 + }, + "drinking_water_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 64 + }, + "embassy_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 319, + "y": 190 + }, + "embassy_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 85 + }, + "entrance_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 449, + "y": 127 + }, + "entrance_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 38, + "y": 210 + }, + "fast_food_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 336, + "y": 190 + }, + "fast_food_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 85 + }, + "ferry_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 464, + "y": 127 + }, + "ferry_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 57, + "y": 210 + }, + "fire-station_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 353, + "y": 190 + }, + "fire-station_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 85 + }, + "fuel_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 479, + "y": 127 + }, + "fuel_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 76, + "y": 210 + }, + "garden_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 370, + "y": 190 + }, + "garden_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 85 + }, + "gift_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 387, + "y": 190 + }, + "gift_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 85 + }, + "golf_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 404, + "y": 190 + }, + "golf_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 85 + }, + "grocery_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 421, + "y": 190 + }, + "grocery_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 106 + }, + "hairdresser_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 438, + "y": 190 + }, + "hairdresser_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 106 + }, + "harbor_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 494, + "y": 127 + }, + "harbor_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 95, + "y": 210 + }, + "heart_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 455, + "y": 190 + }, + "heart_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 106 + }, + "heliport_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 252, + "y": 148 + }, + "heliport_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 114, + "y": 210 + }, + "hospital_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 472, + "y": 190 + }, + "hospital_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 106 + }, + "ice_cream_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 489, + "y": 190 + }, + "ice_cream_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 106 + }, + "industry_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 267, + "y": 148 + }, + "industry_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 133, + "y": 210 + }, + "information_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 252, + "y": 64 + }, + "information_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 106 + }, + "laundry_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 269, + "y": 64 + }, + "laundry_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 127, + "y": 0 + }, + "library_11": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 489, + "y": 106 + }, + "library_15": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 20, + "y": 190 + }, + "lighthouse_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 286, + "y": 64 + }, + "lighthouse_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 148, + "y": 0 + }, + "lodging_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 303, + "y": 64 + }, + "lodging_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 169, + "y": 0 + }, + "marker_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 282, + "y": 148 + }, + "marker_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 152, + "y": 210 + }, + "monument_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 320, + "y": 64 + }, + "monument_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 190, + "y": 0 + }, + "mountain_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 337, + "y": 64 + }, + "mountain_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 211, + "y": 0 + }, + "museum_11": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 252, + "y": 127 + }, + "museum_15": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 40, + "y": 190 + }, + "music_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 354, + "y": 64 + }, + "music_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 232, + "y": 0 + }, + "park_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 371, + "y": 64 + }, + "park_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 127 + }, + "parking_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 297, + "y": 148 + }, + "parking_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 171, + "y": 210 + }, + "parking_garage_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 312, + "y": 148 + }, + "parking_garage_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 190, + "y": 210 + }, + "pedestrian_polygon": { + "height": 64, + "pixelRatio": 1, + "width": 64, + "x": 0, + "y": 0 + }, + "pharmacy_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 388, + "y": 64 + }, + "pharmacy_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 127 + }, + "picnic_site_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 405, + "y": 64 + }, + "picnic_site_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 127 + }, + "pitch_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 422, + "y": 64 + }, + "pitch_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 127 + }, + "place_of_worship_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 439, + "y": 64 + }, + "place_of_worship_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 127 + }, + "playground_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 456, + "y": 64 + }, + "playground_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 127 + }, + "police_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 473, + "y": 64 + }, + "police_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 127 + }, + "post_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 490, + "y": 64 + }, + "post_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 127 + }, + "prison_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 252, + "y": 85 + }, + "prison_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 127 + }, + "railway_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 327, + "y": 148 + }, + "railway_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 209, + "y": 210 + }, + "railway_light_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 342, + "y": 148 + }, + "railway_light_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 228, + "y": 210 + }, + "railway_metro_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 357, + "y": 148 + }, + "railway_metro_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 0, + "y": 229 + }, + "ranger_station_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 269, + "y": 85 + }, + "ranger_station_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 127 + }, + "religious_christian_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 286, + "y": 85 + }, + "religious_christian_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 127 + }, + "religious_jewish_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 303, + "y": 85 + }, + "religious_jewish_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 127 + }, + "religious_muslim_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 320, + "y": 85 + }, + "religious_muslim_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 148 + }, + "restaurant_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 337, + "y": 85 + }, + "restaurant_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 148 + }, + "roadblock_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 354, + "y": 85 + }, + "roadblock_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 148 + }, + "rocket_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 371, + "y": 85 + }, + "rocket_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 148 + }, + "school_11": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 268, + "y": 127 + }, + "school_15": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 60, + "y": 190 + }, + "shelter_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 388, + "y": 85 + }, + "shelter_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 148 + }, + "shop_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 405, + "y": 85 + }, + "shop_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 148 + }, + "skiing_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 422, + "y": 85 + }, + "skiing_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 148 + }, + "soccer_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 439, + "y": 85 + }, + "soccer_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 148 + }, + "square-stroke_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 372, + "y": 148 + }, + "square-stroke_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 19, + "y": 229 + }, + "square_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 387, + "y": 148 + }, + "square_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 38, + "y": 229 + }, + "stadium_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 456, + "y": 85 + }, + "stadium_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 148 + }, + "star-stroke_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 402, + "y": 148 + }, + "star-stroke_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 57, + "y": 229 + }, + "star_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 417, + "y": 148 + }, + "star_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 76, + "y": 229 + }, + "suitcase_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 473, + "y": 85 + }, + "suitcase_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 148 + }, + "sushi_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 490, + "y": 85 + }, + "sushi_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 148 + }, + "swimming_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 252, + "y": 106 + }, + "swimming_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 148 + }, + "telephone_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 269, + "y": 106 + }, + "telephone_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 0, + "y": 169 + }, + "tennis_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 286, + "y": 106 + }, + "tennis_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 21, + "y": 169 + }, + "theatre_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 303, + "y": 106 + }, + "theatre_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 42, + "y": 169 + }, + "toilet_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 320, + "y": 106 + }, + "toilet_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 63, + "y": 169 + }, + "town_hall_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 337, + "y": 106 + }, + "town_hall_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 84, + "y": 169 + }, + "triangle_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 432, + "y": 148 + }, + "triangle_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 95, + "y": 229 + }, + "triangle_stroked_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 447, + "y": 148 + }, + "triangle_stroked_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 114, + "y": 229 + }, + "veterinary_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 354, + "y": 106 + }, + "veterinary_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 105, + "y": 169 + }, + "volcano_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 371, + "y": 106 + }, + "volcano_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 126, + "y": 169 + }, + "warehouse_11": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 462, + "y": 148 + }, + "warehouse_15": { + "height": 19, + "pixelRatio": 1, + "width": 19, + "x": 133, + "y": 229 + }, + "waste_basket_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 388, + "y": 106 + }, + "waste_basket_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 147, + "y": 169 + }, + "water_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 405, + "y": 106 + }, + "water_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 168, + "y": 169 + }, + "wetland_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 422, + "y": 106 + }, + "wetland_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 189, + "y": 169 + }, + "wheelchair_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 439, + "y": 106 + }, + "wheelchair_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 210, + "y": 169 + }, + "zoo_11": { + "height": 17, + "pixelRatio": 1, + "width": 17, + "x": 456, + "y": 106 + }, + "zoo_15": { + "height": 21, + "pixelRatio": 1, + "width": 21, + "x": 231, + "y": 169 + } +} \ No newline at end of file diff --git a/data/tiles/sprites.png b/data/tiles/sprites.png new file mode 100644 index 0000000..54aa199 Binary files /dev/null and b/data/tiles/sprites.png differ diff --git a/data/tiles/sprites@2x.json b/data/tiles/sprites@2x.json new file mode 100644 index 0000000..69dc186 --- /dev/null +++ b/data/tiles/sprites@2x.json @@ -0,0 +1,1689 @@ +{ + "aerialway_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 568, + "y": 254 + }, + "aerialway_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 160, + "y": 380 + }, + "airfield_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 598, + "y": 254 + }, + "airfield_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 198, + "y": 380 + }, + "airport_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 628, + "y": 254 + }, + "airport_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 236, + "y": 380 + }, + "alcohol_shop_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 762, + "y": 420 + }, + "alcohol_shop_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 128, + "y": 0 + }, + "america_football_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 796, + "y": 420 + }, + "america_football_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 170, + "y": 0 + }, + "amusement_park_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 830, + "y": 420 + }, + "amusement_park_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 212, + "y": 0 + }, + "aquarium_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 864, + "y": 420 + }, + "aquarium_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 128 + }, + "arrow": { + "height": 14, + "pixelRatio": 2, + "width": 40, + "x": 972, + "y": 296 + }, + "art_gallery_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 898, + "y": 420 + }, + "art_gallery_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 128 + }, + "attraction_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 932, + "y": 420 + }, + "attraction_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 128 + }, + "bakery_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 966, + "y": 420 + }, + "bakery_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 128 + }, + "bank_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 454, + "y": 458 + }, + "bank_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 128 + }, + "bar_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 488, + "y": 458 + }, + "bar_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 128 + }, + "baseball_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 522, + "y": 458 + }, + "baseball_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 170 + }, + "basketball_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 556, + "y": 458 + }, + "basketball_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 170 + }, + "beer_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 590, + "y": 458 + }, + "beer_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 170 + }, + "bicycle_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 624, + "y": 458 + }, + "bicycle_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 170 + }, + "bicycle_rental_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 658, + "y": 458 + }, + "bicycle_rental_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 170 + }, + "building_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 658, + "y": 254 + }, + "building_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 274, + "y": 380 + }, + "bus_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 688, + "y": 254 + }, + "bus_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 312, + "y": 380 + }, + "butcher_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 692, + "y": 458 + }, + "butcher_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 170 + }, + "cafe_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 726, + "y": 458 + }, + "cafe_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 212 + }, + "campsite_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 760, + "y": 458 + }, + "campsite_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 212 + }, + "car_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 718, + "y": 254 + }, + "car_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 350, + "y": 380 + }, + "castle_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 794, + "y": 458 + }, + "castle_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 212 + }, + "cemetery_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 828, + "y": 458 + }, + "cemetery_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 212 + }, + "cinema_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 862, + "y": 458 + }, + "cinema_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 212 + }, + "circle-stroked_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 748, + "y": 254 + }, + "circle-stroked_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 388, + "y": 380 + }, + "circle_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 778, + "y": 254 + }, + "circle_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 426, + "y": 380 + }, + "clothing_store_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 896, + "y": 458 + }, + "clothing_store_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 212 + }, + "college_11": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 946, + "y": 212 + }, + "college_15": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 0, + "y": 380 + }, + "commercial_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 808, + "y": 254 + }, + "commercial_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 464, + "y": 380 + }, + "cricket_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 930, + "y": 458 + }, + "cricket_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 128 + }, + "cross_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 838, + "y": 254 + }, + "cross_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 0, + "y": 420 + }, + "dam_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 868, + "y": 254 + }, + "dam_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 38, + "y": 420 + }, + "danger_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 964, + "y": 458 + }, + "danger_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 128 + }, + "default_1": { + "height": 36, + "pixelRatio": 2, + "width": 36, + "x": 304, + "y": 458 + }, + "default_2": { + "height": 36, + "pixelRatio": 2, + "width": 50, + "x": 340, + "y": 458 + }, + "default_3": { + "height": 36, + "pixelRatio": 2, + "width": 64, + "x": 390, + "y": 458 + }, + "default_4": { + "height": 36, + "pixelRatio": 2, + "width": 78, + "x": 494, + "y": 420 + }, + "default_5": { + "height": 36, + "pixelRatio": 2, + "width": 90, + "x": 572, + "y": 420 + }, + "default_6": { + "height": 36, + "pixelRatio": 2, + "width": 100, + "x": 662, + "y": 420 + }, + "dentist_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 502, + "y": 380 + }, + "dentist_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 128 + }, + "doctor_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 536, + "y": 380 + }, + "doctor_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 128 + }, + "dog_park_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 570, + "y": 380 + }, + "dog_park_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 128 + }, + "dot_10": { + "height": 20, + "pixelRatio": 2, + "width": 20, + "x": 998, + "y": 458 + }, + "dot_11": { + "height": 22, + "pixelRatio": 2, + "width": 22, + "x": 1000, + "y": 420 + }, + "dot_9": { + "height": 18, + "pixelRatio": 2, + "width": 18, + "x": 954, + "y": 296 + }, + "drinking-water_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 604, + "y": 380 + }, + "drinking_water_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 128 + }, + "embassy_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 638, + "y": 380 + }, + "embassy_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 170 + }, + "entrance_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 898, + "y": 254 + }, + "entrance_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 76, + "y": 420 + }, + "fast_food_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 672, + "y": 380 + }, + "fast_food_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 170 + }, + "ferry_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 928, + "y": 254 + }, + "ferry_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 114, + "y": 420 + }, + "fire-station_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 706, + "y": 380 + }, + "fire-station_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 170 + }, + "fuel_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 958, + "y": 254 + }, + "fuel_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 152, + "y": 420 + }, + "garden_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 740, + "y": 380 + }, + "garden_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 170 + }, + "gift_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 774, + "y": 380 + }, + "gift_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 170 + }, + "golf_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 808, + "y": 380 + }, + "golf_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 170 + }, + "grocery_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 842, + "y": 380 + }, + "grocery_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 212 + }, + "hairdresser_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 876, + "y": 380 + }, + "hairdresser_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 212 + }, + "harbor_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 988, + "y": 254 + }, + "harbor_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 190, + "y": 420 + }, + "heart_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 910, + "y": 380 + }, + "heart_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 212 + }, + "heliport_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 504, + "y": 296 + }, + "heliport_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 228, + "y": 420 + }, + "hospital_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 944, + "y": 380 + }, + "hospital_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 212 + }, + "ice_cream_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 978, + "y": 380 + }, + "ice_cream_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 212 + }, + "industry_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 534, + "y": 296 + }, + "industry_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 266, + "y": 420 + }, + "information_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 504, + "y": 128 + }, + "information_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 212 + }, + "laundry_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 538, + "y": 128 + }, + "laundry_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 254, + "y": 0 + }, + "library_11": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 978, + "y": 212 + }, + "library_15": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 40, + "y": 380 + }, + "lighthouse_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 572, + "y": 128 + }, + "lighthouse_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 296, + "y": 0 + }, + "lodging_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 606, + "y": 128 + }, + "lodging_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 338, + "y": 0 + }, + "marker_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 564, + "y": 296 + }, + "marker_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 304, + "y": 420 + }, + "monument_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 640, + "y": 128 + }, + "monument_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 380, + "y": 0 + }, + "mountain_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 674, + "y": 128 + }, + "mountain_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 422, + "y": 0 + }, + "museum_11": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 504, + "y": 254 + }, + "museum_15": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 80, + "y": 380 + }, + "music_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 708, + "y": 128 + }, + "music_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 464, + "y": 0 + }, + "park_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 742, + "y": 128 + }, + "park_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 254 + }, + "parking_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 594, + "y": 296 + }, + "parking_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 342, + "y": 420 + }, + "parking_garage_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 624, + "y": 296 + }, + "parking_garage_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 380, + "y": 420 + }, + "pedestrian_polygon": { + "height": 128, + "pixelRatio": 2, + "width": 128, + "x": 0, + "y": 0 + }, + "pharmacy_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 776, + "y": 128 + }, + "pharmacy_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 254 + }, + "picnic_site_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 810, + "y": 128 + }, + "picnic_site_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 254 + }, + "pitch_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 844, + "y": 128 + }, + "pitch_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 254 + }, + "place_of_worship_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 878, + "y": 128 + }, + "place_of_worship_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 254 + }, + "playground_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 912, + "y": 128 + }, + "playground_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 254 + }, + "police_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 946, + "y": 128 + }, + "police_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 254 + }, + "post_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 980, + "y": 128 + }, + "post_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 254 + }, + "prison_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 504, + "y": 170 + }, + "prison_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 254 + }, + "railway_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 654, + "y": 296 + }, + "railway_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 418, + "y": 420 + }, + "railway_light_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 684, + "y": 296 + }, + "railway_light_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 456, + "y": 420 + }, + "railway_metro_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 714, + "y": 296 + }, + "railway_metro_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 0, + "y": 458 + }, + "ranger_station_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 538, + "y": 170 + }, + "ranger_station_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 254 + }, + "religious_christian_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 572, + "y": 170 + }, + "religious_christian_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 254 + }, + "religious_jewish_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 606, + "y": 170 + }, + "religious_jewish_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 254 + }, + "religious_muslim_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 640, + "y": 170 + }, + "religious_muslim_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 296 + }, + "restaurant_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 674, + "y": 170 + }, + "restaurant_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 296 + }, + "roadblock_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 708, + "y": 170 + }, + "roadblock_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 296 + }, + "rocket_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 742, + "y": 170 + }, + "rocket_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 296 + }, + "school_11": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 536, + "y": 254 + }, + "school_15": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 120, + "y": 380 + }, + "shelter_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 776, + "y": 170 + }, + "shelter_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 296 + }, + "shop_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 810, + "y": 170 + }, + "shop_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 296 + }, + "skiing_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 844, + "y": 170 + }, + "skiing_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 296 + }, + "soccer_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 878, + "y": 170 + }, + "soccer_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 296 + }, + "square-stroke_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 744, + "y": 296 + }, + "square-stroke_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 38, + "y": 458 + }, + "square_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 774, + "y": 296 + }, + "square_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 76, + "y": 458 + }, + "stadium_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 912, + "y": 170 + }, + "stadium_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 296 + }, + "star-stroke_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 804, + "y": 296 + }, + "star-stroke_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 114, + "y": 458 + }, + "star_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 834, + "y": 296 + }, + "star_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 152, + "y": 458 + }, + "suitcase_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 946, + "y": 170 + }, + "suitcase_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 296 + }, + "sushi_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 980, + "y": 170 + }, + "sushi_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 296 + }, + "swimming_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 504, + "y": 212 + }, + "swimming_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 296 + }, + "telephone_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 538, + "y": 212 + }, + "telephone_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 0, + "y": 338 + }, + "tennis_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 572, + "y": 212 + }, + "tennis_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 42, + "y": 338 + }, + "theatre_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 606, + "y": 212 + }, + "theatre_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 84, + "y": 338 + }, + "toilet_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 640, + "y": 212 + }, + "toilet_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 126, + "y": 338 + }, + "town_hall_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 674, + "y": 212 + }, + "town_hall_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 168, + "y": 338 + }, + "triangle_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 864, + "y": 296 + }, + "triangle_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 190, + "y": 458 + }, + "triangle_stroked_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 894, + "y": 296 + }, + "triangle_stroked_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 228, + "y": 458 + }, + "veterinary_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 708, + "y": 212 + }, + "veterinary_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 210, + "y": 338 + }, + "volcano_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 742, + "y": 212 + }, + "volcano_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 252, + "y": 338 + }, + "warehouse_11": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 924, + "y": 296 + }, + "warehouse_15": { + "height": 38, + "pixelRatio": 2, + "width": 38, + "x": 266, + "y": 458 + }, + "waste_basket_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 776, + "y": 212 + }, + "waste_basket_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 294, + "y": 338 + }, + "water_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 810, + "y": 212 + }, + "water_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 336, + "y": 338 + }, + "wetland_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 844, + "y": 212 + }, + "wetland_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 378, + "y": 338 + }, + "wheelchair_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 878, + "y": 212 + }, + "wheelchair_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 420, + "y": 338 + }, + "zoo_11": { + "height": 34, + "pixelRatio": 2, + "width": 34, + "x": 912, + "y": 212 + }, + "zoo_15": { + "height": 42, + "pixelRatio": 2, + "width": 42, + "x": 462, + "y": 338 + } +} diff --git a/data/tiles/sprites@2x.png b/data/tiles/sprites@2x.png new file mode 100644 index 0000000..456cf03 Binary files /dev/null and b/data/tiles/sprites@2x.png differ diff --git a/src/Define.vala b/src/Define.vala index 18c6fa0..e1490db 100644 --- a/src/Define.vala +++ b/src/Define.vala @@ -23,4 +23,8 @@ namespace Define { public const string EXPLORE = "explore"; public const string TRANSIT = "transit"; } + + namespace MapID { + public const string EXPLORE_LIGHT = "explore-light"; + } } diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 597bc7b..5443842 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -30,6 +30,7 @@ public class Maps.MainWindow : Adw.ApplicationWindow { private Gtk.SearchEntry search_entry; private Gtk.Popover search_res_popover; private MapWidget map_widget; + private Shumate.MapSourceRegistry registry; construct { title = _("Maps"); @@ -288,6 +289,14 @@ public class Maps.MainWindow : Adw.ApplicationWindow { } private void setup_map_source_action () { + registry = new Shumate.MapSourceRegistry.with_defaults (); + + try { + load_vector_tiles (); + } catch (Error e) { + critical ("Failed to create vector map style: %s", e.message); + } + var map_source_action = Application.settings.create_action ("map-source"); add_action (map_source_action); @@ -295,10 +304,33 @@ public class Maps.MainWindow : Adw.ApplicationWindow { "map-source", map_widget, "map-source", GET, (SettingsBindGetMappingShared) Util.map_source_get_mapping_cb, (SettingsBindSetMappingShared) null, - null, null + registry, null ); } + private void load_vector_tiles () throws Error requires (Shumate.VectorRenderer.is_supported ()) { + var style_json = new Maps.MapStyle (Define.MapID.EXPLORE_LIGHT).to_string (); + critical (style_json); + + var renderer = new Shumate.VectorRenderer (Define.MapID.EXPLORE_LIGHT, style_json) { + license = "© OpenMapTiles © OpenStreetMap contributors", + max_zoom_level = 19, + min_zoom_level = 2 + }; + + var sprites_json = resources_lookup_data ("/io/elementary/maps/tiles/sprites.json", NONE); + var sprites_texture = Gdk.Texture.from_resource ("/io/elementary/maps/tiles/sprites.png"); + + var sprites_2x_json = resources_lookup_data ("/io/elementary/maps/tiles/sprites@2x.json", NONE); + var sprites_2x_texture = Gdk.Texture.from_resource ("/io/elementary/maps/tiles/sprites@2x.png"); + + var sprites = renderer.get_sprite_sheet (); + sprites.add_page (sprites_texture, (string) sprites_json.get_data (), 1); + sprites.add_page (sprites_2x_texture, (string) sprites_2x_json.get_data (), 2); + + registry.add (renderer); + } + private async void search_location (string term, ListStore res) { busy_start (BusyReason.SEARCHING); diff --git a/src/Util.vala b/src/Util.vala index 04860ad..34bb08d 100644 --- a/src/Util.vala +++ b/src/Util.vala @@ -34,11 +34,17 @@ namespace Util { } public static bool map_source_get_mapping_cb (Value value, Variant variant, void* user_data) { + unowned var registry = user_data as Shumate.MapSourceRegistry; + if (registry == null) { + warning ("map_source_get_mapping_cb: Invalid user_data"); + return false; + } + string map_source; var val = (string) variant; switch (val) { case Define.MapSetting.EXPLORE: - map_source = Shumate.MAP_SOURCE_OSM_MAPNIK; + map_source = Define.MapID.EXPLORE_LIGHT; break; case Define.MapSetting.TRANSIT: map_source = Shumate.MAP_SOURCE_OSM_TRANSPORT_MAP; @@ -48,7 +54,6 @@ namespace Util { return false; } - var registry = new Shumate.MapSourceRegistry.with_defaults (); value.set_object (registry.get_by_id (map_source)); return true; diff --git a/src/meson.build b/src/meson.build index 61815a5..e61885c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -17,6 +17,7 @@ dependencies = [ # Version limitation for Granite.Bin dependency('granite-7', version: '>= 7.6.0'), dependency('gtk4'), + dependency('json-glib-1.0'), dependency('libadwaita-1'), dependency('libgeoclue-2.0'), dependency('shumate-1.0'), @@ -29,6 +30,9 @@ sources = files( 'MapWidget.vala', 'SearchResultItem.vala', 'Util.vala', + + 'renderers' / 'JsonObject.vala', + 'renderers' / 'MapStyle.vala' ) executable( diff --git a/src/renderers/JsonObject.vala b/src/renderers/JsonObject.vala new file mode 100644 index 0000000..32130e4 --- /dev/null +++ b/src/renderers/JsonObject.vala @@ -0,0 +1,38 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) + */ + +public class Maps.JsonObject : Object, Json.Serializable { + public override Json.Node serialize_property (string prop, Value val, ParamSpec spec) { + var type = spec.value_type; + + if (type.is_a (typeof (Maps.Expression))) { + var expression = (Maps.Expression) val; + return expression.serialize (); + } + + if (type.is_a (typeof (Gee.ArrayList))) { + return serialize_list (prop, val, spec); + } + + return default_serialize_property (prop, val, spec); + } + + private static Json.Node serialize_list (string prop, Value val, ParamSpec spec) { + var list = (Gee.ArrayList) val; + if (list == null) { + return new Json.Node (NULL); + } + + var array = new Json.Array (); + foreach (var object in list) { + array.add_element (Json.gobject_serialize (object)); + } + + var node = new Json.Node (ARRAY); + node.set_array (array); + + return node; + } +} diff --git a/src/renderers/MapStyle.vala b/src/renderers/MapStyle.vala new file mode 100644 index 0000000..f677a57 --- /dev/null +++ b/src/renderers/MapStyle.vala @@ -0,0 +1,536 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) + */ + + +// https://openmaptiles.org/docs/style/mapbox-gl-style-spec/ +// https://openmaptiles.org/schema/ +public class Maps.MapStyle : Maps.JsonObject { + public int version { get; private set; } + public string name { get; construct set; } + public Sources sources { get; private set; } + public Gee.ArrayList layers { get; private set; } + + private const string BANANA_300 = "#ffe16b"; + private const string BLUEBERRY_100 = "#8cd5ff"; + private const string LATTE_25 = "#f6f3ed"; + private const string LATTE_50 = "#f7f0e3"; + private const string LATTE_75 = "#f3e7d3"; + private const string LATTE_100 = "#efdfc4"; + private const string LIME_100 = "#d1ff82"; + private const string LIME_300 = "#9bdb4d"; + private const string SILVER_100 = "#fafafa"; + private const string SILVER_300 = "#d4d4d4"; + + public MapStyle (string name) { + Object (name: name); + } + + construct { + version = 8; + sources = new Sources (); + + var background = new Layer () { + id = "background", + kind = "background", + paint = new Layer.Paint () { + background_color = LATTE_25 + } + }; + + var park = new Layer () { + id = "park", + kind = "fill", + source = "vector-tiles", + source_layer = "park", + paint = new Layer.Paint () { + fill_color = LIME_300, + fill_opacity = 0.7, + fill_outline_color = LIME_300 + } + }; + + var park_outline = new Layer () { + id = "park_outline", + kind = "line", + source = "vector-tiles", + source_layer = "park", + paint = new Layer.Paint () { + // line_dasharray = [1, 1.5], + // line_color = LIME_100 // FIXME: segfault + } + }; + + // var landuse_residential_filter = new Maps.Expression ("all"); + // landuse_residential_filter.append ("==", "class", "residential"); + + // var landuse_residential = new Layer () { + // id = "landuse_residential", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landuse", + // maxzoom = 8, + // filter = landuse_residential_filter, + // paint = new Layer.Paint () { + // // fill_color = { + // // "base": 1, + // // "stops": [ + // // [9, "hsla(0, 3%, 85%, 0.84)"], + // // [12, "hsla(35, 57%, 88%, 0.49)"] + // // ] + // // } + // } + // }; + + // var landcover_wood_filter = new Maps.Expression ("all"); + // landcover_wood_filter.append ("==", "class", "wood"); + + // var landcover_wood = new Layer () { + // id = "landcover_wood", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landcover", + // filter = landcover_wood_filter, + // paint = new Layer.Paint () { + // fill_antialias = false, + // fill_color = "hsla(98, 61%, 72%, 0.7)", + // fill_opacity = 0.4 + // } + // }; + + // var landcover_grass_filter = new Maps.Expression ("all"); + // landcover_grass_filter.append ("==", "class", "grass"); + + // var landcover_grass = new Layer () { + // id = "landcover_grass", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landcover", + // filter = landcover_grass_filter, + // paint = new Layer.Paint () { + // fill_antialias = false, + // fill_color = LIME_300, + // fill_opacity = 0.5 + // } + // }; + + // var landcover_ice_filter = new Maps.Expression ("all"); + // landcover_ice_filter.append ("==", "class", "ice"); + + // var landcover_ice = new Layer () { + // id = "landcover_ice", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landcover", + // filter = landcover_ice_filter, + // paint = new Layer.Paint () { + // fill_antialias = false, + // fill_color = "rgba(224, 236, 236, 1)", + // fill_opacity = 0.8 + // } + // }; + + // var landuse_cemetery_filter = new Maps.Expression ("all"); + // landuse_cemetery_filter.append ("==", "class", "cemetery"); + + // var landuse_cemetery = new Layer () { + // id = "landuse_cemetery", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landuse", + // filter = landuse_cemetery_filter, + // paint = new Layer.Paint () { + // fill_color = "hsl(75, 37%, 81%)" + // } + // }; + + // var landuse_hospital_filter = new Maps.Expression ("all"); + // landuse_hospital_filter.append ("==", "class", "hospital"); + + // var landuse_hospital = new Layer () { + // id = "landuse_hospital", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landuse", + // paint = new Layer.Paint () { + // fill_color = "#fde" + // } + // }; + + // var landuse_school = new Layer () { + // id = "landuse_school", + // kind = "fill", + // source = "openmaptiles", + // source_layer = "landuse", + // // "filter": ["==", "class", "school"], + // paint = new Layer.Paint () { + // fill_color = "rgb(236,238,204)" + // } + // }; + + var waterway_tunnel_filter = new Maps.Expression ("all"); + waterway_tunnel_filter.append ("==", "brunnel", "tunnel"); + + var waterway_tunnel = new Layer () { + id = "waterway_tunnel", + kind = "line", + source = "openmaptiles", + source_layer = "waterway", + filter = waterway_tunnel_filter, + // paint = new Layer.Paint () { + // line_color = "#a0c8f0", + // line_dasharray = {3, 3}, + // // line_gap_width = {"stops": [[12, 0], [20, 6]]}, + // line_opacity = 1, + // // line_width = {"base": 1.4, "stops": [[8, 1], [20, 2]]} + // } + }; + + // var waterway_river_filter = new Maps.Expression ("all"); + // waterway_river_filter.append ("==", "class", "river"); + // waterway_river_filter.append ("!=", "brunnel", "tunnel"); + + // var waterway_river = new Layer () { + // id = "waterway_river", + // kind = "line", + // source = "openmaptiles", + // source_layer = "waterway", + // filter = waterway_river_filter, + // layout = new Layer.Layout () { + // line_cap = "round" + // }, + // paint = new Layer.Paint () { + // line_color = "#a0c8f0", + // // line_width = {"base": 1.2, "stops": [[11, 0.5], [20, 6]]} + // } + // }; + + // var waterway_other_filter = new Maps.Expression ("all"); + // waterway_other_filter.append ("!=", "class", "river"); + // waterway_other_filter.append ("!=", "brunnel", "tunnel"); + + // var waterway_other = new Layer () { + // id = "waterway_other", + // kind = "line", + // source = "openmaptiles", + // source_layer = "waterway", + // filter = waterway_other_filter, + // layout = new Layer.Layout () { + // line_cap = "round" + // }, + // paint = new Layer.Paint () { + // line_color = "#a0c8f0", + // // line_width = {"base": 1.3, "stops": [[13, 0.5], [20, 6]]} + // } + // }; + + var water_filter = new Maps.Expression ("all"); + water_filter.append ("!=", "brunnel", "tunnel"); + + var water = new Layer () { + id = "water", + kind = "fill", + source = "vector-tiles", + source_layer = "water", + filter = water_filter, + paint = new Layer.Paint () { + fill_color = BLUEBERRY_100 + } + }; + + var road_minor_filter = new Maps.Expression ("all"); + // road_minor_filter.append ("==", "$type", "LineString"); // FIXME: segfault + // road_minor_filter.append ("!in", "brunnel", "bridge", "tunnel"); // FIXME: segfault + road_minor_filter.append ("in", "class", "minor"); + + var road_minor = new Layer () { + id = "road_minor", + kind = "line", + source = "vector-tiles", + source_layer = "transportation", + filter = road_minor_filter, + layout = new Layer.Layout () { + line_cap = "round", + line_join = "round" + }, + paint = new Layer.Paint () { + line_color = SILVER_100 + // line_width = {"base": 1.2, "stops": [[13.5, 0], [14, 2.5], [20, 18]]} + } + }; + + + var road_secondary_tertiary_filter = new Maps.Expression ("all"); + road_secondary_tertiary_filter.append ("!in", "brunnel", "bridge", "tunnel"); + road_secondary_tertiary_filter.append ("in", "class", "secondary", "tertiary"); + + var road_secondary_tertiary = new Layer () { + id = "road_secondary_tertiary", + kind = "line", + source = "vector-tiles", + source_layer = "transportation", + filter = road_secondary_tertiary_filter, + layout = new Layer.Layout () { + line_cap = "round", + line_join = "round" + }, + paint = new Layer.Paint () { + line_color = SILVER_100 + // line_width = {"base": 1.2, "stops": [[6.5, 0], [8, 0.5], [20, 13]]} + } + }; + + var road_trunk_primary_filter = new Maps.Expression ("all"); + road_trunk_primary_filter.append ("!in", "brunnel", "bridge", "tunnel"); + road_trunk_primary_filter.append ("in", "class", "primary", "trunk"); + + var road_trunk_primary = new Layer () { + id = "road_trunk_primary", + kind = "line", + source = "vector-tiles", + source_layer = "transportation", + filter = road_trunk_primary_filter, + layout = new Layer.Layout () { + line_join = "round" + }, + paint = new Layer.Paint () { + line_color = SILVER_300 + // line_width = {"base": 1.2, "stops": [[5, 0], [7, 1], [20, 18]]} + } + }; + + var road_motorway_filter = new Maps.Expression ("all"); + road_motorway_filter.append ("==", "class", "motorway"); + + var road_motorway = new Layer () { + id = "road_motorway", + kind = "line", + source = "vector-tiles", + source_layer = "transportation", + minzoom = 5, + filter = road_motorway_filter, + layout = new Layer.Layout () { + line_cap = "round", + line_join = "round" + }, + paint = new Layer.Paint () { + line_color = BANANA_300, + line_width = new InterpolateExpression () { + base_val = 1.2 + // stops = {[5, 0], [7, 1], [20, 18]} + } + } + }; + + var building = new Layer () { + id = "building", + kind = "fill", + source = "vector-tiles", + source_layer = "building", + minzoom = 13, + paint = new Layer.Paint () { + fill_color = LATTE_75, + // "fill-outline-color": { + // "base": 1, + // "stops": [[13, "hsla(35, 6%, 79%, 0.32)"], [14, "hsl(35, 6%, 79%)"]] + // } + } + }; + + var place_city_filter = new Maps.Expression ("all"); + place_city_filter.append ("==", "class", "city"); + + var place_city = new Layer () { + id = "place_city", + kind = "symbol", + source = "vector-tiles", + source_layer = "place", + minzoom = 5, + maxzoom = 15, + filter = place_city_filter, + layout = new Layer.Layout () { + // "icon-image": {"base": 1, "stops": [[0, "dot_9"], [8, ""]]}, + text_anchor = "bottom", + text_field = "{name_en}", // FIXME: Localize properly + text_font = {"Inter Medium"}, + text_max_width = 8, + text_offset = {0, 0}, + // text_size = new InterpolateExpression () { + // base = 1.2 + // "stops": [[7, 14], [11, 32]] + // }, + icon_allow_overlap = true, + icon_optional = false + }, + paint = new Layer.Paint () { + text_color = "#333" + } + + // "metadata": { + // "libshumate:cursor": "pointer" + // } + }; + + layers = new Gee.ArrayList (null); + layers.add (background); + layers.add (park); + // layers.add (park_outline); + // layers.add (landuse_residential); + // layers.add (landcover_wood); + // layers.add (landcover_grass); + // layers.add (landcover_ice); + // layers.add (landuse_cemetery); + // layers.add (landuse_hospital); + // layers.add (landuse_school); + // layers.add (waterway_tunnel); + // layers.add (waterway_river); + // layers.add (waterway_other); + layers.add (water); + layers.add (road_minor); + layers.add (road_secondary_tertiary); + layers.add (road_trunk_primary); + layers.add (road_motorway); + layers.add (building); + layers.add (place_city); + + // // "metadata": { + // // "libshumate:cursor": "pointer" + // // } + } + + public string to_string () { + var generator = new Json.Generator () { + root = Json.gobject_serialize (this) + }; + + return generator.to_data (null).replace ("kind", "type"); + } + + public class Sources : Object { + public VectorTiles vector_tiles { get; private set; } + + construct { + vector_tiles = new VectorTiles (); + } + + public class VectorTiles : Maps.JsonObject { + public string kind { get; private set; default = "vector"; } + public string[] tiles { get; private set; default = {"https://tileserver.gnome.org/data/v3/{z}/{x}/{y}.pbf"}; } + public int maxzoom { get; private set; } + public int minzoom { get; private set; } + + construct { + minzoom = 0; + maxzoom = 14; + } + } + } + + // https://docs.maptiler.com/gl-style-specification/layers/ + public class Layer : Maps.JsonObject { + public string id { get; set; } + public string kind { get; set; } + public string source { get; set; } + public string source_layer { get; set; } + public int maxzoom { get; set; } + public int minzoom { get; set; } + + public Expression filter { get; set; } + public Layout layout { get; set; } + public Paint paint { get; set; } + + // https://docs.maptiler.com/gl-style-specification/layers/#paint-property + public class Paint : Maps.JsonObject { + public double fill_opacity { get; set; } + public string background_color { get; set; } + public bool fill_antialias { get; set;} + public string fill_color { get; set; } + public string fill_outline_color { get; set; } + public string text_color { get; set; } + public string line_color { get; set; } + public double line_opacity { get; set; } + public double[] line_dasharray { get; set; } + public InterpolateExpression line_width { get; set; } + } + + public class Layout : Maps.JsonObject { + public string line_cap { get; set; } + public string line_join { get; set; } + public string text_anchor { get; set; } + public string text_field { get; set; } + public string[] text_font { get; set; } + public int text_max_width { get; set; } + public double[] text_offset { get; set; } + public InterpolateExpression text_size { get; set; } + public string text_transform { get; set; } + public bool icon_allow_overlap { get; set; } + public bool icon_optional { get; set; } + } + } +} + +// https://docs.maptiler.com/gl-style-specification/expressions/#interpolate +public class Maps.InterpolateExpression : Maps.JsonObject { + public double base_val { get; set; } // Need to serialize as base + public Gee.ArrayList stops { get; set; } + + construct { + stops = new Gee.ArrayList (null); + } +} + +// https://docs.maptiler.com/gl-style-specification/expressions/ +public class Maps.Expression : Maps.JsonObject { + public string name { get; construct set; } + public Gee.ArrayList args { get; set; } + + public Expression (string name) { + Object (name: name); + } + + construct { + args = new Gee.ArrayList (null); + } + + public void append (string operator, ...) { + var argument = new Json.Array (); + + argument.add_string_element (operator); + + var list = va_list (); + while (true) { + string? string_arg = list.arg (); + if (string_arg != null) { + argument.add_string_element (string_arg); + continue; + } + + int? int_arg = list.arg (); + if (int_arg != null) { + argument.add_int_element (int_arg); + continue; + } + + break; + } + + args.add (argument); + } + + // FIXME: assertion 'self != NULL' failed + public Json.Node serialize () { + var array = new Json.Array (); + + array.add_string_element (name); + + foreach (var argument in args) { + array.add_array_element (argument); + } + + var node = new Json.Node (ARRAY); + node.set_array (array); + + return node; + } +}