// 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)
{
{
GetManualViewBaseContour()->Refresh();
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- }
- }
- }
+ } // if
+ } // if !Editable
+ } // if code 8 or 127
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnMouseMove()
{
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnLeftButtonDown()
{
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnLeftButtonUp()
{
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnLeftDClick()
{
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnMiddleButtonDown()
{
}
return true;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnMiddleButtonUp()
{
return true;
}
+
// ----------------------------------------------------------------------------
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()
{
// ----------------------------------------------------------------------------
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;
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 )
{
}
} // 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 )
{
{
return _posibleToMove;
}
+
// ----------------------------------------------------------------------------
void manualContourBaseControler::SetPosibleToMove( bool condition )
{
_posibleToMove = condition;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::IsMoving()
{
return _moving;
}
+
// ----------------------------------------------------------------------------
void manualContourBaseControler::SetMoving( bool condition )
{
{
_created = condition;
}
+
// ----------------------------------------------------------------------------
bool manualContourBaseControler::GetIfCompleteCreation ( )
{
return _created;
}
+
// ----------------------------------------------------------------------------
void manualContourBaseControler::SetKeyBoardMoving( bool condition )
{
{
return _keyBoardMoving;
}
+
// ----------------------------------------------------------------------------
void manualContourBaseControler::CreateNewManualContour(){
_manViewBaseCont->CreateNewContour();
int manualContourBaseControler::GetNumberOfPointsManualContour(){
return _manViewBaseCont->GetNumberOfPoints();
}
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//JSTG - 25-02-08 -------------------------------------------------------------
int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
//return _manViewBaseCont->GetNumberOfPointsSpline();
double* manualContourBaseControler::GetVectorPointsYManualContour(){
return _manViewBaseCont->GetVectorPointsYManualContour();
}
+
// ----------------------------------------------------------------------------
void manualContourBaseControler::DeleteContour(){
_manViewBaseCont->DeleteContour();
_manContModel->DeleteAllPoints();
}
+
// ----------------------------------------------------------------------------
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)
{
#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"
-
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
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
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
// _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()
{
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;
//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() );
GetManualViewBaseContour()->Refresh();
}
}
+
// ----------------------------------------------------------------------------
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
+
}
// ----------------------------------------------------------------------------
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;
}
-
protected:
bool _easyCreation;
-private:
};
}
// ----------------------------------------------------------------------------
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(){
_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()
{
// ----------------------------------------------------------------------------
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;
}
// ----------------------------------------------------------------------------
_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
+{
+}
#define manualViewBaseContour_h
#include "vtkRenderWindow.h"
-
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
#include "vtkCommand.h"
#include "vtkInteractorObserver.h"
#include "vtkInteractorStyleImage.h"
#include <vtkKochanekSpline.h>
-
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkCellArray.h>
#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"
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();
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 );
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
//---------------------------------------------------
void DeleteVtkObjects();
-
//---------------------------------------------------
// PROTECTED METHODS & ATTS
//---------------------------------------------------
virtual void RefreshText();
+ int _RectangleStartX;
+ int _RectangleStartY;
+ int _RectangleStartZ;
};
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
}
//-------------------------------------------------------------------
}
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
+}
{
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;
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
manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
_selected = false;
_posibleSelected = false;
+ _groupSelected = false;
_pts = NULL;
_pd = NULL;
_pointVtkActor = NULL;
cloneObject->SetWidthLine(_widthline);
}
-
// ----------------------------------------------------------------------------
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(); }
_pd = NULL;
}
-
-
// ----------------------------------------------------------------------------
vtkActor* manualViewPoint::CreateVtkPointActor()
{
}
}
-
// ----------------------------------------------------------------------------
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
}
// ----------------------------------------------------------------------------
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();
//
bool _selected;
bool _posibleSelected;
+ bool _groupSelected;
vtkPoints *_pts;