cesium-native 0.52.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 <CesiumGltf/Model.h>
7#include <CesiumUtility/IntrusivePointer.h>
8#include <CesiumUtility/ReferenceCounted.h>
9
10#include <vector>
11
12namespace CesiumUtility {
13struct Credit;
14}
15
16namespace CesiumRasterOverlays {
17
19class RasterOverlay;
21
34 : public CesiumUtility::ReferenceCountedNonThreadSafe<RasterOverlayTile> {
35public:
39 enum class LoadState {
44
48 Failed = -1,
49
54
59
63 Loaded = 2,
64
68 Done = 3
69 };
70
81
83 No = 0,
84
86 Yes = 1,
87
91 };
92
103 RasterOverlayTile(ActivatedRasterOverlay& activatedOverlay) noexcept;
104
126 ActivatedRasterOverlay& activatedOverlay,
127 const glm::dvec2& targetScreenPixels,
128 const CesiumGeometry::Rectangle& imageryRectangle) noexcept;
129
132
136 ActivatedRasterOverlay& getActivatedOverlay() noexcept;
137
139 const ActivatedRasterOverlay& getActivatedOverlay() const noexcept;
140
146
149
153 const RasterOverlay& getOverlay() const noexcept;
154
159 const CesiumGeometry::Rectangle& getRectangle() const noexcept {
160 return this->_rectangle;
161 }
162
170 glm::dvec2 getTargetScreenPixels() const noexcept {
171 return this->_targetScreenPixels;
172 }
173
177 LoadState getState() const noexcept { return this->_state; }
178
183 const std::vector<CesiumUtility::Credit>& getCredits() const noexcept {
184 return this->_tileCredits;
185 }
186
196 getImage() const noexcept {
197 return this->_pImage;
198 }
199
209 return this->_pImage;
210 }
211
222
226 void* getRendererResources() const noexcept {
227 return this->_pRendererResources;
228 }
229
235 void setRendererResources(void* pValue) noexcept {
236 this->_pRendererResources = pValue;
237 }
238
244 return this->_moreDetailAvailable;
245 }
246
254 void setState(LoadState newState) noexcept;
255
256private:
257 friend class ActivatedRasterOverlay;
258
259 // This is a raw pointer instead of an IntrusivePointer in order to avoid
260 // circular references, particularly among a placeholder tile provider and
261 // placeholder tile. However, to avoid undefined behavior, the tile provider
262 // is required to outlive the tile. In normal use, the RasterOverlayCollection
263 // ensures that this is true.
264 ActivatedRasterOverlay* _pActivatedOverlay;
265 glm::dvec2 _targetScreenPixels;
266 CesiumGeometry::Rectangle _rectangle;
267 std::vector<CesiumUtility::Credit> _tileCredits;
268 LoadState _state;
270 void* _pRendererResources;
271 MoreDetailAvailable _moreDetailAvailable;
272};
273} // 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.
CesiumUtility::IntrusivePointer< const CesiumGltf::ImageAsset > getImage() const noexcept
Returns the image data for the 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< CesiumGltf::ImageAsset > getImage() 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.
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 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
Represents an HTML string that should be shown on screen to attribute third parties for used data,...