X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fobjects%2Fgis-tile.h;h=e2b72524f53d430e4c12cf0746bccb809e905e4e;hp=c1e3ea77d999cbb155eacf4266545273ee970e24;hb=14c34a746fc94a9e5477d081275f04bd1c8b5d6d;hpb=7d7d6ae0531a85361ce0d8b997d988b653282847 diff --git a/src/objects/gis-tile.h b/src/objects/gis-tile.h index c1e3ea7..e2b7252 100644 --- a/src/objects/gis-tile.h +++ b/src/objects/gis-tile.h @@ -38,10 +38,11 @@ struct _GisTile { /* Pointer to the tile data */ gpointer data; + /* Pointer to the tile data */ + gint zindex; + /* North,South,East,West limits */ - struct { - gdouble n,s,e,w; - } edge; + GisBBox edge; /* Pointers to parent/child nodes */ GisTile *parent; @@ -55,18 +56,49 @@ struct _GisTileClass { GisObjectClass parent_class; }; +/** + * GisTileLoadFunc: + * @tile: the tile to load + * @user_data: data paseed to the function + * + * Used to load the image data associated with a tile. For GisOpenGL, this + * function should store the OpenGL texture number in the tiles data field. + */ typedef void (*GisTileLoadFunc)(GisTile *tile, gpointer user_data); + +/** + * GisTileFreeFunc: + * @tile: the tile to free + * @user_data: data paseed to the function + * + * Used to free the image data associated with a tile + */ typedef void (*GisTileFreeFunc)(GisTile *tile, gpointer user_data); /* Forech functions */ -#define gis_tile_foreach(tile, child) \ - for (int _x = 0; _x < G_N_ELEMENTS(tile->children); _x++) \ - for (int _y = 0; child = tile->children[_x][_y], \ - _y < G_N_ELEMENTS(tile->children[_x]); _y++) \ - -#define gis_tile_foreach_index(tile, x, y) \ - for (x = 0; x < G_N_ELEMENTS(tile->children); x++) \ - for (y = 0; y < G_N_ELEMENTS(tile->children[x]); y++) +/** + * gis_tile_foreach: + * @parent: the #GisTile to iterate over + * @child: a pointer to a #GisTile to store the current subtile + * + * Iterate over each imediate subtile of @parent. + */ +#define gis_tile_foreach(parent, child) \ + for (int _x = 0; _x < G_N_ELEMENTS(parent->children); _x++) \ + for (int _y = 0; child = parent->children[_x][_y], \ + _y < G_N_ELEMENTS(parent->children[_x]); _y++) + +/** + * gis_tile_foreach_index: + * @parent: the #GisTile to iterate over + * @x: integer to store the x index of the current subtile + * @y: integer to store the y index of the current subtile + * + * Iterate over each imediate subtile of @parent. + */ +#define gis_tile_foreach_index(parent, x, y) \ + for (x = 0; x < G_N_ELEMENTS(parent->children); x++) \ + for (y = 0; y < G_N_ELEMENTS(parent->children[x]); y++) /* Path to string table, keep in sync with tile->children */ extern gchar *gis_tile_path_table[2][2]; @@ -81,10 +113,9 @@ GisTile *gis_tile_new(GisTile *parent, gchar *gis_tile_get_path(GisTile *child); /* Update a root tile */ -/* Based on eye distance (lat,lon,elev) */ -void gis_tile_update(GisTile *root, +/* Based on eye distance */ +void gis_tile_update(GisTile *root, GisPoint *eye, gdouble res, gint width, gint height, - gdouble lat, gdouble lon, gdouble elev, GisTileLoadFunc load_func, gpointer user_data); /* Find the leaf tile containing lat-lon */