feat/vtk-3d-view #7
|
|
@ -4,6 +4,7 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
|
|
@ -47,7 +48,7 @@ constexpr int kMaxLeaves = 200; // 一次覆盖的叶瓦片上限(安全
|
|||
constexpr double kRangeFactor = 10.0;
|
||||
constexpr double kRangeFloor = 2000.0; // 至少 2km(小剖面也有足够地理背景)
|
||||
constexpr double kRangeCeil = 30000.0; // 最多 30km(防远裁剪面失控)
|
||||
constexpr int kMaxConcurrent = 8; // 瓦片请求最大并发(防暴发饱和单域名连接)
|
||||
constexpr int kMaxConcurrent = 12; // 瓦片请求最大并发(天地图 8 子域+Mapbox,适度提高吞吐)
|
||||
constexpr int kMinZoom = 3;
|
||||
constexpr int kMaxZoom = 18;
|
||||
constexpr double kGroundZ = 0.0; // 底图置于 z=0 地面参考(剖面深度向下为负,落其下)
|
||||
|
|
@ -287,12 +288,23 @@ void TileBasemap::refresh() {
|
|||
for (int dx = -1; dx <= 1; ++dx)
|
||||
refineTile(kRootZoom, root.x + dx, root.y + dy, desired_, count);
|
||||
|
||||
// 拉取缺失瓦片(旧层暂不删,落地后由 purgeStale 清理)。
|
||||
// 拉取缺失瓦片:按离相机距离排序,最近的先拉 → 用户正看的区域最先出现(而非粗/远块先出)。
|
||||
std::vector<std::pair<double, long long>> todo;
|
||||
for (long long key : desired_) {
|
||||
if (placed_.count(key) || inFlight_.count(key)) continue;
|
||||
int z, x, y;
|
||||
unpackKey(key, z, x, y);
|
||||
fetchTile(z, x, y, key);
|
||||
const geopro::render::LonLatBox b = geopro::render::tileBounds(z, x, y);
|
||||
const auto sw = frame_->toLocal(b.south, b.west);
|
||||
const auto ne = frame_->toLocal(b.north, b.east);
|
||||
const double cx = (sw.x + ne.x) * 0.5 - camX_, cy = (sw.y + ne.y) * 0.5 - camY_;
|
||||
todo.push_back({cx * cx + cy * cy, key});
|
||||
}
|
||||
std::sort(todo.begin(), todo.end());
|
||||
for (const auto& t : todo) {
|
||||
int z, x, y;
|
||||
unpackKey(t.second, z, x, y);
|
||||
fetchTile(z, x, y, t.second);
|
||||
}
|
||||
|
||||
purgeStale();
|
||||
|
|
|
|||
Loading…
Reference in New Issue