| 162 | } |
| 163 | |
| 164 | bool mitk::ContourModelInteractor::IsHovering(const InteractionEvent *interactionEvent) |
| 165 | { |
| 166 | const auto *positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent); |
| 167 | if (!positionEvent) |
| 168 | return false; |
| 169 | |
| 170 | const auto timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); |
| 171 | |
| 172 | auto *contour = dynamic_cast<mitk::ContourModel *>(this->GetDataNode()->GetData()); |
| 173 | |
| 174 | Point3D currentPosition = positionEvent->GetPositionInWorld(); |
| 175 | |
| 176 | bool isHover = false; |
| 177 | this->GetDataNode()->GetBoolProperty("contour.hovering", isHover, positionEvent->GetSender()); |
| 178 | if (contour->IsNearContour(currentPosition, ContourModelInteractor::eps, timeStep)) |
| 179 | { |
| 180 | if (isHover == false) |
| 181 | { |
| 182 | this->GetDataNode()->SetBoolProperty("contour.hovering", true); |
| 183 | mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow()); |
| 184 | } |
| 185 | //check if it would be valid to add a point. |
| 186 | } |
| 187 | else |
| 188 | { |
| 189 | if (isHover == true) |
| 190 | { |
| 191 | this->GetDataNode()->SetBoolProperty("contour.hovering", false); |
| 192 | mitk::RenderingManager::GetInstance()->RequestUpdate(positionEvent->GetSender()->GetRenderWindow()); |
| 193 | } |
| 194 | } |
| 195 | this->m_lastMousePosition = currentPosition; |
| 196 | |
| 197 | return false; |
| 198 | } |
| 199 | |
| 200 | void mitk::ContourModelInteractor::OnMovePoint(StateMachineAction *, InteractionEvent *interactionEvent) |
| 201 | { |
nothing calls this directly
no test coverage detected