#pragma once #include "Library.h" #include "RasterOverlay.h" #include #include #include #include #include #include #include namespace CesiumRasterOverlays { /** * @brief Options for tile map service accesses. */ struct TileMapServiceRasterOverlayOptions { /** * @brief The file extension for images on the server. */ std::optional fileExtension; /** * @brief A credit for the data source, which is displayed on the canvas. */ std::optional credit; /** * @brief The minimum level-of-detail supported by the imagery provider. * * Take care when specifying this that the number of tiles at the minimum * level is small, such as four or less. A larger number is likely to * result in rendering problems. */ std::optional minimumLevel; /** * @brief The maximum level-of-detail supported by the imagery provider. * * This will be `std::nullopt` if there is no limit. */ std::optional maximumLevel; /** * @brief The {@link CesiumGeometry::Rectangle}, in radians, covered by the * image. */ std::optional coverageRectangle; /** * @brief The {@link CesiumGeospatial::Projection} that is used. */ std::optional projection; /** * @brief The {@link CesiumGeometry::QuadtreeTilingScheme} specifying how * the ellipsoidal surface is broken into tiles. */ std::optional tilingScheme; /** * @brief Pixel width of image tiles. */ std::optional tileWidth; /** * @brief Pixel height of image tiles. */ std::optional tileHeight; /** * @brief An otion to flip the x- and y values of a tile map resource. * * Older versions of gdal2tiles.py flipped X and Y values in * `tilemapresource.xml`. Specifying this option will do the same, allowing * for loading of these incorrect tilesets. */ std::optional flipXY; }; /** * @brief A {@link RasterOverlay} based on tile map service imagery. */ class CESIUMRASTEROVERLAYS_API TileMapServiceRasterOverlay final : public RasterOverlay { public: /** * @brief Creates a new instance. * * @param name The user-given name of this overlay layer. * @param url The base URL. * @param headers The headers. This is a list of pairs of strings of the * form (Key,Value) that will be inserted as request headers internally. * @param tmsOptions The {@link TileMapServiceRasterOverlayOptions}. * @param overlayOptions The {@link RasterOverlayOptions} for this instance. */ TileMapServiceRasterOverlay( const std::string& name, const std::string& url, const std::vector& headers = {}, const TileMapServiceRasterOverlayOptions& tmsOptions = {}, const RasterOverlayOptions& overlayOptions = {}); virtual ~TileMapServiceRasterOverlay() override; virtual CesiumAsync::Future createTileProvider( const CesiumAsync::AsyncSystem& asyncSystem, const std::shared_ptr& pAssetAccessor, const std::shared_ptr& pCreditSystem, const std::shared_ptr& pPrepareRendererResources, const std::shared_ptr& pLogger, CesiumUtility::IntrusivePointer pOwner) const override; private: std::string _url; std::vector _headers; TileMapServiceRasterOverlayOptions _options; }; } // namespace CesiumRasterOverlays