Added marker icon to map

This commit is contained in:
2022-12-24 20:49:10 -08:00
parent 52ccf6d080
commit 7833d6fa57
6 changed files with 12 additions and 3 deletions

View File

@@ -19,3 +19,7 @@ crystal run src/gtktest.cr
``` ```
You can build for production with `make` and install with `make install` You can build for production with `make` and install with `make install`
## Credits
Marker icon from [Paomedia on iconfinder](https://www.iconfinder.com/icons/299087/marker_map_icon)

BIN
data/img/marker-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -78,6 +78,7 @@ Adw.ApplicationWindow mainWindow {
Gtk.Label detailsTitle { Gtk.Label detailsTitle {
halign: start; halign: start;
wrap: true;
styles ["title-1"] styles ["title-1"]
} }

View File

@@ -4,5 +4,6 @@
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/main.ui</file> <file compressed="true" preprocess="xml-stripblanks">ui/compiled/main.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/templates/businessrow.ui</file> <file compressed="true" preprocess="xml-stripblanks">ui/compiled/templates/businessrow.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/templates/hourrow.ui</file> <file compressed="true" preprocess="xml-stripblanks">ui/compiled/templates/hourrow.ui</file>
<file compressed="true">img/marker-icon.png</file>
</gresource> </gresource>
</gresources> </gresources>

View File

@@ -49,10 +49,13 @@ module Wince
DETAILS_MAP.map_source = Shumate::MapSourceRegistry DETAILS_MAP.map_source = Shumate::MapSourceRegistry
.new_with_defaults().by_id(Shumate::MAP_SOURCE_OSM_MAPNIK) .new_with_defaults().by_id(Shumate::MAP_SOURCE_OSM_MAPNIK)
icon = Gtk::Image.new_from_icon_name("view-pin-symbolic") pixbuf = GdkPixbuf::Pixbuf.new_from_resource("/wince/img/marker-icon.png")
icon = Gtk::Image.new_from_pixbuf(pixbuf)
@@marker = Shumate::Marker.new @@marker = Shumate::Marker.new
@@marker.try do|m| @@marker.try do|m|
m.height_request = 64
m.width_request = 64
m.child = icon m.child = icon
marker_layer = Shumate::MarkerLayer.new(DETAILS_MAP.viewport) marker_layer = Shumate::MarkerLayer.new(DETAILS_MAP.viewport)
marker_layer.add_marker(m) marker_layer.add_marker(m)
@@ -174,7 +177,7 @@ module Wince
viewport = DETAILS_MAP.viewport viewport = DETAILS_MAP.viewport
viewport.set_location(latitude, longitude) viewport.set_location(latitude, longitude)
viewport.zoom_level = 14 viewport.zoom_level = 16
@@marker.try {|m| m.set_location(latitude, longitude) } @@marker.try {|m| m.set_location(latitude, longitude) }
end end

View File

@@ -29,5 +29,5 @@ module Wince
DETAILS_HOURS_BOX = Gtk::ListBox.cast(B_UI["detailsHoursBox"]) DETAILS_HOURS_BOX = Gtk::ListBox.cast(B_UI["detailsHoursBox"])
DETAILS_MAP = Shumate::SimpleMap.cast(B_UI["detailsMap"]) DETAILS_MAP = Shumate::SimpleMap.cast(B_UI["detailsMap"])
APP = Adw::Application.new("dev.wince", Gio::ApplicationFlags::None) APP = Adw::Application.new("space.quietfeathers.wince", Gio::ApplicationFlags::None)
end end