wxContourViewPanel.cxx

Go to the documentation of this file.
00001 
00002 //----------------------------------------------------------------------------------------------------------------
00003 // Class definition include
00004 //----------------------------------------------------------------------------------------------------------------
00005 #include "wxContourViewPanel.h"
00006 
00007 #include "wxContourMainFrame.h"
00008 //----------------------------------------------------------------------------------------------------------------
00009 // Other includes
00010 //----------------------------------------------------------------------------------------------------------------
00011 //#include "ConceptDataWrap.h"
00012 
00013 //this should be eliminated at some point
00014 //#include "wxContourEventHandler.h"
00015 //----------------------------------------------------------------------------------------------------------------
00016 // Class implementation
00017 //----------------------------------------------------------------------------------------------------------------
00020 //----------------------------------------------------------------------------------------------------------------
00021 // Throwed Events definition
00022 //----------------------------------------------------------------------------------------------------------------
00023 
00024 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
00025 
00026 
00027         //------------------------------------------------------------------------------------------------------------
00028         // Constructors & Destructors
00029         //------------------------------------------------------------------------------------------------------------
00030         /*{
00031 
00032                 showingVID = theShowingImage;
00033                 int gapH = 20;
00034                 int gapV = 10;
00035                 createHorizontalBar(1,80);
00036                 createVerticalBar(1,200);
00037                 createViewPanel();
00038 
00039                 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0);
00040                 panelSizer->AddSpacer(gapV);
00041                 panelSizer -> AddGrowableCol(1);
00042                 panelSizer->Add(theViewPanel, 1, wxEXPAND);
00043                 panelSizer->AddSpacer(gapV);
00044 
00045                 wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH);
00046                 downSizer->Add(_verticalBar, 1, wxEXPAND);
00047                 //downSizer->AddSpacer(gapH);
00048                 downSizer -> AddGrowableCol(1);
00049                 downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER);
00050                 //downSizer->AddSpacer(gapH);
00051                 outSizer = new wxFlexGridSizer(3,1,1,1);
00052                 outSizer->Add(_horizontalBar, 1, wxEXPAND);
00053                 outSizer -> AddGrowableRow(1);
00054                 outSizer -> AddGrowableCol(1);
00055                 outSizer->Add(downSizer, 1, wxEXPAND);
00056 
00057                 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
00058                 _horizontalBar->setDeviceEndMargin( gapH+10 );
00059 
00060                 //Connecting the events to the horizontal bar
00061                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
00062                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
00063                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
00064                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
00065                 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
00066                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
00067 
00068                 //Connecting the events to the vertical bar
00069                 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
00070                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
00071                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
00072                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
00073                 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
00074                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
00075 
00076 
00077                 this->SetAutoLayout( true );
00078                 SetSizer( outSizer );
00079                 this->Layout();
00080 
00081                 SetSize(900,700);
00082                 theViewPanel->SetSize(800,600);
00083                 theViewPanel->GetWindow(1)->SetSize(800,600);
00084 
00085                 outSizer->Fit( this );
00086                 SetBackgroundColour(wxColour(255,0,0));
00087 
00088         }*/
00089         //:wxScrolledWindow(parent, -1, pos, size, style)
00090         wxContourViewPanel :: wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
00091         :wxPanel(parent, -1, pos, size, style)
00092         {
00093                 theShowingImage->GetSpacing(last_spacing);
00094                 showingVID = theShowingImage;
00095                 int gapH = 20;
00096                 int gapV = 10;
00097                 _verticalConceptName = "";
00098                 _horizontalConceptName = "";
00099                 createHorizontalBar(1,80);
00100                 createVerticalBar(1,200);
00101                 createViewPanel();
00102                 _eventHandler = NULL;
00103 
00104                 wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1, 4, gapV, gapH);
00105                 panelSizer -> AddGrowableCol(2);
00106                 panelSizer -> AddGrowableRow(2);
00107                 panelSizer->Add(_verticalBar, 1, wxGROW);
00108                 panelSizer->AddSpacer(gapV);
00109                 panelSizer->Add(theViewPanel, 1, wxGROW);
00110                 panelSizer->AddSpacer(gapV);
00111 
00112                 outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
00113                 outSizer -> AddGrowableCol(1);
00114                 outSizer -> AddGrowableRow(1);
00115                 outSizer->Add( _horizontalBar, 1, wxGROW);
00116                 outSizer->Add( panelSizer, 1, wxGROW);
00117                 outSizer->AddSpacer(gapH);
00118 
00119                 _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
00120                 _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
00121 
00122                 //Connecting the events to the horizontal bar
00123                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
00124                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
00125                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
00126                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
00127                 Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
00128                 Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
00129 
00130                 //Connecting the events to the vertical bar
00131                 Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
00132                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
00133                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
00134                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
00135                 Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
00136                 Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
00137 
00138 
00139                 this->SetSizer( outSizer );
00140                 this->SetAutoLayout( true );
00141                 this->Layout();
00142 
00143                 //SetSize(1900,1900);
00144                 //theViewPanel->SetSize(800,600);
00145                 //theViewPanel->GetWindow(1)->SetSize(800,600);
00146 
00147                 //outSizer->Fit( this );
00148 
00149                 initializeScenceManager();
00150         }
00151 
00152 
00153         wxContourViewPanel :: ~wxContourViewPanel()
00154         {
00155                 delete _sceneManager;
00156         }
00157 
00158         void wxContourViewPanel::initializeScenceManager(){
00159 
00160                 //_theViewPanel = theViewPanel;
00161                 //_theViewPanel->setWxEventHandler( this );
00162 
00163                 double spc[3];
00164                 this->getSpacing(spc);
00165                 _sceneManager           = new wxVtkBaseView_SceneManager ( this->getWxVtkBaseView(), this, spc  );
00166 
00167                 Connect( this->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangeInstant );
00168         Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateMultipleROI );
00169                 Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateROI );
00170                 Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStopCreateROI );
00171                 Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangedDeep );
00172                 Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
00173 
00174         }
00175 
00176         wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
00177                 return _sceneManager;
00178         }
00179 
00180         //------------------------------------------------------------------------------------------------------------
00181         // Creational and initialization methods
00182         //------------------------------------------------------------------------------------------------------------
00183 
00184         void wxContourViewPanel :: setWxEventHandler( wxEvtHandler * theEventHandler )
00185         {
00186                 _eventHandler = theEventHandler;
00187         }
00188 
00189         void wxContourViewPanel :: createHorizontalBar(int horzStart, int horzEnd)
00190         {
00191                 _horizontalBar = new mBarRange(this, 1500,80);
00192                 _horizontalBar -> setVisibleLabels (true);
00193                 _horizontalBar -> setRepresentedValues (horzStart, horzEnd);
00194                 _horizontalBar -> setActiveStateTo(true);
00195                 _horizontalBar -> SetActual( horzStart );
00196                 _horizontalBar -> setDeviceBlitStart (10,10);
00197                 _horizontalBar -> setDeviceEndMargin (10);
00198         }
00199 
00200         void wxContourViewPanel :: createVerticalBar(int vertStart, int vertEnd)
00201         {
00202                 _verticalBar = new mBarRange(this, 1500,40);
00203                 _verticalBar -> SetOrientation(false);
00204                 _verticalBar -> setVisibleLabels (false);
00205                 _verticalBar -> setRepresentedValues (vertStart, vertEnd);
00206                 _verticalBar -> setActiveStateTo(true);
00207                 _verticalBar -> SetActual( vertStart );
00208                 _verticalBar -> setDeviceBlitStart (10,10);
00209                 _verticalBar -> setDeviceEndMargin (10);
00210         }
00211         //------------------------------------------------------------------------------------------------------------
00212 
00213         void wxContourViewPanel::createViewPanel()
00214         {
00215                 std::vector<int> * numViews = new std::vector<int> ();
00216                 numViews->push_back(0);
00217                 theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
00218                 SetVisibleAxis(false);
00219 
00220                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
00221 
00222                 theViewPanel->SetSize(800,600);
00223                 theViewPanel->GetWindow(1)->SetSize(800,600);
00224 
00225         }
00226         //------------------------------------------------------------------------------------------------------------
00227 
00228         void wxContourViewPanel::changeImage(vtkImageData* img){
00229 
00230                 theViewPanel->SetImage(img);
00231 
00232         }
00233         wxVtkMPR2DView * wxContourViewPanel::GetwxVtkMPR2DView()
00234         {
00235                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
00236         }
00237 
00238         //------------------------------------------------------------------------------------------------------------
00239         void wxContourViewPanel::SetVisibleAxis(bool ok)
00240         {
00241                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
00242         }
00243 
00244         //------------------------------------------------------------------------------------------------------------
00245         int wxContourViewPanel::GetX()
00246         {
00247                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
00248         }
00249         //------------------------------------------------------------------------------------------------------------
00250         int wxContourViewPanel::GetY()
00251         {
00252                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
00253         }
00254         //------------------------------------------------------------------------------------------------------------
00255         int wxContourViewPanel::GetZ()
00256         {
00257                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
00258         }
00259 
00260         //------------------------------------------------------------------------------------------------------------
00261         void wxContourViewPanel::Refresh()
00262         {
00263                 GetwxVtkMPR2DView()->GetRenWin()->Render();
00264         }
00265 
00266 
00267         //------------------------------------------------------------------------------------------------------------
00268         // Methods for capturing events from the horizontal bar
00269         //------------------------------------------------------------------------------------------------------------
00270 
00274         void wxContourViewPanel :: onBarrange_Horizontal(wxCommandEvent& event)
00275         {
00276 
00277         }
00281         void wxContourViewPanel :: onActualChange_Bar_Horizontal(wxCommandEvent& event)
00282         {
00283 
00284                 int actual = getActualHorizontal();
00285 
00286                 wxContourMainFrame::getInstance()->onChangeInstant(_horizontalConceptName, actual);
00287 
00288                 //JCP 26 - 11 - 08
00289                 //int nxActual_h = getActualHorizontal();
00290 
00291 
00292                 //if (_eventHandler!=NULL)
00293                 //{
00294                         //-------------------------------------------------
00295                         //  Sending the event of wxINSTANT_CHANGE
00296                         //-------------------------------------------------
00297                 //      wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
00298 
00299                 //      ConceptDataWrap * cWrap = new ConceptDataWrap( _horizontalConceptName );
00300                 //      cWrap->setActualValue( nxActual_h );
00301 
00302                 //      newevent.SetClientData( (void *)cWrap );
00303                 //      _eventHandler->ProcessEvent(newevent);
00304 
00305                 //}
00306                 //JCP 26 - 11 - 08
00307         }
00311         void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
00312         {
00313 //              int nxStart_h = getStartHorizontal();
00314         }
00318         void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
00319         {
00320 //              int nxEnd_h = getEndHorizontal();
00321         }
00325         void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
00326         {
00327 
00328         }
00332         void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
00333         {
00334 //              int nxStart_h = getStartHorizontal();
00335 //              int nxEnd_h = getEndHorizontal();
00336         }
00337 
00338 
00339         //------------------------------------------------------------------------------------------------------------
00340         // Methods for capturing events from the vertical bar
00341         //------------------------------------------------------------------------------------------------------------
00342 
00346         void wxContourViewPanel :: onBarrange_Vertical(wxCommandEvent& event)
00347         {
00348 
00349         }
00353         void wxContourViewPanel :: onActualChange_Bar_Vertical(wxCommandEvent& event)
00354         {
00355                 int actual = getActualVertical();
00356                 wxContourMainFrame::getInstance()->onChangeInstant(_verticalConceptName, actual);
00357                 //JCP 26 - 11 - 08
00358                 /*
00359                 int nxActual_v = getActualVertical();
00360 
00361                 if (_eventHandler!=NULL)
00362                 {
00363                         //-------------------------------------------------
00364                         //  Sending the event of wxINSTANT_CHANGE
00365                         //-------------------------------------------------
00366                         wxCommandEvent newevent(wxINSTANT_CHANGE,GetId());
00367 
00368                         ConceptDataWrap * cWrap = new ConceptDataWrap( _verticalConceptName );
00369                         cWrap->setActualValue( nxActual_v );
00370 
00371                         newevent.SetClientData( (void *)cWrap );
00372                         _eventHandler->ProcessEvent(newevent);
00373                 }*/
00374                 //JCP 26 - 11 - 08
00375         }
00379         void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
00380         {
00381 //              int nxStart_v = getStartVertical();
00382         }
00386         void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
00387         {
00388 //              int nxEnd_v = getEndVertical();
00389         }
00393         void wxContourViewPanel :: onSelectionEnd_Vertical(wxCommandEvent& event)
00394         {
00395 
00396         }
00400         void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
00401         {
00402 //              int nxStart_v = getStartVertical();
00403 //              int nxEnd_v = getEndVertical();
00404         }
00405 
00406 
00407         //------------------------------------------------------------------------------------------------------------
00408         //  Methods for sending events
00409         //------------------------------------------------------------------------------------------------------------
00410 
00411         //------------------------------------------------------------------------------------------------------------
00412         //  Attributes getters and setters
00413         //------------------------------------------------------------------------------------------------------------
00414 
00420         void wxContourViewPanel :: setVerticalRepresentedValues( int minRepresented, int maxRepresented )
00421         {
00422                 if( _verticalBar != NULL && _useVerticalBar )
00423                 {
00424                         _verticalBar -> setRepresentedValues( minRepresented, maxRepresented );
00425                 }
00426         }
00427 
00433         void wxContourViewPanel :: setHorizontalRepresentedValues( int minRepresented, int maxRepresented )
00434         {
00435                 if( _horizontalBar != NULL && _useHorizontalBar )
00436                 {
00437                         _horizontalBar -> setRepresentedValues( minRepresented, maxRepresented );
00438                 }
00439         }
00440 
00445         int wxContourViewPanel :: getStartVertical()
00446         {
00447                 return _verticalBar->GetActual();
00448         }
00453         int wxContourViewPanel :: getEndVertical()
00454         {
00455                 return _verticalBar->GetEnd();
00456         }
00461         int wxContourViewPanel :: getActualVertical()
00462         {
00463                 return _verticalBar->GetActual();//GetEnd();
00464         }
00465 
00470         void wxContourViewPanel :: setStartVertical( int nwValue )
00471         {
00472                  _verticalBar->SetEnd( nwValue );
00473         }
00478         void wxContourViewPanel :: setEndVertical( int nwValue )
00479         {
00480                  _verticalBar->SetEnd( nwValue );
00481         }
00486         void wxContourViewPanel :: setActualVertical( int nwValue )
00487         {
00488                  _verticalBar->SetActual( nwValue );
00489         }
00490 
00495         int wxContourViewPanel :: getStartHorizontal()
00496         {
00497                 return _horizontalBar->GetStart();
00498         }
00503         int wxContourViewPanel :: getEndHorizontal()
00504         {
00505                 return _horizontalBar->GetEnd();
00506         }
00511         int wxContourViewPanel :: getActualHorizontal()
00512         {
00513                 return _horizontalBar->GetActual();
00514         }
00515 
00520         void wxContourViewPanel :: setStartHorizontal( int nwValue )
00521         {
00522                 _horizontalBar->SetStart( nwValue );
00523         }
00528         void wxContourViewPanel :: setEndHorizontal( int nwValue )
00529         {
00530                 _horizontalBar->SetEnd( nwValue );
00531         }
00536         void wxContourViewPanel :: setActualHorizontal( int nwValue )
00537         {
00538                 _horizontalBar->SetActual( nwValue );
00539         }
00540 
00550         void wxContourViewPanel :: setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
00551         {
00552                 setHorizontalConceptName( theHorizontalConcept );
00553                 setHorizontalRepresentedValues( minRepresent, maxRepresent );
00554                 setActualHorizontal( actualShow );
00555                 setStartHorizontal( minShowed );
00556                 setEndHorizontal( maxShowed );
00557         }
00558 
00568         void wxContourViewPanel :: setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow )
00569         {
00570                 setVerticalConceptName( theVerticalConcept );
00571                 setVerticalRepresentedValues( minRepresent, maxRepresent );
00572                 setActualVertical( actualShow );
00573                 setStartVertical( minShowed );
00574                 setEndVertical( maxShowed );
00575         }
00576 
00577 
00582         void wxContourViewPanel :: setHorizontalConceptName( std::string theHorizontalConcept )
00583         {
00584                 _horizontalConceptName = theHorizontalConcept;
00585         }
00586 
00591         std::string wxContourViewPanel :: getHorizontalConceptName(  )
00592         {
00593                 return _horizontalConceptName;
00594         }
00595 
00600         void wxContourViewPanel :: setVerticalConceptName( std::string theVerticalConcept )
00601         {
00602                 _verticalConceptName = theVerticalConcept;
00603         }
00604 
00609         std::string wxContourViewPanel :: getVerticalConceptName(  )
00610         {
00611                 return _verticalConceptName;
00612         }
00613 
00614         //------------------------------------------------------------------------------------------------------------
00615         //  Other functional methods
00616         //------------------------------------------------------------------------------------------------------------
00617 
00618         void wxContourViewPanel :: getSpacing( double * spacing  )
00619         {
00620                 spacing[0] = last_spacing[0];
00621                 spacing[1] = last_spacing[1];
00622                 spacing[2] = last_spacing[2];
00623         }
00624 
00625         wxVtkBaseView* wxContourViewPanel :: getWxVtkBaseView()
00626         {
00627                 return theViewPanel->GetwxVtkBaseView(1);
00628         }
00629 
00630         double wxContourViewPanel :: getCurrentDeep()
00631         {
00632 //EED 08/04/2008
00633 //              return theViewPanel->GetZ(1);
00634                 return theViewPanel->GetZ();
00635                 //return GetZ();
00636         }
00637 
00638 
00639         bool wxContourViewPanel::isEditableCControler(std::string theKeyName){
00640                 return _sceneManager->isEditableCControler(theKeyName);
00641         }
00642 
00643         void wxContourViewPanel::removeFromScene(std::string theKeyName){
00644 
00645                 _sceneManager->deleteCViewerCControler(theKeyName);
00646 
00647 
00648         }
00649 
00650         void wxContourViewPanel::onChangeInstant(wxCommandEvent& event){
00651                 ConceptDataWrap * dataConcept = NULL;
00652                 if ( GetId() == event.GetId() )
00653                 {
00654                         dataConcept = (ConceptDataWrap *)event.GetClientData();
00655                         int value = dataConcept->getActualValue();
00656                         //_instantPanel->setConceptValue( dataConcept->getName(), value );
00657                         wxContourMainFrame::getInstance()->setConceptValue( dataConcept->getName(), value );
00658                 }
00659                 else
00660                 {
00661                         dataConcept = wxContourMainFrame::getInstance()->getLastConceptData();
00662                         if( dataConcept->getName().compare( getVerticalConceptName() ) == 0)
00663                         {
00664                                 setActualVertical( dataConcept->getActualValue());
00665                                 //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
00666                         }
00667                         else if( dataConcept->getName().compare( getHorizontalConceptName() ) == 0|| wxContourMainFrame::getInstance()->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
00668                         {
00669                                 setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
00670                         }
00671                 }
00672                 wxContourMainFrame::getInstance()->changeInstant();
00673         }
00674 
00675         void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
00676         }
00677         void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
00678         }
00679         void wxContourViewPanel::onStopCreateROI (wxCommandEvent& event){
00680         }
00681         void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
00682                 double val = getCurrentDeep();
00683                 //setActualVertical( (int)val );
00684                 wxContourMainFrame::getInstance()->onChangeDeep((int)val);
00685                 //_instantPanel->setConceptValue( "Axe Depth", (int)val );
00686 
00687 //              changeInstant();
00688         }
00689         void wxContourViewPanel::changeDeep(){
00690                 double val = getCurrentDeep();
00691                 setActualVertical( (int)val );
00692         }
00693         void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
00694 
00695 
00696                 std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
00697 //              int elementsSelected = currentSelection.size();
00698                 bool ctrlKey = _sceneManager->isCtrlPressed();
00699                 char toolCommand = _sceneManager->getLastKeyCode();
00700 
00701 
00702                 if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
00703                 {
00704                         wxContourMainFrame::getInstance()->onCopy();
00705                 }
00706                 else if(  toolCommand == 22 && ctrlKey ) //'V' || 'v'
00707                 {
00708                         wxContourMainFrame::getInstance()->onPaste();
00709                 }
00710                 else if(  toolCommand == 8 || (toolCommand==127) ) // backspace Delete
00711                 {
00712                         wxContourMainFrame::getInstance()->onDeleteContour();
00713                 }
00714                 else if(  toolCommand == 14 && ctrlKey ) //'N' || 'n'
00715                 {
00716                         //toolCommand = &(CREATE_CONTOUR_KEY);
00717                 }
00718                 else if(  toolCommand == 15 && ctrlKey ) //'O' || 'o'
00719                 {
00720                         wxContourMainFrame::getInstance()->onLoad();
00721                 }
00722                 else if(  toolCommand == 19 && ctrlKey ) //'S' || 's'
00723                 {
00724                         wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
00725                 }else if( toolCommand == 26 ){
00726                         wxContourMainFrame::getInstance()->onUndo();
00727                 }else if( toolCommand == 25 ){
00728                         wxContourMainFrame::getInstance()->onRedo();
00729                 }
00730         }
00731 
00732         void wxContourViewPanel::removeSceneContours(){
00733                 _sceneManager->removeSceneContours();
00734         }
00735 
00736         void wxContourViewPanel::addNameWrapperToScene(){
00737                 int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
00738                 for(int i = 0; i < size;i++){
00739                         std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
00740                         _sceneManager->addToScene(name, true, true, true, false, false );
00741                 }
00742         }
00743 
00744         std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
00745                 return _sceneManager->getSelectedObjects();
00746         }
00747 
00748         void wxContourViewPanel::RefreshInterface(){
00749                 getWxVtkBaseView()->Refresh();
00750         }
00751 
00752         vtkImageData* wxContourViewPanel::getImageData(){
00753                 return _sceneManager->GetImageData();
00754         }
00755 
00756         void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour)
00757         {
00758                 _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
00759         }
00760 
00761         int wxContourViewPanel::GetImageDataSizeZ()
00762         {
00763                 return _sceneManager->GetImageDataSizeZ();
00764         }
00765 
00766         void wxContourViewPanel::GetImageDataRange(double *range)
00767         {
00768                 _sceneManager->GetImageDataRange(range);
00769         }
00770 
00771         void wxContourViewPanel::SetWidthContour(double width )
00772         {
00773                 _sceneManager->SetWidthContour( width );
00774         }
00775 
00776         int wxContourViewPanel::getColorWindow()
00777         {
00778                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
00779                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
00780                 int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
00781                 return colorwindow;
00782         }
00783 
00784         int wxContourViewPanel::getWindowLevel()
00785         {
00786                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
00787                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
00788                 int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();
00789                 return windowlevel;
00790         }
00791 
00792         void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
00793         {
00794                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
00795                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
00796                 imageviewer->SetColorWindow(colorwindow);
00797                 imageviewer->SetColorLevel(windowlevel);
00798         }
00799 
00800         void wxContourViewPanel::onInterpolation(bool interpolate)
00801         {
00802                 wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
00803                 vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
00804 
00805                 if (interpolate){
00806                         imageviewer->GetImageActor()->InterpolateOn();
00807                 } else {
00808                         imageviewer->GetImageActor()->InterpolateOff();
00809                 }
00810         }
00811 
00812         void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
00813         {
00814                 _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
00815         }
00816 
00817         void wxContourViewPanel::setImageSlice(int z){
00818                 vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
00819                 wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
00820                 baseview->SetActualSlice(z);
00821                 RefreshInterface();
00822         }
00823 

Generated on Wed Jun 27 23:28:32 2012 for creaContours_lib by  doxygen 1.5.7.1