1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "manualContour3DControler.h"
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 manualContour3DControler::manualContour3DControler()
36 // ----------------------------------------------------------------------------
37 manualContour3DControler::~manualContour3DControler()
40 // ----------------------------------------------------------------------------
41 manualContour3DControler * manualContour3DControler :: Clone() // virtual
43 manualContour3DControler * clone = new manualContour3DControler();
44 CopyAttributesTo(clone);
48 // ---------------------------------------------------------------------------
49 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
52 manualContourControler::CopyAttributesTo(cloneObject);
54 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
57 // ----------------------------------------------------------------------------
58 bool manualContour3DControler::OnLeftButtonDown()
61 wxVTKRenderWindowInteractor *wxVTKiren;
62 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
63 wxVTKiren->GetEventPosition(X,Y);
67 // ----------------------------------------------------------------------------
68 void manualContour3DControler::ResetOrientationPlane()
70 double p[3],rp[3],rn[3];
71 p[0] = this->GetVtkMPRBaseData()->GetX( );
72 p[1] = this->GetVtkMPRBaseData()->GetY( );
73 p[2] = this->GetVtkMPRBaseData()->GetZ( );
74 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
75 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
77 // ----------------------------------------------------------------------------
78 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
80 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
81 int id=manualview3Dcontour->GetIdPoint2(x,y);
82 if ( (GetState()==0) && (id!=-1) )
84 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
86 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
87 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
88 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
89 ResetOrientationPlane();
90 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
94 manualContourControler::MouseClickLeft(x,y);
97 // ----------------------------------------------------------------------------
98 bool manualContour3DControler::OnChar()
101 manualContourControler::OnChar();
102 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
105 ResetOrientationPlane();
106 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
111 // ----------------------------------------------------------------------------
112 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
114 _vtkmprbasedata=vtkmprbasedata;
116 // ----------------------------------------------------------------------------
117 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
119 return _vtkmprbasedata;
122 // ----------------------------------------------------------------------------
123 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
125 manualContourControler::InsertPoint( x, y, z );
126 ResetOrientationPlane();