Commit 72d7c5da authored by Jan Kremer's avatar Jan Kremer

Added option for file wide bounds.

parent 54f628e0
......@@ -20,6 +20,7 @@ UDataComponent::UDataComponent()
D3_BrushColor = FColor(0, 0, 0, 0);
D3_UseTransparency = true;
D3_SpriteSizeFactor = 50;
UseFileBounds = false;
}
......@@ -88,6 +89,11 @@ void UDataComponent::LoadFile(FString FileName)
GroupNames.Emplace(String);
}
if (UseFileBounds)
{
SetFileBounds();
}
IsFirstTime = true;
LoadStep(GroupNames[0], true);
}
......@@ -112,27 +118,30 @@ void UDataComponent::LoadStep(FString GroupName, bool ResetBrush)
}
Length.Empty();
for (int32 i = 0; i < Num; i++)
for (int32 i = 0; i < X.Num(); i++)
{
Length.Emplace(FVector(U[i], V[i], W[i]).Size());
}
int32 MaxIndex, MinIndex;
UKismetMathLibrary::MaxOfFloatArray(Length, MaxIndex, MaxLength);
UKismetMathLibrary::MinOfFloatArray(Length, MinIndex, MinLength);
UKismetMathLibrary::MaxOfFloatArray(X, MaxIndex, MaxX);
UKismetMathLibrary::MinOfFloatArray(X, MinIndex, MinX);
UKismetMathLibrary::MaxOfFloatArray(Y, MaxIndex, MaxY);
UKismetMathLibrary::MinOfFloatArray(Y, MinIndex, MinY);
UKismetMathLibrary::MaxOfFloatArray(Z, MaxIndex, MaxZ);
UKismetMathLibrary::MinOfFloatArray(Z, MinIndex, MinZ);
UKismetMathLibrary::MaxOfFloatArray(U, MaxIndex, MaxU);
UKismetMathLibrary::MinOfFloatArray(U, MinIndex, MinU);
UKismetMathLibrary::MaxOfFloatArray(V, MaxIndex, MaxV);
UKismetMathLibrary::MinOfFloatArray(V, MinIndex, MinV);
UKismetMathLibrary::MaxOfFloatArray(W, MaxIndex, MaxW);
UKismetMathLibrary::MinOfFloatArray(W, MinIndex, MinW);
if (!UseFileBounds)
{
int32 MaxIndex, MinIndex;
UKismetMathLibrary::MaxOfFloatArray(Length, MaxIndex, MaxLength);
UKismetMathLibrary::MinOfFloatArray(Length, MinIndex, MinLength);
UKismetMathLibrary::MaxOfFloatArray(X, MaxIndex, MaxX);
UKismetMathLibrary::MinOfFloatArray(X, MinIndex, MinX);
UKismetMathLibrary::MaxOfFloatArray(Y, MaxIndex, MaxY);
UKismetMathLibrary::MinOfFloatArray(Y, MinIndex, MinY);
UKismetMathLibrary::MaxOfFloatArray(Z, MaxIndex, MaxZ);
UKismetMathLibrary::MinOfFloatArray(Z, MinIndex, MinZ);
UKismetMathLibrary::MaxOfFloatArray(U, MaxIndex, MaxU);
UKismetMathLibrary::MinOfFloatArray(U, MinIndex, MinU);
UKismetMathLibrary::MaxOfFloatArray(V, MaxIndex, MaxV);
UKismetMathLibrary::MinOfFloatArray(V, MinIndex, MinV);
UKismetMathLibrary::MaxOfFloatArray(W, MaxIndex, MaxW);
UKismetMathLibrary::MinOfFloatArray(W, MinIndex, MinW);
}
PColor.Empty();
for (int32 i = 0; i < Num; i++)
{
......@@ -161,6 +170,70 @@ FColor UDataComponent::CalculateColorOfPoint(int32 Index, float Min, float Max)
return Color;
}
void UDataComponent::SetFileBounds()
{
TArray<float> XMinTemp = TArray<float>();
TArray<float> XMaxTemp = TArray<float>();
TArray<float> YMinTemp = TArray<float>();
TArray<float> YMaxTemp = TArray<float>();
TArray<float> ZMinTemp = TArray<float>();
TArray<float> ZMaxTemp = TArray<float>();
TArray<float> UMinTemp = TArray<float>();
TArray<float> UMaxTemp = TArray<float>();
TArray<float> VMinTemp = TArray<float>();
TArray<float> VMaxTemp = TArray<float>();
TArray<float> WMinTemp = TArray<float>();
TArray<float> WMaxTemp = TArray<float>();
TArray<float> LengthTemp = TArray<float>();
for (FString Group : GroupNames)
{
TArray<float> XTemp = TArray<float>();
TArray<float> YTemp = TArray<float>();
TArray<float> ZTemp = TArray<float>();
TArray<float> UTemp = TArray<float>();
TArray<float> VTemp = TArray<float>();
TArray<float> WTemp = TArray<float>();
UHDF5Library::LoadGroup(LoadedFile, Group, XTemp, YTemp, ZTemp, UTemp, VTemp, WTemp);
for (int32 i = 0; i < XTemp.Num(); i++)
{
LengthTemp.Emplace(FVector(UTemp[i], VTemp[i], WTemp[i]).Size());
}
float TempMaxX, TempMaxY, TempMaxZ, TempMaxU, TempMaxV, TempMaxW, TempMinX, TempMinY, TempMinZ, TempMinU, TempMinV, TempMinW;
int32 MaxIndex, MinIndex;
UKismetMathLibrary::MaxOfFloatArray(XTemp, MaxIndex, TempMaxX); XMaxTemp.Emplace(TempMaxX);
UKismetMathLibrary::MinOfFloatArray(XTemp, MinIndex, TempMinX); XMinTemp.Emplace(TempMinX);
UKismetMathLibrary::MaxOfFloatArray(YTemp, MaxIndex, TempMaxY); YMaxTemp.Emplace(TempMaxY);
UKismetMathLibrary::MinOfFloatArray(YTemp, MinIndex, TempMinY); YMinTemp.Emplace(TempMinY);
UKismetMathLibrary::MaxOfFloatArray(ZTemp, MaxIndex, TempMaxZ); ZMaxTemp.Emplace(TempMaxZ);
UKismetMathLibrary::MinOfFloatArray(ZTemp, MinIndex, TempMinZ); ZMinTemp.Emplace(TempMinZ);
UKismetMathLibrary::MaxOfFloatArray(UTemp, MaxIndex, TempMaxU); UMaxTemp.Emplace(TempMaxU);
UKismetMathLibrary::MinOfFloatArray(UTemp, MinIndex, TempMinU); UMinTemp.Emplace(TempMinU);
UKismetMathLibrary::MaxOfFloatArray(VTemp, MaxIndex, TempMaxV); VMaxTemp.Emplace(TempMaxV);
UKismetMathLibrary::MinOfFloatArray(VTemp, MinIndex, TempMinV); VMinTemp.Emplace(TempMinV);
UKismetMathLibrary::MaxOfFloatArray(WTemp, MaxIndex, TempMaxW); WMaxTemp.Emplace(TempMaxW);
UKismetMathLibrary::MinOfFloatArray(WTemp, MinIndex, TempMinW); WMinTemp.Emplace(TempMinW);
}
int32 MaxIndex, MinIndex;
UKismetMathLibrary::MaxOfFloatArray(LengthTemp, MaxIndex, MaxLength);
UKismetMathLibrary::MinOfFloatArray(LengthTemp, MinIndex, MinLength);
UKismetMathLibrary::MaxOfFloatArray(XMaxTemp, MaxIndex, MaxX);
UKismetMathLibrary::MinOfFloatArray(XMinTemp, MinIndex, MinX);
UKismetMathLibrary::MaxOfFloatArray(YMaxTemp, MaxIndex, MaxY);
UKismetMathLibrary::MinOfFloatArray(YMinTemp, MinIndex, MinY);
UKismetMathLibrary::MaxOfFloatArray(ZMaxTemp, MaxIndex, MaxZ);
UKismetMathLibrary::MinOfFloatArray(ZMinTemp, MinIndex, MinZ);
UKismetMathLibrary::MaxOfFloatArray(UMaxTemp, MaxIndex, MaxU);
UKismetMathLibrary::MinOfFloatArray(UMinTemp, MinIndex, MinU);
UKismetMathLibrary::MaxOfFloatArray(VMaxTemp, MaxIndex, MaxV);
UKismetMathLibrary::MinOfFloatArray(VMinTemp, MinIndex, MinV);
UKismetMathLibrary::MaxOfFloatArray(WMaxTemp, MaxIndex, MaxW);
UKismetMathLibrary::MinOfFloatArray(WMinTemp, MinIndex, MinW);
}
void UDataComponent::AddFilter_Planes(FVector NormalRight, FVector LocationRight, bool UseTwoPlanes, FVector NormalLeft, FVector LocationLeft, bool Add, bool Rebuild, bool Invert)
{
TArray<int32> Indexes = TArray<int32>();
......
......@@ -46,6 +46,9 @@ public:
UPROPERTY(Category = Plot3D, EditAnywhere, BlueprintReadWrite)
int32 OverrideMaxPointCount;
UPROPERTY(Category = Plot3D, EditAnywhere, BlueprintReadWrite)
bool UseFileBounds;
UFUNCTION(BlueprintCallable)
void AddFilter_Planes(FVector Normal, FVector Location, bool UseTwoPlanes, FVector NormalLeft, FVector LocationLeft, bool Add, bool Rebuild, bool Invert);
......@@ -103,6 +106,7 @@ private:
H5File LoadedFile;
FColor CalculateColorOfPoint(int32 Index, float Min, float Max);
bool IsFirstTime;
void SetFileBounds();
public:
UPROPERTY(Category = Plot3D, BlueprintReadWrite)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment