]> Pileus Git - grits/blobdiff - src/objects/gis-tile.h
Document GisTile
[grits] / src / objects / gis-tile.h
index b7e912336aee50663daad59a8e91acbff7b2bc2b..98052c69abb821d4f7b2634891e59abc523f8f7d 100644 (file)
 #define __GIS_TILE_H__
 
 #include <glib.h>
+#include <glib-object.h>
 #include "gis-object.h"
 
-#define GIS_TYPE_TILE (gis_tile_get_type())
+#define GIS_TYPE_TILE            (gis_tile_get_type())
+#define GIS_TILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),   GIS_TYPE_TILE, GisTile))
+#define GIS_IS_TILE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),   GIS_TYPE_TILE))
+#define GIS_TILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST   ((klass), GIS_TYPE_TILE, GisTileClass))
+#define GIS_IS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE   ((klass), GIS_TYPE_TILE))
+#define GIS_TILE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),   GIS_TYPE_TILE, GisTileClass))
 
-GOBJECT_HEAD(
-       GIS, TILE,
-       Gis, Tile,
-       gis, tile);
+typedef struct _GisTile      GisTile;
+typedef struct _GisTileClass GisTileClass;
 
 struct _GisTile {
        GisObject  parent_instance;
@@ -51,22 +55,55 @@ 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];
 
+GType gis_tile_get_type(void);
+
 /* Allocate a new Tile */
 GisTile *gis_tile_new(GisTile *parent,
        gdouble n, gdouble s, gdouble e, gdouble w);