add per-tile min/max elevation support
This commit is contained in:
@@ -53,6 +53,8 @@ public static class GeoTileAddressablesBuilder
|
||||
public double Ymin;
|
||||
public double GlobalMin;
|
||||
public double GlobalMax;
|
||||
public double TileMin;
|
||||
public double TileMax;
|
||||
}
|
||||
|
||||
internal struct BuildRequest
|
||||
@@ -348,7 +350,9 @@ public static class GeoTileAddressablesBuilder
|
||||
tileId = tile.TileId,
|
||||
offsetX = (float)(tile.Xmin - minX),
|
||||
offsetZ = (float)(tile.Ymin - minY),
|
||||
baseY = (float)tile.GlobalMin
|
||||
baseY = (float)tile.TileMin,
|
||||
tileMin = (float)tile.TileMin,
|
||||
tileMax = (float)tile.TileMax
|
||||
};
|
||||
}
|
||||
|
||||
@@ -405,6 +409,8 @@ public static class GeoTileAddressablesBuilder
|
||||
int IDX_YMIN = headerMap["ymin"];
|
||||
int IDX_GMIN = headerMap["global_min"];
|
||||
int IDX_GMAX = headerMap["global_max"];
|
||||
int IDX_TMIN = headerMap.TryGetValue("tile_min", out var idxTileMin) ? idxTileMin : -1;
|
||||
int IDX_TMAX = headerMap.TryGetValue("tile_max", out var idxTileMax) ? idxTileMax : -1;
|
||||
int IDX_TILE_KEY = headerMap.TryGetValue("tile_key", out var idxTileKey) ? idxTileKey : -1;
|
||||
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
@@ -417,6 +423,10 @@ public static class GeoTileAddressablesBuilder
|
||||
int maxIdx = Math.Max(IDX_TILE, Math.Max(IDX_XMIN, Math.Max(IDX_YMIN, Math.Max(IDX_GMIN, IDX_GMAX))));
|
||||
if (IDX_TILE_KEY >= 0)
|
||||
maxIdx = Math.Max(maxIdx, IDX_TILE_KEY);
|
||||
if (IDX_TMIN >= 0)
|
||||
maxIdx = Math.Max(maxIdx, IDX_TMIN);
|
||||
if (IDX_TMAX >= 0)
|
||||
maxIdx = Math.Max(maxIdx, IDX_TMAX);
|
||||
if (parts.Length <= maxIdx)
|
||||
continue;
|
||||
|
||||
@@ -426,6 +436,16 @@ public static class GeoTileAddressablesBuilder
|
||||
var ymin = double.Parse(parts[IDX_YMIN], ci);
|
||||
var tileKeyRaw = IDX_TILE_KEY >= 0 ? parts[IDX_TILE_KEY].Trim() : "";
|
||||
var tileKey = ResolveTileKey(tileKeyRaw, xmin, ymin, tileKeyConfig, out var xKey, out var yKey);
|
||||
var globalMin = double.Parse(parts[IDX_GMIN], ci);
|
||||
var globalMax = double.Parse(parts[IDX_GMAX], ci);
|
||||
double tileMin = globalMin;
|
||||
double tileMax = globalMax;
|
||||
if (IDX_TMIN >= 0 && IDX_TMIN < parts.Length &&
|
||||
double.TryParse(parts[IDX_TMIN], NumberStyles.Float, ci, out var parsedTileMin))
|
||||
tileMin = parsedTileMin;
|
||||
if (IDX_TMAX >= 0 && IDX_TMAX < parts.Length &&
|
||||
double.TryParse(parts[IDX_TMAX], NumberStyles.Float, ci, out var parsedTileMax))
|
||||
tileMax = parsedTileMax;
|
||||
|
||||
tiles.Add(new TileRecord
|
||||
{
|
||||
@@ -435,8 +455,10 @@ public static class GeoTileAddressablesBuilder
|
||||
YKey = yKey,
|
||||
Xmin = xmin,
|
||||
Ymin = ymin,
|
||||
GlobalMin = double.Parse(parts[IDX_GMIN], ci),
|
||||
GlobalMax = double.Parse(parts[IDX_GMAX], ci)
|
||||
GlobalMin = globalMin,
|
||||
GlobalMax = globalMax,
|
||||
TileMin = tileMin,
|
||||
TileMax = tileMax
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user