[libshumate] demos: Add markers and paths to demo
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] demos: Add markers and paths to demo
- Date: Sat, 13 Mar 2021 21:54:27 +0000 (UTC)
commit 164b3701dce560736d2c901bfa5bd314c45cc621
Author: James Westman <james jwestman net>
Date: Sat Feb 27 16:30:19 2021 -0600
demos: Add markers and paths to demo
demos/map-marker-symbolic.svg | 74 +++++++++++++++++++++++++++++
demos/org.gnome.Shumate.Demo.gresources.xml | 3 ++
demos/shumate-demo-window.c | 26 ++++++++++
3 files changed, 103 insertions(+)
---
diff --git a/demos/map-marker-symbolic.svg b/demos/map-marker-symbolic.svg
new file mode 100644
index 0000000..4d5a6b1
--- /dev/null
+++ b/demos/map-marker-symbolic.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="16"
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg7384"
+ height="16">
+ <metadata
+ id="metadata90">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Gnome Symbolic Icon Theme</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <title
+ id="title9167">Gnome Symbolic Icon Theme</title>
+ <defs
+ id="defs7386">
+ <linearGradient
+ osb:paint="solid"
+ id="linearGradient7212">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop7214" />
+ </linearGradient>
+ </defs>
+ <g
+ transform="translate(-380.00852,79.9875)"
+ style="display:inline"
+ id="layer1" />
+ <g
+ transform="translate(-621.00872,446.9875)"
+ style="display:inline"
+ id="layer9" />
+ <g
+ transform="translate(-621.00872,446.9875)"
+ style="display:inline"
+ id="g7628" />
+ <g
+ transform="translate(-380.00852,-120.0125)"
+ id="layer13">
+ <path
+ d="m 388.00867,121.00914 c -2.76142,0 -5,2.23858 -5,5 0,0.17259 0.0142,0.33191 0.0312,0.5
0.0137,0.16725 0.0358,0.33617 0.0625,0.5 0.57248,3.51444 2.9063,6.00336 4.9063,8.00336 2,-2 4.33372,-4.48892
4.9062,-8.00336 0.0267,-0.16383 0.0488,-0.33275 0.0625,-0.5 0.0171,-0.16809 0.0312,-0.32741 0.0312,-0.5
0,-2.76142 -2.23858,-5 -5,-5 z m 0,3 c 1.10457,0 2,0.89543 2,2 0,1.10457 -0.89543,2 -2,2 -1.10457,0
-2,-0.89543 -2,-2 0,-1.10457 0.89543,-2 2,-2 z"
+ id="path5874-9"
+
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
/>
+ </g>
+ <g
+ transform="translate(-380.00852,79.9875)"
+ style="display:inline"
+ id="g6387" />
+ <g
+ transform="translate(-380.00852,79.9875)"
+ style="display:inline"
+ id="layer10" />
+ <g
+ transform="translate(-380.00852,79.9875)"
+ id="layer12" />
+ <g
+ transform="translate(-380.00852,79.9875)"
+ style="display:inline"
+ id="layer11" />
+</svg>
diff --git a/demos/org.gnome.Shumate.Demo.gresources.xml b/demos/org.gnome.Shumate.Demo.gresources.xml
index e27b991..6446607 100644
--- a/demos/org.gnome.Shumate.Demo.gresources.xml
+++ b/demos/org.gnome.Shumate.Demo.gresources.xml
@@ -3,4 +3,7 @@
<gresource prefix="/org/gnome/Shumate/Demo/ui">
<file preprocess="xml-stripblanks">shumate-demo-window.ui</file>
</gresource>
+ <gresource prefix="/org/gnome/Shumate/Demo/icons">
+ <file preprocess="xml-stripblanks">map-marker-symbolic.svg</file>
+ </gresource>
</gresources>
diff --git a/demos/shumate-demo-window.c b/demos/shumate-demo-window.c
index c30351d..640e965 100644
--- a/demos/shumate-demo-window.c
+++ b/demos/shumate-demo-window.c
@@ -25,6 +25,9 @@ struct _ShumateDemoWindow
ShumateView *view;
GtkOverlay *overlay;
ShumateLicense *license;
+
+ ShumateMarkerLayer *marker_layer;
+ ShumatePathLayer *path_layer;
};
G_DEFINE_TYPE (ShumateDemoWindow, shumate_demo_window, GTK_TYPE_APPLICATION_WINDOW)
@@ -39,6 +42,20 @@ shumate_demo_window_new (GtkApplication *app)
}
+static void
+create_marker (ShumateDemoWindow *self, double lat, double lng)
+{
+ GtkWidget *image = gtk_image_new_from_icon_name ("map-marker-symbolic");
+ ShumateMarker *marker = shumate_marker_new ();
+
+ shumate_location_set_location (SHUMATE_LOCATION (marker), lat, lng);
+ shumate_marker_set_child (marker, image);
+
+ shumate_marker_layer_add_marker (self->marker_layer, marker);
+ shumate_path_layer_add_node (self->path_layer, SHUMATE_LOCATION (marker));
+}
+
+
static void
shumate_demo_window_class_init (ShumateDemoWindowClass *klass)
{
@@ -80,4 +97,13 @@ shumate_demo_window_init (ShumateDemoWindow *self)
"valign", GTK_ALIGN_END,
NULL);
gtk_overlay_add_overlay (self->overlay, GTK_WIDGET (scale));
+
+ self->marker_layer = shumate_marker_layer_new (viewport);
+ shumate_view_add_layer (self->view, SHUMATE_LAYER (self->marker_layer));
+ self->path_layer = shumate_path_layer_new (viewport);
+ shumate_view_add_layer (self->view, SHUMATE_LAYER (self->path_layer));
+
+ create_marker (self, 35.426667, -116.89);
+ create_marker (self, 40.431389, -4.248056);
+ create_marker (self, -35.401389, 148.981667);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]