[libchamplainmm] Wrap ChamplainMapSourceChain



commit 7de87883c39faead168a467d04804da21f26081d
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sat Aug 2 11:03:18 2014 +0200

    Wrap ChamplainMapSourceChain
    
        * champlain/champlainmm.h: Add map-source-chain.h.
        * champlain/champlainmm/.gitignore: Ignore map-source-chain.*.
        * champlain/src/filelist.am: Add map-source-chain.hg.
        * champlain/src/map-source-chain.[hg|ccg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |    2 +
 champlain/src/filelist.am                          |    1 +
 champlain/src/map-source-chain.ccg                 |   23 ++++++++
 champlain/src/map-source-chain.hg                  |   54 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 7 files changed, 83 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index becf3c0..3f03d93 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -34,6 +34,7 @@
 #include <champlainmm/map-source-desc.h>
 #include <champlainmm/map-source-factory.h>
 #include <champlainmm/map-source.h>
+#include <champlainmm/map-source-chain.h>
 #include <champlainmm/marker.h>
 #include <champlainmm/memory-cache.h>
 #include <champlainmm/network-map-source.h>
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index 3f03239..72cbc11 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -10,6 +10,7 @@ location.*
 map-source-desc.*
 map-source-factory.*
 map-source.*
+map-source-chain.*
 marker-layer.*
 marker.*
 memory-cache.*
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index defb7b2..c574410 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -297,6 +297,8 @@
   (construct-only #t)
 )
 
+;; From ChamplainMapSourceChain
+
 ;; From ChamplainMarkerLayer
 
 (define-property selection-mode
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index c2d74ca..ce18906 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -22,6 +22,7 @@ files_hg  =                                   \
        map-source-desc.hg                      \
        map-source-factory.hg                   \
        map-source.hg                           \
+       map-source-chain.hg                             \
        memory-cache.hg                         \
        network-tile-source.hg                          \
        network-bbox-tile-source.hg                             \
diff --git a/champlain/src/map-source-chain.ccg b/champlain/src/map-source-chain.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/map-source-chain.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/map-source-chain.hg b/champlain/src/map-source-chain.hg
new file mode 100644
index 0000000..f3a73ae
--- /dev/null
+++ b/champlain/src/map-source-chain.hg
@@ -0,0 +1,54 @@
+/* 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>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(champlainmm/private/map-source_p.h)
+
+namespace Champlain
+{
+
+/** A map source simplifying creation of source chains.
+ *
+ * This map source simplifies creation of map chains by providing two
+ * functions for their creation and modification in a stack-like manner:
+ * champlain_map_source_chain_push() and champlain_map_source_chain_pop().
+ * For instance, to create a chain consisting of #ChamplainMemoryCache,
+ * #ChamplainFileCache and #ChamplainNetworkTileSource, the map
+ * sources have to be pushed into the chain in the reverse order starting
+ * from #ChamplainNetworkTileSource. After its creation, #ChamplainMapSourceChain
+ * behaves as a chain of map sources it contains.
+ *
+ * @newin{0,6}
+ */
+class MapSourceChain : public MapSource
+{
+  _CLASS_GOBJECT(MapSourceChain, ChamplainMapSourceChain, CHAMPLAIN_MAP_SOURCE_CHAIN, MapSource, 
ChamplainMapSource)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(void push(const Glib::RefPtr<MapSource>& map_source), champlain_map_source_chain_push)
+  _WRAP_METHOD(void pop(), champlain_map_source_chain_pop)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 15fa3d6..1d360b1 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -36,6 +36,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_LOCATION)
             << get_defs(CHAMPLAIN_TYPE_MAP_SOURCE)
             << get_defs(CHAMPLAIN_TYPE_MAP_SOURCE_DESC)
+            << get_defs(CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN)
             << get_defs(CHAMPLAIN_TYPE_MARKER_LAYER)
             << get_defs(CHAMPLAIN_TYPE_MARKER)
             << get_defs(CHAMPLAIN_TYPE_MEMORY_CACHE)


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