]> Creatis software - creaMaracasVisu.git/commitdiff
#3588 ShowNPoints Erase point with Unselection vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Mar 2026 15:25:06 +0000 (16:25 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Mar 2026 15:25:06 +0000 (16:25 +0100)
16 files changed:
bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx
bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h
bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx
bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h
bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx
bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/InteractorStyleMaracas.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyle3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx

index 6415f74e20113d7e8bbedd3ab7d86516704b371e..f02c3a2584ef157610fac3ba43388874134a8680 100644 (file)
@@ -8,36 +8,23 @@ namespace bbcreaMaracasVisu
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,InteractorStyleMaracas_Model)
 BBTK_BLACK_BOX_IMPLEMENTATION(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox);
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void InteractorStyleMaracas_Model::Process()
 {
-// THE MAIN PROCESSING METHOD BODY
-//   Here we simply set the input 'In' value to the output 'Out'
-//   And print out the output value
-// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
-//    void bbSet{Input|Output}NAME(const TYPE&)
-//    const TYPE& bbGet{Input|Output}NAME() const 
-//    Where :
-//    * NAME is the name of the input/output
-//      (the one provided in the attribute 'name' of the tag 'input')
-//    * TYPE is the C++ type of the input/output
-//      (the one provided in the attribute 'type' of the tag 'input')
-//    bbSetOutputOut( bbGetInputIn() );
-//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-  
-    if (bbGetInputInteractorStyleMaracas()!=NULL)  { bbGetInputInteractorStyleMaracas() ->SetActive( bbGetInputActive() ); }
+    if (bbGetInputInteractorStyleMaracas() !=NULL)  { bbGetInputInteractorStyleMaracas() ->SetActive( bbGetInputActive() ); }
     if (bbGetInputInteractorStyleMaracas2()!=NULL) { bbGetInputInteractorStyleMaracas2()->SetActive( bbGetInputActive() ); }
     if (bbGetInputInteractorStyleMaracas3()!=NULL) { bbGetInputInteractorStyleMaracas3()->SetActive( bbGetInputActive() ); }
     if (bbGetInputInteractorStyleMaracas4()!=NULL) { bbGetInputInteractorStyleMaracas4()->SetActive( bbGetInputActive() ); }
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void InteractorStyleMaracas_Model::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
     bbSetInputActive(true);
@@ -46,32 +33,29 @@ void InteractorStyleMaracas_Model::bbUserSetDefaultValues()
     bbSetInputInteractorStyleMaracas3(NULL);
     bbSetInputInteractorStyleMaracas4(NULL);
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void InteractorStyleMaracas_Model::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    if any
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void InteractorStyleMaracas_Model::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaMaracasVisu
+
+}// EO namespace bbcreaMaracasVisu
 
 
index b9f1c8ea883bdfa12019cdd667e9e3b5a7db4d9f..bd6e9011a321d0de1ea4cf3c08f8f5504ffdd373 100644 (file)
 
 #include "InteractorStyleMaracas.h"
 
-
 namespace bbcreaMaracasVisu
 {
 
 class bbcreaMaracasVisu_EXPORT InteractorStyleMaracas_Model
- : 
-   public bbtk::AtomicBlackBox
+:
+public bbtk::AtomicBlackBox
 {
-  BBTK_BLACK_BOX_INTERFACE(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox);
-//===== 
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//===== 
-  BBTK_DECLARE_INPUT(Active,bool);
-  BBTK_DECLARE_INPUT(InteractorStyleMaracas,InteractorStyleMaracas*);
-  BBTK_DECLARE_INPUT(InteractorStyleMaracas2,InteractorStyleMaracas*);
-  BBTK_DECLARE_INPUT(InteractorStyleMaracas3,InteractorStyleMaracas*);
-  BBTK_DECLARE_INPUT(InteractorStyleMaracas4,InteractorStyleMaracas*);
-//  BBTK_DECLARE_OUTPUT(Out,double);
-  BBTK_PROCESS(Process);
-  void Process();
-//===== 
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//===== 
+    BBTK_BLACK_BOX_INTERFACE(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox);
+    //=====
+    // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+    //=====
+    BBTK_DECLARE_INPUT(Active,bool);
+    BBTK_DECLARE_INPUT(InteractorStyleMaracas,InteractorStyleMaracas*);
+    BBTK_DECLARE_INPUT(InteractorStyleMaracas2,InteractorStyleMaracas*);
+    BBTK_DECLARE_INPUT(InteractorStyleMaracas3,InteractorStyleMaracas*);
+    BBTK_DECLARE_INPUT(InteractorStyleMaracas4,InteractorStyleMaracas*);
+    //  BBTK_DECLARE_OUTPUT(Out,double);
+    BBTK_PROCESS(Process);
+    void Process();
+    //=====
+    // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+    //=====
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox);
@@ -40,21 +39,19 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox)
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-
   BBTK_INPUT(InteractorStyleMaracas_Model,Active,"(default true)",bool,"");
   BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas,"InteractorStyleMaracas",InteractorStyleMaracas*,"");
   BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas2,"InteractorStyleMaracas2",InteractorStyleMaracas*,"");
   BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas3,"InteractorStyleMaracas3",InteractorStyleMaracas*,"");
-  BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas4,"InteractorStyleMaracas4",InteractorStyleMaracas*,"");
+BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas4,"InteractorStyleMaracas4",InteractorStyleMaracas*,"");
 
 //  BBTK_OUTPUT(InteractorStyleMaracas_Model,Out,"First output",double,"");
 
 BBTK_END_DESCRIBE_BLACK_BOX(InteractorStyleMaracas_Model);
-//===== 
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//===== 
-}
-// EO namespace bbcreaMaracasVisu
+//=====
 
+}// EO namespace bbcreaMaracasVisu
 #endif // __bbcreaMaracasVisuInteractorStyleMaracas_Model_h_INCLUDED__
 
index 5ff880d38e0f06cb463db3dd38b530691268b76a..5f4962726c3ffcb85c6fa9a4a6ebca00af1ab139 100644 (file)
@@ -1161,8 +1161,13 @@ void ShowNPoints_Tools::Process()
         } // if Type
         if (bbGetInputType()==40)
         {
-            bbGetInputWidgetShowNPoints()->OnErasePoint_();
+            bbGetInputWidgetShowNPoints()->OnErasePoint_(false);
         } // if Type
+        if (bbGetInputType()==41)
+        {
+            bbGetInputWidgetShowNPoints()->OnErasePoint_(true);
+        } // if Type
+
         if (bbGetInputType()==50)
         {
             bbGetInputWidgetShowNPoints()->OnDeleteAllPoints_();
index 7c4634450f3a3448874bfa6f995b3c703cfb1477..6a8694ff3b09e01d4018153a155b74fd9384f672 100644 (file)
@@ -73,7 +73,7 @@ BBTK_CATEGORY("empty");
   BBTK_INPUT(ShowNPoints_Tools,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,"");
   BBTK_INPUT(ShowNPoints_Tools,Spacing,"(default [1,1,1] )Spacing",std::vector<double>,"");
   BBTK_INPUT(ShowNPoints_Tools,Mesh,"Mesh en format vtkPolyData ",vtkPolyData*,"");
-  BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add points   5:Add Point  10:Insert Point  20:TrackPoint  30:Set nearest point  35:Set Label to actual point  40:Erase point  50:Deleta all points  100:Insert  group after   110:Delete group  120:Reset collection  200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points)   205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points)   210: Invert points   220: Move patch center (param is the step ex [-1] or [1])      230: Move point in normal of surface (Params [-1] or [1])       235: ChangeCurrentPoint (Params [-1] or [1])  240: Join all start-end points to the start-end points on selected spline  250: Set Mesh SPC (Params: [0]:Patch [1]:CloseSpline1 [2]:CloseSpline2)   300: Create expanded surface   310: Create wide expanded surface     320: Expand Surface,   330: Widen surface,   340: Expand patch,   400: Separate and Order Splines given a rotation origin,   500:Load collection (ParamStr filenaname.xls   501:Save collection (ParamStr filenaname.xls)",int,"");
+  BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add points   5:Add Point  10:Insert Point  20:TrackPoint  30:Set nearest point  35:Set Label to actual point  40:Erase point  41:Erase point and Unselect point  50:Deleta all points  100:Insert  group after   110:Delete group  120:Reset collection  200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points)   205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points)   210: Invert points        220: Move patch center (param is the step ex [-1] or [1])      230: Move point in normal of surface (Params [-1] or [1])       235: ChangeCurrentPoint (Params [-1] or [1])  240: Join all start-end points to the start-end points on selected spline  250: Set Mesh SPC (Params: [0]:Patch [1]:CloseSpline1 [2]:CloseSpline2)   300: Create expanded surface   310: Create wide expanded surface     320: Expand Surface,   330: Widen surface,   340: Expand patch,   400: Separate and Order Splines given a rotation origin,   500:Load collection (ParamStr filenaname.xls   501:Save collection (ParamStr filenaname.xls)",int,"");
   BBTK_INPUT(ShowNPoints_Tools, Params,"Optional params for the tools, (type:200): normal and direction, (type:235):step, (type:320): centroid and direction, (type:330): normal and direction, (type:340): centroid and direction,    (type:400): reference point", std::vector<double>,"");
 BBTK_INPUT(ShowNPoints_Tools, ParamsStr,"Optional params for the tools, required for 35:New Label  500:filename.xls", std::vector<std::string>,"");
 
index 3e3ba0d6bdcbc06d4367586a5f2de5861b0942cf..642a4c3667017d56d58daa3205f4b1d3bac896e4 100644 (file)
@@ -33,15 +33,16 @@ class InteractorwxVtkBaseView : public InteractorwxVtkBaseView_model
     public:
         InteractorwxVtkBaseView( wxVtkBaseView_Info *box );
         ~InteractorwxVtkBaseView();
-        virtual bool    OnLeftButtonDown();
-        virtual bool    OnLeftButtonUp();
-        virtual bool    OnMouseMove();
-        virtual bool    OnRightButtonDown();
-        virtual bool    OnRightButtonUp();
-        virtual bool    OnMiddleButtonDown();
-        virtual bool    OnMiddleButtonUp();
-        virtual bool    OnLeftDClick();
-        virtual bool    OnRightDClick();
+        virtual bool  OnChar();
+        virtual bool  OnLeftButtonDown();
+        virtual bool  OnLeftButtonUp();
+        virtual bool  OnMouseMove();
+        virtual bool  OnRightButtonDown();
+        virtual bool  OnRightButtonUp();
+        virtual bool  OnMiddleButtonDown();
+        virtual bool  OnMiddleButtonUp();
+        virtual bool  OnLeftDClick();
+        virtual bool  OnRightDClick();
 private:
         wxVtkBaseView_Info      *_box;
         bool                    flagDrag;
@@ -57,6 +58,21 @@ InteractorwxVtkBaseView::~InteractorwxVtkBaseView()
 {
 }
 
+bool InteractorwxVtkBaseView::OnChar()
+{
+    if (_box!=NULL)
+    {
+        if ( (_box->bbGetInputInteractionType()==20 ) && (_wxvtkbaseview!=NULL) )
+        {
+            printf("EED InteractorwxVtkBaseView::OnChar \n");
+            _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+            _box->bbSignalOutputModification();
+            return false;
+        }
+    } // if _box
+    return true;
+}
+
 bool InteractorwxVtkBaseView::OnLeftButtonDown()
 {
     if (_box!=NULL)
@@ -278,6 +294,14 @@ void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
             bbSetOutputNormal( lstNormal );
             
             bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
+            
+            int systelCtrlKey = wxvtkbaseview->GetInteractorStyleBaseView()->GetInteractor()->GetControlKey();
+            int systelKeyCode = wxvtkbaseview->GetInteractorStyleBaseView()->GetInteractor()->GetKeyCode();
+            std::vector<char> lstKeyboard;
+            lstKeyboard.push_back(systelCtrlKey);
+            lstKeyboard.push_back(systelKeyCode);
+            bbSetOutputKeyboard( lstKeyboard );
+            
         }  // BaseData
     } // if wxvtkbaseview
 }
@@ -369,12 +393,19 @@ void wxVtkBaseView_Info::bbUserSetDefaultValues()
     bbSetOutputvtkRenderer(NULL);
     bbSetInputWithEventPropagation(false);
     interactorwxvtkbaseview     = NULL;
+    interactorwxvtkbaseview1    = NULL;
     interactorwxvtkbaseview2    = NULL;
     interactorwxvtkbaseview3    = NULL;
     bbSetOutputInteractorwxVtkBaseView_model(   interactorwxvtkbaseview  );
     bbSetOutputInteractorwxVtkBaseView_model1(  interactorwxvtkbaseview1 );
     bbSetOutputInteractorwxVtkBaseView_model2(  interactorwxvtkbaseview2 );
     bbSetOutputInteractorwxVtkBaseView_model3(  interactorwxvtkbaseview3 );
+    
+    std::vector<char> lstKeyboard;
+    lstKeyboard.push_back(-1);
+    lstKeyboard.push_back(-1);
+    bbSetOutputKeyboard(lstKeyboard);
+    
 }
 
 //===== 
index 9ba6116b21fefcd06f3a4e9718d0fbc24296cb7f..1c4a2ee06044e71ac921db83ae1834babd0f1180 100644 (file)
@@ -51,6 +51,7 @@ class bbcreaMaracasVisu_EXPORT wxVtkBaseView_Info
     BBTK_DECLARE_OUTPUT(Point,std::vector<double>);
     BBTK_DECLARE_OUTPUT(PointMouse,std::vector<double>);
     BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
+    BBTK_DECLARE_OUTPUT(Keyboard,std::vector<char>);
     BBTK_DECLARE_OUTPUT(InteractorwxVtkBaseView_model,InteractorwxVtkBaseView_model*);
     BBTK_DECLARE_OUTPUT(InteractorwxVtkBaseView_model1,InteractorwxVtkBaseView_model*);
     BBTK_DECLARE_OUTPUT(InteractorwxVtkBaseView_model2,InteractorwxVtkBaseView_model*);
@@ -83,7 +84,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
   BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView1,"Used in case of InteractionType!=0",wxVtkBaseView*,"");
   BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView2,"Used in case of InteractionType!=0",wxVtkBaseView*,"");
   BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView3,"Used in case of InteractionType!=0",wxVtkBaseView*,"");
-  BBTK_INPUT(wxVtkBaseView_Info,InteractionType,"(default 0) 0:Nothing 1:LeftButtonDown 2:LeftButtonUp 3:MouseMove 4:RightButtonDown 5:RightButtonUp 6:LeftDClick 7:RightDClick 8:DragLeft 9:DragRight 10:MiddleButtonDown 11:MiddleButtonUp  12:DragMiddle ",int,"");
+  BBTK_INPUT(wxVtkBaseView_Info,InteractionType,"(default 0) 0:Nothing 1:LeftButtonDown 2:LeftButtonUp 3:MouseMove 4:RightButtonDown 5:RightButtonUp 6:LeftDClick 7:RightDClick 8:DragLeft 9:DragRight 10:MiddleButtonDown 11:MiddleButtonUp  12:DragMiddle 20:Char",int,"");
   BBTK_INPUT(wxVtkBaseView_Info,WithEventPropagation,"(default false)  (In LeftDClick envet)  false:No Event propagation  true:With event propagation",bool,"");
 
   BBTK_OUTPUT(wxVtkBaseView_Info,Direction,"Direction -1=3D 0=YZ  1=XZ  2=XY(default)",int,"");
@@ -94,6 +95,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
   BBTK_OUTPUT(wxVtkBaseView_Info,Point,"Axis positon of the viewer",std::vector<double>,"");
   BBTK_OUTPUT(wxVtkBaseView_Info,PointMouse,"Actual Point Mouse",std::vector<double>,"");
   BBTK_OUTPUT(wxVtkBaseView_Info,Normal,"Normal of plane viewe",std::vector<double>,"");
+  BBTK_OUTPUT(wxVtkBaseView_Info,Keyboard,"default [-1 -1] : [ctrl keycode]",std::vector<char>,"");
   BBTK_OUTPUT(wxVtkBaseView_Info,InteractorwxVtkBaseView_model,"Interactor wxVtkBaseView Model", InteractorwxVtkBaseView_model* ,"");
   BBTK_OUTPUT(wxVtkBaseView_Info,InteractorwxVtkBaseView_model1,"Interactor wxVtkBaseView Model", InteractorwxVtkBaseView_model* ,"");
   BBTK_OUTPUT(wxVtkBaseView_Info,InteractorwxVtkBaseView_model2,"Interactor wxVtkBaseView Model", InteractorwxVtkBaseView_model* ,"");
index 043c8e45635b820860cd51805aa3984148dd8478..c913b290193d43d1a8e44ba34b503c69811260ee 100644 (file)
@@ -34,6 +34,7 @@ InteractorStyleMaracas::InteractorStyleMaracas()
        _active                                         = true;
        _vtkInteractorStyleBaseView     = NULL;
 }
+
 //---------------------------------------------------------------------------
 InteractorStyleMaracas::~InteractorStyleMaracas()
 {
@@ -95,21 +96,25 @@ bool InteractorStyleMaracas::OnMiddleButtonUp() //virtual
 {
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool InteractorStyleMaracas::OnMiddleDClick() //virtual
 {
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool InteractorStyleMaracas::OnRightButtonDown() //virtual
 {
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool InteractorStyleMaracas::OnRightButtonUp() //virtual
 {
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool InteractorStyleMaracas::OnRightDClick() //virtual
 {
index 0bfb9cca3f78e15a98abb67dae806319c5cc9341..65848b2d9d247eeaea14e1f2cea436aef7d04c95 100644 (file)
@@ -484,3 +484,9 @@ void ModelShowNPoints::SetIdCurrentPoint(int idPoint)
         if (idCurrentPoint>=GetLstPointsSize() ) {idCurrentPoint=GetLstPointsSize()-1; }
     } // if Size==0
 }
+
+//----------------------------------------------------------------------
+void ModelShowNPoints::ForceIdCurrentPoint(int idPoint)
+{
+    idCurrentPoint=idPoint;
+}
index de99605fb688282b1331b2f7427b579051d19306..fdfa552383c421da02286a2533d31a558c0d34dd 100644 (file)
@@ -50,6 +50,7 @@ class ModelShowNPoints
       void                             InversLstPoints();
       int                                                      GetIdCurrentPoint();
       void                          SetIdCurrentPoint(int idPoint);
+      void                          ForceIdCurrentPoint(int idPoint);
 
        private:
          std::vector<double>           lstPointsX;
index a4b66bd6b968818c2a51b1a70fff5cbfcbb3fb2c..f6301e7ce23fade1788793cab70f4d4b4733f433 100644 (file)
@@ -1159,7 +1159,7 @@ void WidgetShowNPoints::StopTrackPoint( )
        }
 
 //------------------------------------------------------------------------
-    void WidgetShowNPoints::OnErasePoint_()
+    void WidgetShowNPoints::OnErasePoint_(bool forceUnselectPoint)
     {
         StopAutoAddPoints();
         StopTrackPoint();
@@ -1168,6 +1168,10 @@ void WidgetShowNPoints::StopTrackPoint( )
         UndoRedo_SaveCollection(); //A
         if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
         {
+            if (forceUnselectPoint==true)
+            {
+                GetModelShowNPoints()->ForceIdCurrentPoint(-1);
+            } // if forceUnselectPoint
             SetOutputBox();
             // EED 2022-05-19
             //renderer->GetRenderWindow()->Render();
@@ -1182,7 +1186,7 @@ void WidgetShowNPoints::StopTrackPoint( )
 //------------------------------------------------------------------------
        void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
        {
-               OnErasePoint_();
+               OnErasePoint_(false);
        }
 
 //------------------------------------------------------------------------
@@ -1710,21 +1714,26 @@ void WidgetShowNPoints::DetectCollectionActive()
     RefreshColourCollection();
 }
 
-
-
-
 //------------------------------------------------------------------------
 void WidgetShowNPoints::RefreshColourCollection()
 {
     UpdatePoints_();
     std::vector<double> colourAll;
-    colourAll.push_back(0);
-    colourAll.push_back(1);
-    colourAll.push_back(1);
+    // magenta
+    colourAll.push_back(0.5);
+    colourAll.push_back(0.9);
+    colourAll.push_back(0.9);
     std::vector<double> colourActualGroup;
-    colourActualGroup.push_back(1);
-    colourActualGroup.push_back(0);
-    colourActualGroup.push_back(0);
+    // red
+//    colourActualGroup.push_back(1);
+//    colourActualGroup.push_back(0.4);
+//    colourActualGroup.push_back(0.4);
+    // red
+    colourActualGroup.push_back(0.8);
+    colourActualGroup.push_back(0.4);
+    colourActualGroup.push_back(0.4);
+
+    
     // For all collections
     SetColour( colourAll );
     int sizeLstPoints;
@@ -1745,9 +1754,10 @@ void WidgetShowNPoints::RefreshColourCollection()
             if ((curPnt>=0)  && (curPnt<sizeLstPoints  ) )
             {
                 std::vector<double> colourActualPoint;
-                colourActualPoint.push_back(1);
-                colourActualPoint.push_back(1);
-                colourActualPoint.push_back(0);
+                // yellow
+                colourActualPoint.push_back(1.0);
+                colourActualPoint.push_back(1.0);
+                colourActualPoint.push_back(0.2);
                 double radio          = GetModelShowNPoints()->GetRadio();
                 lstViewShowNPoints[mActualCollection] -> mcolour  = colourActualPoint;
                 lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt   );
index 2c633a251665351cf8e4371ab4e295b562c5a2bd..9679b9cc3d6af68a446fa11fe1a010057db42530 100644 (file)
@@ -44,7 +44,7 @@ class WidgetShowNPoints : public wxPanel
 
       void OnRenamePoint_(std::string label);
          void OnRenamePoint(wxCommandEvent& event);
-      void OnErasePoint_();
+      void OnErasePoint_(bool forceUnselectPoint);
          void OnErasePoint(wxCommandEvent& event);
          void OnEraseLastPoint(wxCommandEvent &event); 
       void DeleteAllPoints_();
index bb9225fb011013a92d09b3c1c91825d97f23bcaa..7dfe74e97d133fafcced919b3a126e290565dff9 100644 (file)
 #include "vtkPointPicker.h"
 #include "UtilVtk3DGeometriSelection.h"
 
+//---------------------------------------------------------------------------
 vtkInteractorStyle3DView::vtkInteractorStyle3DView()
 {
 }
+
 //---------------------------------------------------------------------------
 vtkInteractorStyle3DView::~vtkInteractorStyle3DView()
 {
 }
+
 //---------------------------------------------------------------------------
 bool vtkInteractorStyle3DView::OnLeftDClick()
 {
        SelectMarchibCubePoint();
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
 {
@@ -64,23 +68,19 @@ bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
        pp( 0 ) = pickPoint[ 0 ]; pp( 1 ) = pickPoint[ 1 ]; pp( 2 ) = pickPoint[ 2 ];
     cp( 0 ) = cameraPos[ 0 ]; cp( 1 ) = cameraPos[ 1 ]; cp( 2 ) = cameraPos[ 2 ];
 
-
 //EED 27 sep 2006  (1/2)
 //     wxVtkMPR3DView *wxvtkmpr3Dview = (wxVtkMPR3DView *)_vtkInteractorStyleBaseView->GetWxVtk3DBaseView();
 //     double spc[3];
 //     wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetSpacing(spc);
 
-
        vtkImageData *imageData = GetWxVtkMPR3DView()->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
        int dim[3];
        double spc[3];
        imageData->GetDimensions(dim);
        imageData->GetSpacing(spc);
 
-
        vtkMarchingCubes *mcubes = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetMCubes(0);
        
-
        UtilVtk3DGeometriSelection utilVtk3DGeometriSelection;
        utilVtk3DGeometriSelection.SetDimentions(dim[0],dim[1],dim[2]);
 
@@ -89,7 +89,6 @@ bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
     double fac;
     fac = GTM_MAX( dim[0], dim[2] );
 
-
     if( utilVtk3DGeometriSelection.FindCubePointsFromPoints(
       pO.GetAnsiRef( ), pF.GetAnsiRef( ),
       pp.GetAnsiRef( ), cp.GetAnsiRef( ) )  ) 
@@ -117,25 +116,27 @@ bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
                        }
                }
        }
-
-
        return ok;
 }
+
 //-------------------------------------------------------------------
 void vtkInteractorStyle3DView::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
 {
        _wxvtkmpr3Dview = wxvtkmpr3Dview;
 }
+
 //-------------------------------------------------------------------
 wxVtkMPR3DView *vtkInteractorStyle3DView::GetWxVtkMPR3DView()
 {
        return _wxvtkmpr3Dview;
 }
+
 //-------------------------------------------------------------------
 wxVtkClipping3DView *vtkInteractorStyle3DView::GetWxVtkClipping3DView()
 {
        return _wxvtkclipping3Dview;
 }
+
 //-------------------------------------------------------------------
 void vtkInteractorStyle3DView::SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview)
 {
index 844af945200d2b775cc55a4c63a5e51ea331e192..becd5626528c16e0c4631e57e06dd63720efb412 100644 (file)
@@ -210,7 +210,7 @@ void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type)
                                }
                        }
                        if (type==10)
-                       {  // OnMiddleButtonUp
+                       {  // OnChar
                                if (intStyMar->OnChar()==false)
                                {
                                        i=size;
@@ -258,7 +258,7 @@ void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type)
 }
 
 //---------------------------------------------------------------------------
-void  vtkInteractorStyleBaseView::OnChar()  // virtual 
+void vtkInteractorStyleBaseView::OnChar()  // virtual 
 {    
 //     char a=GetInteractor()->GetKeyCode();
        CallLstInteractorStyleMaracas(10);
@@ -344,11 +344,13 @@ void vtkInteractorStyleBaseView::SetParent_refresh_waiting()
 {
        _parent_refresh_waiting=true;
 }
+
 //---------------------------------------------------------------------------
 bool vtkInteractorStyleBaseView::GetParent_refresh_waiting()
 {
        return _parent_refresh_waiting;
 }
+
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::EvaluateToRefresh()
 {
@@ -380,11 +382,13 @@ void vtkInteractorStyleBaseView::EvaluateToRefresh()
                }//if
        }//if _blockRefresh
 }
+
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::BlockRefresh()
 {
        _blockRefresh=true;
 }
+
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::UnBlockRefresh()
 {
index cc0f1a3d39d6abc095661234c459370f67445847..80e6f97648e84b84a2768bed80bab4d71200128f 100644 (file)
 vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
 
 //---------------------------------------------------------------------------
-vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
+vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D()
+{
 }
+
 //---------------------------------------------------------------------------
-vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
+vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D()
+{
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnRightButtonDown ()
 {    
@@ -46,31 +50,28 @@ void  vtkInteractorStyleBaseView3D::OnRightButtonDown ()
                        this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
                }
 */
-  this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
+    this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
                           this->Interactor->GetEventPosition()[1]);
 
-  if (this->CurrentRenderer == NULL)
+    if (this->CurrentRenderer == NULL)
     {
-    return;
-    }
-
-  if (this->Interactor->GetControlKey()) {
-      this->StartDolly();
-  }
+        return;
+    } // if renderer
 
+    if (this->Interactor->GetControlKey()) {
+        this->StartDolly();
+    } //  if Control key
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnRightButtonUp () 
 {
        vtkInteractorStyleBaseView::OnRightButtonUp();
-
 /*
                if (GetInteractor()->GetControlKey()==1 ){
                        this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
                }
 */
-
-               
   switch (this->State) 
     {
     case VTKIS_DOLLY:
@@ -78,6 +79,7 @@ void  vtkInteractorStyleBaseView3D::OnRightButtonUp ()
       break;
     }
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnMouseMove () 
 {
@@ -96,7 +98,6 @@ void  vtkInteractorStyleBaseView3D::OnMouseMove ()
  // int dx = rwi->GetEventPosition()[0] ; // JPRx
  // int dy = rwi->GetEventPosition()[1] ; // JPRx
 
-
   switch (this->State) 
     {
     case VTKIS_ROTATE:
@@ -123,10 +124,8 @@ void  vtkInteractorStyleBaseView3D::OnMouseMove ()
  //     this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
       break;
     }
-
-
-
 }
+
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
 {
@@ -140,7 +139,6 @@ void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
                }
 */
 
-
   this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 
                           this->Interactor->GetEventPosition()[1]);
   if (this->CurrentRenderer == NULL)
@@ -148,79 +146,40 @@ void vtkInteractorStyleBaseView3D::OnLeftButtonDown()
     return;
     }
 
-       
        if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
        {
                this->vtkInteractorStyleImage::OnLeftButtonDown();
        }
        
-       
   if (this->Interactor->GetControlKey()) {
       this->StartPan();
   } else {
       this->StartRotate();
   }
-
-       
-       
-
- /* 
-  if (this->Interactor->GetShiftKey()) 
-    {
-    if (this->Interactor->GetControlKey()) 
-      {
-      this->StartDolly();
-      }
-    else 
-      {
-      this->StartPan();
-      }
-    } 
-  else 
-    {
-    if (this->Interactor->GetControlKey()) 
-      {
-      this->StartSpin();
-      }
-    else 
-      {
-      this->StartRotate();
-      }
-    }
-*/
-
-
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnLeftButtonUp () 
 {
-       vtkInteractorStyleBaseView::OnLeftButtonUp();
-
-/*
-               if (GetInteractor()->GetControlKey()==1 ){
-                       this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
-               } else {
-                       this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
-               }
-*/
-  switch (this->State) 
+    vtkInteractorStyleBaseView::OnLeftButtonUp();
+    switch (this->State)
     {
-
-    case VTKIS_PAN:
-      this->EndPan();
-      break;
-
-    case VTKIS_ROTATE:
-      this->EndRotate();
-      break;
-    }
+        case VTKIS_PAN:
+            this->EndPan();
+            break;
+        case VTKIS_ROTATE:
+            this->EndRotate();
+            break;
+    } // switch
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnMiddleButtonDown () 
 {
        vtkInteractorStyleBaseView::OnMiddleButtonDown();
        //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
 }
+
 //---------------------------------------------------------------------------
 void  vtkInteractorStyleBaseView3D::OnMiddleButtonUp () 
 {
@@ -229,7 +188,6 @@ void  vtkInteractorStyleBaseView3D::OnMiddleButtonUp ()
        //              this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
 }
 
-
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView3D::OnMouseWheelForward () // virtual
 {
index 6d0a49887898133faabac910712a32bfc6214100..5a5a6dfdd81a57adeeebadfb16c7454f4505efb5 100644 (file)
@@ -33,6 +33,7 @@ vtkInteractorStyleMPRView::vtkInteractorStyleMPRView()
        _stateMoveAxisY = false;
        _stateMoveAxisZ = false;
 }
+
 //---------------------------------------------------------------------------
 vtkInteractorStyleMPRView::~vtkInteractorStyleMPRView()
 {
@@ -89,13 +90,12 @@ bool  vtkInteractorStyleMPRView::OnLeftButtonDown ()
        _xBack=xx;      
        _yBack=yy;
 */
-
        _stateMoveAxisX = wxvtkmpr2Dview->IfMouseTouchX(x,y,z);
        _stateMoveAxisY = wxvtkmpr2Dview->IfMouseTouchY(x,y,z);
        _stateMoveAxisZ = wxvtkmpr2Dview->IfMouseTouchZ(x,y,z);
-
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool  vtkInteractorStyleMPRView::OnLeftButtonUp () 
 {
@@ -113,13 +113,14 @@ bool  vtkInteractorStyleMPRView::OnLeftButtonUp ()
        }
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool  vtkInteractorStyleMPRView::OnMouseMove () 
 {
        double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
        double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
-       double z=1;
-       _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);            
+       double z = 1;
+       _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
        wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
 //     wxvtkmpr2Dview->TransfromCoordViewWorld(x,y,z);
        wxvtkmpr2Dview->ChangeAxisColor(x,y,z);
index f4826a17314b555074f8e8df9437e0628e7a7771..109783902f2e454c78d3f1bc94be2e722b0f02fd 100644 (file)
@@ -112,7 +112,8 @@ class vtkWindowLevelImagePlaneWidgetCallback : public vtkCommand
                           isbv->SetParent_refresh_waiting();
                           isbv->EvaluateToRefresh();
                   }
-          } // Execute
+
+       } // Execute
                vtkWindowLevelImagePlaneWidgetCallback(){}
                wxVtkMPR3DView *_wxvtkmpr3Dview;
 };
@@ -344,32 +345,32 @@ void wxVtkMPR3DView::Configure()
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::ConfigureFreePlanes()
 {
-       // The shared picker enables us to use 3 planes at one time
-       // and gets the picking order right
-       vtkCellPicker* picker = vtkCellPicker::New();
-       picker->SetTolerance(0.005);
-       // The 3 image plane widgets
-       _planeWidgetX = GetPlaneWidget('x', 1, 0, 0, picker);
-       _planeWidgetY = GetPlaneWidget('y', 1, 1, 0, picker);
-       _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker);
-       _planeWidgetY->SetLookupTable(_planeWidgetX->GetLookupTable());
-       _planeWidgetZ->SetLookupTable(_planeWidgetX->GetLookupTable());
-       picker->UnRegister(NULL);
-
-       // ColorWindow ColorLevel Callback
-       vtkWindowLevelImagePlaneWidgetCallback *wlipwc  = vtkWindowLevelImagePlaneWidgetCallback::New();
-       wlipwc->_wxvtkmpr3Dview                                                 = this;
-       _planeWidgetX->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
-       _planeWidgetY->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
-       _planeWidgetZ->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
-       
-       // Cursor Callback
-       _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc );
-       _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc );
-       _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc );      
+    // The shared picker enables us to use 3 planes at one time
+    // and gets the picking order right
+    vtkCellPicker* picker = vtkCellPicker::New();
+    picker->SetTolerance(0.005);
+    // The 3 image plane widgets
+    _planeWidgetX = GetPlaneWidget('x', 1, 0, 0, picker);
+    _planeWidgetY = GetPlaneWidget('y', 1, 1, 0, picker);
+    _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker);
+    
+    _planeWidgetY->SetLookupTable(_planeWidgetX->GetLookupTable());
+    _planeWidgetZ->SetLookupTable(_planeWidgetX->GetLookupTable());
+    picker->UnRegister(NULL);
+    
+    // ColorWindow ColorLevel Callback
+    vtkWindowLevelImagePlaneWidgetCallback *wlipwc     = vtkWindowLevelImagePlaneWidgetCallback::New();
+    wlipwc->_wxvtkmpr3Dview                                                    = this;
+    _planeWidgetX->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+    _planeWidgetY->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+    _planeWidgetZ->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+    // Cursor Callback
+    _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc );
+    _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc );
+    _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc );
+    
 }
 
-
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::SetImage()
 {
@@ -384,7 +385,6 @@ void wxVtkMPR3DView::SetImage()
        _probe->SetSource( imageData );
 #else
 
-
 //     double colorWindow      = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
 //     double colorLevel       = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
 
@@ -733,19 +733,19 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible)
 //showOutlineActor(false);
                        // step 1, step 2
                        vtkActorCollection *tmpCollection    = vtkActorCollection::New();
-                       vtkActorCollection *collectionActors =  _wxvtk3Dbaseview->GetRenderer()->GetActors();
+                       vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors();
                        int i,size=collectionActors->GetNumberOfItems();
                        for (i=0; i<size; i++)
                        {
                                tmpCollection->AddItem ( (vtkActor*)collectionActors->GetItemAsObject(0)  );                    
-                               _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
                        } // for
                        // step 3
                        _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition)  );
                        // step 4
                         for (i=0; i<size; i++)
                        {
-                               _wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
+                _wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
                        } // for
                        tmpCollection->Delete();
                        // step 5 Refresh