47 explicit TerrariumTileFetcher(QObject* parent =
nullptr, QNetworkAccessManager* networkManager =
nullptr);
85 ElevationTilePyramid::Grid grid;
86 QSet<TileMath::TileKey> anchors;
89 void _insertIntoField(
const TileMath::TileKey& fetchKey, ElevationTilePyramid::Grid grid);
92 int _releaseHeld(
const TileMath::TileKey& anchor);
93 void _failAsync(
int requestId);
94 bool _fetchInFlight(
const TileMath::TileKey& fetchKey)
const;
95 bool _startFetch(
const TileMath::TileKey& fetchKey);
96 void _fetchFromNetwork(
const TileMath::TileKey& fetchKey);
97 void _deliverAll(
const TileMath::TileKey& fetchKey,
const QImage& image);
98 void _failAll(
const TileMath::TileKey& fetchKey,
const QString& reason);
99 void _deliver(
int requestId,
const QImage& image);
100 void _finishFailed(
int requestId);
101 bool _shouldWarnFailure();
103 static constexpr int kFailureWarnIntervalMs = 10000;
105 QNetworkAccessManager* _networkManager =
nullptr;
107 QHash<int, PendingRequest> _pending;
108 QHash<TileMath::TileKey, QList<int>> _waiters;
109 QSet<TileMath::TileKey> _fieldRequests;
110 QHash<TileMath::TileKey, HeldTile> _held;
111 QHash<TileMath::TileKey, QNetworkReply*> _activeReplies;
112 TileMath::TileKey _lastFetchKey;
113 QElapsedTimer _failureWarnTimer;