1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::manualConnectorContourController
37 #include "manualConnectorContourController.h"
43 //=========================================================================
44 manualConnectorContourController::manualConnectorContourController()
48 //=========================================================================
49 manualConnectorContourController::~manualConnectorContourController()
52 //=========================================================================
54 void manualConnectorContourController::MouseClickRight(int x, int y)
56 SetCompleteCreation( true );
57 SetKeyBoardMoving( false );
58 GetManualContourModel()->SetCloseContour(false);
61 SetPosibleToMove( false );
70 //=========================================================================
71 void manualConnectorContourController::MouseClickLeft(int x, int y){
75 int size= GetManualViewBaseContour()->GetNumberOfPoints();
77 // Insert a Control Point with shift+ClickLeft
78 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
81 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
87 // Start to Insert Control Points with ClickLeft (Empty contour)
88 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
92 GetManualContourModel()->SetCloseContour(false);
96 // RaC Just create 2 points
97 if ((GetState()==1) && (_easyCreation==true) && GetNumberOfPointsManualContour()==2)
101 SetCompleteCreation( true );
102 SetKeyBoardMoving( false );
103 GetManualContourModel()->SetCloseContour(false);
105 SetEditable( false );
106 SetPosibleToMove( false );
110 // Continue to Insert Control Points with ClickLeft (After being empty the contour)
111 if ((GetState()==1) && (_easyCreation==true) )
115 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
118 // Insert Control Points IF Contour si Selected
119 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
123 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
126 // Chose id of Control Point to be move
127 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
130 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
131 if(_bakIdPoint!=0 && _bakIdPoint!=GetManualViewBaseContour()->GetNumberOfPoints()-1)
136 // If nothing selected _state=7
137 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
140 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
144 SetPosibleToMove( true );
145 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
148 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
152 GetManualViewBaseContour()->InitMove(x,y,z);
157 GetManualViewBaseContour()->Refresh();
160 //=========================================================================
162 } // EO namespace bbtk