cesium-native  0.41.0
RasterOverlayCollection.h
1 #pragma once
2 
3 #include "Library.h"
4 #include "TilesetExternals.h"
5 
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 <gsl/span>
14 
15 #include <memory>
16 #include <vector>
17 
18 namespace Cesium3DTilesSelection {
19 
31 class CESIUM3DTILESSELECTION_API RasterOverlayCollection final {
32 public:
42  Tile::LoadedLinkedList& loadedTiles,
43  const TilesetExternals& externals,
44  const CesiumGeospatial::Ellipsoid& ellipsoid
45  CESIUM_DEFAULT_ELLIPSOID) noexcept;
46 
53 
60 
67  operator=(const RasterOverlayCollection& rhs) = delete;
68 
75  operator=(RasterOverlayCollection&& rhs) noexcept = default;
76 
77  ~RasterOverlayCollection() noexcept;
78 
84  void add(const CesiumUtility::IntrusivePointer<
85  CesiumRasterOverlays::RasterOverlay>& pOverlay);
86 
90  void remove(const CesiumUtility::IntrusivePointer<
91  CesiumRasterOverlays::RasterOverlay>& pOverlay) noexcept;
92 
96  const std::vector<
97  CesiumUtility::IntrusivePointer<CesiumRasterOverlays::RasterOverlay>>&
98  getOverlays() const;
99 
105  const std::vector<CesiumUtility::IntrusivePointer<
106  CesiumRasterOverlays::RasterOverlayTileProvider>>&
107  getTileProviders() const;
108 
114  const std::vector<CesiumUtility::IntrusivePointer<
115  CesiumRasterOverlays::RasterOverlayTileProvider>>&
116  getPlaceholderTileProviders() const;
117 
131  CesiumRasterOverlays::RasterOverlayTileProvider* findTileProviderForOverlay(
132  CesiumRasterOverlays::RasterOverlay& overlay) noexcept;
133 
137  const CesiumRasterOverlays::RasterOverlayTileProvider*
138  findTileProviderForOverlay(
139  const CesiumRasterOverlays::RasterOverlay& overlay) const noexcept;
140 
155  CesiumRasterOverlays::RasterOverlayTileProvider*
156  findPlaceholderTileProviderForOverlay(
157  CesiumRasterOverlays::RasterOverlay& overlay) noexcept;
158 
162  const CesiumRasterOverlays::RasterOverlayTileProvider*
163  findPlaceholderTileProviderForOverlay(
164  const CesiumRasterOverlays::RasterOverlay& overlay) const noexcept;
165 
169  typedef std::vector<CesiumUtility::IntrusivePointer<
171 
175  const_iterator begin() const noexcept;
176 
180  const_iterator end() const noexcept;
181 
185  size_t size() const noexcept;
186 
187 private:
188  // We store the list of overlays and tile providers in this separate class
189  // so that we can separate its lifetime from the lifetime of the
190  // RasterOverlayCollection. We need to do this because the async operations
191  // that create tile providers from overlays need to have somewhere to write
192  // the result. And we can't extend the lifetime of the entire
193  // RasterOverlayCollection until the async operations complete because the
194  // RasterOverlayCollection has a pointer to the tile LoadedLinkedList, which
195  // is owned externally and may become invalid before the async operations
196  // complete.
197  struct OverlayList
198  : public CesiumUtility::ReferenceCountedNonThreadSafe<OverlayList> {
199  std::vector<
201  overlays{};
204  tileProviders{};
207  placeholders{};
208  };
209 
210  Tile::LoadedLinkedList* _pLoadedTiles;
211  TilesetExternals _externals;
212  CesiumGeospatial::Ellipsoid _ellipsoid;
214  CESIUM_TRACE_DECLARE_TRACK_SET(_loadingSlots, "Raster Overlay Loading Slot");
215 };
216 
217 } // namespace Cesium3DTilesSelection
A collection of RasterOverlay instances that are associated with a Tileset.
RasterOverlayCollection & operator=(const RasterOverlayCollection &rhs)=delete
Deleted copy assignment.
RasterOverlayCollection(const RasterOverlayCollection &rhs)=delete
Deleted Copy constructor.
RasterOverlayCollection(Tile::LoadedLinkedList &loadedTiles, const TilesetExternals &externals, const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID) noexcept
Creates a new instance.
std::vector< CesiumUtility::IntrusivePointer< CesiumRasterOverlays::RasterOverlay > >::const_iterator const_iterator
A constant iterator for RasterOverlay instances.
RasterOverlayCollection(RasterOverlayCollection &&rhs) noexcept=default
Move constructor.
RasterOverlayCollection & operator=(RasterOverlayCollection &&rhs) noexcept=default
Move assignment.
External interfaces used by a Tileset.
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
Provides individual tiles for a RasterOverlay on demand.
Classes that implement the 3D Tiles standard.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.