[libchamplainmm] Wrap ChamplainNetworkBboxTileSource



commit f762934aec532b44b3ed6c3d8a9ddb6d6f598f8c
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sat Aug 2 10:37:40 2014 +0200

    Wrap ChamplainNetworkBboxTileSource
    
        * champlain/champlainmm.h: Add network-bbox-tile-source.h.
        * champlain/champlainmm/.gitignore: Ignore
        network-bbox-tile-source.*.
        * champlain/src/champlain_signals.defs: Add "api-uri",
        "proxy-uri", and "state" properties.
        * champlain/src/filelist.am: Add network-bbox-tile-source.hg.
        * champlain/src/network-bbox-tile-source.[hg|ccg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE.
        * tools/m4/convert_libchamplain.m4: Add conversion from 'const
        BoundingBox&' to 'ChamplainBoundingBox*'.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |   29 ++++++++
 champlain/src/filelist.am                          |    1 +
 champlain/src/network-bbox-tile-source.ccg         |   23 ++++++
 champlain/src/network-bbox-tile-source.hg          |   77 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 tools/m4/convert_libchamplain.m4                   |    1 +
 8 files changed, 134 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index 3aca91a..8fb5874 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -38,6 +38,7 @@
 #include <champlainmm/memory-cache.h>
 #include <champlainmm/network-map-source.h>
 #include <champlainmm/network-tile-source.h>
+#include <champlainmm/network-bbox-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 3868070..4bc218d 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -14,6 +14,7 @@ marker-layer.*
 marker.*
 memory-cache.*
 network-tile-source.*
+network-bbox-tile-source.*
 path-layer.*
 point.*
 renderer.*
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index 2261755..3fea583 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -415,6 +415,35 @@
   (construct-only #f)
 )
 
+;; From ChamplainNetworkBboxTileSource
+
+(define-property api-uri
+  (of-object "ChamplainNetworkBboxTileSource")
+  (prop-type "GParamString")
+  (docs "The API URI of an OpenStreetMap server")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property proxy-uri
+  (of-object "ChamplainNetworkBboxTileSource")
+  (prop-type "GParamString")
+  (docs "The proxy URI to use to access network")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property state
+  (of-object "ChamplainNetworkBboxTileSource")
+  (prop-type "GParamEnum")
+  (docs "The state of the map data source")
+  (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 1864c5e..262e961 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -24,6 +24,7 @@ files_hg  =                                   \
        map-source.hg                           \
        memory-cache.hg                         \
        network-tile-source.hg                          \
+       network-bbox-tile-source.hg                             \
        label.hg                                \
        point.hg                                \
        path-layer.hg                           \
diff --git a/champlain/src/network-bbox-tile-source.ccg b/champlain/src/network-bbox-tile-source.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/network-bbox-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-bbox-tile-source.hg b/champlain/src/network-bbox-tile-source.hg
new file mode 100644
index 0000000..2b1976b
--- /dev/null
+++ b/champlain/src/network-bbox-tile-source.hg
@@ -0,0 +1,77 @@
+/* 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/bounding-box.h>
+#include <champlainmm/tile-source.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(champlainmm/private/tile-source_p.h)
+
+namespace Champlain
+{
+
+/** A map source that loads tile data from an OpenStreetMap API
+ * server.
+ *
+ * This map source source downloads the map data from an OpenStreetMap API
+ * server. It supports protocol version 0.5 and 0.6.
+ *
+ * <ulink role="online-location" url="http://wiki.openstreetmap.org/wiki/API";>
+ * http://wiki.openstreetmap.org/wiki/API</ulink>
+ *
+ * @newin{0,8}
+ */
+class NetworkBboxTileSource : public TileSource
+{
+  _CLASS_GOBJECT(NetworkBboxTileSource, ChamplainNetworkBboxTileSource, CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE, 
TileSource, ChamplainTileSource)
+
+protected:
+  _WRAP_CTOR(NetworkBboxTileSource(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::RefPtr<Renderer>& renderer), 
champlain_network_bbox_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::RefPtr<Renderer>& renderer)
+
+  _WRAP_METHOD(void load_map_data(const BoundingBox& bbox), champlain_network_bbox_tile_source_load_map_data)
+
+  _WRAP_METHOD(Glib::ustring get_api_uri() const, champlain_network_bbox_tile_source_get_api_uri)
+  _WRAP_METHOD(void set_api_uri(const Glib::ustring& api_uri), 
champlain_network_bbox_tile_source_set_api_uri)
+
+  _WRAP_PROPERTY("api-uri", Glib::ustring)
+  _WRAP_PROPERTY("proxy-uri", Glib::ustring)
+  _WRAP_PROPERTY("state", State)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 5c5e148..e5b5158 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -40,6 +40,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_MARKER)
             << get_defs(CHAMPLAIN_TYPE_MEMORY_CACHE)
             << get_defs(CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE)
+            << get_defs(CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE)
             << get_defs(CHAMPLAIN_TYPE_PATH_LAYER)
             << get_defs(CHAMPLAIN_TYPE_POINT)
             << get_defs(CHAMPLAIN_TYPE_RENDERER)
diff --git a/tools/m4/convert_libchamplain.m4 b/tools/m4/convert_libchamplain.m4
index 6da1dec..c00013f 100644
--- a/tools/m4/convert_libchamplain.m4
+++ b/tools/m4/convert_libchamplain.m4
@@ -21,6 +21,7 @@ _CONVERSION(`const GList*',`Glib::ListHandle<Glib::RefPtr<BaseMarker> >',`$2(con
 
 # BoundingBox
 _CONVERSION(`BoundingBox&',`ChamplainBoundingBox*',`($3).gobj()')
+_CONVERSION(`const BoundingBox&',`ChamplainBoundingBox*',`const_cast<ChamplainBoundingBox*>(($3).gobj())')
 _CONVERSION(`BoundingBox',`ChamplainBoundingBox*',`($3).gobj()')
 _CONVERSION(`ChamplainBoundingBox*',`BoundingBox',`Glib::wrap($3)')
 


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