/* diversity-atlas.c - DiversityAtlas * * Copyright 2008 OpenMoko, Inc. * Authored by Chia-I Wu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "diversity-marshal.h" enum { TILE_COMPLETED, AREA_ADDED, AREA_REMOVED, LAST_SIGNAL }; static guint atlas_signals[LAST_SIGNAL] = { 0 }; static void diversity_atlas_class_init(gpointer g_iface); GType diversity_atlas_get_type(void) { static GType atlas_type = 0; if (!atlas_type) { atlas_type = g_type_register_static_simple(G_TYPE_INTERFACE, "DiversityAtlas", sizeof(DiversityAtlasIface), (GClassInitFunc) diversity_atlas_class_init, 0, NULL, 0); g_type_interface_add_prerequisite(atlas_type, G_TYPE_OBJECT); } return atlas_type; } static void diversity_atlas_class_init(gpointer g_iface) { GType iface_type = G_TYPE_FROM_INTERFACE(g_iface); atlas_signals[TILE_COMPLETED] = g_signal_new("tile-completed", iface_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DiversityAtlasIface, tile_completed), NULL, NULL, _diversity_marshal_VOID__UINT_INT, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_INT); atlas_signals[AREA_ADDED] = g_signal_new("area-added", iface_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DiversityAtlasIface, area_added), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); atlas_signals[AREA_REMOVED] = g_signal_new("area-removed", iface_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DiversityAtlasIface, area_removed), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } const gchar **diversity_atlas_list_sources(DiversityAtlas *atlas) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->list_sources(atlas); } gboolean diversity_atlas_set_source(DiversityAtlas *atlas, const gchar *src) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->set_source(atlas, src); } const gchar *diversity_atlas_get_source(DiversityAtlas *atlas) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_source(atlas); } const guint *diversity_atlas_list_levels(DiversityAtlas *atlas, gint *size) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->list_levels(atlas, size); } gboolean diversity_atlas_set_level(DiversityAtlas *atlas, gint level) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->set_level(atlas, level); } gint diversity_atlas_get_level(DiversityAtlas *atlas) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_level(atlas); } void diversity_atlas_get_tile_size(DiversityAtlas *atlas, gint *width, gint *height) { DIVERSITY_ATLAS_GET_IFACE(atlas)->get_tile_size(atlas, width, height); } gboolean diversity_atlas_get_atlas_coord(DiversityAtlas *atlas, gdouble lon, gdouble lat, gdouble *x, gdouble *y) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_atlas_coord(atlas, lon, lat, x, y); } gboolean diversity_atlas_get_world_coord(DiversityAtlas *atlas, gdouble x, gdouble y, gdouble *lon, gdouble *lat) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_world_coord(atlas, x, y, lon, lat); } gchar *diversity_atlas_get_uri(DiversityAtlas *atlas, gint x, gint y) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_uri(atlas, x, y); } guint diversity_atlas_submit_tile(DiversityAtlas *atlas, gint x, gint y, gboolean force) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->submit_tile(atlas, x, y, force); } gboolean diversity_atlas_cancel_tile(DiversityAtlas *atlas, guint tile_id) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->cancel_tile(atlas, tile_id); } const gchar *diversity_atlas_get_path(DiversityAtlas *atlas) { return DIVERSITY_ATLAS_GET_IFACE(atlas)->get_path(atlas); }