MCPcopy Create free account
hub / github.com/Kitware/VTK / OnLeftButtonUp

Method OnLeftButtonUp

Interaction/Style/vtkInteractorStyleUnicam.cxx:213–273  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

211
212//------------------------------------------------------------------------------
213void 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 }

Callers

nothing calls this directly

Calls 15

RemoveActorMethod · 0.80
GetActiveCameraMethod · 0.80
RenderMethod · 0.65
NormalizeFunction · 0.50
DotFunction · 0.50
SetPositionMethod · 0.45
FindPokedRendererMethod · 0.45
GetPositionMethod · 0.45
SetScaleMethod · 0.45
AddActorMethod · 0.45
SetDesiredUpdateRateMethod · 0.45
GetRenderWindowMethod · 0.45

Tested by

no test coverage detected