]> Creatis software - creaMaracasVisu.git/commitdiff
#3525 ShowNPoints Actual Visu collection option
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 20 Jul 2023 17:01:54 +0000 (19:01 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 20 Jul 2023 17:01:54 +0000 (19:01 +0200)
bbtk/src/bbmaracasvisuShowNPoints.cxx
bbtk/src/bbmaracasvisuShowNPoints.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h

index 5103f9c5b2ddde1a8b1c5318b2d8ba53aa9bc837..0d7d0ddf8e99366dbd9feffa60778d6360a92ea6 100644 (file)
@@ -108,9 +108,16 @@ void ShowNPoints::Process()
                mwxwidget->SetReferencePoint( bbGetInputIn() );
                mwxwidget->SetImage( bbGetInputImage() );
                mwxwidget->SetColour( bbGetInputColour() );
-               mwxwidget->SetOpacity( bbGetInputOpacity() );
+//             mwxwidget->SetOpacity( bbGetInputOpacity() );
                mwxwidget->SetRadio( bbGetInputRadio() );
 
+        if ( backOpacity!=bbGetInputOpacity() )
+        {
+            backOpacity = bbGetInputOpacity();
+            mwxwidget->SetOpacity( bbGetInputOpacity() );
+        } // if backOpacity
+        
+        
 //        if (firsttime==true)
 //        {
 //            firsttime=false;
@@ -152,6 +159,7 @@ void ShowNPoints::CreateWidget(wxWindow* parent)
 void ShowNPoints::bbUserSetDefaultValues()
 {
     firsttime=true;
+    backOpacity = -1;
        mwxwidget = NULL;
        bbSetInputRadio(10);
        bbSetInputOpacity(1);
index 2a276eebf9ef98de4c3348883f294cd2cd895003..71eb59ab37a53371098d2f1b9aef926fe27a4f60 100644 (file)
@@ -88,6 +88,8 @@ class /*BBTK_EXPORT*/ ShowNPoints
   BBTK_CREATE_WIDGET(CreateWidget);
   void CreateWidget(wxWindow*);
 
+    double backOpacity;
+    
 private:
     bool                        firsttime;
        WidgetShowNPointsBox *mwxwidget; 
index 20dc25377a3d88ba25da9ecb6525a5ae16c24bdf..cd1aace00afb8165a6fd981ba63a5f97a474dac7 100644 (file)
@@ -4,7 +4,6 @@
 #include <wx/filedlg.h>
 #include <wx/msgdlg.h>
 #include <wx/notebook.h>
-#include <wx/spinctrl.h>
 
 
 #include <vtkStaticPointLocator.h>
@@ -30,6 +29,7 @@
   WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
   {
+      printf("WidgetShowNPoints::WidgetShowNPoints Start\n");
       aux_mesh      =   NULL;
       aux_mesh_spc.push_back(1);
       aux_mesh_spc.push_back(1);
                               wxDefaultSize,
                               wxNB_TOP );
           panel2  = new wxPanel(bookGroupManager);
-          wxCheckBox *cbVisuActualCollection    = new wxCheckBox    ( panel2,-1, _T("A.V.")       ,   wxDefaultPosition, sizeButton );
+          cbVisuActualCollection                = new wxCheckBox    ( panel2,-1, _T("A.V.")   ,   wxDefaultPosition, sizeButton );
           txtNrCollections                      = new wxStaticText  ( panel2,-1, _T("    1/1    "));
           wxButton *btnBackCollection           = new wxButton      ( panel2, -1, _T("<")     ,   wxDefaultPosition, sizeButton );
           wxButton *btnNextCollection           = new wxButton      ( panel2, -1, _T(">")     ,   wxDefaultPosition, sizeButton );
           wxButton *btnResetCollection          = new wxButton      ( panel2, -1, _T("--")    ,   wxDefaultPosition, sizeButton );
           wxButton *btnSaveCollection           = new wxButton      ( panel2, -1, _T("Save")  ,   wxDefaultPosition, sizeButton );
           wxButton *btnLoadCollection           = new wxButton      ( panel2, -1, _T("Load")  ,   wxDefaultPosition, sizeButton );
+          wxButton *btnUndo                     = new wxButton      ( panel2, -1, _T("Undo")  ,   wxDefaultPosition, sizeButton );
+          wxButton *btnRedo                     = new wxButton      ( panel2, -1, _T("Redo")  ,   wxDefaultPosition, sizeButton );
+
+         sCtrlRadio = new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+         sCtrlRadio->SetRange(1,10);
+         sCtrlRadio->SetValue( 2 );
+         sCtrlOpacity= new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+         sCtrlOpacity->SetRange(0,10);
+         sCtrlOpacity->SetValue( 10 );
+        
           wxFlexGridSizer *sizer1               = new wxFlexGridSizer(1);
           wxFlexGridSizer *sizer2               = new wxFlexGridSizer(2);
           wxFlexGridSizer *sizer3               = new wxFlexGridSizer(3);
           wxFlexGridSizer *sizer4               = new wxFlexGridSizer(3);
-          wxFlexGridSizer *sizer5               = new wxFlexGridSizer(1);
+          wxFlexGridSizer *sizer5               = new wxFlexGridSizer(2);
           wxFlexGridSizer *sizer5a              = new wxFlexGridSizer(2);
           wxFlexGridSizer *sizer6               = new wxFlexGridSizer(2);
           wxFlexGridSizer *sizer7               = new wxFlexGridSizer(2);
//         wxStaticText* txOpacity               = new wxStaticText(panel2, -1, wxString(_T("Op:")));
         wxFlexGridSizer *sizer8               = new wxFlexGridSizer(2);
         
           cbVisuActualCollection      -> SetToolTip( _T("Visu actual collection") );
           btnInsertCollectionBefore   -> SetToolTip( _T("+  Add group before") );
           btnInsertCollectionAfter    -> SetToolTip( _T("+>  Add group after") );
           btnDeleteCollection         -> SetToolTip( _T("-  Erase group") );
           btnResetCollection          -> SetToolTip( _T("-- Reset : Erase all groups") );
+          sCtrlRadio                  -> SetToolTip( _T("Radio")   );
+          sCtrlOpacity                -> SetToolTip( _T("Opacity") );
 
-          sdrOpacity                            = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS);
-//          wxStaticText* txRadio                 = new wxStaticText(panel2, -1, wxString(_T("R:")));
-          sdrRadio                              = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS);
-
-          sdrRadio                    -> SetToolTip( _T("Radio") );
-          sdrOpacity                  -> SetToolTip( _T("Opacity") );
+//          sdrOpacity                            = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS);
+//          sdrRadio                              = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS);
+//          sdrRadio                    -> SetToolTip( _T("Radio")   );
+//          sdrOpacity                  -> SetToolTip( _T("Opacity") );
+        
+          Connect(cbVisuActualCollection->GetId()   , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnVisuActualCollection     );
+          Connect(btnBackCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection           );
+          Connect(btnNextCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection           );
+          Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore   );
+          Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter    );
+          Connect(btnDeleteCollection->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection         );
         
-          Connect(btnBackCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection           );
-          Connect(btnNextCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection           );
-          Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore   );
-          Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter    );
-          Connect(btnDeleteCollection->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection         );
-          Connect(sdrOpacity->GetId()               , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints                );
-          Connect(sdrRadio->GetId()                 , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints                );
-          Connect(btnSaveCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections          );
-          Connect(btnLoadCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections          );
-          Connect(btnResetCollection->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnResetCollections         );
+//        Connect(sdrOpacity->GetId()               , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints               );
+//        Connect(sdrRadio->GetId()                 , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints               );
+          Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
+          Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
         
+          Connect(btnSaveCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections          );
+          Connect(btnLoadCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections          );
+          Connect(btnResetCollection->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnResetCollections         );
+          Connect(btnUndo->GetId()                  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo                      );
+          Connect(btnRedo->GetId()                  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo                      );
+
           sizer2->Add( btnBackCollection );
           sizer2->Add( btnNextCollection );
           sizer3->Add( btnInsertCollectionBefore );
           sizer4->Add( btnLoadCollection );
           sizer4->Add( btnSaveCollection );
 //          sizer5->Add( txRadio ,wxGROW );
-          sizer5->Add( sdrRadio ,wxGROW );
+//          sizer5->Add( sdrRadio ,wxGROW );
 //          sizer5->Add( txOpacity ,wxGROW );
-          sizer5->Add( sdrOpacity ,wxGROW );
-
-        /*
-        wxChoice *wxchoiceA = new wxChoice ( panel2 , -1, wxDefaultPosition,sizeButton2);
-        wxChoice *wxchoiceB = new wxChoice ( panel2 , -1, wxDefaultPosition,sizeButton2);
-        wxchoiceA->Append(_T("0") );
-        wxchoiceA->Append(_T("1") );
-        wxchoiceA->Append(_T("2") );
-        wxchoiceA->Append(_T("3") );
-        wxchoiceA->Append(_T("4") );
-        wxchoiceA->Append(_T("5") );
-        wxchoiceA->Append(_T("6") );
-        wxchoiceA->Append(_T("7") );
-        wxchoiceA->Append(_T("8") );
-        wxchoiceA->Append(_T("9") );
-        wxchoiceA->Append(_T("10") );
-        wxchoiceB->Append(_T("0%") );
-        wxchoiceB->Append(_T("10%") );
-        wxchoiceB->Append(_T("20%") );
-        wxchoiceB->Append(_T("30%") );
-        wxchoiceB->Append(_T("40%") );
-        wxchoiceB->Append(_T("50%") );
-        wxchoiceB->Append(_T("60%") );
-        wxchoiceB->Append(_T("70%") );
-        wxchoiceB->Append(_T("80%") );
-        wxchoiceB->Append(_T("90") );
-        wxchoiceB->Append(_T("100") );
-*/
+//          sizer5->Add( sdrOpacity ,wxGROW );
         
-        wxSpinCtrl *mwxSpinButtonA = new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
-        mwxSpinButtonA->SetRange(1,10);
-        mwxSpinButtonA->SetValue( 2 );
-        wxSpinCtrl *mwxSpinButtonB = new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
-        mwxSpinButtonB->SetRange(0,10);
-        mwxSpinButtonB->SetValue( 10 );
+          sizer5->Add( sCtrlRadio );
+          sizer5->Add( sCtrlOpacity );
 
-        
-//        sizer5a->Add( wxchoiceA ,wxGROW );
-//        sizer5a->Add( wxchoiceB ,wxGROW );
-        sizer5a->Add( mwxSpinButtonA ,wxGROW );
-        sizer5a->Add( mwxSpinButtonB ,wxGROW );
-
-        
           sizer6->Add( btnDeleteCollection );
           sizer6->Add( btnResetCollection );
         
-        sizer7->Add( cbVisuActualCollection  );
-        sizer7->Add( txtNrCollections );
+         sizer7->Add( cbVisuActualCollection );
+         sizer7->Add( txtNrCollections );
+
+         sizer8->Add( btnUndo        );
+         sizer8->Add( btnRedo        );
 
           sizer1->Add( sizer7 );
           sizer1->Add( sizer2 );
           sizer1->Add( sizer3 );
           sizer1->Add( sizer6 );
           sizer1->Add( sizer4 );
-          sizer1->Add( sizer5a );
+          sizer1->Add( sizer5 );
+          sizer1->Add( sizer8 );
 
-          sizer1->Add( sizer5 ,wxGROW );
+//          sizer1->Add( sizer5 ,wxGROW );
 
           MNPsizer                        = sizer1;
           panel2->SetSizer( MNPsizer );
         wxButton    *btnErasePoint          = new wxButton( panel, -1, _T("-")          ,   wxDefaultPosition, sizeButton );
 //             wxButton    *btnEraseLastPoint      = new wxButton( panel, -1, _T("- lst")      ,   wxDefaultPosition, sizeButton );
                wxButton    *btnDeleteAllPoints     = new wxButton( panel, -1, _T("--")         ,   wxDefaultPosition, sizeButton );
-        wxButton    *btnUndo                = new wxButton( panel, -1, _T("Undo")       ,   wxDefaultPosition, sizeButton );
-        wxButton    *btnRedo                = new wxButton( panel, -1, _T("Redo")       ,   wxDefaultPosition, sizeButton );
+        
+        wxButton    *btnUndo                = NULL;
+        wxButton    *btnRedo                = NULL;
+        
                wxButton    *btnSavePoints                  = NULL;
                wxButton    *btnLoadPoints                  = NULL;
                 
 
-        btnBackPoint        -> SetToolTip( _T("Select befor point")                        );
-        btnNextPoint        -> SetToolTip( _T("Select next point")                         );
+        btnBackPoint        -> SetToolTip( _T("Select befor point")                         );
+        btnNextPoint        -> SetToolTip( _T("Select next point")                          );
         cbAutoAddPoints     -> SetToolTip( _T("Auto Add point")                             );
         btnAddPoint         -> SetToolTip( _T("+  Add point")                               );
-        btnInsertPoint      -> SetToolTip( _T("(-)  Insert point")                          );
+        btnInsertPoint      -> SetToolTip( _T("(+)  Insert point")                          );
         btnMovePointUp      -> SetToolTip( _T("Move point Up in the normal direction")      );
         btnMovePointDown    -> SetToolTip( _T("Move point Down in the normal direction")    );
-
+        btnRenamePoint      -> SetToolTip( _T("Rename label for each point")                );
+        textCtrl            -> SetToolTip( _T("Point label")                                );
+        
+        
         btnErasePoint       -> SetToolTip( _T("-  Erase point")                             );
-//        btnEraseLastPoint   -> SetToolTip( _T("- lst  Erase last point")                    );
+//        btnEraseLastPoint   -> SetToolTip( _T("- lst  Erase last point")                  );
         btnDeleteAllPoints  -> SetToolTip( _T("-- Erase all points")                        );
         
                if ( mtype==0 )
                {
-                       btnSavePoints                           = new wxButton( panel, -1, _T("Save points"));
-                       btnLoadPoints                           = new wxButton( panel, -1, _T("Load points"));
-            Connect(btnSavePoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
-            Connect(btnLoadPoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
+            btnUndo             = new wxButton( panel, -1, _T("Undo")       ,   wxDefaultPosition, sizeButton   );
+            btnRedo             = new wxButton( panel, -1, _T("Redo")       ,   wxDefaultPosition, sizeButton   );
+                       btnSavePoints           = new wxButton( panel, -1, _T("Save")       ,   wxDefaultPosition, sizeButton   );
+                       btnLoadPoints       = new wxButton( panel, -1, _T("Load")       ,   wxDefaultPosition, sizeButton   );
+            Connect(btnSavePoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints    );
+            Connect(btnLoadPoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints    );
+            Connect(btnUndo->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo          );
+            Connect(btnRedo->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo          );
                } // if mtype
                txtNrPoints                                             = new wxStaticText(panel,-1, _T("   -/-"));
 
         if ( (mtype==0) || (mtype==3) )
         {
             //NTU: Sliders for opacity and radio change
-            txOpacity         = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
-            sdrOpacity        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-            txRadio           = new wxStaticText(panel, -1, wxString(_T("  Points Radius  ")));
-            sdrRadio          = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-            //NTU: Slider events
-            Connect(sdrOpacity->GetId()          , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
-            Connect(sdrRadio->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+//            txOpacity         = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
+//            sdrOpacity        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+//            txRadio           = new wxStaticText(panel, -1, wxString(_T("  Points Radius  ")));
+//            sdrRadio          = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+//            //NTU: Slider events
+//            Connect(sdrOpacity->GetId()          , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+//            Connect(sdrRadio->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+            
+            sCtrlRadio = new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+            sCtrlRadio->SetRange(1,10);
+            sCtrlRadio->SetValue( 2 );
+            sCtrlOpacity= new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+            sCtrlOpacity->SetRange(0,10);
+            sCtrlOpacity->SetValue( 10 );
+            Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
+            Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
+
+            
         } // if mtype 0 3
-        Connect(cbAutoAddPoints->GetId()    , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints);
-        Connect(btnBackPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint);
-        Connect(btnNextPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint);
-               Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
-               Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
-        Connect(btnMovePointUp->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp);
-        Connect(btnMovePointDown->GetId()   , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown);
-               Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
-               Connect(btnRenamePoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint);
-//             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(cbTrackPoint->GetId()       , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint);
-        Connect(btnUndo->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo);
-        Connect(btnRedo->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo);
+        Connect(cbAutoAddPoints->GetId()    , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints       );
+        Connect(btnBackPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint           );
+        Connect(btnNextPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint           );
+               Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint            );
+               Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint         );
+        Connect(btnMovePointUp->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp         );
+        Connect(btnMovePointDown->GetId()   , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown       );
+               Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint            );
+               Connect(btnRenamePoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint         );
+//             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(cbTrackPoint->GetId()       , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint          );
         wxFlexGridSizer *sizer0 = new wxFlexGridSizer(1);
         wxFlexGridSizer *sizer1 = new wxFlexGridSizer(2);
         wxFlexGridSizer *sizer2 = new wxFlexGridSizer(3);
         wxFlexGridSizer *sizer3 = new wxFlexGridSizer(2);
         wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
-        wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
+//        wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
         wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
         wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
         wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
         sizer4->Add( btnErasePoint          );
 //        sizer4->Add( btnEraseLastPoint    );
         sizer4->Add( btnDeleteAllPoints     );
-        sizer5->Add( btnUndo                );
-        sizer5->Add( btnRedo                );
+//        sizer5->Add( btnUndo                );
+//        sizer5->Add( btnRedo                );
         sizer6->Add( btnBackPoint           );
         sizer6->Add( btnNextPoint           );
         sizer7->Add( btnMovePointUp         );
                sizer0->Add(sizer3);
         sizer0->Add(sizer4);
         sizer0->Add(sizer1);
-        sizer0->Add(sizer5);
+  //      sizer0->Add(sizer5);
         if ( (mtype==0) || (mtype==3) )
         {
-            wxFlexGridSizer *sizer5 = new wxFlexGridSizer(1);
-            sizer5->Add(txRadio);
-            sizer5->Add(sdrRadio,1,wxGROW );
-            sizer5->Add(txOpacity);
-            sizer5->Add(sdrOpacity,1,wxGROW );
+            wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
+//            sizer5->Add(txRadio);
+//            sizer5->Add(sdrRadio,1,wxGROW );
+//            sizer5->Add(txOpacity);
+//            sizer5->Add(sdrOpacity,1,wxGROW );
+            
+            sizer5->Add( sCtrlRadio      );
+            sizer5->Add( sCtrlOpacity    );
+
+            
             sizer0->Add(sizer5);
+            
         }  // if mtype 0 3
         if ( mtype==0 )
                {
+            wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
             wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
-                       sizer6->Add(btnSavePoints);
-                       sizer6->Add(btnLoadPoints);
-            sizer0->Add(sizer6);
+                       sizer6->Add( btnSavePoints  );
+                       sizer6->Add( btnLoadPoints  );
+            sizer5->Add( btnUndo        );
+            sizer5->Add( btnRedo        );
+            sizer0->Add( sizer6         );
+            sizer0->Add( sizer5         );
                } // if mtype 0
                sizer = sizer0;
        }
                  txtNrPoints                                           = new wxStaticText(panel,-1, _T("-/-"));
 
                  //NTU: Sliders for opacity and radio change
+//          sdrRadio                            = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+//          sdrOpacity                        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+//          Connect(sdrOpacity->GetId()           , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+//          Connect(sdrRadio->GetId()             , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
                  wxStaticText* txOpacity                       = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
-                 sdrOpacity                                            = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
                  wxStaticText* txRadio                         = new wxStaticText(panel, -1, wxString(_T("  Points Radio  ")));
-                 sdrRadio                                                      = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+          
+          sCtrlRadio = new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+          sCtrlRadio->SetRange(1,10);
+          sCtrlRadio->SetValue( 2 );
+          sCtrlOpacity= new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
+          sCtrlOpacity->SetRange(0,10);
+          sCtrlOpacity->SetValue( 10 );
+          Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
+          Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
+
+          
                  Connect(btnSetPositionPoint->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
-                 Connect(sdrOpacity->GetId()           , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
-                 Connect(sdrRadio->GetId()             , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
 
           wxFlexGridSizer *sizer1           = new wxFlexGridSizer(1);
                  sizer1->Add(btnSetPositionPoint);
                  sizer1->Add(txtNrPoints);
                  sizer1->Add(txRadio);
-                 sizer1->Add(sdrRadio,1,wxGROW );
-          sizer1->Add(txOpacity);
-          sizer1->Add(sdrOpacity,1,wxGROW );
+                 //sizer1->Add(sdrRadio,1,wxGROW );
+          //sizer1->Add(sdrOpacity,1,wxGROW );
+          sizer1->Add(sCtrlRadio );
+          sizer1->Add(sCtrlOpacity);
                  sizer = sizer1;
          }
     
             panelParent->Layout();
         } // if sizer
     } // if mtype 4
+      
+      printf("WidgetShowNPoints::WidgetShowNPoints End\n");
+
 }
 
 //------------------------------------------------------------------------
@@ -474,7 +500,8 @@ void WidgetShowNPoints::SetRadio(double radio)
         lstModelShowNPoints[i]->SetRadio( radio );
     } // for i
        //NTU: For Slider
-       sdrRadio->SetValue(radio);
+//     sdrRadio->SetValue(radio);
+    sCtrlRadio->SetValue(radio);
 }
 
 //------------------------------------------------------------------------
@@ -512,7 +539,9 @@ void WidgetShowNPoints::SetOpacity(double opacity)
         lstViewShowNPoints[i]->mopacity = opacity;
     } // for i
        //NTU: For Slider
-       sdrOpacity->SetValue( opacity*100.0 );
+//     sdrOpacity->SetValue( opacity*100.0 );
+    sCtrlOpacity->SetValue( opacity*10.0 );
+
 }
 
 
@@ -1206,8 +1235,11 @@ void WidgetShowNPoints::UpdatePoints_()
     //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
     //RefreshPoints();
 
-    double opacity  = sdrOpacity->GetValue()/100.0;
-    double radio    = sdrRadio->GetValue();
+//    double opacity  = sdrOpacity->GetValue()/100.0;
+//    double radio    = sdrRadio->GetValue();
+    double opacity  = (sCtrlOpacity->GetValue()*10)/100.0;
+     double radio    = sCtrlRadio->GetValue();
+      
     int i,size      = lstViewShowNPoints.size();
     for (i=0 ; i<size ; i++)
     {
@@ -1362,12 +1394,14 @@ int WidgetShowNPoints::GetType()
 //------------------------------------------------------------------------
 double WidgetShowNPoints::GetRadio()
 {
-       return sdrRadio->GetValue();
+//     return sdrRadio->GetValue();
+    return sCtrlRadio->GetValue();
 }
 //------------------------------------------------------------------------
 double WidgetShowNPoints::GetOpacity()
 {
-       return sdrOpacity->GetValue()/100;
+//    return sdrOpacity->GetValue()/100;
+    return (sCtrlOpacity->GetValue()*10)/100.0;
 }
 
 //------------------------------------------------------------------------
@@ -1674,11 +1708,18 @@ void WidgetShowNPoints::RefreshColourCollection()
     {
         lstViewShowNPoints[i] -> mcolour    = colourAll;
         lstViewShowNPoints[i] -> ratioRadio = 1;
+        if (cbVisuActualCollection->GetValue()==true)
+        {
+            lstViewShowNPoints[i] -> mopacity   = 0.0;
+        } else {
+            lstViewShowNPoints[i] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
+        }
         lstViewShowNPoints[i]->RefreshEachPoint();
     } // for i
     
     // Actual collection
     lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
+    lstViewShowNPoints[mActualCollection] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
     lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.1;
     lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
     
@@ -1692,10 +1733,10 @@ void WidgetShowNPoints::RefreshColourCollection()
         colourActualPoint.push_back(0);
         colourActualPoint.push_back(1);
         double radio          = GetModelShowNPoints()->GetRadio();
-        lstViewShowNPoints[mActualCollection] -> mcolour = colourActualPoint;
+        lstViewShowNPoints[mActualCollection] -> mcolour  = colourActualPoint;
         lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt   );
         lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
-    }
+    } // if
     lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
 }
 
@@ -2074,3 +2115,11 @@ void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector<double> spc, s
         aux_mesh_type   = 0;
     }// if params size
 }
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnVisuActualCollection(wxCommandEvent &event)
+{
+    printf("EED WidgetShowNPoints::OnVisuActualCollection  \n");
+    RefreshCollectionText();
+    RefreshColourCollection();
+}
index 43620f53f3ce2a2a27b102b7a3f29fbe7a10e3cc..3f444fa785429d212f0f3f7035cf78c16e208dbc 100644 (file)
@@ -10,6 +10,7 @@
 #include <wx/slider.h>
 #include <wx/stattext.h>
 #include <wx/checkbox.h>
+#include <wx/spinctrl.h>
 
 #include "vtkPolyData.h"
 
@@ -55,6 +56,7 @@ class WidgetShowNPoints : public wxPanel
          virtual void UpdatePoints(wxCommandEvent &event);
       void UpdatePoints_();
 
+      void OnVisuActualCollection(wxCommandEvent &event);
       void InsertCollection();
       void InsertCollectionBefore_();
       void OnInsertCollectionBefore_();
@@ -87,8 +89,6 @@ class WidgetShowNPoints : public wxPanel
       void OnMovePointUp(wxCommandEvent& event);
       void OnMovePointDown(wxCommandEvent& event);
 
-    
-
       void RefreshCollectionText();
       void RefreshColourCollection();
       void InvertLstPoints_();
@@ -123,7 +123,7 @@ class WidgetShowNPoints : public wxPanel
     virtual void  SetOutputBox();
     bool          ErasePoint(int id);
 
-    void            SetAuxMesh(vtkPolyData* , std::vector<double> spc, std::vector<double> params);
+    void          SetAuxMesh(vtkPolyData* , std::vector<double> spc, std::vector<double> params);
     
     std::vector<double>       GetLstPointsX();
     std::vector<double>       GetLstPointsY();
@@ -135,14 +135,19 @@ class WidgetShowNPoints : public wxPanel
   private:
         std::vector<ViewShowNPoints*>   lstViewShowNPoints;
         //NTU: For updating points
-        wxStaticText                       * askPointLabel;
-        wxTextCtrl                         * textCtrl;
-        wxStaticText                    * txtNrCollections;
-        wxStaticText                       * txtNrPoints;
-        wxSlider                           * sdrOpacity;
-        wxSlider                           * sdrRadio;
-        wxCheckBox                      * cbTrackPoint;
-        wxCheckBox                      * cbAutoAddPoints;
+        wxStaticText                       *askPointLabel;
+        wxTextCtrl                         *textCtrl;
+        wxStaticText                    *txtNrCollections;
+        wxStaticText                       *txtNrPoints;
+    
+//        wxSlider                             *sdrOpacity;
+//        wxSlider                             *sdrRadio;
+        wxSpinCtrl                      *sCtrlRadio;
+        wxSpinCtrl                      *sCtrlOpacity;
+
+        wxCheckBox                      *cbTrackPoint;
+        wxCheckBox                      *cbAutoAddPoints;
+        wxCheckBox                      *cbVisuActualCollection;
 
         std::vector<ModelShowNPoints*>  lstModelShowNPoints;
         int                                                        mtype;
@@ -155,6 +160,7 @@ class WidgetShowNPoints : public wxPanel
         vtkPolyData                     *aux_mesh;
         std::vector<double>             aux_mesh_spc;
         int                             aux_mesh_type;
+    
 };