[libchamplainmm] Wrap ChamplainNetworkTileSource



commit 91496e7714aa05a600b63a4f7972b68726dba9a6
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Fri Aug 1 23:15:49 2014 +0200

    Wrap ChamplainNetworkTileSource
    
        * champlain/champlainmm.h: Add network-tile-source.h.
        * champlain/champlainmm/.gitignore: Ignore
        network-tile-source.*.
        * champlain/src/champlain_signals.defs: Add "uri-format",
        "offline", and "proxy-uri" properties.
        * champlain/src/filelist.am: Add network-tile-source.hg.
        * champlain/src/network-tile-source.[ccg|hg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |   29 +++++++
 champlain/src/filelist.am                          |    1 +
 champlain/src/network-tile-source.ccg              |   23 ++++++
 champlain/src/network-tile-source.hg               |   83 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 7 files changed, 139 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index b0f2d8a..3aca91a 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -37,6 +37,7 @@
 #include <champlainmm/marker.h>
 #include <champlainmm/memory-cache.h>
 #include <champlainmm/network-map-source.h>
+#include <champlainmm/network-tile-source.h>
 #include <champlainmm/point.h>
 #include <champlainmm/polygon.h>
 #include <champlainmm/scale.h>
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index 935bc71..3868070 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -13,6 +13,7 @@ map-source.*
 marker-layer.*
 marker.*
 memory-cache.*
+network-tile-source.*
 path-layer.*
 point.*
 renderer.*
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index 9bf74a0..2261755 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -386,6 +386,35 @@
   (construct-only #f)
 )
 
+;; From ChamplainNetworkTileSource
+
+(define-property uri-format
+  (of-object "ChamplainNetworkTileSource")
+  (prop-type "GParamString")
+  (docs "The URI format")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property offline
+  (of-object "ChamplainNetworkTileSource")
+  (prop-type "GParamBoolean")
+  (docs "Offline")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property proxy-uri
+  (of-object "ChamplainNetworkTileSource")
+  (prop-type "GParamString")
+  (docs "The proxy URI to use to access network")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From ChamplainPathLayer
 
 (define-property closed
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index 3079eee..1864c5e 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -23,6 +23,7 @@ files_hg  =                                   \
        map-source-factory.hg                   \
        map-source.hg                           \
        memory-cache.hg                         \
+       network-tile-source.hg                          \
        label.hg                                \
        point.hg                                \
        path-layer.hg                           \
diff --git a/champlain/src/network-tile-source.ccg b/champlain/src/network-tile-source.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/network-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/network-tile-source.hg b/champlain/src/network-tile-source.hg
new file mode 100644
index 0000000..4ea2d6d
--- /dev/null
+++ b/champlain/src/network-tile-source.hg
@@ -0,0 +1,83 @@
+/* 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/renderer.h>
+#include <champlainmm/tile-source.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(champlainmm/private/tile-source_p.h)
+
+namespace Champlain
+{
+
+/** A map source that downloads tile data from a web server.
+ *
+ * This class is specialized for map tiles that can be downloaded
+ * from a web server.  This includes all web based map services such as
+ * OpenStreetMap, Google Maps, Yahoo Maps and more. This class contains
+ * all mechanisms necessary to download tiles.
+ *
+ * Some preconfigured network map sources are built-in this library,
+ * see MapSourceFactory.
+ *
+ * @newin{0,4}
+ */
+class NetworkTileSource : public TileSource
+{
+  _CLASS_GOBJECT(NetworkTileSource, ChamplainNetworkTileSource, CHAMPLAIN_NETWORK_TILE_SOURCE, TileSource, 
ChamplainTileSource)
+
+protected:
+  _WRAP_CTOR(NetworkTileSource(const std::string& id,
+                               const Glib::ustring& name,
+                               const Glib::ustring& license,
+                               const Glib::ustring& license_uri,
+                               guint min_zoom,
+                               guint max_zoom,
+                               guint tile_size,
+                               MapProjection projection,
+                               const Glib::ustring& uri_format,
+                               const Glib::RefPtr<Renderer>& renderer), 
champlain_network_tile_source_new_full)
+
+public:
+  _WRAP_CREATE(const std::string& id,
+               const Glib::ustring& name,
+               const Glib::ustring& license,
+               const Glib::ustring& license_uri,
+               guint min_zoom,
+               guint max_zoom,
+               guint tile_size,
+               MapProjection projection,
+               const Glib::ustring& uri_format,
+               const Glib::RefPtr<Renderer>& renderer)
+
+  _WRAP_METHOD(Glib::ustring get_uri_format() const, champlain_network_tile_source_get_uri_format)
+  _WRAP_METHOD(void set_uri_format(const Glib::ustring& uri_format), 
champlain_network_tile_source_set_uri_format)
+
+  _WRAP_METHOD(bool get_offline() const, champlain_network_tile_source_get_offline)
+  _WRAP_METHOD(void set_offline(bool offline = true), champlain_network_tile_source_set_offline)
+
+  _WRAP_METHOD(Glib::ustring get_proxy_uri() const, champlain_network_tile_source_get_proxy_uri)
+  _WRAP_METHOD(void set_proxy_uri(const Glib::ustring& proxy_uri), 
champlain_network_tile_source_set_proxy_uri)
+
+  _WRAP_PROPERTY("uri-format", Glib::ustring)
+  _WRAP_PROPERTY("offline", bool)
+  _WRAP_PROPERTY("proxy-uri", Glib::ustring)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 0dfa0c4..5c5e148 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_MARKER_LAYER)
             << get_defs(CHAMPLAIN_TYPE_MARKER)
             << get_defs(CHAMPLAIN_TYPE_MEMORY_CACHE)
+            << get_defs(CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE)
             << get_defs(CHAMPLAIN_TYPE_PATH_LAYER)
             << get_defs(CHAMPLAIN_TYPE_POINT)
             << get_defs(CHAMPLAIN_TYPE_RENDERER)


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