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 SetNumberOfPointsSpline(2);
150 manualContourModelLine::~manualContourModelLine()
155 // ----------------------------------------------------------------------------
156 manualContourModelLine * manualContourModelLine :: Clone() // virtual
158 manualContourModelLine * clone = new manualContourModelLine();
159 CopyAttributesTo(clone);
163 // ---------------------------------------------------------------------------
165 void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
167 manualContourModel::CopyAttributesTo(cloneObject);
170 //----------------------------------------------------------------
171 int manualContourModelLine::GetTypeModel() //virtual
176 //----------------------------------------------------------------
177 void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
179 int np = GetSizeLstPoints();
189 mp = GetManualPoint(0);
200 mp = GetManualPoint(0);
204 mp = GetManualPoint(1);
215 int np = GetSizeLstPoints( );
216 int nps = GetNumberOfPointsSpline();
217 // _deltaAngle=(3.14159265*2)/(nps-1);
218 _deltaAngle = 100/nps;
223 mp = GetManualPoint(0);
225 mp = GetManualPoint(1);
242 // ----------------------------------------------------------------------------
243 // ----------------------------------------------------------------------------
244 // ----------------------------------------------------------------------------
245 manualContourModelBullEye::manualContourModelBullEye()
246 : manualContourModel()
248 _numberPointsSlineBySector=101; // impaire
251 manualContourModelBullEye::~manualContourModelBullEye()
256 // ----------------------------------------------------------------------------
257 manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
259 manualContourModelBullEye * clone = new manualContourModelBullEye();
260 CopyAttributesTo(clone);
264 // ---------------------------------------------------------------------------
266 void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
269 manualContourModel::CopyAttributesTo(cloneObject);
272 //----------------------------------------------------------------
273 int manualContourModelBullEye::GetTypeModel() //virtual
278 //----------------------------------------------------------------
279 int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
281 return _numberPointsSlineBySector;
284 //----------------------------------------------------------------
285 void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
287 this->_numberPointsSlineBySector = numpoints;
290 //----------------------------------------------------------------
291 void manualContourModelBullEye::AddSector( double radioA,
296 manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
297 modelSector->SetSector(radioA,radioB,ang,angDelta);
298 modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
299 _lstModelBullEyeSector.push_back(modelSector);
302 //----------------------------------------------------------------
303 manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
305 return _lstModelBullEyeSector[id];
308 //----------------------------------------------------------------
309 void manualContourModelBullEye::GetSector(int id,
315 _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
318 void manualContourModelBullEye::UpdateSpline() // virtual
320 manualContourModel::UpdateSpline();
322 if (this->GetSizeLstPoints()>2){
325 manualPoint *mpA = GetManualPoint(0);
326 manualPoint *mpB = GetManualPoint(2);
327 cx = (mpA->GetX() + mpB->GetX()) / 2.0;
328 cy = (mpA->GetY() + mpB->GetY()) / 2.0;
329 ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
330 hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
331 int i,size = _lstModelBullEyeSector.size();
334 _lstModelBullEyeSector[i]->SetCenter(cx,cy);
335 _lstModelBullEyeSector[i]->SetSize(ww,hh);
341 //----------------------------------------------------------------
342 void manualContourModelBullEye::ResetSectors()
344 int i,size=_lstModelBullEyeSector.size();
347 delete _lstModelBullEyeSector[i];
349 _lstModelBullEyeSector.clear();
352 //----------------------------------------------------------------
353 int manualContourModelBullEye::GetSizeOfSectorLst()
355 return _lstModelBullEyeSector.size();
358 //----------------------------------------------------------------
359 void manualContourModelBullEye::Save(FILE *ff) // virtual
361 manualContourModel::Save(ff);
362 int i,size = GetSizeOfSectorLst();
363 fprintf(ff,"numberOfSections %d \n",size);
364 for ( i=0 ; i<size ; i++ )
366 _lstModelBullEyeSector[i]->Save(ff);
370 //----------------------------------------------------------------
371 void manualContourModelBullEye::Open(FILE *ff) // virtual
373 manualContourModel::Open(ff);
379 int numberOfSections;
380 // double radioA,radioB,ang,deltaAng;
382 fscanf(ff,"%s",tmp); // NumberOfSections
383 fscanf(ff,"%s",tmp); // ##
384 numberOfSections = atoi(tmp);
385 for (i=0;i<numberOfSections;i++)
388 _lstModelBullEyeSector[i]->Open(ff);
393 // ----------------------------------------------------------------------------
394 std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
397 std::vector<manualContourModel*> lstTmp;
398 int i,iSize=_lstModelBullEyeSector.size();
399 for (i=0;i<iSize;i++)
401 lstTmp.push_back( _lstModelBullEyeSector[i] );
407 // ----------------------------------------------------------------------------
408 // ----------------------------------------------------------------------------
409 // ----------------------------------------------------------------------------
410 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
411 : manualContourModel()
415 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
420 // ----------------------------------------------------------------------------
421 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
423 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
424 CopyAttributesTo(clone);
428 // ---------------------------------------------------------------------------
430 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
433 manualContourModel::CopyAttributesTo(cloneObject);
436 //----------------------------------------------------------------
437 int manualContourModelBullEyeSector::GetTypeModel() //virtual
443 //----------------------------------------------------------------
444 void manualContourModelBullEyeSector::SetSector( double radioA,
451 _ang = ang*3.14159265/180.0;
452 _angDelta = angDelta*3.14159265/180.0;
455 //----------------------------------------------------------------
456 void manualContourModelBullEyeSector::GetSector(
465 *angDelta = _angDelta;
468 // ----------------------------------------------------------------------------
469 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
475 //----------------------------------------------------------------
476 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
482 //----------------------------------------------------------------
483 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
489 double ang,angcos, angsin;
492 nps = GetNumberOfPointsSpline() - 3;
494 if (i==GetNumberOfPointsSpline()-1)
507 ang = ((double)ii/(nps/2))*_angDelta + _ang;
511 *x = _ww*radio*angcos + _cx;
512 *y = _hh*radio*angsin + _cy;
516 //----------------------------------------------------------------
517 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
519 manualContourModel::Save(ff);
520 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
523 //----------------------------------------------------------------
524 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
527 fscanf(ff,"%s",tmp); // TypeModel
528 fscanf(ff,"%s",tmp); // ##
530 manualContourModel::Open(ff);
533 fscanf(ff,"%s",tmp); // radioA=
534 fscanf(ff,"%s",tmp); // radioA
537 fscanf(ff,"%s",tmp); // radioB=
538 fscanf(ff,"%s",tmp); // radioB
541 fscanf(ff,"%s",tmp); // ang=
542 fscanf(ff,"%s",tmp); // ang
545 fscanf(ff,"%s",tmp); // deltaAng=
546 fscanf(ff,"%s",tmp); // deltaAng
547 _angDelta = atof(tmp);
552 // ---------------------------------------------------------------------------
553 // ---------------------------------------------------------------------------
554 // ---------------------------------------------------------------------------
555 // ---------------------------------------------------------------------------
557 //JSTG 25-02-08 --------------------------------------------------
558 manualContourModelRoi::manualContourModelRoi()
559 : manualContourModel()
561 SetNumberOfPointsSpline(5);
564 manualContourModelRoi::~manualContourModelRoi()
569 // ----------------------------------------------------------------------------
570 manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
572 manualContourModelRoi * clone = new manualContourModelRoi();
573 CopyAttributesTo(clone);
577 // ---------------------------------------------------------------------------
579 void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
582 manualContourModel::CopyAttributesTo(cloneObject);
585 //----------------------------------------------------------------
586 int manualContourModelRoi::GetTypeModel() //virtual
591 //----------------------------------------------------------------
594 // ----------------------------------------------------------------------------
595 // ----------------------------------------------------------------------------
596 // ----------------------------------------------------------------------------
598 manualContourModel::manualContourModel()
600 _cntSplineX = vtkKochanekSpline::New( );
601 _cntSplineY = vtkKochanekSpline::New( );
602 _cntSplineZ = vtkKochanekSpline::New( );
604 this->SetCloseContour(true);
606 _cntSplineX->SetDefaultTension( 0 );
607 _cntSplineX->SetDefaultBias( 0 );
608 _cntSplineX->SetDefaultContinuity( 0 );
610 _cntSplineY->SetDefaultTension( 0 );
611 _cntSplineY->SetDefaultBias( 0 );
612 _cntSplineY->SetDefaultContinuity( 0 );
614 _cntSplineZ->SetDefaultTension( 0 );
615 _cntSplineZ->SetDefaultBias( 0 );
616 _cntSplineZ->SetDefaultContinuity( 0 );
618 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
620 // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
621 _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
624 //---------------------------------------------------------------------------------------------------------------
627 // ----------------------------------------------------------------------------
628 manualContourModel::~manualContourModel()
630 int i,size=_lstPoints.size();
631 for (i=0;i<size; i++){
632 delete _lstPoints[i];
636 _cntSplineX->Delete();
637 _cntSplineY->Delete();
638 _cntSplineZ->Delete();
640 // ----------------------------------------------------------------------------
641 int manualContourModel::AddPoint(double x,double y,double z)
643 manualPoint *mp = new manualPoint();
648 return _lstPoints.size()-1;
650 // ----------------------------------------------------------------------------
651 int manualContourModel::InsertPoint(double x,double y,double z)
653 double dd,ddmin=9999999;
658 int i,ii,iii,size=_lstPoints.size();
659 double j,MaxDivisions=20,porcentage;
662 if (_closeContour==false)
669 for ( i=0 ; i<size ; i++ )
673 x1=_lstPoints[ii]->GetX();
674 y1=_lstPoints[ii]->GetY();
675 z1=_lstPoints[ii]->GetZ();
676 x2=_lstPoints[iii]->GetX();
677 y2=_lstPoints[iii]->GetY();
678 z2=_lstPoints[iii]->GetZ();
679 for (j=0; j<=MaxDivisions; j++)
681 porcentage=(j/MaxDivisions);
682 xx=(x2-x1)*porcentage+x1;
683 yy=(y2-y1)*porcentage+y1;
684 zz=(z2-z1)*porcentage+z1;
685 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
695 if (_closeContour==false)
697 if ( (ibak==1) && (jbak==0) )
701 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
708 //JSTG - 25-04-08 ----------------------------------------------------------
709 //manualPoint *mp = new manualPoint();
710 //mp->SetPoint(x,y,z);
711 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
712 //_lstPoints.insert(itNum,mp);
713 InsertPoint_id(ibak,x,y,z);
714 //----------------------------------------------------------------------------
718 // ----------------------------------------------------------------------------
719 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
721 manualPoint *mp = new manualPoint();
723 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
724 _lstPoints.insert(itNum,mp);
726 // ----------------------------------------------------------------------------
728 void manualContourModel::DeletePoint(int i)
730 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
731 _lstPoints.erase(itNum);
733 // ----------------------------------------------------------------------------
734 void manualContourModel::DeleteAllPoints()
736 int i,size=_lstPoints.size();
737 for (i=0;i<size;i++){
738 _lstPoints.erase( _lstPoints.begin() );
740 this->UpdateSpline();
742 // ----------------------------------------------------------------------------
744 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
746 manualPoint *mp=_lstPoints[i];
747 double x=mp->GetX()+dx;
748 double y=mp->GetY()+dy;
749 double z=mp->GetZ()+dz;
752 // ----------------------------------------------------------------------------
753 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
757 // ----------------------------------------------------------------------------
758 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
760 int i,size=_lstPoints.size();
761 for (i=0;i<size;i++){
762 MovePoint(i,dx,dy,dz);
767 // ----------------------------------------------------------------------------
773 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
775 double range = i_range+1;
777 double xx,yy,zz,dd,ddmin=9999999;
779 int i,size=_lstPoints.size();
780 for (i=0;i<size;i++){
781 manualPoint *mp=_lstPoints[i];
788 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
789 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
798 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
799 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
808 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
809 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
818 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
819 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
829 // ----------------------------------------------------------------------------
830 manualPoint* manualContourModel::GetManualPoint(int id)
832 return _lstPoints[id];
834 // ----------------------------------------------------------------------------
835 int manualContourModel::GetSizeLstPoints()
837 return _lstPoints.size();
839 //----------------------------------------------------------------------------
840 int manualContourModel::GetNumberOfPointsSpline()
842 return _sizePointsContour;
844 //----------------------------------------------------------------------------
845 void manualContourModel::SetNumberOfPointsSpline(int size)
847 _sizePointsContour = size;
851 // ----------------------------------------------------------------------------
853 void manualContourModel::SetCloseContour(bool closeContour)
855 _closeContour = closeContour;
856 if (_closeContour==true)
858 _cntSplineX->ClosedOn();
859 _cntSplineY->ClosedOn();
860 _cntSplineZ->ClosedOn();
862 _cntSplineX->ClosedOff();
863 _cntSplineY->ClosedOff();
864 _cntSplineZ->ClosedOff();
868 // ----------------------------------------------------------------------------
869 bool manualContourModel::IfCloseContour()
871 return _closeContour;
874 // ----------------------------------------------------------------------------
876 void manualContourModel::UpdateSpline() // virtual
879 np = _lstPoints.size();
881 _cntSplineX->RemoveAllPoints();
882 _cntSplineY->RemoveAllPoints();
883 _cntSplineZ->RemoveAllPoints();
884 for( i = 0; i < np; i++ ) {
885 mp = GetManualPoint(i);
886 _cntSplineX->AddPoint( i, mp->GetX() );
887 _cntSplineY->AddPoint( i, mp->GetY() );
888 _cntSplineZ->AddPoint( i, mp->GetZ() );
891 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
892 if (this->_closeContour==true)
894 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
896 _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
898 //-----------------------------------------------------------------------------------------------------------
901 //---------------------------------------------------------------------------------
903 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
905 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
906 double t = delta*(double)i;
907 GetSplinePoint(t, x, y, z);
910 //-----------------------------------------------------------------------------
912 //JSTG 25-02-08 ---------------------------------------------------------------
913 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
915 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
918 // ----------------------------------------------------------------------------
920 //JSTG 25-02-08 ---------------------------------------------------------------
921 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
923 if (_lstPoints.size()==0)
929 if (_lstPoints.size()==1)
932 mp = GetManualPoint(0);
937 if (_lstPoints.size()>=2)
939 *x = _cntSplineX->Evaluate(t);
940 *y = _cntSplineY->Evaluate(t);
941 *z = _cntSplineZ->Evaluate(t);
945 // ----------------------------------------------------------------------------
948 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
950 if (_lstPoints.size()==0)
956 if (_lstPoints.size()==1)
959 mp = GetManualPoint(0);
964 if (_lstPoints.size()>=2)
966 x = _cntSplineX->Evaluate(t);
967 y = _cntSplineY->Evaluate(t);
968 z = _cntSplineZ->Evaluate(t);
971 // ----------------------------------------------------------------------------
972 double manualContourModel::GetPathSize()
978 // JSTG 25-02-08 -----------------------------
982 //--------------------------------------------
984 if (_lstPoints.size()==2)
986 x1=_lstPoints[0]->GetX();
987 y1=_lstPoints[0]->GetY();
988 z1=_lstPoints[0]->GetZ();
989 x2=_lstPoints[1]->GetX();
990 y2=_lstPoints[1]->GetY();
991 z2=_lstPoints[1]->GetZ();
992 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
994 if (_lstPoints.size()>2)
997 // JSTG 25-02-08 ------------------------------------------
998 //np = _lstPoints.size( );
1000 //delta=( double ) ( np ) / ( double ) ( nps );
1002 //GetSplinePoint(0,x1,y1,z1);
1003 GetSpline_i_Point(0,&x1,&y1,&z1);
1005 //for( i = 1; i < nps; i++ )
1006 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
1008 //t = delta * (double)i;
1009 //GetSplinePoint(t,x2,y2,z2);
1010 GetSpline_i_Point(i,&x2,&y2,&z2);
1011 //---------------------------------------------------------
1012 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
1021 // ----------------------------------------------------------------------------
1022 double manualContourModel::GetPathArea()
1024 double result = 555;
1025 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1028 //JSTG 25-02-08 ---------------------------------------------
1030 //-----------------------------------------------------------
1036 // This uses Green's theorem:
1037 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1038 // A < 0 -> A = |A| (a negative value could raise because points are
1039 // given in clockwise order).
1041 //JSTG 25-02-08 -------------------------------------------------
1042 //int np = _lstPoints.size( );
1044 int nps = GetNumberOfPointsSpline();
1045 //double delta=( double ) ( np ) / ( double ) ( nps );
1047 for( i = 0, area = 0.0; i < nps; i++ )
1049 j = ( i + 1 ) % nps;
1050 //ti = delta * (double)i;
1051 //tj = delta * (double)j;
1052 //GetSplinePoint(ti,x1,y1,z1);
1053 //GetSplinePoint(tj,x2,y2,z2);
1054 GetSpline_i_Point(i,&x1,&y1,&z1);
1055 GetSpline_i_Point(j,&x2,&y2,&z2);
1056 //----------------------------------------------------------------
1066 area = fabs( area );
1069 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1071 j = ( i + 1 ) % _lstPoints.size();
1074 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1075 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1076 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1082 area = fabs( area );
1098 // ----------------------------------------------------------------------------
1099 // p[x,y,z] : data in
1100 // rp[x,y,z] : data out result point
1101 // rn[x,y,z] : data out result normal
1103 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1105 double distMin=999999999;
1106 double dist,dx,dy,dz;
1111 //JSTG 25-02-08 -------------------
1115 //---------------------------------
1117 np = _lstPoints.size( );
1120 // JSTG 25-02-08 ------------------------------------------
1122 nps = GetNumberOfPointsSpline();
1123 //delta = ( double ) ( np ) / ( double ) ( nps );
1125 //GetSplinePoint(0,x1,y1,z1);
1126 GetSpline_i_Point(0,&x1,&y1,&z1);
1127 for( i = 0; i < nps; i++ )
1129 //t = delta * (double)i;
1130 //GetSplinePoint(t,x1,y1,z1);
1131 GetSpline_i_Point(i,&x1,&y1,&z1);
1132 //----------------------------------------------------------
1136 dist = sqrt( dx*dx + dy*dy + dz*dz );
1154 // JSTG 25-02-08 ------------------------------------------
1158 //t = delta * (double)1.0;
1159 //GetSplinePoint(t,x1,y1,z1);
1160 GetSpline_i_Point(i,&x1,&y1,&z1);
1161 //----------------------------------------------------------
1178 // ----------------------------------------------------------------------------
1179 manualContourModel * manualContourModel :: Clone() // virtual
1181 manualContourModel * clone = new manualContourModel();
1182 CopyAttributesTo(clone);
1186 // ----------------------------------------------------------------------------
1187 void manualContourModel::Open(FILE *ff) // virtual
1191 int numberOfControlPoints;
1194 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1195 fscanf(ff,"%s",tmp); // ##
1196 numberOfControlPoints = atoi(tmp);
1197 for (i=0;i<numberOfControlPoints;i++)
1199 fscanf(ff,"%s",tmp); // X
1201 fscanf(ff,"%s",tmp); // Y
1203 fscanf(ff,"%s",tmp); // Z
1210 // ----------------------------------------------------------------------------
1211 int manualContourModel::GetTypeModel() //virtual
1223 // ----------------------------------------------------------------------------
1224 void manualContourModel::Save(FILE *ff) // virtual
1226 int i,size=_lstPoints.size();
1227 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1228 fprintf(ff,"NumberOfControlPoints %d\n",size);
1229 for (i=0;i<size;i++)
1231 manualPoint *mp=_lstPoints[i];
1232 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1237 // ---------------------------------------------------------------------------
1239 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1242 //XXXX::CopyAttributesTo(cloneObject);
1244 cloneObject->SetCloseContour( this->IfCloseContour() );
1245 int i, size = GetSizeLstPoints();
1246 for( i=0; i<size; i++ )
1248 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1250 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1251 cloneObject->SetCloseContour( _closeContour );
1252 cloneObject->UpdateSpline();
1256 // ---------------------------------------------------------------------------
1257 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1259 _lstPoints.push_back( theManualPoint );
1262 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1264 std::vector<manualContourModel*> lstTmp;
1265 lstTmp.push_back(this);
1270 // ---------------------------------------------------------------------------
1271 // ----------------------------------------------------------------------------
1272 // ----------------------------------------------------------------------------
1274 //int manualViewPoint::range=1;
1277 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1279 _posibleSelected = false;
1282 _pointVtkActor = NULL;
1284 _wxvtkbaseview = wxvtkbaseview;
1292 // ----------------------------------------------------------------------------
1293 manualViewPoint::~manualViewPoint(){
1297 // ----------------------------------------------------------------------------
1298 void manualViewPoint::SetWidthLine( double width)
1303 // ----------------------------------------------------------------------------
1304 void manualViewPoint::SetSelected(bool selected){
1307 // ----------------------------------------------------------------------------
1308 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1309 _posibleSelected=posibleSelected;
1311 // ----------------------------------------------------------------------------
1312 bool manualViewPoint::GetSelected(){
1315 // ----------------------------------------------------------------------------
1316 bool manualViewPoint::GetPosibleSelected(){
1317 return _posibleSelected;
1319 // ----------------------------------------------------------------------------
1320 void manualViewPoint::DeleteVtkObjects(){
1321 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1322 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1323 if (_pts !=NULL) { _pts ->Delete(); }
1324 if (_pd !=NULL) { _pd ->Delete(); }
1325 _pointVtkActor = NULL;
1333 // ----------------------------------------------------------------------------
1334 vtkActor* manualViewPoint::CreateVtkPointActor()
1338 _pts = vtkPoints::New();
1339 _pts->SetNumberOfPoints(8);
1340 _pts->SetPoint(0, -1000 , -1000 , 0 );
1341 _pts->SetPoint(1, 1000 , -1000 , 0 );
1342 _pts->SetPoint(2, 1000 , 1000 , 0 );
1343 _pts->SetPoint(3, -1000 , 1000 , 0 );
1344 _pts->SetPoint(4, -1000 , 1000 , 0 );
1345 _pts->SetPoint(5, -1000 , 1000 , 0 );
1346 _pts->SetPoint(6, -1000 , 1000 , 0 );
1347 _pts->SetPoint(7, -1000 , 1000 , 0 );
1349 vtkCellArray *lines = vtkCellArray::New();
1350 lines->InsertNextCell(17);
1351 lines->InsertCellPoint(0);
1352 lines->InsertCellPoint(1);
1353 lines->InsertCellPoint(2);
1354 lines->InsertCellPoint(3);
1355 lines->InsertCellPoint(0);
1356 lines->InsertCellPoint(4);
1357 lines->InsertCellPoint(5);
1358 lines->InsertCellPoint(6);
1359 lines->InsertCellPoint(7);
1360 lines->InsertCellPoint(4);
1361 lines->InsertCellPoint(0);
1362 lines->InsertCellPoint(3);
1363 lines->InsertCellPoint(7);
1364 lines->InsertCellPoint(6);
1365 lines->InsertCellPoint(2);
1366 lines->InsertCellPoint(1);
1367 lines->InsertCellPoint(5);
1369 _pd = vtkPolyData::New();
1370 _pd->SetPoints( _pts );
1371 _pd->SetLines( lines );
1372 lines->Delete(); //do not delete lines ??
1374 _pointVtkActor = vtkActor::New();
1375 _bboxMapper = vtkPolyDataMapper::New();
1377 _bboxMapper->SetInput(_pd);
1378 _bboxMapper->ImmediateModeRenderingOn();
1379 _pointVtkActor->SetMapper(_bboxMapper);
1380 _pointVtkActor->GetProperty()->BackfaceCullingOn();
1382 _pd->ComputeBounds();
1384 return _pointVtkActor;
1386 // ----------------------------------------------------------------------------
1387 vtkActor* manualViewPoint::GetVtkActor(){
1388 return _pointVtkActor;
1390 // ----------------------------------------------------------------------------
1391 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1393 // double range=0.2; // i_range;
1394 // double range=(double)manualViewPoint::range;
1396 double range=i_range;
1401 posZ = posZ * _spc[2];
1404 _pts->SetPoint(0, x-range, y+range, posZ-range);
1405 _pts->SetPoint(1, x+range, y+range, posZ-range);
1406 _pts->SetPoint(2, x+range, y-range, posZ-range);
1407 _pts->SetPoint(3, x-range, y-range, posZ-range);
1408 _pts->SetPoint(4, x-range, y+range, posZ+range);
1409 _pts->SetPoint(5, x+range, y+range, posZ+range);
1410 _pts->SetPoint(6, x+range, y-range, posZ+range);
1411 _pts->SetPoint(7, x-range, y-range, posZ+range);
1416 // ----------------------------------------------------------------------------
1417 void manualViewPoint::UpdateColorActor()
1419 if (_pointVtkActor!=NULL){
1421 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1422 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1423 if (_posibleSelected==true){
1424 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1428 // ----------------------------------------------------------------------------
1429 void manualViewPoint::GetSpacing(double spc[3])
1435 // ----------------------------------------------------------------------------
1436 void manualViewPoint::SetSpacing(double spc[3])
1445 // ----------------------------------------------------------------------------
1446 // ----------------------------------------------------------------------------
1447 // ----------------------------------------------------------------------------
1449 manualViewContour::manualViewContour()
1451 _id_viewPoint_for_text = 0;
1453 _initialConoturModel = new manualContourModel();
1455 // ----------------------------------------------------------------------------
1456 manualViewContour::~manualViewContour()
1458 delete _initialConoturModel;
1460 // ----------------------------------------------------------------------------
1462 // ----------------------------------------------------------------------------
1463 manualViewContour * manualViewContour :: Clone()
1465 manualViewContour * clone = new manualViewContour();
1466 CopyAttributesTo(clone);
1470 // ---------------------------------------------------------------------------
1472 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1474 // Call to Fathers object
1475 manualViewBaseContour::CopyAttributesTo(cloneObject);
1477 cloneObject->SetMesureScale(_mesureScale);
1480 // ---------------------------------------------------------------------------
1482 int manualViewContour::GetType() // virtual
1487 // ----------------------------------------------------------------------------
1489 void manualViewContour::Save(FILE *pFile)
1491 manualViewBaseContour::Save(pFile);
1494 // ----------------------------------------------------------------------------
1496 void manualViewContour::Open(FILE *pFile)
1502 // ----------------------------------------------------------------------------
1503 void manualViewContour::RefreshContour() // virtual
1508 //JSTG 25-02-08 --------------------
1509 //double t,delta, x,y,z;
1511 //----------------------------------
1513 _manContModel->UpdateSpline();
1514 np = GetNumberOfPoints( );
1515 //nps = GetNumberOfPointsSpline();
1516 nps = _manContModel->GetNumberOfPointsSpline();
1517 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1519 //printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
1525 for( i = 0; i < nps; i++ )
1527 //JSTG 25-02-08 ------------------------------------------------
1528 //t = delta * (double)i;
1529 //_manContModel->GetSplinePoint(t,x,y,z);
1530 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1531 //--------------------------------------------------------------
1533 // _pts->SetPoint(i, x,y,z );
1534 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1537 // printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
1545 _pts->SetPoint(0, 0 , 0 , 0);
1546 _pts->SetPoint(1, 0 , 0 , 0);
1551 // ----------------------------------------------------------------------------
1552 void manualViewContour::RefreshText() // virtual
1555 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1556 int size = GetNumberOfPoints();
1558 char resultText[50];
1559 strcpy(resultText," ");
1562 strcpy(resultText,"L= ");
1563 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1564 strcat(resultText,text);
1568 if (_manContModel->IfCloseContour()==true)
1570 strcpy(resultText,"P= ");
1571 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1572 strcat(resultText,text);
1573 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1574 strcat(resultText," A= ");
1575 strcat(resultText,text);
1577 strcpy(resultText,"L= ");
1578 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1579 strcat(resultText,text);
1583 _textActor -> SetInput(resultText);
1588 for (i=0; i<size; i++)
1590 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1592 _id_viewPoint_for_text = i;
1596 int id = _id_viewPoint_for_text;
1597 double px = _manContModel->GetManualPoint(id)->GetX();
1598 double py = _manContModel->GetManualPoint(id)->GetY();
1604 _textActor->SetPosition(px+GetRange()+1,py);
1610 // ----------------------------------------------------------------------------
1611 bool manualViewContour::ifTouchContour(int x,int y,int z){
1619 TransfromeCoordViewWorld(xx,yy,zz);
1626 unsigned int i, nps,nps_t;
1627 nps = _sizePointsContour;
1628 if (this->_manContModel->IfCloseContour()==true)
1636 printf("\n>%d ",nps_t);
1638 for( i = 0; i < nps_t; i++ )
1640 _pts->GetPoint(i%nps, ppA);
1641 _pts->GetPoint((i+1)%nps, ppB);
1642 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1643 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1644 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]));
1647 printf("%d %f %f %f - ", i,d1,d2,d3);
1649 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1658 // ----------------------------------------------------------------------------
1659 void manualViewContour::DeletePoint(int id) // virtual
1661 if (_lstViewPoints.size()>2)
1663 manualViewBaseContour::DeletePoint( id );
1666 // ----------------------------------------------------------------------------
1668 void manualViewContour::ClearPoint(int id)
1670 manualViewBaseContour::DeletePoint( id );
1673 //-------------------------------------------------------------------
1674 void manualViewContour::SetMesureScale(double mesureScale)
1676 _mesureScale = mesureScale;
1678 //-------------------------------------------------------------------
1679 void manualViewContour::InitMove(int x, int y, int z)
1681 _initialConoturModel->DeleteAllPoints();
1683 manualPoint *mp = NULL;
1687 TransfromeCoordViewWorld(XX,YY,ZZ);
1689 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1690 for ( i=0; i<manualPointsSZ; i++ )
1692 mp = _manContModel->GetManualPoint( i );
1693 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1696 //-------------------------------------------------------------------
1697 void manualViewContour::MoveContour(int x, int y, int z)
1699 manualPoint *mpOrigin = NULL;
1700 manualPoint *mpMoving = NULL;
1705 TransfromeCoordViewWorld(XX,YY,ZZ);
1707 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1708 for ( i=0; i<manualPointsSZ; i++ )
1710 mpOrigin = _manContModel->GetManualPoint( i );
1711 mpMoving = _initialConoturModel->GetManualPoint(i);
1712 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1716 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1718 manualPoint *mpOrigin = NULL;
1720 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1721 for ( i=0; i<manualPointsSZ; i++ )
1723 mpOrigin = _manContModel->GetManualPoint( i );
1724 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1728 // ----------------------------------------------------------------------------
1729 // ----------------------------------------------------------------------------
1730 // ----------------------------------------------------------------------------
1733 manualView3VContour::manualView3VContour(int type)
1736 // JSTG 25-02-08 ------------------------------
1737 //_manContModel= new manualContourModel();
1738 //---------------------------------------------
1740 // ----------------------------------------------------------------------------
1741 manualView3VContour::~manualView3VContour()
1747 // ----------------------------------------------------------------------------
1748 manualView3VContour * manualView3VContour :: Clone()
1750 manualView3VContour * clone = new manualView3VContour( GetType() );
1751 CopyAttributesTo(clone);
1755 // ---------------------------------------------------------------------------
1757 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1760 manualViewContour::CopyAttributesTo(cloneObject);
1763 int manualView3VContour::GetType()
1768 // ----------------------------------------------------------------------------
1769 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1784 // ----------------------------------------------------------------------------
1786 void manualView3VContour::RefreshContour() // virtula
1788 manualViewContour::RefreshContour();
1791 // JSTG 25-02-08 ----------------------------------------
1792 //int nps = GetNumberOfPointsSpline();
1793 int nps = _manContModel->GetNumberOfPointsSpline();
1794 //-------------------------------------------------------
1795 for( i = 0; i < nps; i++ )
1797 _pts->GetPoint( i, pp );
1798 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1801 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1806 // ----------------------------------------------------------------------------
1808 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1810 manualPoint *mp = _manContModel->GetManualPoint(id);
1815 FilterCordinateXYZ(x,y,z);
1816 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1819 // ----------------------------------------------------------------------------
1821 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1824 if (_manContModel!=NULL){
1828 TransfromeCoordViewWorld(xx,yy,zz,-1);
1829 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1834 // ----------------------------------------------------------------------------
1835 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1843 TransfromeCoordViewWorld(xx,yy,zz,-1);
1850 unsigned int i, nps,nps_t;
1851 nps = _sizePointsContour;
1852 if (this->_manContModel->IfCloseContour()==true)
1858 FilterCordinateXYZ(xx,yy,zz);
1860 for( i = 0; i < nps_t; i++ ) {
1861 _pts->GetPoint(i%nps, ppA);
1862 _pts->GetPoint((i+1)%nps, ppB);
1863 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1864 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1865 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1866 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1867 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]));
1868 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1875 // ----------------------------------------------------------------------------
1876 // ----------------------------------------------------------------------------
1877 // ----------------------------------------------------------------------------
1878 manualView3DContour::manualView3DContour()
1881 // ----------------------------------------------------------------------------
1882 manualView3DContour::~manualView3DContour()
1886 // ----------------------------------------------------------------------------
1887 manualView3DContour * manualView3DContour :: Clone()
1889 manualView3DContour * clone = new manualView3DContour();
1890 CopyAttributesTo(clone);
1894 // ---------------------------------------------------------------------------
1895 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1898 manualViewContour::CopyAttributesTo(cloneObject);
1900 cloneObject->SetDimensions ( _w , _h , _d );
1902 // ----------------------------------------------------------------------------
1903 void manualView3DContour::SetDimensions(int w, int h, int d)
1909 // ----------------------------------------------------------------------------
1910 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1912 X = _vtkmprbasedata->GetX();
1913 Y = _vtkmprbasedata->GetY();
1914 Z = _vtkmprbasedata->GetZ();
1916 // ----------------------------------------------------------------------------
1917 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1919 _vtkmprbasedata = vtkmprbasedata;
1921 // ----------------------------------------------------------------------------
1922 int manualView3DContour::GetIdPoint2(int x, int y)
1925 double p[3],pA[3],pB[3];
1927 double pickPoint[ 3 ], cameraPos[ 3 ];
1928 vtkPointPicker* picker = vtkPointPicker::New( );
1929 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1930 picker->Pick( x, y, 0.0, pRenderer );
1931 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1932 picker->GetPickPosition( pickPoint );
1935 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1936 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1938 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1940 double dist,distMin=999999999;
1941 int i,size=this->_manContModel->GetSizeLstPoints();
1942 for (i=0;i<size;i++)
1944 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1948 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1949 if ( (dist<=2*GetRange()) && (dist<distMin) )
1958 // ----------------------------------------------------------------------------
1959 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1961 SelectAllPossibleSelected(false);
1962 int id=GetIdPoint2(x,y);
1965 SetPointPosibleSelected(id,true);
1973 // ----------------------------------------------------------------------------
1974 // ----------------------------------------------------------------------------
1975 // ----------------------------------------------------------------------------
1980 // ----------------------------------------------------------------------------
1981 // ----------------------------------------------------------------------------
1982 // ----------------------------------------------------------------------------
1983 manualViewBullEyeSector::manualViewBullEyeSector()
1987 // ----------------------------------------------------------------------------
1988 void manualViewBullEyeSector::RefreshContour()
1993 //----------------------------------
1995 _manContModel->UpdateSpline();
1996 nps = _manContModel->GetNumberOfPointsSpline();
2000 for( i = 0; i < nps; i++ )
2002 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
2003 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
2009 // ----------------------------------------------------------------------------
2010 // ----------------------------------------------------------------------------
2011 // ----------------------------------------------------------------------------
2014 manualViewBullEye::manualViewBullEye()
2018 // ----------------------------------------------------------------------------
2019 manualViewBullEye::~manualViewBullEye()
2022 int i,size=lstSectorBullEye.size();
2023 for (i=0;i<size;i++)
2025 delete lstSectorBullEye[i];
2027 lstSectorBullEye.clear();
2031 // ----------------------------------------------------------------------------
2032 manualViewBullEye * manualViewBullEye :: Clone()
2034 manualViewBullEye * clone = new manualViewBullEye();
2035 CopyAttributesTo(clone);
2039 // ---------------------------------------------------------------------------
2041 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2044 manualViewBaseContour::CopyAttributesTo(cloneObject);
2048 // ----------------------------------------------------------------------------
2049 int manualViewBullEye::GetType() // virtual
2055 // ----------------------------------------------------------------------------
2056 void manualViewBullEye::RefreshContour() // virtual
2058 // External Rectangle
2059 manualViewRoi::RefreshContour();
2061 _manContModel->UpdateSpline();
2062 int np = GetNumberOfPoints( );
2063 // Refres sectors of BullEye(s)
2067 int i,size = lstSectorBullEye.size();
2068 for (i=0;i<size;i++)
2070 lstSectorBullEye[i]->RefreshContour();
2077 // ----------------------------------------------------------------------------
2078 void manualViewBullEye::ConstructVTKObjects() // virtual
2080 manualViewRoi::ConstructVTKObjects();
2083 this->GetSpacing(spc);
2084 manualViewBullEyeSector *mvbc;
2085 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2086 int i,size = mcmbe->GetSizeOfSectorLst();
2087 for ( i=0 ; i<size ; i++ )
2089 mvbc = new manualViewBullEyeSector();
2090 mvbc->SetModel( mcmbe->GetModelSector(i) );
2091 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2092 mvbc->SetRange( 2 );
2094 mvbc->SetSpacing(spc);
2095 mvbc->SetColorNormalContour(1, 0, 0);
2096 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2097 // mvbc->SetColorSelectContour(1, 0.8, 0);
2098 mvbc->SetWidthLine( this->GetWidthLine() );
2100 mvbc->ConstructVTKObjects();
2101 lstSectorBullEye.push_back( mvbc );
2107 // ----------------------------------------------------------------------------
2108 void manualViewBullEye::AddSplineActor() // virtual
2110 manualViewRoi::AddSplineActor();
2111 int i,size=lstSectorBullEye.size();
2112 for (i=0;i<size;i++)
2114 lstSectorBullEye[i]->AddSplineActor();
2118 // ----------------------------------------------------------------------------
2119 void manualViewBullEye::RemoveSplineActor() // virtual
2121 manualViewRoi::RemoveSplineActor();
2122 int i,size=lstSectorBullEye.size();
2123 for (i=0;i<size;i++)
2125 lstSectorBullEye[i]->RemoveSplineActor();
2130 // ----------------------------------------------------------------------------
2131 // ----------------------------------------------------------------------------
2132 // ----------------------------------------------------------------------------
2134 manualViewRoi::manualViewRoi()
2136 _sizePointsContour=5;
2138 // ----------------------------------------------------------------------------
2139 manualViewRoi::~manualViewRoi()
2144 // ----------------------------------------------------------------------------
2145 manualViewRoi * manualViewRoi :: Clone()
2147 manualViewRoi * clone = new manualViewRoi();
2148 CopyAttributesTo(clone);
2152 // ---------------------------------------------------------------------------
2154 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2157 manualViewBaseContour::CopyAttributesTo(cloneObject);
2160 // ----------------------------------------------------------------------------
2161 void manualViewRoi::RefreshContour() // virtual
2163 unsigned int i,ii, np;
2164 np = GetNumberOfPoints( );
2166 printf("EED manualViewRoi::RefreshContour np %d \n", np);
2172 for( i = 0; i < np+1; i++ ) {
2174 mp = _manContModel->GetManualPoint(ii);
2177 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2178 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2179 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2182 // _pts->SetPoint(i, XX,YY,ZZ );
2183 printf("EED manualViewRoi::RefreshContour ZZ %f _spc%f \n", ZZ, _spc[2] );
2184 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2188 _pts->SetPoint(0, 0 , 0 , 0);
2189 _pts->SetPoint(1, 0 , 0 , 0);
2194 // ----------------------------------------------------------------------------
2195 int manualViewRoi::GetType() // virtual
2200 // ----------------------------------------------------------------------------
2202 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2213 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2215 for( i = 0; i < size; i++ )
2218 mp=_manContModel->GetManualPoint(i);
2253 // ----------------------------------------------------------------------------
2255 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2258 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2260 GetMinMax(px1,py1, px2, py2);
2265 TransfromeCoordViewWorld(xx,yy,zz);
2269 double ddx=GetRange();
2270 double ddy=GetRange();
2272 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2277 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2282 if ((ok1==true) && (ok2==false))
2291 // ----------------------------------------------------------------------------
2293 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2299 TransfromeCoordViewWorld(XX,YY,ZZ);
2301 if (_manContModel->GetSizeLstPoints()==4){
2302 mp = _manContModel->GetManualPoint(0);
2303 _dp0[0]= mp->GetX() - XX;
2304 _dp0[1]= mp->GetY() - YY;
2305 _dp0[2]= mp->GetZ();
2307 mp = _manContModel->GetManualPoint(1);
2308 _dp1[0]= mp->GetX() - XX;
2309 _dp1[1]= mp->GetY() - YY;
2310 _dp1[2]= mp->GetZ();
2312 mp = _manContModel->GetManualPoint(2);
2313 _dp2[0]= mp->GetX() - XX;
2314 _dp2[1]= mp->GetY() - YY;
2315 _dp2[2]= mp->GetZ();
2317 mp = _manContModel->GetManualPoint(3);
2318 _dp3[0]= mp->GetX() - XX;
2319 _dp3[1]= mp->GetY() - YY;
2320 _dp3[2]= mp->GetZ();
2324 // ----------------------------------------------------------------------------
2326 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2332 TransfromeCoordViewWorld(XX,YY,ZZ);
2334 mp = _manContModel->GetManualPoint(0);
2335 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2337 mp = _manContModel->GetManualPoint(1);
2338 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2340 mp = _manContModel->GetManualPoint(2);
2341 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2343 mp = _manContModel->GetManualPoint(3);
2344 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2355 // ----------------------------------------------------------------------------
2356 // ----------------------------------------------------------------------------
2357 // ----------------------------------------------------------------------------
2361 manualViewCircle::manualViewCircle()
2363 // _sizePointsContour=5; // default 100
2365 // ----------------------------------------------------------------------------
2366 manualViewCircle::~manualViewCircle()
2371 // ----------------------------------------------------------------------------
2372 manualViewCircle * manualViewCircle :: Clone()
2374 manualViewCircle * clone = new manualViewCircle();
2375 CopyAttributesTo(clone);
2379 // ---------------------------------------------------------------------------
2381 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2384 manualViewBaseContour::CopyAttributesTo(cloneObject);
2388 // ----------------------------------------------------------------------------
2390 void manualViewCircle::RefreshContour(){ // virtual
2392 manualPoint *mpA,*mpB;
2393 unsigned int i, np,nps;
2397 np = GetNumberOfPoints( );
2398 nps = _manContModel->GetNumberOfPointsSpline();
2399 double deltaAngle=(3.14159265*2)/(nps-1);
2404 mpA = _manContModel->GetManualPoint(0);
2405 mpB = _manContModel->GetManualPoint(1);
2406 difX = mpA->GetX() - mpB->GetX();
2407 difY = mpA->GetY() - mpB->GetY();
2408 radio = sqrt( difX*difX + difY*difY );
2409 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2410 manContModelCir->SetRadio(radio);
2412 for( i = 0; i < nps; i++ ) {
2413 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2414 // angle = deltaAngle*i;
2415 // XX = cos(angle)*radio+mpA->GetX();
2416 // YY = sin(angle)*radio+mpA->GetY();
2418 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2421 _pts->SetPoint(0, 0 , 0 , 0);
2422 _pts->SetPoint(1, 0 , 0 , 0);
2428 // ----------------------------------------------------------------------------
2429 int manualViewCircle::GetType() // virtual
2434 // ----------------------------------------------------------------------------
2436 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2438 manualPoint *mpA,*mpB;
2442 np = GetNumberOfPoints( );
2445 mpA = _manContModel->GetManualPoint(0);
2446 mpB = _manContModel->GetManualPoint(1);
2447 difX = mpA->GetX() - mpB->GetX();
2448 difY = mpA->GetY() - mpB->GetY();
2449 radio = sqrt( difX*difX + difY*difY );
2450 minX=mpA->GetX()-radio;
2451 minY=mpA->GetY()-radio;
2452 maxX=mpA->GetX()+radio;
2453 maxY=mpA->GetY()+radio;
2463 // ----------------------------------------------------------------------------
2464 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2467 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2469 GetMinMax(px1,py1, px2, py2);
2474 TransfromeCoordViewWorld(xx,yy,zz);
2478 double ddx=GetRange();
2479 double ddy=GetRange();
2481 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2486 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2491 if ((ok1==true) && (ok2==false))
2500 // ----------------------------------------------------------------------------
2502 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2508 TransfromeCoordViewWorld(XX,YY,ZZ);
2510 if (_manContModel->GetSizeLstPoints()==2){
2511 mp = _manContModel->GetManualPoint(0);
2512 _dp0[0]= mp->GetX() - XX;
2513 _dp0[1]= mp->GetY() - YY;
2514 _dp0[2]= mp->GetZ();
2516 mp = _manContModel->GetManualPoint(1);
2517 _dp1[0]= mp->GetX() - XX;
2518 _dp1[1]= mp->GetY() - YY;
2519 _dp1[2]= mp->GetZ();
2521 mp = _manContModel->GetManualPoint(2);
2522 _dp2[0]= mp->GetX() - XX;
2523 _dp2[1]= mp->GetY() - YY;
2524 _dp2[2]= mp->GetZ();
2526 mp = _manContModel->GetManualPoint(3);
2527 _dp3[0]= mp->GetX() - XX;
2528 _dp3[1]= mp->GetY() - YY;
2529 _dp3[2]= mp->GetZ();
2535 // ----------------------------------------------------------------------------
2536 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2542 TransfromeCoordViewWorld(XX,YY,ZZ);
2544 mp = _manContModel->GetManualPoint(0);
2545 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2547 mp = _manContModel->GetManualPoint(1);
2548 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2550 // mp = _manContModel->GetManualPoint(2);
2551 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2553 // mp = _manContModel->GetManualPoint(3);
2554 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2558 // UpdateViewPoint(2);
2559 // UpdateViewPoint(3);
2565 // ----------------------------------------------------------------------------
2566 // ----------------------------------------------------------------------------
2567 // ----------------------------------------------------------------------------
2571 manualViewLine::manualViewLine()
2574 // ----------------------------------------------------------------------------
2575 manualViewLine::~manualViewLine()
2580 // ----------------------------------------------------------------------------
2581 manualViewLine * manualViewLine :: Clone()
2583 manualViewLine * clone = new manualViewLine();
2584 CopyAttributesTo(clone);
2588 // ---------------------------------------------------------------------------
2590 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2593 manualViewBaseContour::CopyAttributesTo(cloneObject);
2596 // ----------------------------------------------------------------------------
2597 int manualViewLine::GetType() // virtual
2603 // ----------------------------------------------------------------------------
2605 void manualViewLine::InitMove(int x, int y, int z) // virtual
2611 TransfromeCoordViewWorld(XX,YY,ZZ);
2613 if (_manContModel->GetSizeLstPoints()==2)
2615 mp = _manContModel->GetManualPoint(0);
2616 _dp0[0]= mp->GetX() - XX;
2617 _dp0[1]= mp->GetY() - YY;
2618 _dp0[2]= mp->GetZ();
2620 mp = _manContModel->GetManualPoint(1);
2621 _dp1[0]= mp->GetX() - XX;
2622 _dp1[1]= mp->GetY() - YY;
2623 _dp1[2]= mp->GetZ();
2629 // ----------------------------------------------------------------------------
2630 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2636 TransfromeCoordViewWorld(XX,YY,ZZ);
2638 mp = _manContModel->GetManualPoint(0);
2639 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2641 mp = _manContModel->GetManualPoint(1);
2642 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2650 // ----------------------------------------------------------------------------
2651 // ----------------------------------------------------------------------------
2652 // ----------------------------------------------------------------------------
2655 manualViewBaseContour::manualViewBaseContour()
2659 _manContModel = NULL;
2660 _wxvtkbaseview = NULL;
2662 _posibleSelected = false;
2663 _viewControlPoints = false;
2666 _contourVtkActor = NULL;
2669 _sizePointsContour = 100;
2678 _coulorNormal_r = 1;
2679 _coulorNormal_g = 0;
2680 _coulorNormal_b = 1;
2682 _coulorSelection_r = 0;
2683 _coulorSelection_g = 1;
2684 _coulorSelection_b = 0;
2689 // ----------------------------------------------------------------------------
2690 manualViewBaseContour::~manualViewBaseContour()
2692 int i,size=_lstViewPoints.size();
2693 for (i=0;i<size; i++){
2694 delete _lstViewPoints[i];
2696 _lstViewPoints.clear();
2698 // ----------------------------------------------------------------------------
2701 int manualViewBaseContour::GetType() // virtual
2704 //int manualViewBaseContour::GetType() 0;
2705 //int manualViewContour::GetType() 1;
2706 //int manualViewRoi::GetType() 2;
2707 //int manualViewCircle::GetType() 3;
2708 //int manualViewStar::GetType() 4;
2709 //int manualViewLine::GetType() 6;
2714 // ----------------------------------------------------------------------------
2716 void manualViewBaseContour::Save(FILE *pFile)
2718 fprintf(pFile,"TypeView %d\n", GetType() );
2721 // ----------------------------------------------------------------------------
2722 void manualViewBaseContour::Open(FILE *pFile)
2726 // ----------------------------------------------------------------------------
2727 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2729 _viewControlPoints = ifControlPoints;
2730 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2735 //Adding each control point
2736 if( ifControlPoints )
2741 // ---------------------------------------------------------------------------
2743 void manualViewBaseContour :: RemoveCompleteContourActor()
2745 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2746 //Removing the spline
2747 RemoveSplineActor();
2750 //Removing each point
2751 RemoveControlPoints();
2755 // ---------------------------------------------------------------------------
2756 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2758 manualViewBaseContour * clone = new manualViewBaseContour();
2759 CopyAttributesTo(clone);
2764 // ---------------------------------------------------------------------------
2766 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2769 //XXXX::CopyAttributesTo(cloneObject);
2771 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2772 cloneObject-> SetSelected( this->GetSelected() );
2773 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2774 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2775 cloneObject-> SetRange( this->GetRange() );
2776 cloneObject-> SetZ( this->GetZ() );
2777 cloneObject-> SetSpacing( _spc );
2778 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2779 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2780 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2782 int i, size = _lstViewPoints.size();
2783 for ( i=0; i<size; i++ )
2785 cloneObject->AddPoint( );
2789 // ----------------------------------------------------------------------------
2790 void manualViewBaseContour :: AddSplineActor()
2792 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2793 if (_contourVtkActor!=NULL)
2794 theRenderer->AddActor( _contourVtkActor );
2796 // ----------------------------------------------------------------------------
2797 void manualViewBaseContour :: RemoveSplineActor() // virtual
2799 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2800 if (_contourVtkActor!=NULL)
2801 theRenderer->RemoveActor( _contourVtkActor );
2803 // ----------------------------------------------------------------------------
2804 void manualViewBaseContour :: RemoveControlPoints()
2806 if (_wxvtkbaseview!=NULL){
2807 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2808 int i,size=_lstViewPoints.size();
2809 for (i=0;i<size; i++)
2811 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2812 theRenderer->RemoveActor( pointActor );
2815 SetIfViewControlPoints( false );
2817 // ----------------------------------------------------------------------------
2818 void manualViewBaseContour :: AddControlPoints()
2820 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2821 SetIfViewControlPoints( true );
2822 if( _viewControlPoints )
2824 int i,size=_lstViewPoints.size();
2825 for (i=0;i<size; i++)
2827 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2828 theRenderer->AddActor( pointActor );
2832 // ----------------------------------------------------------------------------
2833 void manualViewBaseContour::AddTextActor()
2835 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2837 // ----------------------------------------------------------------------------
2838 void manualViewBaseContour::RemoveTextActor()
2840 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2842 // ----------------------------------------------------------------------------
2843 void manualViewBaseContour::DeleteVtkObjects()
2845 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2846 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2847 if ( _pts != NULL ) { _pts -> Delete(); }
2848 if ( _pd != NULL ) { _pd -> Delete(); }
2849 _contourVtkActor = NULL;
2856 // ----------------------------------------------------------------------------
2857 void manualViewBaseContour::SetWidthLine(double width)
2860 this->UpdateColorActor();
2862 // for the control points
2863 int id, size = _lstViewPoints.size();
2864 for( id=0; id<size; id++)
2866 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2871 // ----------------------------------------------------------------------------
2872 double manualViewBaseContour::GetWidthLine()
2877 // ----------------------------------------------------------------------------
2878 void manualViewBaseContour::ConstructVTKObjects()
2880 //JSTG 29-02-08 -----------------------------------------------
2881 //int i , nps = _sizePointsContour;
2883 int nps = _manContModel->GetNumberOfPointsSpline();
2884 printf("EED01 manualViewBaseContour::ConstructVTKObjects nps %d\n ",nps);
2885 //-------------------------------------------------------------
2887 _pts = vtkPoints::New();
2888 _pts->SetNumberOfPoints(nps);
2890 for (i=0 ; i<nps ; i++){
2891 _pts->SetPoint(i, 0 , 0 , 0 );
2893 // This is for the boundaring inicialisation
2895 _pts->SetPoint(0, 0 , 0 , -1000 );
2896 _pts->SetPoint(1, 0 , 0 , 1000 );
2897 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2898 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2900 vtkCellArray *lines = vtkCellArray::New();
2901 lines->InsertNextCell( nps /* +1 */ );
2902 for ( i=0 ; i<nps+1 ; i++ ){
2903 lines->InsertCellPoint(i % nps );
2906 _pd = vtkPolyData::New();
2907 _pd->SetPoints( _pts );
2908 _pd->SetLines( lines );
2909 lines->Delete(); //do not delete lines ??
2911 _contourVtkActor = vtkActor::New();
2912 _bboxMapper = vtkPolyDataMapper::New();
2913 _bboxMapper->ScalarVisibilityOff( );
2915 _bboxMapper->SetInput(_pd);
2916 _bboxMapper->ImmediateModeRenderingOn();
2917 _contourVtkActor->SetMapper(_bboxMapper);
2918 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2922 _pd->ComputeBounds();
2925 _textActor = vtkTextActor::New();
2926 // _textActor->SetDisplayPosition(200, 200);
2927 _textActor->SetInput("");
2928 // Set coordinates to match the old vtkScaledTextActor default value
2929 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2930 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2931 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2932 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2934 vtkTextProperty *tprop = _textActor->GetTextProperty();
2935 tprop->SetFontSize(14);
2936 tprop->SetFontFamilyToArial();
2937 tprop->SetColor(0, 0, 1);
2939 // ----------------------------------------------------------------------------
2940 void manualViewBaseContour::CreateNewContour()
2942 ConstructVTKObjects();
2944 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2945 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2946 AddCompleteContourActor();
2948 // ----------------------------------------------------------------------------
2949 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2951 manualPoint *mp = _manContModel->GetManualPoint(id);
2954 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2955 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2956 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2958 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2961 // ----------------------------------------------------------------------------
2962 void manualViewBaseContour :: UpdateViewPoints()
2964 int id, size = _lstViewPoints.size();
2965 for( id=0; id<size; id++)
2967 UpdateViewPoint( id );
2971 // ----------------------------------------------------------------------------
2972 void manualViewBaseContour::AddPoint()
2974 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2977 // ----------------------------------------------------------------------------
2978 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2980 _lstViewPoints.push_back( manualViewPoint );
2983 manualViewPoint->SetSpacing(_spc);
2985 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2986 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2989 // ----------------------------------------------------------------------------
2990 void manualViewBaseContour::InsertPoint(int id)
2992 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2995 mvp->SetSpacing(_spc);
2997 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2998 _lstViewPoints.insert(itNum,mvp);
2999 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
3001 // ----------------------------------------------------------------------------
3002 void manualViewBaseContour::DeleteContour()
3004 RemoveCompleteContourActor();
3005 /*if (_contourVtkActor!=NULL){
3006 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3009 int i,size=_lstViewPoints.size();
3010 for (i=0;i<size;i++){
3011 manualViewBaseContour::DeletePoint(0);
3015 // ----------------------------------------------------------------------------
3016 void manualViewBaseContour::DeletePoint(int id) // virtual
3018 int size=_lstViewPoints.size();
3019 if ( (id>=0) && (id<size) ){
3020 manualViewPoint *mvp =_lstViewPoints[id];
3022 // _handlePicker->DeletePickList(mvp->GetVtkActor());
3023 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
3024 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
3025 _lstViewPoints.erase(itNum);
3030 // ----------------------------------------------------------------------------
3031 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3033 int id=GetIdPoint(x,y,z);
3038 // ----------------------------------------------------------------------------
3039 void manualViewBaseContour::SetSelected(bool selected)
3043 // ----------------------------------------------------------------------------
3044 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3046 _posibleSelected=posibleSelected;
3048 // ----------------------------------------------------------------------------
3049 bool manualViewBaseContour::GetEditable()
3053 // ----------------------------------------------------------------------------
3054 void manualViewBaseContour::SetEditable( bool * condition )
3056 _editable = condition;
3058 // ----------------------------------------------------------------------------
3059 bool manualViewBaseContour::GetSelected()
3063 // ----------------------------------------------------------------------------
3064 bool manualViewBaseContour::GetPosibleSelected()
3066 return _posibleSelected;
3068 // ----------------------------------------------------------------------------
3069 void manualViewBaseContour::DeleteSelectedPoints()
3071 int i,size=_lstViewPoints.size();
3072 for (i=size-1;i>=0;i--){
3073 if (_lstViewPoints[i]->GetSelected()==true){
3079 // ----------------------------------------------------------------------------
3080 void manualViewBaseContour::SelectPoint(int i, bool select)
3082 _lstViewPoints[i]->SetSelected(select);
3084 // ----------------------------------------------------------------------------
3085 void manualViewBaseContour::SelectLstPoints()
3089 // ----------------------------------------------------------------------------
3090 void manualViewBaseContour::SelectAllPoints(bool select)
3092 int i,size=_lstViewPoints.size();
3093 for (i=0;i<size;i++){
3094 SelectPoint(i,select);
3097 //-----------------------------------------------------------------------------
3098 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3100 _viewControlPoints = ifShow;
3102 // ----------------------------------------------------------------------------
3103 bool manualViewBaseContour:: GetIfViewControlPoints()
3105 return _viewControlPoints;
3108 // ----------------------------------------------------------------------------
3109 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3111 _lstViewPoints[id]->SetPosibleSelected(select);
3113 // ----------------------------------------------------------------------------
3114 void manualViewBaseContour::SetPointSelected(int id,bool select)
3116 _lstViewPoints[id]->SetSelected(select);
3118 // ----------------------------------------------------------------------------
3119 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3121 int i,size=_lstViewPoints.size();
3122 for (i=0;i<size;i++){
3123 SetPointPosibleSelected(i,select);
3126 // ----------------------------------------------------------------------------
3127 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3129 SelectAllPossibleSelected(false);
3131 int id = GetIdPoint(x,y,z);
3134 SetPointPosibleSelected(id,true);
3138 // ----------------------------------------------------------------------------
3139 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3142 SetPosibleSelected(result);
3143 int id = GetIdPoint(x,y,z);
3144 if( !GetEditable() && !_selected && id!= -1)
3147 SetPosibleSelected(result);
3151 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3153 if (ifTouchContour(x,y,z)==true)
3156 SetPosibleSelected(result);
3160 if (GetEditable()==false)
3162 if (ifTouchContour(x,y,z)==true)
3165 SetPosibleSelected(result);
3173 // ----------------------------------------------------------------------------
3174 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3178 // ----------------------------------------------------------------------------
3179 void manualViewBaseContour::UnSelectPoint(int i){
3180 _lstViewPoints[i]->SetSelected(false);
3183 // ----------------------------------------------------------------------------
3184 void manualViewBaseContour::UnSelectLstPoints(){
3187 // ----------------------------------------------------------------------------
3188 void manualViewBaseContour::UnSelectAllPoints(){
3189 int i,size=_lstViewPoints.size();
3190 for (i=0;i<size;i++){
3195 // ----------------------------------------------------------------------------
3196 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3197 _manContModel=manContModel;
3199 // ----------------------------------------------------------------------------
3200 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3201 _wxvtkbaseview = wxvtkbaseview;
3203 // ----------------------------------------------------------------------------
3204 void manualViewBaseContour::RefreshContour() // Virtual
3207 // ----------------------------------------------------------------------------
3208 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3210 int i,size = _sizePointsContour;
3211 double *vx = (double*)malloc(sizeof(double)*size);
3212 for (i=0;i<size;i++){
3213 _pts->GetPoint(i,pp);
3218 // ----------------------------------------------------------------------------
3219 double* manualViewBaseContour::GetVectorPointsYManualContour()
3222 int i,size = _sizePointsContour;
3223 double *vy = (double*)malloc(sizeof(double)*size);
3224 for (i=0;i<size;i++){
3225 _pts->GetPoint(i,pp);
3230 // ----------------------------------------------------------------------------
3231 double* manualViewBaseContour::GetVectorPointsZManualContour()
3234 int i,size = _sizePointsContour;
3235 double *vz = (double*)malloc(sizeof(double)*size);
3236 for (i=0;i<size;i++){
3237 _pts->GetPoint(i,pp);
3242 // ----------------------------------------------------------------------------
3243 void manualViewBaseContour::Refresh() // virtual
3245 if (_contourVtkActor!=NULL){
3248 int i,size=_lstViewPoints.size();
3249 for (i=0;i<size;i++){
3251 _lstViewPoints[i]->UpdateColorActor();
3255 if (_show_text==true)
3260 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3263 _wxvtkbaseview->GetRenWin()->Render();
3267 // ----------------------------------------------------------------------------
3268 void manualViewBaseContour::RefreshText() // virtual
3270 if( _textActor!=NULL)
3271 _textActor -> SetInput(" ");
3273 // ----------------------------------------------------------------------------
3274 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3276 _coulorNormal_r = r;
3277 _coulorNormal_g = g;
3278 _coulorNormal_b = b;
3280 // ----------------------------------------------------------------------------
3281 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3283 r = _coulorNormal_r;
3284 g = _coulorNormal_g;
3285 b = _coulorNormal_b;
3287 // ----------------------------------------------------------------------------
3288 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3294 // ----------------------------------------------------------------------------
3295 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3301 // ----------------------------------------------------------------------------
3302 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3304 _coulorSelection_r = r;
3305 _coulorSelection_g = g;
3306 _coulorSelection_b = b;
3308 // ----------------------------------------------------------------------------
3309 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3311 r = _coulorSelection_r;
3312 g = _coulorSelection_g;
3313 b = _coulorSelection_b;
3315 // ----------------------------------------------------------------------------
3316 void manualViewBaseContour::UpdateColorActor()
3318 if (_contourVtkActor!=NULL)
3320 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3321 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3322 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3324 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3328 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3332 // ----------------------------------------------------------------------------
3333 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3336 if (_manContModel!=NULL){
3340 TransfromeCoordViewWorld(xx,yy,zz);
3341 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3346 // ----------------------------------------------------------------------------
3349 int manualViewBaseContour::GetNumberOfPoints()
3351 return _lstViewPoints.size();
3354 // ----------------------------------------------------------------------------
3356 //JSTG 25-02-08 ---------------------------------------------------------------
3357 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3359 return _sizePointsContour;
3361 //----------------------------------------------------------------------------
3363 //JSTG 25-02-08 ---------------------------------------------------------------
3364 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3366 _sizePointsContour = size;
3368 //----------------------------------------------------------------------------
3370 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3372 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3377 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3378 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3381 // ----------------------------------------------------------------------------
3382 void manualViewBaseContour::SetRange(int range)
3386 // ----------------------------------------------------------------------------
3387 int manualViewBaseContour::GetRange()
3391 // ----------------------------------------------------------------------------
3392 void manualViewBaseContour::SetZ(int z)
3396 // ----------------------------------------------------------------------------
3397 int manualViewBaseContour::GetZ()
3402 // ----------------------------------------------------------------------------
3403 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3407 // ----------------------------------------------------------------------------
3408 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3411 // ----------------------------------------------------------------------------
3412 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3416 // ----------------------------------------------------------------------------
3417 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3422 int size=_manContModel->GetSizeLstPoints();
3427 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3433 for( i = 0; i < size; i++ )
3435 mp=_manContModel->GetManualPoint(i);
3487 // ----------------------------------------------------------------------------
3488 void manualViewBaseContour::ClearContour()
3490 if (_contourVtkActor!=NULL){
3491 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3494 int i,size=_lstViewPoints.size();
3495 for (i=0;i<size;i++){
3500 // ----------------------------------------------------------------------------
3501 void manualViewBaseContour::ClearPoint(int id)
3505 // ----------------------------------------------------------------------------
3506 void manualViewBaseContour::SetVisible(bool ok)
3517 int i,size=_lstViewPoints.size();
3518 for (i=0;i<size;i++){
3519 actor = _lstViewPoints[i]->GetVtkActor();
3520 actor->GetProperty()->SetOpacity( opacity );
3522 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3523 _textActor->GetProperty()->SetOpacity( opacity );
3524 _textActor->SetInput(" ");
3527 // ----------------------------------------------------------------------------
3528 void manualViewBaseContour::SetShowText(bool ok)
3531 if (_show_text==false)
3533 _textActor->SetInput(" ");
3536 // ----------------------------------------------------------------------------
3537 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3539 return this->_wxvtkbaseview;
3541 // ----------------------------------------------------------------------------
3542 void manualViewBaseContour::GetSpacing(double spc[3])
3548 // ----------------------------------------------------------------------------
3549 void manualViewBaseContour::SetSpacing(double spc[3])
3557 // ----------------------------------------------------------------------------
3558 // ----------------------------------------------------------------------------
3559 // ----------------------------------------------------------------------------
3561 // _type = 0 Sagital
3562 // _type = 1 Coronal
3564 // _type = -1 View 3D
3566 manualContour3VControler::manualContour3VControler(int type)
3571 // _manViewBaseCont1 = NULL;
3572 // _manViewBaseCont2 = NULL;
3573 // _manViewBaseCont3 = NULL;
3575 //----------------------------------------------------------------------------
3576 manualContour3VControler::~manualContour3VControler()
3580 // ----------------------------------------------------------------------------
3581 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3583 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3584 CopyAttributesTo(clone);
3588 // ---------------------------------------------------------------------------
3589 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3592 manualContourControler::CopyAttributesTo(cloneObject);
3594 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3596 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3599 // ----------------------------------------------------------------------------
3600 int manualContour3VControler::GetType()
3605 // ----------------------------------------------------------------------------
3606 void manualContour3VControler::AddPoint_Others()
3608 manualViewBaseContour *mvbc;
3609 int i,size=this->_lstManualViewBaseContour.size();
3610 for ( i = 0 ; i < size ; i++ )
3612 mvbc = _lstManualViewBaseContour[i];
3617 // if (_manViewBaseCont1!=NULL){
3618 // _manViewBaseCont1->AddPoint();
3619 // _manViewBaseCont2->AddPoint();
3620 // _manViewBaseCont3->AddPoint();
3621 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3624 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3626 // ----------------------------------------------------------------------------
3627 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3630 z=(int)_vtkmprbasedata->GetZ();
3631 if (GetManualContourModel()!=NULL){
3635 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3639 xx=_vtkmprbasedata->GetX();
3644 yy=_vtkmprbasedata->GetY();
3648 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3649 GetManualViewBaseContour()->AddPoint();
3655 // ----------------------------------------------------------------------------
3656 void manualContour3VControler::InsertPoint_Others(int id)
3659 manualViewBaseContour *mvbc;
3660 int i,size=this->_lstManualViewBaseContour.size();
3661 for ( i = 0 ; i < size ; i++ )
3663 mvbc = _lstManualViewBaseContour[i];
3664 mvbc->InsertPoint(id);
3668 if (_manViewBaseCont1!=NULL){
3669 _manViewBaseCont1->InsertPoint(id);
3670 _manViewBaseCont2->InsertPoint(id);
3671 _manViewBaseCont3->InsertPoint(id);
3672 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3676 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3679 // ----------------------------------------------------------------------------
3680 void manualContour3VControler::InsertPoint(int x, int y, int z)
3683 if (GetManualContourModel()!=NULL){
3684 if (GetManualContourModel()->GetSizeLstPoints()>1){
3685 z=(int)_vtkmprbasedata->GetZ();
3689 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3692 xx=_vtkmprbasedata->GetX();
3697 yy=_vtkmprbasedata->GetY();
3700 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3702 GetManualViewBaseContour()->InsertPoint(id);
3703 InsertPoint_Others(0);
3710 // ----------------------------------------------------------------------------
3714 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3715 manualViewBaseContour *manViewBaseCont0,
3716 manualViewBaseContour *manViewBaseCont1,
3717 manualViewBaseContour *manViewBaseCont2,
3718 manualViewBaseContour *manViewBaseCont3)
3720 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3721 _manViewBaseCont1 = manViewBaseCont1;
3722 _manViewBaseCont2 = manViewBaseCont2;
3723 _manViewBaseCont3 = manViewBaseCont3;
3727 // ----------------------------------------------------------------------------
3728 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3730 _lstManualViewBaseContour.push_back( manViewBaseCont );
3733 // ----------------------------------------------------------------------------
3734 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3736 _vtkmprbasedata=vtkmprbasedata;
3738 // ----------------------------------------------------------------------------
3739 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3741 return _vtkmprbasedata;
3743 // ----------------------------------------------------------------------------
3744 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3746 z=(int)_vtkmprbasedata->GetZ();
3747 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3751 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3755 xx=_vtkmprbasedata->GetX();
3759 yy=_vtkmprbasedata->GetY();
3762 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3763 mp->SetPoint(xx,yy,zz);
3767 // ----------------------------------------------------------------------------
3768 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3770 manualViewBaseContour *mvbc;
3771 int i,size=this->_lstManualViewBaseContour.size();
3772 for ( i = 0 ; i < size ; i++ )
3774 mvbc = _lstManualViewBaseContour[i];
3775 mvbc->DeletePoint(id);
3780 if (_manViewBaseCont1!=NULL){
3781 _manViewBaseCont1->DeletePoint(id);
3782 _manViewBaseCont2->DeletePoint(id);
3783 _manViewBaseCont3->DeletePoint(id);
3785 _manViewBaseCont1->Refresh();
3786 _manViewBaseCont2->Refresh();
3787 _manViewBaseCont3->Refresh();
3789 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3792 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3794 // ----------------------------------------------------------------------------
3795 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3797 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3799 manualContourBaseControler::DeleteActualMousePoint( x , y );
3800 DeleteActualMousePoint_Others( id );
3803 // ----------------------------------------------------------------------------
3804 void manualContour3VControler::MouseMove_Others(int id) // virtual
3806 manualViewBaseContour *mvbc;
3807 int i,size=this->_lstManualViewBaseContour.size();
3808 for ( i = 0 ; i < size ; i++ )
3810 mvbc = _lstManualViewBaseContour[i];
3811 mvbc->SelectAllPossibleSelected(false);
3814 mvbc->SetPointPosibleSelected(id,true);
3816 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3822 if (_manViewBaseCont1!=NULL){
3823 _manViewBaseCont1->SelectAllPossibleSelected(false);
3824 _manViewBaseCont2->SelectAllPossibleSelected(false);
3825 _manViewBaseCont3->SelectAllPossibleSelected(false);
3827 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3828 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3829 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3831 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3832 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3833 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3835 _manViewBaseCont1->Refresh();
3836 _manViewBaseCont2->Refresh();
3837 _manViewBaseCont3->Refresh();
3839 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3842 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3846 // ----------------------------------------------------------------------------
3847 void manualContour3VControler::MouseMove(int x, int y) // virtual
3849 manualContourControler::MouseMove( x , y );
3850 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3851 MouseMove_Others( id );
3854 // ----------------------------------------------------------------------------
3855 void manualContour3VControler::OnChar_Others()
3857 manualViewBaseContour *mvbc;
3858 int i,size=this->_lstManualViewBaseContour.size();
3859 for ( i = 0 ; i < size ; i++ )
3861 mvbc = _lstManualViewBaseContour[i];
3866 _manViewBaseCont1->Refresh();
3867 _manViewBaseCont2->Refresh();
3868 _manViewBaseCont3->Refresh();
3870 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3872 // ----------------------------------------------------------------------------
3873 bool manualContour3VControler::OnChar()
3875 manualContourControler::OnChar();
3879 // ----------------------------------------------------------------------------
3880 void manualContour3VControler::ResetContour() // virtual
3882 manualContourControler::ResetContour();
3883 ResetContour_Others();
3886 // ----------------------------------------------------------------------------
3887 void manualContour3VControler::ResetContour_Others()
3889 manualViewBaseContour *mvbc;
3890 int i,size=this->_lstManualViewBaseContour.size();
3891 for ( i = 0 ; i < size ; i++ )
3893 mvbc = _lstManualViewBaseContour[i];
3894 mvbc->DeleteContour();
3895 mvbc->CreateNewContour();
3900 _manViewBaseCont1->DeleteContour();
3901 _manViewBaseCont2->DeleteContour();
3902 _manViewBaseCont3->DeleteContour();
3903 _manViewBaseCont1->CreateNewContour();
3904 _manViewBaseCont2->CreateNewContour();
3905 _manViewBaseCont3->CreateNewContour();
3909 // ----------------------------------------------------------------------------
3910 // ----------------------------------------------------------------------------
3911 // ----------------------------------------------------------------------------
3912 manualContour3DControler::manualContour3DControler()
3915 // ----------------------------------------------------------------------------
3916 manualContour3DControler::~manualContour3DControler()
3919 // ----------------------------------------------------------------------------
3920 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3922 manualContour3DControler * clone = new manualContour3DControler();
3923 CopyAttributesTo(clone);
3927 // ---------------------------------------------------------------------------
3928 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3931 manualContourControler::CopyAttributesTo(cloneObject);
3933 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3936 // ----------------------------------------------------------------------------
3937 bool manualContour3DControler::OnLeftButtonDown()
3940 wxVTKRenderWindowInteractor *wxVTKiren;
3941 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3942 wxVTKiren->GetEventPosition(X,Y);
3943 MouseClickLeft(X,Y);
3946 // ----------------------------------------------------------------------------
3947 void manualContour3DControler::ResetOrientationPlane()
3949 double p[3],rp[3],rn[3];
3950 p[0] = this->GetVtkMPRBaseData()->GetX( );
3951 p[1] = this->GetVtkMPRBaseData()->GetY( );
3952 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3953 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3954 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3956 // ----------------------------------------------------------------------------
3957 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3959 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3960 int id=manualview3Dcontour->GetIdPoint2(x,y);
3961 if ( (GetState()==0) && (id!=-1) )
3963 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3965 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3966 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3967 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3968 ResetOrientationPlane();
3969 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3973 manualContourControler::MouseClickLeft(x,y);
3976 // ----------------------------------------------------------------------------
3977 bool manualContour3DControler::OnChar()
3980 manualContourControler::OnChar();
3981 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3984 ResetOrientationPlane();
3985 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3990 // ----------------------------------------------------------------------------
3991 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3993 _vtkmprbasedata=vtkmprbasedata;
3995 // ----------------------------------------------------------------------------
3996 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3998 return _vtkmprbasedata;
4001 // ----------------------------------------------------------------------------
4002 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
4004 manualContourControler::InsertPoint( x, y, z );
4005 ResetOrientationPlane();
4010 // ----------------------------------------------------------------------------
4011 // ----------------------------------------------------------------------------
4012 // ----------------------------------------------------------------------------
4014 manualContour3V3DControler::manualContour3V3DControler()
4017 // ----------------------------------------------------------------------------
4018 manualContour3V3DControler::~manualContour3V3DControler()
4022 // ----------------------------------------------------------------------------
4023 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
4025 manualContour3V3DControler * clone = new manualContour3V3DControler();
4026 CopyAttributesTo(clone);
4030 // ---------------------------------------------------------------------------
4031 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4034 manualContour3DControler::CopyAttributesTo(cloneObject);
4036 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4038 // ----------------------------------------------------------------------------
4039 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4041 manualContour3DControler::InsertPoint( x, y, z );
4042 _manualcontour3Vcontroler->InsertPoint_Others(0);
4044 // ----------------------------------------------------------------------------
4045 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4047 manualContour3DControler::AddPoint( x, y, z );
4048 _manualcontour3Vcontroler->AddPoint_Others();
4050 // ----------------------------------------------------------------------------
4051 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4053 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4054 manualContour3DControler::DeleteActualMousePoint( x , y );
4055 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4057 // ----------------------------------------------------------------------------
4058 void manualContour3V3DControler::MouseMove( int x, int y )
4060 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4061 if ((this->GetState()!=7) && (ss!=1)){
4062 manualContour3DControler::MouseMove( x , y );
4063 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4064 _manualcontour3Vcontroler->MouseMove_Others(id);
4067 // ----------------------------------------------------------------------------
4068 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4070 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4072 // ----------------------------------------------------------------------------
4073 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4075 return _manualcontour3Vcontroler;
4077 // ----------------------------------------------------------------------------
4078 bool manualContour3V3DControler::OnChar() // virtual
4080 if (manualContour3DControler::OnChar()==false )
4082 _manualcontour3Vcontroler->OnChar_Others();
4087 // ----------------------------------------------------------------------------
4088 void manualContour3V3DControler::ResetContour() // virtual
4090 manualContourControler::ResetContour();
4091 _manualcontour3Vcontroler->ResetContour_Others();
4095 // ----------------------------------------------------------------------------
4096 // ----------------------------------------------------------------------------
4097 // ----------------------------------------------------------------------------
4099 // _state = 0 // ..nothing..
4100 // _state = 1 // move with add point
4101 // _state = 5 // move
4102 // _state = 6 // move with insert point
4103 // _state = 7 // move with non selection
4105 manualContourControler::manualContourControler()
4107 _easyCreation = true;
4110 // ----------------------------------------------------------------------------
4111 manualContourControler::~manualContourControler()
4114 // ----------------------------------------------------------------------------
4115 manualContourControler * manualContourControler :: Clone() // virtual
4117 manualContourControler * clone = new manualContourControler();
4118 CopyAttributesTo(clone);
4121 // ---------------------------------------------------------------------------
4122 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4125 manualContourBaseControler::CopyAttributesTo(cloneObject);
4126 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4129 // ----------------------------------------------------------------------------
4130 void manualContourControler::Configure() //virtual
4132 // this->_manContModel->SetNumberOfPointsSpline(100);
4135 // ----------------------------------------------------------------------------
4136 void manualContourControler::MouseClickLeft(int x, int y){
4141 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4143 // Insert a Control Point with shift+ClickLeft
4144 // int tt = GetState(); // JPRx
4145 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4149 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4155 // Start to Insert Control Points with ClickLeft (Empty contour)
4156 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4162 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4163 if ((GetState()==1) && (_easyCreation==true) )
4167 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4169 // Insert Control Points IF Contour si Selected
4170 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4174 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4177 // Chose id of Control Point to be move
4178 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4181 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4184 // If nothing selected _state=7
4185 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4188 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4194 SetPosibleToMove( true );
4195 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4197 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4201 GetManualViewBaseContour()->InitMove(x,y,z);
4206 GetManualViewBaseContour()->Refresh();
4209 // ----------------------------------------------------------------------------
4210 void manualContourControler::MouseMove(int x, int y) // virtual
4213 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4214 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4215 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4216 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4217 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4219 GetManualViewBaseContour()->MoveContour(x,y,z);
4221 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4222 GetManualViewBaseContour()->Refresh();
4223 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4227 GetManualViewBaseContour()->RemoveControlPoints();
4228 GetManualViewBaseContour()->RemoveTextActor();
4229 GetManualViewBaseContour()->Refresh();
4230 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4235 // ----------------------------------------------------------------------------
4236 void manualContourControler::MouseDLeft( int x, int y)//virtual
4238 manualContourBaseControler::MouseDLeft( x, y);
4241 GetManualViewBaseContour()->AddControlPoints();
4242 GetManualViewBaseContour()->AddTextActor();
4243 GetManualViewBaseContour()->Refresh();
4244 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4247 // ----------------------------------------------------------------------------
4248 void manualContourControler::SetEasyCreation(bool easyCreation)
4250 _easyCreation=easyCreation;
4252 // ----------------------------------------------------------------------------
4253 bool manualContourControler::GetEasyCreation()
4255 return _easyCreation;
4259 // ----------------------------------------------------------------------------
4260 // ----------------------------------------------------------------------------
4261 // ----------------------------------------------------------------------------
4262 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4264 _flagMouseMove = true;
4266 // ----------------------------------------------------------------------------
4267 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4270 // ----------------------------------------------------------------------------
4271 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4273 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4274 CopyAttributesTo(clone);
4278 // ---------------------------------------------------------------------------
4279 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4282 manualContourControler::CopyAttributesTo(cloneObject);
4284 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4285 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4286 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4289 // ----------------------------------------------------------------------------
4290 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4292 _vtkmprbasedata = vtkmprbasedata;
4295 // ----------------------------------------------------------------------------
4296 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4298 return _vtkmprbasedata;
4302 // ----------------------------------------------------------------------------
4303 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4305 manualContourControler::InsertPoint( x, y, z );
4306 _manualcontour3Vcontroler->InsertPoint_Others(0);
4308 // ----------------------------------------------------------------------------
4309 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4311 manualContourControler::AddPoint( x, y, z );
4312 _manualcontour3Vcontroler->AddPoint_Others();
4314 // ----------------------------------------------------------------------------
4315 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4317 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4318 manualContourControler::DeleteActualMousePoint( x , y );
4319 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4321 // ----------------------------------------------------------------------------
4322 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4324 _flagMouseMove = true;
4325 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4326 if ((this->GetState()!=7) && (ss!=1)){
4327 manualContourControler::MouseMove( x , y );
4328 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4331 _manualcontour3Vcontroler->MouseMove_Others(id);
4332 _flagMouseMove = false;
4336 // ----------------------------------------------------------------------------
4337 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4339 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4341 // ----------------------------------------------------------------------------
4342 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4344 return _manualcontour3Vcontroler;
4346 // ----------------------------------------------------------------------------
4347 bool manualContourPerpPlaneControler::OnChar() // virtual
4349 if (manualContourControler::OnChar()==false )
4351 _manualcontour3Vcontroler->OnChar_Others();
4355 // ----------------------------------------------------------------------------
4356 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4358 manualContourControler::OnMouseMove();
4359 return _flagMouseMove;
4361 // ----------------------------------------------------------------------------
4362 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4364 manualContourControler::OnLeftDClick();
4365 return _flagMouseDClick;
4367 // ----------------------------------------------------------------------------
4368 void manualContourPerpPlaneControler::ResetContour() // virtual
4370 manualContourControler::ResetContour();
4371 _manualcontour3Vcontroler->ResetContour_Others();
4374 // ----------------------------------------------------------------------------
4375 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4377 _flagMouseDClick=true;
4378 manualContourControler::MouseDLeft(x,y);
4380 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4382 _flagMouseDClick = false;
4383 _vtkinteractorstyleplane2D->OnLeftDClick();
4384 ResetOrientationPlane();
4385 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4388 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4389 // if ( (GetState()==0) && (id!=-1) )
4391 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4392 // _vtkmprbasedata->SetX( mp->GetX() );
4393 // _vtkmprbasedata->SetY( mp->GetY() );
4394 // _vtkmprbasedata->SetZ( mp->GetZ() );
4395 // ResetOrientationPlane();
4396 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4402 // ----------------------------------------------------------------------------
4403 void manualContourPerpPlaneControler::ResetOrientationPlane()
4405 double p[3],rp[3],rn[3];
4406 p[0] = _vtkmprbasedata->GetX( );
4407 p[1] = _vtkmprbasedata->GetY( );
4408 p[2] = _vtkmprbasedata->GetZ( );
4409 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4411 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4414 // ----------------------------------------------------------------------------
4415 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4417 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4419 // ----------------------------------------------------------------------------
4420 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4422 return _vtkinteractorstyleplane2D;
4425 // ----------------------------------------------------------------------------
4426 // ----------------------------------------------------------------------------
4427 // ----------------------------------------------------------------------------
4429 // _state = 0 // ..nothing..
4430 // _state = 5 // move point
4431 // _state = 6 // move all
4432 // _state = 7 // Empty mouse drag
4434 manualRoiControler::manualRoiControler()
4437 // ----------------------------------------------------------------------------
4438 manualRoiControler::~manualRoiControler()
4441 // ----------------------------------------------------------------------------
4442 manualRoiControler * manualRoiControler :: Clone() // virtual
4444 manualRoiControler * clone = new manualRoiControler();
4445 CopyAttributesTo(clone);
4449 // ---------------------------------------------------------------------------
4450 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4453 manualContourBaseControler::CopyAttributesTo(cloneObject);
4456 // ----------------------------------------------------------------------------
4457 void manualRoiControler::Configure() //virtual
4459 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4462 // ----------------------------------------------------------------------------
4463 void manualRoiControler::MouseClickLeft(int x, int y){
4465 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4466 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4469 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4470 GetManualViewBaseContour()->InitMove(x,y,z);
4473 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4474 if (GetState()==0) {
4486 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4489 GetManualViewBaseContour()->Refresh();
4491 // ----------------------------------------------------------------------------
4492 void manualRoiControler::MouseMove(int x, int y) // virtual
4496 // this->_vtkInteractorStyleBaseView->
4498 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4499 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4502 SetPoint( bakIdPoint , x , y ,z);
4525 GetManualViewBaseContour()->MoveContour(x,y,z);
4527 GetManualViewBaseContour()->Refresh();
4529 // ----------------------------------------------------------------------------
4530 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4533 // ----------------------------------------------------------------------------
4534 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4539 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4548 double pp1=porcentage;
4549 double pp2=1-porcentage;
4551 mp = GetManualContourModel()->GetManualPoint(2);
4553 mp->SetPoint(ww*pp1,hh*pp1,zz);
4555 mp = GetManualContourModel()->GetManualPoint(1);
4557 mp->SetPoint(ww*pp2,hh*pp1,zz);
4559 mp = GetManualContourModel()->GetManualPoint(0);
4561 mp->SetPoint(ww*pp2,hh*pp2,zz);
4563 mp = GetManualContourModel()->GetManualPoint(3);
4565 mp->SetPoint(ww*pp1,hh*pp2,zz);
4567 GetManualViewBaseContour() ->UpdateViewPoint(0);
4568 GetManualViewBaseContour() ->UpdateViewPoint(1);
4569 GetManualViewBaseContour() ->UpdateViewPoint(2);
4570 GetManualViewBaseContour() ->UpdateViewPoint(3);
4573 GetManualViewBaseContour()->Refresh();
4576 // ----------------------------------------------------------------------------
4577 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4580 InitRoi( 0 , 0 , 0.2 );
4581 mp = GetManualContourModel()->GetManualPoint(2);
4585 mp = GetManualContourModel()->GetManualPoint(1);
4589 mp = GetManualContourModel()->GetManualPoint(0);
4593 mp = GetManualContourModel()->GetManualPoint(3);
4597 GetManualViewBaseContour() ->UpdateViewPoint(0);
4598 GetManualViewBaseContour() ->UpdateViewPoint(1);
4599 GetManualViewBaseContour() ->UpdateViewPoint(2);
4600 GetManualViewBaseContour() ->UpdateViewPoint(3);
4604 // ----------------------------------------------------------------------------
4605 // ----------------------------------------------------------------------------
4606 // ----------------------------------------------------------------------------
4610 // _state = 0 // ..nothing..
4611 // _state = 5 // move point
4612 // _state = 6 // move all
4613 // _state = 7 // Empty mouse drag
4615 manualCircleControler::manualCircleControler()
4618 // ----------------------------------------------------------------------------
4619 manualCircleControler::~manualCircleControler()
4622 // ----------------------------------------------------------------------------
4623 manualCircleControler * manualCircleControler :: Clone() // virtual
4625 manualCircleControler * clone = new manualCircleControler();
4626 CopyAttributesTo(clone);
4630 // ---------------------------------------------------------------------------
4631 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4634 manualContourBaseControler::CopyAttributesTo(cloneObject);
4637 // ----------------------------------------------------------------------------
4638 void manualCircleControler::Configure() //virtual
4640 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4643 // ----------------------------------------------------------------------------
4644 void manualCircleControler::MouseClickLeft(int x, int y){
4646 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4647 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4650 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4651 GetManualViewBaseContour()->InitMove(x,y,z);
4654 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4655 if (GetState()==0) {
4664 // SetPoint(2,x,y,z);
4665 // SetPoint(3,x,y,z);
4667 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4670 GetManualViewBaseContour()->Refresh();
4672 // ----------------------------------------------------------------------------
4674 void manualCircleControler::MouseMove(int x, int y) // virtual
4678 // this->_vtkInteractorStyleBaseView->
4680 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4681 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4684 SetPoint( bakIdPoint , x , y ,z);
4710 GetManualViewBaseContour()->MoveContour(x,y,z);
4712 GetManualViewBaseContour()->Refresh();
4716 // ----------------------------------------------------------------------------
4717 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4720 // ----------------------------------------------------------------------------
4722 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4727 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4732 // AddPoint(0,0,zz);
4733 // AddPoint(0,0,zz);
4736 double pp1=porcentage;
4737 double pp2=1-porcentage;
4739 // mp = GetManualContourModel()->GetManualPoint(2);
4740 // zz=(int)mp->GetZ();
4741 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4743 mp = GetManualContourModel()->GetManualPoint(1);
4745 mp->SetPoint(ww*pp2,hh*pp1,zz);
4747 mp = GetManualContourModel()->GetManualPoint(0);
4749 mp->SetPoint(ww*pp2,hh*pp2,zz);
4751 // mp = GetManualContourModel()->GetManualPoint(3);
4752 // zz=(int)mp->GetZ();
4753 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4755 GetManualViewBaseContour() ->UpdateViewPoint(0);
4756 GetManualViewBaseContour() ->UpdateViewPoint(1);
4757 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4758 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4761 GetManualViewBaseContour()->Refresh();
4764 // ----------------------------------------------------------------------------
4766 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4769 InitRoi( 0 , 0 , 0.2 );
4770 mp = GetManualContourModel()->GetManualPoint(2);
4774 mp = GetManualContourModel()->GetManualPoint(1);
4778 mp = GetManualContourModel()->GetManualPoint(0);
4782 mp = GetManualContourModel()->GetManualPoint(3);
4786 GetManualViewBaseContour() ->UpdateViewPoint(0);
4787 GetManualViewBaseContour() ->UpdateViewPoint(1);
4788 GetManualViewBaseContour() ->UpdateViewPoint(2);
4789 GetManualViewBaseContour() ->UpdateViewPoint(3);
4794 // ----------------------------------------------------------------------------
4795 // ----------------------------------------------------------------------------
4796 // ----------------------------------------------------------------------------
4800 // _state = 0 // ..nothing..
4801 // _state = 5 // move point
4802 // _state = 6 // move all
4803 // _state = 7 // Empty mouse drag
4805 manualLineControler::manualLineControler()
4808 // ----------------------------------------------------------------------------
4809 manualLineControler::~manualLineControler()
4812 // ----------------------------------------------------------------------------
4813 manualLineControler * manualLineControler :: Clone() // virtual
4815 manualLineControler * clone = new manualLineControler();
4816 CopyAttributesTo(clone);
4820 // ---------------------------------------------------------------------------
4821 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4824 manualContourBaseControler::CopyAttributesTo(cloneObject);
4827 // ----------------------------------------------------------------------------
4828 void manualLineControler::MouseClickLeft(int x, int y){
4830 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4831 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4834 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4835 GetManualViewBaseContour()->InitMove(x,y,z);
4838 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4839 if (GetState()==0) {
4847 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4850 GetManualViewBaseContour()->Refresh();
4852 // ----------------------------------------------------------------------------
4854 void manualLineControler::MouseMove(int x, int y) // virtual
4858 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4859 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4863 SetPoint( bakIdPoint , x , y ,z);
4867 GetManualViewBaseContour()->MoveContour(x,y,z);
4869 GetManualViewBaseContour()->Refresh();
4873 // ----------------------------------------------------------------------------
4874 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4877 // ----------------------------------------------------------------------------
4879 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4884 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4891 double pp1=porcentage;
4892 double pp2=1-porcentage;
4894 mp = GetManualContourModel()->GetManualPoint(0);
4896 mp->SetPoint(ww*pp2,hh*pp2,zz);
4898 mp = GetManualContourModel()->GetManualPoint(1);
4900 mp->SetPoint(ww*pp2,hh*pp1,zz);
4902 GetManualViewBaseContour() ->UpdateViewPoint(0);
4903 GetManualViewBaseContour() ->UpdateViewPoint(1);
4906 GetManualViewBaseContour()->Refresh();
4909 // ----------------------------------------------------------------------------
4910 // ----------------------------------------------------------------------------
4911 // ----------------------------------------------------------------------------
4914 manualContourBaseControler::manualContourBaseControler()
4916 _manViewBaseCont = NULL;
4917 _manContModel = NULL;
4921 _posibleToMove = true;
4924 _keyBoardMoving = false;
4926 // ----------------------------------------------------------------------------
4927 manualContourBaseControler::~manualContourBaseControler()
4931 // ----------------------------------------------------------------------------
4932 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4934 manualContourBaseControler * clone = new manualContourBaseControler();
4935 CopyAttributesTo(clone);
4939 // ---------------------------------------------------------------------------
4941 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4944 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4945 cloneObject->SetZ( this->GetZ() );
4946 cloneObject->SetState( this->GetState() );
4947 cloneObject->SetEditable( this->IsEditable() );
4948 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4949 cloneObject->SetMoving( this->IsMoving() );
4950 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4951 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4954 // ----------------------------------------------------------------------------
4955 void manualContourBaseControler::Configure() //virtual
4959 // ----------------------------------------------------------------------------
4960 bool manualContourBaseControler::OnChar()
4962 if ( _vtkInteractorStyleBaseView!=NULL )
4964 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4967 wxVTKRenderWindowInteractor *_wxVTKiren;
4968 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4969 _wxVTKiren->GetEventPosition(X, Y);
4970 //int Z = GetZ(); // JPRx
4972 if ((keyCode==8) || (keyCode==127))
4975 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4977 DeleteActualMousePoint(X,Y);
4979 GetManualViewBaseContour()->Refresh();
4980 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4988 GetManualViewBaseContour()->Refresh();
4989 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4991 else if( !IsEditable() )
4993 if ( keyCode == 'L' )
4995 GetManualViewBaseContour()->MoveContour( -1, 0 );
4996 SetKeyBoardMoving( true );
4998 else if ( keyCode == 'R' )
5000 GetManualViewBaseContour()->MoveContour( 1, 0 );
5001 SetKeyBoardMoving( true );
5003 else if ( keyCode == 'U' )
5005 GetManualViewBaseContour()->MoveContour( 0, -1 );
5006 SetKeyBoardMoving( true );
5008 else if ( keyCode == 'D' )
5010 GetManualViewBaseContour()->MoveContour( 0, 1 );
5011 SetKeyBoardMoving( true );
5013 else if ( keyCode == 'W' )//Diagonal left down
5015 GetManualViewBaseContour()->MoveContour( -1, 1 );
5016 SetKeyBoardMoving( true );
5018 else if ( keyCode == 'Q' )//Diagonal left up
5020 GetManualViewBaseContour()->MoveContour( -1, -1 );
5021 SetKeyBoardMoving( true );
5023 else if( keyCode == 'P' )//Diagonal right up
5025 GetManualViewBaseContour()->MoveContour( 1, -1 );
5026 SetKeyBoardMoving( true );
5028 else if( keyCode == 'M' )//Diagonal right down
5030 GetManualViewBaseContour()->MoveContour( 1, 1 );
5031 SetKeyBoardMoving( true );
5033 if( GetKeyBoardMoving() )
5035 GetManualViewBaseContour()->Refresh();
5036 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5043 // ----------------------------------------------------------------------------
5044 bool manualContourBaseControler::OnMouseMove()
5046 if ( _vtkInteractorStyleBaseView!=NULL)
5049 wxVTKRenderWindowInteractor *_wxVTKiren;
5050 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5051 _wxVTKiren->GetEventPosition( X , Y );
5054 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5055 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5061 // ----------------------------------------------------------------------------
5062 bool manualContourBaseControler::OnLeftButtonDown()
5064 SetKeyBoardMoving( false );
5065 if ( _vtkInteractorStyleBaseView!=NULL )
5068 wxVTKRenderWindowInteractor *wxVTKiren;
5069 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5070 wxVTKiren->GetEventPosition(X,Y);
5072 MouseClickLeft(X,Y);
5076 // ----------------------------------------------------------------------------
5077 bool manualContourBaseControler::OnLeftButtonUp()
5079 if ( _vtkInteractorStyleBaseView!=NULL )
5082 wxVTKRenderWindowInteractor *wxVTKiren;
5083 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5084 wxVTKiren->GetEventPosition(X,Y);
5085 MouseReleaseLeft(X,Y);
5089 // ----------------------------------------------------------------------------
5090 bool manualContourBaseControler::OnLeftDClick()
5092 if ( _vtkInteractorStyleBaseView!=NULL )
5095 wxVTKRenderWindowInteractor *wxVTKiren;
5096 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5097 wxVTKiren->GetEventPosition(X,Y);
5099 this->MouseDLeft(X,Y);
5103 // ----------------------------------------------------------------------------
5104 bool manualContourBaseControler::OnMiddleButtonDown()
5106 // SetKeyBoardMoving( false );
5107 if ( _vtkInteractorStyleBaseView!=NULL )
5110 wxVTKRenderWindowInteractor *wxVTKiren;
5111 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5112 wxVTKiren->GetEventPosition(X,Y);
5113 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5117 // ----------------------------------------------------------------------------
5118 bool manualContourBaseControler::OnMiddleButtonUp()
5122 // ----------------------------------------------------------------------------
5123 bool manualContourBaseControler::OnRightButtonDown()
5125 if( _vtkInteractorStyleBaseView!= NULL )
5128 wxVTKRenderWindowInteractor *wxVTKiren;
5129 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5130 wxVTKiren->GetEventPosition(X, Y);
5132 SetCompleteCreation( true );
5133 SetKeyBoardMoving( false );
5134 MouseClickRight(X,Y);
5138 // ----------------------------------------------------------------------------
5139 bool manualContourBaseControler::OnRightButtonUp()
5143 // ----------------------------------------------------------------------------
5144 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5145 _manContModel = manContModel;
5146 _manViewBaseCont = manViewBaseCont;
5147 _manViewBaseCont->SetEditable( &_editable );
5149 // ----------------------------------------------------------------------------
5150 manualContourModel* manualContourBaseControler::GetManualContourModel()
5152 return _manContModel;
5154 // ----------------------------------------------------------------------------
5155 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5157 return _manViewBaseCont;
5159 // ----------------------------------------------------------------------------
5160 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5164 // ----------------------------------------------------------------------------
5165 void manualContourBaseControler::MouseClickRight(int x, int y)
5171 SetEditable( false );
5172 SetPosibleToMove( false );
5176 // ----------------------------------------------------------------------------
5177 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5179 if (_state==5){ _state = 0; }
5180 if (_state==6){ _state = 0; }
5181 if (_state==7){ _state = 0; }
5183 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5184 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5186 SetEditable( false );
5187 SetPosibleToMove( false );
5190 // ----------------------------------------------------------------------------
5191 void manualContourBaseControler::MouseDLeft(int x, int y )
5196 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5197 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5198 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5204 // ----------------------------------------------------------------------------
5205 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5208 // ----------------------------------------------------------------------------
5209 void manualContourBaseControler::SetState(int state)
5213 // ----------------------------------------------------------------------------
5214 int manualContourBaseControler::GetState()
5218 // ----------------------------------------------------------------------------
5219 bool manualContourBaseControler::IsEditable( )
5223 // ----------------------------------------------------------------------------
5224 void manualContourBaseControler::SetEditable( bool condition )
5226 if (GetManualViewBaseContour()!=NULL) {
5229 GetManualViewBaseContour()->RemoveControlPoints();
5231 GetManualViewBaseContour()->SetSelected( condition );
5233 _editable = condition;
5236 // ----------------------------------------------------------------------------
5237 bool manualContourBaseControler::GetPosibleToMove()
5239 return _posibleToMove;
5241 // ----------------------------------------------------------------------------
5242 void manualContourBaseControler::SetPosibleToMove( bool condition )
5244 _posibleToMove = condition;
5246 // ----------------------------------------------------------------------------
5247 bool manualContourBaseControler::IsMoving()
5251 // ----------------------------------------------------------------------------
5252 void manualContourBaseControler::SetMoving( bool condition )
5254 _moving = condition;
5256 // ----------------------------------------------------------------------------
5257 void manualContourBaseControler::SetCompleteCreation( bool condition )
5259 _created = condition;
5261 // ----------------------------------------------------------------------------
5262 bool manualContourBaseControler::GetIfCompleteCreation ( )
5266 // ----------------------------------------------------------------------------
5267 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5269 _keyBoardMoving = condition;
5271 // ----------------------------------------------------------------------------
5272 bool manualContourBaseControler::GetKeyBoardMoving( )
5274 return _keyBoardMoving;
5276 // ----------------------------------------------------------------------------
5277 void manualContourBaseControler::CreateNewManualContour(){
5278 _manViewBaseCont->CreateNewContour();
5280 // ----------------------------------------------------------------------------
5281 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5282 return _manViewBaseCont->GetNumberOfPoints();
5284 // ----------------------------------------------------------------------------
5286 //JSTG - 25-02-08 -------------------------------------------------------------
5287 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5288 //return _manViewBaseCont->GetNumberOfPointsSpline();
5289 return _manContModel->GetNumberOfPointsSpline();
5291 // ----------------------------------------------------------------------------
5293 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5294 return _manViewBaseCont->GetVectorPointsXManualContour();
5296 // ----------------------------------------------------------------------------
5297 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5298 return _manViewBaseCont->GetVectorPointsYManualContour();
5300 // ----------------------------------------------------------------------------
5301 void manualContourBaseControler::DeleteContour(){
5302 _manViewBaseCont->DeleteContour();
5303 _manContModel->DeleteAllPoints();
5305 // ----------------------------------------------------------------------------
5306 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5308 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5310 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5311 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5312 _manContModel->DeletePoint(id);
5313 _manViewBaseCont->DeletePoint(id);
5319 // ----------------------------------------------------------------------------
5320 void manualContourBaseControler::Magnet(int x, int y)
5324 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5325 if (GetManualContourModel()!=NULL){
5329 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5330 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5333 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5334 mp->SetPoint(xx,yy,zz);
5336 // GetManualViewBaseContour()->UpdateViewPoint(id);
5342 // ----------------------------------------------------------------------------
5343 void manualContourBaseControler::SetZ(int z)
5347 // ----------------------------------------------------------------------------
5348 int manualContourBaseControler::GetZ()
5352 // ----------------------------------------------------------------------------
5353 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5355 if (GetManualContourModel()!=NULL){
5359 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5360 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5361 GetManualViewBaseContour()->AddPoint();
5362 // GetManualViewBaseContour()->UpdateViewPoint(id);
5365 // ----------------------------------------------------------------------------
5366 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5370 if (GetManualContourModel()!=NULL){
5374 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5375 if (GetManualContourModel()->GetSizeLstPoints()>1){
5376 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5377 GetManualViewBaseContour()->InsertPoint(id);
5378 // GetManualViewBaseContour()->UpdateViewPoint(id);
5380 GetManualContourModel()->AddPoint(xx,yy,zz);
5381 GetManualViewBaseContour()->AddPoint();
5383 // GetManualViewBaseContour()->UpdateViewPoint(id);
5388 // ----------------------------------------------------------------------------
5389 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5390 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5394 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5395 manualPoint *mp = _manContModel->GetManualPoint(id);
5396 mp->SetPoint(xx,yy,zz);
5397 GetManualViewBaseContour()->UpdateViewPoint(id);
5400 // ----------------------------------------------------------------------------
5401 void manualContourBaseControler::SetPointX( int id ,int x ){
5402 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5406 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5407 manualPoint *mp = _manContModel->GetManualPoint(id);
5409 GetManualViewBaseContour()->UpdateViewPoint(id);
5412 // ----------------------------------------------------------------------------
5413 void manualContourBaseControler::SetPointY( int id ,int y ){
5414 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5418 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5419 manualPoint *mp = _manContModel->GetManualPoint(id);
5421 GetManualViewBaseContour()->UpdateViewPoint(id);
5424 // ----------------------------------------------------------------------------
5425 void manualContourBaseControler::SetPointZ( int id ,int z ){
5426 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5430 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5431 manualPoint *mp = _manContModel->GetManualPoint(id);
5433 GetManualViewBaseContour()->UpdateViewPoint(id);
5436 // ----------------------------------------------------------------------------
5437 void manualContourBaseControler::ResetContour() // virtual
5439 this->DeleteContour();
5440 GetManualViewBaseContour()->CreateNewContour();