PlotCanvas.h 2.48 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 "UObject/NoExportTypes.h"
#include "Engine/Texture2D.h"
#include <memory>
9
#include "SharedEnums.h"
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "PlotCanvas.generated.h"

/**
 * 
 */
UCLASS(Blueprintable, BlueprintType)
class IMMERSIVEANALYTICS_API UPlotCanvas : public UObject
{
	GENERATED_BODY()

public:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Variables)
23
		UTexture2D* DynamicCanvas;
24

25
26
27
28
29
30
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void SetXAxisType(EAxisType Type);

	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void SetYAxisType(EAxisType Type);

Jan Kremer's avatar
Jan Kremer committed
31
32
33
34
35
	UPROPERTY(BlueprintReadOnly)
	EAxisType XAxisType;
	UPROPERTY(BlueprintReadOnly)
	EAxisType YAxisType;

36
37
38
39
40
41
42
43
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void InitializeCanvas(const int32 pixelsH, const int32 pixelsV);
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void UpdateCanvas();
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void ClearCanvas();

	UFUNCTION(BlueprintCallable, Category = DrawingTools)
44
45
46
47
		void DrawScatterPlot();

	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void DrawHistogramPlot(int32 bins);
48

49
50
51
52
53
54
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void DrawParallelCoordinatesPlot();

	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void DrawPixel(const int32 x, const int32 y, const uint8 r, const uint8 g, const uint8 b, const uint8 a);

55
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
56
57
		void DrawLine(int32 x1, int32 y1, int32 x2, int32 y2, const uint8 r, const uint8 g, const uint8 b, const uint8 a);

58
59
60
	UFUNCTION(BlueprintCallable, Category = DrawingTools)
		void DrawRectangle(int32 x1, int32 y1, int32 x2, int32 y2, const uint8 r, const uint8 g, const uint8 b, const uint8 a);

61
62
63
64
65
66
67
68
69
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
		float XMin;
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
		float XMax;
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
		float YMin;
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
		float YMax;

70
private:
71
72
73
74
75
76
	std::unique_ptr<uint8[]> CanvasPixelData;
	int CanvasWidth;
	int CanvasHeight;
	int BytesPerPixel;
	int BufferPitch;
	int BufferSize;
77

78
79
	std::unique_ptr<FUpdateTextureRegion2D> EchoUpdateTextureRegion;
	void SetPixelColor(uint8*& pointer, uint8 red, uint8 green, uint8 blue, uint8 alpha);
80

81
	TArray<float>* XArray;
82
	TArray<float>* YArray;
83
};