feat/vtk-3d-view #7
|
|
@ -4,6 +4,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
|
@ -281,8 +282,9 @@ void TileBasemap::placeTile(long long key, int z, int x, int y, const QImage& im
|
||||||
void TileBasemap::fetchTerrain(int z, int x, int y, long long key) {
|
void TileBasemap::fetchTerrain(int z, int x, int y, long long key) {
|
||||||
if (z > kDemMaxZoom) return; // 高层级无 DEM → 维持平面
|
if (z > kDemMaxZoom) return; // 高层级无 DEM → 维持平面
|
||||||
if (terrainInFlight_.count(key)) return;
|
if (terrainInFlight_.count(key)) return;
|
||||||
|
// 必须 https:该 S3 桶对纯 http 返回 403(实测)。
|
||||||
const QString url =
|
const QString url =
|
||||||
QStringLiteral("http://s3.amazonaws.com/elevation-tiles-prod/terrarium/%1/%2/%3.png")
|
QStringLiteral("https://s3.amazonaws.com/elevation-tiles-prod/terrarium/%1/%2/%3.png")
|
||||||
.arg(z)
|
.arg(z)
|
||||||
.arg(x)
|
.arg(x)
|
||||||
.arg(y);
|
.arg(y);
|
||||||
|
|
@ -294,9 +296,15 @@ void TileBasemap::fetchTerrain(int z, int x, int y, long long key) {
|
||||||
terrainInFlight_.erase(key);
|
terrainInFlight_.erase(key);
|
||||||
if (gen != generation_ || kind_ != Satellite) return;
|
if (gen != generation_ || kind_ != Satellite) return;
|
||||||
if (placed_.find(key) == placed_.end()) return; // 平面块已被清理
|
if (placed_.find(key) == placed_.end()) return; // 平面块已被清理
|
||||||
if (reply->error() != QNetworkReply::NoError) return;
|
if (reply->error() != QNetworkReply::NoError) {
|
||||||
|
qWarning() << "[basemap] DEM 拉取失败" << reply->url().toString() << reply->errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
QImage dem;
|
QImage dem;
|
||||||
if (!dem.loadFromData(reply->readAll())) return;
|
if (!dem.loadFromData(reply->readAll())) {
|
||||||
|
qWarning() << "[basemap] DEM 解码失败" << reply->url().toString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
applyTerrain(key, z, x, y, dem);
|
applyTerrain(key, z, x, y, dem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue