3 #include <vtkProperty.h>
5 #include <vtkCellArray.h>
6 #include <vtkRenderer.h>
7 #include <vtkCoordinate.h>
8 #include <vtkTextProperty.h>
9 #include <vtkTextActor.h>
10 #include <vtkProperty2D.h>
11 #include <vtkPointPicker.h>
12 #include "widgets/UtilVtk3DGeometriSelection.h"
15 #include "manualContour.h"
18 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 manualPoint::manualPoint(){
24 // ----------------------------------------------------------------------------
25 manualPoint::~manualPoint(){
27 // ----------------------------------------------------------------------------
28 void manualPoint::SetPoint(double x,double y,double z){
33 // ----------------------------------------------------------------------------
34 void manualPoint::SetPointX(double x){
37 // ----------------------------------------------------------------------------
38 void manualPoint::SetPointY(double y){
41 // ----------------------------------------------------------------------------
42 void manualPoint::SetPointZ(double z){
45 // ----------------------------------------------------------------------------
46 double manualPoint::GetX(){
49 // ----------------------------------------------------------------------------
50 double manualPoint::GetY(){
53 // ----------------------------------------------------------------------------
54 double manualPoint::GetZ(){
57 // ----------------------------------------------------------------------------
58 manualPoint * manualPoint :: Clone()
60 manualPoint * clone = new manualPoint();
61 clone->SetPoint( GetX(), GetY(), GetZ());
66 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 manualContourModelCircle::manualContourModelCircle()
71 : manualContourModel()
75 manualContourModelCircle::~manualContourModelCircle()
80 // ----------------------------------------------------------------------------
81 manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
83 manualContourModelCircle * clone = new manualContourModelCircle();
84 CopyAttributesTo(clone);
88 // ---------------------------------------------------------------------------
90 void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
93 manualContourModel::CopyAttributesTo(cloneObject);
96 //----------------------------------------------------------------
97 int manualContourModelCircle::GetTypeModel() //virtual
102 //----------------------------------------------------------------
103 void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
105 double angle = _deltaAngle*i;
106 *x = _radio*cos(angle) + _centerX;
107 *y = _radio*sin(angle) + _centerY;
112 // ---------------------------------------------------------------------------
113 void manualContourModelCircle::UpdateSpline() // virtal
115 manualPoint *mpA,*mpB;
117 int np = GetSizeLstPoints( );
118 int nps = GetNumberOfPointsSpline();
119 _deltaAngle=(3.14159265*2)/(nps-1);
122 mpA = GetManualPoint(0);
123 mpB = GetManualPoint(1);
124 difX = mpA->GetX() - mpB->GetX();
125 difY = mpA->GetY() - mpB->GetY();
126 _radio = sqrt( difX*difX + difY*difY );
127 _centerX = mpA->GetX();
128 _centerY = mpA->GetY();
129 _centerZ = mpA->GetZ();
138 // ----------------------------------------------------------------------------
139 // ----------------------------------------------------------------------------
140 // ----------------------------------------------------------------------------
144 manualContourModelLine::manualContourModelLine()
145 : manualContourModel()
147 printf("EED manualContourModelLine::manualContourModelLine \n");
148 // SetNumberOfPointsSpline(2);
149 SetNumberOfPointsSpline(100);
152 manualContourModelLine::~manualContourModelLine()
157 // ----------------------------------------------------------------------------
158 manualContourModelLine * manualContourModelLine :: Clone() // virtual
160 manualContourModelLine * clone = new manualContourModelLine();
161 CopyAttributesTo(clone);
165 // ---------------------------------------------------------------------------
167 void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
169 manualContourModel::CopyAttributesTo(cloneObject);
172 //----------------------------------------------------------------
173 int manualContourModelLine::GetTypeModel() //virtual
179 //----------------------------------------------------------------
181 void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
183 int np = GetSizeLstPoints();
193 mp = GetManualPoint(0);
204 mp = GetManualPoint(0);
208 mp = GetManualPoint(1);
220 // ----------------------------------------------------------------------------
221 // ----------------------------------------------------------------------------
222 // ----------------------------------------------------------------------------
223 manualContourModelBullEye::manualContourModelBullEye()
224 : manualContourModel()
226 _numberPointsSlineBySector=101; // impaire
229 manualContourModelBullEye::~manualContourModelBullEye()
234 // ----------------------------------------------------------------------------
235 manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
237 manualContourModelBullEye * clone = new manualContourModelBullEye();
238 CopyAttributesTo(clone);
242 // ---------------------------------------------------------------------------
244 void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
247 manualContourModel::CopyAttributesTo(cloneObject);
250 //----------------------------------------------------------------
251 int manualContourModelBullEye::GetTypeModel() //virtual
256 //----------------------------------------------------------------
257 int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
259 return _numberPointsSlineBySector;
262 //----------------------------------------------------------------
263 void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
265 this->_numberPointsSlineBySector = numpoints;
268 //----------------------------------------------------------------
269 void manualContourModelBullEye::AddSector( double radioA,
274 manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
275 modelSector->SetSector(radioA,radioB,ang,angDelta);
276 modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
277 _lstModelBullEyeSector.push_back(modelSector);
280 //----------------------------------------------------------------
281 manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
283 return _lstModelBullEyeSector[id];
286 //----------------------------------------------------------------
287 void manualContourModelBullEye::GetSector(int id,
293 _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
296 void manualContourModelBullEye::UpdateSpline() // virtual
298 manualContourModel::UpdateSpline();
300 if (this->GetSizeLstPoints()>2){
303 manualPoint *mpA = GetManualPoint(0);
304 manualPoint *mpB = GetManualPoint(2);
305 cx = (mpA->GetX() + mpB->GetX()) / 2.0;
306 cy = (mpA->GetY() + mpB->GetY()) / 2.0;
307 ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
308 hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
309 int i,size = _lstModelBullEyeSector.size();
312 _lstModelBullEyeSector[i]->SetCenter(cx,cy);
313 _lstModelBullEyeSector[i]->SetSize(ww,hh);
319 //----------------------------------------------------------------
320 void manualContourModelBullEye::ResetSectors()
322 int i,size=_lstModelBullEyeSector.size();
325 delete _lstModelBullEyeSector[i];
327 _lstModelBullEyeSector.clear();
330 //----------------------------------------------------------------
331 int manualContourModelBullEye::GetSizeOfSectorLst()
333 return _lstModelBullEyeSector.size();
336 //----------------------------------------------------------------
337 void manualContourModelBullEye::Save(FILE *ff) // virtual
339 manualContourModel::Save(ff);
340 int i,size = GetSizeOfSectorLst();
341 fprintf(ff,"numberOfSections %d \n",size);
342 for ( i=0 ; i<size ; i++ )
344 _lstModelBullEyeSector[i]->Save(ff);
348 //----------------------------------------------------------------
349 void manualContourModelBullEye::Open(FILE *ff) // virtual
351 manualContourModel::Open(ff);
357 int numberOfSections;
358 // double radioA,radioB,ang,deltaAng;
360 fscanf(ff,"%s",tmp); // NumberOfSections
361 fscanf(ff,"%s",tmp); // ##
362 numberOfSections = atoi(tmp);
363 for (i=0;i<numberOfSections;i++)
366 _lstModelBullEyeSector[i]->Open(ff);
371 // ----------------------------------------------------------------------------
372 std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
375 std::vector<manualContourModel*> lstTmp;
376 int i,iSize=_lstModelBullEyeSector.size();
377 for (i=0;i<iSize;i++)
379 lstTmp.push_back( _lstModelBullEyeSector[i] );
385 // ----------------------------------------------------------------------------
386 // ----------------------------------------------------------------------------
387 // ----------------------------------------------------------------------------
388 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
389 : manualContourModel()
393 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
398 // ----------------------------------------------------------------------------
399 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
401 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
402 CopyAttributesTo(clone);
406 // ---------------------------------------------------------------------------
408 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
411 manualContourModel::CopyAttributesTo(cloneObject);
414 //----------------------------------------------------------------
415 int manualContourModelBullEyeSector::GetTypeModel() //virtual
421 //----------------------------------------------------------------
422 void manualContourModelBullEyeSector::SetSector( double radioA,
429 _ang = ang*3.14159265/180.0;
430 _angDelta = angDelta*3.14159265/180.0;
433 //----------------------------------------------------------------
434 void manualContourModelBullEyeSector::GetSector(
443 *angDelta = _angDelta;
446 // ----------------------------------------------------------------------------
447 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
453 //----------------------------------------------------------------
454 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
460 //----------------------------------------------------------------
461 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
467 double ang,angcos, angsin;
470 nps = GetNumberOfPointsSpline() - 3;
472 if (i==GetNumberOfPointsSpline()-1)
485 ang = ((double)ii/(nps/2))*_angDelta + _ang;
489 *x = _ww*radio*angcos + _cx;
490 *y = _hh*radio*angsin + _cy;
494 //----------------------------------------------------------------
495 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
497 manualContourModel::Save(ff);
498 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
501 //----------------------------------------------------------------
502 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
505 fscanf(ff,"%s",tmp); // TypeModel
506 fscanf(ff,"%s",tmp); // ##
508 manualContourModel::Open(ff);
511 fscanf(ff,"%s",tmp); // radioA=
512 fscanf(ff,"%s",tmp); // radioA
515 fscanf(ff,"%s",tmp); // radioB=
516 fscanf(ff,"%s",tmp); // radioB
519 fscanf(ff,"%s",tmp); // ang=
520 fscanf(ff,"%s",tmp); // ang
523 fscanf(ff,"%s",tmp); // deltaAng=
524 fscanf(ff,"%s",tmp); // deltaAng
525 _angDelta = atof(tmp);
530 // ---------------------------------------------------------------------------
531 // ---------------------------------------------------------------------------
532 // ---------------------------------------------------------------------------
533 // ---------------------------------------------------------------------------
535 //JSTG 25-02-08 --------------------------------------------------
536 manualContourModelRoi::manualContourModelRoi()
537 : manualContourModel()
539 SetNumberOfPointsSpline(5);
542 manualContourModelRoi::~manualContourModelRoi()
547 // ----------------------------------------------------------------------------
548 manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
550 manualContourModelRoi * clone = new manualContourModelRoi();
551 CopyAttributesTo(clone);
555 // ---------------------------------------------------------------------------
557 void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
560 manualContourModel::CopyAttributesTo(cloneObject);
563 //----------------------------------------------------------------
564 int manualContourModelRoi::GetTypeModel() //virtual
569 //----------------------------------------------------------------
572 // ----------------------------------------------------------------------------
573 // ----------------------------------------------------------------------------
574 // ----------------------------------------------------------------------------
576 manualContourModel::manualContourModel()
578 _cntSplineX = vtkKochanekSpline::New( );
579 _cntSplineY = vtkKochanekSpline::New( );
580 _cntSplineZ = vtkKochanekSpline::New( );
582 this->SetCloseContour(true);
584 _cntSplineX->SetDefaultTension( 0 );
585 _cntSplineX->SetDefaultBias( 0 );
586 _cntSplineX->SetDefaultContinuity( 0 );
588 _cntSplineY->SetDefaultTension( 0 );
589 _cntSplineY->SetDefaultBias( 0 );
590 _cntSplineY->SetDefaultContinuity( 0 );
592 _cntSplineZ->SetDefaultTension( 0 );
593 _cntSplineZ->SetDefaultBias( 0 );
594 _cntSplineZ->SetDefaultContinuity( 0 );
596 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
598 // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
599 _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
602 //---------------------------------------------------------------------------------------------------------------
605 // ----------------------------------------------------------------------------
606 manualContourModel::~manualContourModel()
608 int i,size=_lstPoints.size();
609 for (i=0;i<size; i++){
610 delete _lstPoints[i];
614 _cntSplineX->Delete();
615 _cntSplineY->Delete();
616 _cntSplineZ->Delete();
618 // ----------------------------------------------------------------------------
619 int manualContourModel::AddPoint(double x,double y,double z)
621 manualPoint *mp = new manualPoint();
626 return _lstPoints.size()-1;
628 // ----------------------------------------------------------------------------
629 int manualContourModel::InsertPoint(double x,double y,double z)
631 double dd,ddmin=9999999;
636 int i,ii,iii,size=_lstPoints.size();
637 double j,MaxDivisions=20,porcentage;
640 if (_closeContour==false)
647 for ( i=0 ; i<size ; i++ )
651 x1=_lstPoints[ii]->GetX();
652 y1=_lstPoints[ii]->GetY();
653 z1=_lstPoints[ii]->GetZ();
654 x2=_lstPoints[iii]->GetX();
655 y2=_lstPoints[iii]->GetY();
656 z2=_lstPoints[iii]->GetZ();
657 for (j=0; j<=MaxDivisions; j++)
659 porcentage=(j/MaxDivisions);
660 xx=(x2-x1)*porcentage+x1;
661 yy=(y2-y1)*porcentage+y1;
662 zz=(z2-z1)*porcentage+z1;
663 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
673 if (_closeContour==false)
675 if ( (ibak==1) && (jbak==0) )
679 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
686 //JSTG - 25-04-08 ----------------------------------------------------------
687 //manualPoint *mp = new manualPoint();
688 //mp->SetPoint(x,y,z);
689 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
690 //_lstPoints.insert(itNum,mp);
691 InsertPoint_id(ibak,x,y,z);
692 //----------------------------------------------------------------------------
696 // ----------------------------------------------------------------------------
697 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
699 manualPoint *mp = new manualPoint();
701 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
702 _lstPoints.insert(itNum,mp);
704 // ----------------------------------------------------------------------------
706 void manualContourModel::DeletePoint(int i)
708 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
709 _lstPoints.erase(itNum);
711 // ----------------------------------------------------------------------------
712 void manualContourModel::DeleteAllPoints()
714 int i,size=_lstPoints.size();
715 for (i=0;i<size;i++){
716 _lstPoints.erase( _lstPoints.begin() );
718 this->UpdateSpline();
720 // ----------------------------------------------------------------------------
722 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
724 manualPoint *mp=_lstPoints[i];
725 double x=mp->GetX()+dx;
726 double y=mp->GetY()+dy;
727 double z=mp->GetZ()+dz;
730 // ----------------------------------------------------------------------------
731 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
735 // ----------------------------------------------------------------------------
736 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
738 int i,size=_lstPoints.size();
739 for (i=0;i<size;i++){
740 MovePoint(i,dx,dy,dz);
745 // ----------------------------------------------------------------------------
751 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
753 double range = i_range+1;
755 double xx,yy,zz,dd,ddmin=9999999;
757 int i,size=_lstPoints.size();
758 for (i=0;i<size;i++){
759 manualPoint *mp=_lstPoints[i];
766 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
767 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
776 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
777 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
786 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
787 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
796 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
797 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
807 // ----------------------------------------------------------------------------
808 manualPoint* manualContourModel::GetManualPoint(int id)
810 return _lstPoints[id];
812 // ----------------------------------------------------------------------------
813 int manualContourModel::GetSizeLstPoints()
815 return _lstPoints.size();
817 //----------------------------------------------------------------------------
818 int manualContourModel::GetNumberOfPointsSpline()
820 return _sizePointsContour;
822 //----------------------------------------------------------------------------
823 void manualContourModel::SetNumberOfPointsSpline(int size)
825 _sizePointsContour = size;
829 // ----------------------------------------------------------------------------
831 void manualContourModel::SetCloseContour(bool closeContour)
833 _closeContour = closeContour;
834 if (_closeContour==true)
836 _cntSplineX->ClosedOn();
837 _cntSplineY->ClosedOn();
838 _cntSplineZ->ClosedOn();
840 _cntSplineX->ClosedOff();
841 _cntSplineY->ClosedOff();
842 _cntSplineZ->ClosedOff();
846 // ----------------------------------------------------------------------------
847 bool manualContourModel::IfCloseContour()
849 return _closeContour;
852 // ----------------------------------------------------------------------------
854 void manualContourModel::UpdateSpline() // virtual
857 np = _lstPoints.size();
859 _cntSplineX->RemoveAllPoints();
860 _cntSplineY->RemoveAllPoints();
861 _cntSplineZ->RemoveAllPoints();
862 for( i = 0; i < np; i++ ) {
863 mp = GetManualPoint(i);
864 _cntSplineX->AddPoint( i, mp->GetX() );
865 _cntSplineY->AddPoint( i, mp->GetY() );
866 _cntSplineZ->AddPoint( i, mp->GetZ() );
869 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
870 if (this->_closeContour==true)
872 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
874 _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
876 //-----------------------------------------------------------------------------------------------------------
879 //---------------------------------------------------------------------------------
881 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
883 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
884 double t = delta*(double)i;
885 GetSplinePoint(t, x, y, z);
888 //-----------------------------------------------------------------------------
890 //JSTG 25-02-08 ---------------------------------------------------------------
891 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
893 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
896 // ----------------------------------------------------------------------------
898 //JSTG 25-02-08 ---------------------------------------------------------------
899 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
901 if (_lstPoints.size()==0)
907 if (_lstPoints.size()==1)
910 mp = GetManualPoint(0);
915 if (_lstPoints.size()>=2)
917 *x = _cntSplineX->Evaluate(t);
918 *y = _cntSplineY->Evaluate(t);
919 *z = _cntSplineZ->Evaluate(t);
923 // ----------------------------------------------------------------------------
926 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
928 if (_lstPoints.size()==0)
934 if (_lstPoints.size()==1)
937 mp = GetManualPoint(0);
942 if (_lstPoints.size()>=2)
944 x = _cntSplineX->Evaluate(t);
945 y = _cntSplineY->Evaluate(t);
946 z = _cntSplineZ->Evaluate(t);
949 // ----------------------------------------------------------------------------
950 double manualContourModel::GetPathSize()
956 // JSTG 25-02-08 -----------------------------
960 //--------------------------------------------
962 if (_lstPoints.size()==2)
964 x1=_lstPoints[0]->GetX();
965 y1=_lstPoints[0]->GetY();
966 z1=_lstPoints[0]->GetZ();
967 x2=_lstPoints[1]->GetX();
968 y2=_lstPoints[1]->GetY();
969 z2=_lstPoints[1]->GetZ();
970 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
972 if (_lstPoints.size()>2)
975 // JSTG 25-02-08 ------------------------------------------
976 //np = _lstPoints.size( );
978 //delta=( double ) ( np ) / ( double ) ( nps );
980 //GetSplinePoint(0,x1,y1,z1);
981 GetSpline_i_Point(0,&x1,&y1,&z1);
983 //for( i = 1; i < nps; i++ )
984 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
986 //t = delta * (double)i;
987 //GetSplinePoint(t,x2,y2,z2);
988 GetSpline_i_Point(i,&x2,&y2,&z2);
989 //---------------------------------------------------------
990 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
999 // ----------------------------------------------------------------------------
1000 double manualContourModel::GetPathArea()
1002 double result = 555;
1003 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1006 //JSTG 25-02-08 ---------------------------------------------
1008 //-----------------------------------------------------------
1014 // This uses Green's theorem:
1015 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1016 // A < 0 -> A = |A| (a negative value could raise because points are
1017 // given in clockwise order).
1019 //JSTG 25-02-08 -------------------------------------------------
1020 //int np = _lstPoints.size( );
1022 int nps = GetNumberOfPointsSpline();
1023 //double delta=( double ) ( np ) / ( double ) ( nps );
1025 for( i = 0, area = 0.0; i < nps; i++ )
1027 j = ( i + 1 ) % nps;
1028 //ti = delta * (double)i;
1029 //tj = delta * (double)j;
1030 //GetSplinePoint(ti,x1,y1,z1);
1031 //GetSplinePoint(tj,x2,y2,z2);
1032 GetSpline_i_Point(i,&x1,&y1,&z1);
1033 GetSpline_i_Point(j,&x2,&y2,&z2);
1034 //----------------------------------------------------------------
1044 area = fabs( area );
1047 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1049 j = ( i + 1 ) % _lstPoints.size();
1052 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1053 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1054 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1060 area = fabs( area );
1076 // ----------------------------------------------------------------------------
1077 // p[x,y,z] : data in
1078 // rp[x,y,z] : data out result point
1079 // rn[x,y,z] : data out result normal
1081 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1083 double distMin=999999999;
1084 double dist,dx,dy,dz;
1089 //JSTG 25-02-08 -------------------
1093 //---------------------------------
1095 np = _lstPoints.size( );
1098 // JSTG 25-02-08 ------------------------------------------
1100 nps = GetNumberOfPointsSpline();
1101 //delta = ( double ) ( np ) / ( double ) ( nps );
1103 //GetSplinePoint(0,x1,y1,z1);
1104 GetSpline_i_Point(0,&x1,&y1,&z1);
1105 for( i = 0; i < nps; i++ )
1107 //t = delta * (double)i;
1108 //GetSplinePoint(t,x1,y1,z1);
1109 GetSpline_i_Point(i,&x1,&y1,&z1);
1110 //----------------------------------------------------------
1114 dist = sqrt( dx*dx + dy*dy + dz*dz );
1132 // JSTG 25-02-08 ------------------------------------------
1136 //t = delta * (double)1.0;
1137 //GetSplinePoint(t,x1,y1,z1);
1138 GetSpline_i_Point(i,&x1,&y1,&z1);
1139 //----------------------------------------------------------
1156 // ----------------------------------------------------------------------------
1157 manualContourModel * manualContourModel :: Clone() // virtual
1159 manualContourModel * clone = new manualContourModel();
1160 CopyAttributesTo(clone);
1164 // ----------------------------------------------------------------------------
1165 void manualContourModel::Open(FILE *ff) // virtual
1169 int numberOfControlPoints;
1172 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1173 fscanf(ff,"%s",tmp); // ##
1174 numberOfControlPoints = atoi(tmp);
1175 for (i=0;i<numberOfControlPoints;i++)
1177 fscanf(ff,"%s",tmp); // X
1179 fscanf(ff,"%s",tmp); // Y
1181 fscanf(ff,"%s",tmp); // Z
1188 // ----------------------------------------------------------------------------
1189 int manualContourModel::GetTypeModel() //virtual
1201 // ----------------------------------------------------------------------------
1202 void manualContourModel::Save(FILE *ff) // virtual
1204 int i,size=_lstPoints.size();
1205 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1206 fprintf(ff,"NumberOfControlPoints %d\n",size);
1207 for (i=0;i<size;i++)
1209 manualPoint *mp=_lstPoints[i];
1210 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1215 // ---------------------------------------------------------------------------
1217 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1220 //XXXX::CopyAttributesTo(cloneObject);
1222 cloneObject->SetCloseContour( this->IfCloseContour() );
1223 int i, size = GetSizeLstPoints();
1224 for( i=0; i<size; i++ )
1226 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1228 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1229 cloneObject->SetCloseContour( _closeContour );
1230 cloneObject->UpdateSpline();
1234 // ---------------------------------------------------------------------------
1235 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1237 _lstPoints.push_back( theManualPoint );
1240 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1242 std::vector<manualContourModel*> lstTmp;
1243 lstTmp.push_back(this);
1248 // ---------------------------------------------------------------------------
1249 // ----------------------------------------------------------------------------
1250 // ----------------------------------------------------------------------------
1252 //int manualViewPoint::range=1;
1255 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1257 _posibleSelected = false;
1260 _pointVtkActor = NULL;
1262 _wxvtkbaseview = wxvtkbaseview;
1270 // ----------------------------------------------------------------------------
1271 manualViewPoint::~manualViewPoint(){
1275 // ----------------------------------------------------------------------------
1276 void manualViewPoint::SetWidthLine( double width)
1281 // ----------------------------------------------------------------------------
1282 void manualViewPoint::SetSelected(bool selected){
1285 // ----------------------------------------------------------------------------
1286 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1287 _posibleSelected=posibleSelected;
1289 // ----------------------------------------------------------------------------
1290 bool manualViewPoint::GetSelected(){
1293 // ----------------------------------------------------------------------------
1294 bool manualViewPoint::GetPosibleSelected(){
1295 return _posibleSelected;
1297 // ----------------------------------------------------------------------------
1298 void manualViewPoint::DeleteVtkObjects(){
1299 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1300 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1301 if (_pts !=NULL) { _pts ->Delete(); }
1302 if (_pd !=NULL) { _pd ->Delete(); }
1303 _pointVtkActor = NULL;
1311 // ----------------------------------------------------------------------------
1312 vtkActor* manualViewPoint::CreateVtkPointActor()
1316 _pts = vtkPoints::New();
1317 _pts->SetNumberOfPoints(8);
1318 _pts->SetPoint(0, -1000 , -1000 , 0 );
1319 _pts->SetPoint(1, 1000 , -1000 , 0 );
1320 _pts->SetPoint(2, 1000 , 1000 , 0 );
1321 _pts->SetPoint(3, -1000 , 1000 , 0 );
1322 _pts->SetPoint(4, -1000 , 1000 , 0 );
1323 _pts->SetPoint(5, -1000 , 1000 , 0 );
1324 _pts->SetPoint(6, -1000 , 1000 , 0 );
1325 _pts->SetPoint(7, -1000 , 1000 , 0 );
1327 vtkCellArray *lines = vtkCellArray::New();
1328 lines->InsertNextCell(17);
1329 lines->InsertCellPoint(0);
1330 lines->InsertCellPoint(1);
1331 lines->InsertCellPoint(2);
1332 lines->InsertCellPoint(3);
1333 lines->InsertCellPoint(0);
1334 lines->InsertCellPoint(4);
1335 lines->InsertCellPoint(5);
1336 lines->InsertCellPoint(6);
1337 lines->InsertCellPoint(7);
1338 lines->InsertCellPoint(4);
1339 lines->InsertCellPoint(0);
1340 lines->InsertCellPoint(3);
1341 lines->InsertCellPoint(7);
1342 lines->InsertCellPoint(6);
1343 lines->InsertCellPoint(2);
1344 lines->InsertCellPoint(1);
1345 lines->InsertCellPoint(5);
1347 _pd = vtkPolyData::New();
1348 _pd->SetPoints( _pts );
1349 _pd->SetLines( lines );
1350 lines->Delete(); //do not delete lines ??
1352 _pointVtkActor = vtkActor::New();
1353 _bboxMapper = vtkPolyDataMapper::New();
1355 _bboxMapper->SetInput(_pd);
1356 _bboxMapper->ImmediateModeRenderingOn();
1357 _pointVtkActor->SetMapper(_bboxMapper);
1358 _pointVtkActor->GetProperty()->BackfaceCullingOn();
1360 _pd->ComputeBounds();
1362 return _pointVtkActor;
1364 // ----------------------------------------------------------------------------
1365 vtkActor* manualViewPoint::GetVtkActor(){
1366 return _pointVtkActor;
1368 // ----------------------------------------------------------------------------
1369 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1371 // double range=0.2; // i_range;
1372 // double range=(double)manualViewPoint::range;
1374 double range=i_range;
1379 posZ = posZ * _spc[2];
1382 _pts->SetPoint(0, x-range, y+range, posZ-range);
1383 _pts->SetPoint(1, x+range, y+range, posZ-range);
1384 _pts->SetPoint(2, x+range, y-range, posZ-range);
1385 _pts->SetPoint(3, x-range, y-range, posZ-range);
1386 _pts->SetPoint(4, x-range, y+range, posZ+range);
1387 _pts->SetPoint(5, x+range, y+range, posZ+range);
1388 _pts->SetPoint(6, x+range, y-range, posZ+range);
1389 _pts->SetPoint(7, x-range, y-range, posZ+range);
1394 // ----------------------------------------------------------------------------
1395 void manualViewPoint::UpdateColorActor()
1397 if (_pointVtkActor!=NULL){
1399 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1400 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1401 if (_posibleSelected==true){
1402 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1406 // ----------------------------------------------------------------------------
1407 void manualViewPoint::GetSpacing(double spc[3])
1413 // ----------------------------------------------------------------------------
1414 void manualViewPoint::SetSpacing(double spc[3])
1423 // ----------------------------------------------------------------------------
1424 // ----------------------------------------------------------------------------
1425 // ----------------------------------------------------------------------------
1427 manualViewContour::manualViewContour()
1429 _id_viewPoint_for_text = 0;
1431 _initialConoturModel = new manualContourModel();
1433 // ----------------------------------------------------------------------------
1434 manualViewContour::~manualViewContour()
1436 delete _initialConoturModel;
1438 // ----------------------------------------------------------------------------
1440 // ----------------------------------------------------------------------------
1441 manualViewContour * manualViewContour :: Clone()
1443 manualViewContour * clone = new manualViewContour();
1444 CopyAttributesTo(clone);
1448 // ---------------------------------------------------------------------------
1450 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1452 // Call to Fathers object
1453 manualViewBaseContour::CopyAttributesTo(cloneObject);
1455 cloneObject->SetMesureScale(_mesureScale);
1458 // ---------------------------------------------------------------------------
1460 int manualViewContour::GetType() // virtual
1465 // ----------------------------------------------------------------------------
1467 void manualViewContour::Save(FILE *pFile)
1469 manualViewBaseContour::Save(pFile);
1472 // ----------------------------------------------------------------------------
1474 void manualViewContour::Open(FILE *pFile)
1480 // ----------------------------------------------------------------------------
1481 void manualViewContour::RefreshContour() // virtual
1486 //JSTG 25-02-08 --------------------
1487 //double t,delta, x,y,z;
1489 //----------------------------------
1491 _manContModel->UpdateSpline();
1492 np = GetNumberOfPoints( );
1493 //nps = GetNumberOfPointsSpline();
1494 nps = _manContModel->GetNumberOfPointsSpline();
1495 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1497 //printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
1503 for( i = 0; i < nps; i++ )
1505 //JSTG 25-02-08 ------------------------------------------------
1506 //t = delta * (double)i;
1507 //_manContModel->GetSplinePoint(t,x,y,z);
1508 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1509 //--------------------------------------------------------------
1511 // _pts->SetPoint(i, x,y,z );
1512 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1515 // printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
1523 _pts->SetPoint(0, 0 , 0 , 0);
1524 _pts->SetPoint(1, 0 , 0 , 0);
1529 // ----------------------------------------------------------------------------
1530 void manualViewContour::RefreshText() // virtual
1533 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1534 int size = GetNumberOfPoints();
1536 char resultText[50];
1537 strcpy(resultText," ");
1540 strcpy(resultText,"L= ");
1541 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1542 strcat(resultText,text);
1546 if (_manContModel->IfCloseContour()==true)
1548 strcpy(resultText,"P= ");
1549 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1550 strcat(resultText,text);
1551 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1552 strcat(resultText," A= ");
1553 strcat(resultText,text);
1555 strcpy(resultText,"L= ");
1556 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1557 strcat(resultText,text);
1561 _textActor -> SetInput(resultText);
1566 for (i=0; i<size; i++)
1568 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1570 _id_viewPoint_for_text = i;
1574 int id = _id_viewPoint_for_text;
1575 double px = _manContModel->GetManualPoint(id)->GetX();
1576 double py = _manContModel->GetManualPoint(id)->GetY();
1582 _textActor->SetPosition(px+GetRange()+1,py);
1588 // ----------------------------------------------------------------------------
1589 bool manualViewContour::ifTouchContour(int x,int y,int z){
1597 TransfromeCoordViewWorld(xx,yy,zz);
1604 unsigned int i, nps,nps_t;
1605 nps = _sizePointsContour;
1607 if (this->_manContModel->IfCloseContour()==true)
1615 //printf("\n Number of points %d ",nps_t);
1617 printf("EED %p manualViewContour::ifTouchContour >>>> nps_t=%d nps=%d x=%f y=%f z=%f \n", this , nps_t, nps, xx, yy, zz );
1619 for( i = 0; i < nps_t; i++ )
1621 _pts->GetPoint(i%nps, ppA);
1622 _pts->GetPoint((i+1)%nps, ppB);
1623 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1624 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1625 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]));
1628 printf("%f %f %f - ", ppB[0], ppB[1], ppB[2] );
1630 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1639 printf("EED %p manualViewContour::ifTouchContour true \n", this );
1641 printf("EED %p manualViewContour::ifTouchContour false \n", this );
1646 // ----------------------------------------------------------------------------
1647 void manualViewContour::DeletePoint(int id) // virtual
1649 if (_lstViewPoints.size()>2)
1651 manualViewBaseContour::DeletePoint( id );
1654 // ----------------------------------------------------------------------------
1656 void manualViewContour::ClearPoint(int id)
1658 manualViewBaseContour::DeletePoint( id );
1661 //-------------------------------------------------------------------
1662 void manualViewContour::SetMesureScale(double mesureScale)
1664 _mesureScale = mesureScale;
1666 //-------------------------------------------------------------------
1667 void manualViewContour::InitMove(int x, int y, int z)
1669 _initialConoturModel->DeleteAllPoints();
1671 manualPoint *mp = NULL;
1675 TransfromeCoordViewWorld(XX,YY,ZZ);
1677 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1678 for ( i=0; i<manualPointsSZ; i++ )
1680 mp = _manContModel->GetManualPoint( i );
1681 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1684 //-------------------------------------------------------------------
1685 void manualViewContour::MoveContour(int x, int y, int z)
1687 manualPoint *mpOrigin = NULL;
1688 manualPoint *mpMoving = NULL;
1693 TransfromeCoordViewWorld(XX,YY,ZZ);
1695 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1696 for ( i=0; i<manualPointsSZ; i++ )
1698 mpOrigin = _manContModel->GetManualPoint( i );
1699 mpMoving = _initialConoturModel->GetManualPoint(i);
1700 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1704 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1706 manualPoint *mpOrigin = NULL;
1708 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1709 for ( i=0; i<manualPointsSZ; i++ )
1711 mpOrigin = _manContModel->GetManualPoint( i );
1712 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1716 // ----------------------------------------------------------------------------
1717 // ----------------------------------------------------------------------------
1718 // ----------------------------------------------------------------------------
1721 manualView3VContour::manualView3VContour(int type)
1724 // JSTG 25-02-08 ------------------------------
1725 //_manContModel= new manualContourModel();
1726 //---------------------------------------------
1728 // ----------------------------------------------------------------------------
1729 manualView3VContour::~manualView3VContour()
1735 // ----------------------------------------------------------------------------
1736 manualView3VContour * manualView3VContour :: Clone()
1738 manualView3VContour * clone = new manualView3VContour( GetType() );
1739 CopyAttributesTo(clone);
1743 // ---------------------------------------------------------------------------
1745 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1748 manualViewContour::CopyAttributesTo(cloneObject);
1751 int manualView3VContour::GetType()
1756 // ----------------------------------------------------------------------------
1757 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1772 // ----------------------------------------------------------------------------
1774 void manualView3VContour::RefreshContour() // virtula
1776 manualViewContour::RefreshContour();
1779 // JSTG 25-02-08 ----------------------------------------
1780 //int nps = GetNumberOfPointsSpline();
1781 int nps = _manContModel->GetNumberOfPointsSpline();
1782 //-------------------------------------------------------
1783 for( i = 0; i < nps; i++ )
1785 _pts->GetPoint( i, pp );
1786 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1789 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1794 // ----------------------------------------------------------------------------
1796 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1798 manualPoint *mp = _manContModel->GetManualPoint(id);
1803 FilterCordinateXYZ(x,y,z);
1804 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1807 // ----------------------------------------------------------------------------
1809 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1812 if (_manContModel!=NULL){
1816 TransfromeCoordViewWorld(xx,yy,zz,-1);
1817 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1822 // ----------------------------------------------------------------------------
1823 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1831 TransfromeCoordViewWorld(xx,yy,zz,-1);
1838 unsigned int i, nps,nps_t;
1839 nps = _sizePointsContour;
1840 if (this->_manContModel->IfCloseContour()==true)
1846 FilterCordinateXYZ(xx,yy,zz);
1848 for( i = 0; i < nps_t; i++ ) {
1849 _pts->GetPoint(i%nps, ppA);
1850 _pts->GetPoint((i+1)%nps, ppB);
1851 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1852 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1853 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1854 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1855 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]));
1856 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1863 // ----------------------------------------------------------------------------
1864 // ----------------------------------------------------------------------------
1865 // ----------------------------------------------------------------------------
1866 manualView3DContour::manualView3DContour()
1869 // ----------------------------------------------------------------------------
1870 manualView3DContour::~manualView3DContour()
1874 // ----------------------------------------------------------------------------
1875 manualView3DContour * manualView3DContour :: Clone()
1877 manualView3DContour * clone = new manualView3DContour();
1878 CopyAttributesTo(clone);
1882 // ---------------------------------------------------------------------------
1883 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1886 manualViewContour::CopyAttributesTo(cloneObject);
1888 cloneObject->SetDimensions ( _w , _h , _d );
1890 // ----------------------------------------------------------------------------
1891 void manualView3DContour::SetDimensions(int w, int h, int d)
1897 // ----------------------------------------------------------------------------
1898 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1900 X = _vtkmprbasedata->GetX();
1901 Y = _vtkmprbasedata->GetY();
1902 Z = _vtkmprbasedata->GetZ();
1904 // ----------------------------------------------------------------------------
1905 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1907 _vtkmprbasedata = vtkmprbasedata;
1909 // ----------------------------------------------------------------------------
1910 int manualView3DContour::GetIdPoint2(int x, int y)
1913 double p[3],pA[3],pB[3];
1915 double pickPoint[ 3 ], cameraPos[ 3 ];
1916 vtkPointPicker* picker = vtkPointPicker::New( );
1917 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1918 picker->Pick( x, y, 0.0, pRenderer );
1919 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1920 picker->GetPickPosition( pickPoint );
1923 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1924 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1926 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1928 double dist,distMin=999999999;
1929 int i,size=this->_manContModel->GetSizeLstPoints();
1930 for (i=0;i<size;i++)
1932 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1936 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1937 if ( (dist<=2*GetRange()) && (dist<distMin) )
1946 // ----------------------------------------------------------------------------
1947 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1949 SelectAllPossibleSelected(false);
1950 int id=GetIdPoint2(x,y);
1953 SetPointPosibleSelected(id,true);
1961 // ----------------------------------------------------------------------------
1962 // ----------------------------------------------------------------------------
1963 // ----------------------------------------------------------------------------
1968 // ----------------------------------------------------------------------------
1969 // ----------------------------------------------------------------------------
1970 // ----------------------------------------------------------------------------
1971 manualViewBullEyeSector::manualViewBullEyeSector()
1975 // ----------------------------------------------------------------------------
1976 void manualViewBullEyeSector::RefreshContour()
1981 //----------------------------------
1983 _manContModel->UpdateSpline();
1984 nps = _manContModel->GetNumberOfPointsSpline();
1988 for( i = 0; i < nps; i++ )
1990 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1991 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1997 // ----------------------------------------------------------------------------
1998 // ----------------------------------------------------------------------------
1999 // ----------------------------------------------------------------------------
2002 manualViewBullEye::manualViewBullEye()
2006 // ----------------------------------------------------------------------------
2007 manualViewBullEye::~manualViewBullEye()
2010 int i,size=lstSectorBullEye.size();
2011 for (i=0;i<size;i++)
2013 delete lstSectorBullEye[i];
2015 lstSectorBullEye.clear();
2019 // ----------------------------------------------------------------------------
2020 manualViewBullEye * manualViewBullEye :: Clone()
2022 manualViewBullEye * clone = new manualViewBullEye();
2023 CopyAttributesTo(clone);
2027 // ---------------------------------------------------------------------------
2029 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2032 manualViewBaseContour::CopyAttributesTo(cloneObject);
2036 // ----------------------------------------------------------------------------
2037 int manualViewBullEye::GetType() // virtual
2043 // ----------------------------------------------------------------------------
2044 void manualViewBullEye::RefreshContour() // virtual
2046 // External Rectangle
2047 manualViewRoi::RefreshContour();
2049 _manContModel->UpdateSpline();
2050 int np = GetNumberOfPoints( );
2051 // Refres sectors of BullEye(s)
2055 int i,size = lstSectorBullEye.size();
2056 for (i=0;i<size;i++)
2058 lstSectorBullEye[i]->RefreshContour();
2065 // ----------------------------------------------------------------------------
2066 void manualViewBullEye::ConstructVTKObjects() // virtual
2068 manualViewRoi::ConstructVTKObjects();
2071 this->GetSpacing(spc);
2072 manualViewBullEyeSector *mvbc;
2073 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2074 int i,size = mcmbe->GetSizeOfSectorLst();
2075 for ( i=0 ; i<size ; i++ )
2077 mvbc = new manualViewBullEyeSector();
2078 mvbc->SetModel( mcmbe->GetModelSector(i) );
2079 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2080 mvbc->SetRange( 2 );
2082 mvbc->SetSpacing(spc);
2083 mvbc->SetColorNormalContour(1, 0, 0);
2084 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2085 // mvbc->SetColorSelectContour(1, 0.8, 0);
2086 mvbc->SetWidthLine( this->GetWidthLine() );
2088 mvbc->ConstructVTKObjects();
2089 lstSectorBullEye.push_back( mvbc );
2095 // ----------------------------------------------------------------------------
2096 void manualViewBullEye::AddSplineActor() // virtual
2098 manualViewRoi::AddSplineActor();
2099 int i,size=lstSectorBullEye.size();
2100 for (i=0;i<size;i++)
2102 lstSectorBullEye[i]->AddSplineActor();
2106 // ----------------------------------------------------------------------------
2107 void manualViewBullEye::RemoveSplineActor() // virtual
2109 manualViewRoi::RemoveSplineActor();
2110 int i,size=lstSectorBullEye.size();
2111 for (i=0;i<size;i++)
2113 lstSectorBullEye[i]->RemoveSplineActor();
2118 // ----------------------------------------------------------------------------
2119 // ----------------------------------------------------------------------------
2120 // ----------------------------------------------------------------------------
2122 manualViewRoi::manualViewRoi()
2124 _sizePointsContour=5;
2126 // ----------------------------------------------------------------------------
2127 manualViewRoi::~manualViewRoi()
2132 // ----------------------------------------------------------------------------
2133 manualViewRoi * manualViewRoi :: Clone()
2135 manualViewRoi * clone = new manualViewRoi();
2136 CopyAttributesTo(clone);
2140 // ---------------------------------------------------------------------------
2142 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2145 manualViewBaseContour::CopyAttributesTo(cloneObject);
2148 // ----------------------------------------------------------------------------
2149 void manualViewRoi::RefreshContour() // virtual
2151 unsigned int i,ii, np;
2152 np = GetNumberOfPoints( );
2159 for( i = 0; i < np+1; i++ ) {
2161 mp = _manContModel->GetManualPoint(ii);
2164 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2165 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2166 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2169 // _pts->SetPoint(i, XX,YY,ZZ );
2170 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2174 _pts->SetPoint(0, 0 , 0 , 0);
2175 _pts->SetPoint(1, 0 , 0 , 0);
2180 // ----------------------------------------------------------------------------
2181 int manualViewRoi::GetType() // virtual
2186 // ----------------------------------------------------------------------------
2188 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2199 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2201 for( i = 0; i < size; i++ )
2204 mp=_manContModel->GetManualPoint(i);
2239 // ----------------------------------------------------------------------------
2242 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2245 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2247 GetMinMax(px1,py1, px2, py2);
2252 TransfromeCoordViewWorld(xx,yy,zz);
2256 double ddx=GetRange();
2257 double ddy=GetRange();
2259 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2264 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2269 if ((ok1==true) && (ok2==false))
2277 // ----------------------------------------------------------------------------
2279 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2285 TransfromeCoordViewWorld(XX,YY,ZZ);
2287 if (_manContModel->GetSizeLstPoints()==4){
2288 mp = _manContModel->GetManualPoint(0);
2289 _dp0[0]= mp->GetX() - XX;
2290 _dp0[1]= mp->GetY() - YY;
2291 _dp0[2]= mp->GetZ();
2293 mp = _manContModel->GetManualPoint(1);
2294 _dp1[0]= mp->GetX() - XX;
2295 _dp1[1]= mp->GetY() - YY;
2296 _dp1[2]= mp->GetZ();
2298 mp = _manContModel->GetManualPoint(2);
2299 _dp2[0]= mp->GetX() - XX;
2300 _dp2[1]= mp->GetY() - YY;
2301 _dp2[2]= mp->GetZ();
2303 mp = _manContModel->GetManualPoint(3);
2304 _dp3[0]= mp->GetX() - XX;
2305 _dp3[1]= mp->GetY() - YY;
2306 _dp3[2]= mp->GetZ();
2310 // ----------------------------------------------------------------------------
2312 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2318 TransfromeCoordViewWorld(XX,YY,ZZ);
2320 mp = _manContModel->GetManualPoint(0);
2321 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2323 mp = _manContModel->GetManualPoint(1);
2324 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2326 mp = _manContModel->GetManualPoint(2);
2327 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2329 mp = _manContModel->GetManualPoint(3);
2330 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2341 // ----------------------------------------------------------------------------
2342 // ----------------------------------------------------------------------------
2343 // ----------------------------------------------------------------------------
2347 manualViewCircle::manualViewCircle()
2349 // _sizePointsContour=5; // default 100
2351 // ----------------------------------------------------------------------------
2352 manualViewCircle::~manualViewCircle()
2357 // ----------------------------------------------------------------------------
2358 manualViewCircle * manualViewCircle :: Clone()
2360 manualViewCircle * clone = new manualViewCircle();
2361 CopyAttributesTo(clone);
2365 // ---------------------------------------------------------------------------
2367 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2370 manualViewBaseContour::CopyAttributesTo(cloneObject);
2374 // ----------------------------------------------------------------------------
2376 void manualViewCircle::RefreshContour(){ // virtual
2378 manualPoint *mpA,*mpB;
2379 unsigned int i, np,nps;
2383 np = GetNumberOfPoints( );
2384 nps = _manContModel->GetNumberOfPointsSpline();
2385 double deltaAngle=(3.14159265*2)/(nps-1);
2390 mpA = _manContModel->GetManualPoint(0);
2391 mpB = _manContModel->GetManualPoint(1);
2392 difX = mpA->GetX() - mpB->GetX();
2393 difY = mpA->GetY() - mpB->GetY();
2394 radio = sqrt( difX*difX + difY*difY );
2395 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2396 manContModelCir->SetRadio(radio);
2398 for( i = 0; i < nps; i++ ) {
2399 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2400 // angle = deltaAngle*i;
2401 // XX = cos(angle)*radio+mpA->GetX();
2402 // YY = sin(angle)*radio+mpA->GetY();
2404 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2407 _pts->SetPoint(0, 0 , 0 , 0);
2408 _pts->SetPoint(1, 0 , 0 , 0);
2414 // ----------------------------------------------------------------------------
2415 int manualViewCircle::GetType() // virtual
2420 // ----------------------------------------------------------------------------
2422 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2424 manualPoint *mpA,*mpB;
2428 np = GetNumberOfPoints( );
2431 mpA = _manContModel->GetManualPoint(0);
2432 mpB = _manContModel->GetManualPoint(1);
2433 difX = mpA->GetX() - mpB->GetX();
2434 difY = mpA->GetY() - mpB->GetY();
2435 radio = sqrt( difX*difX + difY*difY );
2436 minX=mpA->GetX()-radio;
2437 minY=mpA->GetY()-radio;
2438 maxX=mpA->GetX()+radio;
2439 maxY=mpA->GetY()+radio;
2449 // ----------------------------------------------------------------------------
2450 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2453 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2455 GetMinMax(px1,py1, px2, py2);
2460 TransfromeCoordViewWorld(xx,yy,zz);
2464 double ddx=GetRange();
2465 double ddy=GetRange();
2467 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2472 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2477 if ((ok1==true) && (ok2==false))
2486 // ----------------------------------------------------------------------------
2488 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2494 TransfromeCoordViewWorld(XX,YY,ZZ);
2496 if (_manContModel->GetSizeLstPoints()==2){
2497 mp = _manContModel->GetManualPoint(0);
2498 _dp0[0]= mp->GetX() - XX;
2499 _dp0[1]= mp->GetY() - YY;
2500 _dp0[2]= mp->GetZ();
2502 mp = _manContModel->GetManualPoint(1);
2503 _dp1[0]= mp->GetX() - XX;
2504 _dp1[1]= mp->GetY() - YY;
2505 _dp1[2]= mp->GetZ();
2507 mp = _manContModel->GetManualPoint(2);
2508 _dp2[0]= mp->GetX() - XX;
2509 _dp2[1]= mp->GetY() - YY;
2510 _dp2[2]= mp->GetZ();
2512 mp = _manContModel->GetManualPoint(3);
2513 _dp3[0]= mp->GetX() - XX;
2514 _dp3[1]= mp->GetY() - YY;
2515 _dp3[2]= mp->GetZ();
2521 // ----------------------------------------------------------------------------
2522 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2528 TransfromeCoordViewWorld(XX,YY,ZZ);
2530 mp = _manContModel->GetManualPoint(0);
2531 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2533 mp = _manContModel->GetManualPoint(1);
2534 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2536 // mp = _manContModel->GetManualPoint(2);
2537 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2539 // mp = _manContModel->GetManualPoint(3);
2540 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2544 // UpdateViewPoint(2);
2545 // UpdateViewPoint(3);
2551 // ----------------------------------------------------------------------------
2552 // ----------------------------------------------------------------------------
2553 // ----------------------------------------------------------------------------
2557 manualViewLine::manualViewLine()
2560 // ----------------------------------------------------------------------------
2561 manualViewLine::~manualViewLine()
2566 // ----------------------------------------------------------------------------
2567 manualViewLine * manualViewLine :: Clone()
2569 manualViewLine * clone = new manualViewLine();
2570 CopyAttributesTo(clone);
2574 // ---------------------------------------------------------------------------
2576 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2579 manualViewBaseContour::CopyAttributesTo(cloneObject);
2582 // ----------------------------------------------------------------------------
2583 int manualViewLine::GetType() // virtual
2589 // ----------------------------------------------------------------------------
2591 void manualViewLine::InitMove(int x, int y, int z) // virtual
2597 TransfromeCoordViewWorld(XX,YY,ZZ);
2599 if (_manContModel->GetSizeLstPoints()==2)
2601 mp = _manContModel->GetManualPoint(0);
2602 _dp0[0]= mp->GetX() - XX;
2603 _dp0[1]= mp->GetY() - YY;
2604 _dp0[2]= mp->GetZ();
2606 mp = _manContModel->GetManualPoint(1);
2607 _dp1[0]= mp->GetX() - XX;
2608 _dp1[1]= mp->GetY() - YY;
2609 _dp1[2]= mp->GetZ();
2615 // ----------------------------------------------------------------------------
2616 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2622 TransfromeCoordViewWorld(XX,YY,ZZ);
2624 mp = _manContModel->GetManualPoint(0);
2625 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2627 mp = _manContModel->GetManualPoint(1);
2628 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2636 // ----------------------------------------------------------------------------
2637 // ----------------------------------------------------------------------------
2638 // ----------------------------------------------------------------------------
2641 manualViewBaseContour::manualViewBaseContour()
2645 _manContModel = NULL;
2646 _wxvtkbaseview = NULL;
2648 _posibleSelected = false;
2649 _viewControlPoints = false;
2652 _contourVtkActor = NULL;
2655 _sizePointsContour = 100;
2664 _coulorNormal_r = 1;
2665 _coulorNormal_g = 0;
2666 _coulorNormal_b = 1;
2668 _coulorSelection_r = 0;
2669 _coulorSelection_g = 1;
2670 _coulorSelection_b = 0;
2675 // ----------------------------------------------------------------------------
2676 manualViewBaseContour::~manualViewBaseContour()
2678 int i,size=_lstViewPoints.size();
2679 for (i=0;i<size; i++){
2680 delete _lstViewPoints[i];
2682 _lstViewPoints.clear();
2684 // ----------------------------------------------------------------------------
2687 int manualViewBaseContour::GetType() // virtual
2690 //int manualViewBaseContour::GetType() 0;
2691 //int manualViewContour::GetType() 1;
2692 //int manualViewRoi::GetType() 2;
2693 //int manualViewCircle::GetType() 3;
2694 //int manualViewStar::GetType() 4;
2695 //int manualViewLine::GetType() 6;
2700 // ----------------------------------------------------------------------------
2702 void manualViewBaseContour::Save(FILE *pFile)
2704 fprintf(pFile,"TypeView %d\n", GetType() );
2707 // ----------------------------------------------------------------------------
2708 void manualViewBaseContour::Open(FILE *pFile)
2712 // ----------------------------------------------------------------------------
2713 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2715 _viewControlPoints = ifControlPoints;
2716 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2721 //Adding each control point
2722 if( ifControlPoints )
2727 // ---------------------------------------------------------------------------
2729 void manualViewBaseContour :: RemoveCompleteContourActor()
2731 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2732 //Removing the spline
2733 RemoveSplineActor();
2736 //Removing each point
2737 RemoveControlPoints();
2741 // ---------------------------------------------------------------------------
2742 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2744 manualViewBaseContour * clone = new manualViewBaseContour();
2745 CopyAttributesTo(clone);
2750 // ---------------------------------------------------------------------------
2752 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2755 //XXXX::CopyAttributesTo(cloneObject);
2757 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2758 cloneObject-> SetSelected( this->GetSelected() );
2759 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2760 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2761 cloneObject-> SetRange( this->GetRange() );
2762 cloneObject-> SetZ( this->GetZ() );
2763 cloneObject-> SetSpacing( _spc );
2764 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2765 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2766 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2768 int i, size = _lstViewPoints.size();
2769 for ( i=0; i<size; i++ )
2771 cloneObject->AddPoint( );
2775 // ----------------------------------------------------------------------------
2776 void manualViewBaseContour :: AddSplineActor()
2778 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2779 if (_contourVtkActor!=NULL)
2780 theRenderer->AddActor( _contourVtkActor );
2782 // ----------------------------------------------------------------------------
2783 void manualViewBaseContour :: RemoveSplineActor() // virtual
2785 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2786 if (_contourVtkActor!=NULL)
2787 theRenderer->RemoveActor( _contourVtkActor );
2789 // ----------------------------------------------------------------------------
2790 void manualViewBaseContour :: RemoveControlPoints()
2792 if (_wxvtkbaseview!=NULL){
2793 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2794 int i,size=_lstViewPoints.size();
2795 for (i=0;i<size; i++)
2797 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2798 theRenderer->RemoveActor( pointActor );
2801 SetIfViewControlPoints( false );
2803 // ----------------------------------------------------------------------------
2804 void manualViewBaseContour :: AddControlPoints()
2806 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2807 SetIfViewControlPoints( true );
2808 if( _viewControlPoints )
2810 int i,size=_lstViewPoints.size();
2811 for (i=0;i<size; i++)
2813 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2814 theRenderer->AddActor( pointActor );
2818 // ----------------------------------------------------------------------------
2819 void manualViewBaseContour::AddTextActor()
2821 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2823 // ----------------------------------------------------------------------------
2824 void manualViewBaseContour::RemoveTextActor()
2826 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2828 // ----------------------------------------------------------------------------
2829 void manualViewBaseContour::DeleteVtkObjects()
2831 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2832 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2833 if ( _pts != NULL ) { _pts -> Delete(); }
2834 if ( _pd != NULL ) { _pd -> Delete(); }
2835 _contourVtkActor = NULL;
2842 // ----------------------------------------------------------------------------
2843 void manualViewBaseContour::SetWidthLine(double width)
2846 this->UpdateColorActor();
2848 // for the control points
2849 int id, size = _lstViewPoints.size();
2850 for( id=0; id<size; id++)
2852 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2857 // ----------------------------------------------------------------------------
2858 double manualViewBaseContour::GetWidthLine()
2863 // ----------------------------------------------------------------------------
2864 void manualViewBaseContour::ConstructVTKObjects()
2866 //JSTG 29-02-08 -----------------------------------------------
2867 //int i , nps = _sizePointsContour;
2869 int nps = _manContModel->GetNumberOfPointsSpline();
2870 //-------------------------------------------------------------
2872 _pts = vtkPoints::New();
2873 _pts->SetNumberOfPoints(nps);
2875 for (i=0 ; i<nps ; i++){
2876 _pts->SetPoint(i, 0 , 0 , 0 );
2878 // This is for the boundaring inicialisation
2881 _pts->SetPoint(0, 0 , 0 , -1000 );
2882 _pts->SetPoint(1, 0 , 0 , 1000 );
2883 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2884 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2887 vtkCellArray *lines = vtkCellArray::New();
2888 lines->InsertNextCell( nps /* +1 */ );
2889 for ( i=0 ; i<nps+1 ; i++ ){
2890 lines->InsertCellPoint(i % nps );
2893 _pd = vtkPolyData::New();
2894 _pd->SetPoints( _pts );
2895 _pd->SetLines( lines );
2896 lines->Delete(); //do not delete lines ??
2898 _contourVtkActor = vtkActor::New();
2899 _bboxMapper = vtkPolyDataMapper::New();
2900 _bboxMapper->ScalarVisibilityOff( );
2902 _bboxMapper->SetInput(_pd);
2903 _bboxMapper->ImmediateModeRenderingOn();
2904 _contourVtkActor->SetMapper(_bboxMapper);
2905 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2909 _pd->ComputeBounds();
2912 _textActor = vtkTextActor::New();
2913 // _textActor->SetDisplayPosition(200, 200);
2914 _textActor->SetInput("");
2915 // Set coordinates to match the old vtkScaledTextActor default value
2916 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2917 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2918 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2919 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2921 vtkTextProperty *tprop = _textActor->GetTextProperty();
2922 tprop->SetFontSize(14);
2923 tprop->SetFontFamilyToArial();
2924 tprop->SetColor(0, 0, 1);
2926 // ----------------------------------------------------------------------------
2927 void manualViewBaseContour::CreateNewContour()
2929 ConstructVTKObjects();
2931 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2932 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2933 AddCompleteContourActor();
2935 // ----------------------------------------------------------------------------
2936 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2938 manualPoint *mp = _manContModel->GetManualPoint(id);
2941 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2942 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2943 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2945 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2948 // ----------------------------------------------------------------------------
2949 void manualViewBaseContour :: UpdateViewPoints()
2951 int id, size = _lstViewPoints.size();
2952 for( id=0; id<size; id++)
2954 UpdateViewPoint( id );
2958 // ----------------------------------------------------------------------------
2959 void manualViewBaseContour::AddPoint()
2961 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2964 // ----------------------------------------------------------------------------
2965 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2967 _lstViewPoints.push_back( manualViewPoint );
2970 manualViewPoint->SetSpacing(_spc);
2972 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2973 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2976 // ----------------------------------------------------------------------------
2977 void manualViewBaseContour::InsertPoint(int id)
2979 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2982 mvp->SetSpacing(_spc);
2984 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2985 _lstViewPoints.insert(itNum,mvp);
2986 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
2988 // ----------------------------------------------------------------------------
2989 void manualViewBaseContour::DeleteContour()
2991 RemoveCompleteContourActor();
2992 /*if (_contourVtkActor!=NULL){
2993 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
2996 int i,size=_lstViewPoints.size();
2997 for (i=0;i<size;i++){
2998 manualViewBaseContour::DeletePoint(0);
3002 // ----------------------------------------------------------------------------
3003 void manualViewBaseContour::DeletePoint(int id) // virtual
3005 int size=_lstViewPoints.size();
3006 if ( (id>=0) && (id<size) ){
3007 manualViewPoint *mvp =_lstViewPoints[id];
3009 // _handlePicker->DeletePickList(mvp->GetVtkActor());
3010 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
3011 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
3012 _lstViewPoints.erase(itNum);
3017 // ----------------------------------------------------------------------------
3018 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3020 int id=GetIdPoint(x,y,z);
3025 // ----------------------------------------------------------------------------
3026 void manualViewBaseContour::SetSelected(bool selected)
3030 // ----------------------------------------------------------------------------
3031 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3033 _posibleSelected=posibleSelected;
3035 // ----------------------------------------------------------------------------
3036 bool manualViewBaseContour::GetEditable()
3040 // ----------------------------------------------------------------------------
3041 void manualViewBaseContour::SetEditable( bool * condition )
3043 _editable = condition;
3045 // ----------------------------------------------------------------------------
3046 bool manualViewBaseContour::GetSelected()
3050 // ----------------------------------------------------------------------------
3051 bool manualViewBaseContour::GetPosibleSelected()
3053 return _posibleSelected;
3055 // ----------------------------------------------------------------------------
3056 void manualViewBaseContour::DeleteSelectedPoints()
3058 int i,size=_lstViewPoints.size();
3059 for (i=size-1;i>=0;i--){
3060 if (_lstViewPoints[i]->GetSelected()==true){
3066 // ----------------------------------------------------------------------------
3067 void manualViewBaseContour::SelectPoint(int i, bool select)
3069 _lstViewPoints[i]->SetSelected(select);
3071 // ----------------------------------------------------------------------------
3072 void manualViewBaseContour::SelectLstPoints()
3076 // ----------------------------------------------------------------------------
3077 void manualViewBaseContour::SelectAllPoints(bool select)
3079 int i,size=_lstViewPoints.size();
3080 for (i=0;i<size;i++){
3081 SelectPoint(i,select);
3084 //-----------------------------------------------------------------------------
3085 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3087 _viewControlPoints = ifShow;
3089 // ----------------------------------------------------------------------------
3090 bool manualViewBaseContour:: GetIfViewControlPoints()
3092 return _viewControlPoints;
3095 // ----------------------------------------------------------------------------
3096 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3098 _lstViewPoints[id]->SetPosibleSelected(select);
3100 // ----------------------------------------------------------------------------
3101 void manualViewBaseContour::SetPointSelected(int id,bool select)
3103 _lstViewPoints[id]->SetSelected(select);
3105 // ----------------------------------------------------------------------------
3106 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3108 int i,size=_lstViewPoints.size();
3109 for (i=0;i<size;i++){
3110 SetPointPosibleSelected(i,select);
3113 // ----------------------------------------------------------------------------
3114 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3116 SelectAllPossibleSelected(false);
3118 int id = GetIdPoint(x,y,z);
3121 SetPointPosibleSelected(id,true);
3125 // ----------------------------------------------------------------------------
3126 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3129 SetPosibleSelected(result);
3130 int id = GetIdPoint(x,y,z);
3131 if( !GetEditable() && !_selected && id!= -1)
3134 SetPosibleSelected(result);
3138 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3140 if (ifTouchContour(x,y,z)==true)
3143 SetPosibleSelected(result);
3147 if (GetEditable()==false)
3149 if (ifTouchContour(x,y,z)==true)
3152 SetPosibleSelected(result);
3160 // ----------------------------------------------------------------------------
3161 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3165 // ----------------------------------------------------------------------------
3166 void manualViewBaseContour::UnSelectPoint(int i){
3167 _lstViewPoints[i]->SetSelected(false);
3170 // ----------------------------------------------------------------------------
3171 void manualViewBaseContour::UnSelectLstPoints(){
3174 // ----------------------------------------------------------------------------
3175 void manualViewBaseContour::UnSelectAllPoints(){
3176 int i,size=_lstViewPoints.size();
3177 for (i=0;i<size;i++){
3182 // ----------------------------------------------------------------------------
3183 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3184 _manContModel=manContModel;
3186 // ----------------------------------------------------------------------------
3187 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3188 _wxvtkbaseview = wxvtkbaseview;
3190 // ----------------------------------------------------------------------------
3191 void manualViewBaseContour::RefreshContour() // Virtual
3194 // ----------------------------------------------------------------------------
3195 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3197 int i,size = _sizePointsContour;
3198 double *vx = (double*)malloc(sizeof(double)*size);
3199 for (i=0;i<size;i++){
3200 _pts->GetPoint(i,pp);
3205 // ----------------------------------------------------------------------------
3206 double* manualViewBaseContour::GetVectorPointsYManualContour()
3209 int i,size = _sizePointsContour;
3210 double *vy = (double*)malloc(sizeof(double)*size);
3211 for (i=0;i<size;i++){
3212 _pts->GetPoint(i,pp);
3217 // ----------------------------------------------------------------------------
3218 double* manualViewBaseContour::GetVectorPointsZManualContour()
3221 int i,size = _sizePointsContour;
3222 double *vz = (double*)malloc(sizeof(double)*size);
3223 for (i=0;i<size;i++){
3224 _pts->GetPoint(i,pp);
3229 // ----------------------------------------------------------------------------
3230 void manualViewBaseContour::Refresh() // virtual
3232 if (_contourVtkActor!=NULL){
3235 int i,size=_lstViewPoints.size();
3236 for (i=0;i<size;i++){
3238 _lstViewPoints[i]->UpdateColorActor();
3242 if (_show_text==true)
3247 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3250 _wxvtkbaseview->GetRenWin()->Render();
3254 // ----------------------------------------------------------------------------
3255 void manualViewBaseContour::RefreshText() // virtual
3257 if( _textActor!=NULL)
3258 _textActor -> SetInput(" ");
3260 // ----------------------------------------------------------------------------
3261 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3263 _coulorNormal_r = r;
3264 _coulorNormal_g = g;
3265 _coulorNormal_b = b;
3267 // ----------------------------------------------------------------------------
3268 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3270 r = _coulorNormal_r;
3271 g = _coulorNormal_g;
3272 b = _coulorNormal_b;
3274 // ----------------------------------------------------------------------------
3275 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3281 // ----------------------------------------------------------------------------
3282 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3288 // ----------------------------------------------------------------------------
3289 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3291 _coulorSelection_r = r;
3292 _coulorSelection_g = g;
3293 _coulorSelection_b = b;
3295 // ----------------------------------------------------------------------------
3296 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3298 r = _coulorSelection_r;
3299 g = _coulorSelection_g;
3300 b = _coulorSelection_b;
3302 // ----------------------------------------------------------------------------
3303 void manualViewBaseContour::UpdateColorActor()
3305 if (_contourVtkActor!=NULL)
3307 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3308 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3309 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3311 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3315 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3319 // ----------------------------------------------------------------------------
3320 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3323 if (_manContModel!=NULL){
3327 TransfromeCoordViewWorld(xx,yy,zz);
3328 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3333 // ----------------------------------------------------------------------------
3336 int manualViewBaseContour::GetNumberOfPoints()
3338 return _lstViewPoints.size();
3341 // ----------------------------------------------------------------------------
3343 //JSTG 25-02-08 ---------------------------------------------------------------
3344 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3346 return _sizePointsContour;
3348 //----------------------------------------------------------------------------
3350 //JSTG 25-02-08 ---------------------------------------------------------------
3351 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3353 _sizePointsContour = size;
3355 //----------------------------------------------------------------------------
3357 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3359 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3364 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3365 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3368 // ----------------------------------------------------------------------------
3369 void manualViewBaseContour::SetRange(int range)
3373 // ----------------------------------------------------------------------------
3374 int manualViewBaseContour::GetRange()
3378 // ----------------------------------------------------------------------------
3379 void manualViewBaseContour::SetZ(int z)
3383 // ----------------------------------------------------------------------------
3384 int manualViewBaseContour::GetZ()
3389 // ----------------------------------------------------------------------------
3390 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3394 // ----------------------------------------------------------------------------
3395 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3398 // ----------------------------------------------------------------------------
3399 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3403 // ----------------------------------------------------------------------------
3404 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3409 int size=_manContModel->GetSizeLstPoints();
3414 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3420 for( i = 0; i < size; i++ )
3422 mp=_manContModel->GetManualPoint(i);
3474 // ----------------------------------------------------------------------------
3475 void manualViewBaseContour::ClearContour()
3477 if (_contourVtkActor!=NULL){
3478 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3481 int i,size=_lstViewPoints.size();
3482 for (i=0;i<size;i++){
3487 // ----------------------------------------------------------------------------
3488 void manualViewBaseContour::ClearPoint(int id)
3492 // ----------------------------------------------------------------------------
3493 void manualViewBaseContour::SetVisible(bool ok)
3504 int i,size=_lstViewPoints.size();
3505 for (i=0;i<size;i++){
3506 actor = _lstViewPoints[i]->GetVtkActor();
3507 actor->GetProperty()->SetOpacity( opacity );
3509 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3510 _textActor->GetProperty()->SetOpacity( opacity );
3511 _textActor->SetInput(" ");
3514 // ----------------------------------------------------------------------------
3515 void manualViewBaseContour::SetShowText(bool ok)
3518 if (_show_text==false)
3520 _textActor->SetInput(" ");
3523 // ----------------------------------------------------------------------------
3524 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3526 return this->_wxvtkbaseview;
3528 // ----------------------------------------------------------------------------
3529 void manualViewBaseContour::GetSpacing(double spc[3])
3535 // ----------------------------------------------------------------------------
3536 void manualViewBaseContour::SetSpacing(double spc[3])
3544 // ----------------------------------------------------------------------------
3545 // ----------------------------------------------------------------------------
3546 // ----------------------------------------------------------------------------
3548 // _type = 0 Sagital
3549 // _type = 1 Coronal
3551 // _type = -1 View 3D
3553 manualContour3VControler::manualContour3VControler(int type)
3558 // _manViewBaseCont1 = NULL;
3559 // _manViewBaseCont2 = NULL;
3560 // _manViewBaseCont3 = NULL;
3562 //----------------------------------------------------------------------------
3563 manualContour3VControler::~manualContour3VControler()
3567 // ----------------------------------------------------------------------------
3568 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3570 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3571 CopyAttributesTo(clone);
3575 // ---------------------------------------------------------------------------
3576 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3579 manualContourControler::CopyAttributesTo(cloneObject);
3581 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3583 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3586 // ----------------------------------------------------------------------------
3587 int manualContour3VControler::GetType()
3592 // ----------------------------------------------------------------------------
3593 void manualContour3VControler::AddPoint_Others()
3595 manualViewBaseContour *mvbc;
3596 int i,size=this->_lstManualViewBaseContour.size();
3597 for ( i = 0 ; i < size ; i++ )
3599 mvbc = _lstManualViewBaseContour[i];
3604 // if (_manViewBaseCont1!=NULL){
3605 // _manViewBaseCont1->AddPoint();
3606 // _manViewBaseCont2->AddPoint();
3607 // _manViewBaseCont3->AddPoint();
3608 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3611 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3613 // ----------------------------------------------------------------------------
3614 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3617 z=(int)_vtkmprbasedata->GetZ();
3618 if (GetManualContourModel()!=NULL){
3622 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3626 xx=_vtkmprbasedata->GetX();
3631 yy=_vtkmprbasedata->GetY();
3635 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3636 GetManualViewBaseContour()->AddPoint();
3642 // ----------------------------------------------------------------------------
3643 void manualContour3VControler::InsertPoint_Others(int id)
3646 manualViewBaseContour *mvbc;
3647 int i,size=this->_lstManualViewBaseContour.size();
3648 for ( i = 0 ; i < size ; i++ )
3650 mvbc = _lstManualViewBaseContour[i];
3651 mvbc->InsertPoint(id);
3655 if (_manViewBaseCont1!=NULL){
3656 _manViewBaseCont1->InsertPoint(id);
3657 _manViewBaseCont2->InsertPoint(id);
3658 _manViewBaseCont3->InsertPoint(id);
3659 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3663 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3666 // ----------------------------------------------------------------------------
3667 void manualContour3VControler::InsertPoint(int x, int y, int z)
3670 if (GetManualContourModel()!=NULL){
3671 if (GetManualContourModel()->GetSizeLstPoints()>1){
3672 z=(int)_vtkmprbasedata->GetZ();
3676 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3679 xx=_vtkmprbasedata->GetX();
3684 yy=_vtkmprbasedata->GetY();
3687 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3689 GetManualViewBaseContour()->InsertPoint(id);
3690 InsertPoint_Others(0);
3697 // ----------------------------------------------------------------------------
3701 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3702 manualViewBaseContour *manViewBaseCont0,
3703 manualViewBaseContour *manViewBaseCont1,
3704 manualViewBaseContour *manViewBaseCont2,
3705 manualViewBaseContour *manViewBaseCont3)
3707 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3708 _manViewBaseCont1 = manViewBaseCont1;
3709 _manViewBaseCont2 = manViewBaseCont2;
3710 _manViewBaseCont3 = manViewBaseCont3;
3714 // ----------------------------------------------------------------------------
3715 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3717 _lstManualViewBaseContour.push_back( manViewBaseCont );
3720 // ----------------------------------------------------------------------------
3721 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3723 _vtkmprbasedata=vtkmprbasedata;
3725 // ----------------------------------------------------------------------------
3726 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3728 return _vtkmprbasedata;
3730 // ----------------------------------------------------------------------------
3731 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3733 z=(int)_vtkmprbasedata->GetZ();
3734 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3738 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3742 xx=_vtkmprbasedata->GetX();
3746 yy=_vtkmprbasedata->GetY();
3749 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3750 mp->SetPoint(xx,yy,zz);
3754 // ----------------------------------------------------------------------------
3755 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3757 manualViewBaseContour *mvbc;
3758 int i,size=this->_lstManualViewBaseContour.size();
3759 for ( i = 0 ; i < size ; i++ )
3761 mvbc = _lstManualViewBaseContour[i];
3762 mvbc->DeletePoint(id);
3767 if (_manViewBaseCont1!=NULL){
3768 _manViewBaseCont1->DeletePoint(id);
3769 _manViewBaseCont2->DeletePoint(id);
3770 _manViewBaseCont3->DeletePoint(id);
3772 _manViewBaseCont1->Refresh();
3773 _manViewBaseCont2->Refresh();
3774 _manViewBaseCont3->Refresh();
3776 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3779 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3781 // ----------------------------------------------------------------------------
3782 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3784 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3786 manualContourBaseControler::DeleteActualMousePoint( x , y );
3787 DeleteActualMousePoint_Others( id );
3790 // ----------------------------------------------------------------------------
3791 void manualContour3VControler::MouseMove_Others(int id) // virtual
3793 manualViewBaseContour *mvbc;
3794 int i,size=this->_lstManualViewBaseContour.size();
3795 for ( i = 0 ; i < size ; i++ )
3797 mvbc = _lstManualViewBaseContour[i];
3798 mvbc->SelectAllPossibleSelected(false);
3801 mvbc->SetPointPosibleSelected(id,true);
3803 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3809 if (_manViewBaseCont1!=NULL){
3810 _manViewBaseCont1->SelectAllPossibleSelected(false);
3811 _manViewBaseCont2->SelectAllPossibleSelected(false);
3812 _manViewBaseCont3->SelectAllPossibleSelected(false);
3814 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3815 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3816 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3818 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3819 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3820 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3822 _manViewBaseCont1->Refresh();
3823 _manViewBaseCont2->Refresh();
3824 _manViewBaseCont3->Refresh();
3826 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3829 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3833 // ----------------------------------------------------------------------------
3834 void manualContour3VControler::MouseMove(int x, int y) // virtual
3836 manualContourControler::MouseMove( x , y );
3837 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3838 MouseMove_Others( id );
3841 // ----------------------------------------------------------------------------
3842 void manualContour3VControler::OnChar_Others()
3844 manualViewBaseContour *mvbc;
3845 int i,size=this->_lstManualViewBaseContour.size();
3846 for ( i = 0 ; i < size ; i++ )
3848 mvbc = _lstManualViewBaseContour[i];
3853 _manViewBaseCont1->Refresh();
3854 _manViewBaseCont2->Refresh();
3855 _manViewBaseCont3->Refresh();
3857 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3859 // ----------------------------------------------------------------------------
3860 bool manualContour3VControler::OnChar()
3862 manualContourControler::OnChar();
3866 // ----------------------------------------------------------------------------
3867 void manualContour3VControler::ResetContour() // virtual
3869 manualContourControler::ResetContour();
3870 ResetContour_Others();
3873 // ----------------------------------------------------------------------------
3874 void manualContour3VControler::ResetContour_Others()
3876 manualViewBaseContour *mvbc;
3877 int i,size=this->_lstManualViewBaseContour.size();
3878 for ( i = 0 ; i < size ; i++ )
3880 mvbc = _lstManualViewBaseContour[i];
3881 mvbc->DeleteContour();
3882 mvbc->CreateNewContour();
3887 _manViewBaseCont1->DeleteContour();
3888 _manViewBaseCont2->DeleteContour();
3889 _manViewBaseCont3->DeleteContour();
3890 _manViewBaseCont1->CreateNewContour();
3891 _manViewBaseCont2->CreateNewContour();
3892 _manViewBaseCont3->CreateNewContour();
3896 // ----------------------------------------------------------------------------
3897 // ----------------------------------------------------------------------------
3898 // ----------------------------------------------------------------------------
3899 manualContour3DControler::manualContour3DControler()
3902 // ----------------------------------------------------------------------------
3903 manualContour3DControler::~manualContour3DControler()
3906 // ----------------------------------------------------------------------------
3907 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3909 manualContour3DControler * clone = new manualContour3DControler();
3910 CopyAttributesTo(clone);
3914 // ---------------------------------------------------------------------------
3915 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3918 manualContourControler::CopyAttributesTo(cloneObject);
3920 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3923 // ----------------------------------------------------------------------------
3924 bool manualContour3DControler::OnLeftButtonDown()
3927 wxVTKRenderWindowInteractor *wxVTKiren;
3928 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3929 wxVTKiren->GetEventPosition(X,Y);
3930 MouseClickLeft(X,Y);
3933 // ----------------------------------------------------------------------------
3934 void manualContour3DControler::ResetOrientationPlane()
3936 double p[3],rp[3],rn[3];
3937 p[0] = this->GetVtkMPRBaseData()->GetX( );
3938 p[1] = this->GetVtkMPRBaseData()->GetY( );
3939 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3940 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3941 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3943 // ----------------------------------------------------------------------------
3944 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3946 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3947 int id=manualview3Dcontour->GetIdPoint2(x,y);
3948 if ( (GetState()==0) && (id!=-1) )
3950 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3952 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3953 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3954 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3955 ResetOrientationPlane();
3956 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3960 manualContourControler::MouseClickLeft(x,y);
3963 // ----------------------------------------------------------------------------
3964 bool manualContour3DControler::OnChar()
3967 manualContourControler::OnChar();
3968 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3971 ResetOrientationPlane();
3972 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3977 // ----------------------------------------------------------------------------
3978 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3980 _vtkmprbasedata=vtkmprbasedata;
3982 // ----------------------------------------------------------------------------
3983 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3985 return _vtkmprbasedata;
3988 // ----------------------------------------------------------------------------
3989 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
3991 manualContourControler::InsertPoint( x, y, z );
3992 ResetOrientationPlane();
3997 // ----------------------------------------------------------------------------
3998 // ----------------------------------------------------------------------------
3999 // ----------------------------------------------------------------------------
4001 manualContour3V3DControler::manualContour3V3DControler()
4004 // ----------------------------------------------------------------------------
4005 manualContour3V3DControler::~manualContour3V3DControler()
4009 // ----------------------------------------------------------------------------
4010 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
4012 manualContour3V3DControler * clone = new manualContour3V3DControler();
4013 CopyAttributesTo(clone);
4017 // ---------------------------------------------------------------------------
4018 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4021 manualContour3DControler::CopyAttributesTo(cloneObject);
4023 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4025 // ----------------------------------------------------------------------------
4026 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4028 manualContour3DControler::InsertPoint( x, y, z );
4029 _manualcontour3Vcontroler->InsertPoint_Others(0);
4031 // ----------------------------------------------------------------------------
4032 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4034 manualContour3DControler::AddPoint( x, y, z );
4035 _manualcontour3Vcontroler->AddPoint_Others();
4037 // ----------------------------------------------------------------------------
4038 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4040 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4041 manualContour3DControler::DeleteActualMousePoint( x , y );
4042 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4044 // ----------------------------------------------------------------------------
4045 void manualContour3V3DControler::MouseMove( int x, int y )
4047 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4048 if ((this->GetState()!=7) && (ss!=1)){
4049 manualContour3DControler::MouseMove( x , y );
4050 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4051 _manualcontour3Vcontroler->MouseMove_Others(id);
4054 // ----------------------------------------------------------------------------
4055 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4057 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4059 // ----------------------------------------------------------------------------
4060 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4062 return _manualcontour3Vcontroler;
4064 // ----------------------------------------------------------------------------
4065 bool manualContour3V3DControler::OnChar() // virtual
4067 if (manualContour3DControler::OnChar()==false )
4069 _manualcontour3Vcontroler->OnChar_Others();
4074 // ----------------------------------------------------------------------------
4075 void manualContour3V3DControler::ResetContour() // virtual
4077 manualContourControler::ResetContour();
4078 _manualcontour3Vcontroler->ResetContour_Others();
4082 // ----------------------------------------------------------------------------
4083 // ----------------------------------------------------------------------------
4084 // ----------------------------------------------------------------------------
4086 // _state = 0 // ..nothing..
4087 // _state = 1 // move with add point
4088 // _state = 5 // move
4089 // _state = 6 // move with insert point
4090 // _state = 7 // move with non selection
4092 manualContourControler::manualContourControler()
4094 _easyCreation = true;
4097 // ----------------------------------------------------------------------------
4098 manualContourControler::~manualContourControler()
4101 // ----------------------------------------------------------------------------
4102 manualContourControler * manualContourControler :: Clone() // virtual
4104 manualContourControler * clone = new manualContourControler();
4105 CopyAttributesTo(clone);
4108 // ---------------------------------------------------------------------------
4109 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4112 manualContourBaseControler::CopyAttributesTo(cloneObject);
4113 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4116 // ----------------------------------------------------------------------------
4117 void manualContourControler::Configure() //virtual
4119 // this->_manContModel->SetNumberOfPointsSpline(100);
4122 // ----------------------------------------------------------------------------
4123 void manualContourControler::MouseClickLeft(int x, int y){
4128 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4130 // Insert a Control Point with shift+ClickLeft
4131 // int tt = GetState(); // JPRx
4132 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4136 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4142 // Start to Insert Control Points with ClickLeft (Empty contour)
4143 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4149 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4150 if ((GetState()==1) && (_easyCreation==true) )
4154 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4156 // Insert Control Points IF Contour si Selected
4157 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4161 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4164 // Chose id of Control Point to be move
4165 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4168 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4171 // If nothing selected _state=7
4172 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4175 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4181 SetPosibleToMove( true );
4182 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4184 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4188 GetManualViewBaseContour()->InitMove(x,y,z);
4193 GetManualViewBaseContour()->Refresh();
4196 // ----------------------------------------------------------------------------
4197 void manualContourControler::MouseMove(int x, int y) // virtual
4200 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4201 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4202 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4203 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4204 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4206 GetManualViewBaseContour()->MoveContour(x,y,z);
4208 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4209 GetManualViewBaseContour()->Refresh();
4210 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4214 GetManualViewBaseContour()->RemoveControlPoints();
4215 GetManualViewBaseContour()->RemoveTextActor();
4216 GetManualViewBaseContour()->Refresh();
4217 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4222 // ----------------------------------------------------------------------------
4223 void manualContourControler::MouseDLeft( int x, int y)//virtual
4225 manualContourBaseControler::MouseDLeft( x, y);
4228 GetManualViewBaseContour()->AddControlPoints();
4229 GetManualViewBaseContour()->AddTextActor();
4230 GetManualViewBaseContour()->Refresh();
4231 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4234 // ----------------------------------------------------------------------------
4235 void manualContourControler::SetEasyCreation(bool easyCreation)
4237 _easyCreation=easyCreation;
4239 // ----------------------------------------------------------------------------
4240 bool manualContourControler::GetEasyCreation()
4242 return _easyCreation;
4246 // ----------------------------------------------------------------------------
4247 // ----------------------------------------------------------------------------
4248 // ----------------------------------------------------------------------------
4249 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4251 _flagMouseMove = true;
4253 // ----------------------------------------------------------------------------
4254 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4257 // ----------------------------------------------------------------------------
4258 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4260 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4261 CopyAttributesTo(clone);
4265 // ---------------------------------------------------------------------------
4266 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4269 manualContourControler::CopyAttributesTo(cloneObject);
4271 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4272 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4273 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4276 // ----------------------------------------------------------------------------
4277 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4279 _vtkmprbasedata = vtkmprbasedata;
4282 // ----------------------------------------------------------------------------
4283 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4285 return _vtkmprbasedata;
4289 // ----------------------------------------------------------------------------
4290 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4292 manualContourControler::InsertPoint( x, y, z );
4293 _manualcontour3Vcontroler->InsertPoint_Others(0);
4295 // ----------------------------------------------------------------------------
4296 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4298 manualContourControler::AddPoint( x, y, z );
4299 _manualcontour3Vcontroler->AddPoint_Others();
4301 // ----------------------------------------------------------------------------
4302 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4304 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4305 manualContourControler::DeleteActualMousePoint( x , y );
4306 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4308 // ----------------------------------------------------------------------------
4309 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4311 _flagMouseMove = true;
4312 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4313 if ((this->GetState()!=7) && (ss!=1)){
4314 manualContourControler::MouseMove( x , y );
4315 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4318 _manualcontour3Vcontroler->MouseMove_Others(id);
4319 _flagMouseMove = false;
4323 // ----------------------------------------------------------------------------
4324 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4326 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4328 // ----------------------------------------------------------------------------
4329 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4331 return _manualcontour3Vcontroler;
4333 // ----------------------------------------------------------------------------
4334 bool manualContourPerpPlaneControler::OnChar() // virtual
4336 if (manualContourControler::OnChar()==false )
4338 _manualcontour3Vcontroler->OnChar_Others();
4342 // ----------------------------------------------------------------------------
4343 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4345 manualContourControler::OnMouseMove();
4346 return _flagMouseMove;
4348 // ----------------------------------------------------------------------------
4349 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4351 manualContourControler::OnLeftDClick();
4352 return _flagMouseDClick;
4354 // ----------------------------------------------------------------------------
4355 void manualContourPerpPlaneControler::ResetContour() // virtual
4357 manualContourControler::ResetContour();
4358 _manualcontour3Vcontroler->ResetContour_Others();
4361 // ----------------------------------------------------------------------------
4362 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4364 _flagMouseDClick=true;
4365 manualContourControler::MouseDLeft(x,y);
4367 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4369 _flagMouseDClick = false;
4370 _vtkinteractorstyleplane2D->OnLeftDClick();
4371 ResetOrientationPlane();
4372 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4375 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4376 // if ( (GetState()==0) && (id!=-1) )
4378 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4379 // _vtkmprbasedata->SetX( mp->GetX() );
4380 // _vtkmprbasedata->SetY( mp->GetY() );
4381 // _vtkmprbasedata->SetZ( mp->GetZ() );
4382 // ResetOrientationPlane();
4383 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4389 // ----------------------------------------------------------------------------
4390 void manualContourPerpPlaneControler::ResetOrientationPlane()
4392 double p[3],rp[3],rn[3];
4393 p[0] = _vtkmprbasedata->GetX( );
4394 p[1] = _vtkmprbasedata->GetY( );
4395 p[2] = _vtkmprbasedata->GetZ( );
4396 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4398 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4401 // ----------------------------------------------------------------------------
4402 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4404 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4406 // ----------------------------------------------------------------------------
4407 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4409 return _vtkinteractorstyleplane2D;
4412 // ----------------------------------------------------------------------------
4413 // ----------------------------------------------------------------------------
4414 // ----------------------------------------------------------------------------
4416 // _state = 0 // ..nothing..
4417 // _state = 5 // move point
4418 // _state = 6 // move all
4419 // _state = 7 // Empty mouse drag
4421 manualRoiControler::manualRoiControler()
4424 // ----------------------------------------------------------------------------
4425 manualRoiControler::~manualRoiControler()
4428 // ----------------------------------------------------------------------------
4429 manualRoiControler * manualRoiControler :: Clone() // virtual
4431 manualRoiControler * clone = new manualRoiControler();
4432 CopyAttributesTo(clone);
4436 // ---------------------------------------------------------------------------
4437 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4440 manualContourBaseControler::CopyAttributesTo(cloneObject);
4443 // ----------------------------------------------------------------------------
4444 void manualRoiControler::Configure() //virtual
4446 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4449 // ----------------------------------------------------------------------------
4450 void manualRoiControler::MouseClickLeft(int x, int y){
4452 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4453 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4456 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4457 GetManualViewBaseContour()->InitMove(x,y,z);
4460 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4461 if (GetState()==0) {
4473 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4476 GetManualViewBaseContour()->Refresh();
4478 // ----------------------------------------------------------------------------
4479 void manualRoiControler::MouseMove(int x, int y) // virtual
4483 // this->_vtkInteractorStyleBaseView->
4485 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4486 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4489 SetPoint( bakIdPoint , x , y ,z);
4512 GetManualViewBaseContour()->MoveContour(x,y,z);
4514 GetManualViewBaseContour()->Refresh();
4516 // ----------------------------------------------------------------------------
4517 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4520 // ----------------------------------------------------------------------------
4521 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4526 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4535 double pp1=porcentage;
4536 double pp2=1-porcentage;
4538 mp = GetManualContourModel()->GetManualPoint(2);
4540 mp->SetPoint(ww*pp1,hh*pp1,zz);
4542 mp = GetManualContourModel()->GetManualPoint(1);
4544 mp->SetPoint(ww*pp2,hh*pp1,zz);
4546 mp = GetManualContourModel()->GetManualPoint(0);
4548 mp->SetPoint(ww*pp2,hh*pp2,zz);
4550 mp = GetManualContourModel()->GetManualPoint(3);
4552 mp->SetPoint(ww*pp1,hh*pp2,zz);
4554 GetManualViewBaseContour() ->UpdateViewPoint(0);
4555 GetManualViewBaseContour() ->UpdateViewPoint(1);
4556 GetManualViewBaseContour() ->UpdateViewPoint(2);
4557 GetManualViewBaseContour() ->UpdateViewPoint(3);
4560 GetManualViewBaseContour()->Refresh();
4563 // ----------------------------------------------------------------------------
4564 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4567 InitRoi( 0 , 0 , 0.2 );
4568 mp = GetManualContourModel()->GetManualPoint(2);
4572 mp = GetManualContourModel()->GetManualPoint(1);
4576 mp = GetManualContourModel()->GetManualPoint(0);
4580 mp = GetManualContourModel()->GetManualPoint(3);
4584 GetManualViewBaseContour() ->UpdateViewPoint(0);
4585 GetManualViewBaseContour() ->UpdateViewPoint(1);
4586 GetManualViewBaseContour() ->UpdateViewPoint(2);
4587 GetManualViewBaseContour() ->UpdateViewPoint(3);
4591 // ----------------------------------------------------------------------------
4592 // ----------------------------------------------------------------------------
4593 // ----------------------------------------------------------------------------
4597 // _state = 0 // ..nothing..
4598 // _state = 5 // move point
4599 // _state = 6 // move all
4600 // _state = 7 // Empty mouse drag
4602 manualCircleControler::manualCircleControler()
4605 // ----------------------------------------------------------------------------
4606 manualCircleControler::~manualCircleControler()
4609 // ----------------------------------------------------------------------------
4610 manualCircleControler * manualCircleControler :: Clone() // virtual
4612 manualCircleControler * clone = new manualCircleControler();
4613 CopyAttributesTo(clone);
4617 // ---------------------------------------------------------------------------
4618 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4621 manualContourBaseControler::CopyAttributesTo(cloneObject);
4624 // ----------------------------------------------------------------------------
4625 void manualCircleControler::Configure() //virtual
4627 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4630 // ----------------------------------------------------------------------------
4631 void manualCircleControler::MouseClickLeft(int x, int y){
4633 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4634 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4637 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4638 GetManualViewBaseContour()->InitMove(x,y,z);
4641 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4642 if (GetState()==0) {
4651 // SetPoint(2,x,y,z);
4652 // SetPoint(3,x,y,z);
4654 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4657 GetManualViewBaseContour()->Refresh();
4659 // ----------------------------------------------------------------------------
4661 void manualCircleControler::MouseMove(int x, int y) // virtual
4665 // this->_vtkInteractorStyleBaseView->
4667 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4668 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4671 SetPoint( bakIdPoint , x , y ,z);
4697 GetManualViewBaseContour()->MoveContour(x,y,z);
4699 GetManualViewBaseContour()->Refresh();
4703 // ----------------------------------------------------------------------------
4704 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4707 // ----------------------------------------------------------------------------
4709 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4714 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4719 // AddPoint(0,0,zz);
4720 // AddPoint(0,0,zz);
4723 double pp1=porcentage;
4724 double pp2=1-porcentage;
4726 // mp = GetManualContourModel()->GetManualPoint(2);
4727 // zz=(int)mp->GetZ();
4728 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4730 mp = GetManualContourModel()->GetManualPoint(1);
4732 mp->SetPoint(ww*pp2,hh*pp1,zz);
4734 mp = GetManualContourModel()->GetManualPoint(0);
4736 mp->SetPoint(ww*pp2,hh*pp2,zz);
4738 // mp = GetManualContourModel()->GetManualPoint(3);
4739 // zz=(int)mp->GetZ();
4740 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4742 GetManualViewBaseContour() ->UpdateViewPoint(0);
4743 GetManualViewBaseContour() ->UpdateViewPoint(1);
4744 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4745 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4748 GetManualViewBaseContour()->Refresh();
4751 // ----------------------------------------------------------------------------
4753 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4756 InitRoi( 0 , 0 , 0.2 );
4757 mp = GetManualContourModel()->GetManualPoint(2);
4761 mp = GetManualContourModel()->GetManualPoint(1);
4765 mp = GetManualContourModel()->GetManualPoint(0);
4769 mp = GetManualContourModel()->GetManualPoint(3);
4773 GetManualViewBaseContour() ->UpdateViewPoint(0);
4774 GetManualViewBaseContour() ->UpdateViewPoint(1);
4775 GetManualViewBaseContour() ->UpdateViewPoint(2);
4776 GetManualViewBaseContour() ->UpdateViewPoint(3);
4781 // ----------------------------------------------------------------------------
4782 // ----------------------------------------------------------------------------
4783 // ----------------------------------------------------------------------------
4787 // _state = 0 // ..nothing..
4788 // _state = 5 // move point
4789 // _state = 6 // move all
4790 // _state = 7 // Empty mouse drag
4792 manualLineControler::manualLineControler()
4795 // ----------------------------------------------------------------------------
4796 manualLineControler::~manualLineControler()
4799 // ----------------------------------------------------------------------------
4800 manualLineControler * manualLineControler :: Clone() // virtual
4802 manualLineControler * clone = new manualLineControler();
4803 CopyAttributesTo(clone);
4807 // ---------------------------------------------------------------------------
4808 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4811 manualContourBaseControler::CopyAttributesTo(cloneObject);
4814 // ----------------------------------------------------------------------------
4815 void manualLineControler::MouseClickLeft(int x, int y){
4817 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4818 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4821 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4822 GetManualViewBaseContour()->InitMove(x,y,z);
4825 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4826 if (GetState()==0) {
4834 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4837 GetManualViewBaseContour()->Refresh();
4839 // ----------------------------------------------------------------------------
4841 void manualLineControler::MouseMove(int x, int y) // virtual
4845 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4846 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4850 SetPoint( bakIdPoint , x , y ,z);
4854 GetManualViewBaseContour()->MoveContour(x,y,z);
4856 GetManualViewBaseContour()->Refresh();
4860 // ----------------------------------------------------------------------------
4861 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4864 // ----------------------------------------------------------------------------
4866 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4871 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4878 double pp1=porcentage;
4879 double pp2=1-porcentage;
4881 mp = GetManualContourModel()->GetManualPoint(0);
4883 mp->SetPoint(ww*pp2,hh*pp2,zz);
4885 mp = GetManualContourModel()->GetManualPoint(1);
4887 mp->SetPoint(ww*pp2,hh*pp1,zz);
4889 GetManualViewBaseContour() ->UpdateViewPoint(0);
4890 GetManualViewBaseContour() ->UpdateViewPoint(1);
4893 GetManualViewBaseContour()->Refresh();
4896 // ----------------------------------------------------------------------------
4897 // ----------------------------------------------------------------------------
4898 // ----------------------------------------------------------------------------
4901 manualContourBaseControler::manualContourBaseControler()
4903 _manViewBaseCont = NULL;
4904 _manContModel = NULL;
4908 _posibleToMove = true;
4911 _keyBoardMoving = false;
4913 // ----------------------------------------------------------------------------
4914 manualContourBaseControler::~manualContourBaseControler()
4918 // ----------------------------------------------------------------------------
4919 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4921 manualContourBaseControler * clone = new manualContourBaseControler();
4922 CopyAttributesTo(clone);
4926 // ---------------------------------------------------------------------------
4928 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4931 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4932 cloneObject->SetZ( this->GetZ() );
4933 cloneObject->SetState( this->GetState() );
4934 cloneObject->SetEditable( this->IsEditable() );
4935 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4936 cloneObject->SetMoving( this->IsMoving() );
4937 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4938 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4941 // ----------------------------------------------------------------------------
4942 void manualContourBaseControler::Configure() //virtual
4946 // ----------------------------------------------------------------------------
4947 bool manualContourBaseControler::OnChar()
4949 if ( _vtkInteractorStyleBaseView!=NULL )
4951 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4954 wxVTKRenderWindowInteractor *_wxVTKiren;
4955 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4956 _wxVTKiren->GetEventPosition(X, Y);
4957 //int Z = GetZ(); // JPRx
4959 if ((keyCode==8) || (keyCode==127))
4962 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4964 DeleteActualMousePoint(X,Y);
4966 GetManualViewBaseContour()->Refresh();
4967 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4975 GetManualViewBaseContour()->Refresh();
4976 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4978 else if( !IsEditable() )
4980 if ( keyCode == 'L' )
4982 GetManualViewBaseContour()->MoveContour( -1, 0 );
4983 SetKeyBoardMoving( true );
4985 else if ( keyCode == 'R' )
4987 GetManualViewBaseContour()->MoveContour( 1, 0 );
4988 SetKeyBoardMoving( true );
4990 else if ( keyCode == 'U' )
4992 GetManualViewBaseContour()->MoveContour( 0, -1 );
4993 SetKeyBoardMoving( true );
4995 else if ( keyCode == 'D' )
4997 GetManualViewBaseContour()->MoveContour( 0, 1 );
4998 SetKeyBoardMoving( true );
5000 else if ( keyCode == 'W' )//Diagonal left down
5002 GetManualViewBaseContour()->MoveContour( -1, 1 );
5003 SetKeyBoardMoving( true );
5005 else if ( keyCode == 'Q' )//Diagonal left up
5007 GetManualViewBaseContour()->MoveContour( -1, -1 );
5008 SetKeyBoardMoving( true );
5010 else if( keyCode == 'P' )//Diagonal right up
5012 GetManualViewBaseContour()->MoveContour( 1, -1 );
5013 SetKeyBoardMoving( true );
5015 else if( keyCode == 'M' )//Diagonal right down
5017 GetManualViewBaseContour()->MoveContour( 1, 1 );
5018 SetKeyBoardMoving( true );
5020 if( GetKeyBoardMoving() )
5022 GetManualViewBaseContour()->Refresh();
5023 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5030 // ----------------------------------------------------------------------------
5031 bool manualContourBaseControler::OnMouseMove()
5033 if ( _vtkInteractorStyleBaseView!=NULL)
5036 wxVTKRenderWindowInteractor *_wxVTKiren;
5037 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5038 _wxVTKiren->GetEventPosition( X , Y );
5041 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5042 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5048 // ----------------------------------------------------------------------------
5049 bool manualContourBaseControler::OnLeftButtonDown()
5051 SetKeyBoardMoving( false );
5052 if ( _vtkInteractorStyleBaseView!=NULL )
5055 wxVTKRenderWindowInteractor *wxVTKiren;
5056 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5057 wxVTKiren->GetEventPosition(X,Y);
5059 MouseClickLeft(X,Y);
5063 // ----------------------------------------------------------------------------
5064 bool manualContourBaseControler::OnLeftButtonUp()
5066 if ( _vtkInteractorStyleBaseView!=NULL )
5069 wxVTKRenderWindowInteractor *wxVTKiren;
5070 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5071 wxVTKiren->GetEventPosition(X,Y);
5072 MouseReleaseLeft(X,Y);
5076 // ----------------------------------------------------------------------------
5077 bool manualContourBaseControler::OnLeftDClick()
5079 if ( _vtkInteractorStyleBaseView!=NULL )
5082 wxVTKRenderWindowInteractor *wxVTKiren;
5083 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5084 wxVTKiren->GetEventPosition(X,Y);
5086 this->MouseDLeft(X,Y);
5090 // ----------------------------------------------------------------------------
5091 bool manualContourBaseControler::OnMiddleButtonDown()
5093 // SetKeyBoardMoving( false );
5094 if ( _vtkInteractorStyleBaseView!=NULL )
5097 wxVTKRenderWindowInteractor *wxVTKiren;
5098 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5099 wxVTKiren->GetEventPosition(X,Y);
5100 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5104 // ----------------------------------------------------------------------------
5105 bool manualContourBaseControler::OnMiddleButtonUp()
5109 // ----------------------------------------------------------------------------
5110 bool manualContourBaseControler::OnRightButtonDown()
5112 if( _vtkInteractorStyleBaseView!= NULL )
5115 wxVTKRenderWindowInteractor *wxVTKiren;
5116 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5117 wxVTKiren->GetEventPosition(X, Y);
5119 SetCompleteCreation( true );
5120 SetKeyBoardMoving( false );
5121 MouseClickRight(X,Y);
5125 // ----------------------------------------------------------------------------
5126 bool manualContourBaseControler::OnRightButtonUp()
5130 // ----------------------------------------------------------------------------
5131 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5132 _manContModel = manContModel;
5133 _manViewBaseCont = manViewBaseCont;
5134 _manViewBaseCont->SetEditable( &_editable );
5136 // ----------------------------------------------------------------------------
5137 manualContourModel* manualContourBaseControler::GetManualContourModel()
5139 return _manContModel;
5141 // ----------------------------------------------------------------------------
5142 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5144 return _manViewBaseCont;
5146 // ----------------------------------------------------------------------------
5147 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5151 // ----------------------------------------------------------------------------
5152 void manualContourBaseControler::MouseClickRight(int x, int y)
5158 SetEditable( false );
5159 SetPosibleToMove( false );
5163 // ----------------------------------------------------------------------------
5164 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5166 if (_state==5){ _state = 0; }
5167 if (_state==6){ _state = 0; }
5168 if (_state==7){ _state = 0; }
5170 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5171 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5173 SetEditable( false );
5174 SetPosibleToMove( false );
5177 // ----------------------------------------------------------------------------
5178 void manualContourBaseControler::MouseDLeft(int x, int y )
5183 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5184 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5185 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5191 // ----------------------------------------------------------------------------
5192 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5195 // ----------------------------------------------------------------------------
5196 void manualContourBaseControler::SetState(int state)
5200 // ----------------------------------------------------------------------------
5201 int manualContourBaseControler::GetState()
5205 // ----------------------------------------------------------------------------
5206 bool manualContourBaseControler::IsEditable( )
5210 // ----------------------------------------------------------------------------
5211 void manualContourBaseControler::SetEditable( bool condition )
5213 if (GetManualViewBaseContour()!=NULL) {
5216 GetManualViewBaseContour()->RemoveControlPoints();
5218 GetManualViewBaseContour()->SetSelected( condition );
5220 _editable = condition;
5223 // ----------------------------------------------------------------------------
5224 bool manualContourBaseControler::GetPosibleToMove()
5226 return _posibleToMove;
5228 // ----------------------------------------------------------------------------
5229 void manualContourBaseControler::SetPosibleToMove( bool condition )
5231 _posibleToMove = condition;
5233 // ----------------------------------------------------------------------------
5234 bool manualContourBaseControler::IsMoving()
5238 // ----------------------------------------------------------------------------
5239 void manualContourBaseControler::SetMoving( bool condition )
5241 _moving = condition;
5243 // ----------------------------------------------------------------------------
5244 void manualContourBaseControler::SetCompleteCreation( bool condition )
5246 _created = condition;
5248 // ----------------------------------------------------------------------------
5249 bool manualContourBaseControler::GetIfCompleteCreation ( )
5253 // ----------------------------------------------------------------------------
5254 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5256 _keyBoardMoving = condition;
5258 // ----------------------------------------------------------------------------
5259 bool manualContourBaseControler::GetKeyBoardMoving( )
5261 return _keyBoardMoving;
5263 // ----------------------------------------------------------------------------
5264 void manualContourBaseControler::CreateNewManualContour(){
5265 _manViewBaseCont->CreateNewContour();
5267 // ----------------------------------------------------------------------------
5268 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5269 return _manViewBaseCont->GetNumberOfPoints();
5271 // ----------------------------------------------------------------------------
5273 //JSTG - 25-02-08 -------------------------------------------------------------
5274 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5275 //return _manViewBaseCont->GetNumberOfPointsSpline();
5276 return _manContModel->GetNumberOfPointsSpline();
5278 // ----------------------------------------------------------------------------
5280 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5281 return _manViewBaseCont->GetVectorPointsXManualContour();
5283 // ----------------------------------------------------------------------------
5284 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5285 return _manViewBaseCont->GetVectorPointsYManualContour();
5287 // ----------------------------------------------------------------------------
5288 void manualContourBaseControler::DeleteContour(){
5289 _manViewBaseCont->DeleteContour();
5290 _manContModel->DeleteAllPoints();
5292 // ----------------------------------------------------------------------------
5293 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5295 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5297 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5298 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5299 _manContModel->DeletePoint(id);
5300 _manViewBaseCont->DeletePoint(id);
5306 // ----------------------------------------------------------------------------
5307 void manualContourBaseControler::Magnet(int x, int y)
5311 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5312 if (GetManualContourModel()!=NULL){
5316 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5317 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5320 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5321 mp->SetPoint(xx,yy,zz);
5323 // GetManualViewBaseContour()->UpdateViewPoint(id);
5329 // ----------------------------------------------------------------------------
5330 void manualContourBaseControler::SetZ(int z)
5334 // ----------------------------------------------------------------------------
5335 int manualContourBaseControler::GetZ()
5339 // ----------------------------------------------------------------------------
5340 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5342 if (GetManualContourModel()!=NULL){
5346 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5347 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5348 GetManualViewBaseContour()->AddPoint();
5349 // GetManualViewBaseContour()->UpdateViewPoint(id);
5352 // ----------------------------------------------------------------------------
5353 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5357 if (GetManualContourModel()!=NULL){
5361 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5362 if (GetManualContourModel()->GetSizeLstPoints()>1){
5363 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5364 GetManualViewBaseContour()->InsertPoint(id);
5365 // GetManualViewBaseContour()->UpdateViewPoint(id);
5367 GetManualContourModel()->AddPoint(xx,yy,zz);
5368 GetManualViewBaseContour()->AddPoint();
5370 // GetManualViewBaseContour()->UpdateViewPoint(id);
5375 // ----------------------------------------------------------------------------
5376 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5377 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5381 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5382 manualPoint *mp = _manContModel->GetManualPoint(id);
5383 mp->SetPoint(xx,yy,zz);
5384 GetManualViewBaseContour()->UpdateViewPoint(id);
5387 // ----------------------------------------------------------------------------
5388 void manualContourBaseControler::SetPointX( int id ,int x ){
5389 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5393 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5394 manualPoint *mp = _manContModel->GetManualPoint(id);
5396 GetManualViewBaseContour()->UpdateViewPoint(id);
5399 // ----------------------------------------------------------------------------
5400 void manualContourBaseControler::SetPointY( int id ,int y ){
5401 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5405 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5406 manualPoint *mp = _manContModel->GetManualPoint(id);
5408 GetManualViewBaseContour()->UpdateViewPoint(id);
5411 // ----------------------------------------------------------------------------
5412 void manualContourBaseControler::SetPointZ( int id ,int z ){
5413 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5417 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5418 manualPoint *mp = _manContModel->GetManualPoint(id);
5420 GetManualViewBaseContour()->UpdateViewPoint(id);
5423 // ----------------------------------------------------------------------------
5424 void manualContourBaseControler::ResetContour() // virtual
5426 this->DeleteContour();
5427 GetManualViewBaseContour()->CreateNewContour();