13 #ifndef QmitkTransferFunctionCanvas_h
14 #define QmitkTransferFunctionCanvas_h
48 void SetLower(
double lower) { this->m_Lower = lower; }
50 void SetUpper(
double upper) { this->m_Upper = upper; }
51 void mousePressEvent(QMouseEvent *mouseEvent)
override;
52 void paintEvent(QPaintEvent *e)
override;
53 virtual void DoubleClickOnHandle(
int handle) = 0;
55 void mouseMoveEvent(QMouseEvent *mouseEvent)
override;
56 void mouseReleaseEvent(QMouseEvent *mouseEvent)
override;
57 void mouseDoubleClickEvent(QMouseEvent *mouseEvent)
override;
58 void PaintHistogram(QPainter &p);
60 virtual int GetNearHandle(
int x,
int y,
unsigned int maxSquaredDistance = 32) = 0;
61 virtual int AddFunctionPoint(
double x,
double val) = 0;
62 virtual void RemoveFunctionPoint(
double x) = 0;
63 virtual void MoveFunctionPoint(
int index, std::pair<double, double> pos) = 0;
64 virtual double GetFunctionX(
int index) = 0;
65 virtual double GetFunctionY(
int index) = 0;
66 virtual int GetFunctionSize() = 0;
71 std::pair<int, int> FunctionToCanvas(std::pair<double, double>);
72 std::pair<double, double> CanvasToFunction(std::pair<int, int>);
76 void keyPressEvent(QKeyEvent *e)
override;
78 void SetImmediateUpdate(
bool state);
82 double max = m_Histogram->
GetMax();
83 double min = m_Histogram->
GetMin();
97 if (m_GrabbedHandle != -1)
99 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(x, GetFunctionY(m_GrabbedHandle))));
107 if (m_GrabbedHandle != -1)
109 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle), y)));
119 m_LineEditAvailable =
true;