Cesium for Unreal 2.24.1
Loading...
Searching...
No Matches
CesiumCartographicPolygon.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "CesiumGeospatial/CartographicPolygon.h"
7#include "Components/SplineComponent.h"
8#include "CoreMinimal.h"
9#include "Engine/StaticMesh.h"
10#include "GameFramework/Actor.h"
11#include <vector>
12
13#include "CesiumCartographicPolygon.generated.h"
14
15/**
16 * A coordinate reference system used to interpret position data.
17 */
18UENUM(BlueprintType)
20 /**
21 * Indicates a coordinate reference system expressed in terms of longitude
22 * in degrees (X), latitude in degrees (Y) and height in meters (Z).
23 */
24 LongitudeLatitudeHeight UMETA(DisplayName = "Longitude Latitude Height"),
25 /**
26 * Indicates a Cartesian coordinate reference system expressed in
27 * Earth-centered, Earth-fixed 3D coordinates.
28 */
29 EarthCenteredEarthFixed UMETA(DisplayName = "Earth-Centered, Earth-Fixed"),
30};
31
32/**
33 * A spline-based polygon actor used to rasterize 2D polygons on top of
34 * Cesium 3D Tileset actors.
35 */
36UCLASS(ClassGroup = Cesium, meta = (BlueprintSpawnableComponent))
37class CESIUMRUNTIME_API ACesiumCartographicPolygon : public AActor {
38
39 GENERATED_BODY()
40
41public:
43
44 /**
45 * The polygon.
46 */
47 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Cesium")
48 USplineComponent* Polygon;
49
50 /**
51 * The Globe Anchor Component that precisely ties this Polygon to the Globe.
52 */
53 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Cesium")
55
56 virtual void OnConstruction(const FTransform& Transform) override;
57 /**
58 * Creates and returns a CartographicPolygon object
59 * created from the current spline selection.
60 *
61 * @param worldToTileset The transformation from Unreal world coordinates to
62 * the coordinates of the Cesium3DTileset Actor for which the cartographic
63 * polygon is being created.
64 */
65 CesiumGeospatial::CartographicPolygon
66 CreateCartographicPolygon(const FTransform& worldToTileset) const;
67
68 /**
69 * Sets the spline points from an array of positions in the specified
70 * coordinate reference system.
71 * @param CoordinateReferenceSystem The coordinate reference system in which
72 * the points are expressed.
73 * @param Points The array of points expressed in the specified coordinate
74 * system.
75 */
76 UFUNCTION(BlueprintCallable, Category = "Cesium")
78 const ECesiumCoordinateReferenceSystem CoordinateReferenceSystem,
79 const TArray<FVector>& Points);
80
81 // AActor overrides
82 virtual void PostLoad() override;
83
84#if WITH_EDITOR
85 /**
86 * Set the spline points to a square centered where the editor camera view ray
87 * intersects the ground and sized to fit within the viewport.
88 * @returns Whether the spline points and transform were successfully
89 * recomputed.
90 */
91 bool ResetSplineAndCenterInEditorViewport();
92#endif
93
94protected:
95 virtual void BeginPlay() override;
96
97private:
98 void MakeLinear();
99};
ECesiumCoordinateReferenceSystem
A coordinate reference system used to interpret position data.
@ UMETA
Indicates a coordinate reference system expressed in terms of longitude in degrees (X),...
USplineComponent * Polygon
The polygon.
virtual void BeginPlay() override
virtual void PostLoad() override
void SetPolygonPoints(const ECesiumCoordinateReferenceSystem CoordinateReferenceSystem, const TArray< FVector > &Points)
Sets the spline points from an array of positions in the specified coordinate reference system.
virtual void OnConstruction(const FTransform &Transform) override
CesiumGeospatial::CartographicPolygon CreateCartographicPolygon(const FTransform &worldToTileset) const
Creates and returns a CartographicPolygon object created from the current spline selection.
UCesiumGlobeAnchorComponent * GlobeAnchor
The Globe Anchor Component that precisely ties this Polygon to the Globe.
This component can be added to a movable actor to anchor it to the globe and maintain precise placeme...