Agrarsense
WeatherParameters.h
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "Math/Color.h"
9
10#include "WeatherParameters.generated.h"
11
12USTRUCT(BlueprintType)
13struct AGRARSENSE_API FWeatherParameters
14{
15 GENERATED_BODY()
16
17 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "-40.0", ClampMax = "40.0", UIMin = "-40.0", UIMax = "40.0"))
18 float Temperature = 10.0f;
19
20 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
21 float Precipitation = 0.0f;
22
23 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1.0", ClampMax = "5.0", UIMin = "1.0", UIMax = "5.0"))
24 float PrecipitationParticleSize = 1.0f;
25
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
27 float Cloudiness = 0.05f;
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
30 float Fog = 0.0f;
31
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "10.0", UIMin = "0.0", UIMax = "10.0"))
33 float FogFalloff = 0.2f;
34
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "25.0", UIMin = "0.0", UIMax = "25.0"))
36 float WindIntensity = 0.0f;
37
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "360.0", UIMin = "0.0", UIMax = "360.0"))
39 float WindDirection = 15.0f;
40
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
42 float SnowAmount = 0.0f;
43
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
45 float TreeSnowiness = 0.0f;
46
47 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1", ClampMax = "12", UIMin = "1", UIMax = "12"))
48 int Month = 7;
49
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "24", UIMin = "0.0", UIMax = "24"))
51 int Time = 12;
52
53 /*
54 * Should Tree leaves be hidden (underground).
55 */
56 UPROPERTY(EditAnywhere, BlueprintReadWrite)
57 bool HideTreeLeaves = false;
58
59 /*
60 * Should Tree branches be hidden (underground).
61 */
62 UPROPERTY(EditAnywhere, BlueprintReadWrite)
63 bool HideTreeBranches = false;
64
65 /*
66 * Use manual leaf colors or change tree leaf colors based on the month.
67 * If any color is (0.0f, 0.0f, 0.0f, 0.0f), it will be ignored.
68 */
69 UPROPERTY(EditAnywhere, BlueprintReadWrite)
70 bool UseManualLeafColors = false;
71
72 UPROPERTY(EditAnywhere, BlueprintReadWrite)
73 FLinearColor BirchLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
74
75 UPROPERTY(EditAnywhere, BlueprintReadWrite)
76 FLinearColor PineLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
77
78 UPROPERTY(EditAnywhere, BlueprintReadWrite)
79 FLinearColor SpruceLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
80
81 UPROPERTY(EditAnywhere, BlueprintReadWrite)
82 FLinearColor AlderLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
83
84 bool IsWinterSnowCondition()
85 {
86 return SnowAmount != 0.0f;
87 }
88
90 {
91 return (Month == 12 || Month <= 3);
92 }
93
99 {
100 return Temperature <= 0.0f && Precipitation != 0.0f;
101 }
102
103 FString ToString() const
104 {
105 return FString::Printf(
106 TEXT("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %d, %d"),
107 Temperature,
108 Precipitation,
109 PrecipitationParticleSize,
110 Cloudiness,
111 Fog,
112 FogFalloff,
113 WindIntensity,
114 WindDirection,
115 SnowAmount,
116 TreeSnowiness,
117 Month,
118 Time
119 );
120 }
121
122 FString ToStringHumanReadable() const
123 {
124 return FString::Printf(
125 TEXT("Temperature: %.2f, Precipitation: %.2f, Precipitation Particle Size: %.2f, Cloudiness: %.2f, Fog: %.2f, Fog Falloff: %.2f, Wind Intensity: %.2f, Wind Direction: %.2f, Snow Amount: %.2f, Tree Snowiness: %.2f, Month: %d, Time: %d"),
126 Temperature,
127 Precipitation,
128 PrecipitationParticleSize,
129 Cloudiness,
130 Fog,
131 FogFalloff,
132 WindIntensity,
133 WindDirection,
134 SnowAmount,
135 TreeSnowiness,
136 Month,
137 Time
138 );
139 }
140};
FString ToStringHumanReadable() const
FString ToString() const