/* diversity-atlas.h - 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. */ #ifndef _DIVERSITY_ATLAS_H_ #define _DIVERSITY_ATLAS_H_ #define G_DISABLE_CAST_CHECKS #include #include G_BEGIN_DECLS #define DIVERSITY_TYPE_ATLAS (diversity_atlas_get_type()) #define DIVERSITY_ATLAS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), DIVERSITY_TYPE_ATLAS, DiversityAtlas)) #define DIVERSITY_IS_ATLAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), DIVERSITY_TYPE_ATLAS)) #define DIVERSITY_ATLAS_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), DIVERSITY_TYPE_ATLAS, DiversityAtlasIface)) typedef struct _DiversityAtlas DiversityAtlas; /* dummy */ typedef struct _DiversityAtlasIface DiversityAtlasIface; typedef enum _DiversityAtlasTileStatus DiversityAtlasTileStatus; enum _DiversityAtlasTileStatus { DIVERSITY_ATLAS_TILE_STATUS_DONE, DIVERSITY_ATLAS_TILE_STATUS_CANCELLED, DIVERSITY_ATLAS_TILE_STATUS_TIMEOUT, DIVERSITY_ATLAS_TILE_STATUS_FAILED, }; struct _DiversityAtlasIface { GTypeInterface base_iface; /* methods */ const gchar **(*list_sources)(DiversityAtlas *atlas); gboolean (*set_source)(DiversityAtlas *atlas, const gchar *src); const gchar *(*get_source)(DiversityAtlas *atlas); /* list of tile numbers for each level */ const guint *(*list_levels)(DiversityAtlas *atlas, gint *size); gboolean (*set_level)(DiversityAtlas *atlas, gint level); gint (*get_level)(DiversityAtlas *atlas); void (*get_tile_size)(DiversityAtlas *atlas, gint *width, gint *height); gboolean (*get_atlas_coord)(DiversityAtlas *atlas, gdouble lon, gdouble lat, gdouble *x, gdouble *y); gboolean (*get_world_coord)(DiversityAtlas *atlas, gdouble x, gdouble y, gdouble *lon, gdouble *lat); gchar *(*get_uri)(DiversityAtlas *atlas, gint x, gint y); const gchar *(*get_path)(DiversityAtlas *atlas); guint (*submit_tile)(DiversityAtlas *atlas, gint x, gint y, gboolean force); gboolean (*cancel_tile)(DiversityAtlas *atlas, guint tile_id); /* signals */ void (*tile_completed)(DiversityAtlas *atlas, guint tile_id, DiversityAtlasTileStatus status); void (*area_added)(DiversityAtlas *atlas, const gchar *path); void (*area_removed)(DiversityAtlas *atlas, const gchar *path); }; GType diversity_atlas_get_type(void) G_GNUC_CONST; const gchar **diversity_atlas_list_sources(DiversityAtlas *atlas); gboolean diversity_atlas_set_source(DiversityAtlas *atlas, const gchar *src); const gchar *diversity_atlas_get_source(DiversityAtlas *atlas); const guint *diversity_atlas_list_levels(DiversityAtlas *atlas, gint *size); gboolean diversity_atlas_set_level(DiversityAtlas *atlas, gint level); gint diversity_atlas_get_level(DiversityAtlas *atlas); void diversity_atlas_get_tile_size(DiversityAtlas *atlas, gint *width, gint *height); gboolean diversity_atlas_get_atlas_coord(DiversityAtlas *atlas, gdouble lon, gdouble lat, gdouble *x, gdouble *y); gboolean diversity_atlas_get_world_coord(DiversityAtlas *atlas, gdouble x, gdouble y, gdouble *lon, gdouble *lat); gchar *diversity_atlas_get_uri(DiversityAtlas *atlas, gint x, gint y); const gchar *diversity_atlas_get_path(DiversityAtlas *atlas); guint diversity_atlas_submit_tile(DiversityAtlas *atlas, gint x, gint y, gboolean force); gboolean diversity_atlas_cancel_tile(DiversityAtlas *atlas, guint tile_id); G_END_DECLS #endif /* _DIVERSITY_ATLAS_H_ */