]> Creatis software - creaMaracasVisu.git/commitdiff
#3563 Group Selection Points in manual contour
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 30 Oct 2024 10:09:49 +0000 (11:09 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 30 Oct 2024 10:09:49 +0000 (11:09 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourControler.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualPoint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.h

index d0e98d0a28c072b03d1b5dc76770ff63e246dfa9..e4e1d3531a048fde6bfc9890d74fba2e409a56f3 100644 (file)
@@ -94,16 +94,14 @@ bool manualContourBaseControler::OnChar()
                // Delete Point
                if ((keyCode==8) || (keyCode==127))
                {
-
                        if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
                        {
                                DeleteActualMousePoint(X,Y);
-                       }
+                DeleteGroupSelectedPoints();
+            }
                        GetManualViewBaseContour()->Refresh();
                        this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-               }
-               else
-               {
+               } else {
                        // Magnet
                        if (keyCode==32)
                        {
@@ -157,12 +155,13 @@ bool manualContourBaseControler::OnChar()
                                {
                                        GetManualViewBaseContour()->Refresh();
                                        this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-                               }
-                       }
-               }
+                               } // if
+                       } // if !Editable
+               } // if code 8 or 127
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMouseMove()
 {
@@ -180,6 +179,7 @@ bool manualContourBaseControler::OnMouseMove()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnLeftButtonDown()
 {
@@ -195,6 +195,7 @@ bool manualContourBaseControler::OnLeftButtonDown()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnLeftButtonUp()
 {
@@ -208,6 +209,7 @@ bool manualContourBaseControler::OnLeftButtonUp()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnLeftDClick()
 {
@@ -222,6 +224,7 @@ bool manualContourBaseControler::OnLeftDClick()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMiddleButtonDown()
 {
@@ -236,11 +239,13 @@ bool manualContourBaseControler::OnMiddleButtonDown()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMiddleButtonUp()
 {
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnRightButtonDown()
 {
@@ -255,22 +260,26 @@ bool manualContourBaseControler::OnRightButtonDown()
        }
        return true;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnRightButtonUp()
 {
        return true;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetModelView(manualBaseModel *manContModel, manualViewBaseContour *manViewBaseCont){
        _manContModel           =       manContModel;
        _manViewBaseCont        =       manViewBaseCont;
        _manViewBaseCont->SetEditable( &_editable );
 }
+
 // ----------------------------------------------------------------------------
 manualBaseModel* manualContourBaseControler::GetManualContourModel()
 {
        return _manContModel;
 }
+
 // ----------------------------------------------------------------------------
 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
 {
@@ -279,15 +288,15 @@ manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
 {
-
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseClickRight(int x, int y)
 {
        SetCompleteCreation( true );
        SetKeyBoardMoving( false );
        this->GetManualContourModel()->SetCloseContour(true);
-
+    this->GetManualViewBaseContour()->SetAllGroupSelectedPoint(false);
 //     if (_state==1)
 //     {
 //             _state=0;
@@ -295,23 +304,40 @@ void manualContourBaseControler::MouseClickRight(int x, int y)
        SetEditable( false );
        SetPosibleToMove( false );
        _state = 0;
-
 //EED 24Avril2009      _state=7;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
 {
        if (_state==5){ _state = 0; }
        if (_state==6){ _state = 0; }
-       if (_state==7){ _state = 0; }
-       SetMoving( false );
-       GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
-       if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1)  )
-       {
-               SetEditable( false );
-               SetPosibleToMove( false );
-       }
+    if (_state==9){ _state = 8; }
+    
+    if ((_state!=7) && (_state!=8))
+    {
+        SetMoving( false );
+        GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
+        if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1)  )
+        {
+            SetEditable( false );
+            SetPosibleToMove( false );
+        }
+    } else {
+        _state = 0;
+        int id, manualPointsSZ;
+        manualPointsSZ = _manContModel->GetSizeLstPoints();
+        for ( id=0; id<manualPointsSZ    ; id++ )
+        {
+            if (_manViewBaseCont->GetGroupSelectedPoint( id ) == true ) 
+            {
+                _state = 8;
+                id = manualPointsSZ;
+            }
+       } // for
+    } // if _state  !=7  !=8
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseDLeft(int x, int y )
 {
@@ -326,25 +352,30 @@ void manualContourBaseControler::MouseDLeft(int x, int y )
                }
        } // if _state==0
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseMove(int x, int y) // virtual
 {
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetState(int state)
 {
        _state=state;
 }
+
 // ----------------------------------------------------------------------------
 int manualContourBaseControler::GetState()
 {
        return _state;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::IsEditable( )
 {
        return _editable;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetEditable(  bool condition  )
 {
@@ -363,16 +394,19 @@ bool manualContourBaseControler::GetPosibleToMove()
 {
        return _posibleToMove;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetPosibleToMove( bool condition )
 {
        _posibleToMove = condition;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::IsMoving()
 {
        return _moving;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetMoving( bool condition )
 {
@@ -383,11 +417,13 @@ void manualContourBaseControler::SetCompleteCreation( bool condition )
 {
        _created = condition;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::GetIfCompleteCreation ( )
 {
        return _created;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
 {
@@ -398,6 +434,7 @@ bool manualContourBaseControler::GetKeyBoardMoving(  )
 {
        return _keyBoardMoving;
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::CreateNewManualContour(){
        _manViewBaseCont->CreateNewContour();
@@ -406,8 +443,8 @@ void manualContourBaseControler::CreateNewManualContour(){
 int    manualContourBaseControler::GetNumberOfPointsManualContour(){
        return _manViewBaseCont->GetNumberOfPoints();
 }
-// ----------------------------------------------------------------------------
 
+// ----------------------------------------------------------------------------
 //JSTG - 25-02-08 -------------------------------------------------------------
 int    manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
        //return _manViewBaseCont->GetNumberOfPointsSpline();
@@ -422,11 +459,13 @@ double* manualContourBaseControler::GetVectorPointsXManualContour(){
 double* manualContourBaseControler::GetVectorPointsYManualContour(){
        return _manViewBaseCont->GetVectorPointsYManualContour();
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::DeleteContour(){
        _manViewBaseCont->DeleteContour();
        _manContModel->DeleteAllPoints();
 }
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
 {
@@ -441,6 +480,39 @@ void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
        _state = 0;
 }
 
+// ----------------------------------------------------------------------------
+void manualContourBaseControler::DeleteGroupSelectedPoints()
+{
+    if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
+    {
+        // Erasing points (leaving minimum 2 points)
+        bool groupSelected;
+        int id, manualPointsSZ;
+        manualPointsSZ = _manContModel->GetSizeLstPoints();
+        for ( id=manualPointsSZ-1; id>=0    ; id-- )
+        {
+            groupSelected = _manViewBaseCont->GetGroupSelectedPoint( id );
+            if (groupSelected == true)
+            {
+                if (_manContModel->GetSizeLstPoints()>2) 
+                {
+                    _manContModel->DeletePoint( id );
+                    _manViewBaseCont->DeletePoint( id );
+                } // if > 2
+            } // if groupSelected
+        } // for
+        
+        // change state of GroupSelectionPoing
+        manualPointsSZ = _manContModel->GetSizeLstPoints();
+        for ( id=0; id<manualPointsSZ    ; id++ )
+        {
+            _manViewBaseCont->SetGroupSelectedPoint( id,false );
+        } // for
+        
+    }
+    _state = 0;
+}
+
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::Magnet(int x, int y)
 {
index 4fece95ed380c68131eeb03d8b0a99c2c93ba6b5..01d3596043d6718fdcb168a25c8152a8479b8121 100644 (file)
 #include "vtkPolyDataMapper.h"
 #include "vtkInteractorObserver.h"
 #include "vtkInteractorStyleImage.h"
-#include <vtkKochanekSpline.h> 
-
-#include <vtkCellPicker.h> 
-
-
+#include <vtkKochanekSpline.h>
+#include <vtkCellPicker.h>
 #include <vtkCamera.h> 
 #include <vtkPolyLine.h>
 #include <vtkDataSetMapper.h>
 #include <vtkUnstructuredGrid.h>
-
 #include <vtkActor.h>
 #include <vtkProperty.h>
-
 #include <vtkCellArray.h>
 #include <vtkRenderer.h>
 #include <vtkCoordinate.h>
 //#include "widgets/UtilVtk3DGeometriSelection.h"
 #include "UtilVtk3DGeometriSelection.h"
 //#include "widgets/InteractorStyleMaracas.h"
-#include "InteractorStyleMaracas.h"
 
+#include "InteractorStyleMaracas.h"
 #include "creawxVTKRenderWindowInteractor.h"
-
-
 //--
-
 #include <vector>
 #include "wxVtkBaseView.h"
 #include "marTypes.h"
-
 #include "manualContourModel.h"
 #include "manualViewBaseContour.h"
 
-
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -109,29 +99,30 @@ public:
        virtual void    MouseMove(int x, int y);
        virtual void    MouseReleaseLeft(int x, int y);
 
-       void    SetState(int state);
-       int             GetState();
-       bool    IsEditable();
+       void            SetState(int state);
+       int                     GetState();
+       bool            IsEditable();
        virtual void    SetEditable(  bool condition  );
-       bool    GetPosibleToMove();
-       void    SetPosibleToMove(  bool condition  );
-       bool    IsMoving();
-       void    SetMoving(  bool condition  );
-       void    SetCompleteCreation( bool condition );
-       bool    GetIfCompleteCreation ( );
-       void    SetKeyBoardMoving( bool condition );
-       bool    GetKeyBoardMoving(  );
+       bool            GetPosibleToMove();
+       void            SetPosibleToMove(  bool condition  );
+       bool            IsMoving();
+       void            SetMoving(  bool condition  );
+       void            SetCompleteCreation( bool condition );
+       bool            GetIfCompleteCreation ( );
+       void            SetKeyBoardMoving( bool condition );
+       bool            GetKeyBoardMoving(  );
        
-       void    CreateNewManualContour();
-       int             GetNumberOfPointsManualContour();
-       int             GetNumberOfPointsSplineManualContour();
-       void    DeleteContour();
+       void            CreateNewManualContour();
+       int                     GetNumberOfPointsManualContour();
+       int                     GetNumberOfPointsSplineManualContour();
+       void            DeleteContour();
        virtual void    DeleteActualMousePoint(int x, int y );
-       double* GetVectorPointsXManualContour();
-       double* GetVectorPointsYManualContour();
+    void            DeleteGroupSelectedPoints();
+       double*         GetVectorPointsXManualContour();
+       double*         GetVectorPointsYManualContour();
        
 
-       void    SetZ(int z);
+       void            SetZ(int z);
        virtual int             GetZ();
 
        // VIRTUAL - Adds a point in an specified position
@@ -148,31 +139,22 @@ public:
 
                        void    Magnet(int x, int y);
        virtual void    ResetContour();
-
-       virtual void Configure();
-
+       virtual void    Configure();
 
 //EED Borrame
 //     virtual manualContourBaseControler * Clone( manualViewBaseContour * cloneView = NULL, manualContourModel * cloneModel = NULL );
-
-
 protected:
-       
        // Reference to the contour or element view 
        manualViewBaseContour   *_manViewBaseCont;
-
        // Reference to the model contour or element model 
        manualBaseModel         *_manContModel;
-
-       int                                             _z;
-       int                                             _state;
-       bool                                    _editable;      
-       bool                                    _posibleToMove;
-       bool                                    _moving;
-       bool                                    _created;
-       bool                                    _keyBoardMoving;
-               
-}; 
-
+       int                                     _z;
+       int                                     _state;
+       bool                            _editable;
+       bool                            _posibleToMove;
+       bool                            _moving;
+       bool                            _created;
+       bool                            _keyBoardMoving;
+};
 
 #endif // manualContourBaseControler_h
index 863d6d95bad0bab01c9f8ef6acf8a161beaebd64..0f61932dae29e8b8658930d43561733d91384717 100644 (file)
@@ -33,7 +33,9 @@
 // _state = 1  // move with add point
 // _state = 5  // move
 // _state = 6  // move with insert point
-// _state = 7  // move with non selection
+// _state = 7  // mouse down moving for select group of points
+// _state = 8  // After (7) waiting with group of points all ready selected
+// _state = 9  // After (8) moving group of points
 
 manualContourControler::manualContourControler()
 {
@@ -99,7 +101,7 @@ void manualContourControler::MouseClickLeft(int x, int y)
                        AddPoint(x,y,z);
                        _bakIdPoint=GetNumberOfPointsManualContour() - 1;
                }
-               // Insert Control Points IF Contour si Selected
+               // Insert Control Points IF Contour is Selected
                if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
                {
                        ok=true;
@@ -120,7 +122,22 @@ void manualContourControler::MouseClickLeft(int x, int y)
                        //ok=true;
                        _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                        SetState(7);
+            GetManualViewBaseContour()->InitRectangleSelection(x,y,z);
                }
+        
+        // If nothing selected _state=8
+        if (GetState()==8)
+        {
+            _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+            if (_bakIdPoint==-1 )
+            {
+                SetState(7);
+                GetManualViewBaseContour()->InitRectangleSelection(x,y,z);
+            } else {
+                SetState(9);
+                GetManualViewBaseContour()->InitGroupSelectionPointsToBeMove(_bakIdPoint);
+            } // point selected
+        }
        }else{
                SetPosibleToMove( true );
                GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
@@ -138,6 +155,7 @@ void manualContourControler::MouseClickLeft(int x, int y)
                GetManualViewBaseContour()->Refresh();
        }
 }
+
 // ----------------------------------------------------------------------------
 void manualContourControler::MouseMove(int x, int y) // virtual
 {
@@ -146,22 +164,37 @@ void manualContourControler::MouseMove(int x, int y) // virtual
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        if (GetState()==1){     SetPoint( _bakIdPoint , x , y ,z); }
        if (GetState()==5){     SetPoint( _bakIdPoint , x , y ,z); }
+
+    if (GetState()==9){ GetManualViewBaseContour()->SetNewPositionGroupSelectedPoints( x,y,z );  }
+
+    
        if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
        {
                GetManualViewBaseContour()->MoveContour(x,y,z);
-       }
-       if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
+       } // if State 6
+    
+       if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() )
+    {
                GetManualViewBaseContour()->Refresh();
                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-       }
-       if (!IsEditable())
+       } /// if State !=7
+
+    if (GetState()==7 )
+    {
+        GetManualViewBaseContour()->SelectPointsInRectangleRegion(x,y,z);
+        GetManualViewBaseContour()->Refresh();
+        this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+    } /// if State ==7
+
+    
+    if (!IsEditable())
        {
                GetManualViewBaseContour()->RemoveControlPoints();
 //             GetManualViewBaseContour()->RemoveTextActor();
                GetManualViewBaseContour()->Refresh();
                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-       }
-
+       }  // if editable
+    
 }
 
 // ----------------------------------------------------------------------------
@@ -170,21 +203,21 @@ void manualContourControler::MouseDLeft( int x, int y)//virtual
        manualContourBaseControler::MouseDLeft( x, y);
        if ( IsEditable() )
        {
-
                GetManualViewBaseContour()->AddControlPoints();
                GetManualViewBaseContour()->AddTextActor();
                GetManualViewBaseContour()->Refresh();
                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
        }
 }
+
 // ----------------------------------------------------------------------------
 void manualContourControler::SetEasyCreation(bool easyCreation)
 {
        _easyCreation=easyCreation;
 }
+
 // ----------------------------------------------------------------------------
 bool manualContourControler::GetEasyCreation()
 {
        return _easyCreation;
 }
-
index 82990a64328c3589082766a318016816e8f86255..6a532b11d7fed57978d89390b064da159a4560c4 100644 (file)
@@ -39,21 +39,21 @@ manualPoint::~manualPoint()
 }
 // ----------------------------------------------------------------------------
 void manualPoint::SetPoint(double x,double y,double z){
-       _x=x;
-       _y=y;
-       _z=z;
+       _x = x;
+       _y = y;
+       _z = z;
 }
 // ----------------------------------------------------------------------------
 void manualPoint::SetPointX(double x){
-       _x=x;
+       _x = x;
 }
 // ----------------------------------------------------------------------------
 void manualPoint::SetPointY(double y){
-       _y=y;
+       _y = y;
 }
 // ----------------------------------------------------------------------------
 void manualPoint::SetPointZ(double z){
-       _z=z;
+       _z = z;
 }
 // ----------------------------------------------------------------------------
 double manualPoint::GetX(){
index f356db286a0edc9d7046a831cb4dca4a4d813cbf..09c847b671bd567f7c6c5fad91bf650f7fe19d05 100644 (file)
@@ -527,6 +527,35 @@ void manualViewBaseContour::SelectPoint(int i, bool select)
        _lstViewPoints[i]->SetSelected(select);
 }
 
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetGroupSelectedPoint(int i, bool select)
+{
+    _lstViewPoints[i]->SetGroupSelected(select);
+}
+
+// ----------------------------------------------------------------------------
+bool manualViewBaseContour::GetGroupSelectedPoint(int i)
+{
+    if ( (i>=0) && (i<_lstViewPoints.size()) )
+    {
+        return _lstViewPoints[i]->GetGroupSelected();
+    } else {
+        return false;
+    }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::SetAllGroupSelectedPoint( bool select)
+{   int i,size=_lstViewPoints.size();
+    for (i=0; i<size; i++)
+    {
+        this->SetGroupSelectedPoint( i, select );
+    }
+}
+
+
+
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::SelectLstPoints()
 {
@@ -828,15 +857,15 @@ void manualViewBaseContour::UpdateColorActor()
 // ----------------------------------------------------------------------------
 int    manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
 {
-       int ii = -1;
+       int id = -1;
        if (_manContModel!=NULL){
                double xx = x;
                double yy = y;
                double zz = z;
                TransfromCoordViewWorld(xx,yy,zz);
-               ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
+               id=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
        }
-       return ii;
+       return id;
 }
 
 // ----------------------------------------------------------------------------
@@ -1061,3 +1090,27 @@ void manualViewBaseContour::SetSpacing(double spc[3])
        _spc[1] = spc[1];
        _spc[2] = spc[2];
 }
+
+//EED 2024-10-25
+//-------------------------------------------------------------------
+void manualViewBaseContour::InitRectangleSelection(int x, int y, int z)
+{
+    _RectangleStartX = x;
+    _RectangleStartY = y;
+    _RectangleStartZ = z;
+}
+
+//-------------------------------------------------------------------
+void manualViewBaseContour::SelectPointsInRectangleRegion(int x,int y,int z) // virtual
+{
+}
+
+//-------------------------------------------------------------------
+void manualViewBaseContour::InitGroupSelectionPointsToBeMove(int id)  // virtual
+{    
+}
+
+//-------------------------------------------------------------------
+void manualViewBaseContour::SetNewPositionGroupSelectedPoints(  int x , int y ,int z)  // virtual
+{
+}
index be5976a1d1c2c059b0758856218f77089f15e9e9..20870f4eabae79c0c371ec6eb8a1df2ec58b57f2 100644 (file)
@@ -27,7 +27,6 @@
 #define manualViewBaseContour_h
 
 #include "vtkRenderWindow.h"
-
 #include "vtkRenderer.h"
 #include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
 #include "vtkCommand.h"
@@ -37,7 +36,6 @@
 #include "vtkInteractorObserver.h"
 #include "vtkInteractorStyleImage.h"
 #include <vtkKochanekSpline.h>
-
 #include <vtkActor.h>
 #include <vtkProperty.h>
 #include <vtkCellArray.h>
@@ -49,9 +47,7 @@
 #include <vtkPointPicker.h>
 //#include "widgets/UtilVtk3DGeometriSelection.h"
 #include "UtilVtk3DGeometriSelection.h"
-#include <vtkCellPicker.h> 
-
-
+#include <vtkCellPicker.h>
 #include <vtkCamera.h> 
 #include <vtkPolyLine.h>
 #include <vtkDataSetMapper.h>
 
 #include "creawxVTKRenderWindowInteractor.h"
 
-
 //--
-
 #include <vector>
 #include "wxVtkBaseView.h"
 #include "marTypes.h"
-
 #include "manualViewPoint.h"
 #include "manualContourModel.h"
 
@@ -84,55 +77,49 @@ class creaMaracasVisu_EXPORT manualViewBaseContour
 public:
        manualViewBaseContour();
        virtual ~manualViewBaseContour();
-
-       virtual int GetType();
-       virtual void Save(FILE *pFile);
-       virtual void Open(FILE *pFile);
-
-       void    AddPoint();
+       virtual int     GetType();
+       virtual void    Save(FILE *pFile);
+       virtual void    Open(FILE *pFile);
+       void            AddPoint();
        virtual void    AddPoint( manualViewPoint * manualViewPoint );
-       void    InsertPoint(int id);
-       void    DeleteContour();
-       void    DeletePoint(int x, int y,int z);
+       void            InsertPoint(int id);
+       void            DeleteContour();
+       void            DeletePoint(int x, int y,int z);
        virtual void    DeletePoint(int id);
-
        virtual void    UpdateViewPoint(int id);
        virtual void    UpdateViewPoints();
-
-       void    SetSelected(bool selected);
-       void    SetPosibleSelected(bool posibleSelected);
-       bool    GetSelected();
-       bool    GetPosibleSelected();
-       void    DeleteSelectedPoints();
-       bool    GetEditable();
-       void    SetEditable( bool * condition );
-
-
-
+       void            SetSelected(bool selected);
+       void            SetPosibleSelected(bool posibleSelected);
+    void            SetGroupSelectedPoint(int i, bool select);
+    void            SetAllGroupSelectedPoint(bool select);
+
+       bool            GetSelected();
+       bool            GetPosibleSelected();
+    bool            GetGroupSelectedPoint(int i);
+
+    void               DeleteSelectedPoints();
+       bool            GetEditable();
+       void            SetEditable( bool * condition );
        virtual int             GetIdPoint(int x, int y, int z);
-
-       void    SelectPoint(int i,bool select);
-       void    SelectLstPoints();
-       void    SelectAllPoints(bool select);
+       void            SelectPoint(int i,bool select);
+       void            SelectLstPoints();
+       void            SelectAllPoints(bool select);
        virtual int             SelectPosiblePoint(int x, int y ,int z);
-       bool    SelectPosibleContour(int x, int y ,int z);
-       void    SelectAllPossibleSelected(bool select);
-       void    SetPointSelected(int id,bool select);
-       void    SetPointPosibleSelected(int id,bool select);
-       void    SetIfViewControlPoints(bool ifShow);
-       bool    GetIfViewControlPoints();
-       
-       void    UnSelectPoint(int i);
-       void    UnSelectLstPoints();
-       void    UnSelectAllPoints();
-
-       void    SetModel(manualBaseModel *manContModel);
-       void    SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
-
+       bool            SelectPosibleContour(int x, int y ,int z);
+       void            SelectAllPossibleSelected(bool select);
+       void            SetPointSelected(int id,bool select);
+       void            SetPointPosibleSelected(int id,bool select);
+       void            SetIfViewControlPoints(bool ifShow);
+       bool            GetIfViewControlPoints();
+       void            UnSelectPoint(int i);
+       void            UnSelectLstPoints();
+       void            UnSelectAllPoints();
+       void            SetModel(manualBaseModel *manContModel);
+       void            SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
        virtual void    Refresh();
-       int             GetNumberOfPoints();                                            // ??? 
-       //int   GetNumberOfPointsSpline();                                      //JSTG 25-02-08 In ContourModel is the same method 
-       //void  SetNumberOfPointsSpline(int size);                      //JSTG 25-02-08 In ContourModel is the same method 
+       int                     GetNumberOfPoints();                                            // ???
+       //int           GetNumberOfPointsSpline();                                      //JSTG 25-02-08 In ContourModel is the same method
+       //void  SetNumberOfPointsSpline(int size);                      //JSTG 25-02-08 In ContourModel is the same method
 
        void    CreateNewContour();
        double* GetVectorPointsXManualContour();
@@ -172,15 +159,15 @@ public:
        void    GetColorSelectContour(double &r, double &g, double &b);
        
        //Addinging and removing from visualization specific actors included in the viewer contour
-       void    AddCompleteContourActor( bool ifControlPoints = false);
-       void    RemoveCompleteContourActor();
+       void            AddCompleteContourActor( bool ifControlPoints = false);
+       void            RemoveCompleteContourActor();
        virtual void    AddSplineActor();
        virtual void    RemoveSplineActor();
        virtual void    AddControlPoints();
        virtual void    RemoveControlPoints();  
-       void    AddTextActor();
-       void    RemoveTextActor();
-       void InitTextActor();
+       void            AddTextActor();
+       void            RemoveTextActor();
+       void            InitTextActor();
 
        virtual manualViewBaseContour * Clone();
                        void                                    CopyAttributesTo( manualViewBaseContour *cloneObject );
@@ -190,7 +177,13 @@ public:
 
        virtual void                                    ConstructVTKObjects();
 
-       void SetCellArray(bool type);
+       void                            SetCellArray(bool type);
+    
+    void                            InitRectangleSelection(int x, int y, int z);
+    virtual void                    SelectPointsInRectangleRegion(int x,int y,int z);
+    virtual void                    InitGroupSelectionPointsToBeMove(int id);
+    virtual void                    SetNewPositionGroupSelectedPoints( int x , int y ,int z);
+
 //---------------------------------------------------
 // PRIVATE METHODS & ATTS
 //---------------------------------------------------
@@ -205,7 +198,6 @@ private:
 
        void                                                            DeleteVtkObjects();
        
-
 //---------------------------------------------------
 // PROTECTED METHODS & ATTS
 //---------------------------------------------------
@@ -266,6 +258,9 @@ protected:
 
        virtual void    RefreshText();
 
+    int                                 _RectangleStartX;
+    int                                 _RectangleStartY;
+    int                                 _RectangleStartZ;
 };
 
 
index 17df8e818c02bf9867a9d1c7fa42bcd42865a5ed..24dada59018635714e9cb03c4877a58d0523766e 100644 (file)
@@ -399,19 +399,17 @@ void manualViewContour::ClearPoint(int id)
 void manualViewContour::InitMove(int x, int y, int z)
 {
        _initialConoturModel->DeleteAllPoints();
-
        manualPoint *mp = NULL;
-       double XX=x;
-       double YY=y;
-       double ZZ=z;
-       TransfromCoordViewWorld(XX,YY,ZZ);
-
+       double      XX  = x;
+       double      YY  = y;
+       double      ZZ  = z;
+       TransfromCoordViewWorld( XX , YY , ZZ );
        int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
        for ( i=0; i<manualPointsSZ; i++ )
        {
                mp = _manContModel->GetManualPoint( i );
                this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
-       }
+       } // for
 }
 
 //-------------------------------------------------------------------
@@ -448,3 +446,92 @@ void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
        }
        UpdateViewPoints();
 }
+
+//EED 2024-10-25
+//-------------------------------------------------------------------
+void manualViewContour::SelectPointsInRectangleRegion(int x,int y,int z) // virtual
+{
+    manualPoint *mp = NULL;
+    double      XX1  = _RectangleStartX;
+    double      YY1  = _RectangleStartY;
+    double      ZZ1  = _RectangleStartZ;
+    double      XX2  = x;
+    double      YY2  = y;
+    double      ZZ2  = z;
+    double      tmp;
+    TransfromCoordViewWorld( XX1 , YY1 , ZZ1 );
+    TransfromCoordViewWorld( XX2 , YY2 , ZZ2 );
+    if (XX2<XX1)
+    {
+        tmp=XX1;
+        XX1=XX2;
+        XX2=tmp;
+    }
+    if (YY2<YY1)
+    {
+        tmp=YY1;
+        YY1=YY2;
+        YY2=tmp;
+    }
+    int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
+    for ( i=0; i<manualPointsSZ; i++ )
+    {
+        mp = _manContModel->GetManualPoint( i );
+        if ( (mp->GetX()>XX1) && (mp->GetX()<XX2) && (mp->GetY()>YY1) && (mp->GetY()<YY2) )
+        {
+            this->SetGroupSelectedPoint(i,true);
+        } else {
+            this->SetGroupSelectedPoint(i,false);
+        }// if inside rectangle
+    } // for
+}
+
+//-------------------------------------------------------------------
+void manualViewContour::InitGroupSelectionPointsToBeMove(int id)
+{
+    manualPoint *mp     = NULL;
+    manualPoint *mpRef  = NULL;
+    mpRef = _manContModel->GetManualPoint( id );
+    lstPointsGroupSelectedToMoveId.clear();
+    lstPointsGroupSelectedToMoveX.clear();
+    lstPointsGroupSelectedToMoveY.clear();
+//    lstPointsGroupSelectedToMoveZ.clear();
+    int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
+    for ( i=0; i<manualPointsSZ; i++ )
+    {
+        if (this->GetGroupSelectedPoint(i)==true)
+        {
+            mp = _manContModel->GetManualPoint( i );
+            lstPointsGroupSelectedToMoveId.push_back(i);
+            lstPointsGroupSelectedToMoveX.push_back( mp->GetX() - mpRef->GetX() );
+            lstPointsGroupSelectedToMoveY.push_back( mp->GetY() - mpRef->GetY() );
+//            lstPointsGroupSelectedToMoveZ.push_back( mpRef->GetZ() - mp->GetZ() );
+        } // if GetGroupSelectedPoint
+    } // for i
+}
+
+//-------------------------------------------------------------------
+void manualViewContour::SetNewPositionGroupSelectedPoints(  int x , int y , int z)  // virtual
+{
+    int         id;
+    manualPoint *mp;
+    double      xx1 = x;
+    double      yy1 = y;
+    double      zz1 = z;
+    double      xx2;
+    double      yy2;
+    double      zz2;
+    TransfromCoordViewWorld(xx1,yy1,zz1);
+    int i,size = lstPointsGroupSelectedToMoveId.size();
+    for ( i=0 ; i<size ; i++ )
+    {
+        id = lstPointsGroupSelectedToMoveId[i];
+        xx2 = xx1 + lstPointsGroupSelectedToMoveX[i];
+        yy2 = yy1 + lstPointsGroupSelectedToMoveY[i];
+//        zz2 = zz1 + lstPointsGroupSelectedToMoveZ[i];
+        zz2 = zz1;
+        mp = _manContModel->GetManualPoint(id);
+        mp->SetPoint(xx2,yy2,zz2);
+        UpdateViewPoint(id);
+    } // for i
+}
index 8e1c14382a84cbdf3d7f02d1a9caed2a15a05d8c..3f61b55d9b7539b57725a057d0f99fa7e4ef1f71 100644 (file)
@@ -37,23 +37,27 @@ class creaMaracasVisu_EXPORT manualViewContour: public manualViewBaseContour
 {
 public:
        manualViewContour();
-       virtual ~manualViewContour();
-       virtual manualViewContour * Clone();
-       void CopyAttributesTo( manualViewContour *cloneObject );
-       virtual int  GetType();
-       virtual void Save(FILE *pFile);
-       virtual void Open(FILE *pFile);
-       virtual bool ShowLineVersion();
-       virtual void RefreshContour();
-       virtual bool ifTouchContour(int x,int y, int z);
-       virtual void InitMove(int x, int y, int z);
-       virtual void MoveContour(int x, int y, int z);  
-       virtual void MoveContour(int horizontalUnits, int verticalUnits );
-       virtual void DeletePoint(int id); 
-       virtual void ClearPoint(int id);
+       virtual         ~manualViewContour();
+       virtual         manualViewContour * Clone();
+       void            CopyAttributesTo( manualViewContour *cloneObject );
+       virtual int     GetType();
+       virtual void    Save(FILE *pFile);
+       virtual void    Open(FILE *pFile);
+       virtual bool    ShowLineVersion();
+       virtual void    RefreshContour();
+       virtual bool    ifTouchContour(int x,int y, int z);
+       virtual void    InitMove(int x, int y, int z);
+       virtual void    MoveContour(int x, int y, int z);
+       virtual void    MoveContour(int horizontalUnits, int verticalUnits );
+       virtual void    DeletePoint(int id);
+       virtual void    ClearPoint(int id);
+    virtual void    SelectPointsInRectangleRegion(int x,int y,int z);
+    virtual void    InitGroupSelectionPointsToBeMove(int id);
+    virtual void    SetNewPositionGroupSelectedPoints( int x , int y ,int z);
+
 private:
-       std::vector< std::vector<double> > _initialMovingPoints;
-       manualContourModel _initialConoturModel;
+       std::vector< std::vector<double> >  _initialMovingPoints;
+       manualContourModel                  *_initialConoturModel;
        virtual void    RefreshText();
 protected:
        double _minX;
@@ -61,7 +65,13 @@ protected:
        double _minZ;
        double _maxX;
        double _maxY;
-       double _maxZ;   
+       double _maxZ;
+
+    //2024-10-25
+    std::vector<double> lstPointsGroupSelectedToMoveId;
+    std::vector<double> lstPointsGroupSelectedToMoveX;
+    std::vector<double> lstPointsGroupSelectedToMoveY;
+//    std::vector<double> lstPointsGroupSelectedToMoveZ;
 };
 
 #endif // manualViewContour_h
index 001bb8e0a39206b21266cd91ced40061224d7c09..79bd5ab46cf1142a803754942064619cc57df730 100644 (file)
@@ -29,6 +29,7 @@
 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
        _selected                = false;
        _posibleSelected = false;
+    _groupSelected   = false;
        _pts                     = NULL;
        _pd                              = NULL;
        _pointVtkActor   = NULL;
@@ -74,7 +75,6 @@ void manualViewPoint::CopyAttributesTo( manualViewPoint * cloneObject)
        cloneObject->SetWidthLine(_widthline);
 }
 
-
 // ----------------------------------------------------------------------------
 void manualViewPoint::SetWidthLine( double width)
 {
@@ -83,20 +83,39 @@ void manualViewPoint::SetWidthLine( double width)
 
 // ----------------------------------------------------------------------------
 void manualViewPoint::SetSelected(bool selected){
-       _selected=selected;
+       _selected = selected;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetPosibleSelected(bool posibleSelected)
+{
+       _posibleSelected = posibleSelected;
 }
+
+// ----------------------------------------------------------------------------
+void manualViewPoint::SetGroupSelected(bool groupSelected)
+{
+    _groupSelected = groupSelected;
+}
+
 // ----------------------------------------------------------------------------
-void manualViewPoint::SetPosibleSelected(bool posibleSelected){
-       _posibleSelected=posibleSelected;
+bool manualViewPoint::GetGroupSelected()
+{
+    return _groupSelected;
 }
+
+
+
 // ----------------------------------------------------------------------------
 bool manualViewPoint::GetSelected(){
        return _selected;
 }
+
 // ----------------------------------------------------------------------------
 bool manualViewPoint::GetPosibleSelected(){
        return _posibleSelected;
 }
+
 // ----------------------------------------------------------------------------
 void manualViewPoint::DeleteVtkObjects(){
        if (_pointVtkActor      !=NULL)         { _pointVtkActor->Delete(); }
@@ -109,8 +128,6 @@ void manualViewPoint::DeleteVtkObjects(){
        _pd                             =       NULL;
 }
 
-
-
 // ----------------------------------------------------------------------------
 vtkActor* manualViewPoint::CreateVtkPointActor()
 {
@@ -211,7 +228,6 @@ void manualViewPoint::SetPositionXY(double x, double y,double i_range,double pos
        }
 }
 
-
 // ----------------------------------------------------------------------------
 void manualViewPoint::UpdateColorActor()
 {
@@ -219,10 +235,16 @@ void manualViewPoint::UpdateColorActor()
 //EED03
                _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
                _pointVtkActor->GetProperty()->SetDiffuseColor(_colorNormal_r,_colorNormal_g,_colorNormal_b);
-               if (_posibleSelected==true){
+               if (_posibleSelected==true)
+        {
                        _pointVtkActor->GetProperty()->SetDiffuseColor(_colorPosibleSelected_r,_colorPosibleSelected_g,_colorPosibleSelected_b);
-               }
-       }
+               }  // if _posibleSelected
+// EED 2024-10-25
+        if (_groupSelected==true)
+        {
+            _pointVtkActor->GetProperty()->SetDiffuseColor(_colorPosibleSelected_r,_colorPosibleSelected_g,_colorPosibleSelected_b);
+        }  // if  _groupSelected
+       } // if _pointVtkActor
 }
 
 // ----------------------------------------------------------------------------
index 7da674e1c0a0249a056d9f32d02c09538864809e..5943aa002f9065e36e09e2c240d071ecb4ca9bd6 100644 (file)
@@ -62,8 +62,10 @@ public:
        void        CopyAttributesTo( manualViewPoint *cloneObject );
        void            SetSelected(bool selected);
        void            SetPosibleSelected(bool posibleSelected);
-       bool            GetSelected();
+    void        SetGroupSelected(bool groupSelected);
+    bool        GetSelected();
        bool            GetPosibleSelected();
+    bool        GetGroupSelected();
        void            DeleteVtkObjects();
        vtkActor*       CreateVtkPointActor();
 
@@ -105,6 +107,7 @@ private:
        //
        bool                            _selected;      
        bool                            _posibleSelected;
+    bool                _groupSelected;
        
        vtkPoints                       *_pts;