#include #include #include #include #include #include #include #include #include #include "widgets/UtilVtk3DGeometriSelection.h" #include "manualContour.h" // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualPoint::manualPoint(){ } // ---------------------------------------------------------------------------- manualPoint::~manualPoint(){ } // ---------------------------------------------------------------------------- void manualPoint::SetPoint(double x,double y,double z){ _x=x; _y=y; _z=z; } // ---------------------------------------------------------------------------- void manualPoint::SetPointX(double x){ _x=x; } // ---------------------------------------------------------------------------- void manualPoint::SetPointY(double y){ _y=y; } // ---------------------------------------------------------------------------- void manualPoint::SetPointZ(double z){ _z=z; } // ---------------------------------------------------------------------------- double manualPoint::GetX(){ return _x; } // ---------------------------------------------------------------------------- double manualPoint::GetY(){ return _y; } // ---------------------------------------------------------------------------- double manualPoint::GetZ(){ return _z; } // ---------------------------------------------------------------------------- manualPoint * manualPoint :: Clone() { manualPoint * clone = new manualPoint(); clone->SetPoint( GetX(), GetY(), GetZ()); return clone; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContourModelCircle::manualContourModelCircle() : manualContourModel() { } manualContourModelCircle::~manualContourModelCircle() { } // ---------------------------------------------------------------------------- manualContourModelCircle * manualContourModelCircle :: Clone() // virtual { manualContourModelCircle * clone = new manualContourModelCircle(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject) { // Fathers object manualContourModel::CopyAttributesTo(cloneObject); } //---------------------------------------------------------------- int manualContourModelCircle::GetTypeModel() //virtual { return 3; } //---------------------------------------------------------------- void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal { double angle = _deltaAngle*i; *x = _radio*cos(angle) + _centerX; *y = _radio*sin(angle) + _centerY; *z = _centerZ; } // // --------------------------------------------------------------------------- void manualContourModelCircle::UpdateSpline() // virtal { manualPoint *mpA,*mpB; double difX,difY; int np = GetSizeLstPoints( ); int nps = GetNumberOfPointsSpline(); _deltaAngle=(3.14159265*2)/(nps-1); if (np==2){ mpA = GetManualPoint(0); mpB = GetManualPoint(1); difX = mpA->GetX() - mpB->GetX(); difY = mpA->GetY() - mpB->GetY(); _radio = sqrt( difX*difX + difY*difY ); _centerX = mpA->GetX(); _centerY = mpA->GetY(); _centerZ = mpA->GetZ(); } else { _radio = -1; _centerX = -1; _centerY = -1; _centerZ = -1; } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContourModelBullEye::manualContourModelBullEye() : manualContourModel() { _numberPointsSlineBySector=101; // impaire } manualContourModelBullEye::~manualContourModelBullEye() { } // ---------------------------------------------------------------------------- manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual { manualContourModelBullEye * clone = new manualContourModelBullEye(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject) { // Fathers object manualContourModel::CopyAttributesTo(cloneObject); } //---------------------------------------------------------------- int manualContourModelBullEye::GetTypeModel() //virtual { return 4; } //---------------------------------------------------------------- int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje() { return _numberPointsSlineBySector; } //---------------------------------------------------------------- void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints) { this->_numberPointsSlineBySector = numpoints; } //---------------------------------------------------------------- void manualContourModelBullEye::AddSector( double radioA, double radioB, double ang, double angDelta) { manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector(); modelSector->SetSector(radioA,radioB,ang,angDelta); modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() ); _lstModelBullEyeSector.push_back(modelSector); } //---------------------------------------------------------------- manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id) { return _lstModelBullEyeSector[id]; } //---------------------------------------------------------------- void manualContourModelBullEye::GetSector(int id, double *radioA, double *radioB, double *ang, double *angDelta) { _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta); } void manualContourModelBullEye::UpdateSpline() // virtual { manualContourModel::UpdateSpline(); if (this->GetSizeLstPoints()>2){ double cx,cy; double ww,hh; manualPoint *mpA = GetManualPoint(0); manualPoint *mpB = GetManualPoint(2); cx = (mpA->GetX() + mpB->GetX()) / 2.0; cy = (mpA->GetY() + mpB->GetY()) / 2.0; ww = fabs( mpA->GetX() - mpB->GetX() )/2.0; hh = fabs( mpA->GetY() - mpB->GetY() )/2.0; int i,size = _lstModelBullEyeSector.size(); for (i=0;iSetCenter(cx,cy); _lstModelBullEyeSector[i]->SetSize(ww,hh); } // for } } //---------------------------------------------------------------- void manualContourModelBullEye::ResetSectors() { int i,size=_lstModelBullEyeSector.size(); for (i=0;iSave(ff); } } //---------------------------------------------------------------- void manualContourModelBullEye::Open(FILE *ff) // virtual { manualContourModel::Open(ff); ResetSectors(); char tmp[255]; int i; int numberOfSections; // double radioA,radioB,ang,deltaAng; fscanf(ff,"%s",tmp); // NumberOfSections fscanf(ff,"%s",tmp); // ## numberOfSections = atoi(tmp); for (i=0;iOpen(ff); } } // ---------------------------------------------------------------------------- std::vector manualContourModelBullEye::ExploseModel( ) { //EED004 std::vector lstTmp; int i,iSize=_lstModelBullEyeSector.size(); for (i=0;iSetCloseContour(true); _cntSplineX->SetDefaultTension( 0 ); _cntSplineX->SetDefaultBias( 0 ); _cntSplineX->SetDefaultContinuity( 0 ); _cntSplineY->SetDefaultTension( 0 ); _cntSplineY->SetDefaultBias( 0 ); _cntSplineY->SetDefaultContinuity( 0 ); _cntSplineZ->SetDefaultTension( 0 ); _cntSplineZ->SetDefaultBias( 0 ); _cntSplineZ->SetDefaultContinuity( 0 ); //JSTG 25-02-08 ------------------------------------------------------------------------------------------------- // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical. _delta_JSTG = 0.0; //--------------------------------------------------------------------------------------------------------------- } // ---------------------------------------------------------------------------- manualContourModel::~manualContourModel() { int i,size=_lstPoints.size(); for (i=0;iDelete(); _cntSplineY->Delete(); _cntSplineZ->Delete(); } // ---------------------------------------------------------------------------- int manualContourModel::AddPoint(double x,double y,double z) { manualPoint *mp = new manualPoint(); mp->SetPoint(x,y,z); AddManualPoint(mp); //UpdateSpline(); return _lstPoints.size()-1; } // ---------------------------------------------------------------------------- int manualContourModel::InsertPoint(double x,double y,double z) { double dd,ddmin=9999999; int ibak=0; double xx,x1,x2; double yy,y1,y2; double zz,z1,z2; int i,ii,iii,size=_lstPoints.size(); double j,MaxDivisions=20,porcentage; int sizeB=size; if (_closeContour==false) { size=size-1; } double jbak; for ( i=0 ; iGetX(); y1=_lstPoints[ii]->GetY(); z1=_lstPoints[ii]->GetZ(); x2=_lstPoints[iii]->GetX(); y2=_lstPoints[iii]->GetY(); z2=_lstPoints[iii]->GetZ(); for (j=0; j<=MaxDivisions; j++) { porcentage=(j/MaxDivisions); xx=(x2-x1)*porcentage+x1; yy=(y2-y1)*porcentage+y1; zz=(z2-z1)*porcentage+z1; dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) ); if ( ddSetPoint(x,y,z); //std::vector::iterator itNum = _lstPoints.begin() + ibak; //_lstPoints.insert(itNum,mp); InsertPoint_id(ibak,x,y,z); //---------------------------------------------------------------------------- return ibak; } // ---------------------------------------------------------------------------- void manualContourModel::InsertPoint_id(int id, double x, double y, double z) { manualPoint *mp = new manualPoint(); mp->SetPoint(x,y,z); std::vector::iterator itNum = _lstPoints.begin() + id; _lstPoints.insert(itNum,mp); } // ---------------------------------------------------------------------------- void manualContourModel::DeletePoint(int i) { std::vector::iterator itNum = _lstPoints.begin() + i; _lstPoints.erase(itNum); } // ---------------------------------------------------------------------------- void manualContourModel::DeleteAllPoints() { int i,size=_lstPoints.size(); for (i=0;iUpdateSpline(); } // ---------------------------------------------------------------------------- void manualContourModel::MovePoint(int i,double dx,double dy,double dz) { manualPoint *mp=_lstPoints[i]; double x=mp->GetX()+dx; double y=mp->GetY()+dy; double z=mp->GetZ()+dz; mp->SetPoint(x,y,z); } // ---------------------------------------------------------------------------- void manualContourModel::MoveLstPoints(double dx,double dy,double dz) { // ToDo } // ---------------------------------------------------------------------------- void manualContourModel::MoveAllPoints(double dx,double dy,double dz) { int i,size=_lstPoints.size(); for (i=0;iGetX(); yy=mp->GetY(); zz=mp->GetZ(); if (type==-1) { if ((fabs(xx-x)ClosedOn(); _cntSplineY->ClosedOn(); _cntSplineZ->ClosedOn(); } else { _cntSplineX->ClosedOff(); _cntSplineY->ClosedOff(); _cntSplineZ->ClosedOff(); } } // ---------------------------------------------------------------------------- bool manualContourModel::IfCloseContour() { return _closeContour; } // ---------------------------------------------------------------------------- void manualContourModel::UpdateSpline() // virtual { int i, np; np = _lstPoints.size(); manualPoint *mp; _cntSplineX->RemoveAllPoints(); _cntSplineY->RemoveAllPoints(); _cntSplineZ->RemoveAllPoints(); for( i = 0; i < np; i++ ) { mp = GetManualPoint(i); _cntSplineX->AddPoint( i, mp->GetX() ); _cntSplineY->AddPoint( i, mp->GetY() ); _cntSplineZ->AddPoint( i, mp->GetZ() ); } // rof //JSTG 25-02-08 --------------------------------------------------------------------------------------------- if (this->_closeContour==true) { _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close } else { _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close } //----------------------------------------------------------------------------------------------------------- } //--------------------------------------------------------------------------------- /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z) { double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour); double t = delta*(double)i; GetSplinePoint(t, x, y, z); }*/ //----------------------------------------------------------------------------- //JSTG 25-02-08 --------------------------------------------------------------- void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal { GetSpline_t_Point(i*_delta_JSTG,x,y,z); } // ---------------------------------------------------------------------------- //JSTG 25-02-08 --------------------------------------------------------------- void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z) { if (_lstPoints.size()==0) { *x = 0; *y = 0; *z = 0; } if (_lstPoints.size()==1) { manualPoint *mp; mp = GetManualPoint(0); *x = mp->GetX(); *y = mp->GetY(); *z = mp->GetZ(); } if (_lstPoints.size()>=2) { *x = _cntSplineX->Evaluate(t); *y = _cntSplineY->Evaluate(t); *z = _cntSplineZ->Evaluate(t); } } // ---------------------------------------------------------------------------- /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z) { if (_lstPoints.size()==0) { x = 0; y = 0; z = 0; } if (_lstPoints.size()==1) { manualPoint *mp; mp = GetManualPoint(0); x = mp->GetX(); y = mp->GetY(); z = mp->GetZ(); } if (_lstPoints.size()>=2) { x = _cntSplineX->Evaluate(t); y = _cntSplineY->Evaluate(t); z = _cntSplineZ->Evaluate(t); } }*/ // ---------------------------------------------------------------------------- double manualContourModel::GetPathSize() { double result = 0; double x1,y1,z1; double x2,y2,z2; // JSTG 25-02-08 ----------------------------- //double t,delta; //int i,np,nps; int i; //-------------------------------------------- if (_lstPoints.size()==2) { x1=_lstPoints[0]->GetX(); y1=_lstPoints[0]->GetY(); z1=_lstPoints[0]->GetZ(); x2=_lstPoints[1]->GetX(); y2=_lstPoints[1]->GetY(); z2=_lstPoints[1]->GetZ(); result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) ); } if (_lstPoints.size()>2) { // JSTG 25-02-08 ------------------------------------------ //np = _lstPoints.size( ); //nps = 200; //delta=( double ) ( np ) / ( double ) ( nps ); UpdateSpline(); //GetSplinePoint(0,x1,y1,z1); GetSpline_i_Point(0,&x1,&y1,&z1); //for( i = 1; i < nps; i++ ) for( i = 1; i < GetNumberOfPointsSpline(); i++ ) { //t = delta * (double)i; //GetSplinePoint(t,x2,y2,z2); GetSpline_i_Point(i,&x2,&y2,&z2); //--------------------------------------------------------- result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) ); x1=x2; y1=y2; z1=z2; }// for } return result; } // ---------------------------------------------------------------------------- double manualContourModel::GetPathArea() { double result = 555; if ((_lstPoints.size()>=3) && IfCloseContour()==true ) { double area; //JSTG 25-02-08 --------------------------------------------- //double ti,tj; //----------------------------------------------------------- double x1,y1,z1; double x2,y2,z2; bool okArea=true; int i, j; // This uses Green's theorem: // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN // A < 0 -> A = |A| (a negative value could raise because points are // given in clockwise order). //JSTG 25-02-08 ------------------------------------------------- //int np = _lstPoints.size( ); //int nps = 200; int nps = GetNumberOfPointsSpline(); //double delta=( double ) ( np ) / ( double ) ( nps ); UpdateSpline(); for( i = 0, area = 0.0; i < nps; i++ ) { j = ( i + 1 ) % nps; //ti = delta * (double)i; //tj = delta * (double)j; //GetSplinePoint(ti,x1,y1,z1); //GetSplinePoint(tj,x2,y2,z2); GetSpline_i_Point(i,&x1,&y1,&z1); GetSpline_i_Point(j,&x2,&y2,&z2); //---------------------------------------------------------------- area += (x1 * y2 ) - ( x2 * y1 ); if (z1!=z2) { okArea=false; } }// for area /= 2.0; area = fabs( area ); /* for( i = 0, area = 0.0; i < _lstPoints.size(); i++ ) { j = ( i + 1 ) % _lstPoints.size(); // Area area += (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) - ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() ); if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ()) { okArea=false; } } // rof area /= 2.0; area = fabs( area ); */ if (okArea==true) { result = area; } else { result = -1; } } else { result = 0; } return result; } // ---------------------------------------------------------------------------- // p[x,y,z] : data in // rp[x,y,z] : data out result point // rn[x,y,z] : data out result normal void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn) { double distMin=999999999; double dist,dx,dy,dz; double x1,y1,z1; double x2,y2,z2; int i,np,nps; //JSTG 25-02-08 ------------------- //double tback; int iback; //double t,delta; //--------------------------------- np = _lstPoints.size( ); if (np>=2) { // JSTG 25-02-08 ------------------------------------------ //nps = 200; nps = GetNumberOfPointsSpline(); //delta = ( double ) ( np ) / ( double ) ( nps ); UpdateSpline(); //GetSplinePoint(0,x1,y1,z1); GetSpline_i_Point(0,&x1,&y1,&z1); for( i = 0; i < nps; i++ ) { //t = delta * (double)i; //GetSplinePoint(t,x1,y1,z1); GetSpline_i_Point(i,&x1,&y1,&z1); //---------------------------------------------------------- dx= x1-p[0]; dy= y1-p[1]; dz= z1-p[2]; dist = sqrt( dx*dx + dy*dy + dz*dz ); if (distGetX(), mp->GetY(), mp->GetZ() ); } } // --------------------------------------------------------------------------- void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject) { // Fathers object //XXXX::CopyAttributesTo(cloneObject); cloneObject->SetCloseContour( this->IfCloseContour() ); int i, size = GetSizeLstPoints(); for( i=0; iAddManualPoint( GetManualPoint( i )->Clone() ); } cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () ); cloneObject->SetCloseContour( _closeContour ); cloneObject->UpdateSpline(); } // --------------------------------------------------------------------------- void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private { _lstPoints.push_back( theManualPoint ); } std::vector manualContourModel::ExploseModel( ) { std::vector lstTmp; lstTmp.push_back(this); return lstTmp; } // --------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- //int manualViewPoint::range=1; manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){ _selected = false; _posibleSelected = false; _pts = NULL; _pd = NULL; _pointVtkActor = NULL; _bboxMapper = NULL; _wxvtkbaseview = wxvtkbaseview; _spc[0] = 1; _spc[1] = 1; _spc[2] = 1; _widthline = 1; } // ---------------------------------------------------------------------------- manualViewPoint::~manualViewPoint(){ DeleteVtkObjects(); } // ---------------------------------------------------------------------------- void manualViewPoint::SetWidthLine( double width) { _widthline = width; } // ---------------------------------------------------------------------------- void manualViewPoint::SetSelected(bool selected){ _selected=selected; } // ---------------------------------------------------------------------------- void manualViewPoint::SetPosibleSelected(bool posibleSelected){ _posibleSelected=posibleSelected; } // ---------------------------------------------------------------------------- bool manualViewPoint::GetSelected(){ return _selected; } // ---------------------------------------------------------------------------- bool manualViewPoint::GetPosibleSelected(){ return _posibleSelected; } // ---------------------------------------------------------------------------- void manualViewPoint::DeleteVtkObjects(){ if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); } if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); } if (_pts !=NULL) { _pts ->Delete(); } if (_pd !=NULL) { _pd ->Delete(); } _pointVtkActor = NULL; _bboxMapper = NULL; _pts = NULL; _pd = NULL; } // ---------------------------------------------------------------------------- vtkActor* manualViewPoint::CreateVtkPointActor() { DeleteVtkObjects(); _pts = vtkPoints::New(); _pts->SetNumberOfPoints(8); _pts->SetPoint(0, -1000 , -1000 , 0 ); _pts->SetPoint(1, 1000 , -1000 , 0 ); _pts->SetPoint(2, 1000 , 1000 , 0 ); _pts->SetPoint(3, -1000 , 1000 , 0 ); _pts->SetPoint(4, -1000 , 1000 , 0 ); _pts->SetPoint(5, -1000 , 1000 , 0 ); _pts->SetPoint(6, -1000 , 1000 , 0 ); _pts->SetPoint(7, -1000 , 1000 , 0 ); vtkCellArray *lines = vtkCellArray::New(); lines->InsertNextCell(17); lines->InsertCellPoint(0); lines->InsertCellPoint(1); lines->InsertCellPoint(2); lines->InsertCellPoint(3); lines->InsertCellPoint(0); lines->InsertCellPoint(4); lines->InsertCellPoint(5); lines->InsertCellPoint(6); lines->InsertCellPoint(7); lines->InsertCellPoint(4); lines->InsertCellPoint(0); lines->InsertCellPoint(3); lines->InsertCellPoint(7); lines->InsertCellPoint(6); lines->InsertCellPoint(2); lines->InsertCellPoint(1); lines->InsertCellPoint(5); _pd = vtkPolyData::New(); _pd->SetPoints( _pts ); _pd->SetLines( lines ); lines->Delete(); //do not delete lines ?? _pointVtkActor = vtkActor::New(); _bboxMapper = vtkPolyDataMapper::New(); _bboxMapper->SetInput(_pd); _bboxMapper->ImmediateModeRenderingOn(); _pointVtkActor->SetMapper(_bboxMapper); _pointVtkActor->GetProperty()->BackfaceCullingOn(); UpdateColorActor(); _pd->ComputeBounds(); return _pointVtkActor; } // ---------------------------------------------------------------------------- vtkActor* manualViewPoint::GetVtkActor(){ return _pointVtkActor; } // ---------------------------------------------------------------------------- void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ) { // double range=0.2; // i_range; // double range=(double)manualViewPoint::range; double range=i_range; //EED 27 sep 2006 x = x * _spc[0]; y = y * _spc[1]; posZ = posZ * _spc[2]; if (_pts!=NULL){ _pts->SetPoint(0, x-range, y+range, posZ-range); _pts->SetPoint(1, x+range, y+range, posZ-range); _pts->SetPoint(2, x+range, y-range, posZ-range); _pts->SetPoint(3, x-range, y-range, posZ-range); _pts->SetPoint(4, x-range, y+range, posZ+range); _pts->SetPoint(5, x+range, y+range, posZ+range); _pts->SetPoint(6, x+range, y-range, posZ+range); _pts->SetPoint(7, x-range, y-range, posZ+range); } } // ---------------------------------------------------------------------------- void manualViewPoint::UpdateColorActor() { if (_pointVtkActor!=NULL){ //EED03 _pointVtkActor->GetProperty()->SetLineWidth( _widthline ); _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0); if (_posibleSelected==true){ _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0); } } } // ---------------------------------------------------------------------------- void manualViewPoint::GetSpacing(double spc[3]) { spc[0] = _spc[0]; spc[1] = _spc[1]; spc[2] = _spc[2]; } // ---------------------------------------------------------------------------- void manualViewPoint::SetSpacing(double spc[3]) { _spc[0] = spc[0]; _spc[1] = spc[1]; _spc[2] = spc[2]; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualViewContour::manualViewContour() { _id_viewPoint_for_text = 0; _mesureScale = 1; _initialConoturModel = new manualContourModel(); } // ---------------------------------------------------------------------------- manualViewContour::~manualViewContour() { delete _initialConoturModel; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualViewContour * manualViewContour :: Clone() { manualViewContour * clone = new manualViewContour(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject) { // Call to Fathers object manualViewBaseContour::CopyAttributesTo(cloneObject); cloneObject->SetMesureScale(_mesureScale); } // --------------------------------------------------------------------------- int manualViewContour::GetType() // virtual { return 1; } // ---------------------------------------------------------------------------- void manualViewContour::Save(FILE *pFile) { manualViewBaseContour::Save(pFile); } // ---------------------------------------------------------------------------- void manualViewContour::Open(FILE *pFile) { } // ---------------------------------------------------------------------------- void manualViewContour::RefreshContour() // virtual { int i,np,nps; //JSTG 25-02-08 -------------------- //double t,delta, x,y,z; double x,y,z; //---------------------------------- _manContModel->UpdateSpline(); np = GetNumberOfPoints( ); //nps = GetNumberOfPointsSpline(); nps = _manContModel->GetNumberOfPointsSpline(); //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08 //printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps); if ( _pts!=NULL ) { if (np>=2 ) { for( i = 0; i < nps; i++ ) { //JSTG 25-02-08 ------------------------------------------------ //t = delta * (double)i; //_manContModel->GetSplinePoint(t,x,y,z); _manContModel->GetSpline_i_Point(i,&x,&y,&z); //-------------------------------------------------------------- // EED 27 sep 2006 // _pts->SetPoint(i, x,y,z ); _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] ); //if (i%15==0) //{ // printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z); //} }// for } else { _pts->SetPoint(0, 0 , 0 , 0); _pts->SetPoint(1, 0 , 0 , 0); } // if } } // ---------------------------------------------------------------------------- void manualViewContour::RefreshText() // virtual { if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){ int size = GetNumberOfPoints(); char text[50]; char resultText[50]; strcpy(resultText," "); if (size==2) { strcpy(resultText,"L= "); gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); strcat(resultText,text); } if (size>2) { if (_manContModel->IfCloseContour()==true) { strcpy(resultText,"P= "); gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); strcat(resultText,text); gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text ); strcat(resultText," A= "); strcat(resultText,text); } else { strcpy(resultText,"L= "); gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); strcat(resultText,text); } } _textActor -> SetInput(resultText); if (size>=1){ int i; for (i=0; iGetPosibleSelected()==true) { _id_viewPoint_for_text = i; } } int id = _id_viewPoint_for_text; double px = _manContModel->GetManualPoint(id)->GetX(); double py = _manContModel->GetManualPoint(id)->GetY(); //EED 27 sep 2006 px=px*_spc[0]; py=py*_spc[1]; _textActor->SetPosition(px+GetRange()+1,py); } } } // ---------------------------------------------------------------------------- bool manualViewContour::ifTouchContour(int x,int y,int z){ bool result=false; double xx=x; double yy=y; double zz=z; double ppA[3]; double ppB[3]; double d1,d2,d3; TransfromeCoordViewWorld(xx,yy,zz); //EED 27 sep 2006 xx = xx * _spc[0]; yy = yy * _spc[1]; zz = zz * _spc[2]; unsigned int i, nps,nps_t; nps = _sizePointsContour; if (this->_manContModel->IfCloseContour()==true) { nps_t = nps; } else { nps_t = nps-1; } for( i = 0; i < nps_t; i++ ) { _pts->GetPoint(i%nps, ppA); _pts->GetPoint((i+1)%nps, ppB); d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz)); d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz)); d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2])); if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) { result=true; i=nps; } } return result; } // ---------------------------------------------------------------------------- void manualViewContour::DeletePoint(int id) // virtual { if (_lstViewPoints.size()>2) { manualViewBaseContour::DeletePoint( id ); } } // ---------------------------------------------------------------------------- void manualViewContour::ClearPoint(int id) { manualViewBaseContour::DeletePoint( id ); } //------------------------------------------------------------------- void manualViewContour::SetMesureScale(double mesureScale) { _mesureScale = mesureScale; } //------------------------------------------------------------------- void manualViewContour::InitMove(int x, int y, int z) { _initialConoturModel->DeleteAllPoints(); manualPoint *mp = NULL; double XX=x; double YY=y; double ZZ=z; TransfromeCoordViewWorld(XX,YY,ZZ); int i, manualPointsSZ = _manContModel->GetSizeLstPoints(); for ( i=0; iGetManualPoint( i ); this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() ); } } //------------------------------------------------------------------- void manualViewContour::MoveContour(int x, int y, int z) { manualPoint *mpOrigin = NULL; manualPoint *mpMoving = NULL; double XX=x; double YY=y; double ZZ=z; TransfromeCoordViewWorld(XX,YY,ZZ); int i, manualPointsSZ = _manContModel->GetSizeLstPoints(); for ( i=0; iGetManualPoint( i ); mpMoving = _initialConoturModel->GetManualPoint(i); mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() ); } UpdateViewPoints(); } void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits ) { manualPoint *mpOrigin = NULL; int i, manualPointsSZ = _manContModel->GetSizeLstPoints(); for ( i=0; iGetManualPoint( i ); mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() ); } UpdateViewPoints(); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualView3VContour::manualView3VContour(int type) { _type=type; // JSTG 25-02-08 ------------------------------ //_manContModel= new manualContourModel(); //--------------------------------------------- } // ---------------------------------------------------------------------------- manualView3VContour::~manualView3VContour() { } // ---------------------------------------------------------------------------- manualView3VContour * manualView3VContour :: Clone() { manualView3VContour * clone = new manualView3VContour( GetType() ); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject) { // Fathers object manualViewContour::CopyAttributesTo(cloneObject); } int manualView3VContour::GetType() { return _type; } // ---------------------------------------------------------------------------- void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z) { if (_type==0) { x=-1000; } if (_type==1) { y=500; } if (_type==2) { z=-1000; } } // ---------------------------------------------------------------------------- void manualView3VContour::RefreshContour() // virtula { manualViewContour::RefreshContour(); int i; double pp[3]; // JSTG 25-02-08 ---------------------------------------- //int nps = GetNumberOfPointsSpline(); int nps = _manContModel->GetNumberOfPointsSpline(); //------------------------------------------------------- for( i = 0; i < nps; i++ ) { _pts->GetPoint( i, pp ); FilterCordinateXYZ(pp[0],pp[1],pp[2]); //EED 27 sep 2006 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] ); } } // ---------------------------------------------------------------------------- void manualView3VContour::UpdateViewPoint(int id){ // virtual double x,y,z; manualPoint *mp = _manContModel->GetManualPoint(id); x=mp->GetX(); y=mp->GetY(); z=mp->GetZ(); FilterCordinateXYZ(x,y,z); _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z ); } // ---------------------------------------------------------------------------- int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual { int ii=-1; if (_manContModel!=NULL){ double xx=x; double yy=y; double zz=z; TransfromeCoordViewWorld(xx,yy,zz,-1); ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type); } return ii; } // ---------------------------------------------------------------------------- bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual bool result=false; double xx=x; double yy=y; double zz=z; double ppA[3]; double ppB[3]; double d1,d2,d3; TransfromeCoordViewWorld(xx,yy,zz,-1); //EED 27 sep 2006 xx = xx * _spc[0]; yy = yy * _spc[1]; zz = zz * _spc[2]; unsigned int i, nps,nps_t; nps = _sizePointsContour; if (this->_manContModel->IfCloseContour()==true) { nps_t = nps; } else { nps_t = nps-1; } FilterCordinateXYZ(xx,yy,zz); for( i = 0; i < nps_t; i++ ) { _pts->GetPoint(i%nps, ppA); _pts->GetPoint((i+1)%nps, ppB); FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]); FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]); d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz)); d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz)); d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2])); if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) { result=true; i=nps; } } return result; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualView3DContour::manualView3DContour() { } // ---------------------------------------------------------------------------- manualView3DContour::~manualView3DContour() { } // ---------------------------------------------------------------------------- manualView3DContour * manualView3DContour :: Clone() { manualView3DContour * clone = new manualView3DContour(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject) { // Fathers object manualViewContour::CopyAttributesTo(cloneObject); cloneObject->SetDimensions ( _w , _h , _d ); } // ---------------------------------------------------------------------------- void manualView3DContour::SetDimensions(int w, int h, int d) { _w = w; _h = h; _d = d; } // ---------------------------------------------------------------------------- void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) { X = _vtkmprbasedata->GetX(); Y = _vtkmprbasedata->GetY(); Z = _vtkmprbasedata->GetZ(); } // ---------------------------------------------------------------------------- void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata) { _vtkmprbasedata = vtkmprbasedata; } // ---------------------------------------------------------------------------- int manualView3DContour::GetIdPoint2(int x, int y) { int id = -1; double p[3],pA[3],pB[3]; double pickPoint[ 3 ], cameraPos[ 3 ]; vtkPointPicker* picker = vtkPointPicker::New( ); vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer(); picker->Pick( x, y, 0.0, pRenderer ); pRenderer->GetActiveCamera( )->GetPosition( cameraPos ); picker->GetPickPosition( pickPoint ); picker->Delete( ); UtilVtk3DGeometriSelection utilVtk3Dgeometriselection; utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d); if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) ) { double dist,distMin=999999999; int i,size=this->_manContModel->GetSizeLstPoints(); for (i=0;i_manContModel->GetManualPoint(i); p[0] = mp->GetX(); p[1] = mp->GetY(); p[2] = mp->GetZ(); dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB); if ( (dist<=2*GetRange()) && (distUpdateSpline(); nps = _manContModel->GetNumberOfPointsSpline(); if ( _pts!=NULL ) { for( i = 0; i < nps; i++ ) { _manContModel->GetSpline_i_Point(i,&x,&y,&z); _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] ); }// for } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualViewBullEye::manualViewBullEye() { } // ---------------------------------------------------------------------------- manualViewBullEye::~manualViewBullEye() { // BullEye(s) int i,size=lstSectorBullEye.size(); for (i=0;iUpdateSpline(); int np = GetNumberOfPoints( ); // Refres sectors of BullEye(s) if (np>=2 ) { int i,size = lstSectorBullEye.size(); for (i=0;iRefreshContour(); } // for } // if } // ---------------------------------------------------------------------------- void manualViewBullEye::ConstructVTKObjects() // virtual { manualViewRoi::ConstructVTKObjects(); double spc[3]; this->GetSpacing(spc); manualViewBullEyeSector *mvbc; manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel; int i,size = mcmbe->GetSizeOfSectorLst(); for ( i=0 ; iSetModel( mcmbe->GetModelSector(i) ); mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() ); mvbc->SetRange( 2 ); mvbc->SetZ( 1000 ); mvbc->SetSpacing(spc); mvbc->SetColorNormalContour(1, 0, 0); // mvbc->SetColorEditContour(0.5, 0.5, 0.5); // mvbc->SetColorSelectContour(1, 0.8, 0); mvbc->SetWidthLine( this->GetWidthLine() ); //EED004 mvbc->ConstructVTKObjects(); lstSectorBullEye.push_back( mvbc ); } } // ---------------------------------------------------------------------------- void manualViewBullEye::AddSplineActor() // virtual { manualViewRoi::AddSplineActor(); int i,size=lstSectorBullEye.size(); for (i=0;iAddSplineActor(); } } // ---------------------------------------------------------------------------- void manualViewBullEye::RemoveSplineActor() // virtual { manualViewRoi::RemoveSplineActor(); int i,size=lstSectorBullEye.size(); for (i=0;iRemoveSplineActor(); } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualViewRoi::manualViewRoi() { _sizePointsContour=5; } // ---------------------------------------------------------------------------- manualViewRoi::~manualViewRoi() { } // ---------------------------------------------------------------------------- manualViewRoi * manualViewRoi :: Clone() { manualViewRoi * clone = new manualViewRoi(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject) { // Fathers object manualViewBaseContour::CopyAttributesTo(cloneObject); } // ---------------------------------------------------------------------------- void manualViewRoi::RefreshContour() // virtual { unsigned int i,ii, np; np = GetNumberOfPoints( ); if ( np > 0) { if (np>=2) { manualPoint *mp; for( i = 0; i < np+1; i++ ) { ii=i%np; mp = _manContModel->GetManualPoint(ii); //EEDx6 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ(); // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView(); // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ); //EED 27 sep 2007 // _pts->SetPoint(i, XX,YY,ZZ ); _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] ); } // rof } else { _pts->SetPoint(0, 0 , 0 , 0); _pts->SetPoint(1, 0 , 0 , 0); } // if } } // ---------------------------------------------------------------------------- int manualViewRoi::GetType() // virtual { return 2; } // ---------------------------------------------------------------------------- void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY) { double pp[3]; manualPoint *mp; unsigned int i; minX=99999; minY=99999; maxX=-99999; maxY=-99999; unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints(); for( i = 0; i < size; i++ ) { mp=_manContModel->GetManualPoint(i); pp[0]=mp->GetX(); pp[1]=mp->GetY(); // min X if (pp[0]maxX) { maxX=pp[0]; } // max Y if (pp[1]>maxY) { maxY=pp[1]; } } if ( size<1 ) { minX=0; maxX=0; minY=0; maxY=0; } } // ---------------------------------------------------------------------------- bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual { bool result=false; double px1=99999,py1=99999,px2=-9999,py2=-99999; GetMinMax(px1,py1, px2, py2); double xx=x; double yy=y; double zz=z; TransfromeCoordViewWorld(xx,yy,zz); bool ok1=false; bool ok2=false; double ddx=GetRange(); double ddy=GetRange(); if ((xx>px1-ddx)&&(xxpy1-ddy)&&(yypx1+ddx)&&(xxpy1+ddy)&&(yyGetSizeLstPoints()==4){ mp = _manContModel->GetManualPoint(0); _dp0[0]= mp->GetX() - XX; _dp0[1]= mp->GetY() - YY; _dp0[2]= mp->GetZ(); mp = _manContModel->GetManualPoint(1); _dp1[0]= mp->GetX() - XX; _dp1[1]= mp->GetY() - YY; _dp1[2]= mp->GetZ(); mp = _manContModel->GetManualPoint(2); _dp2[0]= mp->GetX() - XX; _dp2[1]= mp->GetY() - YY; _dp2[2]= mp->GetZ(); mp = _manContModel->GetManualPoint(3); _dp3[0]= mp->GetX() - XX; _dp3[1]= mp->GetY() - YY; _dp3[2]= mp->GetZ(); } } // ---------------------------------------------------------------------------- void manualViewRoi::MoveContour(int x, int y, int z) // virtual { manualPoint *mp; double XX=x; double YY=y; double ZZ=z; TransfromeCoordViewWorld(XX,YY,ZZ); mp = _manContModel->GetManualPoint(0); mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]); mp = _manContModel->GetManualPoint(1); mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]); mp = _manContModel->GetManualPoint(2); mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]); mp = _manContModel->GetManualPoint(3); mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]); UpdateViewPoint(0); UpdateViewPoint(1); UpdateViewPoint(2); UpdateViewPoint(3); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // EED08 manualViewCircle::manualViewCircle() { // _sizePointsContour=5; // default 100 } // ---------------------------------------------------------------------------- manualViewCircle::~manualViewCircle() { } // ---------------------------------------------------------------------------- manualViewCircle * manualViewCircle :: Clone() { manualViewCircle * clone = new manualViewCircle(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject) { // Fathers object manualViewBaseContour::CopyAttributesTo(cloneObject); } // ---------------------------------------------------------------------------- /* void manualViewCircle::RefreshContour(){ // virtual manualPoint *mpA,*mpB; unsigned int i, np,nps; double angle,radio; double difX,difY; double XX,YY,ZZ; np = GetNumberOfPoints( ); nps = _manContModel->GetNumberOfPointsSpline(); double deltaAngle=(3.14159265*2)/(nps-1); if ( np > 0) { if (np==2) { mpA = _manContModel->GetManualPoint(0); mpB = _manContModel->GetManualPoint(1); difX = mpA->GetX() - mpB->GetX(); difY = mpA->GetY() - mpB->GetY(); radio = sqrt( difX*difX + difY*difY ); manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel; manContModelCir->SetRadio(radio); for( i = 0; i < nps; i++ ) { manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ); // angle = deltaAngle*i; // XX = cos(angle)*radio+mpA->GetX(); // YY = sin(angle)*radio+mpA->GetY(); ZZ = mpA->GetZ(); _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] ); } // rof } else { _pts->SetPoint(0, 0 , 0 , 0); _pts->SetPoint(1, 0 , 0 , 0); } // if } } */ // ---------------------------------------------------------------------------- int manualViewCircle::GetType() // virtual { return 3; } // ---------------------------------------------------------------------------- void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY) { manualPoint *mpA,*mpB; unsigned int np; double radio; double difX,difY; np = GetNumberOfPoints( ); if (np==2) { mpA = _manContModel->GetManualPoint(0); mpB = _manContModel->GetManualPoint(1); difX = mpA->GetX() - mpB->GetX(); difY = mpA->GetY() - mpB->GetY(); radio = sqrt( difX*difX + difY*difY ); minX=mpA->GetX()-radio; minY=mpA->GetY()-radio; maxX=mpA->GetX()+radio; maxY=mpA->GetY()+radio; } else { minX=0; maxX=0; minY=0; maxY=0; } } /* // ---------------------------------------------------------------------------- bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual { bool result=false; double px1=99999,py1=99999,px2=-9999,py2=-99999; GetMinMax(px1,py1, px2, py2); double xx=x; double yy=y; double zz=z; TransfromeCoordViewWorld(xx,yy,zz); bool ok1=false; bool ok2=false; double ddx=GetRange(); double ddy=GetRange(); if ((xx>px1-ddx)&&(xxpy1-ddy)&&(yypx1+ddx)&&(xxpy1+ddy)&&(yyGetSizeLstPoints()==2){ mp = _manContModel->GetManualPoint(0); _dp0[0]= mp->GetX() - XX; _dp0[1]= mp->GetY() - YY; _dp0[2]= mp->GetZ(); mp = _manContModel->GetManualPoint(1); _dp1[0]= mp->GetX() - XX; _dp1[1]= mp->GetY() - YY; _dp1[2]= mp->GetZ(); /* mp = _manContModel->GetManualPoint(2); _dp2[0]= mp->GetX() - XX; _dp2[1]= mp->GetY() - YY; _dp2[2]= mp->GetZ(); mp = _manContModel->GetManualPoint(3); _dp3[0]= mp->GetX() - XX; _dp3[1]= mp->GetY() - YY; _dp3[2]= mp->GetZ(); */ } } // ---------------------------------------------------------------------------- void manualViewCircle::MoveContour(int x, int y, int z) // virtual { manualPoint *mp; double XX=x; double YY=y; double ZZ=z; TransfromeCoordViewWorld(XX,YY,ZZ); mp = _manContModel->GetManualPoint(0); mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]); mp = _manContModel->GetManualPoint(1); mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]); // mp = _manContModel->GetManualPoint(2); // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]); // mp = _manContModel->GetManualPoint(3); // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]); UpdateViewPoint(0); UpdateViewPoint(1); // UpdateViewPoint(2); // UpdateViewPoint(3); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualViewBaseContour::manualViewBaseContour() { _show_text = true; _textActor = NULL; _manContModel = NULL; _wxvtkbaseview = NULL; _selected = false; _posibleSelected = false; _viewControlPoints = false; _pts = NULL; _pd = NULL; _contourVtkActor = NULL; _bboxMapper = NULL; _range = 1; _sizePointsContour = 100; _spc[0] = 1; _spc[1] = 1; _spc[2] = 1; _coulorEdit_r = 1; _coulorEdit_g = 1; _coulorEdit_b = 0; _coulorNormal_r = 1; _coulorNormal_g = 0; _coulorNormal_b = 1; _coulorSelection_r = 0; _coulorSelection_g = 1; _coulorSelection_b = 0; _widthline = 1; } // ---------------------------------------------------------------------------- manualViewBaseContour::~manualViewBaseContour() { int i,size=_lstViewPoints.size(); for (i=0;iGetRenderer(); // JPRx ?? //Adding the spline AddSplineActor(); AddTextActor(); //Adding each control point if( ifControlPoints ) AddControlPoints(); RefreshContour(); Refresh(); } // --------------------------------------------------------------------------- void manualViewBaseContour :: RemoveCompleteContourActor() { /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ?? //Removing the spline RemoveSplineActor(); RemoveTextActor(); //Removing each point RemoveControlPoints(); RefreshContour(); Refresh(); } // --------------------------------------------------------------------------- manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual { manualViewBaseContour * clone = new manualViewBaseContour(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject) { // Fathers object //XXXX::CopyAttributesTo(cloneObject); cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview ); cloneObject-> SetSelected( this->GetSelected() ); cloneObject-> SetPosibleSelected( this->GetPosibleSelected() ); cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() ); cloneObject-> SetRange( this->GetRange() ); cloneObject-> SetZ( this->GetZ() ); cloneObject-> SetSpacing( _spc ); cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b ); cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b ); cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b ); int i, size = _lstViewPoints.size(); for ( i=0; iAddPoint( ); } } // ---------------------------------------------------------------------------- void manualViewBaseContour :: AddSplineActor() { vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); if (_contourVtkActor!=NULL) theRenderer->AddActor( _contourVtkActor ); } // ---------------------------------------------------------------------------- void manualViewBaseContour :: RemoveSplineActor() // virtual { vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); if (_contourVtkActor!=NULL) theRenderer->RemoveActor( _contourVtkActor ); } // ---------------------------------------------------------------------------- void manualViewBaseContour :: RemoveControlPoints() { if (_wxvtkbaseview!=NULL){ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); int i,size=_lstViewPoints.size(); for (i=0;iGetVtkActor(); theRenderer->RemoveActor( pointActor ); } // for } // if SetIfViewControlPoints( false ); } // ---------------------------------------------------------------------------- void manualViewBaseContour :: AddControlPoints() { vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); SetIfViewControlPoints( true ); if( _viewControlPoints ) { int i,size=_lstViewPoints.size(); for (i=0;iGetVtkActor(); theRenderer->AddActor( pointActor ); } } } // ---------------------------------------------------------------------------- void manualViewBaseContour::AddTextActor() { _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor ); } // ---------------------------------------------------------------------------- void manualViewBaseContour::RemoveTextActor() { _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor ); } // ---------------------------------------------------------------------------- void manualViewBaseContour::DeleteVtkObjects() { if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); } if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); } if ( _pts != NULL ) { _pts -> Delete(); } if ( _pd != NULL ) { _pd -> Delete(); } _contourVtkActor = NULL; _bboxMapper = NULL; _pts = NULL; _pd = NULL; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetWidthLine(double width) { _widthline = width; this->UpdateColorActor(); // for the control points int id, size = _lstViewPoints.size(); for( id=0; id_lstViewPoints[id]->SetWidthLine(_widthline); } } // ---------------------------------------------------------------------------- double manualViewBaseContour::GetWidthLine() { return _widthline; } // ---------------------------------------------------------------------------- void manualViewBaseContour::ConstructVTKObjects() { //JSTG 29-02-08 ----------------------------------------------- //int i , nps = _sizePointsContour; int i; int nps = _manContModel->GetNumberOfPointsSpline(); //------------------------------------------------------------- DeleteVtkObjects(); _pts = vtkPoints::New(); _pts->SetNumberOfPoints(nps); for (i=0 ; iSetPoint(i, 0 , 0 , 0 ); } // This is for the boundaring inicialisation _pts->SetPoint(0, -1000 , -1000 , -1000 ); _pts->SetPoint(1, 1000 , 1000 , 1000 ); vtkCellArray *lines = vtkCellArray::New(); lines->InsertNextCell( nps /* +1 */ ); for ( i=0 ; iInsertCellPoint(i % nps ); } _pd = vtkPolyData::New(); _pd->SetPoints( _pts ); _pd->SetLines( lines ); lines->Delete(); //do not delete lines ?? _contourVtkActor = vtkActor::New(); _bboxMapper = vtkPolyDataMapper::New(); _bboxMapper->ScalarVisibilityOff( ); _bboxMapper->SetInput(_pd); _bboxMapper->ImmediateModeRenderingOn(); _contourVtkActor->SetMapper(_bboxMapper); _contourVtkActor->GetProperty()->BackfaceCullingOff(); UpdateColorActor(); _pd->ComputeBounds(); // Text _textActor = vtkTextActor::New(); // _textActor->SetDisplayPosition(200, 200); _textActor->SetInput(""); // Set coordinates to match the old vtkScaledTextActor default value // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport(); // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 ); _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld (); // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 ); vtkTextProperty *tprop = _textActor->GetTextProperty(); tprop->SetFontSize(14); tprop->SetFontFamilyToArial(); tprop->SetColor(0, 0, 1); } // ---------------------------------------------------------------------------- void manualViewBaseContour::CreateNewContour() { ConstructVTKObjects(); /* _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor ); _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/ AddCompleteContourActor(); } // ---------------------------------------------------------------------------- void manualViewBaseContour::UpdateViewPoint(int id) // virtual { manualPoint *mp = _manContModel->GetManualPoint(id); //EEDx6 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ(); // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView(); // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ); _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ ); } // ---------------------------------------------------------------------------- void manualViewBaseContour :: UpdateViewPoints() { int id, size = _lstViewPoints.size(); for( id=0; idGetWxVtkBaseView() ); AddPoint( mvp ); } // ---------------------------------------------------------------------------- void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint ) { _lstViewPoints.push_back( manualViewPoint ); // EED 3 oct 2006 manualViewPoint->SetSpacing(_spc); vtkActor *actor = manualViewPoint->CreateVtkPointActor(); _wxvtkbaseview->GetRenderer()->AddActor( actor ); } // ---------------------------------------------------------------------------- void manualViewBaseContour::InsertPoint(int id) { manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() ); // EED 3 oct 2006 mvp->SetSpacing(_spc); std::vector::iterator itNum = _lstViewPoints.begin() + id; _lstViewPoints.insert(itNum,mvp); _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() ); } // ---------------------------------------------------------------------------- void manualViewBaseContour::DeleteContour() { RemoveCompleteContourActor(); /*if (_contourVtkActor!=NULL){ _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor ); }*/ DeleteVtkObjects(); int i,size=_lstViewPoints.size(); for (i=0;i=0) && (idDeletePickList(mvp->GetVtkActor()); _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() ); std::vector::iterator itNum = _lstViewPoints.begin() + id; _lstViewPoints.erase(itNum); delete mvp; Refresh(); } } // ---------------------------------------------------------------------------- void manualViewBaseContour::DeletePoint(int x, int y, int z) { int id=GetIdPoint(x,y,z); if (id!=-1){ DeletePoint(id); } } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetSelected(bool selected) { _selected=selected; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetPosibleSelected(bool posibleSelected) { _posibleSelected=posibleSelected; } // ---------------------------------------------------------------------------- bool manualViewBaseContour::GetEditable() { return *_editable; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetEditable( bool * condition ) { _editable = condition; } // ---------------------------------------------------------------------------- bool manualViewBaseContour::GetSelected() { return _selected; } // ---------------------------------------------------------------------------- bool manualViewBaseContour::GetPosibleSelected() { return _posibleSelected; } // ---------------------------------------------------------------------------- void manualViewBaseContour::DeleteSelectedPoints() { int i,size=_lstViewPoints.size(); for (i=size-1;i>=0;i--){ if (_lstViewPoints[i]->GetSelected()==true){ DeletePoint(i); } } Refresh(); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SelectPoint(int i, bool select) { _lstViewPoints[i]->SetSelected(select); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SelectLstPoints() { // ToDo } // ---------------------------------------------------------------------------- void manualViewBaseContour::SelectAllPoints(bool select) { int i,size=_lstViewPoints.size(); for (i=0;iSetPosibleSelected(select); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetPointSelected(int id,bool select) { _lstViewPoints[id]->SetSelected(select); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SelectAllPossibleSelected(bool select) { int i,size=_lstViewPoints.size(); for (i=0;i_lstViewPoints.size()>=2) ) { if (ifTouchContour(x,y,z)==true) { result=true; SetPosibleSelected(result); } } if (GetEditable()==false) { if (ifTouchContour(x,y,z)==true) { result=true; SetPosibleSelected(result); } } } return result; } // ---------------------------------------------------------------------------- bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual { return false; } // ---------------------------------------------------------------------------- void manualViewBaseContour::UnSelectPoint(int i){ _lstViewPoints[i]->SetSelected(false); Refresh(); } // ---------------------------------------------------------------------------- void manualViewBaseContour::UnSelectLstPoints(){ // ToDo } // ---------------------------------------------------------------------------- void manualViewBaseContour::UnSelectAllPoints(){ int i,size=_lstViewPoints.size(); for (i=0;iGetPoint(i,pp); vx[i]=pp[0]; } return vx; } // ---------------------------------------------------------------------------- double* manualViewBaseContour::GetVectorPointsYManualContour() { double pp[3]; int i,size = _sizePointsContour; double *vy = (double*)malloc(sizeof(double)*size); for (i=0;iGetPoint(i,pp); vy[i]=pp[1]; } return vy; } // ---------------------------------------------------------------------------- double* manualViewBaseContour::GetVectorPointsZManualContour() { double pp[3]; int i,size = _sizePointsContour; double *vz = (double*)malloc(sizeof(double)*size); for (i=0;iGetPoint(i,pp); vz[i]=pp[2]; } return vz; } // ---------------------------------------------------------------------------- void manualViewBaseContour::Refresh() // virtual { if (_contourVtkActor!=NULL){ RefreshContour(); } int i,size=_lstViewPoints.size(); for (i=0;iUpdateColorActor(); } UpdateColorActor(); if (_show_text==true) { RefreshText(); } vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor (); if (vri==NULL) { _wxvtkbaseview->GetRenWin()->Render(); } } // ---------------------------------------------------------------------------- void manualViewBaseContour::RefreshText() // virtual { if( _textActor!=NULL) _textActor -> SetInput(" "); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetColorNormalContour(double r, double g, double b) { _coulorNormal_r = r; _coulorNormal_g = g; _coulorNormal_b = b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b) { r = _coulorNormal_r; g = _coulorNormal_g; b = _coulorNormal_b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetColorEditContour(double r, double g, double b) { _coulorEdit_r = r; _coulorEdit_g = g; _coulorEdit_b = b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b) { r = _coulorEdit_r; g = _coulorEdit_g; b = _coulorEdit_b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetColorSelectContour(double r, double g, double b) { _coulorSelection_r = r; _coulorSelection_g = g; _coulorSelection_b = b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b) { r = _coulorSelection_r; g = _coulorSelection_g; b = _coulorSelection_b; } // ---------------------------------------------------------------------------- void manualViewBaseContour::UpdateColorActor() { if (_contourVtkActor!=NULL) { _contourVtkActor->GetProperty()->SetLineWidth( _widthline ); _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b ); if (_posibleSelected || (_posibleSelected && GetEditable() ) ) { _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b ); } if( _selected ) { _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b ); } } } // ---------------------------------------------------------------------------- int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual { int ii = -1; if (_manContModel!=NULL){ double xx = x; double yy = y; double zz = z; TransfromeCoordViewWorld(xx,yy,zz); ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1); } return ii; } // ---------------------------------------------------------------------------- int manualViewBaseContour::GetNumberOfPoints() { return _lstViewPoints.size(); } // ---------------------------------------------------------------------------- //JSTG 25-02-08 --------------------------------------------------------------- /*int manualViewBaseContour::GetNumberOfPointsSpline() { return _sizePointsContour; }*/ //---------------------------------------------------------------------------- //JSTG 25-02-08 --------------------------------------------------------------- /*void manualViewBaseContour::SetNumberOfPointsSpline(int size) { _sizePointsContour = size; }*/ //---------------------------------------------------------------------------- // virtual void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual { _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type); //EED 27 sep 2007 // //EEDx6 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview; // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetRange(int range) { _range=range; } // ---------------------------------------------------------------------------- int manualViewBaseContour::GetRange() { return _range; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetZ(int z) { // _Z=z; } // ---------------------------------------------------------------------------- int manualViewBaseContour::GetZ() { // return _Z; return 0; } // ---------------------------------------------------------------------------- void manualViewBaseContour::InitMove(int x, int y, int z) // virtual { } // ---------------------------------------------------------------------------- void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual { } // ---------------------------------------------------------------------------- void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual { } // ---------------------------------------------------------------------------- void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual { double pp[3]; manualPoint *mp; int i; int size=_manContModel->GetSizeLstPoints(); minX=99999; minY=99999; maxX=-99999; maxY=-99999; bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0; if ( ifFindZ ) { minZ=99999; maxZ=-99999; } for( i = 0; i < size; i++ ) { mp=_manContModel->GetManualPoint(i); pp[0]=mp->GetX(); pp[1]=mp->GetY(); if ( ifFindZ ) pp[2]=mp->GetZ(); // min X if (pp[0]maxX) { maxX=pp[0]; } // max Y if (pp[1]>maxY) { maxY=pp[1]; } if ( ifFindZ ) { // min Z if (pp[2]maxZ) { maxZ=pp[2]; } } } if ( size<1 ) { minX = 0; maxX = 0; minY = 0; maxY = 0; minZ = 0; maxZ = 0; } } // ---------------------------------------------------------------------------- void manualViewBaseContour::ClearContour() { if (_contourVtkActor!=NULL){ _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor ); } DeleteVtkObjects(); int i,size=_lstViewPoints.size(); for (i=0;iGetVtkActor(); actor->GetProperty()->SetOpacity( opacity ); } _contourVtkActor->GetProperty()->SetOpacity( opacity ); _textActor->GetProperty()->SetOpacity( opacity ); _textActor->SetInput(" "); } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetShowText(bool ok) { _show_text = ok; if (_show_text==false) { _textActor->SetInput(" "); } } // ---------------------------------------------------------------------------- wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView() { return this->_wxvtkbaseview; } // ---------------------------------------------------------------------------- void manualViewBaseContour::GetSpacing(double spc[3]) { spc[0] = _spc[0]; spc[1] = _spc[1]; spc[2] = _spc[2]; } // ---------------------------------------------------------------------------- void manualViewBaseContour::SetSpacing(double spc[3]) { _spc[0] = spc[0]; _spc[1] = spc[1]; _spc[2] = spc[2]; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // _type = 0 Sagital // _type = 1 Coronal // _type = 2 Axial // _type = -1 View 3D manualContour3VControler::manualContour3VControler(int type) { _type=type; //EEDhh // _manViewBaseCont1 = NULL; // _manViewBaseCont2 = NULL; // _manViewBaseCont3 = NULL; } //---------------------------------------------------------------------------- manualContour3VControler::~manualContour3VControler() { } // ---------------------------------------------------------------------------- manualContour3VControler * manualContour3VControler :: Clone() // virtual { manualContour3VControler * clone = new manualContour3VControler( this->GetType() ); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject) { // Fathers object manualContourControler::CopyAttributesTo(cloneObject); cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() ); // Remember to add ManualViewBaseContour with "AddManualViewBaseContour" } // ---------------------------------------------------------------------------- int manualContour3VControler::GetType() { return _type; } // ---------------------------------------------------------------------------- void manualContour3VControler::AddPoint_Others() { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->AddPoint(); } // EEDhh // if (_manViewBaseCont1!=NULL){ // _manViewBaseCont1->AddPoint(); // _manViewBaseCont2->AddPoint(); // _manViewBaseCont3->AddPoint(); // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); // } this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // ---------------------------------------------------------------------------- void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual { z=(int)_vtkmprbasedata->GetZ(); if (GetManualContourModel()!=NULL){ double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type); if (_type==0) { xx=_vtkmprbasedata->GetX(); } if (_type==1) { yy=_vtkmprbasedata->GetY(); } /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx GetManualViewBaseContour()->AddPoint(); AddPoint_Others(); } } // ---------------------------------------------------------------------------- void manualContour3VControler::InsertPoint_Others(int id) { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->InsertPoint(id); } /*EEDhh if (_manViewBaseCont1!=NULL){ _manViewBaseCont1->InsertPoint(id); _manViewBaseCont2->InsertPoint(id); _manViewBaseCont3->InsertPoint(id); this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } */ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // ---------------------------------------------------------------------------- void manualContour3VControler::InsertPoint(int x, int y, int z) { int id=-1; if (GetManualContourModel()!=NULL){ if (GetManualContourModel()->GetSizeLstPoints()>1){ z=(int)_vtkmprbasedata->GetZ(); double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type); if (_type==0) { xx=_vtkmprbasedata->GetX(); } if (_type==1) { yy=_vtkmprbasedata->GetY(); } id = GetManualContourModel()->InsertPoint(xx,yy,zz); GetManualViewBaseContour()->InsertPoint(id); InsertPoint_Others(0); } else { AddPoint(x,y,z); } } } // ---------------------------------------------------------------------------- // EEDhh /* void manualContour3VControler::SetModelView ( manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont0, manualViewBaseContour *manViewBaseCont1, manualViewBaseContour *manViewBaseCont2, manualViewBaseContour *manViewBaseCont3) { manualContourControler::SetModelView(manContModel,manViewBaseCont0); _manViewBaseCont1 = manViewBaseCont1; _manViewBaseCont2 = manViewBaseCont2; _manViewBaseCont3 = manViewBaseCont3; } */ // ---------------------------------------------------------------------------- void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont ) { _lstManualViewBaseContour.push_back( manViewBaseCont ); } // ---------------------------------------------------------------------------- void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata ) { _vtkmprbasedata=vtkmprbasedata; } // ---------------------------------------------------------------------------- vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData() { return _vtkmprbasedata; } // ---------------------------------------------------------------------------- void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual { z=(int)_vtkmprbasedata->GetZ(); if ((GetManualViewBaseContour()!=NULL) && (id>=0)){ double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type); if (_type==0) { xx=_vtkmprbasedata->GetX(); } if (_type==1) { yy=_vtkmprbasedata->GetY(); } manualPoint *mp = GetManualContourModel()->GetManualPoint(id); mp->SetPoint(xx,yy,zz); } } // ---------------------------------------------------------------------------- void manualContour3VControler::DeleteActualMousePoint_Others(int id) { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->DeletePoint(id); mvbc->Refresh(); } /* if (_manViewBaseCont1!=NULL){ _manViewBaseCont1->DeletePoint(id); _manViewBaseCont2->DeletePoint(id); _manViewBaseCont3->DeletePoint(id); _manViewBaseCont1->Refresh(); _manViewBaseCont2->Refresh(); _manViewBaseCont3->Refresh(); this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } */ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // ---------------------------------------------------------------------------- void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual { int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() ); if (id!=-1){ manualContourBaseControler::DeleteActualMousePoint( x , y ); DeleteActualMousePoint_Others( id ); } } // ---------------------------------------------------------------------------- void manualContour3VControler::MouseMove_Others(int id) // virtual { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->SelectAllPossibleSelected(false); if (id!=-1) { mvbc->SetPointPosibleSelected(id,true); } mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() ); mvbc->Refresh(); } // EEDhh /* if (_manViewBaseCont1!=NULL){ _manViewBaseCont1->SelectAllPossibleSelected(false); _manViewBaseCont2->SelectAllPossibleSelected(false); _manViewBaseCont3->SelectAllPossibleSelected(false); if (id!=-1){ _manViewBaseCont1->SetPointPosibleSelected(id,true); _manViewBaseCont2->SetPointPosibleSelected(id,true); _manViewBaseCont3->SetPointPosibleSelected(id,true); } _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() ); _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() ); _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() ); _manViewBaseCont1->Refresh(); _manViewBaseCont2->Refresh(); _manViewBaseCont3->Refresh(); this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } */ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // ---------------------------------------------------------------------------- void manualContour3VControler::MouseMove(int x, int y) // virtual { manualContourControler::MouseMove( x , y ); int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ()); MouseMove_Others( id ); } // ---------------------------------------------------------------------------- void manualContour3VControler::OnChar_Others() { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->Refresh(); } // EEDhh /* _manViewBaseCont1->Refresh(); _manViewBaseCont2->Refresh(); _manViewBaseCont3->Refresh(); */ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // ---------------------------------------------------------------------------- bool manualContour3VControler::OnChar() { manualContourControler::OnChar(); OnChar_Others(); return true; } // ---------------------------------------------------------------------------- void manualContour3VControler::ResetContour() // virtual { manualContourControler::ResetContour(); ResetContour_Others(); } // ---------------------------------------------------------------------------- void manualContour3VControler::ResetContour_Others() { manualViewBaseContour *mvbc; int i,size=this->_lstManualViewBaseContour.size(); for ( i = 0 ; i < size ; i++ ) { mvbc = _lstManualViewBaseContour[i]; mvbc->DeleteContour(); mvbc->CreateNewContour(); } // EEDhh /* _manViewBaseCont1->DeleteContour(); _manViewBaseCont2->DeleteContour(); _manViewBaseCont3->DeleteContour(); _manViewBaseCont1->CreateNewContour(); _manViewBaseCont2->CreateNewContour(); _manViewBaseCont3->CreateNewContour(); */ } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContour3DControler::manualContour3DControler() { } // ---------------------------------------------------------------------------- manualContour3DControler::~manualContour3DControler() { } // ---------------------------------------------------------------------------- manualContour3DControler * manualContour3DControler :: Clone() // virtual { manualContour3DControler * clone = new manualContour3DControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject) { // Fathers object manualContourControler::CopyAttributesTo(cloneObject); cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() ); } // ---------------------------------------------------------------------------- bool manualContour3DControler::OnLeftButtonDown() { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); MouseClickLeft(X,Y); return true; } // ---------------------------------------------------------------------------- void manualContour3DControler::ResetOrientationPlane() { double p[3],rp[3],rn[3]; p[0] = this->GetVtkMPRBaseData()->GetX( ); p[1] = this->GetVtkMPRBaseData()->GetY( ); p[2] = this->GetVtkMPRBaseData()->GetZ( ); this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn); this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]); } // ---------------------------------------------------------------------------- void manualContour3DControler::MouseClickLeft(int x, int y) // virtual { manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour(); int id=manualview3Dcontour->GetIdPoint2(x,y); if ( (GetState()==0) && (id!=-1) ) { manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id); this->GetVtkMPRBaseData()->SetX( mp->GetX() ); this->GetVtkMPRBaseData()->SetY( mp->GetY() ); this->GetVtkMPRBaseData()->SetZ( mp->GetZ() ); ResetOrientationPlane(); this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } manualContourControler::MouseClickLeft(x,y); } // ---------------------------------------------------------------------------- bool manualContour3DControler::OnChar() { bool ok=true; manualContourControler::OnChar(); char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode(); if (keyCode==32){ ok=false; ResetOrientationPlane(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } return ok; } // ---------------------------------------------------------------------------- void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata ) { _vtkmprbasedata=vtkmprbasedata; } // ---------------------------------------------------------------------------- vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData() { return _vtkmprbasedata; } // ---------------------------------------------------------------------------- void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual { manualContourControler::InsertPoint( x, y, z ); ResetOrientationPlane(); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContour3V3DControler::manualContour3V3DControler() { } // ---------------------------------------------------------------------------- manualContour3V3DControler::~manualContour3V3DControler() { } // ---------------------------------------------------------------------------- manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual { manualContour3V3DControler * clone = new manualContour3V3DControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject) { // Fathers object manualContour3DControler::CopyAttributesTo(cloneObject); cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() ); } // ---------------------------------------------------------------------------- void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual { manualContour3DControler::InsertPoint( x, y, z ); _manualcontour3Vcontroler->InsertPoint_Others(0); } // ---------------------------------------------------------------------------- void manualContour3V3DControler::AddPoint( int x, int y, int z ) { manualContour3DControler::AddPoint( x, y, z ); _manualcontour3Vcontroler->AddPoint_Others(); } // ---------------------------------------------------------------------------- void manualContour3V3DControler::DeleteActualMousePoint(int x, int y) { int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() ); manualContour3DControler::DeleteActualMousePoint( x , y ); _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id); } // ---------------------------------------------------------------------------- void manualContour3V3DControler::MouseMove( int x, int y ) { int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState(); if ((this->GetState()!=7) && (ss!=1)){ manualContour3DControler::MouseMove( x , y ); int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() ); _manualcontour3Vcontroler->MouseMove_Others(id); } } // ---------------------------------------------------------------------------- void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler) { _manualcontour3Vcontroler = manualcontour3Vcontroler; } // ---------------------------------------------------------------------------- manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler() { return _manualcontour3Vcontroler; } // ---------------------------------------------------------------------------- bool manualContour3V3DControler::OnChar() // virtual { if (manualContour3DControler::OnChar()==false ) { _manualcontour3Vcontroler->OnChar_Others(); } return true; } // ---------------------------------------------------------------------------- void manualContour3V3DControler::ResetContour() // virtual { manualContourControler::ResetContour(); _manualcontour3Vcontroler->ResetContour_Others(); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // _state = 0 // ..nothing.. // _state = 1 // move with add point // _state = 5 // move // _state = 6 // move with insert point // _state = 7 // move with non selection manualContourControler::manualContourControler() { _easyCreation = true; } // ---------------------------------------------------------------------------- manualContourControler::~manualContourControler() { } // ---------------------------------------------------------------------------- manualContourControler * manualContourControler :: Clone() // virtual { manualContourControler * clone = new manualContourControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject) { // Fathers object manualContourBaseControler::CopyAttributesTo(cloneObject); cloneObject->SetEasyCreation( this->GetEasyCreation() ); } // ---------------------------------------------------------------------------- void manualContourControler::Configure() //virtual { // this->_manContModel->SetNumberOfPointsSpline(100); } // ---------------------------------------------------------------------------- void manualContourControler::MouseClickLeft(int x, int y){ bool ok = false; int z = GetZ(); int size= GetManualViewBaseContour()->GetNumberOfPoints(); // Insert a Control Point with shift+ClickLeft // int tt = GetState(); // JPRx vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor(); //EED3131 if( IsEditable() ) { if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) ) { ok=true; InsertPoint(x,y,z); size++; } // Start to Insert Control Points with ClickLeft (Empty contour) if ((GetState()==0) && (size==0) && (_easyCreation==true) ) { ok=true; SetState(1); AddPoint(x,y,z); } // Continuie to Insert Control Points with ClickLeft (After being empty the contour) if ((GetState()==1) && (_easyCreation==true) ) { ok=true; AddPoint(x,y,z); _bakIdPoint=GetNumberOfPointsManualContour() - 1; } // Insert Control Points IF Contour si Selected if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() ) { ok=true; InsertPoint(x,y,z); _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(6); } // Chose id of Control Point to be move if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ) { ok=true; _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(5); } // If nothing selected _state=7 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) ) { //ok=true; _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(7); } } else { SetPosibleToMove( true ); GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() ); } if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() ) { SetMoving( true ); ok=true; GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } if (ok==true) { GetManualViewBaseContour()->Refresh(); } } // ---------------------------------------------------------------------------- void manualContourControler::MouseMove(int x, int y) // virtual { int z=GetZ(); GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); GetManualViewBaseContour()->SelectPosibleContour(x,y,z); if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); } if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); } if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() ) { GetManualViewBaseContour()->MoveContour(x,y,z); } if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){ GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } if (!IsEditable()) { GetManualViewBaseContour()->RemoveControlPoints(); GetManualViewBaseContour()->RemoveTextActor(); GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } } // ---------------------------------------------------------------------------- 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; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContourPerpPlaneControler::manualContourPerpPlaneControler() { _flagMouseMove = true; } // ---------------------------------------------------------------------------- manualContourPerpPlaneControler::~manualContourPerpPlaneControler() { } // ---------------------------------------------------------------------------- manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual { manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject) { // Fathers object manualContourControler::CopyAttributesTo(cloneObject); cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() ); cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() ); cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() ); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata) { _vtkmprbasedata = vtkmprbasedata; } // ---------------------------------------------------------------------------- vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData() { return _vtkmprbasedata; } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual { manualContourControler::InsertPoint( x, y, z ); _manualcontour3Vcontroler->InsertPoint_Others(0); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::AddPoint( int x, int y, int z ) { manualContourControler::AddPoint( x, y, z ); _manualcontour3Vcontroler->AddPoint_Others(); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y) { int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() ); manualContourControler::DeleteActualMousePoint( x , y ); _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::MouseMove( int x, int y ) { _flagMouseMove = true; int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState(); if ((this->GetState()!=7) && (ss!=1)){ manualContourControler::MouseMove( x , y ); int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() ); if (id!=-1) { _manualcontour3Vcontroler->MouseMove_Others(id); _flagMouseMove = false; } } } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler) { _manualcontour3Vcontroler = manualcontour3Vcontroler; } // ---------------------------------------------------------------------------- manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler() { return _manualcontour3Vcontroler; } // ---------------------------------------------------------------------------- bool manualContourPerpPlaneControler::OnChar() // virtual { if (manualContourControler::OnChar()==false ) { _manualcontour3Vcontroler->OnChar_Others(); } return true; } // ---------------------------------------------------------------------------- bool manualContourPerpPlaneControler::OnMouseMove() // virtual { manualContourControler::OnMouseMove(); return _flagMouseMove; } // ---------------------------------------------------------------------------- bool manualContourPerpPlaneControler::OnLeftDClick() // virtual { manualContourControler::OnLeftDClick(); return _flagMouseDClick; } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::ResetContour() // virtual { manualContourControler::ResetContour(); _manualcontour3Vcontroler->ResetContour_Others(); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual { _flagMouseDClick=true; manualContourControler::MouseDLeft(x,y); if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true) { _flagMouseDClick = false; _vtkinteractorstyleplane2D->OnLeftDClick(); ResetOrientationPlane(); this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); } // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ()); // if ( (GetState()==0) && (id!=-1) ) // { // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id); // _vtkmprbasedata->SetX( mp->GetX() ); // _vtkmprbasedata->SetY( mp->GetY() ); // _vtkmprbasedata->SetZ( mp->GetZ() ); // ResetOrientationPlane(); // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); // } } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::ResetOrientationPlane() { double p[3],rp[3],rn[3]; p[0] = _vtkmprbasedata->GetX( ); p[1] = _vtkmprbasedata->GetY( ); p[2] = _vtkmprbasedata->GetZ( ); this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn); _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]); } // ---------------------------------------------------------------------------- void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D) { _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D; } // ---------------------------------------------------------------------------- InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D() { return _vtkinteractorstyleplane2D; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // _state = 0 // ..nothing.. // _state = 5 // move point // _state = 6 // move all // _state = 7 // Empty mouse drag manualRoiControler::manualRoiControler() { } // ---------------------------------------------------------------------------- manualRoiControler::~manualRoiControler() { } // ---------------------------------------------------------------------------- manualRoiControler * manualRoiControler :: Clone() // virtual { manualRoiControler * clone = new manualRoiControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject) { // Fathers object manualContourBaseControler::CopyAttributesTo(cloneObject); } // ---------------------------------------------------------------------------- void manualRoiControler::Configure() //virtual { this->GetManualContourModel()->SetNumberOfPointsSpline(5); } // ---------------------------------------------------------------------------- void manualRoiControler::MouseClickLeft(int x, int y){ int z = GetZ(); if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(5); } if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) { GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } int size=GetManualViewBaseContour()->GetNumberOfPoints(); if (GetState()==0) { if (size==0){ AddPoint(x,y,z); AddPoint(x,y,z); AddPoint(x,y,z); AddPoint(x,y,z); } else { SetPoint(0,x,y,z); SetPoint(1,x,y,z); SetPoint(2,x,y,z); SetPoint(3,x,y,z); } bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(5); } GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- void manualRoiControler::MouseMove(int x, int y) // virtual { int z=GetZ(); // this->_vtkInteractorStyleBaseView-> GetManualViewBaseContour()->SelectPosibleContour(x,y,z); GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); if (bakIdPoint==0) { SetPointX( 1 , x ); SetPointY( 3 , y ); } if (bakIdPoint==1) { SetPointX( 0 , x ); SetPointY( 2 , y ); } if (bakIdPoint==2) { SetPointX( 3 , x ); SetPointY( 1 , y ); } if (bakIdPoint==3) { SetPointX( 2 , x ); SetPointY( 0 , y ); } } if (GetState()==6){ GetManualViewBaseContour()->MoveContour(x,y,z); } GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual { } // ---------------------------------------------------------------------------- void manualRoiControler::InitRoi(int ww, int hh, double porcentage) { int zz; manualPoint *mp; if (GetManualContourModel()->GetSizeLstPoints() ==0) { zz = GetZ(); AddPoint(0,0,zz); AddPoint(0,0,zz); AddPoint(0,0,zz); AddPoint(0,0,zz); } double pp1=porcentage; double pp2=1-porcentage; mp = GetManualContourModel()->GetManualPoint(2); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp1,hh*pp1,zz); mp = GetManualContourModel()->GetManualPoint(1); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp2,hh*pp1,zz); mp = GetManualContourModel()->GetManualPoint(0); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp2,hh*pp2,zz); mp = GetManualContourModel()->GetManualPoint(3); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp1,hh*pp2,zz); GetManualViewBaseContour() ->UpdateViewPoint(0); GetManualViewBaseContour() ->UpdateViewPoint(1); GetManualViewBaseContour() ->UpdateViewPoint(2); GetManualViewBaseContour() ->UpdateViewPoint(3); SetState(0); GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2) { manualPoint *mp; InitRoi( 0 , 0 , 0.2 ); mp = GetManualContourModel()->GetManualPoint(2); mp->SetPointX(x1); mp->SetPointY(y1); mp = GetManualContourModel()->GetManualPoint(1); mp->SetPointX(x2); mp->SetPointY(y1); mp = GetManualContourModel()->GetManualPoint(0); mp->SetPointX(x2); mp->SetPointY(y2); mp = GetManualContourModel()->GetManualPoint(3); mp->SetPointX(x1); mp->SetPointY(y2); GetManualViewBaseContour() ->UpdateViewPoint(0); GetManualViewBaseContour() ->UpdateViewPoint(1); GetManualViewBaseContour() ->UpdateViewPoint(2); GetManualViewBaseContour() ->UpdateViewPoint(3); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // EED08 // _state = 0 // ..nothing.. // _state = 5 // move point // _state = 6 // move all // _state = 7 // Empty mouse drag manualCircleControler::manualCircleControler() { } // ---------------------------------------------------------------------------- manualCircleControler::~manualCircleControler() { } // ---------------------------------------------------------------------------- manualCircleControler * manualCircleControler :: Clone() // virtual { manualCircleControler * clone = new manualCircleControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject) { // Fathers object manualContourBaseControler::CopyAttributesTo(cloneObject); } // ---------------------------------------------------------------------------- void manualCircleControler::Configure() //virtual { // this->GetManualContourModel()->SetNumberOfPointsSpline(5); } // ---------------------------------------------------------------------------- void manualCircleControler::MouseClickLeft(int x, int y){ int z = GetZ(); if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(5); } if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) { GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } int size=GetManualViewBaseContour()->GetNumberOfPoints(); if (GetState()==0) { if (size==0){ AddPoint(x,y,z); AddPoint(x,y,z); // AddPoint(x,y,z); // AddPoint(x,y,z); } else { SetPoint(0,x,y,z); SetPoint(1,x,y,z); // SetPoint(2,x,y,z); // SetPoint(3,x,y,z); } bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); SetState(5); } GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- void manualCircleControler::MouseMove(int x, int y) // virtual { int z=GetZ(); // this->_vtkInteractorStyleBaseView-> GetManualViewBaseContour()->SelectPosibleContour(x,y,z); GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); /* if (bakIdPoint==0) { SetPointX( 1 , x ); SetPointY( 3 , y ); } if (bakIdPoint==1) { SetPointX( 0 , x ); SetPointY( 2 , y ); } if (bakIdPoint==2) { SetPointX( 3 , x ); SetPointY( 1 , y ); } if (bakIdPoint==3) { SetPointX( 2 , x ); SetPointY( 0 , y ); } */ } if (GetState()==6){ GetManualViewBaseContour()->MoveContour(x,y,z); } GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual { } // ---------------------------------------------------------------------------- void manualCircleControler::InitRoi(int ww, int hh, double porcentage) { int zz; manualPoint *mp; if (GetManualContourModel()->GetSizeLstPoints() ==0) { zz = GetZ(); AddPoint(0,0,zz); AddPoint(0,0,zz); // AddPoint(0,0,zz); // AddPoint(0,0,zz); } double pp1=porcentage; double pp2=1-porcentage; // mp = GetManualContourModel()->GetManualPoint(2); // zz=(int)mp->GetZ(); // mp->SetPoint(ww*pp1,hh*pp1,zz); mp = GetManualContourModel()->GetManualPoint(1); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp2,hh*pp1,zz); mp = GetManualContourModel()->GetManualPoint(0); zz=(int)mp->GetZ(); mp->SetPoint(ww*pp2,hh*pp2,zz); // mp = GetManualContourModel()->GetManualPoint(3); // zz=(int)mp->GetZ(); // mp->SetPoint(ww*pp1,hh*pp2,zz); GetManualViewBaseContour() ->UpdateViewPoint(0); GetManualViewBaseContour() ->UpdateViewPoint(1); // GetManualViewBaseContour() ->UpdateViewPoint(2); // GetManualViewBaseContour() ->UpdateViewPoint(3); SetState(0); GetManualViewBaseContour()->Refresh(); } // ---------------------------------------------------------------------------- /* void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2) { manualPoint *mp; InitRoi( 0 , 0 , 0.2 ); mp = GetManualContourModel()->GetManualPoint(2); mp->SetPointX(x1); mp->SetPointY(y1); mp = GetManualContourModel()->GetManualPoint(1); mp->SetPointX(x2); mp->SetPointY(y1); mp = GetManualContourModel()->GetManualPoint(0); mp->SetPointX(x2); mp->SetPointY(y2); mp = GetManualContourModel()->GetManualPoint(3); mp->SetPointX(x1); mp->SetPointY(y2); GetManualViewBaseContour() ->UpdateViewPoint(0); GetManualViewBaseContour() ->UpdateViewPoint(1); GetManualViewBaseContour() ->UpdateViewPoint(2); GetManualViewBaseContour() ->UpdateViewPoint(3); } */ // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- manualContourBaseControler::manualContourBaseControler() { _manViewBaseCont = NULL; _manContModel = NULL; _state = 0; _z = -900; _editable = true; _posibleToMove = true; _moving = false; _created = false; _keyBoardMoving = false; } // ---------------------------------------------------------------------------- manualContourBaseControler::~manualContourBaseControler() { } // ---------------------------------------------------------------------------- manualContourBaseControler * manualContourBaseControler :: Clone() // virtual { manualContourBaseControler * clone = new manualContourBaseControler(); CopyAttributesTo(clone); return clone; } // --------------------------------------------------------------------------- void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject) { // Fathers object InteractorStyleMaracas::CopyAttributesTo(cloneObject); cloneObject->SetZ( this->GetZ() ); cloneObject->SetState( this->GetState() ); cloneObject->SetEditable( this->IsEditable() ); cloneObject->SetPosibleToMove( this->GetPosibleToMove() ); cloneObject->SetMoving( this->IsMoving() ); cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() ); cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() ); } // ---------------------------------------------------------------------------- void manualContourBaseControler::Configure() //virtual { } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnChar() { if ( _vtkInteractorStyleBaseView!=NULL ) { char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode(); int X,Y; wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition(X, Y); //int Z = GetZ(); // JPRx // Delete Point if ((keyCode==8) || (keyCode==127)) { if (!GetManualViewBaseContour()->GetPosibleSelected()==true) { DeleteActualMousePoint(X,Y); } GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } else { // Magnet if (keyCode==32) { Magnet(X,Y); GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } else if( !IsEditable() ) { if ( keyCode == 'L' ) { GetManualViewBaseContour()->MoveContour( -1, 0 ); SetKeyBoardMoving( true ); } else if ( keyCode == 'R' ) { GetManualViewBaseContour()->MoveContour( 1, 0 ); SetKeyBoardMoving( true ); } else if ( keyCode == 'U' ) { GetManualViewBaseContour()->MoveContour( 0, -1 ); SetKeyBoardMoving( true ); } else if ( keyCode == 'D' ) { GetManualViewBaseContour()->MoveContour( 0, 1 ); SetKeyBoardMoving( true ); } else if ( keyCode == 'W' )//Diagonal left down { GetManualViewBaseContour()->MoveContour( -1, 1 ); SetKeyBoardMoving( true ); } else if ( keyCode == 'Q' )//Diagonal left up { GetManualViewBaseContour()->MoveContour( -1, -1 ); SetKeyBoardMoving( true ); } else if( keyCode == 'P' )//Diagonal right up { GetManualViewBaseContour()->MoveContour( 1, -1 ); SetKeyBoardMoving( true ); } else if( keyCode == 'M' )//Diagonal right down { GetManualViewBaseContour()->MoveContour( 1, 1 ); SetKeyBoardMoving( true ); } if( GetKeyBoardMoving() ) { GetManualViewBaseContour()->Refresh(); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } } } } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnMouseMove() { if ( _vtkInteractorStyleBaseView!=NULL) { int X,Y; wxVTKRenderWindowInteractor *_wxVTKiren; _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); _wxVTKiren->GetEventPosition( X , Y ); if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) && (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) { MouseMove(X,Y); } } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnLeftButtonDown() { SetKeyBoardMoving( false ); if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); MouseClickLeft(X,Y); } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnLeftButtonUp() { if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); MouseReleaseLeft(X,Y); } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnLeftDClick() { if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); this->MouseDLeft(X,Y); } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnMiddleButtonDown() { // SetKeyBoardMoving( false ); if ( _vtkInteractorStyleBaseView!=NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X,Y); GetManualViewBaseContour()->InitMove( X, Y,GetZ()); } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnMiddleButtonUp() { return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnRightButtonDown() { if( _vtkInteractorStyleBaseView!= NULL ) { int X,Y; wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition(X, Y); SetCompleteCreation( true ); SetKeyBoardMoving( false ); MouseClickRight(X,Y); } return true; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::OnRightButtonUp() { return true; } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){ _manContModel = manContModel; _manViewBaseCont = manViewBaseCont; _manViewBaseCont->SetEditable( &_editable ); } // ---------------------------------------------------------------------------- manualContourModel* manualContourBaseControler::GetManualContourModel() { return _manContModel; } // ---------------------------------------------------------------------------- manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour() { return _manViewBaseCont; } // ---------------------------------------------------------------------------- void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual { } // ---------------------------------------------------------------------------- void manualContourBaseControler::MouseClickRight(int x, int y) { if (_state==1) { _state=0; } SetEditable( false ); SetPosibleToMove( false ); //_state = 0; _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 ); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::MouseDLeft(int x, int y ) { if (_state==0) { int z=GetZ(); GetManualViewBaseContour()->SelectPosibleContour(x,y,z); GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); if ( GetManualViewBaseContour()->GetPosibleSelected() ) { _editable = true; } } } // ---------------------------------------------------------------------------- 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 ) { if (GetManualViewBaseContour()!=NULL) { if( !condition ) { GetManualViewBaseContour()->RemoveControlPoints(); } GetManualViewBaseContour()->SetSelected( condition ); } _editable = condition; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::GetPosibleToMove() { return _posibleToMove; } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetPosibleToMove( bool condition ) { _posibleToMove = condition; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::IsMoving() { return _moving; } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetMoving( bool condition ) { _moving = condition; } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetCompleteCreation( bool condition ) { _created = condition; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::GetIfCompleteCreation ( ) { return _created; } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetKeyBoardMoving( bool condition ) { _keyBoardMoving = condition; } // ---------------------------------------------------------------------------- bool manualContourBaseControler::GetKeyBoardMoving( ) { return _keyBoardMoving; } // ---------------------------------------------------------------------------- void manualContourBaseControler::CreateNewManualContour(){ _manViewBaseCont->CreateNewContour(); } // ---------------------------------------------------------------------------- int manualContourBaseControler::GetNumberOfPointsManualContour(){ return _manViewBaseCont->GetNumberOfPoints(); } // ---------------------------------------------------------------------------- //JSTG - 25-02-08 ------------------------------------------------------------- int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){ //return _manViewBaseCont->GetNumberOfPointsSpline(); return _manContModel->GetNumberOfPointsSpline(); } // ---------------------------------------------------------------------------- double* manualContourBaseControler::GetVectorPointsXManualContour(){ return _manViewBaseCont->GetVectorPointsXManualContour(); } // ---------------------------------------------------------------------------- double* manualContourBaseControler::GetVectorPointsYManualContour(){ return _manViewBaseCont->GetVectorPointsYManualContour(); } // ---------------------------------------------------------------------------- void manualContourBaseControler::DeleteContour(){ _manViewBaseCont->DeleteContour(); _manContModel->DeleteAllPoints(); } // ---------------------------------------------------------------------------- void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual { if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) ) { int id=_manViewBaseCont->GetIdPoint(x,y,GetZ()); if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){ _manContModel->DeletePoint(id); _manViewBaseCont->DeletePoint(id); } } _state = 0; } // ---------------------------------------------------------------------------- void manualContourBaseControler::Magnet(int x, int y) { if( IsEditable()) { /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx if (GetManualContourModel()!=NULL){ double xx = x; double yy = y; double zz = GetZ(); GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1); if (id!=-1) { manualPoint *mp = GetManualContourModel()->GetManualPoint(id); mp->SetPoint(xx,yy,zz); } // GetManualViewBaseContour()->UpdateViewPoint(id); } _state = 0; } } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetZ(int z) { _z=z; } // ---------------------------------------------------------------------------- int manualContourBaseControler::GetZ() { return _z; } // ---------------------------------------------------------------------------- void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual { if (GetManualContourModel()!=NULL){ double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx GetManualViewBaseContour()->AddPoint(); // GetManualViewBaseContour()->UpdateViewPoint(id); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual { //EEDzz int id=-1; if (GetManualContourModel()!=NULL){ double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); if (GetManualContourModel()->GetSizeLstPoints()>1){ id = GetManualContourModel()->InsertPoint(xx,yy,zz); GetManualViewBaseContour()->InsertPoint(id); // GetManualViewBaseContour()->UpdateViewPoint(id); } else { GetManualContourModel()->AddPoint(xx,yy,zz); GetManualViewBaseContour()->AddPoint(); // AddPoint(x,y,z); // GetManualViewBaseContour()->UpdateViewPoint(id); } } } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual if ((GetManualViewBaseContour()!=NULL) && (id>=0)){ double xx = x; double yy = y; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); manualPoint *mp = _manContModel->GetManualPoint(id); mp->SetPoint(xx,yy,zz); GetManualViewBaseContour()->UpdateViewPoint(id); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetPointX( int id ,int x ){ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){ double xx = x; double yy = 0; double zz = 0; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); manualPoint *mp = _manContModel->GetManualPoint(id); mp->SetPointX(xx); GetManualViewBaseContour()->UpdateViewPoint(id); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetPointY( int id ,int y ){ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){ double xx = 0; double yy = y; double zz = 0; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); manualPoint *mp = _manContModel->GetManualPoint(id); mp->SetPointY(yy); GetManualViewBaseContour()->UpdateViewPoint(id); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::SetPointZ( int id ,int z ){ if ((GetManualViewBaseContour()!=NULL) && (id>=0)){ double xx = 0; double yy = 0; double zz = z; GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz); manualPoint *mp = _manContModel->GetManualPoint(id); mp->SetPointZ(zz); GetManualViewBaseContour()->UpdateViewPoint(id); } } // ---------------------------------------------------------------------------- void manualContourBaseControler::ResetContour() // virtual { this->DeleteContour(); GetManualViewBaseContour()->CreateNewContour(); this->SetState(0); }