From: Pierre-Luc Beaudoin Date: Sun, 15 Feb 2009 17:14:54 +0000 (+0200) Subject: Remove dead code (these sources never actually worked). X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1403ae36537a46cb079cfcd39bef68fc2a0c1fdf;p=libchamplain Remove dead code (these sources never actually worked). --- diff --git a/champlain/Makefile.am b/champlain/Makefile.am index b8e8f21..407c2e9 100644 --- a/champlain/Makefile.am +++ b/champlain/Makefile.am @@ -36,11 +36,7 @@ libchamplain_0_3_la_SOURCES = \ champlain-tile.c \ sources/oam.c \ sources/osmmapnik.c \ - sources/mffrelief.c \ - sources/googlemap.c \ - sources/googlesat.c \ - sources/googleterrain.c \ - sources/debugmap.c + sources/mffrelief.c noinst_HEADERS = \ champlain-debug.h \ @@ -53,10 +49,6 @@ noinst_HEADERS = \ sources/oam.h \ sources/osmmapnik.h \ sources/mffrelief.h \ - sources/googlemap.h \ - sources/googlesat.h \ - sources/googleterrain.h \ - sources/debugmap.h \ champlain-enum-types.h libchamplain_include_HEADERS = \ diff --git a/champlain/champlain-map.c b/champlain/champlain-map.c index 58a2d08..7a7505c 100644 --- a/champlain/champlain-map.c +++ b/champlain/champlain-map.c @@ -22,7 +22,6 @@ #include "sources/osmmapnik.h" #include "sources/mffrelief.h" #include "sources/oam.h" -#include "sources/debugmap.h" #include @@ -33,9 +32,6 @@ map_new (ChamplainMapSource source) switch(source) { - case CHAMPLAIN_MAP_SOURCE_DEBUG: - debugmap_init(map); - break; case CHAMPLAIN_MAP_SOURCE_OPENSTREETMAP: osm_mapnik_init(map); break; diff --git a/champlain/sources/debugmap.c b/champlain/sources/debugmap.c deleted file mode 100644 index 5e30730..0000000 --- a/champlain/sources/debugmap.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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 - -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); - -gint debugmap_longitude_to_x (Map *map, gdouble longitude, guint zoom_level); -gint debugmap_latitude_to_y (Map *map, gdouble latitude, guint zoom_level); -gdouble debugmap_x_to_longitude (Map *map, gint x, guint zoom_level); -gdouble debugmap_y_to_latitude (Map *map, gint y, guint zoom_level); - -void -debugmap_init(Map *map) -{ - map->name = "Debug"; - map->zoom_levels = 1; - map->license = "Map data available under GNU Free Documentation license, Version 1.2 or later"; - map->license_uri = "http://www.gnu.org/copyleft/fdl.html"; - map->tile_size = 256; - - map->get_row_count = debugmap_row_count; - map->get_column_count = debugmap_column_count; - - map->longitude_to_x = debugmap_longitude_to_x; - map->latitude_to_y = debugmap_latitude_to_y; - map->x_to_longitude = debugmap_x_to_longitude; - map->y_to_latitude = debugmap_y_to_latitude; -} - -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->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); - - x *= map->tile_size; - y *= map->tile_size; - - gdouble lon, lat; - lon = debugmap_x_to_longitude(map, x, zoom_level); - lat = debugmap_y_to_latitude(map, x, zoom_level); - - actor = clutter_label_new_full ("Arial", g_strdup_printf("%.2f, %.2f", lon, lat), textColor); - clutter_actor_set_position (actor, x, y); - 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; -} - -//FIXME: These functions need to be fixed -gint debugmap_longitude_to_x (Map *map, gdouble longitude, guint zoom_level) -{ - return ((longitude + 180.0) / 360.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gint debugmap_latitude_to_y (Map *map, gdouble latitude, guint zoom_level) -{ - return ((latitude + 90.0) / 180.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gdouble debugmap_x_to_longitude (Map *map, gint x, guint zoom_level) -{ - x /= map->tile_size; - return x / map->tile_size * pow(2.0, zoom_level) * 360.0 - 180; -} - -gdouble debugmap_y_to_latitude (Map *map, gint y, guint zoom_level) -{ - y /= map->tile_size; - return y / map->tile_size * pow(2.0, zoom_level) * 180.0 - 90; -} - diff --git a/champlain/sources/debugmap.h b/champlain/sources/debugmap.h deleted file mode 100644 index f296955..0000000 --- a/champlain/sources/debugmap.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -#ifndef OPENSTREETMAP_H -#define OPENSTREETMAP_H - -#include "champlain-map.h" - -void debugmap_init(Map* map); - -#endif diff --git a/champlain/sources/googlemap.c b/champlain/sources/googlemap.c deleted file mode 100644 index 8b7ce0b..0000000 --- a/champlain/sources/googlemap.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -/* - * WARNING: Using the Google Map Tiles is in viloation of the Terms of Service. - * The current code isn't working because the web server is returning Forbiden error message. - */ - -#include "sources/googlemap.h" - -#include "champlain-map.h" - -#include -#include - -guint google_map_row_count(Map *map, guint zoom_level); -guint google_map_column_count(Map *map, guint zoom_level); -Tile *google_map_get_tile (Map *map, guint zoom_level, guint x, guint y); - -gint google_map_longitude_to_x (Map *map, gdouble longitude, guint zoom_level); -gint google_map_latitude_to_y (Map *map, gdouble latitude, guint zoom_level); -gdouble google_map_x_to_longitude (Map *map, gint x, guint zoom_level); -gdouble google_map_y_to_latitude (Map *map, gint y, guint zoom_level); - -gchar *google_map_get_tile_filename(Map *map, Tile *tile); -gchar *google_map_get_tile_uri(Map *map, Tile *tile); - -void -google_map_init(Map *map) -{ - map->name = "Google Map"; - map->zoom_levels = 15; - map->tile_size = 256; - - map->get_row_count = google_map_row_count; - map->get_column_count = google_map_column_count; - - map->longitude_to_x = google_map_longitude_to_x; - map->latitude_to_y = google_map_latitude_to_y; - map->x_to_longitude = google_map_x_to_longitude; - map->y_to_latitude = google_map_y_to_latitude; - - map->get_tile_filename = google_map_get_tile_filename; - map->get_tile_uri = google_map_get_tile_uri; -} - -guint google_map_row_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -guint -google_map_column_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -gint -google_map_longitude_to_x (Map *map, gdouble longitude, guint zoom_level) -{ - return ((longitude + 180.0) / 360.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gint -google_map_latitude_to_y (Map *map, gdouble latitude, guint zoom_level) -{ - return ((1.0 - log( tan(latitude * M_PI/180.0) + 1.0 / cos(latitude * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gdouble -google_map_x_to_longitude (Map *map, gint x, guint zoom_level) -{ - gdouble dx = (float)x / map->tile_size; - return dx / pow(2.0, zoom_level) * 360.0 - 180; -} - -gdouble -google_map_y_to_latitude (Map *map, gint y, guint zoom_level) -{ - gdouble dy = (float)y / map->tile_size; - double n = M_PI - 2.0 * M_PI * dy / pow(2.0, zoom_level); - return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); -} - -gchar *google_map_get_tile_filename(Map *map, Tile *tile) -{ - return g_build_filename (g_strdup_printf("%d_%d_%d.png", map->zoom_levels + 1 - tile->level, tile->y, tile->x), NULL); -} - -gchar *google_map_get_tile_uri(Map *map, Tile *tile) -{ - return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level); -} diff --git a/champlain/sources/googlemap.h b/champlain/sources/googlemap.h deleted file mode 100644 index 38a1eda..0000000 --- a/champlain/sources/googlemap.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -#ifndef GOOGLE_MAP_H -#define GOOGLE_MAP_H - -#include "champlain-map.h" - -void google_map_init(Map* map); - -#endif diff --git a/champlain/sources/googlesat.c b/champlain/sources/googlesat.c deleted file mode 100644 index 9083e48..0000000 --- a/champlain/sources/googlesat.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -/* - * WARNING: Using the Google Map Tiles is in viloation of the Terms of Service. - * The current code isn't working because the web server is returning Forbiden error message. - */ - -#include "sources/googlesat.h" - -#include "champlain-map.h" - -#include -#include - -guint google_sat_row_count(Map *map, guint zoom_level); -guint google_sat_column_count(Map *map, guint zoom_level); -Tile *google_sat_get_tile (Map *map, guint zoom_level, guint x, guint y); - -gint google_sat_longitude_to_x (Map *map, gdouble longitude, guint zoom_level); -gint google_sat_latitude_to_y (Map *map, gdouble latitude, guint zoom_level); -gdouble google_sat_x_to_longitude (Map *map, gint x, guint zoom_level); -gdouble google_sat_y_to_latitude (Map *map, gint y, guint zoom_level); - -gchar *google_sat_get_tile_filename(Map *map, Tile *tile); -gchar *google_sat_get_tile_uri(Map *map, Tile *tile); - -void -google_sat_init(Map *map) -{ - map->name = "OpenStreetMap"; - map->zoom_levels = 17; - map->tile_size = 256; - - map->get_row_count = google_sat_row_count; - map->get_column_count = google_sat_column_count; - - map->longitude_to_x = google_sat_longitude_to_x; - map->latitude_to_y = google_sat_latitude_to_y; - map->x_to_longitude = google_sat_x_to_longitude; - map->y_to_latitude = google_sat_y_to_latitude; - - map->get_tile_filename = google_sat_get_tile_filename; - map->get_tile_uri = google_sat_get_tile_uri; -} - -guint google_sat_row_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -guint -google_sat_column_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -gint -google_sat_longitude_to_x (Map *map, gdouble longitude, guint zoom_level) -{ - return ((longitude + 180.0) / 360.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gint -google_sat_latitude_to_y (Map *map, gdouble latitude, guint zoom_level) -{ - return ((1.0 - log( tan(latitude * M_PI/180.0) + 1.0 / cos(latitude * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gdouble -google_sat_x_to_longitude (Map *map, gint x, guint zoom_level) -{ - gdouble dx = (float)x / map->tile_size; - return dx / pow(2.0, zoom_level) * 360.0 - 180; -} - -gdouble -google_sat_y_to_latitude (Map *map, gint y, guint zoom_level) -{ - gdouble dy = (float)y / map->tile_size; - double n = M_PI - 2.0 * M_PI * dy / pow(2.0, zoom_level); - return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); -} - -gchar *google_sat_get_tile_filename(Map *map, Tile *tile) -{ - return g_build_filename (g_strdup_printf("%d_%d_%d.png", map->zoom_levels + 1 - tile->level, tile->y, tile->x), NULL); -} - -gchar *google_sat_get_tile_uri(Map *map, Tile *tile) -{ - return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level); -} diff --git a/champlain/sources/googlesat.h b/champlain/sources/googlesat.h deleted file mode 100644 index ab13fef..0000000 --- a/champlain/sources/googlesat.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -#ifndef GOOGLE_SAT_H -#define GOOGLE_SAT_H - -#include "champlain-map.h" - -void google_sat_init(Map* map); - -#endif diff --git a/champlain/sources/googleterrain.c b/champlain/sources/googleterrain.c deleted file mode 100644 index 6811c6a..0000000 --- a/champlain/sources/googleterrain.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -/* - * WARNING: Using the Google Map Tiles is in viloation of the Terms of Service. - * The current code isn't working because the web server is returning Forbiden error message. - */ - -#include "sources/googleterrain.h" - -#include "champlain-map.h" - -#include -#include - -guint google_terrain_row_count(Map *map, guint zoom_level); -guint google_terrain_column_count(Map *map, guint zoom_level); -Tile *google_terrain_get_tile (Map *map, guint zoom_level, guint x, guint y); - -gint google_terrain_longitude_to_x (Map *map, gdouble longitude, guint zoom_level); -gint google_terrain_latitude_to_y (Map *map, gdouble latitude, guint zoom_level); -gdouble google_terrain_x_to_longitude (Map *map, gint x, guint zoom_level); -gdouble google_terrain_y_to_latitude (Map *map, gint y, guint zoom_level); - -gchar *google_terrain_get_tile_filename(Map *map, Tile *tile); -gchar *google_terrain_get_tile_uri(Map *map, Tile *tile); - -void -google_terrain_init(Map *map) -{ - map->name = "OpenStreetMap"; - map->zoom_levels = 17; - map->tile_size = 256; - - map->get_row_count = google_terrain_row_count; - map->get_column_count = google_terrain_column_count; - - map->longitude_to_x = google_terrain_longitude_to_x; - map->latitude_to_y = google_terrain_latitude_to_y; - map->x_to_longitude = google_terrain_x_to_longitude; - map->y_to_latitude = google_terrain_y_to_latitude; - - map->get_tile_filename = google_terrain_get_tile_filename; - map->get_tile_uri = google_terrain_get_tile_uri; -} - -guint google_terrain_row_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -guint -google_terrain_column_count(Map *map, guint zoom_level) -{ - return pow (2, zoom_level); -} - -gint -google_terrain_longitude_to_x (Map *map, gdouble longitude, guint zoom_level) -{ - return ((longitude + 180.0) / 360.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gint -google_terrain_latitude_to_y (Map *map, gdouble latitude, guint zoom_level) -{ - return ((1.0 - log( tan(latitude * M_PI/180.0) + 1.0 / cos(latitude * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, zoom_level)) * map->tile_size; -} - -gdouble -google_terrain_x_to_longitude (Map *map, gint x, guint zoom_level) -{ - gdouble dx = (float)x / map->tile_size; - return dx / pow(2.0, zoom_level) * 360.0 - 180; -} - -gdouble -google_terrain_y_to_latitude (Map *map, gint y, guint zoom_level) -{ - gdouble dy = (float)y / map->tile_size; - double n = M_PI - 2.0 * M_PI * dy / pow(2.0, zoom_level); - return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); -} - -gchar *google_terrain_get_tile_filename(Map *map, Tile *tile) -{ - return g_build_filename (g_strdup_printf("%d_%d_%d.png", tile->level, tile->y, tile->x), NULL); -} - -gchar *google_terrain_get_tile_uri(Map *map, Tile *tile) -{ - return g_strdup_printf("http://tile.openstreetmap.org/%d/%d/%d.png", tile->level, tile->x, tile->y); -} diff --git a/champlain/sources/googleterrain.h b/champlain/sources/googleterrain.h deleted file mode 100644 index f82d0f0..0000000 --- a/champlain/sources/googleterrain.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 Pierre-Luc Beaudoin - * - * 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. - */ - -#ifndef GOOGLE_TERRAIN_H -#define GOOGLE_TERRAIN_H - -#include "champlain-map.h" - -void google_terrain_init(Map* map); - -#endif