]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualContourBaseControler.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26 #ifndef manualContourBaseControler_h
27 #define manualContourBaseControler_h
28
29 #include "vtkRenderWindow.h"
30
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> 
40
41 #include <vtkCellPicker.h> 
42
43
44 #include <vtkCamera.h> 
45 #include <vtkPolyLine.h>
46 #include <vtkDataSetMapper.h>
47 #include <vtkUnstructuredGrid.h>
48
49 #include <vtkActor.h>
50 #include <vtkProperty.h>
51
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"
63
64 #include "wxVTKRenderWindowInteractor.h"
65
66
67 //--
68
69 #include <vector>
70 #include "wxVtkBaseView.h"
71 #include "marTypes.h"
72
73 #include "manualContourModel.h"
74 #include "manualViewBaseContour.h"
75
76
77 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
79 // ----------------------------------------------------------------------------
80
81 class creaMaracasVisu_EXPORT manualContourBaseControler: public InteractorStyleMaracas
82 {
83 public:
84         manualContourBaseControler();
85         virtual ~manualContourBaseControler();
86
87         virtual manualContourBaseControler * Clone();
88         void CopyAttributesTo( manualContourBaseControler *cloneObject );
89
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();
99
100         void    SetModelView(manualBaseModel *manContModel, manualViewBaseContour *manViewBaseCont);
101         manualBaseModel         * GetManualContourModel();
102         manualViewBaseContour   * GetManualViewBaseContour();
103
104
105         virtual void    MouseClickLeft(int x, int y);
106         virtual void    MouseClickRight(int x, int y);
107         virtual void    MouseDLeft(int x, int y);
108
109         virtual void    MouseMove(int x, int y);
110         virtual void    MouseReleaseLeft(int x, int y);
111
112         void    SetState(int state);
113         int             GetState();
114         bool    IsEditable();
115         virtual void    SetEditable(  bool condition  );
116         bool    GetPosibleToMove();
117         void    SetPosibleToMove(  bool condition  );
118         bool    IsMoving();
119         void    SetMoving(  bool condition  );
120         void    SetCompleteCreation( bool condition );
121         bool    GetIfCompleteCreation ( );
122         void    SetKeyBoardMoving( bool condition );
123         bool    GetKeyBoardMoving(  );
124         
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();
132         
133
134         void    SetZ(int z);
135         virtual int             GetZ();
136
137         // VIRTUAL - Adds a point in an specified position
138         // @param x - int
139         // @param y - int
140         // @param z - int
141         virtual void    AddPoint(int x, int y, int z);
142         virtual void    InsertPoint(int x, int y, int z);
143
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 );
148
149                         void    Magnet(int x, int y);
150         virtual void    ResetContour();
151
152         virtual void Configure();
153
154
155 //EED Borrame
156 //      virtual manualContourBaseControler * Clone( manualViewBaseContour * cloneView = NULL, manualContourModel * cloneModel = NULL );
157
158
159 protected:
160         
161         // Reference to the contour or element view 
162         manualViewBaseContour   *_manViewBaseCont;
163
164         // Reference to the model contour or element model 
165         manualBaseModel         *_manContModel;
166
167         int                                             _z;
168         int                                             _state;
169         bool                                    _editable;      
170         bool                                    _posibleToMove;
171         bool                                    _moving;
172         bool                                    _created;
173         bool                                    _keyBoardMoving;
174                 
175 }; 
176
177
178 #endif // manualContourBaseControler_h