cesium-native 0.52.0
Loading...
Searching...
No Matches
RasterOverlay.h
1#pragma once
2
3#include <CesiumAsync/AsyncSystem.h>
4#include <CesiumAsync/IAssetAccessor.h>
5#include <CesiumGeospatial/Ellipsoid.h>
6#include <CesiumGltf/Ktx2TranscodeTargets.h>
7#include <CesiumRasterOverlays/Library.h>
8#include <CesiumRasterOverlays/RasterOverlayLoadFailureDetails.h>
9#include <CesiumUtility/IntrusivePointer.h>
10#include <CesiumUtility/ReferenceCounted.h>
11
12#include <nonstd/expected.hpp>
13#include <spdlog/fwd.h>
14
15#include <any>
16#include <cstddef>
17#include <functional>
18#include <memory>
19#include <optional>
20#include <string>
21
22namespace CesiumUtility {
23struct Credit;
24class CreditSystem;
25} // namespace CesiumUtility
26
27namespace CesiumRasterOverlays {
28
33
37struct CESIUMRASTEROVERLAYS_API RasterOverlayOptions {
43
55 int64_t subTileCacheBytes = static_cast<int64_t>(16 * 1024 * 1024);
56
68 int32_t maximumTextureSize = 2048;
69
79
85
98
103
113
118};
119
137 : public CesiumUtility::ReferenceCountedNonThreadSafe<RasterOverlay> {
138public:
146 const std::string& name,
147 const RasterOverlayOptions& overlayOptions = RasterOverlayOptions());
148 virtual ~RasterOverlay() noexcept;
149
159 CesiumAsync::SharedFuture<void>&
160 getAsyncDestructionCompleteEvent(const CesiumAsync::AsyncSystem& asyncSystem);
161
165 const std::string& getName() const noexcept { return this->_name; }
166
170 RasterOverlayOptions& getOptions() noexcept { return this->_options; }
171
173 const RasterOverlayOptions& getOptions() const noexcept {
174 return this->_options;
175 }
176
190 const RasterOverlayExternals& externals,
191 const CesiumGeospatial::Ellipsoid& ellipsoid
192 CESIUM_DEFAULT_ELLIPSOID) const;
193
203 const RasterOverlayExternals& externals,
204 const CesiumGeospatial::Ellipsoid& ellipsoid
205 CESIUM_DEFAULT_ELLIPSOID) const;
206
214 using CreateTileProviderResult = nonstd::expected<
217
237 const CesiumAsync::AsyncSystem& asyncSystem,
238 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
239 const std::shared_ptr<CesiumUtility::CreditSystem>& pCreditSystem,
240 const std::shared_ptr<IPrepareRasterOverlayRendererResources>&
241 pPrepareRendererResources,
242 const std::shared_ptr<spdlog::logger>& pLogger,
244
245private:
246 struct DestructionCompleteDetails {
247 CesiumAsync::AsyncSystem asyncSystem;
250 };
251
252 std::string _name;
253 RasterOverlayOptions _options;
254 std::vector<CesiumUtility::Credit> _credits;
255 std::optional<DestructionCompleteDetails> _destructionCompleteDetails;
256};
257
258} // namespace CesiumRasterOverlays
A system for managing asynchronous requests and tasks.
Definition AsyncSystem.h:36
A value that will be available in the future, as produced by AsyncSystem.
Definition Future.h:29
A promise that can be resolved or rejected by an asynchronous task.
Definition Promise.h:19
A value that will be available in the future, as produced by AsyncSystem. Unlike Future,...
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:39
static const Ellipsoid WGS84
An Ellipsoid instance initialized to the WGS84 standard.
Definition Ellipsoid.h:48
A RasterOverlay that has been activated for use. While a RasterOverlayTileProvider can be used direct...
An interface between Cesium Native and the application using it, allowing Cesium Native to pass loade...
External interfaces used by a RasterOverlay.
Details on a failure while attempting to load a raster overlay tile.
Provides individual tiles for a RasterOverlay on demand.
const RasterOverlayOptions & getOptions() const noexcept
Gets options for this overlay.
CesiumUtility::IntrusivePointer< RasterOverlayTileProvider > createPlaceholder(const RasterOverlayExternals &externals, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) const
Create a placeholder tile provider can be used in place of the real one while createTileProvider comp...
CesiumAsync::SharedFuture< void > & getAsyncDestructionCompleteEvent(const CesiumAsync::AsyncSystem &asyncSystem)
A future that resolves when this RasterOverlay has been destroyed (i.e. its destructor has been calle...
virtual CesiumAsync::Future< CreateTileProviderResult > createTileProvider(const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const std::shared_ptr< CesiumUtility::CreditSystem > &pCreditSystem, const std::shared_ptr< IPrepareRasterOverlayRendererResources > &pPrepareRendererResources, const std::shared_ptr< spdlog::logger > &pLogger, CesiumUtility::IntrusivePointer< const RasterOverlay > pOwner) const =0
Begins asynchronous creation of a tile provider for this overlay and eventually returns it via a Futu...
RasterOverlay(const std::string &name, const RasterOverlayOptions &overlayOptions=RasterOverlayOptions())
Creates a new instance.
CesiumUtility::IntrusivePointer< ActivatedRasterOverlay > activate(const RasterOverlayExternals &externals, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) const
Activates this overlay.
RasterOverlayOptions & getOptions() noexcept
Gets options for this overlay.
nonstd::expected< CesiumUtility::IntrusivePointer< RasterOverlayTileProvider >, RasterOverlayLoadFailureDetails > CreateTileProviderResult
A result from a call to createTileProvider. This is expected to be an IntrusivePointer to a RasterOve...
const std::string & getName() const noexcept
Gets the name of this overlay.
Creates and manages Credit objects. Avoids repetitions and tracks which credits should be shown and w...
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that support asynchronous operations.
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...
STL namespace.
For each possible input transmission format, this struct names the ideal target gpu-compressed pixel ...
Options for loading raster overlays.
std::any rendererOptions
Arbitrary data that will be passed to Cesium3DTilesSelection::IPrepareRendererResources::prepareRaste...
double maximumScreenSpaceError
The maximum number of pixels of error when rendering this overlay. This is used to select an appropri...
bool showCreditsOnScreen
Whether or not to display the credits on screen.
int32_t maximumSimultaneousTileLoads
The maximum number of overlay tiles that may simultaneously be in the process of loading.
std::function< void(const RasterOverlayLoadFailureDetails &)> loadErrorCallback
A callback function that is invoked when a raster overlay resource fails to load.
CesiumGeospatial::Ellipsoid ellipsoid
The ellipsoid used for this raster overlay.
CesiumGltf::Ktx2TranscodeTargets ktx2TranscodeTargets
For each possible input transmission format, this struct names the ideal target gpu-compressed pixel ...
int32_t maximumTextureSize
The maximum pixel size of raster overlay textures, in either direction.
int64_t subTileCacheBytes
The maximum number of bytes to use to cache sub-tiles in memory.
Represents an HTML string that should be shown on screen to attribute third parties for used data,...