DynamicHeatmapDefs.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * @Author: namidame
  3. * @Description: A Heatmap Generation plugin based on the old HeatMapActor, Supports Heightmap, Texture Coordinate Points And Geographic Location Data.
  4. * @Date: 2024/07/27
  5. */
  6. #pragma once
  7. #include "CoreMinimal.h"
  8. #include "Engine/DataTable.h"
  9. #include "DynamicHeatmapDefs.generated.h"
  10. /*
  11. * Defines which method is used to generate the heatmap
  12. *
  13. * GrayScaleTexture: Use a gray scale value texture to create a heatmap.
  14. * TextureCoordPoint: Use a map with texture coordinate point for keys and heat value(0 to 1) to create a heatmap.
  15. * GeographicData: Use a map with geographic point (longitude, latitude) for keys and heat value(0 to 1) to create a heatmap.
  16. * JsonFileData: Use a json file with geographic point (longitude, latitude) and heat value(0 to 1) to create a heatmap.
  17. * HgtFileData: Use a hgt file (a DEM data format file) to create a heatmap.
  18. */
  19. UENUM(BlueprintType)
  20. enum class EDynamicHeatmapType : uint8
  21. {
  22. NONE,
  23. GrayScaleTexture,
  24. TextureCoordPoint,
  25. GeographicData,
  26. JsonFileData,
  27. HgtFileData
  28. };
  29. /*
  30. * Configuration of field names and types of a json content.
  31. */
  32. USTRUCT(BlueprintType)
  33. struct FJsonConfig
  34. {
  35. GENERATED_BODY()
  36. FJsonConfig()
  37. : LngName("lng")
  38. , LatName("lat")
  39. , ValueName("value")
  40. , bStringCoord(false)
  41. , bStringValue(false)
  42. {};
  43. FJsonConfig(const FString& lng, const FString& lat, const FString& vName, bool bStringCoordValue, bool bStringValueValue)
  44. : LngName(lng)
  45. , LatName(lat)
  46. , ValueName(vName)
  47. , bStringCoord(bStringCoordValue)
  48. , bStringValue(bStringValueValue)
  49. {
  50. };
  51. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Json)
  52. FString LngName;
  53. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Json)
  54. FString LatName;
  55. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Json)
  56. FString ValueName;
  57. UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(DisplayName="Is String Coordinate"), Category=Json)
  58. bool bStringCoord;
  59. UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(DisplayName="Is String Heat Value"), Category=Json)
  60. bool bStringValue;
  61. };
  62. /*
  63. * Defines fields in heatmap data table.
  64. */
  65. USTRUCT(BlueprintType)
  66. struct FHeatmapData : public FTableRowBase
  67. {
  68. GENERATED_BODY()
  69. FHeatmapData()
  70. : Longitude(0)
  71. , Latitude(0)
  72. , HeatValue(0)
  73. {};
  74. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Heatmap)
  75. double Longitude;
  76. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Heatmap)
  77. double Latitude;
  78. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Heatmap)
  79. float HeatValue;
  80. };
  81. /*
  82. * Defines data format in TextureCoordPoint method.
  83. */
  84. USTRUCT(BlueprintType)
  85. struct FTextureCoordPointData : public FTableRowBase
  86. {
  87. GENERATED_BODY()
  88. FTextureCoordPointData()
  89. : TextureCoord(FVector2D::Zero())
  90. , HeatValue(0)
  91. {};
  92. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Heatmap)
  93. FVector2D TextureCoord;
  94. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Heatmap)
  95. float HeatValue;
  96. };