Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RequestHeaders properly to relevant raster overlays #1597

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

##### Additions :tada:

- Added `RequestHeaders` property to `Cesium3DTileset`, allowing per-tileset headers to be specified.
- Added `CesiumUrlTemplateRasterOverlay`, allowing a raster overlay to be added using tiles requested based on a specified URL template.
- Added `RequestHeaders` property to `Cesium3DTileset`, allowing per-tileset headers to be specified.
- Added `RequestHeaders` properties to `CesiumTileMapServiceRasterOverlay`, `CesiumUrlTemplateRasterOverlay`, `CesiumWebMapServiceRasterOverlay`,
and `CesiumWebMapTileServiceRasterOverlay`, allowing per-raster-overlay HTTP headers to be specified.

##### Fixes :wrench:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ UCesiumTileMapServiceRasterOverlay::CreateOverlay(
tmsOptions.minimumLevel = MinimumLevel;
tmsOptions.maximumLevel = MaximumLevel;
}

std::vector<CesiumAsync::IAssetAccessor::THeader> headers;

for (const auto& [Key, Value] : this->RequestHeaders) {
headers.push_back(CesiumAsync::IAssetAccessor::THeader{
TCHAR_TO_UTF8(*Key),
TCHAR_TO_UTF8(*Value)});
}

return std::make_unique<CesiumRasterOverlays::TileMapServiceRasterOverlay>(
TCHAR_TO_UTF8(*this->MaterialLayerKey),
TCHAR_TO_UTF8(*this->Url),
std::vector<CesiumAsync::IAssetAccessor::THeader>(),
headers,
tmsOptions,
options);
}
10 changes: 9 additions & 1 deletion Source/CesiumRuntime/Private/CesiumUrlTemplateRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ UCesiumUrlTemplateRasterOverlay::CreateOverlay(
RootTilesY);
}

std::vector<CesiumAsync::IAssetAccessor::THeader> headers;

for (const auto& [Key, Value] : this->RequestHeaders) {
headers.push_back(CesiumAsync::IAssetAccessor::THeader{
TCHAR_TO_UTF8(*Key),
TCHAR_TO_UTF8(*Value)});
}

return std::make_unique<CesiumRasterOverlays::UrlTemplateRasterOverlay>(
TCHAR_TO_UTF8(*this->MaterialLayerKey),
TCHAR_TO_UTF8(*this->TemplateUrl),
std::vector<CesiumAsync::IAssetAccessor::THeader>(),
headers,
urlTemplateOptions,
options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ UCesiumWebMapServiceRasterOverlay::CreateOverlay(
wmsOptions.layers = TCHAR_TO_UTF8(*Layers);
wmsOptions.tileWidth = TileWidth;
wmsOptions.tileHeight = TileHeight;

std::vector<CesiumAsync::IAssetAccessor::THeader> headers;

for (const auto& [Key, Value] : this->RequestHeaders) {
headers.push_back(CesiumAsync::IAssetAccessor::THeader{
TCHAR_TO_UTF8(*Key),
TCHAR_TO_UTF8(*Value)});
}

return std::make_unique<CesiumRasterOverlays::WebMapServiceRasterOverlay>(
TCHAR_TO_UTF8(*this->MaterialLayerKey),
TCHAR_TO_UTF8(*this->BaseUrl),
std::vector<CesiumAsync::IAssetAccessor::THeader>(),
headers,
wmsOptions,
options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,19 @@ UCesiumWebMapTileServiceRasterOverlay::CreateOverlay(
wmtsOptions.tileMatrixLabels = labels;
}
}

std::vector<CesiumAsync::IAssetAccessor::THeader> headers;

for (const auto& [Key, Value] : this->RequestHeaders) {
headers.push_back(CesiumAsync::IAssetAccessor::THeader{
TCHAR_TO_UTF8(*Key),
TCHAR_TO_UTF8(*Value)});
}

return std::make_unique<CesiumRasterOverlays::WebMapTileServiceRasterOverlay>(
TCHAR_TO_UTF8(*this->MaterialLayerKey),
TCHAR_TO_UTF8(*this->BaseUrl),
std::vector<CesiumAsync::IAssetAccessor::THeader>(),
headers,
wmtsOptions,
options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class CESIUMRUNTIME_API UCesiumTileMapServiceRasterOverlay
meta = (EditCondition = "bSpecifyZoomLevels", ClampMin = 0))
int32 MaximumLevel = 10;

/**
* HTTP headers to be attached to each request made for this raster overlay.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
TMap<FString, FString> RequestHeaders;

protected:
virtual std::unique_ptr<CesiumRasterOverlays::RasterOverlay> CreateOverlay(
const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override;
Expand Down
6 changes: 6 additions & 0 deletions Source/CesiumRuntime/Public/CesiumUrlTemplateRasterOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ class CESIUMRUNTIME_API UCesiumUrlTemplateRasterOverlay
meta = (ClampMin = 64, ClampMax = 2048))
int32 TileHeight = 256;

/**
* HTTP headers to be attached to each request made for this raster overlay.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
TMap<FString, FString> RequestHeaders;

protected:
virtual std::unique_ptr<CesiumRasterOverlays::RasterOverlay> CreateOverlay(
const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ class CESIUMRUNTIME_API UCesiumWebMapServiceRasterOverlay
meta = (ClampMin = 0))
int32 MaximumLevel = 14;

/**
* HTTP headers to be attached to each request made for this raster overlay.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
TMap<FString, FString> RequestHeaders;

protected:
virtual std::unique_ptr<CesiumRasterOverlays::RasterOverlay> CreateOverlay(
const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ class CESIUMRUNTIME_API UCesiumWebMapTileServiceRasterOverlay
meta = (ClampMin = 64, ClampMax = 2048))
int32 TileHeight = 256;

/**
* HTTP headers to be attached to each request made for this raster overlay.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
TMap<FString, FString> RequestHeaders;

virtual void Serialize(FArchive& Ar) override;

protected:
Expand Down