Cesium for Unreal 2.16.0
Loading...
Searching...
No Matches
CesiumGeocoderServiceBlueprintLibrary.h
Go to the documentation of this file.
1// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Cesium3DTileset.h"
7#include "Kismet/BlueprintAsyncActionBase.h"
8#include "Kismet/BlueprintFunctionLibrary.h"
9#include "Math/MathFwd.h"
10#include "Misc/Optional.h"
11#include "Templates/SharedPointer.h"
12#include "UObject/Object.h"
13#include "UObject/ObjectMacros.h"
14
15THIRD_PARTY_INCLUDES_START
16#include <CesiumIonClient/Connection.h>
17THIRD_PARTY_INCLUDES_END
18
19#include <CesiumGeospatial/Cartographic.h>
20#include <CesiumGeospatial/GlobeRectangle.h>
21#include <CesiumIonClient/Geocoder.h>
22#include <CesiumUtility/Math.h>
23
24#include <optional>
25
26#include "CesiumGeocoderServiceBlueprintLibrary.generated.h"
27
28/**
29 * @brief The supported providers that can be accessed through ion's geocoder
30 * API.
31 */
32UENUM(BlueprintType)
34 /**
35 * @brief Google geocoder, for use with Google data.
36 */
37 Google = CesiumIonClient::GeocoderProviderType::Google,
38 /**
39 * @brief Bing geocoder, for use with Bing data.
40 */
41 Bing = CesiumIonClient::GeocoderProviderType::Bing,
42 /**
43 * @brief Use the default geocoder as set on the server. Used when neither
44 * Bing or Google data is used.
45 */
46 Default = CesiumIonClient::GeocoderProviderType::Default
47};
48
49/**
50 * @brief The supported types of requests to geocoding API.
51 */
52UENUM(BlueprintType)
54 /**
55 * @brief Perform a full search from a complete query.
56 */
57 Search = CesiumIonClient::GeocoderRequestType::Search,
58 /**
59 * @brief Perform a quick search based on partial input, such as while a user
60 * is typing.
61 *
62 * The search results may be less accurate or exhaustive than using
63 * `ECesiumIonGeocoderRequestType::Search`.
64 */
65 Autocomplete = CesiumIonClient::GeocoderRequestType::Autocomplete
66};
67
68/**
69 * @brief Attribution information for a query to a geocoder service.
70 */
71USTRUCT(BlueprintType)
73 GENERATED_BODY()
74public:
77 const CesiumIonClient::GeocoderAttribution& attribution);
78
79 /**
80 * @brief An HTML string containing the necessary attribution information.
81 */
82 UPROPERTY(BlueprintReadOnly, Category = "Cesium|Geocoder")
83 FString Html;
84
85 /**
86 * @brief If true, the credit should be visible in the main credit container.
87 * Otherwise, it can appear in a popover.
88 */
89 UPROPERTY(BlueprintReadOnly, Category = "Cesium|Geocoder")
91};
92
93/**
94 * @brief A single feature (a location or region) obtained from a geocoder
95 * service.
96 */
97USTRUCT(BlueprintType)
99 GENERATED_BODY()
100public:
103 const CesiumIonClient::GeocoderFeature& feature);
104
105 /**
106 * @brief The position of the feature expressed as longitude in degrees (X),
107 * latitude in degrees (Y), and height in meters above the ellipsoid (Z).
108 *
109 * Do not confuse the ellipsoid height with a geoid height or height above
110 * mean sea level, which can be tens of meters higher or lower depending on
111 * where in the world the object is located.
112 *
113 * The height may be 0.0, indicating that the geocoder did not provide a
114 * height for the feature.
115 *
116 * If the geocoder service returned a bounding box for this result, this will
117 * return the center of the bounding box. If the geocoder service returned a
118 * coordinate for this result, this will return the coordinate.
119 */
120 UPROPERTY(
121 BlueprintReadOnly,
122 Category = "Cesium|Geocoder",
123 meta = (AllowPrivateAccess))
125
126 /**
127 * @brief The globe rectangle that bounds the feature. The box's `Min.X` is
128 * the Westernmost longitude in degrees, `Min.Y` is the Southernmost latitude
129 * in degrees, `Max.X` is the Easternmost longitude in degrees, and `Max.Y` is
130 * the Northernmost latitude in degrees.
131 *
132 * If the geocoder service returned a bounding box for this result, this will
133 * return the bounding box. If the geocoder service returned a coordinate for
134 * this result, this will return a zero-width rectangle at that coordinate.
135 */
136 UPROPERTY(
137 BlueprintReadOnly,
138 Category = "Cesium|Geocoder",
139 meta = (AllowPrivateAccess))
141
142 /**
143 * @brief The user-friendly display name of this feature.
144 */
145 UPROPERTY(
146 BlueprintReadOnly,
147 Category = "Cesium|Geocoder",
148 meta = (AllowPrivateAccess))
149 FString DisplayName;
150};
151
152/**
153 * @brief The result of making a request to a geocoder service.
154 */
155UCLASS(BlueprintType)
156class UCesiumGeocoderServiceResult : public UObject {
157 GENERATED_BODY()
158public:
160
161 /**
162 * @brief Any necessary attributions for this geocoder result.
163 */
164 UPROPERTY(BlueprintReadOnly, Category = "Cesium|Geocoder")
166
167 /**
168 * @brief The features obtained from this geocoder service, if any.
169 */
170 UPROPERTY(BlueprintReadOnly, Category = "Cesium|Geocoder")
172};
173
175 FCesiumGeocoderServiceDelegate,
176 bool,
177 Success,
179 Result,
180 FString,
181 Error);
182
183UCLASS()
185 : public UBlueprintAsyncActionBase {
186 GENERATED_BODY()
187
188public:
189 /**
190 * @brief Queries the Cesium ion Geocoder service.
191 *
192 * @param IonAccessToken The access token to use for Cesium ion. This token
193 * must have the `geocode` scope.
194 * @param CesiumIonServer Information on the Cesium ion server to perform this
195 * request against.
196 * @param ProviderType The provider to obtain a geocoding result from.
197 * @param RequestType The type of geocoding request to make.
198 * @param Query The query string.
199 */
200 UFUNCTION(
201 BlueprintCallable,
202 Category = "Cesium|Geocoder",
203 meta =
204 (BlueprintInternalUseOnly = true,
205 DisplayName = "Query Cesium ion Geocoder"))
207 const FString& IonAccessToken,
208 const UCesiumIonServer* CesiumIonServer,
211 const FString& Query);
212
213 UPROPERTY(BlueprintAssignable)
214 FCesiumGeocoderServiceDelegate OnGeocodeRequestComplete;
215
216 virtual void Activate() override;
217
218private:
219 FString _ionAccessToken;
220
221 UPROPERTY()
222 const UCesiumIonServer* _cesiumIonServer;
223
224 ECesiumIonGeocoderProviderType _providerType;
226 FString _query;
227};
ECesiumIonGeocoderProviderType
The supported providers that can be accessed through ion's geocoder API.
@ Bing
Bing geocoder, for use with Bing data.
@ Default
Use the default geocoder as set on the server.
@ Google
Google geocoder, for use with Google data.
ECesiumIonGeocoderRequestType
The supported types of requests to geocoding API.
@ Search
Perform a full search from a complete query.
@ Autocomplete
Perform a quick search based on partial input, such as while a user is typing.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCesiumGeocoderServiceDelegate, bool, Success, UCesiumGeocoderServiceResult *, Result, FString, Error)
static UCesiumGeocoderServiceIonGeocoderAsyncAction * Geocode(const FString &IonAccessToken, const UCesiumIonServer *CesiumIonServer, ECesiumIonGeocoderProviderType ProviderType, ECesiumIonGeocoderRequestType RequestType, const FString &Query)
Queries the Cesium ion Geocoder service.
The result of making a request to a geocoder service.
TArray< FCesiumGeocoderServiceAttribution > Attributions
Any necessary attributions for this geocoder result.
TArray< FCesiumGeocoderServiceFeature > Features
The features obtained from this geocoder service, if any.
Defines a Cesium ion Server.
Attribution information for a query to a geocoder service.
FString Html
An HTML string containing the necessary attribution information.
bool bShowOnScreen
If true, the credit should be visible in the main credit container.
FCesiumGeocoderServiceAttribution(const CesiumIonClient::GeocoderAttribution &attribution)
A single feature (a location or region) obtained from a geocoder service.
FBox GlobeRectangle
The globe rectangle that bounds the feature.
FCesiumGeocoderServiceFeature(const CesiumIonClient::GeocoderFeature &feature)
FString DisplayName
The user-friendly display name of this feature.
FVector LongitudeLatitudeHeight
The position of the feature expressed as longitude in degrees (X), latitude in degrees (Y),...