ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkPVTrackballZoomToMouse.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkPVTrackballZoomToMouse.cxx
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
16 
17 #include "vtkCamera.h"
18 #include "vtkObjectFactory.h"
19 #include "vtkPVInteractorStyle.h"
20 #include "vtkRenderWindow.h"
21 #include "vtkRenderWindowInteractor.h"
22 #include "vtkRenderer.h"
23 
25 
26 //-------------------------------------------------------------------------
28 {
29  this->ZoomPosition[0] = 0;
30  this->ZoomPosition[1] = 0;
31 }
32 
33 //-------------------------------------------------------------------------
35 {
36 }
37 
38 //-------------------------------------------------------------------------
40  int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* rwi)
41 {
42  this->Superclass::OnButtonDown(x, y, ren, rwi);
43  rwi->GetEventPosition(this->ZoomPosition);
44 }
45 
46 //-------------------------------------------------------------------------
48  int vtkNotUsed(x), int y, vtkRenderer* ren, vtkRenderWindowInteractor* rwi)
49 {
50  double dy = rwi->GetLastEventPosition()[1] - y;
51  // The camera's Dolly function scales by the distance already, so we need
52  // to un-scale by it here so the zoom is not too fast or slow.
53  double k = dy * this->ZoomScale / ren->GetActiveCamera()->GetDistance();
55  rwi->Render();
56 }
57 
58 //-------------------------------------------------------------------------
59 void vtkPVTrackballZoomToMouse::PrintSelf(ostream& os, vtkIndent indent)
60 {
61  this->Superclass::PrintSelf(os, indent);
62 
63  os << indent << "ZoomPosition: " << this->ZoomPosition[0] << " " << this->ZoomPosition[1] << endl;
64 }
static void DollyToPosition(double fact, int *position, vtkRenderer *renderer)
void OnMouseMove(int x, int y, vtkRenderer *ren, vtkRenderWindowInteractor *rwi) override
void PrintSelf(ostream &os, vtkIndent indent) override
void OnButtonDown(int x, int y, vtkRenderer *ren, vtkRenderWindowInteractor *rwi) override
normal_z y
normal_z x
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
vtkStandardNewMacro(vtkPVTrackballZoomToMouse)