| 100 | } |
| 101 | |
| 102 | void QmitkTransferFunctionCanvas::mouseMoveEvent(QMouseEvent *mouseEvent) |
| 103 | { |
| 104 | if (m_GrabbedHandle != -1) |
| 105 | { |
| 106 | const auto pos = mouseEvent->position().toPoint(); |
| 107 | std::pair<double, double> newPos = this->CanvasToFunction(std::make_pair(pos.x(), pos.y())); |
| 108 | |
| 109 | // X Clamping |
| 110 | { |
| 111 | // Check with predecessor |
| 112 | if (m_GrabbedHandle > 0) |
| 113 | if (newPos.first <= this->GetFunctionX(m_GrabbedHandle - 1)) |
| 114 | newPos.first = this->GetFunctionX(m_GrabbedHandle); |
| 115 | |
| 116 | // Check with successor |
| 117 | if (m_GrabbedHandle < this->GetFunctionSize() - 1) |
| 118 | if (newPos.first >= this->GetFunctionX(m_GrabbedHandle + 1)) |
| 119 | newPos.first = this->GetFunctionX(m_GrabbedHandle); |
| 120 | |
| 121 | // Clamping to histogramm |
| 122 | if (newPos.first < m_Min) |
| 123 | newPos.first = m_Min; |
| 124 | else if (newPos.first > m_Max) |
| 125 | newPos.first = m_Max; |
| 126 | } |
| 127 | |
| 128 | // Y Clamping |
| 129 | { |
| 130 | if (newPos.second < 0.0) |
| 131 | newPos.second = 0.0; |
| 132 | else if (newPos.second > 1.0) |
| 133 | newPos.second = 1.0; |
| 134 | } |
| 135 | |
| 136 | // Move selected point |
| 137 | this->MoveFunctionPoint(m_GrabbedHandle, newPos); |
| 138 | |
| 139 | update(); |
| 140 | |
| 141 | mitk::RenderingManager::GetInstance()->RequestUpdateAll(); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | void QmitkTransferFunctionCanvas::mouseReleaseEvent(QMouseEvent *) |
| 146 | { |
nothing calls this directly
no test coverage detected