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 "WeatherParameters.generated.h"
9
10USTRUCT(BlueprintType)
11struct AGRARSENSE_API FWeatherParameters
12{
13 GENERATED_BODY()
14
15 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "-40.0", ClampMax = "40.0", UIMin = "-40.0", UIMax = "40.0"))
16 float Temperature = 10.0f;
17
18 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
19 float Precipitation = 0.0f;
20
21 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1.0", ClampMax = "5.0", UIMin = "1.0", UIMax = "5.0"))
22 float PrecipitationParticleSize = 1.0f;
23
24 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
25 float Cloudiness = 0.05f;
26
27 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
28 float Fog = 0.0f;
29
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "10.0", UIMin = "0.0", UIMax = "10.0"))
31 float FogFalloff = 0.2f;
32
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "25.0", UIMin = "0.0", UIMax = "25.0"))
34 float WindIntensity = 0.0f;
35
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "360.0", UIMin = "0.0", UIMax = "360.0"))
37 float WindDirection = 15.0f;
38
39 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
40 float SnowAmount = 0.0f;
41
42 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
43 float TreeSnowiness = 0.0f;
44
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1", ClampMax = "12", UIMin = "1", UIMax = "12"))
46 int Month = 7;
47
48 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "24", UIMin = "0.0", UIMax = "24"))
49 int Time = 12;
50
51 bool IsWinterSnowCondition()
52 {
53 return SnowAmount != 0.0f;
54 }
55
57 {
58 return (Month == 12 || Month <= 3);
59 }
60
66 {
67 return Temperature <= 0.0f && Precipitation != 0.0f;
68 }
69
70 FString ToString() const
71 {
72 return FString::Printf(
73 TEXT("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %d, %d"),
74 Temperature,
75 Precipitation,
76 PrecipitationParticleSize,
77 Cloudiness,
78 Fog,
79 FogFalloff,
80 WindIntensity,
81 WindDirection,
82 SnowAmount,
83 TreeSnowiness,
84 Month,
85 Time
86 );
87 }
88
89 FString ToStringHumanReadable() const
90 {
91 return FString::Printf(
92 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"),
93 Temperature,
94 Precipitation,
95 PrecipitationParticleSize,
96 Cloudiness,
97 Fog,
98 FogFalloff,
99 WindIntensity,
100 WindDirection,
101 SnowAmount,
102 TreeSnowiness,
103 Month,
104 Time
105 );
106 }
107};
FString ToStringHumanReadable() const
FString ToString() const