Skip to content

Commit 50d1ba0

Browse files
committed
Add CesiumAzureMapsRasterOverlay [skip ci]
1 parent 1d61f76 commit 50d1ba0

File tree

3 files changed

+150
-1
lines changed

3 files changed

+150
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2+
3+
#include "CesiumAzureMapsRasterOverlay.h"
4+
#include "Cesium3DTilesSelection/Tileset.h"
5+
#include "CesiumRasterOverlays/AzureMapsRasterOverlay.h"
6+
7+
using namespace CesiumRasterOverlays;
8+
9+
namespace {
10+
std::string getTilesetId(EAzureMapsTilesetId tilesetId) {
11+
switch (tilesetId) {
12+
case EAzureMapsTilesetId::BaseDarkGrey:
13+
return AzureMapsTilesetId::baseDarkGrey;
14+
case EAzureMapsTilesetId::BaseLabelsRoad:
15+
return AzureMapsTilesetId::baseLabelsRoad;
16+
case EAzureMapsTilesetId::BaseLabelsDarkGrey:
17+
return AzureMapsTilesetId::baseLabelsDarkGrey;
18+
case EAzureMapsTilesetId::Imagery:
19+
return AzureMapsTilesetId::imagery;
20+
case EAzureMapsTilesetId::Terra:
21+
return AzureMapsTilesetId::terra;
22+
case EAzureMapsTilesetId::BaseRoad:
23+
default:
24+
return AzureMapsTilesetId::baseRoad;
25+
}
26+
}
27+
} // namespace
28+
29+
std::unique_ptr<CesiumRasterOverlays::RasterOverlay>
30+
UCesiumAzureMapsRasterOverlay::CreateOverlay(
31+
const CesiumRasterOverlays::RasterOverlayOptions& options) {
32+
if (this->Key.IsEmpty()) {
33+
// We must have a key to create this overlay.
34+
return nullptr;
35+
}
36+
37+
return std::make_unique<AzureMapsRasterOverlay>(
38+
TCHAR_TO_UTF8(*this->MaterialLayerKey),
39+
AzureMapsSessionParameters{
40+
.key = TCHAR_TO_UTF8(*this->Key),
41+
.apiVersion = TCHAR_TO_UTF8(*this->ApiVersion),
42+
.tilesetId = getTilesetId(this->TilesetId),
43+
.language = TCHAR_TO_UTF8(*this->Language),
44+
.view = TCHAR_TO_UTF8(*this->View),
45+
},
46+
options);
47+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2+
3+
#pragma once
4+
5+
#include "CesiumRasterOverlay.h"
6+
#include "CoreMinimal.h"
7+
#include "CesiumAzureMapsRasterOverlay.generated.h"
8+
9+
/**
10+
* Supported values for the `TilesetId` property.
11+
*/
12+
UENUM(BlueprintType)
13+
enum class EAzureMapsTilesetId : uint8 {
14+
/**
15+
* @brief All layers with Azure Maps' main style.
16+
*/
17+
BaseRoad UMETA(DisplayName = "Base"),
18+
/**
19+
* @brief All layers with Azure Maps' dark grey style.
20+
*/
21+
BaseDarkGrey,
22+
/**
23+
* @brief Label data in Azure Maps' main style.
24+
*/
25+
BaseLabelsRoad,
26+
/**
27+
* @brief Label data in Azure Maps' dark grey style.
28+
*/
29+
BaseLabelsDarkGrey,
30+
/**
31+
* @brief A combination of satellite or aerial imagery. Only available in S1
32+
* and G2 pricing SKU.
33+
*/
34+
Imagery,
35+
/**
36+
* @brief Shaded relief and terra layers.
37+
*/
38+
Terra,
39+
};
40+
41+
/**
42+
* A raster overlay that directly accesses Azure Maps. If you're using Azure
43+
* Maps via Cesium ion, use the "Cesium ion Raster Overlay" component instead.
44+
*/
45+
UCLASS(ClassGroup = Cesium, meta = (BlueprintSpawnableComponent))
46+
class CESIUMRUNTIME_API UCesiumAzureMapsRasterOverlay
47+
: public UCesiumRasterOverlay {
48+
GENERATED_BODY()
49+
50+
public:
51+
/**
52+
* The Azure Maps subscription key to use.
53+
*/
54+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
55+
FString Key;
56+
57+
/**
58+
* The version number of Azure Maps API.
59+
*/
60+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
61+
FString ApiVersion = "2024-04-01";
62+
63+
/**
64+
* The tileset ID to use.
65+
*/
66+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
67+
EAzureMapsTilesetId TilesetId = EAzureMapsTilesetId::Imagery;
68+
69+
/**
70+
* The language in which search results should be returned. This should be one
71+
* of the supported IETF language tags, case insensitive. When data in the
72+
* specified language is not available for a specific field, default language
73+
* is used.
74+
*/
75+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
76+
FString Language = "en-US";
77+
78+
/**
79+
* The View parameter (also called the "user region" parameter) allows
80+
* you to show the correct maps for a certain country/region for
81+
* geopolitically disputed regions.
82+
*
83+
* Different countries/regions have different views of such regions, and the
84+
* View parameter allows your application to comply with the view required by
85+
* the country/region your application will be serving. By default, the View
86+
* parameter is set to "Unified" even if you haven't defined it in the
87+
* request. It is your responsibility to determine the location of your users,
88+
* and then set the View parameter correctly for that location. Alternatively,
89+
* you have the option to set 'View=Auto', which will return the map data
90+
* based on the IP address of the request. The View parameter in Azure Maps
91+
* must be used in compliance with applicable laws, including those regarding
92+
* mapping, of the country/region where maps, images and other data and third
93+
* party content that you are authorized to access via Azure Maps is made
94+
* available. Example: view=IN.
95+
*/
96+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
97+
FString View = "US";
98+
99+
protected:
100+
virtual std::unique_ptr<CesiumRasterOverlays::RasterOverlay> CreateOverlay(
101+
const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override;
102+
};

0 commit comments

Comments
 (0)