diff --git a/go.mod b/go.mod index 1e7f280..ae8932a 100755 --- a/go.mod +++ b/go.mod @@ -2,7 +2,11 @@ module git.zhouxhere.com/zhouxhere/maptile go 1.22.5 -require github.com/twpayne/go-geom v1.6.0 +require ( + github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 + github.com/twpayne/go-geom v1.6.0 + golang.org/x/image v0.0.0-20211028202545-6944b10bf410 +) require ( github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -56,6 +60,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.9.1 github.com/spf13/viper v1.19.0 + github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c github.com/swaggo/echo-swagger v1.4.1 github.com/swaggo/swag v1.16.4 golang.org/x/crypto v0.33.0 // indirect @@ -66,3 +71,5 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c => github.com/zhouxhere/oksvg v0.0.0-20250327093439-d7b4c44f1879 diff --git a/go.sum b/go.sum index b568b68..0eaf550 100755 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= -github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= @@ -143,6 +141,8 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 h1:oDMiXaTMyBEuZMU53atpxqYsSB3U1CHkeAu2zr6wTeY= +github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= @@ -161,6 +161,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/zhouxhere/oksvg v0.0.0-20250327093439-d7b4c44f1879 h1:Tqrf44gHnpP1bblyB1Z4poRDUK8NgwurOU270IcO640= +github.com/zhouxhere/oksvg v0.0.0-20250327093439-d7b4c44f1879/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= @@ -177,6 +179,8 @@ golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= @@ -187,10 +191,12 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/icons/airfield_11.svg b/icons/airfield_11.svg new file mode 100644 index 0000000..0d2b3b6 --- /dev/null +++ b/icons/airfield_11.svg @@ -0,0 +1,3 @@ +airfield-11.svg \ No newline at end of file diff --git a/icons/airport_11.svg b/icons/airport_11.svg new file mode 100644 index 0000000..66cd4aa --- /dev/null +++ b/icons/airport_11.svg @@ -0,0 +1,3 @@ +airport-11.svg \ No newline at end of file diff --git a/icons/alcohol_shop_11.svg b/icons/alcohol_shop_11.svg new file mode 100644 index 0000000..301c2e4 --- /dev/null +++ b/icons/alcohol_shop_11.svg @@ -0,0 +1,13 @@ +alcohol-shop-11.svg \ No newline at end of file diff --git a/icons/amusement_park_11.svg b/icons/amusement_park_11.svg new file mode 100644 index 0000000..41df22a --- /dev/null +++ b/icons/amusement_park_11.svg @@ -0,0 +1,23 @@ +amusement-park-11.svg \ No newline at end of file diff --git a/icons/aquarium_11.svg b/icons/aquarium_11.svg new file mode 100644 index 0000000..8ece76c --- /dev/null +++ b/icons/aquarium_11.svg @@ -0,0 +1,13 @@ +aquarium-11.svg \ No newline at end of file diff --git a/icons/art_gallery_11.svg b/icons/art_gallery_11.svg new file mode 100644 index 0000000..9eb5887 --- /dev/null +++ b/icons/art_gallery_11.svg @@ -0,0 +1,7 @@ +art-gallery-11.svg \ No newline at end of file diff --git a/icons/attraction_11.svg b/icons/attraction_11.svg new file mode 100644 index 0000000..a2884c4 --- /dev/null +++ b/icons/attraction_11.svg @@ -0,0 +1,5 @@ +attraction-11.svg \ No newline at end of file diff --git a/icons/bakery_11.svg b/icons/bakery_11.svg new file mode 100644 index 0000000..392207e --- /dev/null +++ b/icons/bakery_11.svg @@ -0,0 +1,5 @@ +bakery-11.svg \ No newline at end of file diff --git a/icons/bank_11.svg b/icons/bank_11.svg new file mode 100644 index 0000000..69ac8fc --- /dev/null +++ b/icons/bank_11.svg @@ -0,0 +1,23 @@ +bank-11.svg \ No newline at end of file diff --git a/icons/bar_11.svg b/icons/bar_11.svg new file mode 100644 index 0000000..1d13721 --- /dev/null +++ b/icons/bar_11.svg @@ -0,0 +1,3 @@ +bar-11.svg \ No newline at end of file diff --git a/icons/beer_11.svg b/icons/beer_11.svg new file mode 100644 index 0000000..9c6f80c --- /dev/null +++ b/icons/beer_11.svg @@ -0,0 +1,9 @@ +beer-11.svg \ No newline at end of file diff --git a/icons/bicycle_11.svg b/icons/bicycle_11.svg new file mode 100644 index 0000000..3b184c3 --- /dev/null +++ b/icons/bicycle_11.svg @@ -0,0 +1,15 @@ +bicycle-11.svg \ No newline at end of file diff --git a/icons/bicycle_rental_11.svg b/icons/bicycle_rental_11.svg new file mode 100644 index 0000000..e738bbb --- /dev/null +++ b/icons/bicycle_rental_11.svg @@ -0,0 +1,33 @@ +bicycle-share-11.svg \ No newline at end of file diff --git a/icons/bus_11.svg b/icons/bus_11.svg new file mode 100644 index 0000000..a7b50a8 --- /dev/null +++ b/icons/bus_11.svg @@ -0,0 +1,11 @@ +bus-11.svg \ No newline at end of file diff --git a/icons/cafe_11.svg b/icons/cafe_11.svg new file mode 100644 index 0000000..006a507 --- /dev/null +++ b/icons/cafe_11.svg @@ -0,0 +1,5 @@ +cafe-11.svg \ No newline at end of file diff --git a/icons/campsite_11.svg b/icons/campsite_11.svg new file mode 100644 index 0000000..83bf08d --- /dev/null +++ b/icons/campsite_11.svg @@ -0,0 +1,7 @@ +campsite-11.svg \ No newline at end of file diff --git a/icons/car_11.svg b/icons/car_11.svg new file mode 100644 index 0000000..3cfb5c2 --- /dev/null +++ b/icons/car_11.svg @@ -0,0 +1,7 @@ +car-11.svg \ No newline at end of file diff --git a/icons/castle_11.svg b/icons/castle_11.svg new file mode 100644 index 0000000..c9b086e --- /dev/null +++ b/icons/castle_11.svg @@ -0,0 +1,19 @@ +castle-11.svg \ No newline at end of file diff --git a/icons/cemetery_11.svg b/icons/cemetery_11.svg new file mode 100644 index 0000000..71925e0 --- /dev/null +++ b/icons/cemetery_11.svg @@ -0,0 +1,7 @@ +cemetery-11.svg \ No newline at end of file diff --git a/icons/cinema_11.svg b/icons/cinema_11.svg new file mode 100644 index 0000000..3e21879 --- /dev/null +++ b/icons/cinema_11.svg @@ -0,0 +1,11 @@ +cinema-11.svg \ No newline at end of file diff --git a/icons/circle_11.svg b/icons/circle_11.svg new file mode 100644 index 0000000..389f8bb --- /dev/null +++ b/icons/circle_11.svg @@ -0,0 +1 @@ +circle-11.svg \ No newline at end of file diff --git a/icons/circle_stroked_11.svg b/icons/circle_stroked_11.svg new file mode 100644 index 0000000..654766c --- /dev/null +++ b/icons/circle_stroked_11.svg @@ -0,0 +1,5 @@ +circle-stroked-11.svg \ No newline at end of file diff --git a/icons/clothing_store_11.svg b/icons/clothing_store_11.svg new file mode 100644 index 0000000..5406cb9 --- /dev/null +++ b/icons/clothing_store_11.svg @@ -0,0 +1,3 @@ +clothing-store-11.svg \ No newline at end of file diff --git a/icons/college_11.svg b/icons/college_11.svg new file mode 100644 index 0000000..1eec8c6 --- /dev/null +++ b/icons/college_11.svg @@ -0,0 +1,5 @@ +college-11.svg \ No newline at end of file diff --git a/icons/dentist_11.svg b/icons/dentist_11.svg new file mode 100644 index 0000000..b292a32 --- /dev/null +++ b/icons/dentist_11.svg @@ -0,0 +1,5 @@ +dentist-11.svg \ No newline at end of file diff --git a/icons/doctor_11.svg b/icons/doctor_11.svg new file mode 100644 index 0000000..2537ca2 --- /dev/null +++ b/icons/doctor_11.svg @@ -0,0 +1,17 @@ +doctor-11.svg \ No newline at end of file diff --git a/icons/dog_park_11.svg b/icons/dog_park_11.svg new file mode 100644 index 0000000..08af4e3 --- /dev/null +++ b/icons/dog_park_11.svg @@ -0,0 +1,11 @@ +dog-park-11.svg \ No newline at end of file diff --git a/icons/drinking_water_11.svg b/icons/drinking_water_11.svg new file mode 100644 index 0000000..6ca28b1 --- /dev/null +++ b/icons/drinking_water_11.svg @@ -0,0 +1,5 @@ +drinking-water-11.svg \ No newline at end of file diff --git a/icons/embassy_11.svg b/icons/embassy_11.svg new file mode 100644 index 0000000..1e2e51b --- /dev/null +++ b/icons/embassy_11.svg @@ -0,0 +1,11 @@ +embassy-11.svg \ No newline at end of file diff --git a/icons/entrance_11.svg b/icons/entrance_11.svg new file mode 100644 index 0000000..71ff699 --- /dev/null +++ b/icons/entrance_11.svg @@ -0,0 +1,9 @@ +entrance-11.svg \ No newline at end of file diff --git a/icons/fast_food_11.svg b/icons/fast_food_11.svg new file mode 100644 index 0000000..281ed32 --- /dev/null +++ b/icons/fast_food_11.svg @@ -0,0 +1,11 @@ +fast-food-11.svg \ No newline at end of file diff --git a/icons/ferry_terminal_11.svg b/icons/ferry_terminal_11.svg new file mode 100644 index 0000000..69e1ae6 --- /dev/null +++ b/icons/ferry_terminal_11.svg @@ -0,0 +1,21 @@ +ferry-11.svg \ No newline at end of file diff --git a/icons/fire_station_11.svg b/icons/fire_station_11.svg new file mode 100644 index 0000000..559f76a --- /dev/null +++ b/icons/fire_station_11.svg @@ -0,0 +1,5 @@ +fire-station-11.svg \ No newline at end of file diff --git a/icons/fuel_11.svg b/icons/fuel_11.svg new file mode 100644 index 0000000..40eb1c7 --- /dev/null +++ b/icons/fuel_11.svg @@ -0,0 +1,9 @@ +fuel-11.svg \ No newline at end of file diff --git a/icons/garden_11.svg b/icons/garden_11.svg new file mode 100644 index 0000000..9e480b4 --- /dev/null +++ b/icons/garden_11.svg @@ -0,0 +1,13 @@ +garden-11.svg \ No newline at end of file diff --git a/icons/golf_11.svg b/icons/golf_11.svg new file mode 100644 index 0000000..93acf2d --- /dev/null +++ b/icons/golf_11.svg @@ -0,0 +1,13 @@ +golf-11.svg \ No newline at end of file diff --git a/icons/grocery_11.svg b/icons/grocery_11.svg new file mode 100644 index 0000000..b04e3c0 --- /dev/null +++ b/icons/grocery_11.svg @@ -0,0 +1,11 @@ +grocery-11.svg \ No newline at end of file diff --git a/icons/harbor_11.svg b/icons/harbor_11.svg new file mode 100644 index 0000000..cb91835 --- /dev/null +++ b/icons/harbor_11.svg @@ -0,0 +1,11 @@ +harbor-11.svg \ No newline at end of file diff --git a/icons/heliport_11.svg b/icons/heliport_11.svg new file mode 100644 index 0000000..5673328 --- /dev/null +++ b/icons/heliport_11.svg @@ -0,0 +1,9 @@ +heliport-11.svg \ No newline at end of file diff --git a/icons/hospital_11.svg b/icons/hospital_11.svg new file mode 100644 index 0000000..204ba28 --- /dev/null +++ b/icons/hospital_11.svg @@ -0,0 +1,5 @@ +hospital-11.svg \ No newline at end of file diff --git a/icons/ice_cream_11.svg b/icons/ice_cream_11.svg new file mode 100644 index 0000000..d96d7e2 --- /dev/null +++ b/icons/ice_cream_11.svg @@ -0,0 +1,7 @@ +ice-cream-11.svg \ No newline at end of file diff --git a/icons/information_11.svg b/icons/information_11.svg new file mode 100644 index 0000000..f796dcf --- /dev/null +++ b/icons/information_11.svg @@ -0,0 +1,7 @@ +information-11.svg \ No newline at end of file diff --git a/icons/laundry_11.svg b/icons/laundry_11.svg new file mode 100644 index 0000000..b4788fd --- /dev/null +++ b/icons/laundry_11.svg @@ -0,0 +1,3 @@ +laundry-11.svg \ No newline at end of file diff --git a/icons/library_11.svg b/icons/library_11.svg new file mode 100644 index 0000000..c136c08 --- /dev/null +++ b/icons/library_11.svg @@ -0,0 +1,19 @@ +library-11.svg \ No newline at end of file diff --git a/icons/lodging_11.svg b/icons/lodging_11.svg new file mode 100644 index 0000000..9dcd222 --- /dev/null +++ b/icons/lodging_11.svg @@ -0,0 +1,7 @@ +lodging-11.svg \ No newline at end of file diff --git a/icons/marker_11.svg b/icons/marker_11.svg new file mode 100644 index 0000000..d639a15 --- /dev/null +++ b/icons/marker_11.svg @@ -0,0 +1,3 @@ +marker-11.svg \ No newline at end of file diff --git a/icons/monument_11.svg b/icons/monument_11.svg new file mode 100644 index 0000000..4e415a1 --- /dev/null +++ b/icons/monument_11.svg @@ -0,0 +1,3 @@ +monument-11.svg \ No newline at end of file diff --git a/icons/mountain_11.svg b/icons/mountain_11.svg new file mode 100644 index 0000000..9030f98 --- /dev/null +++ b/icons/mountain_11.svg @@ -0,0 +1,7 @@ +mountain-11.svg \ No newline at end of file diff --git a/icons/museum_11.svg b/icons/museum_11.svg new file mode 100644 index 0000000..f20a451 --- /dev/null +++ b/icons/museum_11.svg @@ -0,0 +1,7 @@ +museum-11.svg \ No newline at end of file diff --git a/icons/music_11.svg b/icons/music_11.svg new file mode 100644 index 0000000..84b3595 --- /dev/null +++ b/icons/music_11.svg @@ -0,0 +1,7 @@ +music-11.svg \ No newline at end of file diff --git a/icons/oneway.svg b/icons/oneway.svg new file mode 100644 index 0000000..2be2c22 --- /dev/null +++ b/icons/oneway.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/icons/park_11.svg b/icons/park_11.svg new file mode 100644 index 0000000..310bb16 --- /dev/null +++ b/icons/park_11.svg @@ -0,0 +1,17 @@ +park-11.svg \ No newline at end of file diff --git a/icons/pharmacy_11.svg b/icons/pharmacy_11.svg new file mode 100644 index 0000000..50cdc03 --- /dev/null +++ b/icons/pharmacy_11.svg @@ -0,0 +1,3 @@ +pharmacy-11.svg \ No newline at end of file diff --git a/icons/picnic_site_11.svg b/icons/picnic_site_11.svg new file mode 100644 index 0000000..f405c97 --- /dev/null +++ b/icons/picnic_site_11.svg @@ -0,0 +1,5 @@ +picnic-site-11.svg \ No newline at end of file diff --git a/icons/pitch_11.svg b/icons/pitch_11.svg new file mode 100644 index 0000000..385537f --- /dev/null +++ b/icons/pitch_11.svg @@ -0,0 +1,11 @@ +stadium-11.svg \ No newline at end of file diff --git a/icons/place_of_worship_11.svg b/icons/place_of_worship_11.svg new file mode 100644 index 0000000..4f2059d --- /dev/null +++ b/icons/place_of_worship_11.svg @@ -0,0 +1,3 @@ +place-of-worship-11.svg \ No newline at end of file diff --git a/icons/playground_11.svg b/icons/playground_11.svg new file mode 100644 index 0000000..306a698 --- /dev/null +++ b/icons/playground_11.svg @@ -0,0 +1,17 @@ +playground-11.svg \ No newline at end of file diff --git a/icons/police_11.svg b/icons/police_11.svg new file mode 100644 index 0000000..8e21550 --- /dev/null +++ b/icons/police_11.svg @@ -0,0 +1,7 @@ +police-11.svg \ No newline at end of file diff --git a/icons/post_11.svg b/icons/post_11.svg new file mode 100644 index 0000000..db6b1d1 --- /dev/null +++ b/icons/post_11.svg @@ -0,0 +1,7 @@ +post-11.svg \ No newline at end of file diff --git a/icons/prison_11.svg b/icons/prison_11.svg new file mode 100644 index 0000000..08cdb56 --- /dev/null +++ b/icons/prison_11.svg @@ -0,0 +1,3 @@ +prison-11.svg \ No newline at end of file diff --git a/icons/rail_light_11.svg b/icons/rail_light_11.svg new file mode 100644 index 0000000..837640d --- /dev/null +++ b/icons/rail_light_11.svg @@ -0,0 +1,7 @@ +rail-light-11.svg \ No newline at end of file diff --git a/icons/rail_metro_11.svg b/icons/rail_metro_11.svg new file mode 100644 index 0000000..ffe9013 --- /dev/null +++ b/icons/rail_metro_11.svg @@ -0,0 +1,7 @@ +rail-metro-11.svg \ No newline at end of file diff --git a/icons/railway_11.svg b/icons/railway_11.svg new file mode 100644 index 0000000..c120f10 --- /dev/null +++ b/icons/railway_11.svg @@ -0,0 +1,15 @@ +rail-11.svg \ No newline at end of file diff --git a/icons/religious_christian_11.svg b/icons/religious_christian_11.svg new file mode 100644 index 0000000..52cd8ad --- /dev/null +++ b/icons/religious_christian_11.svg @@ -0,0 +1 @@ +religious-christian-11.svg \ No newline at end of file diff --git a/icons/religious_jewish_11.svg b/icons/religious_jewish_11.svg new file mode 100644 index 0000000..643ccb2 --- /dev/null +++ b/icons/religious_jewish_11.svg @@ -0,0 +1 @@ +religious-jewish-11.svg \ No newline at end of file diff --git a/icons/religious_muslim_11.svg b/icons/religious_muslim_11.svg new file mode 100644 index 0000000..39bcfcd --- /dev/null +++ b/icons/religious_muslim_11.svg @@ -0,0 +1,5 @@ +religious-muslim-11.svg \ No newline at end of file diff --git a/icons/restaurant_11.svg b/icons/restaurant_11.svg new file mode 100644 index 0000000..f2ce880 --- /dev/null +++ b/icons/restaurant_11.svg @@ -0,0 +1,3 @@ +restaurant-11.svg \ No newline at end of file diff --git a/icons/road_1.svg b/icons/road_1.svg new file mode 100644 index 0000000..8eeff24 --- /dev/null +++ b/icons/road_1.svg @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/icons/road_2.svg b/icons/road_2.svg new file mode 100644 index 0000000..7a1db4c --- /dev/null +++ b/icons/road_2.svg @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/icons/road_3.svg b/icons/road_3.svg new file mode 100644 index 0000000..4d10e7c --- /dev/null +++ b/icons/road_3.svg @@ -0,0 +1,21 @@ + + + + + + + + + \ No newline at end of file diff --git a/icons/road_4.svg b/icons/road_4.svg new file mode 100644 index 0000000..733e526 --- /dev/null +++ b/icons/road_4.svg @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/icons/road_5.svg b/icons/road_5.svg new file mode 100644 index 0000000..a89e944 --- /dev/null +++ b/icons/road_5.svg @@ -0,0 +1,27 @@ + + + + + + + + + \ No newline at end of file diff --git a/icons/road_6.svg b/icons/road_6.svg new file mode 100644 index 0000000..740fe4a --- /dev/null +++ b/icons/road_6.svg @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/icons/rocket_11.svg b/icons/rocket_11.svg new file mode 100644 index 0000000..c2fd2ba --- /dev/null +++ b/icons/rocket_11.svg @@ -0,0 +1,5 @@ +rocket-11.svg \ No newline at end of file diff --git a/icons/school_11.svg b/icons/school_11.svg new file mode 100644 index 0000000..25a04a1 --- /dev/null +++ b/icons/school_11.svg @@ -0,0 +1 @@ +school-11.svg \ No newline at end of file diff --git a/icons/shop_11.svg b/icons/shop_11.svg new file mode 100644 index 0000000..49f7514 --- /dev/null +++ b/icons/shop_11.svg @@ -0,0 +1,11 @@ +shop-11.svg \ No newline at end of file diff --git a/icons/stadium_11.svg b/icons/stadium_11.svg new file mode 100644 index 0000000..385537f --- /dev/null +++ b/icons/stadium_11.svg @@ -0,0 +1,11 @@ +stadium-11.svg \ No newline at end of file diff --git a/icons/star_11.svg b/icons/star_11.svg new file mode 100644 index 0000000..2fc55eb --- /dev/null +++ b/icons/star_11.svg @@ -0,0 +1,3 @@ +star-11.svg \ No newline at end of file diff --git a/icons/suitcase_11.svg b/icons/suitcase_11.svg new file mode 100644 index 0000000..8f3156b --- /dev/null +++ b/icons/suitcase_11.svg @@ -0,0 +1,3 @@ +suitcase-11.svg \ No newline at end of file diff --git a/icons/swimming_11.svg b/icons/swimming_11.svg new file mode 100644 index 0000000..ba40068 --- /dev/null +++ b/icons/swimming_11.svg @@ -0,0 +1,9 @@ +swimming-11.svg \ No newline at end of file diff --git a/icons/theatre_11.svg b/icons/theatre_11.svg new file mode 100644 index 0000000..bcbade9 --- /dev/null +++ b/icons/theatre_11.svg @@ -0,0 +1,17 @@ +theatre-11.svg \ No newline at end of file diff --git a/icons/toilet_11.svg b/icons/toilet_11.svg new file mode 100644 index 0000000..3e11dbb --- /dev/null +++ b/icons/toilet_11.svg @@ -0,0 +1,19 @@ +toilet-11.svg \ No newline at end of file diff --git a/icons/town_hall_11.svg b/icons/town_hall_11.svg new file mode 100644 index 0000000..e81c324 --- /dev/null +++ b/icons/town_hall_11.svg @@ -0,0 +1 @@ +town-hall-11.svg \ No newline at end of file diff --git a/icons/triangle_11.svg b/icons/triangle_11.svg new file mode 100644 index 0000000..2609394 --- /dev/null +++ b/icons/triangle_11.svg @@ -0,0 +1,5 @@ +triangle-11.svg \ No newline at end of file diff --git a/icons/triangle_stroked_11.svg b/icons/triangle_stroked_11.svg new file mode 100644 index 0000000..e53e1b5 --- /dev/null +++ b/icons/triangle_stroked_11.svg @@ -0,0 +1,5 @@ +triangle-stroked-11.svg \ No newline at end of file diff --git a/icons/us-highway_1.svg b/icons/us-highway_1.svg new file mode 100644 index 0000000..ddafb0a --- /dev/null +++ b/icons/us-highway_1.svg @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/icons/us-highway_2.svg b/icons/us-highway_2.svg new file mode 100644 index 0000000..ddafb0a --- /dev/null +++ b/icons/us-highway_2.svg @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/icons/us-highway_3.svg b/icons/us-highway_3.svg new file mode 100644 index 0000000..94bb67e --- /dev/null +++ b/icons/us-highway_3.svg @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/icons/us-interstate_1.svg b/icons/us-interstate_1.svg new file mode 100644 index 0000000..6551cf9 --- /dev/null +++ b/icons/us-interstate_1.svg @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/icons/us-interstate_2.svg b/icons/us-interstate_2.svg new file mode 100644 index 0000000..2672ae2 --- /dev/null +++ b/icons/us-interstate_2.svg @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/icons/us-interstate_3.svg b/icons/us-interstate_3.svg new file mode 100644 index 0000000..06cdc4c --- /dev/null +++ b/icons/us-interstate_3.svg @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/icons/us-state_1.svg b/icons/us-state_1.svg new file mode 100644 index 0000000..94bde51 --- /dev/null +++ b/icons/us-state_1.svg @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/icons/us-state_2.svg b/icons/us-state_2.svg new file mode 100644 index 0000000..73503d0 --- /dev/null +++ b/icons/us-state_2.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/icons/us-state_3.svg b/icons/us-state_3.svg new file mode 100644 index 0000000..670ea92 --- /dev/null +++ b/icons/us-state_3.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/icons/us-state_4.svg b/icons/us-state_4.svg new file mode 100644 index 0000000..a8e9fc9 --- /dev/null +++ b/icons/us-state_4.svg @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/icons/us-state_5.svg b/icons/us-state_5.svg new file mode 100644 index 0000000..1e8f393 --- /dev/null +++ b/icons/us-state_5.svg @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/icons/us-state_6.svg b/icons/us-state_6.svg new file mode 100644 index 0000000..62496b5 --- /dev/null +++ b/icons/us-state_6.svg @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/icons/veterinary_11.svg b/icons/veterinary_11.svg new file mode 100644 index 0000000..0920a03 --- /dev/null +++ b/icons/veterinary_11.svg @@ -0,0 +1,23 @@ +veterinary-11.svg \ No newline at end of file diff --git a/icons/volcano_11.svg b/icons/volcano_11.svg new file mode 100644 index 0000000..073b844 --- /dev/null +++ b/icons/volcano_11.svg @@ -0,0 +1,5 @@ +volcano-11.svg \ No newline at end of file diff --git a/icons/wave.svg b/icons/wave.svg new file mode 100644 index 0000000..3f9bdda --- /dev/null +++ b/icons/wave.svg @@ -0,0 +1,9 @@ + + + + diff --git a/icons/zoo_11.svg b/icons/zoo_11.svg new file mode 100644 index 0000000..0ff94d7 --- /dev/null +++ b/icons/zoo_11.svg @@ -0,0 +1,7 @@ +zoo-11.svg \ No newline at end of file diff --git a/main.go b/main.go index 19ff334..fa64951 100755 --- a/main.go +++ b/main.go @@ -1,7 +1,63 @@ package main -import "git.zhouxhere.com/zhouxhere/maptile/bin" +import ( + "fmt" + "image/png" + "os" + "path/filepath" + + // "git.zhouxhere.com/zhouxhere/maptile/bin" + "git.zhouxhere.com/zhouxhere/maptile/util/sprite" +) func main() { - bin.RunCMD() + // bin.RunCMD() + // testSprite() + testFont() +} + +func testSprite() { + sprites, err := sprite.NewSprite(1, sprite.Vertical, 4, 30) + if err != nil { + panic(err) + } + + files, err := os.ReadDir("icons") + if err != nil { + panic(err) + } + + images := []sprite.ImageInfo{} + + for _, file := range files { + if file.IsDir() { + continue + } + filePath, err := filepath.Abs("icons/" + file.Name()) + if err != nil { + continue + } + images = append(images, sprite.ImageInfo{ + Name: file.Name(), + Path: filePath, + }) + } + + fmt.Println((images)) + spritesheet, err := sprites.MergeImages(images) + if err != nil { + panic(err) + } + + file, err := os.Create("ouput.png") + if err != nil { + panic(err) + } + defer file.Close() + png.Encode(file, spritesheet) + +} + +func testFont() { + } diff --git a/util/font/font.go b/util/font/font.go new file mode 100644 index 0000000..32f9fa1 --- /dev/null +++ b/util/font/font.go @@ -0,0 +1 @@ +package font diff --git a/util/sprite/sprite.go b/util/sprite/sprite.go new file mode 100644 index 0000000..b8d607c --- /dev/null +++ b/util/sprite/sprite.go @@ -0,0 +1,204 @@ +package sprite + +import ( + "fmt" + "image" + "image/color" + "image/png" + "os" + "strings" + + "github.com/pkg/errors" + "github.com/srwiley/oksvg" + "github.com/srwiley/rasterx" + "golang.org/x/image/draw" +) + +type Direction int + +const ( + Horizontal = iota + Vertical +) + +func (d Direction) String() string { + switch d { + case Horizontal: + return "Horizontal" + case Vertical: + return "Vertical" + default: + return "Unknown" + } +} + +type Image struct { + Name string + Width, Height int + X, Y int +} + +type Sprite struct { + x, y int + padding int + direction Direction + standard int + count int + Images []Image +} + +func NewSprite(padding int, direct int, count int, standard int) (*Sprite, error) { + + if Direction(direct).String() == "Unknown" { + return nil, errors.Errorf("direction %d is unknown", direct) + } + + if count <= 0 { + return nil, errors.Errorf("count %d need to max than 0", count) + } + + if standard <= 0 { + return nil, errors.Errorf("standard %d need to max than 0", standard) + } + + return &Sprite{ + x: 0, + y: 0, + padding: padding, + direction: Direction(direct), + count: count, + standard: standard, + Images: []Image{}, + }, nil +} + +func (s *Sprite) MergeImages(infos []ImageInfo) (image.Image, error) { + width, height := 0, 0 + max := 0 + spritesheet := image.NewRGBA(image.Rect(0, 0, 0, 0)) + for i, info := range infos { + img, err := info.ReadInfo() + if err != nil { + return nil, err + } + + x, y := 0, 0 + imgWidth, imgHeight := img.Bounds().Dx(), img.Bounds().Dy() + perCount := (i + 1) / s.count + nowCount := i % s.count + + if s.direction == Horizontal { + scale := float64(s.standard) / float64(imgHeight) + imgWidth = int(float64(imgWidth) * scale) + imgHeight = s.standard + + if perCount == 0 { + height = nowCount * (s.standard + s.padding*2) + } else { + height = s.count * (s.standard + s.padding*2) + } + + y = (s.standard+2*s.padding)*nowCount + s.padding + if nowCount == 0 { + x = width + s.padding + max = imgWidth + width = width + imgWidth + s.padding*2 + } else { + if imgWidth > max { + width = width + (imgWidth - max) + max = imgWidth + } + x = width - max - s.padding + } + } + + if s.direction == Vertical { + scale := float64(s.standard) / float64(imgWidth) + imgHeight = int(float64(imgHeight) * scale) + imgWidth = s.standard + + if perCount == 0 { + width = (nowCount + 1) * (s.standard + s.padding*2) + } else { + width = s.count * (s.standard + s.padding*2) + } + + x = (s.standard+2*s.padding)*nowCount + s.padding + if nowCount == 0 { + y = height + s.padding + max = imgHeight + height = height + imgHeight + s.padding*2 + } else { + if imgHeight > max { + height = height + (imgHeight - max) + max = imgHeight + } + y = height - max - s.padding + } + } + + newspritesheet := image.NewRGBA(image.Rect(0, 0, width, height)) + + if spritesheet.Bounds().Dx() > 0 && spritesheet.Bounds().Dy() > 0 { + draw.Draw(newspritesheet, spritesheet.Bounds(), spritesheet, image.Point{}, draw.Src) + } + + draw.ApproxBiLinear.Scale(newspritesheet, image.Rect(x, y, x+imgWidth, y+imgHeight), img, img.Bounds(), draw.Src, nil) + spritesheet = newspritesheet + + s.Images = append(s.Images, Image{ + Name: info.Name, + Width: imgWidth, + Height: imgHeight, + X: x, + Y: y, + }) + fmt.Println(info.Name, imgWidth, imgHeight, x, y) + } + return spritesheet, nil +} + +type ImageInfo struct { + Name, Path string +} + +func (i *ImageInfo) ReadInfo() (image.Image, error) { + if strings.HasSuffix(i.Path, ".png") { + pngFile, err := os.Open(i.Path) + if err != nil { + return nil, err + } + defer pngFile.Close() + + pngImg, err := png.Decode(pngFile) + if err != nil { + return nil, err + } + + return pngImg, nil + } + + if strings.HasSuffix(i.Path, ".svg") { + svgFile, err := os.Open(i.Path) + if err != nil { + return nil, err + } + defer svgFile.Close() + + svgInfo, err := oksvg.ReadIconStream(svgFile, oksvg.WarnErrorMode) + if err != nil { + return nil, err + } + + svgImg := image.NewRGBA(image.Rect(int(svgInfo.ViewBox.X), int(svgInfo.ViewBox.Y), int(svgInfo.ViewBox.W), int(svgInfo.ViewBox.H))) + draw.Draw(svgImg, svgImg.Bounds(), &image.Uniform{color.Transparent}, image.Point{}, draw.Src) + svgInfo.SetTarget(0, 0, float64(svgInfo.ViewBox.W), float64(svgInfo.ViewBox.H)) + scaner := rasterx.NewScannerGV(int(svgInfo.ViewBox.W), int(svgInfo.ViewBox.H), svgImg, svgImg.Bounds()) + raster := rasterx.NewDasher(int(svgInfo.ViewBox.W), int(svgInfo.ViewBox.H), scaner) + svgInfo.Draw(raster, 1.0) + + return svgImg, nil + } + + return nil, nil +} diff --git a/web/app.vue b/web/app.vue index c73e29f..07c1222 100755 --- a/web/app.vue +++ b/web/app.vue @@ -10,6 +10,10 @@ useHead({ content: "maptile.map.geojson", }, ], + htmlAttrs: { + lang: "zh-CN" + }, + title: "地图数据管理" }); diff --git a/web/components/maplibre/map.vue b/web/components/maplibre/map.vue index 80a2b1c..9251d9c 100644 --- a/web/components/maplibre/map.vue +++ b/web/components/maplibre/map.vue @@ -29,8 +29,8 @@ onMounted(async () => { map.value = new maplibregl.Map({ container: mapContainer.value, // container id style: "https://demotiles.maplibre.org/style.json", // style URL - center: [116.405285, 39.904989], // starting position [lng, lat] - zoom: 4, // starting zoom + center: [120.147376, 30.272934], // starting position [lng, lat] + zoom: 8, // starting zoom }); map.value.removeControl(map.value._controls[0]); const draw = new MapboxDraw({ @@ -95,6 +95,10 @@ onMounted(async () => { }, }); }); + +onUnmounted(() => { + if (map.value) map.value.remove(); +})