]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuShowNPoints.h
avoid warnings / fix typo / reindent
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuShowNPoints.h
1 #ifdef _USE_WXWIDGETS_
2 #ifndef __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
3 #define __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
4 #include "bbtkWxBlackBox.h"
5
6
7 #include "vtkActor.h"
8 #include "vtkSphereSource.h"
9 #include "vtkImageData.h"
10 #include "vtkRenderer.h"
11 #include "vtkTextActor3D.h"
12
13 namespace bbcreaMaracasVisu
14 {
15
16   class ShowNPoints;
17
18   //--------------------------------------------------------------------------
19   class WidgetShowNPoints : public wxPanel
20   {
21   public:
22           WidgetShowNPoints( wxWindow *parent,  ShowNPoints *box);
23           ~WidgetShowNPoints(); 
24           void OnAddPoint(wxCommandEvent &event);   
25           void OnRenamePoint(wxCommandEvent& event);
26           void OnErasePoint(wxCommandEvent& event);
27           void OnEraseLastPoint(wxCommandEvent &event);   
28           void OnDeleteAllPoints(wxCommandEvent &event);   
29           void OnSavePoints(wxCommandEvent &event);   
30           void OnLoadPoints(wxCommandEvent &event);
31
32           void UpdatePoints(wxCommandEvent &event);
33           
34           void SetPoint(std::vector<int> ppoint);
35           void SetColour(std::vector<double> colour);
36           void SetOpacity(double opacity);
37           void SetRadio(double radio);
38           void SetImage(vtkImageData *image);
39           void SetRenderer(vtkRenderer *renderer);
40           std::vector<int> GetLstPointsX();
41           std::vector<int> GetLstPointsY();
42           std::vector<int> GetLstPointsZ();
43           std::vector<std::string> GetLstLabels();
44
45   private:
46
47           void                  AddPoint(int x, int y, int z, std::string label);
48           std::string           CleanSpaces(std::string ss);
49           int                   GetNearestPoint();
50           void                  ErasePoint(int id);
51           void                  SetOutputBox();
52
53           ShowNPoints                   *mbbShowNPoints;
54           vtkRenderer                   *renderer;
55           std::vector<int>              lstPointsX;
56           std::vector<int>              lstPointsY;
57           std::vector<int>              lstPointsZ;
58           std::vector<std::string>      lstLabels;
59           std::vector<vtkActor*>        lstActorsSphere;//NTU changed from prop3D to Actor
60           std::vector<vtkTextActor3D*>  lstActorsText;
61
62           //NTU: For updating points
63
64           std::vector<vtkSphereSource*> lstSourceSphere;
65
66           std::vector<int>      mpoint;
67           vtkImageData          *mimage;
68           std::vector<double>   mcolour;
69           double                mopacity;
70           double                mradio;
71           wxStaticText          *askPointLabel;
72           wxTextCtrl            *textCtrl;
73           wxStaticText          *txtNrPoints;
74           wxSlider              *sdrOpacity;
75           wxSlider              *sdrRadio;
76   };
77
78 class /*BBTK_EXPORT*/ ShowNPoints
79  : 
80    public bbtk::WxBlackBox
81 {
82   BBTK_BLACK_BOX_INTERFACE(ShowNPoints,bbtk::WxBlackBox);
83   BBTK_DECLARE_INPUT(In, std::vector<int> );
84   BBTK_DECLARE_INPUT(Renderer, vtkRenderer* );
85   BBTK_DECLARE_INPUT(Image, vtkImageData* );
86   BBTK_DECLARE_INPUT(Colour, std::vector<double> );
87   BBTK_DECLARE_INPUT(Opacity, double );
88   BBTK_DECLARE_INPUT(Radio, double );
89   BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
90   BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
91   BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
92   BBTK_DECLARE_OUTPUT( lstLabels,  std::vector<std::string> );
93   BBTK_PROCESS(Process);
94   void Process();
95   BBTK_CREATE_WIDGET(CreateWidget);
96   void CreateWidget(wxWindow*);
97
98 private:
99         WidgetShowNPoints *mwxwidget; 
100
101 };
102
103 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
104   BBTK_NAME("ShowNPoints");
105   BBTK_AUTHOR("Eduardo DAVILA");
106   BBTK_DESCRIPTION("widget that shows N moints in 3D (vtkActors)");
107   BBTK_CATEGORY("widgetVtk");
108   BBTK_INPUT(ShowNPoints,In,"One Point",std::vector<int>,"");
109   BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
110   BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
111   BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
112   BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,"");
113   BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,"");
114   BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
115   BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
116   BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
117   BBTK_OUTPUT(ShowNPoints , lstLabels , " list of labels ", std::vector<std::string> ,"");
118 BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
119 }
120 // EO namespace bbcreaMaracasVisu
121
122 #endif // __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
123 #endif // _USE_WXWIDGETS_