]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
#3418 creaMaracasVisu Feature New Normal - ManualPaint_model with openmp
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
index 0190f82d55f4a296eb120b235b3478f0af7e95d7..3cdf1e0b73b9c7108ad9da1b5a4df5cd1e74fc8d 100644 (file)
@@ -34,7 +34,7 @@
     wxPanel    *panel                                  = this;
     wxSizer *sizer                                     = NULL;
 
-       if (mtype==0)
+       if ((mtype==0) || (mtype==3))
        {
                // Widget interface
                askPointLabel                                   = new wxStaticText(panel, -1, _T("Point label :")); // JPR
                wxButton *btnEraseLastPoint             = new wxButton( panel, -1, _T("Erase Last point"));
                wxButton *btnErasePoint                 = new wxButton( panel, -1, _T("Erase point"));
                wxButton *btnDeleteAllPoints    = new wxButton( panel, -1, _T("Delete all points"));
-               wxButton *btnSavePoints                 = new wxButton( panel, -1, _T("Save points"));
-               wxButton *btnLoadPoints                 = new wxButton( panel, -1, _T("Load points"));
+               wxButton *btnSavePoints                 = NULL;
+               wxButton *btnLoadPoints                 = NULL;
+               if (mtype==0)
+               {
+                       btnSavePoints                           = new wxButton( panel, -1, _T("Save points"));
+                       btnLoadPoints                           = new wxButton( panel, -1, _T("Load points"));
+               }
                txtNrPoints                                             = new wxStaticText(panel,-1, _T(" "));
 
                //NTU: Sliders for opacity and radio change
                Connect(btnEraseLastPoint->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
                Connect(btnErasePoint->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
                Connect(btnDeleteAllPoints->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
-               Connect(btnSavePoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
-               Connect(btnLoadPoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
-
+               if (mtype==0)
+               {
+                       Connect(btnSavePoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
+                       Connect(btnLoadPoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
+               }
                //NTU: Slider events
                Connect(sdrOpacity->GetId()                     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
                Connect(sdrRadio->GetId()                       , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
                sizer1->Add(sdrOpacity,1,wxGROW );
                sizer1->Add(txRadio);
                sizer1->Add(sdrRadio,1,wxGROW );
-               sizer1->Add(btnSavePoints);
-               sizer1->Add(btnLoadPoints);
+               if (mtype==0)
+               {
+                       sizer1->Add(btnSavePoints);
+                       sizer1->Add(btnLoadPoints);
+               }
                sizer = sizer1;
        }
 
@@ -215,6 +225,13 @@ void WidgetShowNPoints::RefreshPoint(int id)
        lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
        lstSourceSphere[id]->SetRadius( radio );
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+       // ..
+#else
+       lstSourceSphere[id]->Update();
+#endif
+
        lstActorsText[id]->SetInput( label.c_str()  );
        lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
 }
@@ -241,7 +258,15 @@ void WidgetShowNPoints::AddVtkPoint()
        //NTU: For updating points
        lstSourceSphere.push_back(vtksphere);
        vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        sphereMapper->SetInput( vtksphere->GetOutput() );
+#else
+       vtksphere->Update();
+       sphereMapper->SetInputData( vtksphere->GetOutput() );
+#endif
+
        vtkActor *sphereActor   = vtkActor::New();
        sphereActor->SetMapper(sphereMapper);
        sphereActor->SetOrigin(0, 0, 0);
@@ -346,6 +371,9 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
 //------------------------------------------------------------------------
        void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
        {
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                wxFileDialog* FD = new wxFileDialog( 0,
                                             _T("Save points .."),
                                             _T(""),
@@ -353,7 +381,17 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
                                             _T("(*.xls)|*.xls"),
                                             wxSAVE | wxOVERWRITE_PROMPT,
                                             wxDefaultPosition);
-               //EED
+#else
+               wxFileDialog* FD = new wxFileDialog( 0,
+                                            _T("Save points .."),
+                                            _T(""),
+                                            _T(""),
+                                            _T("(*.xls)|*.xls"),
+                                            wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
+                                            wxDefaultPosition);
+#endif
+
+
 
                int result_FD = FD->ShowModal();
                
@@ -371,6 +409,9 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
 //------------------------------------------------------------------------
        void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
        {
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                wxFileDialog* FD = new wxFileDialog( 0,
                                              _T("Load points .."),
                                              _T(""),
@@ -378,6 +419,15 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
                                              _T("(*.xls)|*.xls"),
                                              wxOPEN | wxFILE_MUST_EXIST,
                                              wxDefaultPosition);
+#else
+               wxFileDialog* FD = new wxFileDialog( 0,
+                                             _T("Load points .."),
+                                             _T(""),
+                                             _T(""),
+                                             _T("(*.xls)|*.xls"),
+                                             wxFD_OPEN | wxFD_FILE_MUST_EXIST,
+                                             wxDefaultPosition);
+#endif
                int i;
                //EED
                int result_FD = FD->ShowModal();
@@ -548,13 +598,13 @@ void  WidgetShowNPoints::SetInitLstPoints( std::vector<int> initLstPointsX,  std
        } // if size
 }
 //------------------------------------------------------------------------
-void WidgetShowNPoints::WidgetShowNPoints::SetType(int type)
+void WidgetShowNPoints::SetType(int type)
 {
        mtype=type;
 }
 
 //------------------------------------------------------------------------
-int WidgetShowNPoints::WidgetShowNPoints::GetType()
+int WidgetShowNPoints::GetType()
 {
        return mtype;
 }