------------------------------------------------------------------------------
| 211 | |
| 212 | //------------------------------------------------------------------------------ |
| 213 | void vtkInteractorStyleUnicam::OnLeftButtonUp() |
| 214 | { |
| 215 | int x = this->Interactor->GetEventPosition()[0]; |
| 216 | int y = this->Interactor->GetEventPosition()[1]; |
| 217 | |
| 218 | this->ButtonDown = vtkInteractorStyleUnicam::NONE; |
| 219 | |
| 220 | if (state == vtkInteractorStyleUnicam::CAM_INT_ROT && this->IsDot) |
| 221 | { |
| 222 | this->FocusSphereRenderer->RemoveActor(this->FocusSphere); |
| 223 | this->IsDot = 0; |
| 224 | } |
| 225 | else if (state == vtkInteractorStyleUnicam::CAM_INT_CHOOSE) |
| 226 | { |
| 227 | if (this->IsDot) |
| 228 | { |
| 229 | this->FocusSphereRenderer->RemoveActor(this->FocusSphere); |
| 230 | this->IsDot = 0; |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | this->FocusSphere->SetPosition(this->DownPt[0], this->DownPt[1], this->DownPt[2]); |
| 235 | |
| 236 | double from[3]; |
| 237 | this->FindPokedRenderer(x, y); |
| 238 | vtkCamera* camera = this->CurrentRenderer->GetActiveCamera(); |
| 239 | camera->GetPosition(from); |
| 240 | |
| 241 | double vec[3]; |
| 242 | vec[0] = this->DownPt[0] - from[0]; |
| 243 | vec[1] = this->DownPt[1] - from[1]; |
| 244 | vec[2] = this->DownPt[2] - from[2]; |
| 245 | |
| 246 | double at_v[4]; |
| 247 | camera->GetDirectionOfProjection(at_v); |
| 248 | vtkMath::Normalize(at_v); |
| 249 | |
| 250 | // calculate scale so focus sphere always is the same size on the screen |
| 251 | double s = 0.02 * vtkMath::Dot(at_v, vec); |
| 252 | |
| 253 | this->FocusSphere->SetScale(s, s, s); |
| 254 | |
| 255 | this->FindPokedRenderer(x, y); |
| 256 | this->FocusSphereRenderer = this->CurrentRenderer; |
| 257 | this->FocusSphereRenderer->AddActor(this->FocusSphere); |
| 258 | |
| 259 | this->IsDot = 1; |
| 260 | } |
| 261 | this->Interactor->Render(); |
| 262 | } |
| 263 | |
| 264 | vtkRenderWindowInteractor* rwi = this->Interactor; |
| 265 | rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate()); |
| 266 | rwi->Render(); |
| 267 | if (this->UseTimers) |
| 268 | { |
| 269 | rwi->DestroyTimer(this->TimerId); |
| 270 | } |
nothing calls this directly
no test coverage detected