DataComponent.h 4.88 KB
Newer Older
1 2 3 4 5 6 7 8
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "H5Cpp.h"
#include "Runtime/Engine/Classes/Curves/CurveVector.h"
9
#include "SharedEnums.h"
10 11 12 13 14 15 16 17 18 19 20 21
#include "DataComponent.generated.h"
using namespace H5;


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class IMMERSIVEANALYTICS_API UDataComponent : public UActorComponent
{
	GENERATED_BODY()

public:	
	UDataComponent();

Jan Kremer's avatar
Jan Kremer committed
22 23 24 25 26 27 28 29 30 31 32 33
	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
	TArray<FString> GroupNames;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
	TArray<FString> FileNames;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
	FString CurrentGroupName;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
	FString CurrentFileName;

34 35 36 37
	UFUNCTION(BlueprintCallable, Category = HDF5)
		void LoadFile(FString FileName);

	UFUNCTION(BlueprintCallable, Category = HDF5)
Jan Kremer's avatar
Jan Kremer committed
38
		void LoadStep(FString GroupName, bool ResetBrush);
39 40 41 42 43 44 45

	UPROPERTY(Category = Plot3D, EditAnywhere)
		FString FileNameToLoadOnStart;

	UPROPERTY(EditAnywhere, Category = Plot3D)
		UCurveVector* TransferFunction;

Jan Kremer's avatar
Jan Kremer committed
46
	UPROPERTY(Category = Plot3D, EditAnywhere, BlueprintReadWrite)
47 48
		int32 OverrideMaxPointCount;

49 50 51
	UPROPERTY(Category = Plot3D, EditAnywhere, BlueprintReadWrite)
		bool UseFileBounds;

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
	UFUNCTION(BlueprintCallable)
		void AddFilter_Planes(FVector Normal, FVector Location, bool UseTwoPlanes, FVector NormalLeft, FVector LocationLeft, bool Add, bool Rebuild, bool Invert);

	UFUNCTION(BlueprintCallable)
		void AddFilter_ValueRange(EAxisType XType, float XMin, float XMax, EAxisType YType, float YMin, float YMax, bool Add, bool Rebuild, bool UseTwoValues);

	UFUNCTION(BlueprintCallable)
		void AddFilter_Box(FTransform Transform, FVector Extent, bool Add, bool Rebuild);

	UFUNCTION(BlueprintCallable)
		void AddFilter_Sphere(FVector Location, float Radius, bool Add, bool Rebuild);

	UFUNCTION(BlueprintCallable)
		void BrushPoints(TArray<int32> PointIndexes, bool Add, bool Rebuild);

	UFUNCTION(BlueprintCallable)
		void BrushPoint(int32 PointIndex, bool Add);

	UFUNCTION(BlueprintCallable)
		void ResetPoints(bool Rebuild);

	UFUNCTION(BlueprintCallable)
		void InvertPoints(bool Rebuild);

76 77 78
	UFUNCTION(BlueprintCallable)
		void RebuildAll();

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
	// 3d settings

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
		UMaterialInterface* D3_MaterialNontransparent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
		UMaterialInterface* D3_MaterialTransparent;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		FColor D3_BrushColor;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		bool D3_BrushOverridesColor;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		uint8 D3_BrushAlpha;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		uint8 D3_SpriteAlpha;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		bool D3_UseTransparency;

	UPROPERTY(EditAnywhere, Category = Plot3D, BlueprintReadWrite)
		float D3_SpriteSizeFactor;

protected:
	virtual void BeginPlay() override;

private:	
	H5File LoadedFile;
	FColor CalculateColorOfPoint(int32 Index, float Min, float Max);
111
	void SetFileBounds();
Jan Kremer's avatar
Jan Kremer committed
112
	void UpdateDataScaleFactor();
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186

public:
	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		int32 Num;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<bool> IsBrushed;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> X;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> Y;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> Z;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<FVector> PColor;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> U;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> V;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> W;

	UPROPERTY(Category = Plot3D, BlueprintReadWrite)
		TArray<float> Length;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinLength;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxLength;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinX;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxX;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinY;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxY;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinZ;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxZ;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinU;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxU;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinV;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxV;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MinW;

	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float MaxW;

Jan Kremer's avatar
Jan Kremer committed
187 188
	UPROPERTY(Category = Plot3D, BlueprintReadOnly)
		float DataScaleFactor;
189
};