17 #ifndef __QmlMitkTransferFunctionCanvas_h
18 #define __QmlMitkTransferFunctionCanvas_h
25 #include <QQuickPaintedItem>
43 m_Histogram = histogram;
75 this->m_Lower = lower;
85 this->m_Upper = upper;
88 virtual void paint(QPainter* painter) = 0;
90 void mousePressEvent( QMouseEvent* mouseEvent )
override;
91 virtual void DoubleClickOnHandle(
int handle) = 0;
93 void mouseMoveEvent( QMouseEvent* mouseEvent )
override;
94 void mouseReleaseEvent( QMouseEvent* mouseEvent )
override;
95 void mouseDoubleClickEvent( QMouseEvent* mouseEvent )
override;
96 void keyPressEvent(QKeyEvent * event)
override;
97 void PaintHistogram(QPainter* painter);
99 virtual int GetNearHandle(
int x,
int y,
unsigned int maxSquaredDistance = 32) = 0;
100 virtual int AddFunctionPoint(
double x,
double val) = 0;
101 virtual void RemoveFunctionPoint(
double x) = 0;
102 virtual void MoveFunctionPoint(
int index, std::pair<double,double> pos) = 0;
103 virtual double GetFunctionX(
int index) = 0;
104 virtual double GetFunctionY(
int index) = 0;
105 virtual int GetFunctionSize() = 0;
110 std::pair<int,int> FunctionToCanvas(std::pair<double,double>);
111 std::pair<double,double> CanvasToFunction(std::pair<int,int>);
115 void SetImmediateUpdate(
bool state);
121 if( x.first < min ) x.first =
min;
122 if( x.first > max ) x.first =
max;
123 if( x.second < 0 ) x.second = 0;
124 if( x.second > 1 ) x.second = 1;
130 if (m_GrabbedHandle != -1)
132 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(x,GetFunctionY(m_GrabbedHandle))));
140 if (m_GrabbedHandle != -1)
142 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle),y)));
std::pair< double, double > ValidateCoord(std::pair< double, double > x)
void SetUpper(double upper)
void SetLower(double lower)
#define MITKQMLITEMS_EXPORT
virtual double GetMax() const =0
Returns the maximum value of the histogram.
mitk::SimpleHistogram * m_Histogram
virtual double GetMin() const =0
Returns the minimal value of the histogram.
Abstract superclass for histograms with double values. Classes which are deriving from this class can...
static RenderingManager * GetInstance()
void SetHistogram(mitk::SimpleHistogram *histogram)
mitk::SimpleHistogram * GetHistogram()
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)