]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuViewerMPR.cxx
Compilation with bbtk 0.9.1
[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                 wxBusyCursor wait;         
113                 bbSetOutputPoint( mwxwidgetmpr->GetPoint() );
114                 bbSetOutputRenderer( mwxwidgetmpr->GetRenderer() );  
115 }
116
117 void ViewerMPR::CreateWidget(wxWindow* parent)
118 {
119         bbtkDebugMessageInc("Core",9,"ViewerMPR::CreateWidget() " <<std::endl);
120         marImageData    *marimagedata = new marImageData(bbGetInputIn() );
121         bbtkDebugDecTab("Core",9);
122         mwxwidgetmpr = new wxWidgetMPR(this , parent ,marimagedata);
123         bbSetOutputWidget( mwxwidgetmpr );
124 }
125
126 void ViewerMPR::bbUserConstructor()
127 {
128                 bbSetInputIn(NULL);
129 }
130 void ViewerMPR::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
131 {
132
133 }
134 void ViewerMPR::bbUserDestructor()
135 {
136
137 }
138 }
139 // EO namespace bbcreaMaracasVisu
140
141