1 #include "bbmaracasvisuViewerNV.h"
2 #include "bbcreaMaracasVisuPackage.h"
3 namespace bbcreaMaracasVisu
7 BEGIN_EVENT_TABLE( bbwxMaracas_N_ViewersWidget, wxPanel )
8 EVT_MENU( 12121, bbwxMaracas_N_ViewersWidget::OnRefreshView )
9 EVT_MENU( 12122, bbwxMaracas_N_ViewersWidget::OnDClickLeft )
13 //-------------------------------------------------------------
14 //-------------------------------------------------------------
15 //-------------------------------------------------------------
17 bbwxMaracas_N_ViewersWidget::bbwxMaracas_N_ViewersWidget(ViewerNV* box,
19 vtkImageData* imagedata,
20 std::vector<int> *nTypeView)
21 :wxMaracas_N_ViewersWidget(parent,imagedata,nTypeView)
26 //-------------------------------------------------------------
27 bbwxMaracas_N_ViewersWidget::~bbwxMaracas_N_ViewersWidget()
31 //-------------------------------------------------------------
32 void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event)
34 wxMaracas_N_ViewersWidget::OnRefreshView(event);
35 mbbViewerNV->bbSignalOutputModification(std::string("Point"));
39 //-------------------------------------------------------------
40 void bbwxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event)
42 wxMaracas_N_ViewersWidget::OnDClickLeft(event);
43 mbbViewerNV->bbSignalOutputModification(std::string("Point"));
46 //-------------------------------------------------------------
47 //-------------------------------------------------------------
48 //-------------------------------------------------------------
53 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ViewerNV)
54 BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox);
55 //-------------------------------------------------------------
56 void ViewerNV::Process()
59 vtkImageData* img = bbGetInputIn();
60 std::vector<int> type = bbGetInputnTypeView();
62 if(img != NULL && mwxwidget != NULL){// && !enter){
64 if(!compareVectors(type, currenttype)){
65 mwxwidget->SetType(&type);
66 mwxwidget->UpdateLayout(img);
67 }else if (img != currentimg){
68 mwxwidget->SetImage(img);
75 point.push_back((int)mwxwidget->GetX());
76 point.push_back((int)mwxwidget->GetY());
77 point.push_back((int)mwxwidget->GetZ());
78 bbSetOutputPoint(point);
80 // WxBlackBox::Process();
81 // mwxwidget->SetImage(img );
82 wxVtkBaseView *wvbv1 = mwxwidget->GetwxVtkBaseView(1);
83 wxVtkBaseView *wvbv2 = mwxwidget->GetwxVtkBaseView(2);
84 wxVtkBaseView *wvbv3 = mwxwidget->GetwxVtkBaseView(3);
85 wxVtkBaseView *wvbv4 = mwxwidget->GetwxVtkBaseView(4);
87 //wxwidget->RefreshView();
89 bbSetOutputwxVtkBaseView1( wvbv1 );
90 bbSetOutputwxVtkBaseView2( wvbv2 );
91 bbSetOutputwxVtkBaseView3( wvbv3 );
92 bbSetOutputwxVtkBaseView4( wvbv4 );
93 if (wvbv1!=NULL) { bbSetOutputRenderer1( wvbv1->GetRenderer() ); }
94 if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); }
95 if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); }
96 if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); }
100 //-------------------------------------------------------------
101 void ViewerNV::CreateWidget(wxWindow* parent)
103 bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<<std::endl);
104 mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent );
105 bbtkDebugDecTab("Core",9);
106 bbSetOutputWidget( mwxwidget );
109 this->bbSignalOutputModification();
113 //-------------------------------------------------------------
114 void ViewerNV::bbUserConstructor()
120 std::vector<int> vecNTypeViwer;
121 vecNTypeViwer.push_back(5);
122 vecNTypeViwer.push_back(0);
123 vecNTypeViwer.push_back(1);
124 vecNTypeViwer.push_back(3);
125 bbSetInputnTypeView(vecNTypeViwer);
128 bbSetOutputwxVtkBaseView1( NULL );
129 bbSetOutputwxVtkBaseView2( NULL );
130 bbSetOutputwxVtkBaseView3( NULL );
131 bbSetOutputwxVtkBaseView4( NULL );
132 bbSetOutputRenderer1( NULL );
133 bbSetOutputRenderer2( NULL );
134 bbSetOutputRenderer3( NULL );
135 bbSetOutputRenderer4( NULL );
138 //-------------------------------------------------------------
139 void ViewerNV::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
146 //-------------------------------------------------------------
147 void ViewerNV::bbUserDestructor()
149 std::cout << "ViewerNV destroy "<<this<<" vs "<<GetThisPointer<void>()<<std::endl;
153 bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype){
157 if(type.size()==currenttype.size()){
158 for(int i = 0; i < type.size() && ret; i++){
159 if(type[i]!=currenttype[i]){
172 // EO namespace bbcreaMaracasVisu