17 #ifndef QMITKTRANSFERFUNCTIONCANVAS_H_INCLUDED
18 #define QMITKTRANSFERFUNCTIONCANVAS_H_INCLUDED
52 void SetLower(
double lower) { this->m_Lower = lower; }
54 void SetUpper(
double upper) { this->m_Upper = upper; }
55 void mousePressEvent(QMouseEvent *mouseEvent)
override;
56 virtual void paintEvent(QPaintEvent *e)
override;
57 virtual void DoubleClickOnHandle(
int handle) = 0;
59 void mouseMoveEvent(QMouseEvent *mouseEvent)
override;
60 void mouseReleaseEvent(QMouseEvent *mouseEvent)
override;
61 void mouseDoubleClickEvent(QMouseEvent *mouseEvent)
override;
62 void PaintHistogram(QPainter &p);
64 virtual int GetNearHandle(
int x,
int y,
unsigned int maxSquaredDistance = 32) = 0;
65 virtual int AddFunctionPoint(
double x,
double val) = 0;
66 virtual void RemoveFunctionPoint(
double x) = 0;
67 virtual void MoveFunctionPoint(
int index, std::pair<double, double> pos) = 0;
68 virtual double GetFunctionX(
int index) = 0;
69 virtual double GetFunctionY(
int index) = 0;
70 virtual int GetFunctionSize() = 0;
75 std::pair<int, int> FunctionToCanvas(std::pair<double, double>);
76 std::pair<double, double> CanvasToFunction(std::pair<int, int>);
80 void keyPressEvent(QKeyEvent *e)
override;
82 void SetImmediateUpdate(
bool state);
101 if (m_GrabbedHandle != -1)
103 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(x, GetFunctionY(m_GrabbedHandle))));
111 if (m_GrabbedHandle != -1)
113 this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle), y)));
123 m_LineEditAvailable =
true;
virtual double GetMax() const =0
Returns the maximum value of the histogram.
void SetLower(double lower)
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()
std::pair< double, double > ValidateCoord(std::pair< double, double > x)
mitk::SimpleHistogram * m_Histogram
void SetQLineEdits(QLineEdit *xEdit, QLineEdit *yEdit)
mitk::SimpleHistogram * GetHistogram()
void SetUpper(double upper)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
void SetHistogram(mitk::SimpleHistogram *histogram)