]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
#3525 ShowNPoints Actual Visu collection option
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
index f42c078d8d738fae2f0f21a1b5481395ba92b30b..c5b080843b2745bd1237be6e83fefa5a3bcd0b05 100644 (file)
                     cbAutoAddPoints         = new wxCheckBox(panel,-1, _T("Auto")       ,   wxDefaultPosition, sizeButton );
         wxButton    *btnMovePointUp         = new wxButton( panel, -1, _T("<-")         ,   wxDefaultPosition, sizeButton );
         wxButton    *btnMovePointDown       = new wxButton( panel, -1, _T("->")         ,   wxDefaultPosition, sizeButton );
-
         wxButton    *btnSetPositionPoint    = new wxButton( panel, -1, _T("Set")        ,   wxDefaultPosition, sizeButton );
                      cbTrackPoint           = new wxCheckBox(panel,-1, _T("Tra.")       ,   wxDefaultPosition, sizeButton );
         wxButton    *btnRenamePoint                = new wxButton( panel, -1, _T("Ren.")       ,   wxDefaultPosition, sizeButton );
         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                = NULL;
         wxButton    *btnRedo                = NULL;
-        
                wxButton    *btnSavePoints                  = NULL;
                wxButton    *btnLoadPoints                  = NULL;
-                
-
         btnBackPoint        -> SetToolTip( _T("Select befor point")                         );
         btnNextPoint        -> SetToolTip( _T("Select next point")                          );
         cbAutoAddPoints     -> SetToolTip( _T("Auto Add point")                             );
         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")                  );
         btnDeleteAllPoints  -> SetToolTip( _T("-- Erase all points")                        );
-        
                if ( mtype==0 )
                {
             btnUndo             = new wxButton( panel, -1, _T("Undo")       ,   wxDefaultPosition, sizeButton   );
             Connect(btnRedo->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo          );
                } // if mtype
                txtNrPoints                                             = new wxStaticText(panel,-1, _T("   -/-"));
-
         wxStaticText* txOpacity;
         wxStaticText* txRadio;
         if ( (mtype==0) || (mtype==3) )
         sizer7->Add( btnMovePointDown       );
         sizer8->Add( cbAutoAddPoints        );
         sizer8->Add( txtNrPoints            );
-
         //             sizer0->Add(askPointLabel); // JPR
         sizer0->Add(sizer8);
         sizer0->Add(sizer6);
 //            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 )
                {
           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);
-
           wxFlexGridSizer *sizer1           = new wxFlexGridSizer(1);
                  sizer1->Add(btnSetPositionPoint);
                  sizer1->Add(txtNrPoints);
@@ -699,7 +682,6 @@ void WidgetShowNPoints::OnInsertPoint_()
     }
     RefreshCollectionText();
     RefreshColourCollection();
-
     UndoRedo_SaveCollection();
 }
 
@@ -1045,11 +1027,15 @@ void WidgetShowNPoints::TrackingPoint( )
 {
     if ( cbTrackPoint->GetValue() == true )
     {
-        int id = GetModelShowNPoints()->IdInsidePoint();
-        if (id>=0)
-        {
-            idTrack=id;
-        }
+//        int id = GetModelShowNPoints()->IdInsidePoint();
+//        if (id>=0)
+//        {
+//            idTrack=id;
+//        }
+        
+//       int idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
+        int idTrack = GetModelShowNPoints()->GetNearestPoint();
+
         
         if (idTrack>=0)
         {
@@ -1077,12 +1063,12 @@ void WidgetShowNPoints::OnTrackPoint_()
 {
     StopAutoAddPoints();
 
-    idTrack         =   -1;
+//    idTrack         =   -1;
     if ( cbTrackPoint->GetValue() == true )
     {
         // EED 2023-06-23
 //        idTrack = GetModelShowNPoints()->IdInsidePoint();
-        idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
+//        idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
     } // if trackPointFlag
 }
 
@@ -1096,7 +1082,7 @@ void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
 void WidgetShowNPoints::StopTrackPoint( )
 {
     cbTrackPoint->SetValue(false);
-    idTrack=-1;
+//    idTrack=-1;
 }
 
 //------------------------------------------------------------------------
@@ -2007,6 +1993,18 @@ std::vector<int> WidgetShowNPoints::GetLstIndexs()
     }
     return lstIndexs;
 }
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstSelectedIndexs()
+{
+    std::vector<int> lstSelectedIndexs;
+    if ( (cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true) )
+    {
+        lstSelectedIndexs.push_back( mActualCollection );
+    }
+    return lstSelectedIndexs;
+}
+
 //------------------------------------------------------------------------
 int WidgetShowNPoints::GetLstModelShowNPointsSize()
 {