[niepce] Issue #37 - use osm-gps-map instead of Champlain
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Issue #37 - use osm-gps-map instead of Champlain
- Date: Tue, 31 Dec 2019 03:17:23 +0000 (UTC)
commit e8b4a0d3f317b9124b493e44d5d9abef14a211aa
Author: Hubert Figuière <hub figuiere net>
Date: Mon Dec 30 18:38:10 2019 -0500
Issue #37 - use osm-gps-map instead of Champlain
README | 2 +-
configure.ac | 2 +-
src/fwk/toolkit/application.cpp | 5 -----
src/fwk/toolkit/mapcontroller.cpp | 44 ++++++++++++++++++++++++++-------------
4 files changed, 32 insertions(+), 21 deletions(-)
---
diff --git a/README b/README
index a5b3061..baf5659 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@ glibmm 2.32
gtkmm 3.16
giomm
cairomm
-champlain-gtk 0.12
+osm-gps-map 1.1
sqlite3
libxml2 > 2.5.0
boost 1.60
diff --git a/configure.ac b/configure.ac
index 50eda33..993aeff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,7 +58,7 @@ AC_LANG_CPLUSPLUS
AC_LANG_COMPILER_REQUIRE
dnl Framework requirements.
-PKG_CHECK_MODULES(FRAMEWORK, [glibmm-2.4 >= $LIBGLIBMM_VERSION giomm-2.4 >= $LIBGIOMM_VERSION gthread-2.0
gtkmm-3.0 >= $LIBGTKMM_VERSION sqlite3 >= $SQLITE_VERSION exempi-2.0 >= $EXEMPI_VERSION libxml-2.0 >=
$LIBXML2_VERSION champlain-gtk-0.12])
+PKG_CHECK_MODULES(FRAMEWORK, [glibmm-2.4 >= $LIBGLIBMM_VERSION giomm-2.4 >= $LIBGIOMM_VERSION gthread-2.0
gtkmm-3.0 >= $LIBGTKMM_VERSION sqlite3 >= $SQLITE_VERSION exempi-2.0 >= $EXEMPI_VERSION libxml-2.0 >=
$LIBXML2_VERSION osmgpsmap-1.0])
dnl optional framework
PKG_CHECK_MODULES(GPHOTO, [libgphoto2 >= $LIBGPHOTO_VERSION libgphoto2_port])
diff --git a/src/fwk/toolkit/application.cpp b/src/fwk/toolkit/application.cpp
index dac64ec..c564c3a 100644
--- a/src/fwk/toolkit/application.cpp
+++ b/src/fwk/toolkit/application.cpp
@@ -21,7 +21,6 @@
#include <gtkmm/main.h>
#include <gtkmm/aboutdialog.h>
#include <gtkmm/settings.h>
-#include <clutter-gtk/clutter-gtk.h>
#include "fwk/base/debug.hpp"
#include "fwk/utils/modulemanager.hpp"
@@ -40,10 +39,6 @@ Application::Application(int & argc, char** &argv, const char* app_id,
, m_module_manager(new ModuleManager())
, m_gtkapp(Gtk::Application::create(argc, argv, app_id))
{
- ClutterInitError error = gtk_clutter_init(&argc, &argv);
- if (error != CLUTTER_INIT_SUCCESS) {
- ERR_OUT("clutter init error: %d", (int)error);
- }
m_gtkapp->signal_startup().connect(
sigc::mem_fun(*this, &Application::on_startup));
getIconTheme()->add_resource_path("/org/gnome/Niepce");
diff --git a/src/fwk/toolkit/mapcontroller.cpp b/src/fwk/toolkit/mapcontroller.cpp
index 2f7f109..68f3e76 100644
--- a/src/fwk/toolkit/mapcontroller.cpp
+++ b/src/fwk/toolkit/mapcontroller.cpp
@@ -19,25 +19,43 @@
#include "mapcontroller.hpp"
-#include <champlain-gtk/champlain-gtk.h>
-
#include <gtkmm/widget.h>
+#include <osm-gps-map.h>
namespace fwk {
class MapController::Priv {
public:
Priv()
- : m_clutter_map(nullptr)
+ : m_map(nullptr)
{
}
~Priv()
{
- if (m_clutter_map) {
- g_object_unref(G_OBJECT(m_clutter_map));
+ if (m_map) {
+ g_object_unref(G_OBJECT(m_map));
}
}
- ChamplainView* m_clutter_map;
+ void create_widget()
+ {
+ m_map = OSM_GPS_MAP(osm_gps_map_new());
+ g_object_ref(m_map);
+
+ OsmGpsMapLayer* osd = OSM_GPS_MAP_LAYER(
+ g_object_new (OSM_TYPE_GPS_MAP_OSD,
+ "show-scale", TRUE,
+ "show-coordinates", TRUE,
+ "show-crosshair", TRUE,
+ "show-dpad", TRUE,
+ "show-zoom", TRUE,
+ "show-gps-in-dpad", TRUE,
+ "show-gps-in-zoom", FALSE,
+ "dpad-radius", 30,
+ nullptr));
+ osm_gps_map_layer_add(OSM_GPS_MAP(m_map), osd);
+ g_object_unref(G_OBJECT(osd));
+ }
+ OsmGpsMap* m_map;
};
MapController::MapController()
@@ -58,11 +76,9 @@ MapController::buildWidget()
return m_widget;
}
- auto embed = gtk_champlain_embed_new();
- m_widget = Gtk::manage(Glib::wrap(embed));
+ m_priv->create_widget();
- m_priv->m_clutter_map = gtk_champlain_embed_get_view(GTK_CHAMPLAIN_EMBED(embed));
- g_object_ref(G_OBJECT(m_priv->m_clutter_map));
+ m_widget = Gtk::manage(Glib::wrap(GTK_WIDGET(m_priv->m_map)));
// Default position. Somewhere over Montréal, QC
setZoomLevel(10);
@@ -73,22 +89,22 @@ MapController::buildWidget()
void MapController::centerOn(double lat, double longitude)
{
- champlain_view_center_on(m_priv->m_clutter_map, lat, longitude);
+ osm_gps_map_set_center(m_priv->m_map, lat, longitude);
}
void MapController::zoomIn()
{
- champlain_view_zoom_in(m_priv->m_clutter_map);
+ osm_gps_map_zoom_in(m_priv->m_map);
}
void MapController::zoomOut()
{
- champlain_view_zoom_out(m_priv->m_clutter_map);
+ osm_gps_map_zoom_out(m_priv->m_map);
}
void MapController::setZoomLevel(uint8_t level)
{
- champlain_view_set_zoom_level(m_priv->m_clutter_map, level);
+ osm_gps_map_set_zoom(m_priv->m_map, level);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]