- tile->atime = time(NULL);
- //g_debug("GisTile: update - %p->atime = %u", tile, (guint)tile->atime);
- gdouble lat_dist = tile->edge.n - tile->edge.s;
- gdouble lon_dist = tile->edge.e - tile->edge.w;
- if (_gis_tile_needs_split(tile, res, width, height, lat, lon, elev)) {
- gdouble lat_step = lat_dist / G_N_ELEMENTS(tile->children);
- gdouble lon_step = lon_dist / G_N_ELEMENTS(tile->children[0]);
- int x, y;
- gis_tile_foreach_index(tile, x, y) {
- if (!tile->children[x][y]) {
- tile->children[x][y] = gis_tile_new(tile,
- tile->edge.n-(lat_step*(x+0)),
- tile->edge.n-(lat_step*(x+1)),
- tile->edge.w+(lon_step*(y+1)),
- tile->edge.w+(lon_step*(y+0)));
- load_func(tile->children[x][y], user_data);
+ root->atime = time(NULL);
+ //g_debug("GisTile: update - %p->atime = %u",
+ // root, (guint)root->atime);
+ const gdouble rows = G_N_ELEMENTS(root->children);
+ const gdouble cols = G_N_ELEMENTS(root->children[0]);
+ const gdouble lat_dist = root->edge.n - root->edge.s;
+ const gdouble lon_dist = root->edge.e - root->edge.w;
+ const gdouble lat_step = lat_dist / rows;
+ const gdouble lon_step = lon_dist / cols;
+ int row, col;
+ gis_tile_foreach_index(root, row, col) {
+ GisTile **child = &root->children[row][col];
+ GisBBox edge;
+ edge.n = root->edge.n-(lat_step*(row+0));
+ edge.s = root->edge.n-(lat_step*(row+1));
+ edge.e = root->edge.w+(lon_step*(col+1));
+ edge.w = root->edge.w+(lon_step*(col+0));
+ if (!_gis_tile_precise(eye, &edge, res,
+ width/cols, height/rows)) {
+ if (!*child) {
+ *child = gis_tile_new(root, edge.n, edge.s,
+ edge.e, edge.w);
+ load_func(*child, user_data);