cesium-native 0.61.0
Loading...
Searching...
No Matches
ActivatedRasterOverlay.h
1#pragma once
2
3#include <CesiumAsync/Future.h>
4#include <CesiumAsync/Promise.h>
5#include <CesiumAsync/SharedFuture.h>
6#include <CesiumGeometry/Rectangle.h>
7#include <CesiumGeospatial/Ellipsoid.h>
8#include <CesiumRasterOverlays/Library.h>
9#include <CesiumUtility/IntrusivePointer.h>
10#include <CesiumUtility/ReferenceCounted.h>
11
12#include <glm/vec2.hpp>
13
14namespace CesiumRasterOverlays {
15
16class RasterOverlay;
22
23} // namespace CesiumRasterOverlays
24
25namespace CesiumRasterOverlays {
26
74
83class CESIUMRASTEROVERLAYS_API ActivatedRasterOverlay
84 : public CesiumUtility::ReferenceCountedNonThreadSafe<
86public:
98 const RasterOverlayExternals& externals,
100 const CesiumGeospatial::Ellipsoid& ellipsoid
101 CESIUM_DEFAULT_ELLIPSOID) noexcept;
102
108
116 CesiumAsync::SharedFuture<void>& getReadyEvent();
117
123
129 getTileProvider() const noexcept;
130
133
146 const CesiumUtility::IntrusivePointer<RasterOverlayTileProvider>&
147 pTileProvider);
148
157
161
167 getPlaceholderTile() const noexcept;
168
171
193 const CesiumGeometry::Rectangle& rectangle,
194 const glm::dvec2& targetScreenPixels);
195
199 int64_t getTileDataBytes() const noexcept;
200
204 uint32_t getNumberOfTilesLoading() const noexcept;
205
217
237
261
268 void tick();
269
270private:
272 doLoad(RasterOverlayTile& tile, bool isThrottledLoad);
273
281 void beginTileLoad(bool isThrottledLoad) noexcept;
282
291 void finalizeTileLoad(bool isThrottledLoad) noexcept;
292
293 CesiumUtility::IntrusivePointer<const CesiumRasterOverlays::RasterOverlay>
294 _pOverlay;
295 CesiumUtility::IntrusivePointer<
297 _pPlaceholderTileProvider;
299 _pPlaceholderTile;
300 CesiumUtility::IntrusivePointer<
302 _pTileProvider;
303
304 int64_t _tileDataBytes;
305 int32_t _totalTilesCurrentlyLoading;
306 int32_t _throttledTilesCurrentlyLoading;
307
308 CesiumAsync::Promise<void> _readyPromise;
309 CesiumAsync::SharedFuture<void> _readyEvent;
310};
311
312} // namespace CesiumRasterOverlays
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:39
A RasterOverlay that has been activated for use. While a RasterOverlayTileProvider can be used direct...
CesiumAsync::SharedFuture< void > & getReadyEvent()
Gets a shared future that resolves when this instance is ready to provide tiles.
const CesiumRasterOverlays::RasterOverlay & getOverlay() const noexcept
Gets the RasterOverlay that was activated to create this instance.
ActivatedRasterOverlay(const RasterOverlayExternals &externals, const CesiumUtility::IntrusivePointer< const RasterOverlay > &pOverlay, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Constructs a new instance.
const CesiumRasterOverlays::RasterOverlayTile * getPlaceholderTile() const noexcept
Gets the placeholder tile created by the getPlaceholderTileProvider.
CesiumUtility::IntrusivePointer< CesiumRasterOverlays::RasterOverlayTile > getTile(const CesiumGeometry::Rectangle &rectangle, const glm::dvec2 &targetScreenPixels)
Returns a new RasterOverlayTile with the given specifications.
void setTileProvider(const CesiumUtility::IntrusivePointer< RasterOverlayTileProvider > &pTileProvider)
Sets the tile provider for this activated overlay.
bool loadTileThrottled(RasterOverlayTile &tile)
Loads a tile, unless there are too many tile loads already in progress.
uint32_t getNumberOfTilesLoading() const noexcept
Returns the number of tiles that are currently loading.
void removeTile(RasterOverlayTile *pTile) noexcept
Removes a no-longer-referenced tile from this provider's cache and deletes it.
CesiumAsync::Future< RasterOverlayTileLoadResult > loadTile(RasterOverlayTile &tile)
Loads a tile immediately, without throttling requests.
void tick()
Ticks the underlying raster overlay. This should be called frequently, such as once per frame,...
const CesiumRasterOverlays::RasterOverlayTileProvider * getTileProvider() const noexcept
Gets the tile provider created for this activated overlay. This will be nullptr before getReadyEvent ...
const CesiumRasterOverlays::RasterOverlayTileProvider * getPlaceholderTileProvider() const noexcept
Gets the placeholder tile provider.
int64_t getTileDataBytes() const noexcept
Gets the number of bytes of tile data that are currently loaded.
~ActivatedRasterOverlay() noexcept
Destroys the instance. Use addReference and releaseReference instead of destroying this instance dire...
External interfaces used by a RasterOverlay.
Provides individual tiles for a RasterOverlay on demand.
Raster image data for a tile in a quadtree.
The base class for a rasterized image that can be draped over a Cesium3DTilesSelection::Tileset....
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that support asynchronous operations.
Basic geometry classes for Cesium.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.
Holds a tile and its corresponding activated raster overlay. Used as the return value of ActivatedRas...
RasterOverlayTileLoadResult(const CesiumUtility::IntrusivePointer< ActivatedRasterOverlay > &pActivated_, const CesiumUtility::IntrusivePointer< RasterOverlayTile > &pTile_) noexcept
Constructs an instance.
CesiumUtility::IntrusivePointer< ActivatedRasterOverlay > pActivated
A CesiumUtility::IntrusivePointer to the ActivatedRasterOverlay used for this tile.
CesiumUtility::IntrusivePointer< RasterOverlayTile > pTile
A CesiumUtility::IntrusivePointer to the RasterOverlayTile used for this tile.