BFL_Coordinate.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "Kismet/BlueprintFunctionLibrary.h"
  5. #include "BFL_Coordinate.generated.h"
  6. /**
  7. *
  8. */
  9. UCLASS()
  10. class IOC_TEMPLATE_API UBFL_Coordinate : public UBlueprintFunctionLibrary
  11. {
  12. GENERATED_BODY()
  13. public:
  14. /** 将GCJ-02坐标转换为WGS84坐标 */
  15. UFUNCTION(BlueprintCallable, Category = "Geo|Coordinate Conversion", meta = (Keywords = "GCJ02 WGS84"))
  16. static FVector2D GCJ02ToWGS84(double Longitude, double Latitude);
  17. UFUNCTION(BlueprintCallable, Category = "Color")
  18. static FColor HexToColor(FString HexString);
  19. UFUNCTION(BlueprintCallable, Category = "Color")
  20. static FString ColorToHex(FColor Color);
  21. private:
  22. static constexpr double a = 6378245.0; // WGS84长半轴
  23. static constexpr double ee = 0.00669342162296594323; // 偏心率平方
  24. static bool IsOutOfChina(const FVector2D& Coord);
  25. static double TransformLatitude(double lng, double lat);
  26. static double TransformLongitude(double lng, double lat);
  27. };