[libchamplainmm] MapSourceDesc: Add constructor and properties



commit 0603cd3440e5683d63dabad2043cf0754d080fb5
Author: Juan R. GarcĂ­a Blanco <juanrgar gmail com>
Date:   Sun Jun 22 11:32:06 2014 +0200

    MapSourceDesc: Add constructor and properties

 champlain/src/champlain_signals.defs               |  101 ++++++++++++++++++++
 champlain/src/map-source-desc.ccg                  |   23 +++++
 champlain/src/map-source-desc.hg                   |   42 ++++++++-
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 4 files changed, 166 insertions(+), 1 deletions(-)
---
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index ccc8a7f..93c5681 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -172,6 +172,107 @@
   (construct-only #f)
 )
 
+;; From ChamplainMapSourceDesc
+
+(define-property id
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamString")
+  (docs "Map source id")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property name
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamString")
+  (docs "Map source name")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property license
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamString")
+  (docs "Map source license")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property license-uri
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamString")
+  (docs "Map source license URI")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property uri-format
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamString")
+  (docs "Network map source URI format")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property min-zoom-level
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamUInt")
+  (docs "The lowest allowed level of zoom")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property max-zoom-level
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamUInt")
+  (docs "The highest allowed level of zoom")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property tile-size
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamUInt")
+  (docs "The size of the map source tile")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property projection
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamEnum")
+  (docs "Map source projection")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property constructor
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamPointer")
+  (docs "Map source constructor")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property data
+  (of-object "ChamplainMapSourceDesc")
+  (prop-type "GParamPointer")
+  (docs "User data")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From ChamplainMarkerLayer
 
 (define-property selection-mode
diff --git a/champlain/src/map-source-desc.ccg b/champlain/src/map-source-desc.ccg
index 7acff57..4f5fabb 100644
--- a/champlain/src/map-source-desc.ccg
+++ b/champlain/src/map-source-desc.ccg
@@ -18,4 +18,27 @@
 
 namespace Champlain
 {
+  Glib::RefPtr<MapSourceDesc> MapSourceDesc::create(const std::string& id,
+                                                    const Glib::ustring& name,
+                                                    const Glib::ustring& license,
+                                                    const Glib::ustring& license_uri,
+                                                    guint min_zoom_level,
+                                                    guint max_zoom_level,
+                                                    guint tile_size,
+                                                    MapProjection projection,
+                                                    const Glib::ustring& uri_format,
+                                                    const SlotMapSourceConstructor& constructor)
+  {
+    Glib::RefPtr<MapSourceDesc> map_source_desc(new MapSourceDesc(id,
+                                                                  name,
+                                                                  license,
+                                                                  license_uri,
+                                                                  min_zoom_level,
+                                                                  max_zoom_level,
+                                                                  tile_size,
+                                                                  projection,
+                                                                  uri_format,
+                                                                  constructor));
+    return map_source_desc;
+  }
 } // namespace Champlain
diff --git a/champlain/src/map-source-desc.hg b/champlain/src/map-source-desc.hg
index bb91496..3813fc5 100644
--- a/champlain/src/map-source-desc.hg
+++ b/champlain/src/map-source-desc.hg
@@ -32,14 +32,54 @@ class MapSourceDesc : public Glib::Object
   _CLASS_GOBJECT(MapSourceDesc, ChamplainMapSourceDesc, CHAMPLAIN_MAP_SOURCE_DESC, Glib::Object, GObject)
 
 public:
+  typedef sigc::slot<Glib::RefPtr<MapSource>, Glib::RefPtr<MapSourceDesc> > SlotMapSourceConstructor;
+
+protected:
+  MapSourceDesc(const std::string& id,
+                const Glib::ustring& name,
+                const Glib::ustring& license,
+                const Glib::ustring& license_uri,
+                guint min_zoom_level,
+                guint max_zoom_level,
+                guint tile_size,
+                MapProjection projection,
+                const Glib::ustring& uri_format,
+                const SlotMapSourceConstructor& constructor);
+
+public:
+  static Glib::RefPtr<MapSourceDesc> create(const std::string& id,
+                                            const Glib::ustring& name,
+                                            const Glib::ustring& license,
+                                            const Glib::ustring& license_uri,
+                                            guint min_zoom_level,
+                                            guint max_zoom_level,
+                                            guint tile_size,
+                                            MapProjection projection,
+                                            const Glib::ustring& uri_format,
+                                            const SlotMapSourceConstructor& constructor);
+
   _WRAP_METHOD(std::string get_id() const, champlain_map_source_desc_get_id)
   _WRAP_METHOD(Glib::ustring get_name() const, champlain_map_source_desc_get_name)
   _WRAP_METHOD(Glib::ustring get_license() const, champlain_map_source_desc_get_license)
   _WRAP_METHOD(Glib::ustring get_license_uri() const, champlain_map_source_desc_get_license_uri)
+  _WRAP_METHOD(Glib::ustring get_uri_format() const, champlain_map_source_desc_get_uri_format)
+
   _WRAP_METHOD(guint get_max_zoom_level() const, champlain_map_source_desc_get_max_zoom_level)
   _WRAP_METHOD(guint get_min_zoom_level() const, champlain_map_source_desc_get_min_zoom_level)
+
+  _WRAP_METHOD(guint get_tile_size() const, champlain_map_source_desc_get_tile_size)
+
   _WRAP_METHOD(MapProjection get_projection() const, champlain_map_source_desc_get_projection)
-  _WRAP_METHOD(Glib::ustring get_uri_format() const, champlain_map_source_desc_get_uri_format)
+
+  _WRAP_PROPERTY("id", std::string)
+  _WRAP_PROPERTY("name", Glib::ustring)
+  _WRAP_PROPERTY("license", Glib::ustring)
+  _WRAP_PROPERTY("license-uri", Glib::ustring)
+  _WRAP_PROPERTY("uri-format", Glib::ustring)
+  _WRAP_PROPERTY("min-zoom-level", guint)
+  _WRAP_PROPERTY("max-zoom-level", guint)
+  _WRAP_PROPERTY("projection", MapProjection)
+  _WRAP_PROPERTY("tile-size", guint)
 };
 
 } // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 1ec3623..4d5bbe8 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -32,6 +32,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_LICENSE)
             << get_defs(CHAMPLAIN_TYPE_LOCATION)
             << get_defs(CHAMPLAIN_TYPE_MAP_SOURCE)
+            << get_defs(CHAMPLAIN_TYPE_MAP_SOURCE_DESC)
             << get_defs(CHAMPLAIN_TYPE_MARKER_LAYER)
             << get_defs(CHAMPLAIN_TYPE_MARKER)
             << get_defs(CHAMPLAIN_TYPE_PATH_LAYER)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]