Agrarsense
Static Public Member Functions | List of all members
UCoordinateConversionUtilities Class Reference

#include <CoordinateConversionUtilities.h>

Inheritance diagram for UCoordinateConversionUtilities:
Inheritance graph
[legend]
Collaboration diagram for UCoordinateConversionUtilities:
Collaboration graph
[legend]

Static Public Member Functions

static FGeographicCoordinates UnrealToGeographicCoordinates (AGeoReferencingSystem *GeoReferencingSystem, const FVector &Position)
 
static FVector GeographicToUnrealCoordinates (AGeoReferencingSystem *GeoReferencingSystem, const FGeographicCoordinates &GeographicCoordinates)
 

Detailed Description

A class for coordinate conversion utilities.

Definition at line 18 of file CoordinateConversionUtilities.h.

Member Function Documentation

◆ GeographicToUnrealCoordinates()

FVector UCoordinateConversionUtilities::GeographicToUnrealCoordinates ( AGeoReferencingSystem *  GeoReferencingSystem,
const FGeographicCoordinates &  GeographicCoordinates 
)
static

Converts geographic coordinates (latitude, longitude, and altitude) to a position in Unreal Engine's FVector.

Parameters
GeoReferencingSystemThe GeoReferencingSystem used for coordinate conversions.
GeographicCoordinatesThe geographic coordinates that need to be converted to Unreal's coordinate system.
Returns
The corresponding position as an FVector in Unreal's coordinate system.

Definition at line 23 of file CoordinateConversionUtilities.cpp.

24{
25 FVector UnrealCoordinates;
26
27 if (GeoReferencingSystem)
28 {
29 // Convert FGeographicCoordinates to FVector position
30 FVector ProjectedCoordinates;
31 GeoReferencingSystem->GeographicToProjected(GeographicCoordinates, ProjectedCoordinates);
32 GeoReferencingSystem->ProjectedToEngine(ProjectedCoordinates, UnrealCoordinates);
33 }
34
35 return UnrealCoordinates;
36}

◆ UnrealToGeographicCoordinates()

FGeographicCoordinates UCoordinateConversionUtilities::UnrealToGeographicCoordinates ( AGeoReferencingSystem *  GeoReferencingSystem,
const FVector &  Position 
)
static

Converts a position in Unreal Engine's coordinate system to geographic coordinates (latitude, longitude, and altitude).

Parameters
GeoReferencingSystemThe GeoReferencingSystem used for coordinate conversions.
PositionThe position that needs to be converted to geographic coordinates.
Returns
The corresponding geographic coordinates as FGeographicCoordinates (latitude, longitude, altitude).

Definition at line 8 of file CoordinateConversionUtilities.cpp.

9{
10 FGeographicCoordinates GeographicCoordinates;
11
12 if (GeoReferencingSystem)
13 {
14 // Convert FVector position to FGeographicCoordinates
15 FVector ProjectedCoordinates;
16 GeoReferencingSystem->EngineToProjected(Position, ProjectedCoordinates);
17 GeoReferencingSystem->ProjectedToGeographic(ProjectedCoordinates, GeographicCoordinates);
18 }
19
20 return GeographicCoordinates;
21}

Referenced by ACamera::SaveCameraMetaDataToDisk(), and ATransformSensor::SendGnssDataToROS().


The documentation for this class was generated from the following files: