6#include "CesiumGeospatial/LocalHorizontalCoordinateSystem.h"
8#include "Delegates/Delegate.h"
9#include "GameFramework/Actor.h"
12#include "CesiumGeoreference.generated.h"
14class APlayerCameraManager;
15class FLevelCollectionModel;
29DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(
73 meta = (WorldContext =
"WorldContextObject"))
91 UFUNCTION(BlueprintCallable, Category =
"Cesium")
98 UPROPERTY(BlueprintAssignable, Category =
"Cesium")
105 UPROPERTY(BlueprintAssignable, Category =
"Cesium")
108#pragma region Properties
122 meta = (AllowPrivateAccess))
142 meta = (AllowPrivateAccess))
159 "OriginPlacement==EOriginPlacement::CartographicOrigin",
162 double OriginLatitude = 39.736401;
178 "OriginPlacement==EOriginPlacement::CartographicOrigin",
181 double OriginLongitude = -105.25737;
197 "OriginPlacement==EOriginPlacement::CartographicOrigin"))
198 double OriginHeight = 2250.0;
212 Meta = (AllowPrivateAccess, UIMin = 0.000001, UIMax = 100.0))
213 double Scale = 100.0;
225 "Add a CesiumOriginShiftComponent to the appropriate Actor instead."))
226 APlayerCameraManager* SubLevelCamera_DEPRECATED =
nullptr;
234 Category =
"Cesium|Sub-levels",
237 meta = (AllowPrivateAccess))
240#if WITH_EDITORONLY_DATA
246 Category =
"Cesium|Sub-levels",
249 BlueprintGetter = GetShowLoadRadii,
250 BlueprintSetter = SetShowLoadRadii,
251 meta = (AllowPrivateAccess))
252 bool ShowLoadRadii =
true;
257#pragma region PropertyAccessors
266 UFUNCTION(BlueprintPure, Category =
"Cesium")
276 UFUNCTION(BlueprintCallable, Category =
"Cesium")
278 const FVector& TargetLongitudeLatitudeHeight);
285 UFUNCTION(BlueprintPure, Category =
"Cesium")
298 UFUNCTION(BlueprintCallable, Category =
"Cesium")
300 const FVector& TargetEarthCenteredEarthFixed);
314 UFUNCTION(BlueprintGetter)
329 UFUNCTION(BlueprintSetter)
336 UFUNCTION(BlueprintGetter)
343 UFUNCTION(BlueprintSetter)
350 UFUNCTION(BlueprintGetter)
357 UFUNCTION(BlueprintSetter)
364 UFUNCTION(BlueprintGetter)
371 UFUNCTION(BlueprintSetter)
379 UFUNCTION(BlueprintGetter)
387 UFUNCTION(BlueprintSetter)
395 "Cesium For Unreal v2.0",
396 "Add a CesiumOriginShiftComponent to the appropriate Actor instead.")
397 UFUNCTION(BlueprintGetter)
405 "Cesium For Unreal v2.0",
406 "Add a CesiumOriginShiftComponent to the appropriate Actor instead.")
407 UFUNCTION(BlueprintSetter)
414 UFUNCTION(BlueprintGetter)
416 return this->SubLevelSwitcher;
423 UFUNCTION(BlueprintCallable, BlueprintGetter, Category =
"Cesium")
432 UFUNCTION(BlueprintSetter, Category =
"Cesium")
440 UFUNCTION(BlueprintGetter)
441 bool GetShowLoadRadii()
const;
447 UFUNCTION(BlueprintSetter)
448 void SetShowLoadRadii(
bool NewValue);
453#pragma region Transformation Functions
467 meta = (ReturnDisplayName =
"UnrealPosition"))
469 const FVector& LongitudeLatitudeHeight) const;
482 meta = (ReturnDisplayName =
"LongitudeLatitudeHeight"))
484 const FVector& UnrealPosition) const;
497 meta = (ReturnDisplayName =
"UnrealPosition"))
499 const FVector& EarthCenteredEarthFixedPosition) const;
511 meta = (ReturnDisplayName =
"EarthCenteredEarthFixedPosition"))
513 const FVector& UnrealPosition) const;
526 meta = (ReturnDisplayName =
"UnrealDirection"))
528 const FVector& EarthCenteredEarthFixedDirection) const;
541 meta = (ReturnDisplayName =
"EarthCenteredEarthFixedPosition"))
543 const FVector& UnrealDirection) const;
565 meta = (ReturnDisplayName =
"EastSouthUpRotator"))
567 const FRotator& UnrealRotator,
568 const FVector& UnrealLocation) const;
590 meta = (ReturnDisplayName =
"UnrealRotator"))
592 const FRotator& EastSouthUpRotator,
593 const FVector& UnrealLocation) const;
606 meta = (ReturnDisplayName =
"UnrealToEarthCenteredEarthFixedMatrix"))
620 meta = (ReturnDisplayName =
"EarthCenteredEarthFixedToUnrealMatrix"))
642 meta = (ReturnDisplayName =
"EastSouthUpToUnrealMatrix"))
667 meta = (ReturnDisplayName =
"EastSouthUpToUnrealMatrix"))
670 const FVector& EarthCenteredEarthFixedPosition) const;
694 meta = (ReturnDisplayName =
"UnrealToEastSouthUpMatrix"))
700#pragma region Editor Support
715 UFUNCTION(Category =
"Cesium")
716 void PlaceGeoreferenceOriginHere();
728 UFUNCTION(Category =
"Cesium")
729 void CreateSubLevelHere();
735 UPROPERTY(VisibleAnywhere, Category =
"Cesium")
736 USceneComponent* Root;
746 void _showSubLevelLoadRadii()
const;
751#pragma region Unreal Lifecycle
755 virtual void Tick(
float DeltaTime)
override;
763 PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
override;
768#pragma region Obsolete
772 "Cesium For Unreal v2.0",
773 "Use transformation functions on ACesiumGeoreference and UCesiumEllipsoid instead.")
777 PRAGMA_DISABLE_DEPRECATION_WARNINGS
782 "Create sub-levels by adding a UCesiumSubLevelComponent to an ALevelInstance Actor."))
784 PRAGMA_ENABLE_DEPRECATION_WARNINGS
787 void _createSubLevelsFromWorldComposition();
801 "Use LongitudeLatitudeHeightToEllipsoidCenteredEllipsoidFixed on UCesiumEllipsoid instead."))
802 FVector TransformLongitudeLatitudeHeightToEcef(
803 const FVector& LongitudeLatitudeHeight) const;
816 "Use EllipsoidCenteredEllipsoidFixedToLongitudeLatitudeHeight on UCesiumEllipsoid instead."))
817 FVector TransformEcefToLongitudeLatitudeHeight(const FVector& Ecef) const;
829 "Use EastNorthUpToEllipsoidCenteredEllipsoidFixed on UCesiumEllipsoid instead."))
830 FMatrix ComputeEastNorthUpToEcef(const FVector& Ecef) const;
835#pragma region Implementation Details
842 return this->_coordinateSystem;
849 void UpdateGeoreference();
855 static FName DEFAULT_GEOREFERENCE_TAG;
864 void _updateCoordinateSystem();
@ Actor
Uses the relative rotation of the root component of the Actor to which the CesiumFlyToComponent is at...
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGeoreferenceUpdated)
The delegate for the ACesiumGeoreference::OnGeoreferenceUpdated, which is triggered from UpdateGeoref...
EOriginPlacement
An enumeration of the possible strategies for placing the origin of a Georeference.
FMatrix ComputeEastSouthUpAtEarthCenteredEarthFixedPositionToUnrealTransformation(const FVector &EarthCenteredEarthFixedPosition) const
Computes the matrix that transforms from an East-South-Up frame centered at a given location to the U...
virtual void PostLoad() override
FRotator TransformEastSouthUpRotatorToUnreal(const FRotator &EastSouthUpRotator, const FVector &UnrealLocation) const
Given a Rotator that transforms an object into the East-South-Up frame centered at a given location,...
UCesiumSubLevelSwitcherComponent * GetSubLevelSwitcher() const
Gets the component that allows switching between different sub-levels registered with this georeferen...
double GetOriginLatitude() const
Gets the latitude of the custom origin placement in degrees, in the range [-90, 90].
friend class FCesiumGeoreferenceCustomization
static const double kMinimumScale
The minimum allowed value for the Scale property, 1e-6.
FVector TransformUnrealPositionToLongitudeLatitudeHeight(const FVector &UnrealPosition) const
Transforms a position in Unreal coordinates into longitude in degrees (x), latitude in degrees (y),...
virtual void BeginPlay() override
void SetOriginLongitude(double NewValue)
Sets the longitude of the custom origin placement in degrees, in the range [-180, 180].
double GetOriginHeight() const
Gets the height of the custom origin placement in meters above the ellipsoid.
double GetScale() const
Gets the percentage scale of the globe in the Unreal world.
EOriginPlacement GetOriginPlacement() const
Gets the placement of this Actor's origin (coordinate 0,0,0) within the tileset.
void SetOriginLatitude(double NewValue)
Sets the latitude of the custom origin placement in degrees, in the range [-90, 90].
void SetOriginHeight(double NewValue)
Sets the height of the custom origin placement in meters above the ellipsoid.
FGeoreferenceUpdated OnGeoreferenceUpdated
A delegate that will be called whenever the Georeference is modified in a way that affects its comput...
void SetOriginPlacement(EOriginPlacement NewValue)
Sets the placement of this Actor's origin (coordinate 0,0,0) within the tileset.
void SetEllipsoid(UCesiumEllipsoid *NewEllipsoid)
Sets the UCesiumEllipsoid used by this georeference.
static ACesiumGeoreference * GetDefaultGeoreference(const UObject *WorldContextObject)
Finds and returns a CesiumGeoreference in the world.
FVector TransformUnrealDirectionToEarthCenteredEarthFixed(const FVector &UnrealDirection) const
Transforms the given direction vector from Unreal coordinates to Earth-Centered, Earth-Fixed (ECEF) c...
void SetOriginEarthCenteredEarthFixed(const FVector &TargetEarthCenteredEarthFixed)
This aligns the specified Earth-Centered, Earth-Fixed (ECEF) coordinates to the Unreal origin.
FVector TransformUnrealPositionToEarthCenteredEarthFixed(const FVector &UnrealPosition) const
Transforms the given position from Unreal coordinates to Earth-Centered, Earth-Fixed (ECEF).
static ACesiumGeoreference * GetDefaultGeoreferenceForActor(AActor *Actor)
Finds and returns the CesiumGeoreference suitable for use with the given Actor.
FMatrix ComputeUnrealToEastSouthUpTransformation(const FVector &UnrealLocation) const
Computes the matrix that transforms from the Unreal frame to an East-South-Up frame centered at a giv...
double GetOriginLongitude() const
Gets the longitude of the custom origin placement in degrees, in the range [-180, 180].
void SetOriginLongitudeLatitudeHeight(const FVector &TargetLongitudeLatitudeHeight)
This aligns the specified longitude in degrees (X), latitude in degrees (Y), and height above the ell...
FVector GetOriginEarthCenteredEarthFixed() const
Returns the georeference origin position as an FVector in Earth-Centerd, Earth-Fixed (ECEF) coordinat...
FVector TransformEarthCenteredEarthFixedPositionToUnreal(const FVector &EarthCenteredEarthFixedPosition) const
Transforms a position in Earth-Centered, Earth-Fixed (ECEF) coordinates into Unreal coordinates.
FMatrix ComputeUnrealToEarthCenteredEarthFixedTransformation() const
Computes the transformation matrix from the Unreal coordinate system to the Earth-Centered,...
virtual void OnConstruction(const FTransform &Transform) override
GeoTransforms GetGeoTransforms() const noexcept
void SetScale(double NewValue)
Sets the percentage scale of the globe in the Unreal world.
FMatrix ComputeEastSouthUpToUnrealTransformation(const FVector &UnrealLocation) const
Computes the matrix that transforms from an East-South-Up frame centered at a given location to the U...
FGeoreferenceEllipsoidChanged OnEllipsoidChanged
An event that will be called whenever the georeference's ellipsoid has been modified.
void SetSubLevelCamera(APlayerCameraManager *NewValue)
Sets the camera to use to determine which sub-level is closest, so that one can be activated and all ...
FMatrix ComputeEarthCenteredEarthFixedToUnrealTransformation() const
Computes the transformation matrix from the Earth-Centered, Earth-Fixed (ECEF) coordinate system to t...
const CesiumGeospatial::LocalHorizontalCoordinateSystem & GetCoordinateSystem() const noexcept
FVector TransformLongitudeLatitudeHeightPositionToUnreal(const FVector &LongitudeLatitudeHeight) const
Transforms the given longitude in degrees (x), latitude in degrees (y), and height above the ellipsoi...
FVector TransformEarthCenteredEarthFixedDirectionToUnreal(const FVector &EarthCenteredEarthFixedDirection) const
Transforms a direction vector in Earth-Centered, Earth-Fixed (ECEF) coordinates into Unreal coordinat...
FVector GetOriginLongitudeLatitudeHeight() const
Returns the georeference origin position as an FVector where X is longitude (degrees),...
virtual void Serialize(FArchive &Ar) override
FRotator TransformUnrealRotatorToEastSouthUp(const FRotator &UnrealRotator, const FVector &UnrealLocation) const
Given a Rotator that transforms an object into the Unreal coordinate system, returns a new Rotator th...
UCesiumEllipsoid * GetEllipsoid() const
Returns a pointer to the UCesiumEllipsoid currently being used by this georeference.
virtual void Tick(float DeltaTime) override
APlayerCameraManager * GetSubLevelCamera() const
Gets the camera to use to determine which sub-level is closest, so that one can be activated and all ...
virtual bool ShouldTickIfViewportsOnly() const override
The event that triggers when a georeference's ellipsoid is changed.
Manages the asynchronous switching between sub-levels, making sure that a previous sub-level is hidde...