Skip to content

Commit bf5b3ff

Browse files
authored
Merge pull request #1750 from CesiumGS/azure-overlay
Add `CesiumAzureMapsRasterOverlay`
2 parents 6f9822d + b3bbf96 commit bf5b3ff

File tree

7 files changed

+229
-12
lines changed

7 files changed

+229
-12
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
##### Additions :tada:
66

7+
- Added `CesiumAzureMapsRasterOverlay`.
78
- Added the interface `ICesium3DTilesetLifecycleEventReceiver`: when an implementation is registered on a tileset (with `ACesium3DTileset::SetLifecycleEventReceiver`), its functions will be called at various points in a tile's lifecycle, like when a mesh component is created, when a material is instanced, when the tile changes visibility, when it is unloaded, etc.
89

910
##### Fixes :wrench:
1011

12+
- Fixed a bug where `CesiumCreditSystem` would not filter out empty credits, resulting in duplicate on-screen delimiters.
1113
- Fixed a problem where multi-selecting `UCesiumGlobeAnchorComponent` could cause the selected components to teleport to 0 degrees longitude and 0 degrees latitude. Now, the geospatial position and orientation fields are hidden while multi-selecting.
1214

1315
### v2.20.0 - 2025-10-01
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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::BaseHybridRoad:
19+
return AzureMapsTilesetId::baseHybridRoad;
20+
case EAzureMapsTilesetId::BaseHybridDarkGrey:
21+
return AzureMapsTilesetId::baseHybridDarkGrey;
22+
case EAzureMapsTilesetId::Imagery:
23+
return AzureMapsTilesetId::imagery;
24+
case EAzureMapsTilesetId::Terra:
25+
return AzureMapsTilesetId::terra;
26+
case EAzureMapsTilesetId::WeatherRadar:
27+
return AzureMapsTilesetId::weatherRadar;
28+
case EAzureMapsTilesetId::WeatherInfrared:
29+
return AzureMapsTilesetId::weatherInfrared;
30+
case EAzureMapsTilesetId::TrafficAbsolute:
31+
return AzureMapsTilesetId::trafficAbsolute;
32+
case EAzureMapsTilesetId::TrafficRelativeMain:
33+
return AzureMapsTilesetId::trafficRelativeMain;
34+
case EAzureMapsTilesetId::TrafficRelativeDark:
35+
return AzureMapsTilesetId::trafficRelativeDark;
36+
case EAzureMapsTilesetId::TrafficDelay:
37+
return AzureMapsTilesetId::trafficDelay;
38+
case EAzureMapsTilesetId::TrafficReduced:
39+
return AzureMapsTilesetId::trafficReduced;
40+
case EAzureMapsTilesetId::BaseRoad:
41+
default:
42+
return AzureMapsTilesetId::baseRoad;
43+
}
44+
}
45+
} // namespace
46+
47+
std::unique_ptr<CesiumRasterOverlays::RasterOverlay>
48+
UCesiumAzureMapsRasterOverlay::CreateOverlay(
49+
const CesiumRasterOverlays::RasterOverlayOptions& options) {
50+
if (this->Key.IsEmpty()) {
51+
// We must have a key to create this overlay.
52+
return nullptr;
53+
}
54+
55+
return std::make_unique<AzureMapsRasterOverlay>(
56+
TCHAR_TO_UTF8(*this->MaterialLayerKey),
57+
AzureMapsSessionParameters{
58+
.key = TCHAR_TO_UTF8(*this->Key),
59+
.apiVersion = TCHAR_TO_UTF8(*this->ApiVersion),
60+
.tilesetId = getTilesetId(this->TilesetId),
61+
.language = TCHAR_TO_UTF8(*this->Language),
62+
.view = TCHAR_TO_UTF8(*this->View),
63+
},
64+
options);
65+
}

Source/CesiumRuntime/Private/CesiumCreditSystem.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,19 @@ void ACesiumCreditSystem::Tick(float DeltaTime) {
340340
for (int i = 0; i < creditsToShowThisFrame.size(); i++) {
341341
const CesiumUtility::Credit& credit = creditsToShowThisFrame[i];
342342

343-
FString CreditRtf;
343+
FString creditRtf;
344344
const std::string& html = _pCreditSystem->getHtml(credit);
345345

346346
auto htmlFind = _htmlToRtf.find(html);
347347
if (htmlFind != _htmlToRtf.end()) {
348-
CreditRtf = htmlFind->second;
348+
creditRtf = htmlFind->second;
349349
} else {
350-
CreditRtf = ConvertHtmlToRtf(html);
351-
_htmlToRtf.insert({html, CreditRtf});
350+
creditRtf = ConvertHtmlToRtf(html);
351+
_htmlToRtf.insert({html, creditRtf});
352+
}
353+
354+
if (creditRtf.IsEmpty()) {
355+
continue;
352356
}
353357

354358
if (_pCreditSystem->shouldBeShownOnScreen(credit)) {
@@ -358,13 +362,13 @@ void ACesiumCreditSystem::Tick(float DeltaTime) {
358362
OnScreenCredits += TEXT(" \u2022 ");
359363
}
360364

361-
OnScreenCredits += CreditRtf;
365+
OnScreenCredits += creditRtf;
362366
} else {
363367
if (i != 0) {
364368
Credits += "\n";
365369
}
366370

367-
Credits += CreditRtf;
371+
Credits += creditRtf;
368372
}
369373
}
370374

Source/CesiumRuntime/Private/CesiumGoogleMapTilesRasterOverlay.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright 2020-2025 CesiumGS, Inc. and Contributors
22

33
#include "CesiumGoogleMapTilesRasterOverlay.h"
4-
#include "Cesium3DTilesSelection/Tileset.h"
5-
#include "CesiumJsonReader/JsonObjectJsonHandler.h"
6-
#include "CesiumJsonReader/JsonReader.h"
7-
#include "CesiumRasterOverlays/GoogleMapTilesRasterOverlay.h"
4+
#include <Cesium3DTilesSelection/Tileset.h>
5+
#include <CesiumJsonReader/JsonObjectJsonHandler.h>
6+
#include <CesiumJsonReader/JsonReader.h>
7+
#include <CesiumRasterOverlays/GoogleMapTilesRasterOverlay.h>
88

99
using namespace CesiumJsonReader;
1010
using namespace CesiumRasterOverlays;
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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+
* All roadmap layers with Azure Maps' main style.
16+
*/
17+
BaseRoad UMETA(DisplayName = "Base"),
18+
/**
19+
* All roadmap layers with Azure Maps' dark grey style.
20+
*/
21+
BaseDarkGrey UMETA(DisplayName = "Base (Dark Grey)"),
22+
/**
23+
* Label data in Azure Maps' main style.
24+
*/
25+
BaseLabelsRoad UMETA(DisplayName = "Labels"),
26+
/**
27+
* Label data in Azure Maps' dark grey style.
28+
*/
29+
BaseLabelsDarkGrey UMETA(DisplayName = "Labels (Dark Grey)"),
30+
/**
31+
* Road, boundary, and label data in Azure Maps' main style.
32+
*/
33+
BaseHybridRoad UMETA(DisplayName = "Hybrid"),
34+
/**
35+
* Road, boundary, and label data in Azure Maps' dark grey style.
36+
*/
37+
BaseHybridDarkGrey UMETA(DisplayName = "Hybrid (Dark Grey)"),
38+
/**
39+
* A combination of satellite or aerial imagery. Only available for accounts
40+
* under S1 and G2 pricing SKU.
41+
*/
42+
Imagery,
43+
/**
44+
* Shaded relief and terra layers.
45+
*/
46+
Terra,
47+
/**
48+
* Weather radar tiles. Latest weather radar images including areas of rain,
49+
* snow, ice and mixed conditions.
50+
*/
51+
WeatherRadar UMETA(DisplayName = "Weather (Radar)"),
52+
/**
53+
* Weather infrared tiles. Latest infrared satellite images showing clouds by
54+
* their temperature.
55+
*/
56+
WeatherInfrared UMETA(DisplayName = "Weather (Infrared)"),
57+
/**
58+
* Absolute traffic tiles in Azure Maps' main style.
59+
*/
60+
TrafficAbsolute UMETA(DisplayName = "Traffic (Absolute)"),
61+
/**
62+
* Relative traffic tiles in Azure Maps' main style. This filters out traffic
63+
* data from smaller streets that are otherwise included in TrafficAbsolute.
64+
*/
65+
TrafficRelativeMain UMETA(DisplayName = "Traffic (Relative)"),
66+
/**
67+
* Relative traffic tiles in Azure Maps' dark style. This filters out traffic
68+
* data from smaller streets that are otherwise included in TrafficAbsolute.
69+
*/
70+
TrafficRelativeDark UMETA(DisplayName = "Traffic (Relative, Dark)"),
71+
/**
72+
* Delay traffic tiles in Azure Maps' dark style. This only shows the points
73+
* of delay along traffic routes that are otherwise included in
74+
* TrafficAbsolute.
75+
*/
76+
TrafficDelay UMETA(DisplayName = "Traffic (Delay)"),
77+
/**
78+
* Reduced traffic tiles in Azure Maps' dark style. This shows the traffic
79+
* routes and major delay points, but filters out some data that is otherwise
80+
* included in TrafficAbsolute.
81+
*/
82+
TrafficReduced UMETA(DisplayName = "Traffic (Reduced)"),
83+
};
84+
85+
/**
86+
* A raster overlay that directly accesses Azure Maps. If you're using Azure
87+
* Maps via Cesium ion, use the "Cesium ion Raster Overlay" component instead.
88+
*/
89+
UCLASS(ClassGroup = Cesium, meta = (BlueprintSpawnableComponent))
90+
class CESIUMRUNTIME_API UCesiumAzureMapsRasterOverlay
91+
: public UCesiumRasterOverlay {
92+
GENERATED_BODY()
93+
94+
public:
95+
/**
96+
* The Azure Maps subscription key to use.
97+
*/
98+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
99+
FString Key;
100+
101+
/**
102+
* The version number of Azure Maps API.
103+
*/
104+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
105+
FString ApiVersion = "2024-04-01";
106+
107+
/**
108+
* The tileset ID to use.
109+
*/
110+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
111+
EAzureMapsTilesetId TilesetId = EAzureMapsTilesetId::BaseRoad;
112+
113+
/**
114+
* The language in which search results should be returned. This should be one
115+
* of the supported IETF language tags, case insensitive. When data in the
116+
* specified language is not available for a specific field, default language
117+
* is used.
118+
*/
119+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
120+
FString Language = "en-US";
121+
122+
/**
123+
* The View parameter (also called the "user region" parameter) allows
124+
* you to show the correct maps for a certain country/region for
125+
* geopolitically disputed regions.
126+
*
127+
* Different countries/regions have different views of such regions, and the
128+
* View parameter allows your application to comply with the view required by
129+
* the country/region your application will be serving. By default, the View
130+
* parameter is set to "Unified" even if you haven't defined it in the
131+
* request. It is your responsibility to determine the location of your users,
132+
* and then set the View parameter correctly for that location. Alternatively,
133+
* you have the option to set 'View=Auto', which will return the map data
134+
* based on the IP address of the request. The View parameter in Azure Maps
135+
* must be used in compliance with applicable laws, including those regarding
136+
* mapping, of the country/region where maps, images and other data and third
137+
* party content that you are authorized to access via Azure Maps is made
138+
* available. Example: view=IN.
139+
*/
140+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
141+
FString View = "US";
142+
143+
protected:
144+
virtual std::unique_ptr<CesiumRasterOverlays::RasterOverlay> CreateOverlay(
145+
const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override;
146+
};

Source/CesiumRuntime/Public/CesiumRasterOverlay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class CESIUMRUNTIME_API UCesiumRasterOverlay : public UActorComponent {
111111
* overlay will be removed from the Cesium3DTileset if already present but not
112112
* re-added.
113113
*/
114-
UFUNCTION(BlueprintCallable, Category = "Cesium")
114+
UFUNCTION(CallInEditor, BlueprintCallable, Category = "Cesium")
115115
void Refresh();
116116

117117
UFUNCTION(BlueprintCallable, Category = "Cesium")

0 commit comments

Comments
 (0)