Cesium for Unreal 2.18.0
Loading...
Searching...
No Matches
CesiumGeoJsonDocument.h
Go to the documentation of this file.
1// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2
3#pragma once
4
6#include "CesiumUtility/IntrusivePointer.h"
7#include "CesiumVectorData/GeoJsonDocument.h"
8#include "Kismet/BlueprintAsyncActionBase.h"
9#include "Kismet/BlueprintFunctionLibrary.h"
10#include "Templates/SharedPointer.h"
11#include "UObject/ObjectMacros.h"
12
13#include <memory>
14#include <optional>
15
16#include "CesiumGeoJsonDocument.generated.h"
17
18/**
19 * @brief A GeoJSON document containing a tree of `FCesiumGeoJsonObject` values.
20 */
21USTRUCT(BlueprintType)
23 GENERATED_BODY()
24
25 /**
26 * @brief Creates an empty `FCesiumGeoJsonDocument`.
27 */
29
30 /**
31 * @brief Creates a `FCesiumGeoJsonDocument` wrapping the provided
32 * `CesiumVectorData::GeoJsonDocument`.
33 */
35 std::shared_ptr<CesiumVectorData::GeoJsonDocument>&& document);
36
37 /**
38 * @brief Checks if this FCesiumGeoJsonDocument is valid (document is not
39 * nullptr).
40 */
41 bool IsValid() const;
42
43 /**
44 * @brief Returns the `CesiumVectorData::GeoJsonDocument` this wraps.
45 */
46 const std::shared_ptr<CesiumVectorData::GeoJsonDocument>& GetDocument() const;
47
48private:
49 std::shared_ptr<CesiumVectorData::GeoJsonDocument> _pDocument;
50
52};
53
54/**
55 * @brief A Blueprint Function Library providing functions for interacting with
56 * a `FCesiumGeoJsonDocument`.
57 */
58UCLASS()
60 : public UBlueprintFunctionLibrary {
61 GENERATED_BODY()
62
63public:
64 /**
65 * @brief Attempts to load a `FCesiumGeoJsonDocument` from a string containing
66 * GeoJSON data.
67 *
68 * If loading fails, this function will return false and `OutGeoJsonDocument`
69 * will be empty.
70 */
71 UFUNCTION(
72 BlueprintCallable,
73 Category = "Cesium|Vector|Document",
74 meta = (DisplayName = "Load GeoJSON Document From String"))
75 static UPARAM(DisplayName = "Success") bool LoadGeoJsonFromString(
76 const FString& InString,
78
79 /**
80 * @brief Obtains the root node of the provided GeoJSON document.
81 */
82 UFUNCTION(
83 BlueprintCallable,
84 BlueprintPure,
85 Category = "Cesium|Vector|Document",
86 meta = (DisplayName = "Get Root Node"))
88 GetRootObject(const FCesiumGeoJsonDocument& InGeoJsonDocument);
89};
90
91DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(
93 bool,
94 Success,
96 Document);
97
98UCLASS()
100 : public UBlueprintAsyncActionBase {
101 GENERATED_BODY()
102public:
103 /**
104 * @brief Attempts to load a GeoJSON document from a Cesium ion asset.
105 *
106 * If the provided `IonAccessToken` is an empty string, the
107 * `DefaultIonAccessToken` from the provided `CesiumIonServer` will be used
108 * instead.
109 *
110 * If successful, `Success` will be true and `Document` will contain the
111 * loaded document.
112 */
113 UFUNCTION(
114 BlueprintCallable,
115 Category = "Cesium|Vector|Document",
116 meta =
117 (BlueprintInternalUseOnly = true,
118 DisplayName = "Load GeoJSON Document from Cesium ion"))
120 int64 AssetId,
122 const FString& IonAccessToken);
123
124 UPROPERTY(BlueprintAssignable)
126
127 virtual void Activate() override;
128
129 int64 AssetId;
131
132 UPROPERTY()
134};
135
136UCLASS()
138 : public UBlueprintAsyncActionBase {
139 GENERATED_BODY()
140public:
141 /**
142 * @brief Attempts to load a GeoJSON document from a URL.
143 *
144 * If successful, `Success` will be true and `Document` will contain the
145 * loaded document.
146 */
147 UFUNCTION(
148 BlueprintCallable,
149 Category = "Cesium|Vector|Document",
150 meta =
151 (BlueprintInternalUseOnly = true,
152 DisplayName = "Load GeoJSON Document from URL"))
154 LoadFromUrl(const FString& Url, const TMap<FString, FString>& Headers);
155
156 UPROPERTY(BlueprintAssignable)
158
159 virtual void Activate() override;
160
161 FString Url;
162 TMap<FString, FString> Headers;
163};
A Blueprint Function Library providing functions for interacting with a FCesiumGeoJsonDocument.
static FCesiumGeoJsonDocument & OutGeoJsonDocument
static FCesiumGeoJsonObject GetRootObject(const FCesiumGeoJsonDocument &InGeoJsonDocument)
Obtains the root node of the provided GeoJSON document.
static UPARAM(DisplayName="Success") bool LoadGeoJsonFromString(const FString &InString
Attempts to load a FCesiumGeoJsonDocument from a string containing GeoJSON data.
Defines a Cesium ion Server.
static UCesiumLoadGeoJsonDocumentFromIonAsyncAction * LoadFromIon(int64 AssetId, const UCesiumIonServer *CesiumIonServer, const FString &IonAccessToken)
Attempts to load a GeoJSON document from a Cesium ion asset.
FCesiumGeoJsonDocumentAsyncLoadDelegate OnLoadResult
FCesiumGeoJsonDocumentAsyncLoadDelegate OnLoadResult
static UCesiumLoadGeoJsonDocumentFromUrlAsyncAction * LoadFromUrl(const FString &Url, const TMap< FString, FString > &Headers)
Attempts to load a GeoJSON document from a URL.
STL namespace.
A GeoJSON document containing a tree of FCesiumGeoJsonObject values.
bool IsValid() const
Checks if this FCesiumGeoJsonDocument is valid (document is not nullptr).
const std::shared_ptr< CesiumVectorData::GeoJsonDocument > & GetDocument() const
Returns the CesiumVectorData::GeoJsonDocument this wraps.
friend class UCesiumGeoJsonDocumentBlueprintLibrary
FCesiumGeoJsonDocument()
Creates an empty FCesiumGeoJsonDocument.
A single object in the GeoJSON document.