[libchamplainmm] Wrap ChamplainTileSource (partially)



commit d33ed334ebba97fa81beeaf6c0c1e344b6e76917
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Wed Jul 30 20:57:20 2014 +0200

    Wrap ChamplainTileSource (partially)
    
        * champlain/champlainmm.h: Add tile-source.h.
        * champlain/champlainmm/.gitignore: Ignore tile-source.*.
        * champlain/src/champlain_signals.defs: Add ChamplainTileSource
        properties.
        * champlain/src/filelist.am: Add tile-source.hg.
        * champlain/src/tile-source.[ccg|hg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_TILE_SOURCE.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |   83 ++++++++++++++++++++
 champlain/src/filelist.am                          |    1 +
 champlain/src/tile-source.ccg                      |   23 ++++++
 champlain/src/tile-source.hg                       |   68 ++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 7 files changed, 178 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index 8f9f29d..f7129d0 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -39,6 +39,7 @@
 #include <champlainmm/scale.h>
 #include <champlainmm/selection-layer.h>
 #include <champlainmm/tile.h>
+#include <champlainmm/tile-source.h>
 #include <champlainmm/view.h>
 #include <champlainmm/zoom-level.h>
 
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index 4267412..e29d7b7 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -15,6 +15,7 @@ point.*
 renderer.*
 scale.*
 tile.*
+tile-source.*
 view.*
 wrap_init.cc
 private
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index d25c8e3..63396ae 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -545,6 +545,89 @@
   (construct-only #f)
 )
 
+;; From ChamplainTileSource
+
+(define-property id
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamString")
+  (docs "The id of the tile source")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property name
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamString")
+  (docs "The name of the tile source")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property license
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamString")
+  (docs "The usage license of the tile source")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property license-uri
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamString")
+  (docs "The usage license's uri for more information")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property min-zoom-level
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamUInt")
+  (docs "The minimum zoom level")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property max-zoom-level
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamUInt")
+  (docs "The maximum zoom level")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property tile-size
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamUInt")
+  (docs "The tile size")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property projection
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamEnum")
+  (docs "The map projection")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property cache
+  (of-object "ChamplainTileSource")
+  (prop-type "GParamObject")
+  (docs "Cache used for tile sorage")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From ChamplainView
 
 (define-signal animation-completed
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index 378133e..ef1af72 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -27,6 +27,7 @@ files_hg  =                                   \
        scale.hg                                \
        marker-layer.hg                 \
        tile.hg                                 \
+       tile-source.hg                                  \
        view.hg
 
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/champlain/src/tile-source.ccg b/champlain/src/tile-source.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/tile-source.ccg
@@ -0,0 +1,23 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/tile-source.hg b/champlain/src/tile-source.hg
new file mode 100644
index 0000000..cebb552
--- /dev/null
+++ b/champlain/src/tile-source.hg
@@ -0,0 +1,68 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlainmm/map-source.h>
+//#include <champlainmm/tile-cache.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(champlainmm/private/map-source_p.h)
+
+namespace Champlain
+{
+
+/** A base class of tile sources.
+ *
+ * This class defines properties common to all tile sources (that is, map
+ * sources that are not caches).
+ *
+ * @newin{0,6}
+ */
+class TileSource : public MapSource
+{
+  _CLASS_GOBJECT(TileSource, ChamplainTileSource, CHAMPLAIN_TILE_SOURCE, MapSource, ChamplainMapSource)
+
+protected:
+
+public:
+//  _WRAP_METHOD(Glib::RefPtr<TileCache> get_cache(), champlain_tile_source_get_cache)
+//  _WRAP_METHOD(Glib::RefPtr<const TileCache> get_cache() const, champlain_tile_source_get_cache, 
constversion)
+
+  _WRAP_METHOD(void set_id(const std::string& id), champlain_tile_source_set_id)
+  _WRAP_METHOD(void set_name(const Glib::ustring& name), champlain_tile_source_set_name)
+  _WRAP_METHOD(void set_license(const Glib::ustring& license), champlain_tile_source_set_license)
+  _WRAP_METHOD(void set_license_uri(const Glib::ustring& license_uri), champlain_tile_source_set_license_uri)
+
+  _WRAP_METHOD(void set_min_zoom_level(guint zoom_level), champlain_tile_source_set_min_zoom_level)
+  _WRAP_METHOD(void set_max_zoom_level(guint zoom_level), champlain_tile_source_set_max_zoom_level)
+
+  _WRAP_METHOD(void set_tile_size(guint tile_size), champlain_tile_source_set_tile_size)
+
+  _WRAP_METHOD(void set_projection(MapProjection projection), champlain_tile_source_set_projection)
+
+  _WRAP_PROPERTY("id", std::string)
+  _WRAP_PROPERTY("name", Glib::ustring)
+  _WRAP_PROPERTY("license", Glib::ustring)
+  _WRAP_PROPERTY("license-uri", Glib::ustring)
+  _WRAP_PROPERTY("min-zoom-level", guint)
+  _WRAP_PROPERTY("max-zoom-level", guint)
+  _WRAP_PROPERTY("tile-size", guint)
+  _WRAP_PROPERTY("projection", MapProjection)
+//  _WRAP_PROPERTY("cache", Glib::RefPtr<TileCache>)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 36ef5ea..d21bb3e 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -41,6 +41,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_RENDERER)
             << get_defs(CHAMPLAIN_TYPE_SCALE)
             << get_defs(CHAMPLAIN_TYPE_TILE)
+            << get_defs(CHAMPLAIN_TYPE_TILE_SOURCE)
             << get_defs(CHAMPLAIN_TYPE_VIEW)
             ;
 


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