cesium-native 0.62.0
Loading...
Searching...
No Matches
RasterOverlayTile.h
1#pragma once
2
3#include <CesiumAsync/AsyncSystem.h>
4#include <CesiumAsync/IAssetRequest.h>
5#include <CesiumGeometry/Rectangle.h>
6#include <CesiumUtility/IntrusivePointer.h>
7#include <CesiumUtility/ReferenceCounted.h>
8
9#include <vector>
10
11namespace CesiumUtility {
12struct Credit;
13}
14
15namespace CesiumImage {
16struct ImageAsset;
17}
18
19namespace CesiumRasterOverlays {
20
22class RasterOverlay;
24
37 : public CesiumUtility::ReferenceCountedNonThreadSafe<RasterOverlayTile> {
38public:
42 enum class LoadState {
47
51 Failed = -1,
52
57
62
66 Loaded = 2,
67
71 Done = 3
72 };
73
84
86 No = 0,
87
89 Yes = 1,
90
94 };
95
106 RasterOverlayTile(ActivatedRasterOverlay& activatedOverlay) noexcept;
107
129 ActivatedRasterOverlay& activatedOverlay,
130 const glm::dvec2& targetScreenPixels,
131 const CesiumGeometry::Rectangle& imageryRectangle) noexcept;
132
135
139 ActivatedRasterOverlay& getActivatedOverlay() noexcept;
140
142 const ActivatedRasterOverlay& getActivatedOverlay() const noexcept;
143
149
152
156 const RasterOverlay& getOverlay() const noexcept;
157
162 const CesiumGeometry::Rectangle& getRectangle() const noexcept {
163 return this->_rectangle;
164 }
165
173 glm::dvec2 getTargetScreenPixels() const noexcept {
174 return this->_targetScreenPixels;
175 }
176
180 LoadState getState() const noexcept { return this->_state; }
181
186 const std::vector<CesiumUtility::Credit>& getCredits() const noexcept {
187 return this->_tileCredits;
188 }
189
199 getImage() const noexcept {
200 return this->_pImage;
201 }
202
212 return this->_pImage;
213 }
214
225
229 void* getRendererResources() const noexcept {
230 return this->_pRendererResources;
231 }
232
238 void setRendererResources(void* pValue) noexcept {
239 this->_pRendererResources = pValue;
240 }
241
247 return this->_moreDetailAvailable;
248 }
249
257 void setState(LoadState newState) noexcept;
258
259private:
260 friend class ActivatedRasterOverlay;
261
262 // This is a raw pointer instead of an IntrusivePointer in order to avoid
263 // circular references, particularly among a placeholder tile provider and
264 // placeholder tile. However, to avoid undefined behavior, the tile provider
265 // is required to outlive the tile. In normal use, the RasterOverlayCollection
266 // ensures that this is true.
267 ActivatedRasterOverlay* _pActivatedOverlay;
268 glm::dvec2 _targetScreenPixels;
269 CesiumGeometry::Rectangle _rectangle;
270 std::vector<CesiumUtility::Credit> _tileCredits;
271 LoadState _state;
273 void* _pRendererResources;
274 MoreDetailAvailable _moreDetailAvailable;
275};
276} // namespace CesiumRasterOverlays
A RasterOverlay that has been activated for use. While a RasterOverlayTileProvider can be used direct...
Provides individual tiles for a RasterOverlay on demand.
void setRendererResources(void *pValue) noexcept
Set the renderer resources for this tile.
const RasterOverlay & getOverlay() const noexcept
Gets the RasterOverlay associated with this instance.
const std::vector< CesiumUtility::Credit > & getCredits() const noexcept
Returns the list of Credits needed for this tile.
void * getRendererResources() const noexcept
Returns the renderer resources that have been created for this tile.
glm::dvec2 getTargetScreenPixels() const noexcept
Gets the number of screen pixels in each direction that should be covered by this tile's texture.
CesiumUtility::IntrusivePointer< const CesiumImage::ImageAsset > getImage() const noexcept
Returns the image data for the tile.
MoreDetailAvailable isMoreDetailAvailable() const noexcept
Determines if more detailed data is available for the spatial area covered by this tile.
ActivatedRasterOverlay & getActivatedOverlay() noexcept
Gets the activated overlay that created this instance.
RasterOverlayTileProvider & getTileProvider() noexcept
Returns the RasterOverlayTileProvider that is responsible for loading this tile's image.
RasterOverlayTile(ActivatedRasterOverlay &activatedOverlay) noexcept
Constructs a placeholder tile for the tile provider.
const CesiumGeometry::Rectangle & getRectangle() const noexcept
Returns the CesiumGeometry::Rectangle that defines the bounds of this tile in the raster overlay's pr...
void loadInMainThread()
Create the renderer resources for the loaded image.
RasterOverlayTile(ActivatedRasterOverlay &activatedOverlay, const glm::dvec2 &targetScreenPixels, const CesiumGeometry::Rectangle &imageryRectangle) noexcept
Creates a new instance.
CesiumUtility::IntrusivePointer< CesiumImage::ImageAsset > getImage() noexcept
Returns the image data for the tile.
LoadState getState() const noexcept
Returns the current LoadState.
LoadState
Lifecycle states of a raster overlay tile.
@ Loading
The request for loading the image data is still pending.
@ Placeholder
Indicator for a placeholder tile.
@ Loaded
The image data has been loaded and the image has been created.
@ Failed
The image request or image creation failed.
@ Done
The rendering resources for the image data have been created.
MoreDetailAvailable
Tile availability states.
@ Unknown
It is not known whether more detailed raster tiles are available.
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.
Basic geometry classes for Cesium.
Classes that support reading, decoding, and manipulating images.
Definition ImageAsset.h:11
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.
ReferenceCounted< T, false > ReferenceCountedNonThreadSafe
A reference-counted base class, meant to be used with IntrusivePointer. The reference count is not th...
A 2D rectangle.
Definition Rectangle.h:14
A 2D image asset, including its pixel data. The image may have mipmaps, and it may be encoded in a GP...
Definition ImageAsset.h:33
Represents an HTML string that should be shown on screen to attribute third parties for used data,...