]> err.no Git - libchamplain/commitdiff
Fixed library
authorPierre-Luc Beaudoin <pierre-luc@squidy.info>
Mon, 18 Aug 2008 00:25:55 +0000 (20:25 -0400)
committerPierre-Luc Beaudoin <pierre-luc@squidy.info>
Mon, 18 Aug 2008 00:25:55 +0000 (20:25 -0400)
24 files changed:
Makefile.am
autom4te.cache/output.2
autom4te.cache/output.3
autom4te.cache/traces.2
autom4te.cache/traces.3
champlain.pc [new file with mode: 0644]
champlain.pc.in [new file with mode: 0644]
configure.ac
src/Makefile.am
src/champlain_map_zoom_level.c [deleted file]
src/champlainview.c [moved from src/champlain_widget.c with 64% similarity]
src/champlainview.h [moved from src/champlain_widget.h with 52% similarity]
src/launcher.c
src/map.c [moved from src/champlain_map.c with 55% similarity]
src/map.h [moved from src/champlain_map.h with 67% similarity]
src/map_source/debugmap.c [deleted file]
src/sources/debugmap.c [new file with mode: 0644]
src/sources/debugmap.h [moved from src/map_source/debugmap.h with 93% similarity]
src/sources/openstreetmap.c [moved from src/map_source/openstreetmap.c with 52% similarity]
src/sources/openstreetmap.h [moved from src/map_source/openstreetmap.h with 93% similarity]
src/tile.c [moved from src/champlain_map_tile.c with 57% similarity]
src/tile.h [moved from src/champlain_map_tile.h with 98% similarity]
src/zoomlevel.c [new file with mode: 0644]
src/zoomlevel.h [moved from src/champlain_map_zoom_level.h with 79% similarity]

index 5c179c2152f884a23ceeffe60286957dc6bfb463..f6d5602ef87ddbc6d5c0910b346d52e3e562aa41 100644 (file)
@@ -1 +1,9 @@
 SUBDIRS = tidy src 
+
+pcfiles = champlain-1.0.pc
+
+champlain-1.0.pc: champlain.pc
+       @cp -f $< $@
+
+pkgconfig_DATA = $(pcfiles)
+pkgconfigdir = $(libdir)/pkgconfig
index 583e4c5a5637a3373abdf2cd857dc4609c99c9bc..183e032d1cc4eb748ce658831452d142007fda11 100644 (file)
@@ -732,7 +732,7 @@ PACKAGE_VERSION='0.1'
 PACKAGE_STRING='champlain 0.1'
 PACKAGE_BUGREPORT='pierre-luc@squidy.info'
 
-ac_unique_file="src/champlain_widget.h"
+ac_unique_file="src/champlainview.h"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -20731,14 +20731,14 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 \"") >&5
   ($PKG_CONFIG --exists --print-errors "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -20748,7 +20748,7 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`
 else
   pkg_failed=yes
@@ -20767,14 +20767,14 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 \"") >&5
   ($PKG_CONFIG --exists --print-errors "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -20784,7 +20784,7 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`
 else
   pkg_failed=yes
@@ -20809,7 +20809,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 "`
         else 
                DEPS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "   glib-2.0 >= 2.2,
@@ -20817,7 +20817,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 "`
         fi
        # Put the nasty error message in config.log where it belongs
@@ -20828,7 +20828,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ) were not met:
 
 $DEPS_PKG_ERRORS
@@ -20845,7 +20845,7 @@ echo "$as_me: error: Package requirements (   glib-2.0 >= 2.2,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ) were not met:
 
 $DEPS_PKG_ERRORS
@@ -20894,7 +20894,7 @@ fi
 
 # Checks for library functions.
 
-ac_config_files="$ac_config_files Makefile src/Makefile tidy/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile tidy/Makefile champlain.pc"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -21491,6 +21491,7 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "tidy/Makefile") CONFIG_FILES="$CONFIG_FILES tidy/Makefile" ;;
+    "champlain.pc") CONFIG_FILES="$CONFIG_FILES champlain.pc" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -22296,3 +22297,11 @@ if test "$no_create" != yes; then
   $ac_cs_success || { (exit 1); exit 1; }
 fi
 
+
+
+echo ""
+echo " Champlain $VERSION"
+echo ""
+echo "         Prefix: ${prefix}"
+echo " Compiler flags: ${CPPFLAGS}"
+echo ""
index caa75273ecdb1de511f03c8db1c1478185471f41..35893764f3c8a015e51594b8e8d29f8ba60b30ae 100644 (file)
@@ -732,7 +732,7 @@ PACKAGE_VERSION='0.1'
 PACKAGE_STRING='champlain 0.1'
 PACKAGE_BUGREPORT='pierre-luc@squidy.info'
 
-ac_unique_file="src/champlain_widget.h"
+ac_unique_file="src/champlainview.h"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -20743,14 +20743,14 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 \"") >&5
   ($PKG_CONFIG --exists --print-errors "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -20760,7 +20760,7 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`
 else
   pkg_failed=yes
@@ -20779,14 +20779,14 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 \"") >&5
   ($PKG_CONFIG --exists --print-errors "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -20796,7 +20796,7 @@ if test -n "$PKG_CONFIG"; then
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`
 else
   pkg_failed=yes
@@ -20821,7 +20821,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 "`
         else 
                DEPS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "   glib-2.0 >= 2.2,
@@ -20829,7 +20829,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 "`
         fi
        # Put the nasty error message in config.log where it belongs
@@ -20840,7 +20840,7 @@ fi
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ) were not met:
 
 $DEPS_PKG_ERRORS
@@ -20857,7 +20857,7 @@ echo "$as_me: error: Package requirements (   glib-2.0 >= 2.2,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ) were not met:
 
 $DEPS_PKG_ERRORS
@@ -20906,7 +20906,7 @@ fi
 
 # Checks for library functions.
 
-ac_config_files="$ac_config_files Makefile src/Makefile tidy/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile tidy/Makefile champlain.pc"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -21503,6 +21503,7 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "tidy/Makefile") CONFIG_FILES="$CONFIG_FILES tidy/Makefile" ;;
+    "champlain.pc") CONFIG_FILES="$CONFIG_FILES champlain.pc" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -22308,3 +22309,11 @@ if test "$no_create" != yes; then
   $ac_cs_success || { (exit 1); exit 1; }
 fi
 
+
+
+echo ""
+echo " Champlain $VERSION"
+echo ""
+echo "         Prefix: ${prefix}"
+echo " Compiler flags: ${CPPFLAGS}"
+echo ""
index c58ff0440f8155bbabaffd4fcb8815c719e4c595..f9574ed9d0d455eeaa3889fa1cb4af53d9a6fb2c 100644 (file)
@@ -643,19 +643,20 @@ m4trace:configure.ac:23: -1- AC_SUBST_TRACE([DEPS_LIBS])
 m4trace:configure.ac:23: -1- m4_pattern_allow([^DEPS_LIBS$])
 m4trace:configure.ac:38: -1- AC_CONFIG_FILES([Makefile
                  src/Makefile
-                 tidy/Makefile])
-m4trace:configure.ac:41: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
-m4trace:configure.ac:41: -1- m4_pattern_allow([^LIB@&t@OBJS$])
-m4trace:configure.ac:41: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([LTLIBOBJS])
-m4trace:configure.ac:41: -1- m4_pattern_allow([^LTLIBOBJS$])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([top_builddir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([srcdir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([abs_srcdir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([top_srcdir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([abs_top_srcdir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([builddir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([abs_builddir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([abs_top_builddir])
-m4trace:configure.ac:41: -1- AC_SUBST_TRACE([INSTALL])
+                 tidy/Makefile
+                 champlain.pc])
+m4trace:configure.ac:42: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
+m4trace:configure.ac:42: -1- m4_pattern_allow([^LIB@&t@OBJS$])
+m4trace:configure.ac:42: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([LTLIBOBJS])
+m4trace:configure.ac:42: -1- m4_pattern_allow([^LTLIBOBJS$])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([top_builddir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([srcdir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([abs_srcdir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([top_srcdir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([abs_top_srcdir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([builddir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([abs_builddir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([abs_top_builddir])
+m4trace:configure.ac:42: -1- AC_SUBST_TRACE([INSTALL])
index 1e4733012ecb8ed36ececd0afcb310d6d94c3c27..20457d6b0147b5e6e181aaf4a31fc87e39e7fabe 100644 (file)
@@ -9447,7 +9447,7 @@ m4trace:configure.ac:23: -1- PKG_CHECK_MODULES([DEPS], [   glib-2.0 >= 2.2,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ])
 m4trace:configure.ac:23: -1- PKG_PROG_PKG_CONFIG
 m4trace:configure.ac:23: -1- m4_pattern_forbid([^_?PKG_[A-Z_]+$])
@@ -9461,29 +9461,29 @@ m4trace:configure.ac:23: -1- PKG_CHECK_EXISTS([   glib-2.0 >= 2.2,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ], [pkg_cv_[]DEPS_CFLAGS=`$PKG_CONFIG --[]cflags "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`], [pkg_failed=yes])
 m4trace:configure.ac:23: -1- PKG_CHECK_EXISTS([   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 ], [pkg_cv_[]DEPS_LIBS=`$PKG_CONFIG --[]libs "   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    
+  
 " 2>/dev/null`], [pkg_failed=yes])
 m4trace:configure.ac:23: -1- _PKG_SHORT_ERRORS_SUPPORTED
-m4trace:configure.ac:41: -1- m4_pattern_allow([^LIB@&t@OBJS$])
-m4trace:configure.ac:41: -1- m4_pattern_allow([^LTLIBOBJS$])
-m4trace:configure.ac:41: -1- _AC_AM_CONFIG_HEADER_HOOK([$ac_file])
-m4trace:configure.ac:41: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS
+m4trace:configure.ac:42: -1- m4_pattern_allow([^LIB@&t@OBJS$])
+m4trace:configure.ac:42: -1- m4_pattern_allow([^LTLIBOBJS$])
+m4trace:configure.ac:42: -1- _AC_AM_CONFIG_HEADER_HOOK([$ac_file])
+m4trace:configure.ac:42: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS
diff --git a/champlain.pc b/champlain.pc
new file mode 100644 (file)
index 0000000..14a4670
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr/local
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${exec_prefix}/include
+
+Name: Champlain
+Description: Map View for Gtk+
+Version: 0.1
+Libs: -L${libdir} -lchamplain-1.0
+Cflags: -I${includedir}/champlain-1.0
+Requires: gobject-2.0 clutter-0.8 gtk+-2.10
diff --git a/champlain.pc.in b/champlain.pc.in
new file mode 100644 (file)
index 0000000..de926d5
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${exec_prefix}/include
+
+Name: Champlain
+Description: Map View for Gtk+
+Version: @VERSION@
+Libs: -L${libdir} -lchamplain-1.0
+Cflags: -I${includedir}/champlain-1.0
+Requires: gobject-2.0 clutter-0.8 gtk+-2.10
index 4699df4309ec72d1cf3c130b802f12dc65e72176..bd15c90a96299239606c857d647fff5f1466b252 100644 (file)
@@ -3,7 +3,7 @@
 
 AC_PREREQ(2.61)
 AC_INIT(champlain, 0.1, pierre-luc@squidy.info)
-AC_CONFIG_SRCDIR([src/champlain_widget.h])
+AC_CONFIG_SRCDIR([src/champlainview.h])
 AC_CONFIG_HEADER([config.h])
 
 AM_INIT_AUTOMAKE
@@ -21,12 +21,12 @@ AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_LIBS)
 
 PKG_CHECK_MODULES(DEPS,
-       [   glib-2.0 >= 2.2,
+  [   glib-2.0 >= 2.2,
       gobject-2.0 >= 2.10,
       gtk+-2.0 >= 2.2,
       clutter-0.8 >= 0.8,
       clutter-gtk-0.8 >= 0.8
-    ]
+  ]
 )
 
 # Checks for header files.
@@ -37,5 +37,14 @@ PKG_CHECK_MODULES(DEPS,
 
 AC_CONFIG_FILES([Makefile
                  src/Makefile
-                 tidy/Makefile])
+                 tidy/Makefile
+                 champlain.pc])
 AC_OUTPUT
+
+
+echo ""
+echo " Champlain $VERSION"
+echo ""
+echo "         Prefix: ${prefix}"
+echo " Compiler flags: ${CPPFLAGS}"
+echo ""
index a4f64bf5af295f8aa432ea27770641523053ae9c..f5a5942500010007122bebc15026b71796d3dbcb 100644 (file)
@@ -8,22 +8,26 @@ CLEANFILES = $(BUILT_SOURCES)
 CHAMPLAIN_MARSHAL = champlain-marshal
 CHAMPLAIN_MARSHAL_LIST = champlain-marshal.list 
 
-bin_PROGRAMS = champlain
+lib_LTLIBRARIES = libchamplain-1.0.la
 
-nodist_champlain_SOURCES = \
+bin_PROGRAMS = launcher
+
+nodist_libchamplain_1_0_la_SOURCES = \
         $(BUILT_SOURCES)
 
-champlain_SOURCES = $(CHAMPLAIN_MARSHAL_LIST) \
-                                       champlain_widget.c \
-                                       champlain_map.c  \
-                                       champlain_map_zoom_level.c \
-                                       champlain_map_tile.c \
-                                       map_source/openstreetmap.c \
-                                       map_source/debugmap.c \
-                                       launcher.c
+launcher_SOURCES = launcher.c
+launcher_LDADD = $(DEPS_LIBS) libchamplain-1.0.la
+
+libchamplain_1_0_la_SOURCES = $(CHAMPLAIN_MARSHAL_LIST) \
+                                       champlainview.c \
+                                       map.c  \
+                                       zoomlevel.c \
+                                       tile.c \
+                                       sources/openstreetmap.c \
+                                       sources/debugmap.c 
                                        
 
-champlain_LDADD = $(DEPS_LIBS) ../tidy/libtidy-1.0.la
+libchamplain_1_0_la_LIBADD = $(DEPS_LIBS) ../tidy/libtidy-1.0.la
 AM_CPPFLAGS = $(DEPS_CFLAGS) -I../tidy
 
 
diff --git a/src/champlain_map_zoom_level.c b/src/champlain_map_zoom_level.c
deleted file mode 100644 (file)
index a4e8f28..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@squidy.info>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <champlain_map_zoom_level.h>
-#include <champlain_map_tile.h>
-#include <champlain_map.h>
-#include <champlain_private.h>
-#include <clutter/clutter.h>
-
-ChamplainMapZoomLevel* 
-champlain_map_zoom_level_new(gint zoom_level, gint row, gint column, gint tile_size)
-{
-       ChamplainMapZoomLevel* level = g_new0(ChamplainMapZoomLevel, 1);
-       
-       level->level = zoom_level;
-       level->row_count = row;
-       level->column_count = column;
-       level->tile_size = tile_size;
-       level->tiles = g_ptr_array_sized_new (row * column);
-       level->group = clutter_group_new ();
-       
-       return level;
-}
-
-void 
-champlain_map_zoom_level_create(ChamplainMap* map, gint zoom_level)
-{
-       int i;
-       for (i = 0; i < map->current_level->row_count * map->current_level->column_count; i++) 
-               {
-                       int x = i % map->current_level->column_count;
-                       int y = i / map->current_level->column_count;
-                       
-                       ChamplainMapTile* tile = map->get_tile(map, zoom_level, x, y);
-                       
-                       clutter_container_add (CLUTTER_CONTAINER (map->current_level->group), tile->actor, NULL);
-                       g_ptr_array_add (map->current_level->tiles, tile);
-               }
-}
-
-guint
-champlain_map_zoom_level_get_width(ChamplainMapZoomLevel* level)
-{
-               return (level->column_count + 1) * level->tile_size;
-}
-
-guint
-champlain_map_zoom_level_get_height(ChamplainMapZoomLevel* level)
-{
-               return (level->row_count + 1) * level->tile_size;
-}
similarity index 64%
rename from src/champlain_widget.c
rename to src/champlainview.c
index d15960199684cdd10e2b3c8213d3263c0b8ff5fe..9919041c474e1c57b68dd02756d2e790749772b5 100644 (file)
 #include "config.h"
 
 #include "champlain_defines.h"
-#include "champlain_map_tile.h"
-#include "champlain_map.h"
-#include "champlain_map_zoom_level.h"
-#include "champlain_widget.h"
+#include "champlain_view.h"
+#include "map_tile.h"
+#include "map.h"
+#include "map_zoom_level.h"
 #include "champlain-marshal.h"
 
 #include <tidy-finger-scroll.h>
@@ -49,9 +49,9 @@ enum
   PROP_TBD
 };
 
-static guint champlain_widget_signals[LAST_SIGNAL] = { 0, };
+static guint champlain_view_signals[LAST_SIGNAL] = { 0, };
 
-#define CHAMPLAIN_WIDGET_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_WIDGET, ChamplainWidgetPrivate))
+#define CHAMPLAIN_VIEW_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewPrivate))
 
 typedef struct
 {
@@ -60,50 +60,50 @@ typedef struct
   ClutterUnit y;
 } ChamplainPoint;
 
-struct _ChamplainWidgetPrivate
+struct _ChamplainViewPrivate
 {
   GtkWidget *clutterEmbed;
   ClutterActor *viewport;
   ChamplainPoint viewportSize;
   ClutterActor *fingerScroll;
   
-  ChamplainMap *map;
+  Map *map;
 };
 
 
-G_DEFINE_TYPE (ChamplainWidget, champlain_widget, GTK_TYPE_ALIGNMENT);
+G_DEFINE_TYPE (ChamplainView, champlain_view, GTK_TYPE_ALIGNMENT);
 
 static void
-champlain_widget_finalize (GObject * object)
+champlain_view_finalize (GObject * object)
 {
-  ChamplainWidget *widget = CHAMPLAIN_WIDGET (object);
-  ChamplainWidgetPrivate *priv = CHAMPLAIN_WIDGET_GET_PRIVATE (widget);
+  ChamplainView *view = CHAMPLAIN_VIEW (object);
+  ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view);
 
-  G_OBJECT_CLASS (champlain_widget_parent_class)->finalize (object);
+  G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
 }
 
 static void
-champlain_widget_class_init (ChamplainWidgetClass *champlainWidgetClass)
+champlain_view_class_init (ChamplainViewClass *champlainViewClass)
 {
-  g_type_class_add_private (champlainWidgetClass, sizeof (ChamplainWidgetPrivate));
+  g_type_class_add_private (champlainViewClass, sizeof (ChamplainViewPrivate));
 
-  GObjectClass *objectClass = G_OBJECT_CLASS (champlainWidgetClass);
-  objectClass->finalize = champlain_widget_finalize;
+  GObjectClass *objectClass = G_OBJECT_CLASS (champlainViewClass);
+  objectClass->finalize = champlain_view_finalize;
 }
 
 static void
-champlain_widget_init (ChamplainWidget *champlainWidget)
+champlain_view_init (ChamplainView *champlainView)
 {
-  ChamplainWidgetPrivate *priv = CHAMPLAIN_WIDGET_GET_PRIVATE (champlainWidget);
+  ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (champlainView);
 }
 
 static void
-widget_size_allocated_cb (GtkWidget *widget, GtkAllocation *allocation, ChamplainWidget *champlainWidget
+view_size_allocated_cb (GtkWidget *view, GtkAllocation *allocation, ChamplainView *champlainView
 {                
   gdouble lower, upper;
   TidyAdjustment *hadjust, *vadjust;
   
-  ChamplainWidgetPrivate *priv = CHAMPLAIN_WIDGET_GET_PRIVATE (champlainWidget);
+  ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (champlainView);
   priv->viewportSize.x = allocation->width;
   priv->viewportSize.y = allocation->height;
   clutter_actor_set_size (priv->fingerScroll, priv->viewportSize.x, priv->viewportSize.y);
@@ -114,26 +114,27 @@ widget_size_allocated_cb (GtkWidget *widget, GtkAllocation *allocation, Champlai
   
   tidy_adjustment_get_values (hadjust, NULL, &lower, &upper, NULL, NULL, NULL);
   lower = 0;
-  upper = champlain_map_zoom_level_get_width(priv->map->current_level) - priv->viewportSize.x; 
+  upper = map_zoom_level_get_width(priv->map->current_level) - priv->viewportSize.x; 
   g_object_set (hadjust, "lower", lower, "upper", upper,
                 "step-increment", 1.0, "elastic", TRUE, NULL);
                 
   tidy_adjustment_get_values (vadjust, NULL, &lower, &upper, NULL, NULL, NULL);
   lower = 0;
-  upper = champlain_map_zoom_level_get_height(priv->map->current_level) - priv->viewportSize.y;
+  upper = map_zoom_level_get_height(priv->map->current_level) - priv->viewportSize.y;
   g_object_set (vadjust, "lower", lower, "upper", upper,
                 "step-increment", 1.0, "elastic", TRUE, NULL);
+                
 }
                           
 GtkWidget *
-champlain_widget_new ()
+champlain_view_new ()
 {
   ClutterColor stage_color = { 0x34, 0x39, 0x39, 0xff };
-  ChamplainWidget *widget;
+  ChamplainView *view;
   ClutterActor *stage; 
   
-  widget = CHAMPLAIN_WIDGET (g_object_new (CHAMPLAIN_TYPE_WIDGET, NULL));
-  ChamplainWidgetPrivate *priv = CHAMPLAIN_WIDGET_GET_PRIVATE (widget);
+  view = CHAMPLAIN_VIEW (g_object_new (CHAMPLAIN_TYPE_VIEW, NULL));
+  ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view);
   
   priv->viewportSize.x = 640;
   priv->viewportSize.y = 480;
@@ -141,14 +142,14 @@ champlain_widget_new ()
   priv->clutterEmbed = gtk_clutter_embed_new ();
   g_signal_connect (priv->clutterEmbed,
                     "size-allocate",
-                    G_CALLBACK (widget_size_allocated_cb),
-                    widget);
+                    G_CALLBACK (view_size_allocated_cb),
+                    view);
 
        // Setup stage
   stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->clutterEmbed));
   
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
-  gtk_container_add (GTK_CONTAINER (widget), priv->clutterEmbed);
+  gtk_container_add (GTK_CONTAINER (view), priv->clutterEmbed);
   
   // Setup viewport
   priv->viewport = tidy_viewport_new ();
@@ -161,9 +162,9 @@ champlain_widget_new ()
   clutter_container_add_actor (CLUTTER_CONTAINER (priv->fingerScroll), priv->viewport);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), priv->fingerScroll);
     
-       priv->map = champlain_map_new(CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP);//OPENSTREETMAP
-       champlain_map_load(priv->map, 4);
+       priv->map = map_new(CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP);//OPENSTREETMAP
+       map_load(priv->map, 4);
   clutter_container_add_actor (CLUTTER_CONTAINER (group), priv->map->current_level->group);
   
-  return GTK_WIDGET (widget);
+  return GTK_WIDGET (view);
 }
similarity index 52%
rename from src/champlain_widget.h
rename to src/champlainview.h
index 7eaeebdf92a19571a96a75d776fbf8ba6babded8..e9622f6fdec69544e53450eb29fdd8dfc14ce081 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef CHAMPLAIN_WIDGET_H
-#define CHAMPLAIN_WIDGET_H
+#ifndef CHAMPLAIN_VIEW_H
+#define CHAMPLAIN_VIEW_H
 
 #include <champlain_defines.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_WIDGET     (champlain_widget_get_type())
-#define CHAMPLAIN_WIDGET(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_WIDGET, ChamplainWidget))
-#define CHAMPLAIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  CHAMPLAIN_TYPE_WIDGET, ChamplainWidgetClass))
-#define CHAMPLAIN_IS_WIDGET(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_WIDGET))
-#define CHAMPLAIN_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  CHAMPLAIN_TYPE_WIDGET))
-#define CHAMPLAIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  CHAMPLAIN_TYPE_WIDGET, ChamplainWidgetClass))
-typedef struct _ChamplainWidgetPrivate ChamplainWidgetPrivate;
+typedef enum
+{
+  CHAMPLAIN_MAP_SOURCE_DEBUG,
+  CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP,
+  CHAMPLAIN_MAP_SOURCE_GOOGLE
+} ChamplainMapSource;
+
+#define CHAMPLAIN_TYPE_VIEW     (champlain_view_get_type())
+#define CHAMPLAIN_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_VIEW, ChamplainView))
+#define CHAMPLAIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
+#define CHAMPLAIN_IS_VIEW(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_VIEW))
+#define CHAMPLAIN_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  CHAMPLAIN_TYPE_VIEW))
+#define CHAMPLAIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
+
+typedef struct _ChamplainViewPrivate ChamplainViewPrivate;
 
-struct _ChamplainWidget
+struct _ChamplainView
 {
   GtkAlignment bin;
 
-  ChamplainWidgetPrivate *priv;
+  ChamplainViewPrivate *priv;
 };
 
-struct _ChamplainWidgetClass
+struct _ChamplainViewClass
 {
   GtkBinClass parent_class;
 
-  ChamplainWidget *(*create_widget) (ChamplainWidget * widget);
-
-  void (*set_scroll_adjustments) (ChamplainWidget * widget, GtkAdjustment * hadjustment, GtkAdjustment * vadjustment);
-
 };
 
-CHAMPLAIN_API GType champlain_widget_get_type (void);
-
-CHAMPLAIN_API GtkWidget *champlain_widget_new (void);
+CHAMPLAIN_API GType champlain_view_get_type (void);
 
-#define TILE_SIZE 100  
-#define ROW_SIZE 5 
+CHAMPLAIN_API GtkWidget *champlain_view_new (void);
 
 #endif
index a150b497eacfc891d4037dbe98b7931b2aebaef2..8a215a371bbfa884f7aa9f07eda8d329d73d60bc 100644 (file)
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
    */
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy), NULL);
 
-  widget = champlain_widget_new ();
+  widget = champlain_view_new ();
 
   /* and insert it into the main window  */
   gtk_container_add (GTK_CONTAINER (window), widget);
similarity index 55%
rename from src/champlain_map.c
rename to src/map.c
index 13fe929ee08d9c92bbba8359f9350652b6e39e4c..01f1af61ef76c4ad87ed0bcef6ac4b8e4005be36 100644 (file)
+++ b/src/map.c
  * Boston, MA 02110-1301, USA.
  */
  
-#include <champlain_map.h>
-#include <champlain_map_zoom_level.h>
+#include <map.h>
+#include <zoomlevel.h>
  
 
-ChamplainMap* 
-champlain_map_new (ChamplainMapSourceId source)
+Map* 
+map_new (ChamplainMapSource source)
 {
-       ChamplainMap* map = g_new0(ChamplainMap, 1);
+  Map* map = g_new0(Map, 1);
 
-       switch(source) 
-               {
-                       case CHAMPLAIN_MAP_SOURCE_DEBUG:
-                               debugmap_init(map);
-                               break;
-                       case CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP:
-                               osm_init(map);
-                               break;
-               }
-               
-       return map;
+  switch(source) 
+    {
+      case CHAMPLAIN_MAP_SOURCE_DEBUG:
+        debugmap_init(map);
+        break;
+      case CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP:
+        osm_init(map);
+        break;
+    }
+    
+  return map;
 }
 
 void 
-champlain_map_load(ChamplainMap* map, gint zoom_level)
+map_load(Map* map, gint zoom_level)
 {
-               guint row_count = map->get_row_count(map, zoom_level);
-               guint column_count = map->get_column_count(map, zoom_level);
-               
-               map->current_level = champlain_map_zoom_level_new(zoom_level, row_count, column_count, map->tile_size);
-               champlain_map_zoom_level_create(map, zoom_level);
+    guint row_count = map->get_row_count(map, zoom_level);
+    guint column_count = map->get_column_count(map, zoom_level);
+    
+    map->current_level = zoom_level_new(zoom_level, row_count, column_count, map->tile_size);
+    zoom_level_create(map, zoom_level);
 }
 
similarity index 67%
rename from src/champlain_map.h
rename to src/map.h
index ef6e89c4d1d544df15e1dda47912cec31a21975f..44d9e7bc4c40aebb3b77872d86288401d0a04381 100644 (file)
+++ b/src/map.h
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef CHAMPLAIN_MAP_H
-#define CHAMPLAIN_MAP_H
+#ifndef MAP_H
+#define MAP_H
 
+#include "champlainview.h"
 #include "champlain_defines.h"
-#include "champlain_map_zoom_level.h"
-#include "champlain_map_tile.h"
+#include "zoomlevel.h"
+#include "tile.h"
+
 #include <glib.h>
 #include <clutter/clutter.h>
 
 
-struct _ChamplainMap
+struct _Map
 {
   int zoom_levels;
   const gchar* name;
-  ChamplainMapZoomLevel* current_level;
+  ZoomLevel* current_level;
   int tile_size;
   
-  ChamplainMapTile* (* get_tile) (ChamplainMap* map, guint zoom_level, guint x, guint y);
-  guint (* get_row_count) (ChamplainMap* map, guint zoom_level);
-  guint (* get_column_count) (ChamplainMap* map, guint zoom_level);
+  Tile* (* get_tile) (Map* map, guint zoom_level, guint x, guint y);
+  guint (* get_row_count) (Map* map, guint zoom_level);
+  guint (* get_column_count) (Map* map, guint zoom_level);
   
-} ;
+};
 
 
-CHAMPLAIN_API ChamplainMap* champlain_map_new (ChamplainMapSourceId source);
+CHAMPLAIN_API Map* champlain_map_new (ChamplainMapSource source);
 
 
 #endif
diff --git a/src/map_source/debugmap.c b/src/map_source/debugmap.c
deleted file mode 100644 (file)
index a66ca3b..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@squidy.info>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "map_source/debugmap.h"
-#include <math.h>
-
-guint debugmap_row_count(ChamplainMap* map, guint zoom_level);
-guint debugmap_column_count(ChamplainMap* map, guint zoom_level);
-ChamplainMapTile* debugmap_get_tile (ChamplainMap* map, guint zoom_level, guint x, guint y);
-
-void 
-debugmap_init(ChamplainMap* map)
-{
-       map->name = "Debug";
-       map->zoom_levels = 1;
-       map->tile_size = 256;
-  
-  map->get_row_count = debugmap_row_count;
-  map->get_column_count = debugmap_column_count;
-  map->get_tile = debugmap_get_tile;
-}
-
-guint debugmap_row_count(ChamplainMap* map, guint zoom_level)
-{
-       return pow (2, zoom_level);
-}
-
-guint debugmap_column_count(ChamplainMap* map, guint zoom_level)
-{
-       return pow (2, zoom_level);
-}
-
-ChamplainMapTile* debugmap_get_tile (ChamplainMap* map, guint zoom_level, guint x, guint y)
-{
-
-       ChamplainMapTile* tile = g_new0(ChamplainMapTile, 1);
-       
-       ClutterColor white;
-       clutter_color_parse ("white", &white);
-       ClutterColor blue;
-       clutter_color_parse ("blue", &blue);
-       
-       ClutterColor * color, * textColor;
-       if ((y  + x) % 2) 
-               {
-                       color = &blue;
-                       textColor = &white;
-               } 
-       else 
-               {
-                       color = &white;
-                       textColor = &blue;
-               }
-       
-       
-       tile->x = x;
-       tile->y = y;
-       tile->visible = FALSE;
-       tile->actor = clutter_group_new();
-       
-       ClutterActor* actor = clutter_rectangle_new_with_color (color);
-       clutter_actor_set_position (actor, x * map->tile_size, y * map->tile_size);
-       clutter_actor_set_size (actor, map->tile_size, map->tile_size);
-       clutter_actor_show (actor);
-  clutter_container_add_actor (CLUTTER_CONTAINER (tile->actor), actor);
-  
-  actor = clutter_label_new_full ("Arial", g_strdup_printf("%d, %d", x, y), textColor);
-       clutter_actor_set_position (actor, x * map->tile_size + map->tile_size/2.25, y * map->tile_size + map->tile_size/2.25);
-  clutter_container_add_actor (CLUTTER_CONTAINER (tile->actor), actor);
-  
-       g_object_ref(tile->actor); // to prevent actors to be destroyed when they are removed from groups
-       
-       return tile;
-}
diff --git a/src/sources/debugmap.c b/src/sources/debugmap.c
new file mode 100644 (file)
index 0000000..5abc2ee
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@squidy.info>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "sources/debugmap.h"
+#include <math.h>
+
+guint debugmap_row_count(Map* map, guint zoom_level);
+guint debugmap_column_count(Map* map, guint zoom_level);
+Tile* debugmap_get_tile (Map* map, guint zoom_level, guint x, guint y);
+
+void 
+debugmap_init(Map* map)
+{
+  map->name = "Debug";
+  map->zoom_levels = 1;
+  map->tile_size = 256;
+  
+  map->get_row_count = debugmap_row_count;
+  map->get_column_count = debugmap_column_count;
+  map->get_tile = debugmap_get_tile;
+}
+
+guint debugmap_row_count(Map* map, guint zoom_level)
+{
+  return pow (2, zoom_level);
+}
+
+guint debugmap_column_count(Map* map, guint zoom_level)
+{
+  return pow (2, zoom_level);
+}
+
+Tile* debugmap_get_tile (Map* map, guint zoom_level, guint x, guint y)
+{
+
+  Tile* tile = g_new0(Tile, 1);
+  
+  ClutterColor white;
+  clutter_color_parse ("white", &white);
+  ClutterColor blue;
+  clutter_color_parse ("blue", &blue);
+  
+  ClutterColor * color, * textColor;
+  if ((y  + x) % 2) 
+    {
+      color = &blue;
+      textColor = &white;
+    } 
+  else 
+    {
+      color = &white;
+      textColor = &blue;
+    }
+  
+  tile->x = x;
+  tile->y = y;
+  tile->visible = FALSE;
+  tile->actor = clutter_group_new();
+  
+  ClutterActor* actor = clutter_rectangle_new_with_color (color);
+  clutter_actor_set_position (actor, x * map->tile_size, y * map->tile_size);
+  clutter_actor_set_size (actor, map->tile_size, map->tile_size);
+  clutter_actor_show (actor);
+  clutter_container_add_actor (CLUTTER_CONTAINER (tile->actor), actor);
+  
+  actor = clutter_label_new_full ("Arial", g_strdup_printf("%d, %d", x, y), textColor);
+  clutter_actor_set_position (actor, x * map->tile_size + map->tile_size/2.25, y * map->tile_size + map->tile_size/2.25);
+  clutter_container_add_actor (CLUTTER_CONTAINER (tile->actor), actor);
+  
+  g_object_ref(tile->actor); // to prevent actors to be destroyed when they are removed from groups
+  
+  return tile;
+}
similarity index 93%
rename from src/map_source/debugmap.h
rename to src/sources/debugmap.h
index 0ca96d4f0548c7ff86e0a1a716e42873a453d840..e30ba8f840caa2d1aa9892ebfd2ab8c18e9d4dd8 100644 (file)
@@ -20,8 +20,8 @@
 #ifndef OPENSTREETMAP_H
 #define OPENSTREETMAP_H
 
-#include <champlain_map.h>
+#include <map.h>
 
-void debugmap_init(ChamplainMap* map);
+void debugmap_init(Map* map);
 
 #endif
similarity index 52%
rename from src/map_source/openstreetmap.c
rename to src/sources/openstreetmap.c
index 538e4032e9e002b4f759e9a27775d667cc24dbf9..c55010f71961a32e9a56276c911e759e806edb7d 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
  
-#include "map_source/openstreetmap.h"
-#include <champlain_map.h>
+#include "sources/openstreetmap.h"
+#include <map.h>
 #include <math.h>
 
 //http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames#C.2FC.2B.2B
 
-guint osm_row_count(ChamplainMap* map, guint zoom_level);
-guint osm_column_count(ChamplainMap* map, guint zoom_level);
-ChamplainMapTile* osm_get_tile (ChamplainMap* map, guint zoom_level, guint x, guint y);
+guint osm_row_count(Map* map, guint zoom_level);
+guint osm_column_count(Map* map, guint zoom_level);
+Tile* osm_get_tile (Map* map, guint zoom_level, guint x, guint y);
 
 void
-osm_init(ChamplainMap* map)
+osm_init(Map* map)
 {
-       map->name = "OpenStreetMap";
-       map->zoom_levels = 17;
+  map->name = "OpenStreetMap";
+  map->zoom_levels = 17;
   map->tile_size = 256;
   
   map->get_row_count = osm_row_count;
@@ -39,35 +39,35 @@ osm_init(ChamplainMap* map)
   map->get_tile = osm_get_tile;
 }
 
-guint osm_row_count(ChamplainMap* map, guint zoom_level)
+guint osm_row_count(Map* map, guint zoom_level)
 {
-       return pow (2, zoom_level);
+  return pow (2, zoom_level);
 }
 
-guint osm_column_count(ChamplainMap* map, guint zoom_level)
+guint osm_column_count(Map* map, guint zoom_level)
 {
-       return pow (2, zoom_level);
+  return pow (2, zoom_level);
 }
 
-ChamplainMapTile* osm_get_tile (ChamplainMap* map, guint zoom_level, guint x, guint y)
+Tile* osm_get_tile (Map* map, guint zoom_level, guint x, guint y)
 {
-       ChamplainMapTile* tile = g_new0(ChamplainMapTile, 1);
-       
-       tile->x = x;
-       tile->y = y;
-       tile->visible = FALSE;
+  Tile* tile = g_new0(Tile, 1);
+  
+  tile->x = x;
+  tile->y = y;
+  tile->visible = FALSE;
   // For no apparent reason, the group is necessary even if 
   // it contains only one actor... if missing, the viewport will break
-       tile->actor = clutter_group_new();
-                                                                                                                                                       
-       ClutterActor* actor = clutter_texture_new_from_file(g_strdup_printf("/home/plbeaudoin/champlain/tiles/%d/%d/%d.png", zoom_level, x, y), NULL);
-       clutter_actor_set_position (actor, x * map->tile_size, y * map->tile_size);
-       clutter_actor_set_size (actor, map->tile_size, map->tile_size);
-       clutter_actor_show (actor);
+  tile->actor = clutter_group_new();
+                                      
+  ClutterActor* actor = clutter_texture_new_from_file(g_strdup_printf("/home/plbeaudoin/champlain/tiles/%d/%d/%d.png", zoom_level, x, y), NULL);
+  clutter_actor_set_position (actor, x * map->tile_size, y * map->tile_size);
+  clutter_actor_set_size (actor, map->tile_size, map->tile_size);
+  clutter_actor_show (actor);
   clutter_container_add_actor (CLUTTER_CONTAINER (tile->actor), actor);
   
-       g_object_ref(tile->actor); // to prevent actors to be destroyed when they are removed from groups
-       
-       return tile;
-       
+  g_object_ref(tile->actor); // to prevent actors to be destroyed when they are removed from groups
+  
+  return tile;
+  
 }
similarity index 93%
rename from src/map_source/openstreetmap.h
rename to src/sources/openstreetmap.h
index ed351dd15007b3c9a5d6a00c8a23bcf02cc6659f..e8c26bad55bef98d23b7bb532e7993f0e320c4f8 100644 (file)
@@ -20,8 +20,8 @@
 #ifndef OPENSTREETMAP_H
 #define OPENSTREETMAP_H
 
-#include <champlain_map.h>
+#include <map.h>
 
-void osm_init(ChamplainMap* map);
+void osm_init(Map* map);
 
 #endif
similarity index 57%
rename from src/champlain_map_tile.c
rename to src/tile.c
index ddc4fda7572589b7e4e80c2817e8ffff0b02c11e..ad1386c428793356b04e1f85954800eb19fc874d 100644 (file)
  */
 
 
-#include "champlain_map_tile.h"
+#include "tile.h"
 
 
 /*
 gboolean
-tile_is_visible(ClutterUnit viewport_w, ClutterUnit viewport_h, ChamplainPoint position, ChamplainMapTile* tile)
+tile_is_visible(ClutterUnit viewport_w, ClutterUnit viewport_h, ChamplainPoint position, MapTile* tile)
 {
-       ClutterUnit size = CLUTTER_UNITS_FROM_INT(tile->size);
+  ClutterUnit size = CLUTTER_UNITS_FROM_INT(tile->size);
 
-      
-       if( ((tile->x + 1)* size + position.x < 0 || tile->x* size + position.x > viewport_w) ||
-                       ((tile->y + 1)* size + position.y < 0 || tile->y* size + position.y > viewport_h))
-               {
-                       g_print ("Tile I: %d, %d\t p: %d, %d \n",
-              tile->x, tile->y,
-              CLUTTER_UNITS_TO_INT (position.x),
-              CLUTTER_UNITS_TO_INT (position.y));
-                       return FALSE;
-               }
-       //g_print ("Tile V: %d, %d\t p: %d, %d \n",
-              //tile->x, tile->y,
-              //CLUTTER_UNITS_TO_INT (position.x),
-              //CLUTTER_UNITS_TO_INT (position.y));
-       return TRUE;
+  if( ((tile->x + 1)* size + position.x < 0 || tile->x* size + position.x > viewport_w) ||
+      ((tile->y + 1)* size + position.y < 0 || tile->y* size + position.y > viewport_h))
+    {
+      g_print ("Tile I: %d, %d\t p: %d, %d \n",
+         tile->x, tile->y,
+         CLUTTER_UNITS_TO_INT (position.x),
+         CLUTTER_UNITS_TO_INT (position.y));
+      return FALSE;
+    }
+  //g_print ("Tile V: %d, %d\t p: %d, %d \n",
+         //tile->x, tile->y,
+         //CLUTTER_UNITS_TO_INT (position.x),
+         //CLUTTER_UNITS_TO_INT (position.y));
+  return TRUE;
 
 }*/
similarity index 98%
rename from src/champlain_map_tile.h
rename to src/tile.h
index c31e903192974607b1870e6c1e1f8a9ce76612b7..7065c3be2cc1cf838e2c047353431da7d00cc67e 100644 (file)
@@ -31,6 +31,6 @@ typedef struct
   int size;
   gboolean visible;            // Wether the tile is visible in the viewport
   
-} ChamplainMapTile;
+} Tile;
 
 #endif
diff --git a/src/zoomlevel.c b/src/zoomlevel.c
new file mode 100644 (file)
index 0000000..e56d47c
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@squidy.info>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <zoomlevel.h>
+#include <tile.h>
+#include "map.h"
+#include <champlain_private.h>
+#include <clutter/clutter.h>
+
+ZoomLevel* 
+zoom_level_new(gint zoom_level, gint row, gint column, gint tile_size)
+{
+  ZoomLevel* level = g_new0(ZoomLevel, 1);
+  
+  level->level = zoom_level;
+  level->row_count = row;
+  level->column_count = column;
+  level->tile_size = tile_size;
+  level->tiles = g_ptr_array_sized_new (row * column);
+  level->group = clutter_group_new ();
+  
+  return level;
+}
+
+void 
+zoom_level_create(Map* map, gint zoom_level)
+{
+  int i;
+  for (i = 0; i < map->current_level->row_count * map->current_level->column_count; i++) 
+    {
+      int x = i % map->current_level->column_count;
+      int y = i / map->current_level->column_count;
+
+      Tile* tile = map->get_tile(map, zoom_level, x, y);
+      
+      clutter_container_add (CLUTTER_CONTAINER (map->current_level->group), tile->actor, NULL);
+      g_ptr_array_add (map->current_level->tiles, tile);
+    }
+}
+
+guint
+zoom_level_get_width(ZoomLevel* level)
+{
+  return (level->column_count + 1) * level->tile_size;
+}
+
+guint
+zoom_level_get_height(ZoomLevel* level)
+{
+  return (level->row_count + 1) * level->tile_size;
+}
similarity index 79%
rename from src/champlain_map_zoom_level.h
rename to src/zoomlevel.h
index 0834927a1d3ee0a8e5d189a5cd6a81200f1e0d5c..1aa5482ab90c8d3c262bc18632557e1da9723016 100644 (file)
@@ -33,12 +33,12 @@ typedef struct
   GPtrArray  *tiles;
   ClutterActor* group;
   
-} ChamplainMapZoomLevel;
+} ZoomLevel;
 
-guint champlain_map_zoom_level_get_width(ChamplainMapZoomLevel* level);
+guint zoom_level_get_width(ZoomLevel* level);
 
-guint champlain_map_zoom_level_get_height(ChamplainMapZoomLevel* level);
+guint zoom_level_get_height(ZoomLevel* level);
 
-ChamplainMapZoomLevel* champlain_map_zoom_level_new(gint zoom_level, gint row, gint column, gint tile_size);
+ZoomLevel* zoom_level_new(gint zoom_level, gint row, gint column, gint tile_size);
 
 #endif