From: eduardo.davila@creatis.insa-lyon.fr Date: Tue, 3 Mar 2026 15:25:06 +0000 (+0100) Subject: #3588 ShowNPoints Erase point with Unselection X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=0f2ff481498fe5f554ec69271fecae55e3f4386e;p=creaMaracasVisu.git #3588 ShowNPoints Erase point with Unselection --- diff --git a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx index 6415f74..f02c3a2 100644 --- a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx +++ b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx @@ -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 = " <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 diff --git a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h index b9f1c8e..bd6e901 100644 --- a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h +++ b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h @@ -10,29 +10,28 @@ #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__ diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx index 5ff880d..5f49627 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx @@ -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_(); diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h index 7c46344..6a8694f 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h @@ -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,""); 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,""); BBTK_INPUT(ShowNPoints_Tools, ParamsStr,"Optional params for the tools, required for 35:New Label 500:filename.xls", std::vector,""); diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx index 3e3ba0d..642a4c3 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx @@ -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 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 lstKeyboard; + lstKeyboard.push_back(-1); + lstKeyboard.push_back(-1); + bbSetOutputKeyboard(lstKeyboard); + } //===== diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h index 9ba6116..1c4a2ee 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h @@ -51,6 +51,7 @@ class bbcreaMaracasVisu_EXPORT wxVtkBaseView_Info BBTK_DECLARE_OUTPUT(Point,std::vector); BBTK_DECLARE_OUTPUT(PointMouse,std::vector); BBTK_DECLARE_OUTPUT(Normal,std::vector); + BBTK_DECLARE_OUTPUT(Keyboard,std::vector); 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,""); BBTK_OUTPUT(wxVtkBaseView_Info,PointMouse,"Actual Point Mouse",std::vector,""); BBTK_OUTPUT(wxVtkBaseView_Info,Normal,"Normal of plane viewe",std::vector,""); + BBTK_OUTPUT(wxVtkBaseView_Info,Keyboard,"default [-1 -1] : [ctrl keycode]",std::vector,""); 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* ,""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/InteractorStyleMaracas.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/InteractorStyleMaracas.cxx index 043c8e4..c913b29 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/InteractorStyleMaracas.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/InteractorStyleMaracas.cxx @@ -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 { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx index 0bfb9cc..65848b2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx @@ -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; +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h index de99605..fdfa552 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h @@ -50,6 +50,7 @@ class ModelShowNPoints void InversLstPoints(); int GetIdCurrentPoint(); void SetIdCurrentPoint(int idPoint); + void ForceIdCurrentPoint(int idPoint); private: std::vector lstPointsX; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index a4b66bd..f6301e7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -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 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 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 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 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index 2c633a2..9679b9c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -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_(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyle3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyle3DView.cxx index bb9225f..7dfe74e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyle3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyle3DView.cxx @@ -28,19 +28,23 @@ #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) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx index 844af94..becd562 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx @@ -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() { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx index cc0f1a3..80e6f97 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView3D.cxx @@ -31,11 +31,15 @@ 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 { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx index 6d0a498..5a5a6df 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx @@ -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); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index f4826a1..1097839 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -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; iAddItem ( (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; iGetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); + _wxvtk3Dbaseview->GetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); } // for tmpCollection->Delete(); // step 5 Refresh