cesium-native 0.47.0
Loading...
Searching...
No Matches
RasterOverlayCollection.h
1#pragma once
2
3#include <Cesium3DTilesSelection/Library.h>
4#include <Cesium3DTilesSelection/LoadedTileEnumerator.h>
5#include <Cesium3DTilesSelection/TilesetExternals.h>
6#include <CesiumGeospatial/Ellipsoid.h>
7#include <CesiumRasterOverlays/RasterOverlay.h>
8#include <CesiumRasterOverlays/RasterOverlayTileProvider.h>
9#include <CesiumUtility/IntrusivePointer.h>
10#include <CesiumUtility/ReferenceCounted.h>
11#include <CesiumUtility/Tracing.h>
12
13#include <memory>
14#include <span>
15#include <vector>
16
17namespace Cesium3DTilesSelection {
18
19class LoadedTileEnumerator;
20
32class CESIUM3DTILESSELECTION_API RasterOverlayCollection final {
33public:
45 const LoadedTileEnumerator& loadedTiles,
46 const TilesetExternals& externals,
47 const CesiumGeospatial::Ellipsoid& ellipsoid
48 CESIUM_DEFAULT_ELLIPSOID) noexcept;
49
61
68
75
82 operator=(const RasterOverlayCollection& rhs) = delete;
83
90 operator=(RasterOverlayCollection&& rhs) noexcept = default;
91
92 ~RasterOverlayCollection() noexcept;
93
99 void add(const CesiumUtility::IntrusivePointer<
100 CesiumRasterOverlays::RasterOverlay>& pOverlay);
101
105 void remove(const CesiumUtility::IntrusivePointer<
106 CesiumRasterOverlays::RasterOverlay>& pOverlay) noexcept;
107
111 const std::vector<
112 CesiumUtility::IntrusivePointer<CesiumRasterOverlays::RasterOverlay>>&
113 getOverlays() const;
114
120 const std::vector<CesiumUtility::IntrusivePointer<
121 CesiumRasterOverlays::RasterOverlayTileProvider>>&
122 getTileProviders() const;
123
129 const std::vector<CesiumUtility::IntrusivePointer<
130 CesiumRasterOverlays::RasterOverlayTileProvider>>&
131 getPlaceholderTileProviders() const;
132
146 CesiumRasterOverlays::RasterOverlayTileProvider* findTileProviderForOverlay(
147 CesiumRasterOverlays::RasterOverlay& overlay) noexcept;
148
152 const CesiumRasterOverlays::RasterOverlayTileProvider*
153 findTileProviderForOverlay(
154 const CesiumRasterOverlays::RasterOverlay& overlay) const noexcept;
155
170 CesiumRasterOverlays::RasterOverlayTileProvider*
171 findPlaceholderTileProviderForOverlay(
172 CesiumRasterOverlays::RasterOverlay& overlay) noexcept;
173
177 const CesiumRasterOverlays::RasterOverlayTileProvider*
178 findPlaceholderTileProviderForOverlay(
179 const CesiumRasterOverlays::RasterOverlay& overlay) const noexcept;
180
184 typedef std::vector<CesiumUtility::IntrusivePointer<
186
190 const_iterator begin() const noexcept;
191
195 const_iterator end() const noexcept;
196
200 size_t size() const noexcept;
201
202private:
203 // We store the list of overlays and tile providers in this separate class
204 // so that we can separate its lifetime from the lifetime of the
205 // RasterOverlayCollection. We need to do this because the async operations
206 // that create tile providers from overlays need to have somewhere to write
207 // the result. And we can't extend the lifetime of the entire
208 // RasterOverlayCollection until the async operations complete because the
209 // RasterOverlayCollection has a pointer to the tile LoadedLinkedList, which
210 // is owned externally and may become invalid before the async operations
211 // complete.
212 struct OverlayList
213 : public CesiumUtility::ReferenceCountedNonThreadSafe<OverlayList> {
214 std::vector<
216 overlays{};
219 tileProviders{};
222 placeholders{};
223 };
224
225 LoadedTileEnumerator _loadedTiles;
226 TilesetExternals _externals;
229 CESIUM_TRACE_DECLARE_TRACK_SET(_loadingSlots, "Raster Overlay Loading Slot")
230};
231
232} // namespace Cesium3DTilesSelection
A "virtual collection" that allows enumeration through the loaded tiles in a subtree rooted at a give...
A collection of CesiumRasterOverlays::RasterOverlay instances that are associated with a Tileset.
RasterOverlayCollection & operator=(RasterOverlayCollection &&rhs) noexcept=default
Move assignment.
RasterOverlayCollection(const RasterOverlayCollection &rhs)=delete
Deleted Copy constructor.
std::vector< CesiumUtility::IntrusivePointer< CesiumRasterOverlays::RasterOverlay > >::const_iterator const_iterator
A constant iterator for CesiumRasterOverlays::RasterOverlay instances.
RasterOverlayCollection(const LoadedTileEnumerator &loadedTiles, const TilesetExternals &externals, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Creates a new instance.
RasterOverlayCollection & operator=(const RasterOverlayCollection &rhs)=delete
Deleted copy assignment.
void setLoadedTileEnumerator(const LoadedTileEnumerator &loadedTiles)
Provides a new LoadedTileEnumerator to use to update loaded tiles when a raster overlay is added or r...
RasterOverlayCollection(RasterOverlayCollection &&rhs) noexcept=default
Move constructor.
External interfaces used by a Tileset.
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:39
Provides individual tiles for a RasterOverlay on demand.
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that implement the 3D Tiles standard.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.
STL namespace.