]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
#3216 creaContours Feature New Normal - vtk8itk4wx3-mingw64
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.cxx
index 4286054e785fb92ef3bb80c2deca61b883204759..0115b33cbb411d4947cd29b5b429a575547c1a63 100644 (file)
@@ -52,65 +52,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        //------------------------------------------------------------------------------------------------------------
        // Constructors & Destructors
        //------------------------------------------------------------------------------------------------------------
-       /*{
-
-               showingVID = theShowingImage;
-               int gapH = 20;
-               int gapV = 10;
-               createHorizontalBar(1,80);
-               createVerticalBar(1,200);
-               createViewPanel();
-
-               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0);
-               panelSizer->AddSpacer(gapV);
-               panelSizer -> AddGrowableCol(1);
-               panelSizer->Add(theViewPanel, 1, wxEXPAND);
-               panelSizer->AddSpacer(gapV);
-
-               wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH);
-               downSizer->Add(_verticalBar, 1, wxEXPAND);
-               //downSizer->AddSpacer(gapH);
-               downSizer -> AddGrowableCol(1);
-               downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER);
-               //downSizer->AddSpacer(gapH);
-               outSizer = new wxFlexGridSizer(3,1,1,1);
-               outSizer->Add(_horizontalBar, 1, wxEXPAND);
-               outSizer -> AddGrowableRow(1);
-               outSizer -> AddGrowableCol(1);
-               outSizer->Add(downSizer, 1, wxEXPAND);
-
-               _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV);
-               _horizontalBar->setDeviceEndMargin( gapH+10 );
-
-               //Connecting the events to the horizontal bar
-               Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
-               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
-               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
-               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
-               Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
-               Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
-
-               //Connecting the events to the vertical bar
-               Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
-               Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
-               Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
-               Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
-               Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
-               Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
-
-
-               this->SetAutoLayout( true );
-               SetSizer( outSizer );
-               this->Layout();
-
-               SetSize(900,700);
-               theViewPanel->SetSize(800,600);
-               theViewPanel->GetWindow(1)->SetSize(800,600);
-
-               outSizer->Fit( this );
-               SetBackgroundColour(wxColour(255,0,0));
-
-       }*/
        //:wxScrolledWindow(parent, -1, pos, size, style)
        wxContourViewPanel::wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
        :wxPanel(parent, -1, pos, size, style)
@@ -125,37 +66,33 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                createVerticalBar(1,200);
                createViewPanel();
                _eventHandler                   = NULL;
-
+               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4,  gapV, gapH);
 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
 #if wxMAJOR_VERSION <= 2
-               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4,  gapV, gapH);
                panelSizer -> AddGrowableCol(2);
                panelSizer -> AddGrowableRow(2);
 #else
-               wxFlexGridSizer * panelSizer = new wxFlexGridSizer(4);
-               panelSizer -> AddGrowableCol(2);
+               panelSizer -> AddGrowableRow(0,1);
+               panelSizer -> AddGrowableCol(2,1);
 #endif
-               panelSizer->Add(_verticalBar, 1, wxGROW);
+               panelSizer->Add(_verticalBar, 0, wxEXPAND);
                panelSizer->AddSpacer(gapV);
-               panelSizer->Add(theViewPanel, 1, wxGROW);
+               panelSizer->Add(theViewPanel, 1, wxEXPAND);
                panelSizer->AddSpacer(gapV);
-
+               outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
 #if wxMAJOR_VERSION <= 2
-               outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
                outSizer -> AddGrowableCol(1);
                outSizer -> AddGrowableRow(1);
 #else
-               outSizer = new wxFlexGridSizer(3);
-               outSizer -> AddGrowableCol(1);
+               outSizer -> AddGrowableRow(1,1);
+               outSizer -> AddGrowableCol(0,1);
 #endif
-               outSizer->Add( _horizontalBar, 1, wxGROW);
-               outSizer->Add( panelSizer, 1, wxGROW);
+               outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP);
+               outSizer->Add( panelSizer, 1, wxEXPAND);
                outSizer->AddSpacer(gapH);
-
                _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
                _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
-
                //Connecting the events to the horizontal bar
                Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
                Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
@@ -199,10 +136,11 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onCreateROI );
                Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStopCreateROI );
                Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onChangedDeep );
-               Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
+               Connect( wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourViewPanel :: onActionButtonPressed );
        }
 
-       wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager(){
+       wxVtkBaseView_SceneManager* wxContourViewPanel::getSceneManager()
+       {
                return _sceneManager;
        }
 
@@ -758,11 +696,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                }
        }
 
-       void wxContourViewPanel::removeSceneContours(){
+       void wxContourViewPanel::removeSceneContours()
+       {
                _sceneManager->removeSceneContours();
        }
 
-       void wxContourViewPanel::addNameWrapperToScene(){
+       void wxContourViewPanel::addNameWrapperToScene()
+       {
                int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
                for(int i = 0; i < size;i++){
                        std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
@@ -821,21 +761,14 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
        {
                wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
-               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-               imageviewer->SetColorWindow(colorwindow);
-               imageviewer->SetColorLevel(windowlevel);
+               wxvtk2dbaseview->SetColorWindow( colorwindow );
+               wxvtk2dbaseview->SetColorLevel( windowlevel );
        }
 
        void wxContourViewPanel::onInterpolation(bool interpolate)
        {
                wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
-               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-
-               if (interpolate){
-                       imageviewer->GetImageActor()->InterpolateOn();
-               } else {
-                       imageviewer->GetImageActor()->InterpolateOff();
-               }
+               wxvtk2dbaseview->SetInterpolate( interpolate );
        }
 
        void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )