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(20);
148 this->SetCloseContour(false);
151 manualContourModelLine::~manualContourModelLine()
156 // ----------------------------------------------------------------------------
157 manualContourModelLine * manualContourModelLine :: Clone() // virtual
159 manualContourModelLine * clone = new manualContourModelLine();
160 CopyAttributesTo(clone);
164 // ---------------------------------------------------------------------------
166 void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
168 manualContourModel::CopyAttributesTo(cloneObject);
171 //----------------------------------------------------------------
172 int manualContourModelLine::GetTypeModel() //virtual
178 //----------------------------------------------------------------
180 void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
182 int np = GetSizeLstPoints();
192 mp = GetManualPoint(0);
203 mp = GetManualPoint(0);
207 mp = GetManualPoint(1);
219 // ----------------------------------------------------------------------------
220 // ----------------------------------------------------------------------------
221 // ----------------------------------------------------------------------------
222 manualContourModelBullEye::manualContourModelBullEye()
223 : manualContourModel()
225 _numberPointsSlineBySector=101; // impaire
228 manualContourModelBullEye::~manualContourModelBullEye()
233 // ----------------------------------------------------------------------------
234 manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
236 manualContourModelBullEye * clone = new manualContourModelBullEye();
237 CopyAttributesTo(clone);
241 // ---------------------------------------------------------------------------
243 void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
246 manualContourModel::CopyAttributesTo(cloneObject);
249 //----------------------------------------------------------------
250 int manualContourModelBullEye::GetTypeModel() //virtual
255 //----------------------------------------------------------------
256 int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
258 return _numberPointsSlineBySector;
261 //----------------------------------------------------------------
262 void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
264 this->_numberPointsSlineBySector = numpoints;
267 //----------------------------------------------------------------
268 void manualContourModelBullEye::AddSector( double radioA,
273 manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
274 modelSector->SetSector(radioA,radioB,ang,angDelta);
275 modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
276 _lstModelBullEyeSector.push_back(modelSector);
279 //----------------------------------------------------------------
280 manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
282 return _lstModelBullEyeSector[id];
285 //----------------------------------------------------------------
286 void manualContourModelBullEye::GetSector(int id,
292 _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
295 void manualContourModelBullEye::UpdateSpline() // virtual
297 manualContourModel::UpdateSpline();
299 if (this->GetSizeLstPoints()>2){
302 manualPoint *mpA = GetManualPoint(0);
303 manualPoint *mpB = GetManualPoint(2);
304 cx = (mpA->GetX() + mpB->GetX()) / 2.0;
305 cy = (mpA->GetY() + mpB->GetY()) / 2.0;
306 ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
307 hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
308 int i,size = _lstModelBullEyeSector.size();
311 _lstModelBullEyeSector[i]->SetCenter(cx,cy);
312 _lstModelBullEyeSector[i]->SetSize(ww,hh);
318 //----------------------------------------------------------------
319 void manualContourModelBullEye::ResetSectors()
321 int i,size=_lstModelBullEyeSector.size();
324 delete _lstModelBullEyeSector[i];
326 _lstModelBullEyeSector.clear();
329 //----------------------------------------------------------------
330 int manualContourModelBullEye::GetSizeOfSectorLst()
332 return _lstModelBullEyeSector.size();
335 //----------------------------------------------------------------
336 void manualContourModelBullEye::Save(FILE *ff) // virtual
338 manualContourModel::Save(ff);
339 int i,size = GetSizeOfSectorLst();
340 fprintf(ff,"numberOfSections %d \n",size);
341 for ( i=0 ; i<size ; i++ )
343 _lstModelBullEyeSector[i]->Save(ff);
347 //----------------------------------------------------------------
348 void manualContourModelBullEye::Open(FILE *ff) // virtual
350 manualContourModel::Open(ff);
356 int numberOfSections;
357 // double radioA,radioB,ang,deltaAng;
359 fscanf(ff,"%s",tmp); // NumberOfSections
360 fscanf(ff,"%s",tmp); // ##
361 numberOfSections = atoi(tmp);
362 for (i=0;i<numberOfSections;i++)
365 _lstModelBullEyeSector[i]->Open(ff);
370 // ----------------------------------------------------------------------------
371 std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
374 std::vector<manualContourModel*> lstTmp;
375 int i,iSize=_lstModelBullEyeSector.size();
376 for (i=0;i<iSize;i++)
378 lstTmp.push_back( _lstModelBullEyeSector[i] );
384 // ----------------------------------------------------------------------------
385 // ----------------------------------------------------------------------------
386 // ----------------------------------------------------------------------------
387 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
388 : manualContourModel()
392 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
397 // ----------------------------------------------------------------------------
398 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
400 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
401 CopyAttributesTo(clone);
405 // ---------------------------------------------------------------------------
407 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
410 manualContourModel::CopyAttributesTo(cloneObject);
413 //----------------------------------------------------------------
414 int manualContourModelBullEyeSector::GetTypeModel() //virtual
420 //----------------------------------------------------------------
421 void manualContourModelBullEyeSector::SetSector( double radioA,
428 _ang = ang*3.14159265/180.0;
429 _angDelta = angDelta*3.14159265/180.0;
432 //----------------------------------------------------------------
433 void manualContourModelBullEyeSector::GetSector(
442 *angDelta = _angDelta;
445 // ----------------------------------------------------------------------------
446 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
452 //----------------------------------------------------------------
453 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
459 //----------------------------------------------------------------
460 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
466 double ang,angcos, angsin;
469 nps = GetNumberOfPointsSpline() - 3;
471 if (i==GetNumberOfPointsSpline()-1)
484 ang = ((double)ii/(nps/2))*_angDelta + _ang;
488 *x = _ww*radio*angcos + _cx;
489 *y = _hh*radio*angsin + _cy;
493 //----------------------------------------------------------------
494 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
496 manualContourModel::Save(ff);
497 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
500 //----------------------------------------------------------------
501 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
504 fscanf(ff,"%s",tmp); // TypeModel
505 fscanf(ff,"%s",tmp); // ##
507 manualContourModel::Open(ff);
510 fscanf(ff,"%s",tmp); // radioA=
511 fscanf(ff,"%s",tmp); // radioA
514 fscanf(ff,"%s",tmp); // radioB=
515 fscanf(ff,"%s",tmp); // radioB
518 fscanf(ff,"%s",tmp); // ang=
519 fscanf(ff,"%s",tmp); // ang
522 fscanf(ff,"%s",tmp); // deltaAng=
523 fscanf(ff,"%s",tmp); // deltaAng
524 _angDelta = atof(tmp);
529 // ---------------------------------------------------------------------------
530 // ---------------------------------------------------------------------------
531 // ---------------------------------------------------------------------------
532 // ---------------------------------------------------------------------------
534 //JSTG 25-02-08 --------------------------------------------------
535 manualContourModelRoi::manualContourModelRoi()
536 : manualContourModel()
538 SetNumberOfPointsSpline(5);
541 manualContourModelRoi::~manualContourModelRoi()
546 // ----------------------------------------------------------------------------
547 manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
549 manualContourModelRoi * clone = new manualContourModelRoi();
550 CopyAttributesTo(clone);
554 // ---------------------------------------------------------------------------
556 void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
559 manualContourModel::CopyAttributesTo(cloneObject);
562 //----------------------------------------------------------------
563 int manualContourModelRoi::GetTypeModel() //virtual
568 //----------------------------------------------------------------
571 // ----------------------------------------------------------------------------
572 // ----------------------------------------------------------------------------
573 // ----------------------------------------------------------------------------
575 manualContourModel::manualContourModel()
577 _cntSplineX = vtkKochanekSpline::New( );
578 _cntSplineY = vtkKochanekSpline::New( );
579 _cntSplineZ = vtkKochanekSpline::New( );
581 this->SetCloseContour(true);
583 _cntSplineX->SetDefaultTension( 0 );
584 _cntSplineX->SetDefaultBias( 0 );
585 _cntSplineX->SetDefaultContinuity( 0 );
587 _cntSplineY->SetDefaultTension( 0 );
588 _cntSplineY->SetDefaultBias( 0 );
589 _cntSplineY->SetDefaultContinuity( 0 );
591 _cntSplineZ->SetDefaultTension( 0 );
592 _cntSplineZ->SetDefaultBias( 0 );
593 _cntSplineZ->SetDefaultContinuity( 0 );
595 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
597 // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
598 _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
601 //---------------------------------------------------------------------------------------------------------------
604 // ----------------------------------------------------------------------------
605 manualContourModel::~manualContourModel()
607 int i,size=_lstPoints.size();
608 for (i=0;i<size; i++){
609 delete _lstPoints[i];
613 _cntSplineX->RemoveAllPoints();
614 _cntSplineY->RemoveAllPoints();
615 _cntSplineZ->RemoveAllPoints();
617 _cntSplineX->Delete();
618 _cntSplineY->Delete();
619 _cntSplineZ->Delete();
621 // ----------------------------------------------------------------------------
622 int manualContourModel::AddPoint(double x,double y,double z)
624 manualPoint *mp = new manualPoint();
629 return _lstPoints.size()-1;
631 // ----------------------------------------------------------------------------
632 int manualContourModel::InsertPoint(double x,double y,double z)
634 double dd,ddmin=9999999;
639 int i,ii,iii,size=_lstPoints.size();
640 double j,MaxDivisions=20,porcentage;
643 if (_closeContour==false)
650 for ( i=0 ; i<size ; i++ )
654 x1=_lstPoints[ii]->GetX();
655 y1=_lstPoints[ii]->GetY();
656 z1=_lstPoints[ii]->GetZ();
657 x2=_lstPoints[iii]->GetX();
658 y2=_lstPoints[iii]->GetY();
659 z2=_lstPoints[iii]->GetZ();
660 for (j=0; j<=MaxDivisions; j++)
662 porcentage=(j/MaxDivisions);
663 xx=(x2-x1)*porcentage+x1;
664 yy=(y2-y1)*porcentage+y1;
665 zz=(z2-z1)*porcentage+z1;
666 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
676 if (_closeContour==false)
678 if ( (ibak==1) && (jbak==0) )
682 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
689 //JSTG - 25-04-08 ----------------------------------------------------------
690 //manualPoint *mp = new manualPoint();
691 //mp->SetPoint(x,y,z);
692 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
693 //_lstPoints.insert(itNum,mp);
694 InsertPoint_id(ibak,x,y,z);
695 //----------------------------------------------------------------------------
699 // ----------------------------------------------------------------------------
700 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
702 manualPoint *mp = new manualPoint();
704 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
705 _lstPoints.insert(itNum,mp);
707 // ----------------------------------------------------------------------------
709 void manualContourModel::DeletePoint(int i)
711 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
712 _lstPoints.erase(itNum);
714 // ----------------------------------------------------------------------------
715 void manualContourModel::DeleteAllPoints()
717 int i,size=_lstPoints.size();
718 for (i=0;i<size;i++){
719 _lstPoints.erase( _lstPoints.begin() );
721 this->UpdateSpline();
723 // ----------------------------------------------------------------------------
725 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
727 manualPoint *mp=_lstPoints[i];
728 double x=mp->GetX()+dx;
729 double y=mp->GetY()+dy;
730 double z=mp->GetZ()+dz;
733 // ----------------------------------------------------------------------------
734 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
738 // ----------------------------------------------------------------------------
739 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
741 int i,size=_lstPoints.size();
742 for (i=0;i<size;i++){
743 MovePoint(i,dx,dy,dz);
748 // ----------------------------------------------------------------------------
754 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
756 double range = i_range+1;
758 double xx,yy,zz,dd,ddmin=9999999;
760 int i,size=_lstPoints.size();
761 for (i=0;i<size;i++){
762 manualPoint *mp=_lstPoints[i];
769 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
770 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
779 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
780 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
789 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
790 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
799 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
800 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
810 // ----------------------------------------------------------------------------
811 manualPoint* manualContourModel::GetManualPoint(int id)
813 return _lstPoints[id];
815 // ----------------------------------------------------------------------------
816 int manualContourModel::GetSizeLstPoints()
818 return _lstPoints.size();
820 //----------------------------------------------------------------------------
821 int manualContourModel::GetNumberOfPointsSpline()
823 return _sizePointsContour;
825 //----------------------------------------------------------------------------
826 void manualContourModel::SetNumberOfPointsSpline(int size)
828 _sizePointsContour = size;
832 // ----------------------------------------------------------------------------
834 void manualContourModel::SetCloseContour(bool closeContour)
836 _closeContour = closeContour;
837 if (_closeContour==true)
839 _cntSplineX->ClosedOn();
840 _cntSplineY->ClosedOn();
841 _cntSplineZ->ClosedOn();
843 _cntSplineX->ClosedOff();
844 _cntSplineY->ClosedOff();
845 _cntSplineZ->ClosedOff();
849 // ----------------------------------------------------------------------------
850 bool manualContourModel::IfCloseContour()
852 return _closeContour;
855 // ----------------------------------------------------------------------------
857 void manualContourModel::UpdateSpline() // virtual
860 np = _lstPoints.size();
862 _cntSplineX->RemoveAllPoints();
863 _cntSplineY->RemoveAllPoints();
864 _cntSplineZ->RemoveAllPoints();
865 for( i = 0; i < np; i++ ) {
866 mp = GetManualPoint(i);
867 _cntSplineX->AddPoint( i, mp->GetX() );
868 _cntSplineY->AddPoint( i, mp->GetY() );
869 _cntSplineZ->AddPoint( i, mp->GetZ() );
872 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
873 if (this->_closeContour==true)
875 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
877 // _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
878 _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close
880 //-----------------------------------------------------------------------------------------------------------
883 //---------------------------------------------------------------------------------
885 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
887 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
888 double t = delta*(double)i;
889 GetSplinePoint(t, x, y, z);
892 //-----------------------------------------------------------------------------
894 //JSTG 25-02-08 ---------------------------------------------------------------
895 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
897 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
900 // ----------------------------------------------------------------------------
902 //JSTG 25-02-08 ---------------------------------------------------------------
903 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
905 if (_lstPoints.size()==0)
911 if (_lstPoints.size()==1)
914 mp = GetManualPoint(0);
919 if (_lstPoints.size()>=2)
921 *x = _cntSplineX->Evaluate(t);
922 *y = _cntSplineY->Evaluate(t);
923 *z = _cntSplineZ->Evaluate(t);
927 // ----------------------------------------------------------------------------
930 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
932 if (_lstPoints.size()==0)
938 if (_lstPoints.size()==1)
941 mp = GetManualPoint(0);
946 if (_lstPoints.size()>=2)
948 x = _cntSplineX->Evaluate(t);
949 y = _cntSplineY->Evaluate(t);
950 z = _cntSplineZ->Evaluate(t);
953 // ----------------------------------------------------------------------------
954 double manualContourModel::GetPathSize()
960 // JSTG 25-02-08 -----------------------------
964 //--------------------------------------------
966 if (_lstPoints.size()==2)
968 x1=_lstPoints[0]->GetX();
969 y1=_lstPoints[0]->GetY();
970 z1=_lstPoints[0]->GetZ();
971 x2=_lstPoints[1]->GetX();
972 y2=_lstPoints[1]->GetY();
973 z2=_lstPoints[1]->GetZ();
974 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
976 if (_lstPoints.size()>2)
979 // JSTG 25-02-08 ------------------------------------------
980 //np = _lstPoints.size( );
982 //delta=( double ) ( np ) / ( double ) ( nps );
984 //GetSplinePoint(0,x1,y1,z1);
985 GetSpline_i_Point(0,&x1,&y1,&z1);
987 //for( i = 1; i < nps; i++ )
988 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
990 //t = delta * (double)i;
991 //GetSplinePoint(t,x2,y2,z2);
992 GetSpline_i_Point(i,&x2,&y2,&z2);
993 //---------------------------------------------------------
994 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
1003 // ----------------------------------------------------------------------------
1004 double manualContourModel::GetPathArea()
1006 double result = 555;
1007 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1010 //JSTG 25-02-08 ---------------------------------------------
1012 //-----------------------------------------------------------
1018 // This uses Green's theorem:
1019 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1020 // A < 0 -> A = |A| (a negative value could raise because points are
1021 // given in clockwise order).
1023 //JSTG 25-02-08 -------------------------------------------------
1024 //int np = _lstPoints.size( );
1026 int nps = GetNumberOfPointsSpline();
1027 //double delta=( double ) ( np ) / ( double ) ( nps );
1029 for( i = 0, area = 0.0; i < nps; i++ )
1031 j = ( i + 1 ) % nps;
1032 //ti = delta * (double)i;
1033 //tj = delta * (double)j;
1034 //GetSplinePoint(ti,x1,y1,z1);
1035 //GetSplinePoint(tj,x2,y2,z2);
1036 GetSpline_i_Point(i,&x1,&y1,&z1);
1037 GetSpline_i_Point(j,&x2,&y2,&z2);
1038 //----------------------------------------------------------------
1048 area = fabs( area );
1051 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1053 j = ( i + 1 ) % _lstPoints.size();
1056 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1057 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1058 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1064 area = fabs( area );
1080 // ----------------------------------------------------------------------------
1081 // p[x,y,z] : data in
1082 // rp[x,y,z] : data out result point
1083 // rn[x,y,z] : data out result normal
1085 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1087 double distMin=999999999;
1088 double dist,dx,dy,dz;
1093 //JSTG 25-02-08 -------------------
1097 //---------------------------------
1099 np = _lstPoints.size( );
1102 // JSTG 25-02-08 ------------------------------------------
1104 nps = GetNumberOfPointsSpline();
1105 //delta = ( double ) ( np ) / ( double ) ( nps );
1107 //GetSplinePoint(0,x1,y1,z1);
1108 GetSpline_i_Point(0,&x1,&y1,&z1);
1109 for( i = 0; i < nps; i++ )
1111 //t = delta * (double)i;
1112 //GetSplinePoint(t,x1,y1,z1);
1113 GetSpline_i_Point(i,&x1,&y1,&z1);
1114 //----------------------------------------------------------
1118 dist = sqrt( dx*dx + dy*dy + dz*dz );
1136 // JSTG 25-02-08 ------------------------------------------
1140 //t = delta * (double)1.0;
1141 //GetSplinePoint(t,x1,y1,z1);
1142 GetSpline_i_Point(i,&x1,&y1,&z1);
1143 //----------------------------------------------------------
1160 // ----------------------------------------------------------------------------
1161 manualContourModel * manualContourModel :: Clone() // virtual
1163 manualContourModel * clone = new manualContourModel();
1164 CopyAttributesTo(clone);
1168 // ----------------------------------------------------------------------------
1169 void manualContourModel::Open(FILE *ff) // virtual
1173 int numberOfControlPoints;
1176 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1177 fscanf(ff,"%s",tmp); // ##
1178 numberOfControlPoints = atoi(tmp);
1179 for (i=0;i<numberOfControlPoints;i++)
1181 fscanf(ff,"%s",tmp); // X
1183 fscanf(ff,"%s",tmp); // Y
1185 fscanf(ff,"%s",tmp); // Z
1192 // ----------------------------------------------------------------------------
1193 int manualContourModel::GetTypeModel() //virtual
1205 // ----------------------------------------------------------------------------
1206 void manualContourModel::Save(FILE *ff) // virtual
1208 int i,size=_lstPoints.size();
1209 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1210 fprintf(ff,"NumberOfControlPoints %d\n",size);
1211 for (i=0;i<size;i++)
1213 manualPoint *mp=_lstPoints[i];
1214 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1219 // ---------------------------------------------------------------------------
1221 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1224 //XXXX::CopyAttributesTo(cloneObject);
1226 cloneObject->SetCloseContour( this->IfCloseContour() );
1227 int i, size = GetSizeLstPoints();
1228 for( i=0; i<size; i++ )
1230 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1232 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1233 cloneObject->SetCloseContour( _closeContour );
1234 cloneObject->UpdateSpline();
1238 // ---------------------------------------------------------------------------
1239 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1241 _lstPoints.push_back( theManualPoint );
1244 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1246 std::vector<manualContourModel*> lstTmp;
1247 lstTmp.push_back(this);
1252 // ---------------------------------------------------------------------------
1253 // ----------------------------------------------------------------------------
1254 // ----------------------------------------------------------------------------
1256 //int manualViewPoint::range=1;
1259 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1261 _posibleSelected = false;
1264 _pointVtkActor = NULL;
1266 _wxvtkbaseview = wxvtkbaseview;
1274 // ----------------------------------------------------------------------------
1275 manualViewPoint::~manualViewPoint(){
1279 // ----------------------------------------------------------------------------
1280 void manualViewPoint::SetWidthLine( double width)
1285 // ----------------------------------------------------------------------------
1286 void manualViewPoint::SetSelected(bool selected){
1289 // ----------------------------------------------------------------------------
1290 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1291 _posibleSelected=posibleSelected;
1293 // ----------------------------------------------------------------------------
1294 bool manualViewPoint::GetSelected(){
1297 // ----------------------------------------------------------------------------
1298 bool manualViewPoint::GetPosibleSelected(){
1299 return _posibleSelected;
1301 // ----------------------------------------------------------------------------
1302 void manualViewPoint::DeleteVtkObjects(){
1303 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1304 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1305 if (_pts !=NULL) { _pts ->Delete(); }
1306 if (_pd !=NULL) { _pd ->Delete(); }
1307 _pointVtkActor = NULL;
1315 // ----------------------------------------------------------------------------
1316 vtkActor* manualViewPoint::CreateVtkPointActor()
1320 _pts = vtkPoints::New();
1321 _pts->SetNumberOfPoints(8);
1323 _pts->SetPoint(0, -1000 , -1000 , 0 );
1324 _pts->SetPoint(1, 1000 , -1000 , 0 );
1325 _pts->SetPoint(2, 1000 , 1000 , 0 );
1326 _pts->SetPoint(3, -1000 , 1000 , 0 );
1327 _pts->SetPoint(4, -1000 , 1000 , 0 );
1328 _pts->SetPoint(5, -1000 , 1000 , 0 );
1329 _pts->SetPoint(6, -1000 , 1000 , 0 );
1330 _pts->SetPoint(7, -1000 , 1000 , 0 );
1332 vtkCellArray *lines = vtkCellArray::New();
1333 lines->InsertNextCell(17);
1334 lines->InsertCellPoint(0);
1335 lines->InsertCellPoint(1);
1336 lines->InsertCellPoint(2);
1337 lines->InsertCellPoint(3);
1338 lines->InsertCellPoint(0);
1339 lines->InsertCellPoint(4);
1340 lines->InsertCellPoint(5);
1341 lines->InsertCellPoint(6);
1342 lines->InsertCellPoint(7);
1343 lines->InsertCellPoint(4);
1344 lines->InsertCellPoint(0);
1345 lines->InsertCellPoint(3);
1346 lines->InsertCellPoint(7);
1347 lines->InsertCellPoint(6);
1348 lines->InsertCellPoint(2);
1349 lines->InsertCellPoint(1);
1350 lines->InsertCellPoint(5);
1352 _pd = vtkPolyData::New();
1353 _pd->SetPoints( _pts );
1354 _pd->SetLines( lines );
1355 // lines->Delete(); //do not delete lines ??
1357 _pointVtkActor = vtkActor::New();
1358 _bboxMapper = vtkPolyDataMapper::New();
1360 _bboxMapper->SetInput(_pd);
1361 // _bboxMapper->ImmediateModeRenderingOn();
1362 _pointVtkActor->SetMapper(_bboxMapper);
1363 // _pointVtkActor->GetProperty()->BackfaceCullingOn();
1365 // _pd->ComputeBounds();
1367 return _pointVtkActor;
1369 // ----------------------------------------------------------------------------
1370 vtkActor* manualViewPoint::GetVtkActor(){
1371 return _pointVtkActor;
1373 // ----------------------------------------------------------------------------
1374 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1376 // double range=0.2; // i_range;
1377 // double range=(double)manualViewPoint::range;
1379 double range=i_range;
1384 posZ = posZ * _spc[2];
1387 _pts->SetPoint(0, x-range, y+range, posZ-range);
1388 _pts->SetPoint(1, x+range, y+range, posZ-range);
1389 _pts->SetPoint(2, x+range, y-range, posZ-range);
1390 _pts->SetPoint(3, x-range, y-range, posZ-range);
1391 _pts->SetPoint(4, x-range, y+range, posZ+range);
1392 _pts->SetPoint(5, x+range, y+range, posZ+range);
1393 _pts->SetPoint(6, x+range, y-range, posZ+range);
1394 _pts->SetPoint(7, x-range, y-range, posZ+range);
1399 // ----------------------------------------------------------------------------
1400 void manualViewPoint::UpdateColorActor()
1402 if (_pointVtkActor!=NULL){
1404 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1405 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1406 if (_posibleSelected==true){
1407 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1411 // ----------------------------------------------------------------------------
1412 void manualViewPoint::GetSpacing(double spc[3])
1418 // ----------------------------------------------------------------------------
1419 void manualViewPoint::SetSpacing(double spc[3])
1428 // ----------------------------------------------------------------------------
1429 // ----------------------------------------------------------------------------
1430 // ----------------------------------------------------------------------------
1432 manualViewContour::manualViewContour()
1434 _id_viewPoint_for_text = 0;
1436 _initialConoturModel = new manualContourModel();
1438 // ----------------------------------------------------------------------------
1439 manualViewContour::~manualViewContour()
1441 delete _initialConoturModel;
1443 // ----------------------------------------------------------------------------
1445 // ----------------------------------------------------------------------------
1446 manualViewContour * manualViewContour :: Clone()
1448 manualViewContour * clone = new manualViewContour();
1449 CopyAttributesTo(clone);
1453 // ---------------------------------------------------------------------------
1455 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1457 // Call to Fathers object
1458 manualViewBaseContour::CopyAttributesTo(cloneObject);
1460 cloneObject->SetMesureScale(_mesureScale);
1463 // ---------------------------------------------------------------------------
1465 int manualViewContour::GetType() // virtual
1470 // ----------------------------------------------------------------------------
1472 void manualViewContour::Save(FILE *pFile)
1474 manualViewBaseContour::Save(pFile);
1477 // ----------------------------------------------------------------------------
1479 void manualViewContour::Open(FILE *pFile)
1485 // ----------------------------------------------------------------------------
1486 void manualViewContour::RefreshContour() // virtual
1491 //JSTG 25-02-08 --------------------
1492 //double t,delta, x,y,z;
1494 //----------------------------------
1496 _manContModel->UpdateSpline();
1497 np = GetNumberOfPoints( );
1498 //nps = GetNumberOfPointsSpline();
1499 nps = _manContModel->GetNumberOfPointsSpline();
1500 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1507 for( i = 0; i < nps; i++ )
1509 //JSTG 25-02-08 ------------------------------------------------
1510 //t = delta * (double)i;
1511 //_manContModel->GetSplinePoint(t,x,y,z);
1512 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1513 //--------------------------------------------------------------
1515 // _pts->SetPoint(i, x,y,z );
1516 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1523 _pts->SetPoint(0, 0 , 0 , 0);
1524 _pts->SetPoint(1, 0 , 0 , 0);
1529 // ----------------------------------------------------------------------------
1530 void manualViewContour::RefreshText() // virtual
1532 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1533 int size = GetNumberOfPoints();
1535 char resultText[50];
1536 strcpy(resultText," ");
1539 strcpy(resultText,"L= ");
1540 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1541 strcat(resultText,text);
1545 if (_manContModel->IfCloseContour()==true)
1547 strcpy(resultText,"P= ");
1548 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1549 strcat(resultText,text);
1550 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1551 strcat(resultText," A= ");
1552 strcat(resultText,text);
1554 strcpy(resultText,"L= ");
1555 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1556 strcat(resultText,text);
1560 _textActor->SetInput(resultText);
1565 for (i=0; i<size; i++)
1567 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1569 _id_viewPoint_for_text = i;
1573 int id = _id_viewPoint_for_text;
1574 double px = _manContModel->GetManualPoint(id)->GetX();
1575 double py = _manContModel->GetManualPoint(id)->GetY();
1581 _textActor->SetPosition(px+GetRange()+1,py);
1587 // ----------------------------------------------------------------------------
1588 bool manualViewContour::ifTouchContour(int x,int y,int z){
1596 TransfromeCoordViewWorld(xx,yy,zz);
1603 unsigned int i, nps,nps_t;
1604 nps = _sizePointsContour;
1606 if (this->_manContModel->IfCloseContour()==true)
1614 for( i = 0; i < nps_t; i++ )
1616 _pts->GetPoint(i%nps, ppA);
1617 _pts->GetPoint((i+1)%nps, ppB);
1618 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1619 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1620 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]));
1623 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1633 // ----------------------------------------------------------------------------
1634 void manualViewContour::DeletePoint(int id) // virtual
1636 if (_lstViewPoints.size()>2)
1638 manualViewBaseContour::DeletePoint( id );
1641 // ----------------------------------------------------------------------------
1643 void manualViewContour::ClearPoint(int id)
1645 manualViewBaseContour::DeletePoint( id );
1648 //-------------------------------------------------------------------
1649 void manualViewContour::SetMesureScale(double mesureScale)
1651 _mesureScale = mesureScale;
1653 //-------------------------------------------------------------------
1654 void manualViewContour::InitMove(int x, int y, int z)
1656 _initialConoturModel->DeleteAllPoints();
1658 manualPoint *mp = NULL;
1662 TransfromeCoordViewWorld(XX,YY,ZZ);
1664 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1665 for ( i=0; i<manualPointsSZ; i++ )
1667 mp = _manContModel->GetManualPoint( i );
1668 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1671 //-------------------------------------------------------------------
1672 void manualViewContour::MoveContour(int x, int y, int z)
1674 manualPoint *mpOrigin = NULL;
1675 manualPoint *mpMoving = NULL;
1680 TransfromeCoordViewWorld(XX,YY,ZZ);
1682 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1683 for ( i=0; i<manualPointsSZ; i++ )
1685 mpOrigin = _manContModel->GetManualPoint( i );
1686 mpMoving = _initialConoturModel->GetManualPoint(i);
1687 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1691 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1693 manualPoint *mpOrigin = NULL;
1695 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1696 for ( i=0; i<manualPointsSZ; i++ )
1698 mpOrigin = _manContModel->GetManualPoint( i );
1699 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1703 // ----------------------------------------------------------------------------
1704 // ----------------------------------------------------------------------------
1705 // ----------------------------------------------------------------------------
1708 manualView3VContour::manualView3VContour(int type)
1711 // JSTG 25-02-08 ------------------------------
1712 //_manContModel= new manualContourModel();
1713 //---------------------------------------------
1715 // ----------------------------------------------------------------------------
1716 manualView3VContour::~manualView3VContour()
1722 // ----------------------------------------------------------------------------
1723 manualView3VContour * manualView3VContour :: Clone()
1725 manualView3VContour * clone = new manualView3VContour( GetType() );
1726 CopyAttributesTo(clone);
1730 // ---------------------------------------------------------------------------
1732 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1735 manualViewContour::CopyAttributesTo(cloneObject);
1738 int manualView3VContour::GetType()
1743 // ----------------------------------------------------------------------------
1744 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1759 // ----------------------------------------------------------------------------
1761 void manualView3VContour::RefreshContour() // virtula
1763 manualViewContour::RefreshContour();
1766 // JSTG 25-02-08 ----------------------------------------
1767 //int nps = GetNumberOfPointsSpline();
1768 int nps = _manContModel->GetNumberOfPointsSpline();
1769 //-------------------------------------------------------
1770 for( i = 0; i < nps; i++ )
1772 _pts->GetPoint( i, pp );
1773 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1776 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1781 // ----------------------------------------------------------------------------
1783 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1785 manualPoint *mp = _manContModel->GetManualPoint(id);
1790 FilterCordinateXYZ(x,y,z);
1791 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1794 // ----------------------------------------------------------------------------
1796 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1799 if (_manContModel!=NULL){
1803 TransfromeCoordViewWorld(xx,yy,zz,-1);
1804 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1809 // ----------------------------------------------------------------------------
1810 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1818 TransfromeCoordViewWorld(xx,yy,zz,-1);
1825 unsigned int i, nps,nps_t;
1826 nps = _sizePointsContour;
1827 if (this->_manContModel->IfCloseContour()==true)
1833 FilterCordinateXYZ(xx,yy,zz);
1835 for( i = 0; i < nps_t; i++ ) {
1836 _pts->GetPoint(i%nps, ppA);
1837 _pts->GetPoint((i+1)%nps, ppB);
1838 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1839 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1840 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1841 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1842 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]));
1843 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1850 // ----------------------------------------------------------------------------
1851 // ----------------------------------------------------------------------------
1852 // ----------------------------------------------------------------------------
1853 manualView3DContour::manualView3DContour()
1856 // ----------------------------------------------------------------------------
1857 manualView3DContour::~manualView3DContour()
1861 // ----------------------------------------------------------------------------
1862 manualView3DContour * manualView3DContour :: Clone()
1864 manualView3DContour * clone = new manualView3DContour();
1865 CopyAttributesTo(clone);
1869 // ---------------------------------------------------------------------------
1870 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1873 manualViewContour::CopyAttributesTo(cloneObject);
1875 cloneObject->SetDimensions ( _w , _h , _d );
1877 // ----------------------------------------------------------------------------
1878 void manualView3DContour::SetDimensions(int w, int h, int d)
1884 // ----------------------------------------------------------------------------
1885 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1887 X = _vtkmprbasedata->GetX();
1888 Y = _vtkmprbasedata->GetY();
1889 Z = _vtkmprbasedata->GetZ();
1891 // ----------------------------------------------------------------------------
1892 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1894 _vtkmprbasedata = vtkmprbasedata;
1896 // ----------------------------------------------------------------------------
1897 int manualView3DContour::GetIdPoint2(int x, int y)
1900 double p[3],pA[3],pB[3];
1902 double pickPoint[ 3 ], cameraPos[ 3 ];
1903 vtkPointPicker* picker = vtkPointPicker::New( );
1904 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1905 picker->Pick( x, y, 0.0, pRenderer );
1906 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1907 picker->GetPickPosition( pickPoint );
1910 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1911 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1913 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1915 double dist,distMin=999999999;
1916 int i,size=this->_manContModel->GetSizeLstPoints();
1917 for (i=0;i<size;i++)
1919 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1923 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1924 if ( (dist<=2*GetRange()) && (dist<distMin) )
1933 // ----------------------------------------------------------------------------
1934 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1936 SelectAllPossibleSelected(false);
1937 int id=GetIdPoint2(x,y);
1940 SetPointPosibleSelected(id,true);
1948 // ----------------------------------------------------------------------------
1949 // ----------------------------------------------------------------------------
1950 // ----------------------------------------------------------------------------
1955 // ----------------------------------------------------------------------------
1956 // ----------------------------------------------------------------------------
1957 // ----------------------------------------------------------------------------
1958 manualViewBullEyeSector::manualViewBullEyeSector()
1962 // ----------------------------------------------------------------------------
1963 void manualViewBullEyeSector::RefreshContour()
1968 //----------------------------------
1970 _manContModel->UpdateSpline();
1971 nps = _manContModel->GetNumberOfPointsSpline();
1975 for( i = 0; i < nps; i++ )
1977 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1978 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1984 // ----------------------------------------------------------------------------
1985 // ----------------------------------------------------------------------------
1986 // ----------------------------------------------------------------------------
1989 manualViewBullEye::manualViewBullEye()
1993 // ----------------------------------------------------------------------------
1994 manualViewBullEye::~manualViewBullEye()
1997 int i,size=lstSectorBullEye.size();
1998 for (i=0;i<size;i++)
2000 delete lstSectorBullEye[i];
2002 lstSectorBullEye.clear();
2006 // ----------------------------------------------------------------------------
2007 manualViewBullEye * manualViewBullEye :: Clone()
2009 manualViewBullEye * clone = new manualViewBullEye();
2010 CopyAttributesTo(clone);
2014 // ---------------------------------------------------------------------------
2016 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2019 manualViewBaseContour::CopyAttributesTo(cloneObject);
2023 // ----------------------------------------------------------------------------
2024 int manualViewBullEye::GetType() // virtual
2030 // ----------------------------------------------------------------------------
2031 void manualViewBullEye::RefreshContour() // virtual
2033 // External Rectangle
2034 manualViewRoi::RefreshContour();
2036 _manContModel->UpdateSpline();
2037 int np = GetNumberOfPoints( );
2038 // Refres sectors of BullEye(s)
2042 int i,size = lstSectorBullEye.size();
2043 for (i=0;i<size;i++)
2045 lstSectorBullEye[i]->RefreshContour();
2052 // ----------------------------------------------------------------------------
2053 void manualViewBullEye::ConstructVTKObjects() // virtual
2055 manualViewRoi::ConstructVTKObjects();
2058 this->GetSpacing(spc);
2059 manualViewBullEyeSector *mvbc;
2060 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2061 int i,size = mcmbe->GetSizeOfSectorLst();
2062 for ( i=0 ; i<size ; i++ )
2064 mvbc = new manualViewBullEyeSector();
2065 mvbc->SetModel( mcmbe->GetModelSector(i) );
2066 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2067 mvbc->SetRange( 2 );
2069 mvbc->SetSpacing(spc);
2070 mvbc->SetColorNormalContour(1, 0, 0);
2071 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2072 // mvbc->SetColorSelectContour(1, 0.8, 0);
2073 mvbc->SetWidthLine( this->GetWidthLine() );
2075 mvbc->ConstructVTKObjects();
2076 lstSectorBullEye.push_back( mvbc );
2082 // ----------------------------------------------------------------------------
2083 void manualViewBullEye::AddSplineActor() // virtual
2085 manualViewRoi::AddSplineActor();
2086 int i,size=lstSectorBullEye.size();
2087 for (i=0;i<size;i++)
2089 lstSectorBullEye[i]->AddSplineActor();
2093 // ----------------------------------------------------------------------------
2094 void manualViewBullEye::RemoveSplineActor() // virtual
2096 manualViewRoi::RemoveSplineActor();
2097 int i,size=lstSectorBullEye.size();
2098 for (i=0;i<size;i++)
2100 lstSectorBullEye[i]->RemoveSplineActor();
2105 // ----------------------------------------------------------------------------
2106 // ----------------------------------------------------------------------------
2107 // ----------------------------------------------------------------------------
2109 manualViewRoi::manualViewRoi()
2111 _sizePointsContour=5;
2113 // ----------------------------------------------------------------------------
2114 manualViewRoi::~manualViewRoi()
2119 // ----------------------------------------------------------------------------
2120 manualViewRoi * manualViewRoi :: Clone()
2122 manualViewRoi * clone = new manualViewRoi();
2123 CopyAttributesTo(clone);
2127 // ---------------------------------------------------------------------------
2129 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2132 manualViewBaseContour::CopyAttributesTo(cloneObject);
2135 // ----------------------------------------------------------------------------
2136 void manualViewRoi::RefreshContour() // virtual
2138 unsigned int i,ii, np;
2139 np = GetNumberOfPoints( );
2146 for( i = 0; i < np+1; i++ ) {
2148 mp = _manContModel->GetManualPoint(ii);
2151 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2152 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2153 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2156 // _pts->SetPoint(i, XX,YY,ZZ );
2157 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2161 _pts->SetPoint(0, 0 , 0 , 0);
2162 _pts->SetPoint(1, 0 , 0 , 0);
2167 // ----------------------------------------------------------------------------
2168 int manualViewRoi::GetType() // virtual
2173 // ----------------------------------------------------------------------------
2175 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2186 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2188 for( i = 0; i < size; i++ )
2191 mp=_manContModel->GetManualPoint(i);
2226 // ----------------------------------------------------------------------------
2229 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2232 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2234 GetMinMax(px1,py1, px2, py2);
2239 TransfromeCoordViewWorld(xx,yy,zz);
2243 double ddx=GetRange();
2244 double ddy=GetRange();
2246 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2251 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2256 if ((ok1==true) && (ok2==false))
2264 // ----------------------------------------------------------------------------
2266 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2272 TransfromeCoordViewWorld(XX,YY,ZZ);
2274 if (_manContModel->GetSizeLstPoints()==4){
2275 mp = _manContModel->GetManualPoint(0);
2276 _dp0[0]= mp->GetX() - XX;
2277 _dp0[1]= mp->GetY() - YY;
2278 _dp0[2]= mp->GetZ();
2280 mp = _manContModel->GetManualPoint(1);
2281 _dp1[0]= mp->GetX() - XX;
2282 _dp1[1]= mp->GetY() - YY;
2283 _dp1[2]= mp->GetZ();
2285 mp = _manContModel->GetManualPoint(2);
2286 _dp2[0]= mp->GetX() - XX;
2287 _dp2[1]= mp->GetY() - YY;
2288 _dp2[2]= mp->GetZ();
2290 mp = _manContModel->GetManualPoint(3);
2291 _dp3[0]= mp->GetX() - XX;
2292 _dp3[1]= mp->GetY() - YY;
2293 _dp3[2]= mp->GetZ();
2297 // ----------------------------------------------------------------------------
2299 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2305 TransfromeCoordViewWorld(XX,YY,ZZ);
2307 mp = _manContModel->GetManualPoint(0);
2308 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2310 mp = _manContModel->GetManualPoint(1);
2311 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2313 mp = _manContModel->GetManualPoint(2);
2314 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2316 mp = _manContModel->GetManualPoint(3);
2317 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2328 // ----------------------------------------------------------------------------
2329 // ----------------------------------------------------------------------------
2330 // ----------------------------------------------------------------------------
2334 manualViewCircle::manualViewCircle()
2336 // _sizePointsContour=5; // default 100
2338 // ----------------------------------------------------------------------------
2339 manualViewCircle::~manualViewCircle()
2344 // ----------------------------------------------------------------------------
2345 manualViewCircle * manualViewCircle :: Clone()
2347 manualViewCircle * clone = new manualViewCircle();
2348 CopyAttributesTo(clone);
2352 // ---------------------------------------------------------------------------
2354 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2357 manualViewBaseContour::CopyAttributesTo(cloneObject);
2361 // ----------------------------------------------------------------------------
2363 void manualViewCircle::RefreshContour(){ // virtual
2365 manualPoint *mpA,*mpB;
2366 unsigned int i, np,nps;
2370 np = GetNumberOfPoints( );
2371 nps = _manContModel->GetNumberOfPointsSpline();
2372 double deltaAngle=(3.14159265*2)/(nps-1);
2377 mpA = _manContModel->GetManualPoint(0);
2378 mpB = _manContModel->GetManualPoint(1);
2379 difX = mpA->GetX() - mpB->GetX();
2380 difY = mpA->GetY() - mpB->GetY();
2381 radio = sqrt( difX*difX + difY*difY );
2382 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2383 manContModelCir->SetRadio(radio);
2385 for( i = 0; i < nps; i++ ) {
2386 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2387 // angle = deltaAngle*i;
2388 // XX = cos(angle)*radio+mpA->GetX();
2389 // YY = sin(angle)*radio+mpA->GetY();
2391 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2394 _pts->SetPoint(0, 0 , 0 , 0);
2395 _pts->SetPoint(1, 0 , 0 , 0);
2401 // ----------------------------------------------------------------------------
2402 int manualViewCircle::GetType() // virtual
2407 // ----------------------------------------------------------------------------
2409 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2411 manualPoint *mpA,*mpB;
2415 np = GetNumberOfPoints( );
2418 mpA = _manContModel->GetManualPoint(0);
2419 mpB = _manContModel->GetManualPoint(1);
2420 difX = mpA->GetX() - mpB->GetX();
2421 difY = mpA->GetY() - mpB->GetY();
2422 radio = sqrt( difX*difX + difY*difY );
2423 minX=mpA->GetX()-radio;
2424 minY=mpA->GetY()-radio;
2425 maxX=mpA->GetX()+radio;
2426 maxY=mpA->GetY()+radio;
2436 // ----------------------------------------------------------------------------
2437 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2440 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2442 GetMinMax(px1,py1, px2, py2);
2447 TransfromeCoordViewWorld(xx,yy,zz);
2451 double ddx=GetRange();
2452 double ddy=GetRange();
2454 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2459 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2464 if ((ok1==true) && (ok2==false))
2473 // ----------------------------------------------------------------------------
2475 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2481 TransfromeCoordViewWorld(XX,YY,ZZ);
2483 if (_manContModel->GetSizeLstPoints()==2){
2484 mp = _manContModel->GetManualPoint(0);
2485 _dp0[0]= mp->GetX() - XX;
2486 _dp0[1]= mp->GetY() - YY;
2487 _dp0[2]= mp->GetZ();
2489 mp = _manContModel->GetManualPoint(1);
2490 _dp1[0]= mp->GetX() - XX;
2491 _dp1[1]= mp->GetY() - YY;
2492 _dp1[2]= mp->GetZ();
2494 mp = _manContModel->GetManualPoint(2);
2495 _dp2[0]= mp->GetX() - XX;
2496 _dp2[1]= mp->GetY() - YY;
2497 _dp2[2]= mp->GetZ();
2499 mp = _manContModel->GetManualPoint(3);
2500 _dp3[0]= mp->GetX() - XX;
2501 _dp3[1]= mp->GetY() - YY;
2502 _dp3[2]= mp->GetZ();
2508 // ----------------------------------------------------------------------------
2509 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2515 TransfromeCoordViewWorld(XX,YY,ZZ);
2517 mp = _manContModel->GetManualPoint(0);
2518 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2520 mp = _manContModel->GetManualPoint(1);
2521 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2523 // mp = _manContModel->GetManualPoint(2);
2524 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2526 // mp = _manContModel->GetManualPoint(3);
2527 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2531 // UpdateViewPoint(2);
2532 // UpdateViewPoint(3);
2538 // ----------------------------------------------------------------------------
2539 // ----------------------------------------------------------------------------
2540 // ----------------------------------------------------------------------------
2544 manualViewLine::manualViewLine()
2546 _sizePointsContour=20;
2548 // ----------------------------------------------------------------------------
2549 manualViewLine::~manualViewLine()
2554 // ----------------------------------------------------------------------------
2555 manualViewLine * manualViewLine :: Clone()
2557 manualViewLine * clone = new manualViewLine();
2558 CopyAttributesTo(clone);
2562 // ---------------------------------------------------------------------------
2564 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2567 manualViewBaseContour::CopyAttributesTo(cloneObject);
2570 // ----------------------------------------------------------------------------
2571 int manualViewLine::GetType() // virtual
2577 // ----------------------------------------------------------------------------
2579 void manualViewLine::InitMove(int x, int y, int z) // virtual
2585 TransfromeCoordViewWorld(XX,YY,ZZ);
2587 if (_manContModel->GetSizeLstPoints()==2)
2589 mp = _manContModel->GetManualPoint(0);
2590 _dp0[0]= mp->GetX() - XX;
2591 _dp0[1]= mp->GetY() - YY;
2592 _dp0[2]= mp->GetZ();
2594 mp = _manContModel->GetManualPoint(1);
2595 _dp1[0]= mp->GetX() - XX;
2596 _dp1[1]= mp->GetY() - YY;
2597 _dp1[2]= mp->GetZ();
2603 // ----------------------------------------------------------------------------
2604 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2610 TransfromeCoordViewWorld(XX,YY,ZZ);
2612 mp = _manContModel->GetManualPoint(0);
2613 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2615 mp = _manContModel->GetManualPoint(1);
2616 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2624 // ----------------------------------------------------------------------------
2625 // ----------------------------------------------------------------------------
2626 // ----------------------------------------------------------------------------
2629 manualViewBaseContour::manualViewBaseContour()
2633 _manContModel = NULL;
2634 _wxvtkbaseview = NULL;
2636 _posibleSelected = false;
2637 _viewControlPoints = false;
2640 _contourVtkActor = NULL;
2643 _sizePointsContour = 100;
2652 _coulorNormal_r = 1;
2653 _coulorNormal_g = 0;
2654 _coulorNormal_b = 1;
2656 _coulorSelection_r = 0;
2657 _coulorSelection_g = 1;
2658 _coulorSelection_b = 0;
2663 // ----------------------------------------------------------------------------
2664 manualViewBaseContour::~manualViewBaseContour()
2666 int i,size=_lstViewPoints.size();
2667 for (i=0;i<size; i++){
2668 delete _lstViewPoints[i];
2670 _lstViewPoints.clear();
2672 // ----------------------------------------------------------------------------
2675 int manualViewBaseContour::GetType() // virtual
2678 //int manualViewBaseContour::GetType() 0;
2679 //int manualViewContour::GetType() 1;
2680 //int manualViewRoi::GetType() 2;
2681 //int manualViewCircle::GetType() 3;
2682 //int manualViewStar::GetType() 4;
2683 //int manualViewLine::GetType() 6;
2688 // ----------------------------------------------------------------------------
2690 void manualViewBaseContour::Save(FILE *pFile)
2692 fprintf(pFile,"TypeView %d\n", GetType() );
2695 // ----------------------------------------------------------------------------
2696 void manualViewBaseContour::Open(FILE *pFile)
2700 // ----------------------------------------------------------------------------
2701 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2703 _viewControlPoints = ifControlPoints;
2704 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2709 //Adding each control point
2710 if( ifControlPoints )
2715 // ---------------------------------------------------------------------------
2717 void manualViewBaseContour :: RemoveCompleteContourActor()
2719 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2720 //Removing the spline
2721 RemoveSplineActor();
2724 //Removing each point
2725 RemoveControlPoints();
2729 // ---------------------------------------------------------------------------
2730 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2732 manualViewBaseContour * clone = new manualViewBaseContour();
2733 CopyAttributesTo(clone);
2738 // ---------------------------------------------------------------------------
2740 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2743 //XXXX::CopyAttributesTo(cloneObject);
2745 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2746 cloneObject-> SetSelected( this->GetSelected() );
2747 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2748 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2749 cloneObject-> SetRange( this->GetRange() );
2750 cloneObject-> SetZ( this->GetZ() );
2751 cloneObject-> SetSpacing( _spc );
2752 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2753 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2754 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2756 int i, size = _lstViewPoints.size();
2757 for ( i=0; i<size; i++ )
2759 cloneObject->AddPoint( );
2763 // ----------------------------------------------------------------------------
2764 void manualViewBaseContour :: AddSplineActor()
2766 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2767 if (_contourVtkActor!=NULL)
2768 theRenderer->AddActor( _contourVtkActor );
2770 // ----------------------------------------------------------------------------
2771 void manualViewBaseContour :: RemoveSplineActor() // virtual
2773 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2774 if (_contourVtkActor!=NULL)
2775 theRenderer->RemoveActor( _contourVtkActor );
2777 // ----------------------------------------------------------------------------
2778 void manualViewBaseContour :: RemoveControlPoints()
2780 if (_wxvtkbaseview!=NULL){
2781 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2782 int i,size=_lstViewPoints.size();
2783 for (i=0;i<size; i++)
2785 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2786 theRenderer->RemoveActor( pointActor );
2789 SetIfViewControlPoints( false );
2791 // ----------------------------------------------------------------------------
2792 void manualViewBaseContour::AddControlPoints()
2794 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2795 SetIfViewControlPoints( true );
2796 if( _viewControlPoints )
2798 int i,size=_lstViewPoints.size();
2799 for (i=0;i<size; i++)
2801 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2802 theRenderer->AddActor( pointActor );
2806 // ----------------------------------------------------------------------------
2807 void manualViewBaseContour::AddTextActor()
2809 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2811 // ----------------------------------------------------------------------------
2812 void manualViewBaseContour::RemoveTextActor()
2814 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2816 // ----------------------------------------------------------------------------
2817 void manualViewBaseContour::DeleteVtkObjects()
2819 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2820 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2821 if ( _pts != NULL ) { _pts -> Delete(); }
2822 if ( _pd != NULL ) { _pd -> Delete(); }
2823 _contourVtkActor = NULL;
2830 // ----------------------------------------------------------------------------
2831 void manualViewBaseContour::SetWidthLine(double width)
2834 this->UpdateColorActor();
2836 // for the control points
2837 int id, size = _lstViewPoints.size();
2838 for( id=0; id<size; id++)
2840 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2845 // ----------------------------------------------------------------------------
2846 double manualViewBaseContour::GetWidthLine()
2851 // ----------------------------------------------------------------------------
2852 void manualViewBaseContour::ConstructVTKObjects()
2854 //JSTG 29-02-08 -----------------------------------------------
2855 //int i , nps = _sizePointsContour;
2857 int nps = _manContModel->GetNumberOfPointsSpline();
2858 //-------------------------------------------------------------
2860 _pts = vtkPoints::New();
2861 _pts->SetNumberOfPoints(nps);
2863 for (i=0 ; i<nps ; i++){
2864 _pts->SetPoint(i, 0 , 0 , 0 );
2866 // This is for the boundaring inicialisation
2869 _pts->SetPoint(0, 0 , 0 , -1000 );
2870 _pts->SetPoint(1, 0 , 0 , 1000 );
2871 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2872 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2875 vtkCellArray *lines = vtkCellArray::New();
2876 lines->InsertNextCell( nps /* +1 */ );
2877 for ( i=0 ; i<nps+1 ; i++ ){
2878 lines->InsertCellPoint(i % nps );
2881 _pd = vtkPolyData::New();
2882 _pd->SetPoints( _pts );
2883 _pd->SetLines( lines );
2884 lines->Delete(); //do not delete lines ??
2886 _contourVtkActor = vtkActor::New();
2887 _bboxMapper = vtkPolyDataMapper::New();
2888 _bboxMapper->ScalarVisibilityOff( );
2890 _bboxMapper->SetInput(_pd);
2891 _bboxMapper->ImmediateModeRenderingOn();
2892 _contourVtkActor->SetMapper(_bboxMapper);
2893 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2897 _pd->ComputeBounds();
2900 _textActor = vtkTextActor::New();
2901 // _textActor->SetDisplayPosition(200, 200);
2902 _textActor->SetInput("00");
2903 // Set coordinates to match the old vtkScaledTextActor default value
2904 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2905 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2906 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2907 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2909 vtkTextProperty *tprop = _textActor->GetTextProperty();
2910 tprop->SetFontSize(14);
2911 tprop->SetFontFamilyToArial();
2912 tprop->SetColor(0, 0, 1);
2914 // ----------------------------------------------------------------------------
2915 void manualViewBaseContour::CreateNewContour()
2917 ConstructVTKObjects();
2919 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2920 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2921 AddCompleteContourActor();
2923 // ----------------------------------------------------------------------------
2924 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2926 manualPoint *mp = _manContModel->GetManualPoint(id);
2929 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2930 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2931 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2933 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2936 // ----------------------------------------------------------------------------
2937 void manualViewBaseContour::UpdateViewPoints()
2939 int id, size = _lstViewPoints.size();
2940 for( id=0; id<size; id++)
2942 UpdateViewPoint( id );
2946 // ----------------------------------------------------------------------------
2947 void manualViewBaseContour::AddPoint()
2949 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2952 // ----------------------------------------------------------------------------
2953 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2955 _lstViewPoints.push_back( manualViewPoint );
2958 manualViewPoint->SetSpacing(_spc);
2960 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2961 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2964 // ----------------------------------------------------------------------------
2965 void manualViewBaseContour::InsertPoint(int id)
2967 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2970 mvp->SetSpacing(_spc);
2972 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2973 _lstViewPoints.insert(itNum,mvp);
2974 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
2976 // ----------------------------------------------------------------------------
2977 void manualViewBaseContour::DeleteContour()
2979 RemoveCompleteContourActor();
2980 /*if (_contourVtkActor!=NULL){
2981 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
2984 int i,size=_lstViewPoints.size();
2985 for (i=0;i<size;i++){
2986 manualViewBaseContour::DeletePoint(0);
2990 // ----------------------------------------------------------------------------
2991 void manualViewBaseContour::DeletePoint(int id) // virtual
2993 int size=_lstViewPoints.size();
2994 if ( (id>=0) && (id<size) ){
2995 manualViewPoint *mvp =_lstViewPoints[id];
2997 // _handlePicker->DeletePickList(mvp->GetVtkActor());
2998 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
2999 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
3000 _lstViewPoints.erase(itNum);
3005 // ----------------------------------------------------------------------------
3006 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3008 int id=GetIdPoint(x,y,z);
3013 // ----------------------------------------------------------------------------
3014 void manualViewBaseContour::SetSelected(bool selected)
3018 // ----------------------------------------------------------------------------
3019 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3021 _posibleSelected=posibleSelected;
3023 // ----------------------------------------------------------------------------
3024 bool manualViewBaseContour::GetEditable()
3028 // ----------------------------------------------------------------------------
3029 void manualViewBaseContour::SetEditable( bool * condition )
3031 _editable = condition;
3033 // ----------------------------------------------------------------------------
3034 bool manualViewBaseContour::GetSelected()
3038 // ----------------------------------------------------------------------------
3039 bool manualViewBaseContour::GetPosibleSelected()
3041 return _posibleSelected;
3043 // ----------------------------------------------------------------------------
3044 void manualViewBaseContour::DeleteSelectedPoints()
3046 int i,size=_lstViewPoints.size();
3047 for (i=size-1;i>=0;i--){
3048 if (_lstViewPoints[i]->GetSelected()==true){
3054 // ----------------------------------------------------------------------------
3055 void manualViewBaseContour::SelectPoint(int i, bool select)
3057 _lstViewPoints[i]->SetSelected(select);
3059 // ----------------------------------------------------------------------------
3060 void manualViewBaseContour::SelectLstPoints()
3064 // ----------------------------------------------------------------------------
3065 void manualViewBaseContour::SelectAllPoints(bool select)
3067 int i,size=_lstViewPoints.size();
3068 for (i=0;i<size;i++){
3069 SelectPoint(i,select);
3072 //-----------------------------------------------------------------------------
3073 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3075 _viewControlPoints = ifShow;
3077 // ----------------------------------------------------------------------------
3078 bool manualViewBaseContour:: GetIfViewControlPoints()
3080 return _viewControlPoints;
3083 // ----------------------------------------------------------------------------
3084 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3086 _lstViewPoints[id]->SetPosibleSelected(select);
3088 // ----------------------------------------------------------------------------
3089 void manualViewBaseContour::SetPointSelected(int id,bool select)
3091 _lstViewPoints[id]->SetSelected(select);
3093 // ----------------------------------------------------------------------------
3094 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3096 int i,size=_lstViewPoints.size();
3097 for (i=0;i<size;i++){
3098 SetPointPosibleSelected(i,select);
3101 // ----------------------------------------------------------------------------
3102 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3104 SelectAllPossibleSelected(false);
3106 int id = GetIdPoint(x,y,z);
3109 SetPointPosibleSelected(id,true);
3113 // ----------------------------------------------------------------------------
3114 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3117 SetPosibleSelected(result);
3118 int id = GetIdPoint(x,y,z);
3119 if( !GetEditable() && !_selected && id!= -1)
3122 SetPosibleSelected(result);
3126 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3128 if (ifTouchContour(x,y,z)==true)
3131 SetPosibleSelected(result);
3135 if (GetEditable()==false)
3137 if (ifTouchContour(x,y,z)==true)
3140 SetPosibleSelected(result);
3148 // ----------------------------------------------------------------------------
3149 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3153 // ----------------------------------------------------------------------------
3154 void manualViewBaseContour::UnSelectPoint(int i){
3155 _lstViewPoints[i]->SetSelected(false);
3158 // ----------------------------------------------------------------------------
3159 void manualViewBaseContour::UnSelectLstPoints(){
3162 // ----------------------------------------------------------------------------
3163 void manualViewBaseContour::UnSelectAllPoints(){
3164 int i,size=_lstViewPoints.size();
3165 for (i=0;i<size;i++){
3170 // ----------------------------------------------------------------------------
3171 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3172 _manContModel=manContModel;
3174 // ----------------------------------------------------------------------------
3175 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3176 _wxvtkbaseview = wxvtkbaseview;
3178 // ----------------------------------------------------------------------------
3179 void manualViewBaseContour::RefreshContour() // Virtual
3182 // ----------------------------------------------------------------------------
3183 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3185 int i,size = _sizePointsContour;
3186 double *vx = (double*)malloc(sizeof(double)*size);
3187 for (i=0;i<size;i++){
3188 _pts->GetPoint(i,pp);
3193 // ----------------------------------------------------------------------------
3194 double* manualViewBaseContour::GetVectorPointsYManualContour()
3197 int i,size = _sizePointsContour;
3198 double *vy = (double*)malloc(sizeof(double)*size);
3199 for (i=0;i<size;i++){
3200 _pts->GetPoint(i,pp);
3205 // ----------------------------------------------------------------------------
3206 double* manualViewBaseContour::GetVectorPointsZManualContour()
3209 int i,size = _sizePointsContour;
3210 double *vz = (double*)malloc(sizeof(double)*size);
3211 for (i=0;i<size;i++){
3212 _pts->GetPoint(i,pp);
3217 // ----------------------------------------------------------------------------
3218 void manualViewBaseContour::Refresh() // virtual
3220 if (_contourVtkActor!=NULL){
3223 int i,size=_lstViewPoints.size();
3224 for (i=0;i<size;i++){
3226 _lstViewPoints[i]->UpdateColorActor();
3230 if (_show_text==true)
3235 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3238 _wxvtkbaseview->GetRenWin()->Render();
3242 // ----------------------------------------------------------------------------
3243 void manualViewBaseContour::RefreshText() // virtual
3245 if( _textActor!=NULL)
3246 _textActor -> SetInput("00");
3248 // ----------------------------------------------------------------------------
3249 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3251 _coulorNormal_r = r;
3252 _coulorNormal_g = g;
3253 _coulorNormal_b = b;
3255 // ----------------------------------------------------------------------------
3256 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3258 r = _coulorNormal_r;
3259 g = _coulorNormal_g;
3260 b = _coulorNormal_b;
3262 // ----------------------------------------------------------------------------
3263 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3269 // ----------------------------------------------------------------------------
3270 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3276 // ----------------------------------------------------------------------------
3277 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3279 _coulorSelection_r = r;
3280 _coulorSelection_g = g;
3281 _coulorSelection_b = b;
3283 // ----------------------------------------------------------------------------
3284 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3286 r = _coulorSelection_r;
3287 g = _coulorSelection_g;
3288 b = _coulorSelection_b;
3290 // ----------------------------------------------------------------------------
3291 void manualViewBaseContour::UpdateColorActor()
3293 if (_contourVtkActor!=NULL)
3295 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3296 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3297 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3299 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3303 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3307 // ----------------------------------------------------------------------------
3308 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3311 if (_manContModel!=NULL){
3315 TransfromeCoordViewWorld(xx,yy,zz);
3316 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3321 // ----------------------------------------------------------------------------
3324 int manualViewBaseContour::GetNumberOfPoints()
3326 return _lstViewPoints.size();
3329 // ----------------------------------------------------------------------------
3331 //JSTG 25-02-08 ---------------------------------------------------------------
3332 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3334 return _sizePointsContour;
3336 //----------------------------------------------------------------------------
3338 //JSTG 25-02-08 ---------------------------------------------------------------
3339 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3341 _sizePointsContour = size;
3343 //----------------------------------------------------------------------------
3345 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3347 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3352 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3353 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3356 // ----------------------------------------------------------------------------
3357 void manualViewBaseContour::SetRange(int range)
3361 // ----------------------------------------------------------------------------
3362 int manualViewBaseContour::GetRange()
3366 // ----------------------------------------------------------------------------
3367 void manualViewBaseContour::SetZ(int z)
3371 // ----------------------------------------------------------------------------
3372 int manualViewBaseContour::GetZ()
3377 // ----------------------------------------------------------------------------
3378 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3382 // ----------------------------------------------------------------------------
3383 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3386 // ----------------------------------------------------------------------------
3387 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3391 // ----------------------------------------------------------------------------
3392 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3397 int size=_manContModel->GetSizeLstPoints();
3402 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3408 for( i = 0; i < size; i++ )
3410 mp=_manContModel->GetManualPoint(i);
3462 // ----------------------------------------------------------------------------
3463 void manualViewBaseContour::ClearContour()
3465 if (_contourVtkActor!=NULL){
3466 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3469 int i,size=_lstViewPoints.size();
3470 for (i=0;i<size;i++){
3475 // ----------------------------------------------------------------------------
3476 void manualViewBaseContour::ClearPoint(int id)
3480 // ----------------------------------------------------------------------------
3481 void manualViewBaseContour::SetVisible(bool ok)
3491 int i,size=_lstViewPoints.size();
3492 for (i=0;i<size;i++){
3493 actor = _lstViewPoints[i]->GetVtkActor();
3494 actor->GetProperty()->SetOpacity( opacity );
3496 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3497 _textActor->GetProperty()->SetOpacity( opacity );
3498 _textActor->SetInput("00");
3501 // ----------------------------------------------------------------------------
3502 void manualViewBaseContour::SetShowText(bool ok)
3505 if (_show_text==false)
3507 _textActor->SetInput("00");
3510 // ----------------------------------------------------------------------------
3511 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3513 return this->_wxvtkbaseview;
3515 // ----------------------------------------------------------------------------
3516 void manualViewBaseContour::GetSpacing(double spc[3])
3522 // ----------------------------------------------------------------------------
3523 void manualViewBaseContour::SetSpacing(double spc[3])
3531 // ----------------------------------------------------------------------------
3532 // ----------------------------------------------------------------------------
3533 // ----------------------------------------------------------------------------
3535 // _type = 0 Sagital
3536 // _type = 1 Coronal
3538 // _type = -1 View 3D
3540 manualContour3VControler::manualContour3VControler(int type)
3545 // _manViewBaseCont1 = NULL;
3546 // _manViewBaseCont2 = NULL;
3547 // _manViewBaseCont3 = NULL;
3549 //----------------------------------------------------------------------------
3550 manualContour3VControler::~manualContour3VControler()
3554 // ----------------------------------------------------------------------------
3555 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3557 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3558 CopyAttributesTo(clone);
3562 // ---------------------------------------------------------------------------
3563 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3566 manualContourControler::CopyAttributesTo(cloneObject);
3568 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3570 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3573 // ----------------------------------------------------------------------------
3574 int manualContour3VControler::GetType()
3579 // ----------------------------------------------------------------------------
3580 void manualContour3VControler::AddPoint_Others()
3582 manualViewBaseContour *mvbc;
3583 int i,size=this->_lstManualViewBaseContour.size();
3584 for ( i = 0 ; i < size ; i++ )
3586 mvbc = _lstManualViewBaseContour[i];
3591 // if (_manViewBaseCont1!=NULL){
3592 // _manViewBaseCont1->AddPoint();
3593 // _manViewBaseCont2->AddPoint();
3594 // _manViewBaseCont3->AddPoint();
3595 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3598 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3600 // ----------------------------------------------------------------------------
3601 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3604 z=(int)_vtkmprbasedata->GetZ();
3605 if (GetManualContourModel()!=NULL){
3609 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3613 xx=_vtkmprbasedata->GetX();
3618 yy=_vtkmprbasedata->GetY();
3622 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3623 GetManualViewBaseContour()->AddPoint();
3629 // ----------------------------------------------------------------------------
3630 void manualContour3VControler::InsertPoint_Others(int id)
3633 manualViewBaseContour *mvbc;
3634 int i,size=this->_lstManualViewBaseContour.size();
3635 for ( i = 0 ; i < size ; i++ )
3637 mvbc = _lstManualViewBaseContour[i];
3638 mvbc->InsertPoint(id);
3642 if (_manViewBaseCont1!=NULL){
3643 _manViewBaseCont1->InsertPoint(id);
3644 _manViewBaseCont2->InsertPoint(id);
3645 _manViewBaseCont3->InsertPoint(id);
3646 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3650 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3653 // ----------------------------------------------------------------------------
3654 void manualContour3VControler::InsertPoint(int x, int y, int z)
3657 if (GetManualContourModel()!=NULL){
3658 if (GetManualContourModel()->GetSizeLstPoints()>1){
3659 z=(int)_vtkmprbasedata->GetZ();
3663 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3666 xx=_vtkmprbasedata->GetX();
3671 yy=_vtkmprbasedata->GetY();
3674 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3676 GetManualViewBaseContour()->InsertPoint(id);
3677 InsertPoint_Others(0);
3684 // ----------------------------------------------------------------------------
3688 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3689 manualViewBaseContour *manViewBaseCont0,
3690 manualViewBaseContour *manViewBaseCont1,
3691 manualViewBaseContour *manViewBaseCont2,
3692 manualViewBaseContour *manViewBaseCont3)
3694 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3695 _manViewBaseCont1 = manViewBaseCont1;
3696 _manViewBaseCont2 = manViewBaseCont2;
3697 _manViewBaseCont3 = manViewBaseCont3;
3701 // ----------------------------------------------------------------------------
3702 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3704 _lstManualViewBaseContour.push_back( manViewBaseCont );
3707 // ----------------------------------------------------------------------------
3708 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3710 _vtkmprbasedata=vtkmprbasedata;
3712 // ----------------------------------------------------------------------------
3713 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3715 return _vtkmprbasedata;
3717 // ----------------------------------------------------------------------------
3718 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3720 z=(int)_vtkmprbasedata->GetZ();
3721 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3725 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3729 xx=_vtkmprbasedata->GetX();
3733 yy=_vtkmprbasedata->GetY();
3736 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3737 mp->SetPoint(xx,yy,zz);
3741 // ----------------------------------------------------------------------------
3742 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3744 manualViewBaseContour *mvbc;
3745 int i,size=this->_lstManualViewBaseContour.size();
3746 for ( i = 0 ; i < size ; i++ )
3748 mvbc = _lstManualViewBaseContour[i];
3749 mvbc->DeletePoint(id);
3754 if (_manViewBaseCont1!=NULL){
3755 _manViewBaseCont1->DeletePoint(id);
3756 _manViewBaseCont2->DeletePoint(id);
3757 _manViewBaseCont3->DeletePoint(id);
3759 _manViewBaseCont1->Refresh();
3760 _manViewBaseCont2->Refresh();
3761 _manViewBaseCont3->Refresh();
3763 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3766 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3768 // ----------------------------------------------------------------------------
3769 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3771 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3773 manualContourBaseControler::DeleteActualMousePoint( x , y );
3774 DeleteActualMousePoint_Others( id );
3777 // ----------------------------------------------------------------------------
3778 void manualContour3VControler::MouseMove_Others(int id) // virtual
3780 manualViewBaseContour *mvbc;
3781 int i,size=this->_lstManualViewBaseContour.size();
3782 for ( i = 0 ; i < size ; i++ )
3784 mvbc = _lstManualViewBaseContour[i];
3785 mvbc->SelectAllPossibleSelected(false);
3788 mvbc->SetPointPosibleSelected(id,true);
3790 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3796 if (_manViewBaseCont1!=NULL){
3797 _manViewBaseCont1->SelectAllPossibleSelected(false);
3798 _manViewBaseCont2->SelectAllPossibleSelected(false);
3799 _manViewBaseCont3->SelectAllPossibleSelected(false);
3801 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3802 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3803 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3805 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3806 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3807 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3809 _manViewBaseCont1->Refresh();
3810 _manViewBaseCont2->Refresh();
3811 _manViewBaseCont3->Refresh();
3813 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3816 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3820 // ----------------------------------------------------------------------------
3821 void manualContour3VControler::MouseMove(int x, int y) // virtual
3823 manualContourControler::MouseMove( x , y );
3824 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3825 MouseMove_Others( id );
3828 // ----------------------------------------------------------------------------
3829 void manualContour3VControler::OnChar_Others()
3831 manualViewBaseContour *mvbc;
3832 int i,size=this->_lstManualViewBaseContour.size();
3833 for ( i = 0 ; i < size ; i++ )
3835 mvbc = _lstManualViewBaseContour[i];
3840 _manViewBaseCont1->Refresh();
3841 _manViewBaseCont2->Refresh();
3842 _manViewBaseCont3->Refresh();
3844 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3846 // ----------------------------------------------------------------------------
3847 bool manualContour3VControler::OnChar()
3849 manualContourControler::OnChar();
3853 // ----------------------------------------------------------------------------
3854 void manualContour3VControler::ResetContour() // virtual
3856 manualContourControler::ResetContour();
3857 ResetContour_Others();
3860 // ----------------------------------------------------------------------------
3861 void manualContour3VControler::ResetContour_Others()
3863 manualViewBaseContour *mvbc;
3864 int i,size=this->_lstManualViewBaseContour.size();
3865 for ( i = 0 ; i < size ; i++ )
3867 mvbc = _lstManualViewBaseContour[i];
3868 mvbc->DeleteContour();
3869 mvbc->CreateNewContour();
3874 _manViewBaseCont1->DeleteContour();
3875 _manViewBaseCont2->DeleteContour();
3876 _manViewBaseCont3->DeleteContour();
3877 _manViewBaseCont1->CreateNewContour();
3878 _manViewBaseCont2->CreateNewContour();
3879 _manViewBaseCont3->CreateNewContour();
3883 // ----------------------------------------------------------------------------
3884 // ----------------------------------------------------------------------------
3885 // ----------------------------------------------------------------------------
3886 manualContour3DControler::manualContour3DControler()
3889 // ----------------------------------------------------------------------------
3890 manualContour3DControler::~manualContour3DControler()
3893 // ----------------------------------------------------------------------------
3894 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3896 manualContour3DControler * clone = new manualContour3DControler();
3897 CopyAttributesTo(clone);
3901 // ---------------------------------------------------------------------------
3902 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3905 manualContourControler::CopyAttributesTo(cloneObject);
3907 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3910 // ----------------------------------------------------------------------------
3911 bool manualContour3DControler::OnLeftButtonDown()
3914 wxVTKRenderWindowInteractor *wxVTKiren;
3915 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3916 wxVTKiren->GetEventPosition(X,Y);
3917 MouseClickLeft(X,Y);
3920 // ----------------------------------------------------------------------------
3921 void manualContour3DControler::ResetOrientationPlane()
3923 double p[3],rp[3],rn[3];
3924 p[0] = this->GetVtkMPRBaseData()->GetX( );
3925 p[1] = this->GetVtkMPRBaseData()->GetY( );
3926 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3927 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3928 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3930 // ----------------------------------------------------------------------------
3931 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3933 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3934 int id=manualview3Dcontour->GetIdPoint2(x,y);
3935 if ( (GetState()==0) && (id!=-1) )
3937 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3939 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3940 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3941 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3942 ResetOrientationPlane();
3943 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3947 manualContourControler::MouseClickLeft(x,y);
3950 // ----------------------------------------------------------------------------
3951 bool manualContour3DControler::OnChar()
3954 manualContourControler::OnChar();
3955 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3958 ResetOrientationPlane();
3959 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3964 // ----------------------------------------------------------------------------
3965 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3967 _vtkmprbasedata=vtkmprbasedata;
3969 // ----------------------------------------------------------------------------
3970 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3972 return _vtkmprbasedata;
3975 // ----------------------------------------------------------------------------
3976 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
3978 manualContourControler::InsertPoint( x, y, z );
3979 ResetOrientationPlane();
3984 // ----------------------------------------------------------------------------
3985 // ----------------------------------------------------------------------------
3986 // ----------------------------------------------------------------------------
3988 manualContour3V3DControler::manualContour3V3DControler()
3991 // ----------------------------------------------------------------------------
3992 manualContour3V3DControler::~manualContour3V3DControler()
3996 // ----------------------------------------------------------------------------
3997 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
3999 manualContour3V3DControler * clone = new manualContour3V3DControler();
4000 CopyAttributesTo(clone);
4004 // ---------------------------------------------------------------------------
4005 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4008 manualContour3DControler::CopyAttributesTo(cloneObject);
4010 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4012 // ----------------------------------------------------------------------------
4013 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4015 manualContour3DControler::InsertPoint( x, y, z );
4016 _manualcontour3Vcontroler->InsertPoint_Others(0);
4018 // ----------------------------------------------------------------------------
4019 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4021 manualContour3DControler::AddPoint( x, y, z );
4022 _manualcontour3Vcontroler->AddPoint_Others();
4024 // ----------------------------------------------------------------------------
4025 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4027 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4028 manualContour3DControler::DeleteActualMousePoint( x , y );
4029 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4031 // ----------------------------------------------------------------------------
4032 void manualContour3V3DControler::MouseMove( int x, int y )
4034 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4035 if ((this->GetState()!=7) && (ss!=1)){
4036 manualContour3DControler::MouseMove( x , y );
4037 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4038 _manualcontour3Vcontroler->MouseMove_Others(id);
4041 // ----------------------------------------------------------------------------
4042 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4044 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4046 // ----------------------------------------------------------------------------
4047 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4049 return _manualcontour3Vcontroler;
4051 // ----------------------------------------------------------------------------
4052 bool manualContour3V3DControler::OnChar() // virtual
4054 if (manualContour3DControler::OnChar()==false )
4056 _manualcontour3Vcontroler->OnChar_Others();
4061 // ----------------------------------------------------------------------------
4062 void manualContour3V3DControler::ResetContour() // virtual
4064 manualContourControler::ResetContour();
4065 _manualcontour3Vcontroler->ResetContour_Others();
4069 // ----------------------------------------------------------------------------
4070 // ----------------------------------------------------------------------------
4071 // ----------------------------------------------------------------------------
4073 // _state = 0 // ..nothing..
4074 // _state = 1 // move with add point
4075 // _state = 5 // move
4076 // _state = 6 // move with insert point
4077 // _state = 7 // move with non selection
4079 manualContourControler::manualContourControler()
4081 _easyCreation = true;
4084 // ----------------------------------------------------------------------------
4085 manualContourControler::~manualContourControler()
4088 // ----------------------------------------------------------------------------
4089 manualContourControler * manualContourControler :: Clone() // virtual
4091 manualContourControler * clone = new manualContourControler();
4092 CopyAttributesTo(clone);
4095 // ---------------------------------------------------------------------------
4096 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4099 manualContourBaseControler::CopyAttributesTo(cloneObject);
4100 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4103 // ----------------------------------------------------------------------------
4104 void manualContourControler::Configure() //virtual
4106 // this->_manContModel->SetNumberOfPointsSpline(100);
4109 // ----------------------------------------------------------------------------
4110 void manualContourControler::MouseClickLeft(int x, int y){
4115 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4117 // Insert a Control Point with shift+ClickLeft
4118 // int tt = GetState(); // JPRx
4119 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4123 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4129 // Start to Insert Control Points with ClickLeft (Empty contour)
4130 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4136 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4137 if ((GetState()==1) && (_easyCreation==true) )
4141 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4143 // Insert Control Points IF Contour si Selected
4144 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4148 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4151 // Chose id of Control Point to be move
4152 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4155 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4158 // If nothing selected _state=7
4159 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4162 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4166 SetPosibleToMove( true );
4167 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4170 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4174 GetManualViewBaseContour()->InitMove(x,y,z);
4179 GetManualViewBaseContour()->Refresh();
4182 // ----------------------------------------------------------------------------
4183 void manualContourControler::MouseMove(int x, int y) // virtual
4186 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4187 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4188 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4189 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4190 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4192 GetManualViewBaseContour()->MoveContour(x,y,z);
4194 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4195 GetManualViewBaseContour()->Refresh();
4196 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4200 GetManualViewBaseContour()->RemoveControlPoints();
4201 // GetManualViewBaseContour()->RemoveTextActor();
4202 GetManualViewBaseContour()->Refresh();
4203 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4208 // ----------------------------------------------------------------------------
4209 void manualContourControler::MouseDLeft( int x, int y)//virtual
4211 manualContourBaseControler::MouseDLeft( x, y);
4214 GetManualViewBaseContour()->AddControlPoints();
4215 GetManualViewBaseContour()->AddTextActor();
4216 GetManualViewBaseContour()->Refresh();
4217 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4220 // ----------------------------------------------------------------------------
4221 void manualContourControler::SetEasyCreation(bool easyCreation)
4223 _easyCreation=easyCreation;
4225 // ----------------------------------------------------------------------------
4226 bool manualContourControler::GetEasyCreation()
4228 return _easyCreation;
4232 // ----------------------------------------------------------------------------
4233 // ----------------------------------------------------------------------------
4234 // ----------------------------------------------------------------------------
4235 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4237 _flagMouseMove = true;
4239 // ----------------------------------------------------------------------------
4240 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4243 // ----------------------------------------------------------------------------
4244 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4246 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4247 CopyAttributesTo(clone);
4251 // ---------------------------------------------------------------------------
4252 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4255 manualContourControler::CopyAttributesTo(cloneObject);
4257 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4258 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4259 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4262 // ----------------------------------------------------------------------------
4263 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4265 _vtkmprbasedata = vtkmprbasedata;
4268 // ----------------------------------------------------------------------------
4269 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4271 return _vtkmprbasedata;
4275 // ----------------------------------------------------------------------------
4276 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4278 manualContourControler::InsertPoint( x, y, z );
4279 _manualcontour3Vcontroler->InsertPoint_Others(0);
4281 // ----------------------------------------------------------------------------
4282 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4284 manualContourControler::AddPoint( x, y, z );
4285 _manualcontour3Vcontroler->AddPoint_Others();
4287 // ----------------------------------------------------------------------------
4288 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4290 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4291 manualContourControler::DeleteActualMousePoint( x , y );
4292 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4294 // ----------------------------------------------------------------------------
4295 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4297 _flagMouseMove = true;
4298 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4299 if ((this->GetState()!=7) && (ss!=1)){
4300 manualContourControler::MouseMove( x , y );
4301 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4304 _manualcontour3Vcontroler->MouseMove_Others(id);
4305 _flagMouseMove = false;
4309 // ----------------------------------------------------------------------------
4310 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4312 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4314 // ----------------------------------------------------------------------------
4315 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4317 return _manualcontour3Vcontroler;
4319 // ----------------------------------------------------------------------------
4320 bool manualContourPerpPlaneControler::OnChar() // virtual
4322 if (manualContourControler::OnChar()==false )
4324 _manualcontour3Vcontroler->OnChar_Others();
4328 // ----------------------------------------------------------------------------
4329 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4331 manualContourControler::OnMouseMove();
4332 return _flagMouseMove;
4334 // ----------------------------------------------------------------------------
4335 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4337 manualContourControler::OnLeftDClick();
4338 return _flagMouseDClick;
4340 // ----------------------------------------------------------------------------
4341 void manualContourPerpPlaneControler::ResetContour() // virtual
4343 manualContourControler::ResetContour();
4344 _manualcontour3Vcontroler->ResetContour_Others();
4347 // ----------------------------------------------------------------------------
4348 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4350 _flagMouseDClick=true;
4351 manualContourControler::MouseDLeft(x,y);
4353 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4355 _flagMouseDClick = false;
4356 _vtkinteractorstyleplane2D->OnLeftDClick();
4357 ResetOrientationPlane();
4358 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4361 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4362 // if ( (GetState()==0) && (id!=-1) )
4364 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4365 // _vtkmprbasedata->SetX( mp->GetX() );
4366 // _vtkmprbasedata->SetY( mp->GetY() );
4367 // _vtkmprbasedata->SetZ( mp->GetZ() );
4368 // ResetOrientationPlane();
4369 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4375 // ----------------------------------------------------------------------------
4376 void manualContourPerpPlaneControler::ResetOrientationPlane()
4378 double p[3],rp[3],rn[3];
4379 p[0] = _vtkmprbasedata->GetX( );
4380 p[1] = _vtkmprbasedata->GetY( );
4381 p[2] = _vtkmprbasedata->GetZ( );
4382 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4384 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4387 // ----------------------------------------------------------------------------
4388 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4390 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4392 // ----------------------------------------------------------------------------
4393 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4395 return _vtkinteractorstyleplane2D;
4398 // ----------------------------------------------------------------------------
4399 // ----------------------------------------------------------------------------
4400 // ----------------------------------------------------------------------------
4402 // _state = 0 // ..nothing..
4403 // _state = 5 // move point
4404 // _state = 6 // move all
4405 // _state = 7 // Empty mouse drag
4407 manualRoiControler::manualRoiControler()
4410 // ----------------------------------------------------------------------------
4411 manualRoiControler::~manualRoiControler()
4414 // ----------------------------------------------------------------------------
4415 manualRoiControler * manualRoiControler :: Clone() // virtual
4417 manualRoiControler * clone = new manualRoiControler();
4418 CopyAttributesTo(clone);
4422 // ---------------------------------------------------------------------------
4423 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4426 manualContourBaseControler::CopyAttributesTo(cloneObject);
4429 // ----------------------------------------------------------------------------
4430 void manualRoiControler::Configure() //virtual
4432 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4435 // ----------------------------------------------------------------------------
4437 void manualRoiControler::MouseClickLeft(int x, int y){
4441 { // move control point
4442 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4443 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4449 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4450 GetManualViewBaseContour()->InitMove(x,y,z);
4454 // if the firs time create 4 control points and move one point
4455 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4456 if (GetState()==0) {
4462 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4468 if (GetState()==0) {
4480 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4485 GetManualViewBaseContour()->Refresh();
4488 // ----------------------------------------------------------------------------
4489 void manualRoiControler::MouseMove(int x, int y) // virtual
4493 // this->_vtkInteractorStyleBaseView->
4496 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4497 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4500 if ( (GetState()==5) || (GetState()==1) ){
4501 SetPoint( bakIdPoint , x , y ,z);
4524 GetManualViewBaseContour()->MoveContour(x,y,z);
4526 GetManualViewBaseContour()->Refresh();
4528 // ----------------------------------------------------------------------------
4529 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4532 // ----------------------------------------------------------------------------
4533 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4538 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4547 double pp1=porcentage;
4548 double pp2=1-porcentage;
4550 mp = GetManualContourModel()->GetManualPoint(2);
4552 mp->SetPoint(ww*pp1,hh*pp1,zz);
4554 mp = GetManualContourModel()->GetManualPoint(1);
4556 mp->SetPoint(ww*pp2,hh*pp1,zz);
4558 mp = GetManualContourModel()->GetManualPoint(0);
4560 mp->SetPoint(ww*pp2,hh*pp2,zz);
4562 mp = GetManualContourModel()->GetManualPoint(3);
4564 mp->SetPoint(ww*pp1,hh*pp2,zz);
4566 GetManualViewBaseContour() ->UpdateViewPoint(0);
4567 GetManualViewBaseContour() ->UpdateViewPoint(1);
4568 GetManualViewBaseContour() ->UpdateViewPoint(2);
4569 GetManualViewBaseContour() ->UpdateViewPoint(3);
4572 GetManualViewBaseContour()->Refresh();
4575 // ----------------------------------------------------------------------------
4576 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4579 InitRoi( 0 , 0 , 0.2 );
4580 mp = GetManualContourModel()->GetManualPoint(2);
4584 mp = GetManualContourModel()->GetManualPoint(1);
4588 mp = GetManualContourModel()->GetManualPoint(0);
4592 mp = GetManualContourModel()->GetManualPoint(3);
4596 GetManualViewBaseContour() ->UpdateViewPoint(0);
4597 GetManualViewBaseContour() ->UpdateViewPoint(1);
4598 GetManualViewBaseContour() ->UpdateViewPoint(2);
4599 GetManualViewBaseContour() ->UpdateViewPoint(3);
4603 // ----------------------------------------------------------------------------
4604 // ----------------------------------------------------------------------------
4605 // ----------------------------------------------------------------------------
4609 // _state = 0 // ..nothing..
4610 // _state = 5 // move point
4611 // _state = 6 // move all
4612 // _state = 7 // Empty mouse drag
4614 manualCircleControler::manualCircleControler()
4617 // ----------------------------------------------------------------------------
4618 manualCircleControler::~manualCircleControler()
4621 // ----------------------------------------------------------------------------
4622 manualCircleControler * manualCircleControler :: Clone() // virtual
4624 manualCircleControler * clone = new manualCircleControler();
4625 CopyAttributesTo(clone);
4629 // ---------------------------------------------------------------------------
4630 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4633 manualContourBaseControler::CopyAttributesTo(cloneObject);
4636 // ----------------------------------------------------------------------------
4637 void manualCircleControler::Configure() //virtual
4639 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4642 // ----------------------------------------------------------------------------
4643 void manualCircleControler::MouseClickLeft(int x, int y){
4647 { // move control point
4648 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4649 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4655 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4656 GetManualViewBaseContour()->InitMove(x,y,z);
4660 // firstime create 2 control points and move one control point
4661 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4662 if (GetState()==0) {
4666 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4672 if (GetState()==0) {
4680 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4685 GetManualViewBaseContour()->Refresh();
4687 // ----------------------------------------------------------------------------
4689 void manualCircleControler::MouseMove(int x, int y) // virtual
4692 // this->_vtkInteractorStyleBaseView->
4694 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4695 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4697 if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
4698 if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
4701 GetManualViewBaseContour()->MoveContour(x,y,z);
4703 GetManualViewBaseContour()->Refresh();
4707 // ----------------------------------------------------------------------------
4708 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4711 // ----------------------------------------------------------------------------
4713 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4718 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4723 // AddPoint(0,0,zz);
4724 // AddPoint(0,0,zz);
4727 double pp1=porcentage;
4728 double pp2=1-porcentage;
4730 // mp = GetManualContourModel()->GetManualPoint(2);
4731 // zz=(int)mp->GetZ();
4732 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4734 mp = GetManualContourModel()->GetManualPoint(1);
4736 mp->SetPoint(ww*pp2,hh*pp1,zz);
4738 mp = GetManualContourModel()->GetManualPoint(0);
4740 mp->SetPoint(ww*pp2,hh*pp2,zz);
4742 // mp = GetManualContourModel()->GetManualPoint(3);
4743 // zz=(int)mp->GetZ();
4744 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4746 GetManualViewBaseContour() ->UpdateViewPoint(0);
4747 GetManualViewBaseContour() ->UpdateViewPoint(1);
4748 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4749 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4752 GetManualViewBaseContour()->Refresh();
4755 // ----------------------------------------------------------------------------
4757 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4760 InitRoi( 0 , 0 , 0.2 );
4761 mp = GetManualContourModel()->GetManualPoint(2);
4765 mp = GetManualContourModel()->GetManualPoint(1);
4769 mp = GetManualContourModel()->GetManualPoint(0);
4773 mp = GetManualContourModel()->GetManualPoint(3);
4777 GetManualViewBaseContour() ->UpdateViewPoint(0);
4778 GetManualViewBaseContour() ->UpdateViewPoint(1);
4779 GetManualViewBaseContour() ->UpdateViewPoint(2);
4780 GetManualViewBaseContour() ->UpdateViewPoint(3);
4785 // ----------------------------------------------------------------------------
4786 // ----------------------------------------------------------------------------
4787 // ----------------------------------------------------------------------------
4791 // _state = 0 // ..nothing..
4792 // _state = 5 // move point
4793 // _state = 6 // move all
4794 // _state = 7 // Empty mouse drag
4796 manualLineControler::manualLineControler()
4799 // ----------------------------------------------------------------------------
4800 manualLineControler::~manualLineControler()
4803 // ----------------------------------------------------------------------------
4804 manualLineControler * manualLineControler :: Clone() // virtual
4806 manualLineControler * clone = new manualLineControler();
4807 CopyAttributesTo(clone);
4811 // ---------------------------------------------------------------------------
4812 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4815 manualContourBaseControler::CopyAttributesTo(cloneObject);
4819 // ----------------------------------------------------------------------------
4820 void manualLineControler::MouseClickLeft(int x, int y){
4824 { // move control point
4825 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4826 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4832 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4833 GetManualViewBaseContour()->InitMove(x,y,z);
4837 // fist time create 2 control points and move a control point
4838 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4839 if (GetState()==0) {
4843 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4850 if (GetState()==0) {
4858 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4863 GetManualViewBaseContour()->Refresh();
4865 // ----------------------------------------------------------------------------
4867 void manualLineControler::MouseMove(int x, int y) // virtual
4871 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4872 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4874 if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
4875 if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
4879 GetManualViewBaseContour()->MoveContour(x,y,z);
4881 GetManualViewBaseContour()->Refresh();
4885 // ----------------------------------------------------------------------------
4886 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4889 // ----------------------------------------------------------------------------
4891 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4896 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4903 double pp1=porcentage;
4904 double pp2=1-porcentage;
4906 mp = GetManualContourModel()->GetManualPoint(0);
4908 mp->SetPoint(ww*pp2,hh*pp2,zz);
4910 mp = GetManualContourModel()->GetManualPoint(1);
4912 mp->SetPoint(ww*pp2,hh*pp1,zz);
4914 GetManualViewBaseContour() ->UpdateViewPoint(0);
4915 GetManualViewBaseContour() ->UpdateViewPoint(1);
4918 GetManualViewBaseContour()->Refresh();
4921 // ----------------------------------------------------------------------------
4922 // ----------------------------------------------------------------------------
4923 // ----------------------------------------------------------------------------
4926 manualContourBaseControler::manualContourBaseControler()
4928 _manViewBaseCont = NULL;
4929 _manContModel = NULL;
4933 _posibleToMove = true;
4936 _keyBoardMoving = false;
4938 // ----------------------------------------------------------------------------
4939 manualContourBaseControler::~manualContourBaseControler()
4943 // ----------------------------------------------------------------------------
4944 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4946 manualContourBaseControler * clone = new manualContourBaseControler();
4947 CopyAttributesTo(clone);
4951 // ---------------------------------------------------------------------------
4953 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4956 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4957 cloneObject->SetZ( this->GetZ() );
4958 cloneObject->SetState( this->GetState() );
4959 cloneObject->SetEditable( this->IsEditable() );
4960 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4961 cloneObject->SetMoving( this->IsMoving() );
4962 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4963 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4966 // ----------------------------------------------------------------------------
4967 void manualContourBaseControler::Configure() //virtual
4971 // ----------------------------------------------------------------------------
4972 bool manualContourBaseControler::OnChar()
4974 if ( _vtkInteractorStyleBaseView!=NULL )
4976 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4979 wxVTKRenderWindowInteractor *_wxVTKiren;
4980 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4981 _wxVTKiren->GetEventPosition(X, Y);
4982 //int Z = GetZ(); // JPRx
4984 if ((keyCode==8) || (keyCode==127))
4987 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4989 DeleteActualMousePoint(X,Y);
4991 GetManualViewBaseContour()->Refresh();
4992 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5000 GetManualViewBaseContour()->Refresh();
5001 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5003 else if( !IsEditable() )
5005 if ( keyCode == 'L' )
5007 GetManualViewBaseContour()->MoveContour( -1, 0 );
5008 SetKeyBoardMoving( true );
5010 else if ( keyCode == 'R' )
5012 GetManualViewBaseContour()->MoveContour( 1, 0 );
5013 SetKeyBoardMoving( true );
5015 else if ( keyCode == 'U' )
5017 GetManualViewBaseContour()->MoveContour( 0, -1 );
5018 SetKeyBoardMoving( true );
5020 else if ( keyCode == 'D' )
5022 GetManualViewBaseContour()->MoveContour( 0, 1 );
5023 SetKeyBoardMoving( true );
5025 else if ( keyCode == 'W' )//Diagonal left down
5027 GetManualViewBaseContour()->MoveContour( -1, 1 );
5028 SetKeyBoardMoving( true );
5030 else if ( keyCode == 'Q' )//Diagonal left up
5032 GetManualViewBaseContour()->MoveContour( -1, -1 );
5033 SetKeyBoardMoving( true );
5035 else if( keyCode == 'P' )//Diagonal right up
5037 GetManualViewBaseContour()->MoveContour( 1, -1 );
5038 SetKeyBoardMoving( true );
5040 else if( keyCode == 'M' )//Diagonal right down
5042 GetManualViewBaseContour()->MoveContour( 1, 1 );
5043 SetKeyBoardMoving( true );
5045 if( GetKeyBoardMoving() )
5047 GetManualViewBaseContour()->Refresh();
5048 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5055 // ----------------------------------------------------------------------------
5056 bool manualContourBaseControler::OnMouseMove()
5059 if ( _vtkInteractorStyleBaseView!=NULL)
5062 wxVTKRenderWindowInteractor *_wxVTKiren;
5063 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5064 _wxVTKiren->GetEventPosition( X , Y );
5067 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5068 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5074 // ----------------------------------------------------------------------------
5075 bool manualContourBaseControler::OnLeftButtonDown()
5077 SetKeyBoardMoving( false );
5078 if ( _vtkInteractorStyleBaseView!=NULL )
5081 wxVTKRenderWindowInteractor *wxVTKiren;
5082 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5083 wxVTKiren->GetEventPosition(X,Y);
5085 MouseClickLeft(X,Y);
5089 // ----------------------------------------------------------------------------
5090 bool manualContourBaseControler::OnLeftButtonUp()
5092 if ( _vtkInteractorStyleBaseView!=NULL )
5095 wxVTKRenderWindowInteractor *wxVTKiren;
5096 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5097 wxVTKiren->GetEventPosition(X,Y);
5098 MouseReleaseLeft(X,Y);
5102 // ----------------------------------------------------------------------------
5103 bool manualContourBaseControler::OnLeftDClick()
5105 if ( _vtkInteractorStyleBaseView!=NULL )
5108 wxVTKRenderWindowInteractor *wxVTKiren;
5109 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5110 wxVTKiren->GetEventPosition(X,Y);
5112 this->MouseDLeft(X,Y);
5116 // ----------------------------------------------------------------------------
5117 bool manualContourBaseControler::OnMiddleButtonDown()
5119 // SetKeyBoardMoving( false );
5120 if ( _vtkInteractorStyleBaseView!=NULL )
5123 wxVTKRenderWindowInteractor *wxVTKiren;
5124 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5125 wxVTKiren->GetEventPosition(X,Y);
5126 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5130 // ----------------------------------------------------------------------------
5131 bool manualContourBaseControler::OnMiddleButtonUp()
5135 // ----------------------------------------------------------------------------
5136 bool manualContourBaseControler::OnRightButtonDown()
5138 if( _vtkInteractorStyleBaseView!= NULL )
5141 wxVTKRenderWindowInteractor *wxVTKiren;
5142 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5143 wxVTKiren->GetEventPosition(X, Y);
5145 SetCompleteCreation( true );
5146 SetKeyBoardMoving( false );
5147 MouseClickRight(X,Y);
5151 // ----------------------------------------------------------------------------
5152 bool manualContourBaseControler::OnRightButtonUp()
5156 // ----------------------------------------------------------------------------
5157 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5158 _manContModel = manContModel;
5159 _manViewBaseCont = manViewBaseCont;
5160 _manViewBaseCont->SetEditable( &_editable );
5162 // ----------------------------------------------------------------------------
5163 manualContourModel* manualContourBaseControler::GetManualContourModel()
5165 return _manContModel;
5167 // ----------------------------------------------------------------------------
5168 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5170 return _manViewBaseCont;
5172 // ----------------------------------------------------------------------------
5173 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5177 // ----------------------------------------------------------------------------
5178 void manualContourBaseControler::MouseClickRight(int x, int y)
5184 SetEditable( false );
5185 SetPosibleToMove( false );
5188 //EED 24Avril2009 _state=7;
5190 // ----------------------------------------------------------------------------
5191 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5193 if (_state==5){ _state = 0; }
5194 if (_state==6){ _state = 0; }
5195 if (_state==7){ _state = 0; }
5197 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5198 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5200 SetEditable( false );
5201 SetPosibleToMove( false );
5204 // ----------------------------------------------------------------------------
5205 void manualContourBaseControler::MouseDLeft(int x, int y )
5210 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5211 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5212 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5218 // ----------------------------------------------------------------------------
5219 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5222 // ----------------------------------------------------------------------------
5223 void manualContourBaseControler::SetState(int state)
5227 // ----------------------------------------------------------------------------
5228 int manualContourBaseControler::GetState()
5232 // ----------------------------------------------------------------------------
5233 bool manualContourBaseControler::IsEditable( )
5237 // ----------------------------------------------------------------------------
5238 void manualContourBaseControler::SetEditable( bool condition )
5240 if (GetManualViewBaseContour()!=NULL) {
5243 GetManualViewBaseContour()->RemoveControlPoints();
5245 GetManualViewBaseContour()->SetSelected( condition );
5247 _editable = condition;
5250 // ----------------------------------------------------------------------------
5251 bool manualContourBaseControler::GetPosibleToMove()
5253 return _posibleToMove;
5255 // ----------------------------------------------------------------------------
5256 void manualContourBaseControler::SetPosibleToMove( bool condition )
5258 _posibleToMove = condition;
5260 // ----------------------------------------------------------------------------
5261 bool manualContourBaseControler::IsMoving()
5265 // ----------------------------------------------------------------------------
5266 void manualContourBaseControler::SetMoving( bool condition )
5268 _moving = condition;
5270 // ----------------------------------------------------------------------------
5271 void manualContourBaseControler::SetCompleteCreation( bool condition )
5273 _created = condition;
5275 // ----------------------------------------------------------------------------
5276 bool manualContourBaseControler::GetIfCompleteCreation ( )
5280 // ----------------------------------------------------------------------------
5281 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5283 _keyBoardMoving = condition;
5285 // ----------------------------------------------------------------------------
5286 bool manualContourBaseControler::GetKeyBoardMoving( )
5288 return _keyBoardMoving;
5290 // ----------------------------------------------------------------------------
5291 void manualContourBaseControler::CreateNewManualContour(){
5292 _manViewBaseCont->CreateNewContour();
5294 // ----------------------------------------------------------------------------
5295 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5296 return _manViewBaseCont->GetNumberOfPoints();
5298 // ----------------------------------------------------------------------------
5300 //JSTG - 25-02-08 -------------------------------------------------------------
5301 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5302 //return _manViewBaseCont->GetNumberOfPointsSpline();
5303 return _manContModel->GetNumberOfPointsSpline();
5305 // ----------------------------------------------------------------------------
5307 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5308 return _manViewBaseCont->GetVectorPointsXManualContour();
5310 // ----------------------------------------------------------------------------
5311 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5312 return _manViewBaseCont->GetVectorPointsYManualContour();
5314 // ----------------------------------------------------------------------------
5315 void manualContourBaseControler::DeleteContour(){
5316 _manViewBaseCont->DeleteContour();
5317 _manContModel->DeleteAllPoints();
5319 // ----------------------------------------------------------------------------
5320 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5322 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5324 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5325 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5326 _manContModel->DeletePoint(id);
5327 _manViewBaseCont->DeletePoint(id);
5333 // ----------------------------------------------------------------------------
5334 void manualContourBaseControler::Magnet(int x, int y)
5338 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5339 if (GetManualContourModel()!=NULL){
5343 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5344 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5347 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5348 mp->SetPoint(xx,yy,zz);
5350 // GetManualViewBaseContour()->UpdateViewPoint(id);
5356 // ----------------------------------------------------------------------------
5357 void manualContourBaseControler::SetZ(int z)
5361 // ----------------------------------------------------------------------------
5362 int manualContourBaseControler::GetZ()
5366 // ----------------------------------------------------------------------------
5367 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5369 if (GetManualContourModel()!=NULL){
5373 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5374 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5375 GetManualViewBaseContour()->AddPoint();
5376 // GetManualViewBaseContour()->UpdateViewPoint(id);
5379 // ----------------------------------------------------------------------------
5380 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5384 if (GetManualContourModel()!=NULL){
5388 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5389 if (GetManualContourModel()->GetSizeLstPoints()>1){
5390 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5391 GetManualViewBaseContour()->InsertPoint(id);
5392 // GetManualViewBaseContour()->UpdateViewPoint(id);
5394 GetManualContourModel()->AddPoint(xx,yy,zz);
5395 GetManualViewBaseContour()->AddPoint();
5397 // GetManualViewBaseContour()->UpdateViewPoint(id);
5402 // ----------------------------------------------------------------------------
5403 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5404 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5408 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5409 manualPoint *mp = _manContModel->GetManualPoint(id);
5410 mp->SetPoint(xx,yy,zz);
5411 GetManualViewBaseContour()->UpdateViewPoint(id);
5414 // ----------------------------------------------------------------------------
5415 void manualContourBaseControler::SetPointX( int id ,int x ){
5416 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5420 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5421 manualPoint *mp = _manContModel->GetManualPoint(id);
5423 GetManualViewBaseContour()->UpdateViewPoint(id);
5426 // ----------------------------------------------------------------------------
5427 void manualContourBaseControler::SetPointY( int id ,int y ){
5428 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5432 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5433 manualPoint *mp = _manContModel->GetManualPoint(id);
5435 GetManualViewBaseContour()->UpdateViewPoint(id);
5438 // ----------------------------------------------------------------------------
5439 void manualContourBaseControler::SetPointZ( int id ,int z ){
5440 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5444 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5445 manualPoint *mp = _manContModel->GetManualPoint(id);
5447 GetManualViewBaseContour()->UpdateViewPoint(id);
5450 // ----------------------------------------------------------------------------
5451 void manualContourBaseControler::ResetContour() // virtual
5453 this->DeleteContour();
5454 GetManualViewBaseContour()->CreateNewContour();