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