]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuShowNPoints.h
bug view MPR
[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           void                  AddPoint(int x, int y, int z, std::string label);
45           std::string   CleanSpaces(std::string ss);
46           int                   GetNearestPoint();
47           void                  ErasePoint(int id);
48           void                  SetOutputBox();
49           
50           ShowNPoints                                   *mbbShowNPoints;
51           vtkRenderer                                   *renderer;
52           std::vector<int>                              lstPointsX;
53           std::vector<int>                              lstPointsY;
54           std::vector<int>                              lstPointsZ;
55           std::vector<std::string>              lstLabels;
56           std::vector<vtkProp3D*>               lstActorsSphere;
57           std::vector<vtkTextActor3D*>  lstActorsText;
58
59           std::vector<int>                              mpoint;
60           vtkImageData                                  *mimage;
61           std::vector<double>                   mcolour;
62           double                                                mopacity;
63           double                                                mradio;
64           wxTextCtrl                                    *textCtrl;
65           wxStaticText                                  *txtNrPoints;
66   };
67
68
69
70 class /*BBTK_EXPORT*/ ShowNPoints
71  : 
72    public bbtk::WxBlackBox
73 {
74   BBTK_BLACK_BOX_INTERFACE(ShowNPoints,bbtk::WxBlackBox);
75   BBTK_DECLARE_INPUT(In, std::vector<int> );
76   BBTK_DECLARE_INPUT(Renderer, vtkRenderer* );
77   BBTK_DECLARE_INPUT(Image, vtkImageData* );
78   BBTK_DECLARE_INPUT(Colour, std::vector<double> );
79   BBTK_DECLARE_INPUT(Opacity, double );
80   BBTK_DECLARE_INPUT(Radio, double );
81   BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
82   BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
83   BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
84   BBTK_DECLARE_OUTPUT( lstLabels,  std::vector<std::string> );
85   BBTK_PROCESS(Process);
86   void Process();
87   BBTK_CREATE_WIDGET(CreateWidget);
88   void CreateWidget(wxWindow*);
89
90 private:
91         WidgetShowNPoints *mwxwidget; 
92
93 };
94
95 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
96   BBTK_NAME("ShowNPoints");
97   BBTK_AUTHOR("Eduardo DAVILA");
98   BBTK_DESCRIPTION("widget that shows N moints in 3D (vtkActors)");
99   BBTK_CATEGORY("widgetVtk");
100   BBTK_INPUT(ShowNPoints,In,"One Point",std::vector<int>,"");
101   BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
102   BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
103   BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
104   BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,"");
105   BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,"");
106   BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
107   BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
108   BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
109   BBTK_OUTPUT(ShowNPoints , lstLabels , " list of labels ", std::vector<std::string> ,"");
110 BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
111 }
112 // EO namespace bbcreaMaracasVisu
113
114 #endif // __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
115 #endif // _USE_WXWIDGETS_
116