Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
CesiumPropertyTableProperty.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "CesiumGltf/PropertyTablePropertyView.h"
6#include "CesiumGltf/PropertyTypeTraits.h"
10#include "Kismet/BlueprintFunctionLibrary.h"
11#include "UObject/ObjectMacros.h"
12#include <any>
13#include <glm/glm.hpp>
14#include <string_view>
15#include <variant>
16#include "CesiumPropertyTableProperty.generated.h"
17
22UENUM(BlueprintType)
24 /* The property table property is valid. */
25 Valid = 0,
26 /* The property table property is empty but has a specified default value. */
28 /* The property table property does not exist in the glTF, or the property
29 definition itself contains errors. */
31 /* The data associated with the property table property is malformed and
32 cannot be retrieved. */
34};
35
42USTRUCT(BlueprintType)
43struct CESIUMRUNTIME_API FCesiumPropertyTableProperty {
44 GENERATED_USTRUCT_BODY()
45
46private:
47public:
53 _property(),
54 _valueType(),
55 _normalized(false) {}
56
62 template <typename T, bool Normalized>
66 _property(Property),
67 _valueType(),
68 _normalized(Normalized) {
69 switch (Property.status()) {
70 case CesiumGltf::PropertyTablePropertyViewStatus::Valid:
71 _status = ECesiumPropertyTablePropertyStatus::Valid;
72 break;
73 case CesiumGltf::PropertyTablePropertyViewStatus::EmptyPropertyWithDefault:
74 _status = ECesiumPropertyTablePropertyStatus::EmptyPropertyWithDefault;
75 break;
76 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidPropertyTable:
77 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorNonexistentProperty:
78 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorTypeMismatch:
79 case CesiumGltf::PropertyTablePropertyViewStatus::
80 ErrorComponentTypeMismatch:
81 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorArrayTypeMismatch:
82 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidNormalization:
83 case CesiumGltf::PropertyTablePropertyViewStatus::
84 ErrorNormalizationMismatch:
85 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidOffset:
86 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidScale:
87 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidMax:
88 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidMin:
89 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidNoDataValue:
90 case CesiumGltf::PropertyTablePropertyViewStatus::ErrorInvalidDefaultValue:
91 // The status was already set in the initializer list.
92 return;
93 default:
94 _status = ECesiumPropertyTablePropertyStatus::ErrorInvalidPropertyData;
95 return;
96 }
97
98 _valueType = TypeToMetadataValueType<T>();
99 _normalized = Normalized;
100 }
101
102private:
104
105 std::any _property;
106
107 FCesiumMetadataValueType _valueType;
108 bool _normalized;
109
111};
112
113UCLASS()
115 : public UBlueprintFunctionLibrary {
116 GENERATED_BODY()
117
118public:
125 UFUNCTION(
126 BlueprintCallable,
127 BlueprintPure,
128 Category = "Cesium|Metadata|PropertyTableProperty")
130 UPARAM(ref) const FCesiumPropertyTableProperty& Property);
131
139 UFUNCTION(
140 BlueprintCallable,
141 BlueprintPure,
142 Category = "Cesium|Metadata|PropertyTableProperty")
144 GetBlueprintType(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
145
153 UFUNCTION(
154 BlueprintCallable,
155 BlueprintPure,
156 Category = "Cesium|Metadata|PropertyTableProperty")
158 UPARAM(ref) const FCesiumPropertyTableProperty& Property);
159
160 PRAGMA_DISABLE_DEPRECATION_WARNINGS
168 UFUNCTION(
169 BlueprintCallable,
170 BlueprintPure,
171 Meta =
172 (DeprecatedFunction,
173 DeprecationMessage = "Use GetArrayElementBlueprintType instead."))
176 const FCesiumPropertyTableProperty& Property);
177 PRAGMA_ENABLE_DEPRECATION_WARNINGS
178
186 UFUNCTION(
187 BlueprintCallable,
188 BlueprintPure,
189 Category = "Cesium|Metadata|PropertyTableProperty")
191 GetValueType(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
192
193 PRAGMA_DISABLE_DEPRECATION_WARNINGS
200 UFUNCTION(
201 BlueprintCallable,
202 BlueprintPure,
203 Meta =
204 (DeprecatedFunction,
205 DeprecationMessage =
206 "CesiumMetadataTrueType is deprecated. Use GetValueType to get the CesiumMetadataValueType instead."))
208 GetTrueType(UPARAM(ref) const FCesiumPropertyTableProperty& Value);
209
218 UFUNCTION(
219 BlueprintCallable,
220 BlueprintPure,
221 Meta =
222 (DeprecatedFunction,
223 DeprecationMessage =
224 "CesiumMetadataTrueType is deprecated. Use GetValueType to get the CesiumMetadataValueType instead."))
227
228 PRAGMA_ENABLE_DEPRECATION_WARNINGS
229
235 UFUNCTION(
236 BlueprintCallable,
237 BlueprintPure,
238 Category = "Cesium|Metadata|PropertyTableProperty")
239 static int64
240 GetPropertySize(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
241
242 PRAGMA_DISABLE_DEPRECATION_WARNINGS
248 UFUNCTION(
249 BlueprintCallable,
250 BlueprintPure,
251 Meta =
252 (DeprecatedFunction,
253 DeprecationMessage = "Use GetPropertySize instead."))
254 static int64
256 PRAGMA_ENABLE_DEPRECATION_WARNINGS
257
264 UFUNCTION(
265 BlueprintCallable,
266 BlueprintPure,
267 Category = "Cesium|Metadata|PropertyTableProperty")
268 static int64 GetArraySize(UPARAM(ref)
269 const FCesiumPropertyTableProperty& Property);
270
271 PRAGMA_DISABLE_DEPRECATION_WARNINGS
278 UFUNCTION(
279 BlueprintCallable,
280 BlueprintPure,
281 Meta =
282 (DeprecatedFunction,
283 DeprecationMessage = "Use GetArraySize instead."))
284 static int64
286 PRAGMA_ENABLE_DEPRECATION_WARNINGS
287
319 UFUNCTION(
320 BlueprintCallable,
321 BlueprintPure,
322 Category = "Cesium|Metadata|PropertyTableProperty")
323 static bool GetBoolean(
324 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
325 int64 FeatureID,
326 bool DefaultValue = false);
327
361 UFUNCTION(
362 BlueprintCallable,
363 BlueprintPure,
364 Category = "Cesium|Metadata|PropertyTableProperty")
365 static uint8 GetByte(
366 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
367 int64 FeatureID,
368 uint8 DefaultValue = 0);
369
406 UFUNCTION(
407 BlueprintCallable,
408 BlueprintPure,
409 Category = "Cesium|Metadata|PropertyTableProperty")
410 static int32 GetInteger(
411 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
412 int64 FeatureID,
413 int32 DefaultValue = 0);
414
450 UFUNCTION(
451 BlueprintCallable,
452 BlueprintPure,
453 Category = "Cesium|Metadata|PropertyTableProperty")
454 static int64 GetInteger64(
455 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
456 int64 FeatureID,
457 int64 DefaultValue = 0);
458
495 UFUNCTION(
496 BlueprintCallable,
497 BlueprintPure,
498 Category = "Cesium|Metadata|PropertyTableProperty")
499 static float GetFloat(
500 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
501 int64 FeatureID,
502 float DefaultValue = 0.0f);
503
539 UFUNCTION(
540 BlueprintCallable,
541 BlueprintPure,
542 Category = "Cesium|Metadata|PropertyTableProperty")
543 static double GetFloat64(
544 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
545 int64 FeatureID,
546 double DefaultValue = 0.0);
547
588 UFUNCTION(
589 BlueprintCallable,
590 BlueprintPure,
591 Category = "Cesium|Metadata|PropertyTableProperty")
592 static FIntPoint GetIntPoint(
593 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
594 int64 FeatureID,
595 const FIntPoint& DefaultValue);
596
633 UFUNCTION(
634 BlueprintCallable,
635 BlueprintPure,
636 Category = "Cesium|Metadata|PropertyTableProperty")
637 static FVector2D GetVector2D(
638 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
639 int64 FeatureID,
640 const FVector2D& DefaultValue);
641
685 UFUNCTION(
686 BlueprintCallable,
687 BlueprintPure,
688 Category = "Cesium|Metadata|PropertyTableProperty")
689 static FIntVector GetIntVector(
690 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
691 int64 FeatureID,
692 const FIntVector& DefaultValue);
693
737 UFUNCTION(
738 BlueprintCallable,
739 BlueprintPure,
740 Category = "Cesium|Metadata|PropertyTableProperty")
741 static FVector3f GetVector3f(
742 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
743 int64 FeatureID,
744 const FVector3f& DefaultValue);
745
785 UFUNCTION(
786 BlueprintCallable,
787 BlueprintPure,
788 Category = "Cesium|Metadata|PropertyTableProperty")
789 static FVector GetVector(
790 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
791 int64 FeatureID,
792 const FVector& DefaultValue);
793
835 UFUNCTION(
836 BlueprintCallable,
837 BlueprintPure,
838 Category = "Cesium|Metadata|PropertyTableProperty")
839 static FVector4 GetVector4(
840 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
841 int64 FeatureID,
842 const FVector4& DefaultValue);
843
886 UFUNCTION(
887 BlueprintCallable,
888 BlueprintPure,
889 Category = "Cesium|Metadata|PropertyTableProperty")
890 static FMatrix GetMatrix(
891 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
892 int64 FeatureID,
893 const FMatrix& DefaultValue);
894
930 UFUNCTION(
931 BlueprintCallable,
932 BlueprintPure,
933 Category = "Cesium|Metadata|PropertyTableProperty")
934 static FString GetString(
935 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
936 int64 FeatureID,
937 const FString& DefaultValue = "");
938
955 UFUNCTION(
956 BlueprintCallable,
957 BlueprintPure,
958 Category = "Cesium|Metadata|PropertyTableProperty")
960 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
961 int64 FeatureID);
962
978 UFUNCTION(
979 BlueprintCallable,
980 BlueprintPure,
981 Category = "Cesium|Metadata|PropertyTableProperty")
983 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
984 int64 FeatureID);
985
986 PRAGMA_DISABLE_DEPRECATION_WARNINGS
996 UFUNCTION(
997 BlueprintCallable,
998 BlueprintPure,
999 Meta = (DeprecatedFunction, DeprecatedMessage = "Use GetValue instead."))
1001 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
1002 int64 FeatureID);
1003 PRAGMA_ENABLE_DEPRECATION_WARNINGS
1004
1019 UFUNCTION(
1020 BlueprintCallable,
1021 BlueprintPure,
1022 Category = "Cesium|Metadata|PropertyTableProperty")
1024 UPARAM(ref) const FCesiumPropertyTableProperty& Property,
1025 int64 FeatureID);
1026
1034 UFUNCTION(
1035 BlueprintCallable,
1036 BlueprintPure,
1037 Category = "Cesium|Metadata|PropertyTableProperty")
1038 static bool IsNormalized(UPARAM(ref)
1039 const FCesiumPropertyTableProperty& Property);
1040
1052 UFUNCTION(
1053 BlueprintCallable,
1054 BlueprintPure,
1055 Category = "Cesium|Metadata|PropertyTableProperty")
1057 GetOffset(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1058
1070 UFUNCTION(
1071 BlueprintCallable,
1072 BlueprintPure,
1073 Category = "Cesium|Metadata|PropertyTableProperty")
1075 GetScale(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1076
1090 UFUNCTION(
1091 BlueprintCallable,
1092 BlueprintPure,
1093 Category = "Cesium|Metadata|PropertyTableProperty")
1095 GetMinimumValue(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1096
1110 UFUNCTION(
1111 BlueprintCallable,
1112 BlueprintPure,
1113 Category = "Cesium|Metadata|PropertyTableProperty")
1115 GetMaximumValue(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1116
1129 UFUNCTION(
1130 BlueprintCallable,
1131 BlueprintPure,
1132 Category = "Cesium|Metadata|PropertyTableProperty")
1134 GetNoDataValue(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1135
1146 UFUNCTION(
1147 BlueprintCallable,
1148 BlueprintPure,
1149 Category = "Cesium|Metadata|PropertyTableProperty")
1151 GetDefaultValue(UPARAM(ref) const FCesiumPropertyTableProperty& Property);
1152};
ECesiumMetadataTrueType_DEPRECATED
The type of a metadata property in EXT_feature_metadata.
ECesiumMetadataBlueprintType
The Blueprint type that can losslessly represent values of a given property.
ECesiumPropertyTablePropertyStatus
Reports the status of a FCesiumPropertyTableProperty.
static FCesiumPropertyArray GetArray(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID)
Attempts to retrieve the value for the given feature as a FCesiumPropertyArray.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS FCesiumMetadataValue GetGenericValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID)
Retrieves the value of the property for the given feature.
static FVector3f GetVector3f(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FVector3f &DefaultValue)
Attempts to retrieve the value for the given feature as a FVector3f.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS int64 GetArraySize(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the number of elements in an array of this property.
static int32 GetInteger(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, int32 DefaultValue=0)
Attempts to retrieve the value for the given feature as a signed 32-bit integer.
static FCesiumMetadataValue GetMaximumValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the maximum value of this property.
static FCesiumMetadataValue GetScale(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the scale of this property.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS int64 GetNumberOfFeatures(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the number of values in this property.
static FIntPoint GetIntPoint(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FIntPoint &DefaultValue)
Attempts to retrieve the value for the given feature as a FIntPoint.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS ECesiumMetadataTrueType_DEPRECATED GetTrueType(UPARAM(ref) const FCesiumPropertyTableProperty &Value)
Gets true type of the value.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS int64 GetComponentCount(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the number of elements in an array of this property.
static FMatrix GetMatrix(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FMatrix &DefaultValue)
Attempts to retrieve the value for the given feature as a FMatrix.
static FCesiumMetadataValue GetMinimumValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the minimum value of this property.
static FVector2D GetVector2D(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FVector2D &DefaultValue)
Attempts to retrieve the value for the given feature as a FVector2D.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS ECesiumMetadataBlueprintType GetBlueprintComponentType(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the best-fitting Blueprints type for the elements in this property's array values.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS bool GetBoolean(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, bool DefaultValue=false)
Attempts to retrieve the value for the given feature as a boolean.
static FIntVector GetIntVector(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FIntVector &DefaultValue)
Attempts to retrieve the value for the given feature as a FIntVector.
static FCesiumMetadataValue GetDefaultValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the default value of this property, as defined by its class property.
static double GetFloat64(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, double DefaultValue=0.0)
Attempts to retrieve the value for the given feature as a double-precision floating-point number.
static float GetFloat(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, float DefaultValue=0.0f)
Attempts to retrieve the value for the given feature as a single-precision floating-point number.
static FVector4 GetVector4(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FVector4 &DefaultValue)
Attempts to retrieve the value for the given feature as a FVector4.
static int64 GetInteger64(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, int64 DefaultValue=0)
Attempts to retrieve the value for the given feature as a signed 64-bit integer.
static ECesiumMetadataBlueprintType GetBlueprintType(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the best-fitting type for the property that is accessible from Blueprints.
static uint8 GetByte(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, uint8 DefaultValue=0)
Attempts to retrieve the value for the given feature as an unsigned 8-bit integer.
static FString GetString(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FString &DefaultValue="")
Attempts to retrieve the value for the given feature as a FString.
static bool IsNormalized(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Whether this property is normalized.
static ECesiumPropertyTablePropertyStatus GetPropertyTablePropertyStatus(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the status of the property table property.
static ECesiumMetadataTrueType_DEPRECATED GetTrueComponentType(UPARAM(ref) const FCesiumPropertyTableProperty &Value)
Gets true type of the elements in this array property.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS FCesiumMetadataValue GetRawValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID)
Retrieves the raw value of the property for the given feature.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS int64 GetPropertySize(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the number of values in the property.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS FCesiumMetadataValueType GetValueType(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the type of the metadata value as defined in the EXT_structural_metadata extension.
static FCesiumMetadataValue GetNoDataValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the "no data" value of this property, as defined by its class property.
static ECesiumMetadataBlueprintType GetArrayElementBlueprintType(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the best-fitting Blueprints type for the elements in this property's array values.
static FCesiumMetadataValue GetValue(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID)
Retrieves the value of the property for the given feature.
static FVector GetVector(UPARAM(ref) const FCesiumPropertyTableProperty &Property, int64 FeatureID, const FVector &DefaultValue)
Attempts to retrieve the value for the given feature as a FVector.
static FCesiumMetadataValue GetOffset(UPARAM(ref) const FCesiumPropertyTableProperty &Property)
Gets the offset of this property.
Represents the true value type of a metadata value, akin to the property types in EXT_structural_meta...
A Blueprint-accessible wrapper for a glTF metadata value.
A Blueprint-accessible wrapper for an array property in glTF metadata.
A Blueprint-accessible wrapper for a glTF property table property in EXT_structural_metadata.
FCesiumPropertyTableProperty()
Construct an invalid property with an unknown type.
FCesiumPropertyTableProperty(const CesiumGltf::PropertyTablePropertyView< T, Normalized > &Property)
Construct a wrapper for the property table property view.