[libchamplainmm] Wrap ChamplainTileCache



commit 81e2e6e146a6cb0a7e057a6870333c090c6a53a3
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Fri Aug 1 21:03:09 2014 +0200

    Wrap ChamplainTileCache
    
        * champlain/champlainmm.h: Add tile-cache.h.
        * champlain/champlainmm/.gitignore: Ignore tile-cache.*.
        * champlain/src/champlain_vfuncs.defs: Add ChamplainTileCache
        virtual functions.
        * champlain/src/filelist.am: Add tile-cache.hg.
        * champlain/src/tile-cache.[ccg|hg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_TILE_CACHE.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |    2 +
 champlain/src/champlain_vfuncs.defs                |   28 ++++++++++
 champlain/src/filelist.am                          |    1 +
 champlain/src/tile-cache.ccg                       |   23 ++++++++
 champlain/src/tile-cache.hg                        |   54 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 8 files changed, 111 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index f7129d0..531dcbd 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-cache.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 e29d7b7..f943b70 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -15,6 +15,7 @@ point.*
 renderer.*
 scale.*
 tile.*
+tile-cache.*
 tile-source.*
 view.*
 wrap_init.cc
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index 63396ae..f846083 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -545,6 +545,8 @@
   (construct-only #f)
 )
 
+;; From ChamplainTileCache
+
 ;; From ChamplainTileSource
 
 (define-property id
diff --git a/champlain/src/champlain_vfuncs.defs b/champlain/src/champlain_vfuncs.defs
index f5b2b87..5e5d7b8 100644
--- a/champlain/src/champlain_vfuncs.defs
+++ b/champlain/src/champlain_vfuncs.defs
@@ -97,3 +97,31 @@
     '("ChamplainTile*" "tile")
   )
 )
+
+; ChamplainTileCache
+
+(define-vfunc store_tile
+  (of-object "ChamplainTileCache")
+  (return-type "void")
+  (parameters
+    '("ChamplainTile*" "tile")
+    '("const-gchar*" "contents")
+    '("gsize" "size")
+  )
+)
+
+(define-vfunc refresh_tile_time
+  (of-object "ChamplainTileCache")
+  (return-type "void")
+  (parameters
+    '("ChamplainTile*" "tile")
+  )
+)
+
+(define-vfunc on_tile_filled
+  (of-object "ChamplainTileCache")
+  (return-type "void")
+  (parameters
+    '("ChamplainTile*" "tile")
+  )
+)
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index ef1af72..06bbf7f 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-cache.hg                                   \
        tile-source.hg                                  \
        view.hg
 
diff --git a/champlain/src/tile-cache.ccg b/champlain/src/tile-cache.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/tile-cache.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-cache.hg b/champlain/src/tile-cache.hg
new file mode 100644
index 0000000..bbaf1d5
--- /dev/null
+++ b/champlain/src/tile-cache.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 base class of tile caches.
+ *
+ * This class defines properties and methods commons to all caches (that is, map
+ * sources that permit storage and retrieval of tiles). Tiles are typically
+ * stored by TileSource objects.
+ *
+ * @newin{0,6}
+ */
+class TileCache : public MapSource
+{
+  _CLASS_GOBJECT(TileCache, ChamplainTileCache, CHAMPLAIN_TILE_CACHE, MapSource, ChamplainMapSource)
+
+protected:
+  _WRAP_VFUNC(void store_tile(const Glib::RefPtr<Tile>& tile, const char* contents, gsize size), store_tile)
+
+  _WRAP_VFUNC(void refresh_tile_time(const Glib::RefPtr<Tile>& tile), refresh_tile_time)
+
+  _WRAP_VFUNC(void on_tile_filled(const Glib::RefPtr<Tile>& tile), on_tile_filled)
+
+public:
+  _WRAP_METHOD(void store_tile(const Glib::RefPtr<Tile>& tile, const char* contents, gsize size), 
champlain_tile_cache_store_tile)
+
+  _WRAP_METHOD(void refresh_tile_time(const Glib::RefPtr<Tile>& tile), 
champlain_tile_cache_refresh_tile_time)
+
+  _WRAP_METHOD(void on_tile_filled(const Glib::RefPtr<Tile>& tile), champlain_tile_cache_on_tile_filled)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index d21bb3e..355498d 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_CACHE)
             << 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]