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
61 {
62 return Temperature <= 0.0f && Precipitation != 0.0f;
63 }
64
65 FString ToString() const
66 {
67 return FString::Printf(
68 TEXT("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %d, %d"),
69 Temperature,
70 Precipitation,
71 PrecipitationParticleSize,
72 Cloudiness,
73 Fog,
74 FogFalloff,
75 WindIntensity,
76 WindDirection,
77 SnowAmount,
78 TreeSnowiness,
79 Month,
80 Time
81 );
82 }
83
84 FString ToStringHumanReadable() const
85 {
86 return FString::Printf(
87 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"),
88 Temperature,
89 Precipitation,
90 PrecipitationParticleSize,
91 Cloudiness,
92 Fog,
93 FogFalloff,
94 WindIntensity,
95 WindDirection,
96 SnowAmount,
97 TreeSnowiness,
98 Month,
99 Time
100 );
101 }
102};
FString ToStringHumanReadable() const
FString ToString() const