~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/vtk/interactor/ginkgointeractorstyleimage2d.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-10-24 21:28:17 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20131024212817-ej1skb9og09d3ht6
Tags: 3.5.0.1137.31+dfsg-1
New upstream release [October 2013]

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <vtkRenderWindowInteractor.h>
34
34
#include <vtkImageData.h>
35
35
#include <vtkRenderWindow.h>
 
36
#include <wx/timer.h>
36
37
 
37
38
vtkCxxRevisionMacro(GinkgoInteractorStyleImage2D, "$Revision: 752 $");
38
39
vtkStandardNewMacro(GinkgoInteractorStyleImage2D);
40
41
#include <vtkCamera.h>
41
42
#include <vtkRenderer.h>
42
43
 
 
44
class ISTimerZoom: public wxTimer
 
45
{
 
46
public:
 
47
        ISTimerZoom(GinkgoInteractorStyleImage2D* pIS): IS(pIS)
 
48
        {
 
49
        }
 
50
        virtual void Notify()
 
51
        {
 
52
                IS->EndZoom();
 
53
        }
 
54
 
 
55
        GinkgoInteractorStyleImage2D* IS;
 
56
};
 
57
 
43
58
//----------------------------------------------------------------------------
44
59
 
45
60
GinkgoInteractorStyleImage2D::GinkgoInteractorStyleImage2D()
50
65
        this->LevelStep = 0.0;
51
66
        this->WindowStep = 0.0;
52
67
        this->PreviewMode = false;
 
68
        this->TimerZoom = new ISTimerZoom(this);
53
69
}
54
70
 
55
71
//----------------------------------------------------------------------------
56
72
 
57
73
GinkgoInteractorStyleImage2D::~GinkgoInteractorStyleImage2D()
58
74
{
 
75
        if (TimerZoom != NULL) {
 
76
                TimerZoom->Stop();
 
77
                delete TimerZoom;
 
78
        }
59
79
}
60
80
 
61
81
//----------------------------------------------------------------------------
800
820
                        this->EndZSliceMove();
801
821
                        break;
802
822
                case vtkGinkgoImageViewer::ZOOM_WITH_SELECT_INTERACTION :
803
 
                        this->StartDolly();
804
823
                        factor = 10.0 * 0.2 * this->MouseWheelMotionFactor;
805
 
                        //this->Dolly(pow((double)1.1, factor));
806
 
                        this->View->SyncSetZoom(pow((double) 1.1, factor) * this->View->GetZoom());
807
 
                        this->EndDolly();
 
824
                        DoZoom(factor);
808
825
                        break;
809
826
                /*
810
827
                case vtkGinkgoImageViewer::FULL_PAGE_INTERACTION :
812
829
                        break;
813
830
                */
814
831
                case vtkGinkgoImageViewer::ZOOM_INTERACTION :
815
 
                        this->StartDolly();
816
832
                        factor = 10.0 * 0.2 * this->MouseWheelMotionFactor;
817
 
                        //this->Dolly(pow((double)1.1, factor));
818
 
                        this->View->SyncSetZoom(pow((double) 1.1, factor) * this->View->GetZoom());
819
 
                        this->EndDolly();
 
833
                        DoZoom(factor);
820
834
                        break;
821
835
 
822
836
                default:
853
867
                        this->EndZSliceMove();
854
868
                        break;
855
869
                case vtkGinkgoImageViewer::ZOOM_WITH_SELECT_INTERACTION :
856
 
                        this->StartDolly();
857
870
                        factor = 10.0 * -0.2 * this->MouseWheelMotionFactor;
858
 
                        //this->Dolly(pow((double)1.1, factor));
859
 
                        this->View->SyncSetZoom(pow((double) 1.1, factor) * this->View->GetZoom());
860
 
                        this->EndDolly();
 
871
                        DoZoom(factor);
861
872
                        break;
862
873
                        /*
863
874
                case vtkGinkgoImageViewer::FULL_PAGE_INTERACTION :
865
876
                        break;
866
877
                */
867
878
                case vtkGinkgoImageViewer::ZOOM_INTERACTION :
868
 
                        this->StartDolly();
869
879
                        factor = 10.0 * -0.2 * this->MouseWheelMotionFactor;
870
 
                        //this->Dolly(pow((double)1.1, factor));
871
 
                        this->View->SyncSetZoom(pow((double) 1.1, factor) * this->View->GetZoom());
872
 
                        this->EndDolly();
 
880
                        DoZoom(factor);
873
881
                        break;
874
882
 
875
883
                default:
878
886
 
879
887
}
880
888
 
 
889
void GinkgoInteractorStyleImage2D::DoZoom(double factor, bool launchTimer)
 
890
{
 
891
        if (TimerZoom->IsRunning()) {
 
892
                TimerZoom->Stop();
 
893
        }
 
894
 
 
895
        if (this->State != VTKIS_ZOOM) {
 
896
                this->StartZoom();
 
897
        }
 
898
        this->View->SyncSetZoom(pow((double) 1.1, factor) * this->View->GetZoom());
 
899
        GetInteractor()->Render();
 
900
        
 
901
        if (launchTimer) {
 
902
                TimerZoom->Start(600, true);
 
903
        }
 
904
}
 
905
 
881
906
 
882
907