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 #ifndef manualContourBaseControler_h
27 #define manualContourBaseControler_h
29 #include "vtkRenderWindow.h"
31 #include "vtkRenderer.h"
32 #include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
33 #include "vtkCommand.h"
34 #include "vtkPolyData.h"
35 #include "vtkCellArray.h"
36 #include "vtkPolyDataMapper.h"
37 #include "vtkInteractorObserver.h"
38 #include "vtkInteractorStyleImage.h"
39 #include <vtkKochanekSpline.h>
41 #include <vtkCellPicker.h>
44 #include <vtkCamera.h>
45 #include <vtkPolyLine.h>
46 #include <vtkDataSetMapper.h>
47 #include <vtkUnstructuredGrid.h>
50 #include <vtkProperty.h>
52 #include <vtkCellArray.h>
53 #include <vtkRenderer.h>
54 #include <vtkCoordinate.h>
55 #include <vtkTextProperty.h>
56 #include <vtkTextActor.h>
57 #include <vtkProperty2D.h>
58 #include <vtkPointPicker.h>
59 //#include "widgets/UtilVtk3DGeometriSelection.h"
60 #include "UtilVtk3DGeometriSelection.h"
61 //#include "widgets/InteractorStyleMaracas.h"
62 #include "InteractorStyleMaracas.h"
64 #include "creawxVTKRenderWindowInteractor.h"
70 #include "wxVtkBaseView.h"
73 #include "manualContourModel.h"
74 #include "manualViewBaseContour.h"
77 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
79 // ----------------------------------------------------------------------------
81 class creaMaracasVisu_EXPORT manualContourBaseControler: public InteractorStyleMaracas
84 manualContourBaseControler();
85 virtual ~manualContourBaseControler();
87 virtual manualContourBaseControler * Clone();
88 void CopyAttributesTo( manualContourBaseControler *cloneObject );
90 virtual bool OnChar();
91 virtual bool OnMouseMove();
92 virtual bool OnLeftButtonDown();
93 virtual bool OnLeftButtonUp();
94 virtual bool OnLeftDClick();
95 virtual bool OnMiddleButtonDown();
96 virtual bool OnMiddleButtonUp();
97 virtual bool OnRightButtonDown();
98 virtual bool OnRightButtonUp();
100 void SetModelView(manualBaseModel *manContModel, manualViewBaseContour *manViewBaseCont);
101 manualBaseModel * GetManualContourModel();
102 manualViewBaseContour * GetManualViewBaseContour();
105 virtual void MouseClickLeft(int x, int y);
106 virtual void MouseClickRight(int x, int y);
107 virtual void MouseDLeft(int x, int y);
109 virtual void MouseMove(int x, int y);
110 virtual void MouseReleaseLeft(int x, int y);
112 void SetState(int state);
115 virtual void SetEditable( bool condition );
116 bool GetPosibleToMove();
117 void SetPosibleToMove( bool condition );
119 void SetMoving( bool condition );
120 void SetCompleteCreation( bool condition );
121 bool GetIfCompleteCreation ( );
122 void SetKeyBoardMoving( bool condition );
123 bool GetKeyBoardMoving( );
125 void CreateNewManualContour();
126 int GetNumberOfPointsManualContour();
127 int GetNumberOfPointsSplineManualContour();
128 void DeleteContour();
129 virtual void DeleteActualMousePoint(int x, int y );
130 double* GetVectorPointsXManualContour();
131 double* GetVectorPointsYManualContour();
137 // VIRTUAL - Adds a point in an specified position
141 virtual void AddPoint(int x, int y, int z);
142 virtual void InsertPoint(int x, int y, int z);
144 virtual void SetPoint( int id ,int x ,int y ,int z);
145 void SetPointX( int id ,int x );
146 void SetPointY( int id ,int y );
147 void SetPointZ( int id ,int z );
149 void Magnet(int x, int y);
150 virtual void ResetContour();
152 virtual void Configure();
156 // virtual manualContourBaseControler * Clone( manualViewBaseContour * cloneView = NULL, manualContourModel * cloneModel = NULL );
161 // Reference to the contour or element view
162 manualViewBaseContour *_manViewBaseCont;
164 // Reference to the model contour or element model
165 manualBaseModel *_manContModel;
173 bool _keyBoardMoving;
178 #endif // manualContourBaseControler_h