]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuViewerMPR.cxx
*** empty log message ***
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuViewerMPR.cxx
1
2 #include "bbmaracasvisuViewerMPR.h"
3 #include "bbcreaMaracasVisuPackage.h"
4 namespace bbcreaMaracasVisu
5 {
6
7 //--------------------------------------------------------------------------
8 //--------------------------------------------------------------------------
9 //--------------------------------------------------------------------------
10
11
12   //--------------------------------------------------------------------------
13   // wxWidgetMPR
14   //--------------------------------------------------------------------------
15 BEGIN_EVENT_TABLE( wxWidgetMPR, wxPanel )
16         EVT_MENU( 12121, wxWidgetMPR::OnRefreshView )
17         EVT_MENU( 12122, wxWidgetMPR::OnDClickLeft  )
18 END_EVENT_TABLE( );
19
20   //-----------
21   //Constructor
22   //-----------
23   wxWidgetMPR::wxWidgetMPR(ViewerMPR* box,wxWindow* parent, marImageData        *marimagedata)
24           : wxPanel( parent, -1 )
25   {
26                 wxPanel *panel  = this;
27                 mbbViewerMPR    = box;
28
29                 wxwidget = new wxMPRWidget2( panel, marimagedata , 1 ); 
30                 wxwidget->ConfigureVTK();
31                 wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
32                 sizer   -> Add( wxwidget,0,wxGROW ); 
33                 sizer   -> AddGrowableCol(1);
34                 panel   -> SetSizer(sizer);
35                 panel   -> SetAutoLayout(true);
36                 panel   -> Layout();            
37   }
38 //--------------------------------------------------------------------------
39   wxWidgetMPR::~wxWidgetMPR()
40   {
41
42   }
43 //--------------------------------------------------------------------------
44   /*
45         Getting the point
46   */
47   std::vector<int> wxWidgetMPR::GetPoint()
48   {
49           return point;
50   }
51   /*
52         Getting the render
53   */
54   vtkRenderer* wxWidgetMPR::GetRenderer()
55   {
56         if(wxwidget!=NULL)      
57         {
58                 return  wxwidget->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
59         }
60         else
61         {
62                 return NULL;
63         }
64 }
65         
66 //--------------------------------------------------------------------------
67   void wxWidgetMPR::Refresh()
68   { 
69           wxwidget->RefreshView();
70   }
71
72 //--------------------------------------------------------------------------
73   //---------------
74   //Handling events
75   //---------------
76   void wxWidgetMPR::OnRefreshView(wxCommandEvent &event)
77   {
78
79           if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
80           {
81             point.clear();
82                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX());
83                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY());
84                 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ());
85                 mbbViewerMPR->bbSetOutputPoint( GetPoint() );
86                 mbbViewerMPR->bbSignalOutputModification(std::string("Point"));    
87                 wxwidget->RefreshView();
88           }
89   }
90
91 //--------------------------------------------------------------------------
92   void wxWidgetMPR::OnDClickLeft(wxCommandEvent & event) 
93   {
94         wxwidget->RefreshView();
95   }
96
97 //--------------------------------------------------------------------------
98 //--------------------------------------------------------------------------
99 //--------------------------------------------------------------------------
100
101
102
103
104
105
106
107
108 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ViewerMPR)
109 BBTK_BLACK_BOX_IMPLEMENTATION(ViewerMPR,bbtk::WxBlackBox);
110 void ViewerMPR::Process()
111 {
112         if (wxwidget!=NULL){
113                 wxBusyCursor wait;         
114                 bbSetOutputPoint( wxwidget->GetPoint() );
115                 bbSetOutputRenderer( wxwidget->GetRenderer() );  
116         } // wxwidget
117 }
118
119 void ViewerMPR::CreateWidget(wxWindow* parent)
120 {
121         bbtkDebugMessageInc("Core",9,"ViewerMPR::CreateWidget() " <<std::endl);
122         marImageData    *marimagedata = new marImageData(bbGetInputIn() );
123         bbtkDebugDecTab("Core",9);
124         wxwidget = new wxWidgetMPR(this , parent ,marimagedata);
125         bbSetOutputWidget( wxwidget );
126 }
127
128 void ViewerMPR::bbUserConstructor()
129 {
130                 wxwidget = NULL;
131                 bbSetInputIn(NULL);
132 }
133 void ViewerMPR::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
134 {
135
136 }
137 void ViewerMPR::bbUserDestructor()
138 {
139
140 }
141 }
142 // EO namespace bbcreaMaracasVisu
143
144