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