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->Delete();
614 _cntSplineY->Delete();
615 _cntSplineZ->Delete();
617 // ----------------------------------------------------------------------------
618 int manualContourModel::AddPoint(double x,double y,double z)
620 manualPoint *mp = new manualPoint();
625 return _lstPoints.size()-1;
627 // ----------------------------------------------------------------------------
628 int manualContourModel::InsertPoint(double x,double y,double z)
630 double dd,ddmin=9999999;
635 int i,ii,iii,size=_lstPoints.size();
636 double j,MaxDivisions=20,porcentage;
639 if (_closeContour==false)
646 for ( i=0 ; i<size ; i++ )
650 x1=_lstPoints[ii]->GetX();
651 y1=_lstPoints[ii]->GetY();
652 z1=_lstPoints[ii]->GetZ();
653 x2=_lstPoints[iii]->GetX();
654 y2=_lstPoints[iii]->GetY();
655 z2=_lstPoints[iii]->GetZ();
656 for (j=0; j<=MaxDivisions; j++)
658 porcentage=(j/MaxDivisions);
659 xx=(x2-x1)*porcentage+x1;
660 yy=(y2-y1)*porcentage+y1;
661 zz=(z2-z1)*porcentage+z1;
662 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
672 if (_closeContour==false)
674 if ( (ibak==1) && (jbak==0) )
678 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
685 //JSTG - 25-04-08 ----------------------------------------------------------
686 //manualPoint *mp = new manualPoint();
687 //mp->SetPoint(x,y,z);
688 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
689 //_lstPoints.insert(itNum,mp);
690 InsertPoint_id(ibak,x,y,z);
691 //----------------------------------------------------------------------------
695 // ----------------------------------------------------------------------------
696 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
698 manualPoint *mp = new manualPoint();
700 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
701 _lstPoints.insert(itNum,mp);
703 // ----------------------------------------------------------------------------
705 void manualContourModel::DeletePoint(int i)
707 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
708 _lstPoints.erase(itNum);
710 // ----------------------------------------------------------------------------
711 void manualContourModel::DeleteAllPoints()
713 int i,size=_lstPoints.size();
714 for (i=0;i<size;i++){
715 _lstPoints.erase( _lstPoints.begin() );
717 this->UpdateSpline();
719 // ----------------------------------------------------------------------------
721 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
723 manualPoint *mp=_lstPoints[i];
724 double x=mp->GetX()+dx;
725 double y=mp->GetY()+dy;
726 double z=mp->GetZ()+dz;
729 // ----------------------------------------------------------------------------
730 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
734 // ----------------------------------------------------------------------------
735 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
737 int i,size=_lstPoints.size();
738 for (i=0;i<size;i++){
739 MovePoint(i,dx,dy,dz);
744 // ----------------------------------------------------------------------------
750 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
752 double range = i_range+1;
754 double xx,yy,zz,dd,ddmin=9999999;
756 int i,size=_lstPoints.size();
757 for (i=0;i<size;i++){
758 manualPoint *mp=_lstPoints[i];
765 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
766 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
775 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
776 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
785 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
786 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
795 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
796 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
806 // ----------------------------------------------------------------------------
807 manualPoint* manualContourModel::GetManualPoint(int id)
809 return _lstPoints[id];
811 // ----------------------------------------------------------------------------
812 int manualContourModel::GetSizeLstPoints()
814 return _lstPoints.size();
816 //----------------------------------------------------------------------------
817 int manualContourModel::GetNumberOfPointsSpline()
819 return _sizePointsContour;
821 //----------------------------------------------------------------------------
822 void manualContourModel::SetNumberOfPointsSpline(int size)
824 _sizePointsContour = size;
828 // ----------------------------------------------------------------------------
830 void manualContourModel::SetCloseContour(bool closeContour)
832 _closeContour = closeContour;
833 if (_closeContour==true)
835 _cntSplineX->ClosedOn();
836 _cntSplineY->ClosedOn();
837 _cntSplineZ->ClosedOn();
839 _cntSplineX->ClosedOff();
840 _cntSplineY->ClosedOff();
841 _cntSplineZ->ClosedOff();
845 // ----------------------------------------------------------------------------
846 bool manualContourModel::IfCloseContour()
848 return _closeContour;
851 // ----------------------------------------------------------------------------
853 void manualContourModel::UpdateSpline() // virtual
856 np = _lstPoints.size();
858 _cntSplineX->RemoveAllPoints();
859 _cntSplineY->RemoveAllPoints();
860 _cntSplineZ->RemoveAllPoints();
861 for( i = 0; i < np; i++ ) {
862 mp = GetManualPoint(i);
863 _cntSplineX->AddPoint( i, mp->GetX() );
864 _cntSplineY->AddPoint( i, mp->GetY() );
865 _cntSplineZ->AddPoint( i, mp->GetZ() );
868 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
869 if (this->_closeContour==true)
871 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
873 // _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
874 _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close
876 //-----------------------------------------------------------------------------------------------------------
879 //---------------------------------------------------------------------------------
881 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
883 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
884 double t = delta*(double)i;
885 GetSplinePoint(t, x, y, z);
888 //-----------------------------------------------------------------------------
890 //JSTG 25-02-08 ---------------------------------------------------------------
891 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
893 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
896 // ----------------------------------------------------------------------------
898 //JSTG 25-02-08 ---------------------------------------------------------------
899 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
901 if (_lstPoints.size()==0)
907 if (_lstPoints.size()==1)
910 mp = GetManualPoint(0);
915 if (_lstPoints.size()>=2)
917 *x = _cntSplineX->Evaluate(t);
918 *y = _cntSplineY->Evaluate(t);
919 *z = _cntSplineZ->Evaluate(t);
923 // ----------------------------------------------------------------------------
926 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
928 if (_lstPoints.size()==0)
934 if (_lstPoints.size()==1)
937 mp = GetManualPoint(0);
942 if (_lstPoints.size()>=2)
944 x = _cntSplineX->Evaluate(t);
945 y = _cntSplineY->Evaluate(t);
946 z = _cntSplineZ->Evaluate(t);
949 // ----------------------------------------------------------------------------
950 double manualContourModel::GetPathSize()
956 // JSTG 25-02-08 -----------------------------
960 //--------------------------------------------
962 if (_lstPoints.size()==2)
964 x1=_lstPoints[0]->GetX();
965 y1=_lstPoints[0]->GetY();
966 z1=_lstPoints[0]->GetZ();
967 x2=_lstPoints[1]->GetX();
968 y2=_lstPoints[1]->GetY();
969 z2=_lstPoints[1]->GetZ();
970 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
972 if (_lstPoints.size()>2)
975 // JSTG 25-02-08 ------------------------------------------
976 //np = _lstPoints.size( );
978 //delta=( double ) ( np ) / ( double ) ( nps );
980 //GetSplinePoint(0,x1,y1,z1);
981 GetSpline_i_Point(0,&x1,&y1,&z1);
983 //for( i = 1; i < nps; i++ )
984 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
986 //t = delta * (double)i;
987 //GetSplinePoint(t,x2,y2,z2);
988 GetSpline_i_Point(i,&x2,&y2,&z2);
989 //---------------------------------------------------------
990 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
999 // ----------------------------------------------------------------------------
1000 double manualContourModel::GetPathArea()
1002 double result = 555;
1003 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1006 //JSTG 25-02-08 ---------------------------------------------
1008 //-----------------------------------------------------------
1014 // This uses Green's theorem:
1015 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1016 // A < 0 -> A = |A| (a negative value could raise because points are
1017 // given in clockwise order).
1019 //JSTG 25-02-08 -------------------------------------------------
1020 //int np = _lstPoints.size( );
1022 int nps = GetNumberOfPointsSpline();
1023 //double delta=( double ) ( np ) / ( double ) ( nps );
1025 for( i = 0, area = 0.0; i < nps; i++ )
1027 j = ( i + 1 ) % nps;
1028 //ti = delta * (double)i;
1029 //tj = delta * (double)j;
1030 //GetSplinePoint(ti,x1,y1,z1);
1031 //GetSplinePoint(tj,x2,y2,z2);
1032 GetSpline_i_Point(i,&x1,&y1,&z1);
1033 GetSpline_i_Point(j,&x2,&y2,&z2);
1034 //----------------------------------------------------------------
1044 area = fabs( area );
1047 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1049 j = ( i + 1 ) % _lstPoints.size();
1052 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1053 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1054 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1060 area = fabs( area );
1076 // ----------------------------------------------------------------------------
1077 // p[x,y,z] : data in
1078 // rp[x,y,z] : data out result point
1079 // rn[x,y,z] : data out result normal
1081 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1083 double distMin=999999999;
1084 double dist,dx,dy,dz;
1089 //JSTG 25-02-08 -------------------
1093 //---------------------------------
1095 np = _lstPoints.size( );
1098 // JSTG 25-02-08 ------------------------------------------
1100 nps = GetNumberOfPointsSpline();
1101 //delta = ( double ) ( np ) / ( double ) ( nps );
1103 //GetSplinePoint(0,x1,y1,z1);
1104 GetSpline_i_Point(0,&x1,&y1,&z1);
1105 for( i = 0; i < nps; i++ )
1107 //t = delta * (double)i;
1108 //GetSplinePoint(t,x1,y1,z1);
1109 GetSpline_i_Point(i,&x1,&y1,&z1);
1110 //----------------------------------------------------------
1114 dist = sqrt( dx*dx + dy*dy + dz*dz );
1132 // JSTG 25-02-08 ------------------------------------------
1136 //t = delta * (double)1.0;
1137 //GetSplinePoint(t,x1,y1,z1);
1138 GetSpline_i_Point(i,&x1,&y1,&z1);
1139 //----------------------------------------------------------
1156 // ----------------------------------------------------------------------------
1157 manualContourModel * manualContourModel :: Clone() // virtual
1159 manualContourModel * clone = new manualContourModel();
1160 CopyAttributesTo(clone);
1164 // ----------------------------------------------------------------------------
1165 void manualContourModel::Open(FILE *ff) // virtual
1169 int numberOfControlPoints;
1172 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1173 fscanf(ff,"%s",tmp); // ##
1174 numberOfControlPoints = atoi(tmp);
1175 for (i=0;i<numberOfControlPoints;i++)
1177 fscanf(ff,"%s",tmp); // X
1179 fscanf(ff,"%s",tmp); // Y
1181 fscanf(ff,"%s",tmp); // Z
1188 // ----------------------------------------------------------------------------
1189 int manualContourModel::GetTypeModel() //virtual
1201 // ----------------------------------------------------------------------------
1202 void manualContourModel::Save(FILE *ff) // virtual
1204 int i,size=_lstPoints.size();
1205 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1206 fprintf(ff,"NumberOfControlPoints %d\n",size);
1207 for (i=0;i<size;i++)
1209 manualPoint *mp=_lstPoints[i];
1210 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1215 // ---------------------------------------------------------------------------
1217 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1220 //XXXX::CopyAttributesTo(cloneObject);
1222 cloneObject->SetCloseContour( this->IfCloseContour() );
1223 int i, size = GetSizeLstPoints();
1224 for( i=0; i<size; i++ )
1226 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1228 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1229 cloneObject->SetCloseContour( _closeContour );
1230 cloneObject->UpdateSpline();
1234 // ---------------------------------------------------------------------------
1235 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1237 _lstPoints.push_back( theManualPoint );
1240 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1242 std::vector<manualContourModel*> lstTmp;
1243 lstTmp.push_back(this);
1248 // ---------------------------------------------------------------------------
1249 // ----------------------------------------------------------------------------
1250 // ----------------------------------------------------------------------------
1252 //int manualViewPoint::range=1;
1255 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1257 _posibleSelected = false;
1260 _pointVtkActor = NULL;
1262 _wxvtkbaseview = wxvtkbaseview;
1270 // ----------------------------------------------------------------------------
1271 manualViewPoint::~manualViewPoint(){
1275 // ----------------------------------------------------------------------------
1276 void manualViewPoint::SetWidthLine( double width)
1281 // ----------------------------------------------------------------------------
1282 void manualViewPoint::SetSelected(bool selected){
1285 // ----------------------------------------------------------------------------
1286 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1287 _posibleSelected=posibleSelected;
1289 // ----------------------------------------------------------------------------
1290 bool manualViewPoint::GetSelected(){
1293 // ----------------------------------------------------------------------------
1294 bool manualViewPoint::GetPosibleSelected(){
1295 return _posibleSelected;
1297 // ----------------------------------------------------------------------------
1298 void manualViewPoint::DeleteVtkObjects(){
1299 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1300 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1301 if (_pts !=NULL) { _pts ->Delete(); }
1302 if (_pd !=NULL) { _pd ->Delete(); }
1303 _pointVtkActor = NULL;
1311 // ----------------------------------------------------------------------------
1312 vtkActor* manualViewPoint::CreateVtkPointActor()
1316 _pts = vtkPoints::New();
1317 _pts->SetNumberOfPoints(8);
1318 _pts->SetPoint(0, -1000 , -1000 , 0 );
1319 _pts->SetPoint(1, 1000 , -1000 , 0 );
1320 _pts->SetPoint(2, 1000 , 1000 , 0 );
1321 _pts->SetPoint(3, -1000 , 1000 , 0 );
1322 _pts->SetPoint(4, -1000 , 1000 , 0 );
1323 _pts->SetPoint(5, -1000 , 1000 , 0 );
1324 _pts->SetPoint(6, -1000 , 1000 , 0 );
1325 _pts->SetPoint(7, -1000 , 1000 , 0 );
1327 vtkCellArray *lines = vtkCellArray::New();
1328 lines->InsertNextCell(17);
1329 lines->InsertCellPoint(0);
1330 lines->InsertCellPoint(1);
1331 lines->InsertCellPoint(2);
1332 lines->InsertCellPoint(3);
1333 lines->InsertCellPoint(0);
1334 lines->InsertCellPoint(4);
1335 lines->InsertCellPoint(5);
1336 lines->InsertCellPoint(6);
1337 lines->InsertCellPoint(7);
1338 lines->InsertCellPoint(4);
1339 lines->InsertCellPoint(0);
1340 lines->InsertCellPoint(3);
1341 lines->InsertCellPoint(7);
1342 lines->InsertCellPoint(6);
1343 lines->InsertCellPoint(2);
1344 lines->InsertCellPoint(1);
1345 lines->InsertCellPoint(5);
1347 _pd = vtkPolyData::New();
1348 _pd->SetPoints( _pts );
1349 _pd->SetLines( lines );
1350 lines->Delete(); //do not delete lines ??
1352 _pointVtkActor = vtkActor::New();
1353 _bboxMapper = vtkPolyDataMapper::New();
1355 _bboxMapper->SetInput(_pd);
1356 _bboxMapper->ImmediateModeRenderingOn();
1357 _pointVtkActor->SetMapper(_bboxMapper);
1358 _pointVtkActor->GetProperty()->BackfaceCullingOn();
1360 _pd->ComputeBounds();
1362 return _pointVtkActor;
1364 // ----------------------------------------------------------------------------
1365 vtkActor* manualViewPoint::GetVtkActor(){
1366 return _pointVtkActor;
1368 // ----------------------------------------------------------------------------
1369 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1371 // double range=0.2; // i_range;
1372 // double range=(double)manualViewPoint::range;
1374 double range=i_range;
1379 posZ = posZ * _spc[2];
1382 _pts->SetPoint(0, x-range, y+range, posZ-range);
1383 _pts->SetPoint(1, x+range, y+range, posZ-range);
1384 _pts->SetPoint(2, x+range, y-range, posZ-range);
1385 _pts->SetPoint(3, x-range, y-range, posZ-range);
1386 _pts->SetPoint(4, x-range, y+range, posZ+range);
1387 _pts->SetPoint(5, x+range, y+range, posZ+range);
1388 _pts->SetPoint(6, x+range, y-range, posZ+range);
1389 _pts->SetPoint(7, x-range, y-range, posZ+range);
1394 // ----------------------------------------------------------------------------
1395 void manualViewPoint::UpdateColorActor()
1397 if (_pointVtkActor!=NULL){
1399 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1400 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1401 if (_posibleSelected==true){
1402 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1406 // ----------------------------------------------------------------------------
1407 void manualViewPoint::GetSpacing(double spc[3])
1413 // ----------------------------------------------------------------------------
1414 void manualViewPoint::SetSpacing(double spc[3])
1423 // ----------------------------------------------------------------------------
1424 // ----------------------------------------------------------------------------
1425 // ----------------------------------------------------------------------------
1427 manualViewContour::manualViewContour()
1429 _id_viewPoint_for_text = 0;
1431 _initialConoturModel = new manualContourModel();
1433 // ----------------------------------------------------------------------------
1434 manualViewContour::~manualViewContour()
1436 delete _initialConoturModel;
1438 // ----------------------------------------------------------------------------
1440 // ----------------------------------------------------------------------------
1441 manualViewContour * manualViewContour :: Clone()
1443 manualViewContour * clone = new manualViewContour();
1444 CopyAttributesTo(clone);
1448 // ---------------------------------------------------------------------------
1450 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1452 // Call to Fathers object
1453 manualViewBaseContour::CopyAttributesTo(cloneObject);
1455 cloneObject->SetMesureScale(_mesureScale);
1458 // ---------------------------------------------------------------------------
1460 int manualViewContour::GetType() // virtual
1465 // ----------------------------------------------------------------------------
1467 void manualViewContour::Save(FILE *pFile)
1469 manualViewBaseContour::Save(pFile);
1472 // ----------------------------------------------------------------------------
1474 void manualViewContour::Open(FILE *pFile)
1480 // ----------------------------------------------------------------------------
1481 void manualViewContour::RefreshContour() // virtual
1486 //JSTG 25-02-08 --------------------
1487 //double t,delta, x,y,z;
1489 //----------------------------------
1491 _manContModel->UpdateSpline();
1492 np = GetNumberOfPoints( );
1493 //nps = GetNumberOfPointsSpline();
1494 nps = _manContModel->GetNumberOfPointsSpline();
1495 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1502 for( i = 0; i < nps; i++ )
1504 //JSTG 25-02-08 ------------------------------------------------
1505 //t = delta * (double)i;
1506 //_manContModel->GetSplinePoint(t,x,y,z);
1507 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1508 //--------------------------------------------------------------
1510 // _pts->SetPoint(i, x,y,z );
1511 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1518 _pts->SetPoint(0, 0 , 0 , 0);
1519 _pts->SetPoint(1, 0 , 0 , 0);
1524 // ----------------------------------------------------------------------------
1525 void manualViewContour::RefreshText() // virtual
1528 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1529 int size = GetNumberOfPoints();
1531 char resultText[50];
1532 strcpy(resultText," ");
1535 strcpy(resultText,"L= ");
1536 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1537 strcat(resultText,text);
1541 if (_manContModel->IfCloseContour()==true)
1543 strcpy(resultText,"P= ");
1544 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1545 strcat(resultText,text);
1546 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1547 strcat(resultText," A= ");
1548 strcat(resultText,text);
1550 strcpy(resultText,"L= ");
1551 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1552 strcat(resultText,text);
1556 _textActor->SetInput(resultText);
1561 for (i=0; i<size; i++)
1563 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1565 _id_viewPoint_for_text = i;
1569 int id = _id_viewPoint_for_text;
1570 double px = _manContModel->GetManualPoint(id)->GetX();
1571 double py = _manContModel->GetManualPoint(id)->GetY();
1577 _textActor->SetPosition(px+GetRange()+1,py);
1583 // ----------------------------------------------------------------------------
1584 bool manualViewContour::ifTouchContour(int x,int y,int z){
1592 TransfromeCoordViewWorld(xx,yy,zz);
1599 unsigned int i, nps,nps_t;
1600 nps = _sizePointsContour;
1602 if (this->_manContModel->IfCloseContour()==true)
1610 for( i = 0; i < nps_t; i++ )
1612 _pts->GetPoint(i%nps, ppA);
1613 _pts->GetPoint((i+1)%nps, ppB);
1614 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1615 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1616 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]));
1619 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1629 // ----------------------------------------------------------------------------
1630 void manualViewContour::DeletePoint(int id) // virtual
1632 if (_lstViewPoints.size()>2)
1634 manualViewBaseContour::DeletePoint( id );
1637 // ----------------------------------------------------------------------------
1639 void manualViewContour::ClearPoint(int id)
1641 manualViewBaseContour::DeletePoint( id );
1644 //-------------------------------------------------------------------
1645 void manualViewContour::SetMesureScale(double mesureScale)
1647 _mesureScale = mesureScale;
1649 //-------------------------------------------------------------------
1650 void manualViewContour::InitMove(int x, int y, int z)
1652 _initialConoturModel->DeleteAllPoints();
1654 manualPoint *mp = NULL;
1658 TransfromeCoordViewWorld(XX,YY,ZZ);
1660 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1661 for ( i=0; i<manualPointsSZ; i++ )
1663 mp = _manContModel->GetManualPoint( i );
1664 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1667 //-------------------------------------------------------------------
1668 void manualViewContour::MoveContour(int x, int y, int z)
1670 manualPoint *mpOrigin = NULL;
1671 manualPoint *mpMoving = NULL;
1676 TransfromeCoordViewWorld(XX,YY,ZZ);
1678 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1679 for ( i=0; i<manualPointsSZ; i++ )
1681 mpOrigin = _manContModel->GetManualPoint( i );
1682 mpMoving = _initialConoturModel->GetManualPoint(i);
1683 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1687 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1689 manualPoint *mpOrigin = NULL;
1691 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1692 for ( i=0; i<manualPointsSZ; i++ )
1694 mpOrigin = _manContModel->GetManualPoint( i );
1695 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1699 // ----------------------------------------------------------------------------
1700 // ----------------------------------------------------------------------------
1701 // ----------------------------------------------------------------------------
1704 manualView3VContour::manualView3VContour(int type)
1707 // JSTG 25-02-08 ------------------------------
1708 //_manContModel= new manualContourModel();
1709 //---------------------------------------------
1711 // ----------------------------------------------------------------------------
1712 manualView3VContour::~manualView3VContour()
1718 // ----------------------------------------------------------------------------
1719 manualView3VContour * manualView3VContour :: Clone()
1721 manualView3VContour * clone = new manualView3VContour( GetType() );
1722 CopyAttributesTo(clone);
1726 // ---------------------------------------------------------------------------
1728 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1731 manualViewContour::CopyAttributesTo(cloneObject);
1734 int manualView3VContour::GetType()
1739 // ----------------------------------------------------------------------------
1740 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1755 // ----------------------------------------------------------------------------
1757 void manualView3VContour::RefreshContour() // virtula
1759 manualViewContour::RefreshContour();
1762 // JSTG 25-02-08 ----------------------------------------
1763 //int nps = GetNumberOfPointsSpline();
1764 int nps = _manContModel->GetNumberOfPointsSpline();
1765 //-------------------------------------------------------
1766 for( i = 0; i < nps; i++ )
1768 _pts->GetPoint( i, pp );
1769 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1772 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1777 // ----------------------------------------------------------------------------
1779 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1781 manualPoint *mp = _manContModel->GetManualPoint(id);
1786 FilterCordinateXYZ(x,y,z);
1787 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1790 // ----------------------------------------------------------------------------
1792 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1795 if (_manContModel!=NULL){
1799 TransfromeCoordViewWorld(xx,yy,zz,-1);
1800 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1805 // ----------------------------------------------------------------------------
1806 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1814 TransfromeCoordViewWorld(xx,yy,zz,-1);
1821 unsigned int i, nps,nps_t;
1822 nps = _sizePointsContour;
1823 if (this->_manContModel->IfCloseContour()==true)
1829 FilterCordinateXYZ(xx,yy,zz);
1831 for( i = 0; i < nps_t; i++ ) {
1832 _pts->GetPoint(i%nps, ppA);
1833 _pts->GetPoint((i+1)%nps, ppB);
1834 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1835 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1836 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1837 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1838 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]));
1839 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1846 // ----------------------------------------------------------------------------
1847 // ----------------------------------------------------------------------------
1848 // ----------------------------------------------------------------------------
1849 manualView3DContour::manualView3DContour()
1852 // ----------------------------------------------------------------------------
1853 manualView3DContour::~manualView3DContour()
1857 // ----------------------------------------------------------------------------
1858 manualView3DContour * manualView3DContour :: Clone()
1860 manualView3DContour * clone = new manualView3DContour();
1861 CopyAttributesTo(clone);
1865 // ---------------------------------------------------------------------------
1866 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1869 manualViewContour::CopyAttributesTo(cloneObject);
1871 cloneObject->SetDimensions ( _w , _h , _d );
1873 // ----------------------------------------------------------------------------
1874 void manualView3DContour::SetDimensions(int w, int h, int d)
1880 // ----------------------------------------------------------------------------
1881 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1883 X = _vtkmprbasedata->GetX();
1884 Y = _vtkmprbasedata->GetY();
1885 Z = _vtkmprbasedata->GetZ();
1887 // ----------------------------------------------------------------------------
1888 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1890 _vtkmprbasedata = vtkmprbasedata;
1892 // ----------------------------------------------------------------------------
1893 int manualView3DContour::GetIdPoint2(int x, int y)
1896 double p[3],pA[3],pB[3];
1898 double pickPoint[ 3 ], cameraPos[ 3 ];
1899 vtkPointPicker* picker = vtkPointPicker::New( );
1900 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1901 picker->Pick( x, y, 0.0, pRenderer );
1902 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1903 picker->GetPickPosition( pickPoint );
1906 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1907 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1909 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1911 double dist,distMin=999999999;
1912 int i,size=this->_manContModel->GetSizeLstPoints();
1913 for (i=0;i<size;i++)
1915 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1919 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1920 if ( (dist<=2*GetRange()) && (dist<distMin) )
1929 // ----------------------------------------------------------------------------
1930 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1932 SelectAllPossibleSelected(false);
1933 int id=GetIdPoint2(x,y);
1936 SetPointPosibleSelected(id,true);
1944 // ----------------------------------------------------------------------------
1945 // ----------------------------------------------------------------------------
1946 // ----------------------------------------------------------------------------
1951 // ----------------------------------------------------------------------------
1952 // ----------------------------------------------------------------------------
1953 // ----------------------------------------------------------------------------
1954 manualViewBullEyeSector::manualViewBullEyeSector()
1958 // ----------------------------------------------------------------------------
1959 void manualViewBullEyeSector::RefreshContour()
1964 //----------------------------------
1966 _manContModel->UpdateSpline();
1967 nps = _manContModel->GetNumberOfPointsSpline();
1971 for( i = 0; i < nps; i++ )
1973 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1974 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1980 // ----------------------------------------------------------------------------
1981 // ----------------------------------------------------------------------------
1982 // ----------------------------------------------------------------------------
1985 manualViewBullEye::manualViewBullEye()
1989 // ----------------------------------------------------------------------------
1990 manualViewBullEye::~manualViewBullEye()
1993 int i,size=lstSectorBullEye.size();
1994 for (i=0;i<size;i++)
1996 delete lstSectorBullEye[i];
1998 lstSectorBullEye.clear();
2002 // ----------------------------------------------------------------------------
2003 manualViewBullEye * manualViewBullEye :: Clone()
2005 manualViewBullEye * clone = new manualViewBullEye();
2006 CopyAttributesTo(clone);
2010 // ---------------------------------------------------------------------------
2012 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2015 manualViewBaseContour::CopyAttributesTo(cloneObject);
2019 // ----------------------------------------------------------------------------
2020 int manualViewBullEye::GetType() // virtual
2026 // ----------------------------------------------------------------------------
2027 void manualViewBullEye::RefreshContour() // virtual
2029 // External Rectangle
2030 manualViewRoi::RefreshContour();
2032 _manContModel->UpdateSpline();
2033 int np = GetNumberOfPoints( );
2034 // Refres sectors of BullEye(s)
2038 int i,size = lstSectorBullEye.size();
2039 for (i=0;i<size;i++)
2041 lstSectorBullEye[i]->RefreshContour();
2048 // ----------------------------------------------------------------------------
2049 void manualViewBullEye::ConstructVTKObjects() // virtual
2051 manualViewRoi::ConstructVTKObjects();
2054 this->GetSpacing(spc);
2055 manualViewBullEyeSector *mvbc;
2056 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2057 int i,size = mcmbe->GetSizeOfSectorLst();
2058 for ( i=0 ; i<size ; i++ )
2060 mvbc = new manualViewBullEyeSector();
2061 mvbc->SetModel( mcmbe->GetModelSector(i) );
2062 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2063 mvbc->SetRange( 2 );
2065 mvbc->SetSpacing(spc);
2066 mvbc->SetColorNormalContour(1, 0, 0);
2067 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2068 // mvbc->SetColorSelectContour(1, 0.8, 0);
2069 mvbc->SetWidthLine( this->GetWidthLine() );
2071 mvbc->ConstructVTKObjects();
2072 lstSectorBullEye.push_back( mvbc );
2078 // ----------------------------------------------------------------------------
2079 void manualViewBullEye::AddSplineActor() // virtual
2081 manualViewRoi::AddSplineActor();
2082 int i,size=lstSectorBullEye.size();
2083 for (i=0;i<size;i++)
2085 lstSectorBullEye[i]->AddSplineActor();
2089 // ----------------------------------------------------------------------------
2090 void manualViewBullEye::RemoveSplineActor() // virtual
2092 manualViewRoi::RemoveSplineActor();
2093 int i,size=lstSectorBullEye.size();
2094 for (i=0;i<size;i++)
2096 lstSectorBullEye[i]->RemoveSplineActor();
2101 // ----------------------------------------------------------------------------
2102 // ----------------------------------------------------------------------------
2103 // ----------------------------------------------------------------------------
2105 manualViewRoi::manualViewRoi()
2107 _sizePointsContour=5;
2109 // ----------------------------------------------------------------------------
2110 manualViewRoi::~manualViewRoi()
2115 // ----------------------------------------------------------------------------
2116 manualViewRoi * manualViewRoi :: Clone()
2118 manualViewRoi * clone = new manualViewRoi();
2119 CopyAttributesTo(clone);
2123 // ---------------------------------------------------------------------------
2125 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2128 manualViewBaseContour::CopyAttributesTo(cloneObject);
2131 // ----------------------------------------------------------------------------
2132 void manualViewRoi::RefreshContour() // virtual
2134 unsigned int i,ii, np;
2135 np = GetNumberOfPoints( );
2142 for( i = 0; i < np+1; i++ ) {
2144 mp = _manContModel->GetManualPoint(ii);
2147 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2148 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2149 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2152 // _pts->SetPoint(i, XX,YY,ZZ );
2153 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2157 _pts->SetPoint(0, 0 , 0 , 0);
2158 _pts->SetPoint(1, 0 , 0 , 0);
2163 // ----------------------------------------------------------------------------
2164 int manualViewRoi::GetType() // virtual
2169 // ----------------------------------------------------------------------------
2171 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2182 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2184 for( i = 0; i < size; i++ )
2187 mp=_manContModel->GetManualPoint(i);
2222 // ----------------------------------------------------------------------------
2225 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2228 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2230 GetMinMax(px1,py1, px2, py2);
2235 TransfromeCoordViewWorld(xx,yy,zz);
2239 double ddx=GetRange();
2240 double ddy=GetRange();
2242 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2247 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2252 if ((ok1==true) && (ok2==false))
2260 // ----------------------------------------------------------------------------
2262 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2268 TransfromeCoordViewWorld(XX,YY,ZZ);
2270 if (_manContModel->GetSizeLstPoints()==4){
2271 mp = _manContModel->GetManualPoint(0);
2272 _dp0[0]= mp->GetX() - XX;
2273 _dp0[1]= mp->GetY() - YY;
2274 _dp0[2]= mp->GetZ();
2276 mp = _manContModel->GetManualPoint(1);
2277 _dp1[0]= mp->GetX() - XX;
2278 _dp1[1]= mp->GetY() - YY;
2279 _dp1[2]= mp->GetZ();
2281 mp = _manContModel->GetManualPoint(2);
2282 _dp2[0]= mp->GetX() - XX;
2283 _dp2[1]= mp->GetY() - YY;
2284 _dp2[2]= mp->GetZ();
2286 mp = _manContModel->GetManualPoint(3);
2287 _dp3[0]= mp->GetX() - XX;
2288 _dp3[1]= mp->GetY() - YY;
2289 _dp3[2]= mp->GetZ();
2293 // ----------------------------------------------------------------------------
2295 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2301 TransfromeCoordViewWorld(XX,YY,ZZ);
2303 mp = _manContModel->GetManualPoint(0);
2304 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2306 mp = _manContModel->GetManualPoint(1);
2307 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2309 mp = _manContModel->GetManualPoint(2);
2310 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2312 mp = _manContModel->GetManualPoint(3);
2313 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2324 // ----------------------------------------------------------------------------
2325 // ----------------------------------------------------------------------------
2326 // ----------------------------------------------------------------------------
2330 manualViewCircle::manualViewCircle()
2332 // _sizePointsContour=5; // default 100
2334 // ----------------------------------------------------------------------------
2335 manualViewCircle::~manualViewCircle()
2340 // ----------------------------------------------------------------------------
2341 manualViewCircle * manualViewCircle :: Clone()
2343 manualViewCircle * clone = new manualViewCircle();
2344 CopyAttributesTo(clone);
2348 // ---------------------------------------------------------------------------
2350 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2353 manualViewBaseContour::CopyAttributesTo(cloneObject);
2357 // ----------------------------------------------------------------------------
2359 void manualViewCircle::RefreshContour(){ // virtual
2361 manualPoint *mpA,*mpB;
2362 unsigned int i, np,nps;
2366 np = GetNumberOfPoints( );
2367 nps = _manContModel->GetNumberOfPointsSpline();
2368 double deltaAngle=(3.14159265*2)/(nps-1);
2373 mpA = _manContModel->GetManualPoint(0);
2374 mpB = _manContModel->GetManualPoint(1);
2375 difX = mpA->GetX() - mpB->GetX();
2376 difY = mpA->GetY() - mpB->GetY();
2377 radio = sqrt( difX*difX + difY*difY );
2378 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2379 manContModelCir->SetRadio(radio);
2381 for( i = 0; i < nps; i++ ) {
2382 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2383 // angle = deltaAngle*i;
2384 // XX = cos(angle)*radio+mpA->GetX();
2385 // YY = sin(angle)*radio+mpA->GetY();
2387 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2390 _pts->SetPoint(0, 0 , 0 , 0);
2391 _pts->SetPoint(1, 0 , 0 , 0);
2397 // ----------------------------------------------------------------------------
2398 int manualViewCircle::GetType() // virtual
2403 // ----------------------------------------------------------------------------
2405 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2407 manualPoint *mpA,*mpB;
2411 np = GetNumberOfPoints( );
2414 mpA = _manContModel->GetManualPoint(0);
2415 mpB = _manContModel->GetManualPoint(1);
2416 difX = mpA->GetX() - mpB->GetX();
2417 difY = mpA->GetY() - mpB->GetY();
2418 radio = sqrt( difX*difX + difY*difY );
2419 minX=mpA->GetX()-radio;
2420 minY=mpA->GetY()-radio;
2421 maxX=mpA->GetX()+radio;
2422 maxY=mpA->GetY()+radio;
2432 // ----------------------------------------------------------------------------
2433 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2436 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2438 GetMinMax(px1,py1, px2, py2);
2443 TransfromeCoordViewWorld(xx,yy,zz);
2447 double ddx=GetRange();
2448 double ddy=GetRange();
2450 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2455 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2460 if ((ok1==true) && (ok2==false))
2469 // ----------------------------------------------------------------------------
2471 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2477 TransfromeCoordViewWorld(XX,YY,ZZ);
2479 if (_manContModel->GetSizeLstPoints()==2){
2480 mp = _manContModel->GetManualPoint(0);
2481 _dp0[0]= mp->GetX() - XX;
2482 _dp0[1]= mp->GetY() - YY;
2483 _dp0[2]= mp->GetZ();
2485 mp = _manContModel->GetManualPoint(1);
2486 _dp1[0]= mp->GetX() - XX;
2487 _dp1[1]= mp->GetY() - YY;
2488 _dp1[2]= mp->GetZ();
2490 mp = _manContModel->GetManualPoint(2);
2491 _dp2[0]= mp->GetX() - XX;
2492 _dp2[1]= mp->GetY() - YY;
2493 _dp2[2]= mp->GetZ();
2495 mp = _manContModel->GetManualPoint(3);
2496 _dp3[0]= mp->GetX() - XX;
2497 _dp3[1]= mp->GetY() - YY;
2498 _dp3[2]= mp->GetZ();
2504 // ----------------------------------------------------------------------------
2505 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2511 TransfromeCoordViewWorld(XX,YY,ZZ);
2513 mp = _manContModel->GetManualPoint(0);
2514 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2516 mp = _manContModel->GetManualPoint(1);
2517 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2519 // mp = _manContModel->GetManualPoint(2);
2520 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2522 // mp = _manContModel->GetManualPoint(3);
2523 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2527 // UpdateViewPoint(2);
2528 // UpdateViewPoint(3);
2534 // ----------------------------------------------------------------------------
2535 // ----------------------------------------------------------------------------
2536 // ----------------------------------------------------------------------------
2540 manualViewLine::manualViewLine()
2542 _sizePointsContour=20;
2544 // ----------------------------------------------------------------------------
2545 manualViewLine::~manualViewLine()
2550 // ----------------------------------------------------------------------------
2551 manualViewLine * manualViewLine :: Clone()
2553 manualViewLine * clone = new manualViewLine();
2554 CopyAttributesTo(clone);
2558 // ---------------------------------------------------------------------------
2560 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2563 manualViewBaseContour::CopyAttributesTo(cloneObject);
2566 // ----------------------------------------------------------------------------
2567 int manualViewLine::GetType() // virtual
2573 // ----------------------------------------------------------------------------
2575 void manualViewLine::InitMove(int x, int y, int z) // virtual
2581 TransfromeCoordViewWorld(XX,YY,ZZ);
2583 if (_manContModel->GetSizeLstPoints()==2)
2585 mp = _manContModel->GetManualPoint(0);
2586 _dp0[0]= mp->GetX() - XX;
2587 _dp0[1]= mp->GetY() - YY;
2588 _dp0[2]= mp->GetZ();
2590 mp = _manContModel->GetManualPoint(1);
2591 _dp1[0]= mp->GetX() - XX;
2592 _dp1[1]= mp->GetY() - YY;
2593 _dp1[2]= mp->GetZ();
2599 // ----------------------------------------------------------------------------
2600 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2606 TransfromeCoordViewWorld(XX,YY,ZZ);
2608 mp = _manContModel->GetManualPoint(0);
2609 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2611 mp = _manContModel->GetManualPoint(1);
2612 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2620 // ----------------------------------------------------------------------------
2621 // ----------------------------------------------------------------------------
2622 // ----------------------------------------------------------------------------
2625 manualViewBaseContour::manualViewBaseContour()
2629 _manContModel = NULL;
2630 _wxvtkbaseview = NULL;
2632 _posibleSelected = false;
2633 _viewControlPoints = false;
2636 _contourVtkActor = NULL;
2639 _sizePointsContour = 100;
2648 _coulorNormal_r = 1;
2649 _coulorNormal_g = 0;
2650 _coulorNormal_b = 1;
2652 _coulorSelection_r = 0;
2653 _coulorSelection_g = 1;
2654 _coulorSelection_b = 0;
2659 // ----------------------------------------------------------------------------
2660 manualViewBaseContour::~manualViewBaseContour()
2662 int i,size=_lstViewPoints.size();
2663 for (i=0;i<size; i++){
2664 delete _lstViewPoints[i];
2666 _lstViewPoints.clear();
2668 // ----------------------------------------------------------------------------
2671 int manualViewBaseContour::GetType() // virtual
2674 //int manualViewBaseContour::GetType() 0;
2675 //int manualViewContour::GetType() 1;
2676 //int manualViewRoi::GetType() 2;
2677 //int manualViewCircle::GetType() 3;
2678 //int manualViewStar::GetType() 4;
2679 //int manualViewLine::GetType() 6;
2684 // ----------------------------------------------------------------------------
2686 void manualViewBaseContour::Save(FILE *pFile)
2688 fprintf(pFile,"TypeView %d\n", GetType() );
2691 // ----------------------------------------------------------------------------
2692 void manualViewBaseContour::Open(FILE *pFile)
2696 // ----------------------------------------------------------------------------
2697 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2699 _viewControlPoints = ifControlPoints;
2700 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2705 //Adding each control point
2706 if( ifControlPoints )
2711 // ---------------------------------------------------------------------------
2713 void manualViewBaseContour :: RemoveCompleteContourActor()
2715 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2716 //Removing the spline
2717 RemoveSplineActor();
2720 //Removing each point
2721 RemoveControlPoints();
2725 // ---------------------------------------------------------------------------
2726 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2728 manualViewBaseContour * clone = new manualViewBaseContour();
2729 CopyAttributesTo(clone);
2734 // ---------------------------------------------------------------------------
2736 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2739 //XXXX::CopyAttributesTo(cloneObject);
2741 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2742 cloneObject-> SetSelected( this->GetSelected() );
2743 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2744 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2745 cloneObject-> SetRange( this->GetRange() );
2746 cloneObject-> SetZ( this->GetZ() );
2747 cloneObject-> SetSpacing( _spc );
2748 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2749 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2750 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2752 int i, size = _lstViewPoints.size();
2753 for ( i=0; i<size; i++ )
2755 cloneObject->AddPoint( );
2759 // ----------------------------------------------------------------------------
2760 void manualViewBaseContour :: AddSplineActor()
2762 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2763 if (_contourVtkActor!=NULL)
2764 theRenderer->AddActor( _contourVtkActor );
2766 // ----------------------------------------------------------------------------
2767 void manualViewBaseContour :: RemoveSplineActor() // virtual
2769 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2770 if (_contourVtkActor!=NULL)
2771 theRenderer->RemoveActor( _contourVtkActor );
2773 // ----------------------------------------------------------------------------
2774 void manualViewBaseContour :: RemoveControlPoints()
2776 if (_wxvtkbaseview!=NULL){
2777 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2778 int i,size=_lstViewPoints.size();
2779 for (i=0;i<size; i++)
2781 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2782 theRenderer->RemoveActor( pointActor );
2785 SetIfViewControlPoints( false );
2787 // ----------------------------------------------------------------------------
2788 void manualViewBaseContour::AddControlPoints()
2790 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2791 SetIfViewControlPoints( true );
2792 if( _viewControlPoints )
2794 int i,size=_lstViewPoints.size();
2795 for (i=0;i<size; i++)
2797 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2798 theRenderer->AddActor( pointActor );
2802 // ----------------------------------------------------------------------------
2803 void manualViewBaseContour::AddTextActor()
2805 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2807 // ----------------------------------------------------------------------------
2808 void manualViewBaseContour::RemoveTextActor()
2810 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2812 // ----------------------------------------------------------------------------
2813 void manualViewBaseContour::DeleteVtkObjects()
2815 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2816 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2817 if ( _pts != NULL ) { _pts -> Delete(); }
2818 if ( _pd != NULL ) { _pd -> Delete(); }
2819 _contourVtkActor = NULL;
2826 // ----------------------------------------------------------------------------
2827 void manualViewBaseContour::SetWidthLine(double width)
2830 this->UpdateColorActor();
2832 // for the control points
2833 int id, size = _lstViewPoints.size();
2834 for( id=0; id<size; id++)
2836 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2841 // ----------------------------------------------------------------------------
2842 double manualViewBaseContour::GetWidthLine()
2847 // ----------------------------------------------------------------------------
2848 void manualViewBaseContour::ConstructVTKObjects()
2850 //JSTG 29-02-08 -----------------------------------------------
2851 //int i , nps = _sizePointsContour;
2853 int nps = _manContModel->GetNumberOfPointsSpline();
2854 //-------------------------------------------------------------
2856 _pts = vtkPoints::New();
2857 _pts->SetNumberOfPoints(nps);
2859 for (i=0 ; i<nps ; i++){
2860 _pts->SetPoint(i, 0 , 0 , 0 );
2862 // This is for the boundaring inicialisation
2865 _pts->SetPoint(0, 0 , 0 , -1000 );
2866 _pts->SetPoint(1, 0 , 0 , 1000 );
2867 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2868 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2871 vtkCellArray *lines = vtkCellArray::New();
2872 lines->InsertNextCell( nps /* +1 */ );
2873 for ( i=0 ; i<nps+1 ; i++ ){
2874 lines->InsertCellPoint(i % nps );
2877 _pd = vtkPolyData::New();
2878 _pd->SetPoints( _pts );
2879 _pd->SetLines( lines );
2880 lines->Delete(); //do not delete lines ??
2882 _contourVtkActor = vtkActor::New();
2883 _bboxMapper = vtkPolyDataMapper::New();
2884 _bboxMapper->ScalarVisibilityOff( );
2886 _bboxMapper->SetInput(_pd);
2887 _bboxMapper->ImmediateModeRenderingOn();
2888 _contourVtkActor->SetMapper(_bboxMapper);
2889 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2893 _pd->ComputeBounds();
2896 _textActor = vtkTextActor::New();
2897 // _textActor->SetDisplayPosition(200, 200);
2898 _textActor->SetInput("");
2899 // Set coordinates to match the old vtkScaledTextActor default value
2900 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2901 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2902 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2903 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2905 vtkTextProperty *tprop = _textActor->GetTextProperty();
2906 tprop->SetFontSize(14);
2907 tprop->SetFontFamilyToArial();
2908 tprop->SetColor(0, 0, 1);
2910 // ----------------------------------------------------------------------------
2911 void manualViewBaseContour::CreateNewContour()
2913 ConstructVTKObjects();
2915 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2916 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2917 AddCompleteContourActor();
2919 // ----------------------------------------------------------------------------
2920 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2922 manualPoint *mp = _manContModel->GetManualPoint(id);
2925 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2926 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2927 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2929 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2932 // ----------------------------------------------------------------------------
2933 void manualViewBaseContour::UpdateViewPoints()
2935 int id, size = _lstViewPoints.size();
2936 for( id=0; id<size; id++)
2938 UpdateViewPoint( id );
2942 // ----------------------------------------------------------------------------
2943 void manualViewBaseContour::AddPoint()
2945 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2948 // ----------------------------------------------------------------------------
2949 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2951 _lstViewPoints.push_back( manualViewPoint );
2954 manualViewPoint->SetSpacing(_spc);
2956 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2957 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2960 // ----------------------------------------------------------------------------
2961 void manualViewBaseContour::InsertPoint(int id)
2963 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2966 mvp->SetSpacing(_spc);
2968 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2969 _lstViewPoints.insert(itNum,mvp);
2970 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
2972 // ----------------------------------------------------------------------------
2973 void manualViewBaseContour::DeleteContour()
2975 RemoveCompleteContourActor();
2976 /*if (_contourVtkActor!=NULL){
2977 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
2980 int i,size=_lstViewPoints.size();
2981 for (i=0;i<size;i++){
2982 manualViewBaseContour::DeletePoint(0);
2986 // ----------------------------------------------------------------------------
2987 void manualViewBaseContour::DeletePoint(int id) // virtual
2989 int size=_lstViewPoints.size();
2990 if ( (id>=0) && (id<size) ){
2991 manualViewPoint *mvp =_lstViewPoints[id];
2993 // _handlePicker->DeletePickList(mvp->GetVtkActor());
2994 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
2995 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2996 _lstViewPoints.erase(itNum);
3001 // ----------------------------------------------------------------------------
3002 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3004 int id=GetIdPoint(x,y,z);
3009 // ----------------------------------------------------------------------------
3010 void manualViewBaseContour::SetSelected(bool selected)
3014 // ----------------------------------------------------------------------------
3015 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3017 _posibleSelected=posibleSelected;
3019 // ----------------------------------------------------------------------------
3020 bool manualViewBaseContour::GetEditable()
3024 // ----------------------------------------------------------------------------
3025 void manualViewBaseContour::SetEditable( bool * condition )
3027 _editable = condition;
3029 // ----------------------------------------------------------------------------
3030 bool manualViewBaseContour::GetSelected()
3034 // ----------------------------------------------------------------------------
3035 bool manualViewBaseContour::GetPosibleSelected()
3037 return _posibleSelected;
3039 // ----------------------------------------------------------------------------
3040 void manualViewBaseContour::DeleteSelectedPoints()
3042 int i,size=_lstViewPoints.size();
3043 for (i=size-1;i>=0;i--){
3044 if (_lstViewPoints[i]->GetSelected()==true){
3050 // ----------------------------------------------------------------------------
3051 void manualViewBaseContour::SelectPoint(int i, bool select)
3053 _lstViewPoints[i]->SetSelected(select);
3055 // ----------------------------------------------------------------------------
3056 void manualViewBaseContour::SelectLstPoints()
3060 // ----------------------------------------------------------------------------
3061 void manualViewBaseContour::SelectAllPoints(bool select)
3063 int i,size=_lstViewPoints.size();
3064 for (i=0;i<size;i++){
3065 SelectPoint(i,select);
3068 //-----------------------------------------------------------------------------
3069 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3071 _viewControlPoints = ifShow;
3073 // ----------------------------------------------------------------------------
3074 bool manualViewBaseContour:: GetIfViewControlPoints()
3076 return _viewControlPoints;
3079 // ----------------------------------------------------------------------------
3080 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3082 _lstViewPoints[id]->SetPosibleSelected(select);
3084 // ----------------------------------------------------------------------------
3085 void manualViewBaseContour::SetPointSelected(int id,bool select)
3087 _lstViewPoints[id]->SetSelected(select);
3089 // ----------------------------------------------------------------------------
3090 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3092 int i,size=_lstViewPoints.size();
3093 for (i=0;i<size;i++){
3094 SetPointPosibleSelected(i,select);
3097 // ----------------------------------------------------------------------------
3098 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3100 SelectAllPossibleSelected(false);
3102 int id = GetIdPoint(x,y,z);
3105 SetPointPosibleSelected(id,true);
3109 // ----------------------------------------------------------------------------
3110 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3113 SetPosibleSelected(result);
3114 int id = GetIdPoint(x,y,z);
3115 if( !GetEditable() && !_selected && id!= -1)
3118 SetPosibleSelected(result);
3122 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3124 if (ifTouchContour(x,y,z)==true)
3127 SetPosibleSelected(result);
3131 if (GetEditable()==false)
3133 if (ifTouchContour(x,y,z)==true)
3136 SetPosibleSelected(result);
3144 // ----------------------------------------------------------------------------
3145 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3149 // ----------------------------------------------------------------------------
3150 void manualViewBaseContour::UnSelectPoint(int i){
3151 _lstViewPoints[i]->SetSelected(false);
3154 // ----------------------------------------------------------------------------
3155 void manualViewBaseContour::UnSelectLstPoints(){
3158 // ----------------------------------------------------------------------------
3159 void manualViewBaseContour::UnSelectAllPoints(){
3160 int i,size=_lstViewPoints.size();
3161 for (i=0;i<size;i++){
3166 // ----------------------------------------------------------------------------
3167 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3168 _manContModel=manContModel;
3170 // ----------------------------------------------------------------------------
3171 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3172 _wxvtkbaseview = wxvtkbaseview;
3174 // ----------------------------------------------------------------------------
3175 void manualViewBaseContour::RefreshContour() // Virtual
3178 // ----------------------------------------------------------------------------
3179 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3181 int i,size = _sizePointsContour;
3182 double *vx = (double*)malloc(sizeof(double)*size);
3183 for (i=0;i<size;i++){
3184 _pts->GetPoint(i,pp);
3189 // ----------------------------------------------------------------------------
3190 double* manualViewBaseContour::GetVectorPointsYManualContour()
3193 int i,size = _sizePointsContour;
3194 double *vy = (double*)malloc(sizeof(double)*size);
3195 for (i=0;i<size;i++){
3196 _pts->GetPoint(i,pp);
3201 // ----------------------------------------------------------------------------
3202 double* manualViewBaseContour::GetVectorPointsZManualContour()
3205 int i,size = _sizePointsContour;
3206 double *vz = (double*)malloc(sizeof(double)*size);
3207 for (i=0;i<size;i++){
3208 _pts->GetPoint(i,pp);
3213 // ----------------------------------------------------------------------------
3214 void manualViewBaseContour::Refresh() // virtual
3216 if (_contourVtkActor!=NULL){
3219 int i,size=_lstViewPoints.size();
3220 for (i=0;i<size;i++){
3222 _lstViewPoints[i]->UpdateColorActor();
3226 if (_show_text==true)
3231 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3234 _wxvtkbaseview->GetRenWin()->Render();
3238 // ----------------------------------------------------------------------------
3239 void manualViewBaseContour::RefreshText() // virtual
3241 if( _textActor!=NULL)
3242 _textActor -> SetInput(" ");
3244 // ----------------------------------------------------------------------------
3245 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3247 _coulorNormal_r = r;
3248 _coulorNormal_g = g;
3249 _coulorNormal_b = b;
3251 // ----------------------------------------------------------------------------
3252 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3254 r = _coulorNormal_r;
3255 g = _coulorNormal_g;
3256 b = _coulorNormal_b;
3258 // ----------------------------------------------------------------------------
3259 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3265 // ----------------------------------------------------------------------------
3266 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3272 // ----------------------------------------------------------------------------
3273 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3275 _coulorSelection_r = r;
3276 _coulorSelection_g = g;
3277 _coulorSelection_b = b;
3279 // ----------------------------------------------------------------------------
3280 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3282 r = _coulorSelection_r;
3283 g = _coulorSelection_g;
3284 b = _coulorSelection_b;
3286 // ----------------------------------------------------------------------------
3287 void manualViewBaseContour::UpdateColorActor()
3289 if (_contourVtkActor!=NULL)
3291 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3292 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3293 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3295 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3299 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3303 // ----------------------------------------------------------------------------
3304 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3307 if (_manContModel!=NULL){
3311 TransfromeCoordViewWorld(xx,yy,zz);
3312 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3317 // ----------------------------------------------------------------------------
3320 int manualViewBaseContour::GetNumberOfPoints()
3322 return _lstViewPoints.size();
3325 // ----------------------------------------------------------------------------
3327 //JSTG 25-02-08 ---------------------------------------------------------------
3328 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3330 return _sizePointsContour;
3332 //----------------------------------------------------------------------------
3334 //JSTG 25-02-08 ---------------------------------------------------------------
3335 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3337 _sizePointsContour = size;
3339 //----------------------------------------------------------------------------
3341 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3343 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3348 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3349 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3352 // ----------------------------------------------------------------------------
3353 void manualViewBaseContour::SetRange(int range)
3357 // ----------------------------------------------------------------------------
3358 int manualViewBaseContour::GetRange()
3362 // ----------------------------------------------------------------------------
3363 void manualViewBaseContour::SetZ(int z)
3367 // ----------------------------------------------------------------------------
3368 int manualViewBaseContour::GetZ()
3373 // ----------------------------------------------------------------------------
3374 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3378 // ----------------------------------------------------------------------------
3379 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3382 // ----------------------------------------------------------------------------
3383 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3387 // ----------------------------------------------------------------------------
3388 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3393 int size=_manContModel->GetSizeLstPoints();
3398 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3404 for( i = 0; i < size; i++ )
3406 mp=_manContModel->GetManualPoint(i);
3458 // ----------------------------------------------------------------------------
3459 void manualViewBaseContour::ClearContour()
3461 if (_contourVtkActor!=NULL){
3462 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3465 int i,size=_lstViewPoints.size();
3466 for (i=0;i<size;i++){
3471 // ----------------------------------------------------------------------------
3472 void manualViewBaseContour::ClearPoint(int id)
3476 // ----------------------------------------------------------------------------
3477 void manualViewBaseContour::SetVisible(bool ok)
3488 int i,size=_lstViewPoints.size();
3489 for (i=0;i<size;i++){
3490 actor = _lstViewPoints[i]->GetVtkActor();
3491 actor->GetProperty()->SetOpacity( opacity );
3493 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3494 _textActor->GetProperty()->SetOpacity( opacity );
3495 _textActor->SetInput(" ");
3498 // ----------------------------------------------------------------------------
3499 void manualViewBaseContour::SetShowText(bool ok)
3502 if (_show_text==false)
3504 _textActor->SetInput(" ");
3507 // ----------------------------------------------------------------------------
3508 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3510 return this->_wxvtkbaseview;
3512 // ----------------------------------------------------------------------------
3513 void manualViewBaseContour::GetSpacing(double spc[3])
3519 // ----------------------------------------------------------------------------
3520 void manualViewBaseContour::SetSpacing(double spc[3])
3528 // ----------------------------------------------------------------------------
3529 // ----------------------------------------------------------------------------
3530 // ----------------------------------------------------------------------------
3532 // _type = 0 Sagital
3533 // _type = 1 Coronal
3535 // _type = -1 View 3D
3537 manualContour3VControler::manualContour3VControler(int type)
3542 // _manViewBaseCont1 = NULL;
3543 // _manViewBaseCont2 = NULL;
3544 // _manViewBaseCont3 = NULL;
3546 //----------------------------------------------------------------------------
3547 manualContour3VControler::~manualContour3VControler()
3551 // ----------------------------------------------------------------------------
3552 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3554 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3555 CopyAttributesTo(clone);
3559 // ---------------------------------------------------------------------------
3560 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3563 manualContourControler::CopyAttributesTo(cloneObject);
3565 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3567 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3570 // ----------------------------------------------------------------------------
3571 int manualContour3VControler::GetType()
3576 // ----------------------------------------------------------------------------
3577 void manualContour3VControler::AddPoint_Others()
3579 manualViewBaseContour *mvbc;
3580 int i,size=this->_lstManualViewBaseContour.size();
3581 for ( i = 0 ; i < size ; i++ )
3583 mvbc = _lstManualViewBaseContour[i];
3588 // if (_manViewBaseCont1!=NULL){
3589 // _manViewBaseCont1->AddPoint();
3590 // _manViewBaseCont2->AddPoint();
3591 // _manViewBaseCont3->AddPoint();
3592 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3595 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3597 // ----------------------------------------------------------------------------
3598 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3601 z=(int)_vtkmprbasedata->GetZ();
3602 if (GetManualContourModel()!=NULL){
3606 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3610 xx=_vtkmprbasedata->GetX();
3615 yy=_vtkmprbasedata->GetY();
3619 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3620 GetManualViewBaseContour()->AddPoint();
3626 // ----------------------------------------------------------------------------
3627 void manualContour3VControler::InsertPoint_Others(int id)
3630 manualViewBaseContour *mvbc;
3631 int i,size=this->_lstManualViewBaseContour.size();
3632 for ( i = 0 ; i < size ; i++ )
3634 mvbc = _lstManualViewBaseContour[i];
3635 mvbc->InsertPoint(id);
3639 if (_manViewBaseCont1!=NULL){
3640 _manViewBaseCont1->InsertPoint(id);
3641 _manViewBaseCont2->InsertPoint(id);
3642 _manViewBaseCont3->InsertPoint(id);
3643 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3647 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3650 // ----------------------------------------------------------------------------
3651 void manualContour3VControler::InsertPoint(int x, int y, int z)
3654 if (GetManualContourModel()!=NULL){
3655 if (GetManualContourModel()->GetSizeLstPoints()>1){
3656 z=(int)_vtkmprbasedata->GetZ();
3660 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3663 xx=_vtkmprbasedata->GetX();
3668 yy=_vtkmprbasedata->GetY();
3671 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3673 GetManualViewBaseContour()->InsertPoint(id);
3674 InsertPoint_Others(0);
3681 // ----------------------------------------------------------------------------
3685 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3686 manualViewBaseContour *manViewBaseCont0,
3687 manualViewBaseContour *manViewBaseCont1,
3688 manualViewBaseContour *manViewBaseCont2,
3689 manualViewBaseContour *manViewBaseCont3)
3691 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3692 _manViewBaseCont1 = manViewBaseCont1;
3693 _manViewBaseCont2 = manViewBaseCont2;
3694 _manViewBaseCont3 = manViewBaseCont3;
3698 // ----------------------------------------------------------------------------
3699 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3701 _lstManualViewBaseContour.push_back( manViewBaseCont );
3704 // ----------------------------------------------------------------------------
3705 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3707 _vtkmprbasedata=vtkmprbasedata;
3709 // ----------------------------------------------------------------------------
3710 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3712 return _vtkmprbasedata;
3714 // ----------------------------------------------------------------------------
3715 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3717 z=(int)_vtkmprbasedata->GetZ();
3718 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3722 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3726 xx=_vtkmprbasedata->GetX();
3730 yy=_vtkmprbasedata->GetY();
3733 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3734 mp->SetPoint(xx,yy,zz);
3738 // ----------------------------------------------------------------------------
3739 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3741 manualViewBaseContour *mvbc;
3742 int i,size=this->_lstManualViewBaseContour.size();
3743 for ( i = 0 ; i < size ; i++ )
3745 mvbc = _lstManualViewBaseContour[i];
3746 mvbc->DeletePoint(id);
3751 if (_manViewBaseCont1!=NULL){
3752 _manViewBaseCont1->DeletePoint(id);
3753 _manViewBaseCont2->DeletePoint(id);
3754 _manViewBaseCont3->DeletePoint(id);
3756 _manViewBaseCont1->Refresh();
3757 _manViewBaseCont2->Refresh();
3758 _manViewBaseCont3->Refresh();
3760 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3763 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3765 // ----------------------------------------------------------------------------
3766 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3768 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3770 manualContourBaseControler::DeleteActualMousePoint( x , y );
3771 DeleteActualMousePoint_Others( id );
3774 // ----------------------------------------------------------------------------
3775 void manualContour3VControler::MouseMove_Others(int id) // virtual
3777 manualViewBaseContour *mvbc;
3778 int i,size=this->_lstManualViewBaseContour.size();
3779 for ( i = 0 ; i < size ; i++ )
3781 mvbc = _lstManualViewBaseContour[i];
3782 mvbc->SelectAllPossibleSelected(false);
3785 mvbc->SetPointPosibleSelected(id,true);
3787 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3793 if (_manViewBaseCont1!=NULL){
3794 _manViewBaseCont1->SelectAllPossibleSelected(false);
3795 _manViewBaseCont2->SelectAllPossibleSelected(false);
3796 _manViewBaseCont3->SelectAllPossibleSelected(false);
3798 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3799 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3800 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3802 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3803 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3804 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3806 _manViewBaseCont1->Refresh();
3807 _manViewBaseCont2->Refresh();
3808 _manViewBaseCont3->Refresh();
3810 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3813 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3817 // ----------------------------------------------------------------------------
3818 void manualContour3VControler::MouseMove(int x, int y) // virtual
3820 manualContourControler::MouseMove( x , y );
3821 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3822 MouseMove_Others( id );
3825 // ----------------------------------------------------------------------------
3826 void manualContour3VControler::OnChar_Others()
3828 manualViewBaseContour *mvbc;
3829 int i,size=this->_lstManualViewBaseContour.size();
3830 for ( i = 0 ; i < size ; i++ )
3832 mvbc = _lstManualViewBaseContour[i];
3837 _manViewBaseCont1->Refresh();
3838 _manViewBaseCont2->Refresh();
3839 _manViewBaseCont3->Refresh();
3841 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3843 // ----------------------------------------------------------------------------
3844 bool manualContour3VControler::OnChar()
3846 manualContourControler::OnChar();
3850 // ----------------------------------------------------------------------------
3851 void manualContour3VControler::ResetContour() // virtual
3853 manualContourControler::ResetContour();
3854 ResetContour_Others();
3857 // ----------------------------------------------------------------------------
3858 void manualContour3VControler::ResetContour_Others()
3860 manualViewBaseContour *mvbc;
3861 int i,size=this->_lstManualViewBaseContour.size();
3862 for ( i = 0 ; i < size ; i++ )
3864 mvbc = _lstManualViewBaseContour[i];
3865 mvbc->DeleteContour();
3866 mvbc->CreateNewContour();
3871 _manViewBaseCont1->DeleteContour();
3872 _manViewBaseCont2->DeleteContour();
3873 _manViewBaseCont3->DeleteContour();
3874 _manViewBaseCont1->CreateNewContour();
3875 _manViewBaseCont2->CreateNewContour();
3876 _manViewBaseCont3->CreateNewContour();
3880 // ----------------------------------------------------------------------------
3881 // ----------------------------------------------------------------------------
3882 // ----------------------------------------------------------------------------
3883 manualContour3DControler::manualContour3DControler()
3886 // ----------------------------------------------------------------------------
3887 manualContour3DControler::~manualContour3DControler()
3890 // ----------------------------------------------------------------------------
3891 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3893 manualContour3DControler * clone = new manualContour3DControler();
3894 CopyAttributesTo(clone);
3898 // ---------------------------------------------------------------------------
3899 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3902 manualContourControler::CopyAttributesTo(cloneObject);
3904 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3907 // ----------------------------------------------------------------------------
3908 bool manualContour3DControler::OnLeftButtonDown()
3911 wxVTKRenderWindowInteractor *wxVTKiren;
3912 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3913 wxVTKiren->GetEventPosition(X,Y);
3914 MouseClickLeft(X,Y);
3917 // ----------------------------------------------------------------------------
3918 void manualContour3DControler::ResetOrientationPlane()
3920 double p[3],rp[3],rn[3];
3921 p[0] = this->GetVtkMPRBaseData()->GetX( );
3922 p[1] = this->GetVtkMPRBaseData()->GetY( );
3923 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3924 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3925 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3927 // ----------------------------------------------------------------------------
3928 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3930 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3931 int id=manualview3Dcontour->GetIdPoint2(x,y);
3932 if ( (GetState()==0) && (id!=-1) )
3934 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3936 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3937 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3938 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3939 ResetOrientationPlane();
3940 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3944 manualContourControler::MouseClickLeft(x,y);
3947 // ----------------------------------------------------------------------------
3948 bool manualContour3DControler::OnChar()
3951 manualContourControler::OnChar();
3952 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3955 ResetOrientationPlane();
3956 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3961 // ----------------------------------------------------------------------------
3962 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3964 _vtkmprbasedata=vtkmprbasedata;
3966 // ----------------------------------------------------------------------------
3967 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3969 return _vtkmprbasedata;
3972 // ----------------------------------------------------------------------------
3973 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
3975 manualContourControler::InsertPoint( x, y, z );
3976 ResetOrientationPlane();
3981 // ----------------------------------------------------------------------------
3982 // ----------------------------------------------------------------------------
3983 // ----------------------------------------------------------------------------
3985 manualContour3V3DControler::manualContour3V3DControler()
3988 // ----------------------------------------------------------------------------
3989 manualContour3V3DControler::~manualContour3V3DControler()
3993 // ----------------------------------------------------------------------------
3994 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
3996 manualContour3V3DControler * clone = new manualContour3V3DControler();
3997 CopyAttributesTo(clone);
4001 // ---------------------------------------------------------------------------
4002 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4005 manualContour3DControler::CopyAttributesTo(cloneObject);
4007 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4009 // ----------------------------------------------------------------------------
4010 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4012 manualContour3DControler::InsertPoint( x, y, z );
4013 _manualcontour3Vcontroler->InsertPoint_Others(0);
4015 // ----------------------------------------------------------------------------
4016 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4018 manualContour3DControler::AddPoint( x, y, z );
4019 _manualcontour3Vcontroler->AddPoint_Others();
4021 // ----------------------------------------------------------------------------
4022 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4024 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4025 manualContour3DControler::DeleteActualMousePoint( x , y );
4026 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4028 // ----------------------------------------------------------------------------
4029 void manualContour3V3DControler::MouseMove( int x, int y )
4031 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4032 if ((this->GetState()!=7) && (ss!=1)){
4033 manualContour3DControler::MouseMove( x , y );
4034 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4035 _manualcontour3Vcontroler->MouseMove_Others(id);
4038 // ----------------------------------------------------------------------------
4039 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4041 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4043 // ----------------------------------------------------------------------------
4044 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4046 return _manualcontour3Vcontroler;
4048 // ----------------------------------------------------------------------------
4049 bool manualContour3V3DControler::OnChar() // virtual
4051 if (manualContour3DControler::OnChar()==false )
4053 _manualcontour3Vcontroler->OnChar_Others();
4058 // ----------------------------------------------------------------------------
4059 void manualContour3V3DControler::ResetContour() // virtual
4061 manualContourControler::ResetContour();
4062 _manualcontour3Vcontroler->ResetContour_Others();
4066 // ----------------------------------------------------------------------------
4067 // ----------------------------------------------------------------------------
4068 // ----------------------------------------------------------------------------
4070 // _state = 0 // ..nothing..
4071 // _state = 1 // move with add point
4072 // _state = 5 // move
4073 // _state = 6 // move with insert point
4074 // _state = 7 // move with non selection
4076 manualContourControler::manualContourControler()
4078 _easyCreation = true;
4081 // ----------------------------------------------------------------------------
4082 manualContourControler::~manualContourControler()
4085 // ----------------------------------------------------------------------------
4086 manualContourControler * manualContourControler :: Clone() // virtual
4088 manualContourControler * clone = new manualContourControler();
4089 CopyAttributesTo(clone);
4092 // ---------------------------------------------------------------------------
4093 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4096 manualContourBaseControler::CopyAttributesTo(cloneObject);
4097 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4100 // ----------------------------------------------------------------------------
4101 void manualContourControler::Configure() //virtual
4103 // this->_manContModel->SetNumberOfPointsSpline(100);
4106 // ----------------------------------------------------------------------------
4107 void manualContourControler::MouseClickLeft(int x, int y){
4112 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4114 // Insert a Control Point with shift+ClickLeft
4115 // int tt = GetState(); // JPRx
4116 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4120 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4126 // Start to Insert Control Points with ClickLeft (Empty contour)
4127 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4133 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4134 if ((GetState()==1) && (_easyCreation==true) )
4138 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4140 // Insert Control Points IF Contour si Selected
4141 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4145 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4148 // Chose id of Control Point to be move
4149 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4152 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4155 // If nothing selected _state=7
4156 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4159 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4163 SetPosibleToMove( true );
4164 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4167 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4171 GetManualViewBaseContour()->InitMove(x,y,z);
4176 GetManualViewBaseContour()->Refresh();
4179 // ----------------------------------------------------------------------------
4180 void manualContourControler::MouseMove(int x, int y) // virtual
4183 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4184 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4185 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4186 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4187 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4189 GetManualViewBaseContour()->MoveContour(x,y,z);
4191 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4192 GetManualViewBaseContour()->Refresh();
4193 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4197 GetManualViewBaseContour()->RemoveControlPoints();
4198 GetManualViewBaseContour()->RemoveTextActor();
4199 GetManualViewBaseContour()->Refresh();
4200 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4205 // ----------------------------------------------------------------------------
4206 void manualContourControler::MouseDLeft( int x, int y)//virtual
4208 manualContourBaseControler::MouseDLeft( x, y);
4211 GetManualViewBaseContour()->AddControlPoints();
4212 GetManualViewBaseContour()->AddTextActor();
4213 GetManualViewBaseContour()->Refresh();
4214 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4217 // ----------------------------------------------------------------------------
4218 void manualContourControler::SetEasyCreation(bool easyCreation)
4220 _easyCreation=easyCreation;
4222 // ----------------------------------------------------------------------------
4223 bool manualContourControler::GetEasyCreation()
4225 return _easyCreation;
4229 // ----------------------------------------------------------------------------
4230 // ----------------------------------------------------------------------------
4231 // ----------------------------------------------------------------------------
4232 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4234 _flagMouseMove = true;
4236 // ----------------------------------------------------------------------------
4237 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4240 // ----------------------------------------------------------------------------
4241 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4243 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4244 CopyAttributesTo(clone);
4248 // ---------------------------------------------------------------------------
4249 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4252 manualContourControler::CopyAttributesTo(cloneObject);
4254 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4255 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4256 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4259 // ----------------------------------------------------------------------------
4260 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4262 _vtkmprbasedata = vtkmprbasedata;
4265 // ----------------------------------------------------------------------------
4266 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4268 return _vtkmprbasedata;
4272 // ----------------------------------------------------------------------------
4273 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4275 manualContourControler::InsertPoint( x, y, z );
4276 _manualcontour3Vcontroler->InsertPoint_Others(0);
4278 // ----------------------------------------------------------------------------
4279 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4281 manualContourControler::AddPoint( x, y, z );
4282 _manualcontour3Vcontroler->AddPoint_Others();
4284 // ----------------------------------------------------------------------------
4285 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4287 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4288 manualContourControler::DeleteActualMousePoint( x , y );
4289 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4291 // ----------------------------------------------------------------------------
4292 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4294 _flagMouseMove = true;
4295 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4296 if ((this->GetState()!=7) && (ss!=1)){
4297 manualContourControler::MouseMove( x , y );
4298 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4301 _manualcontour3Vcontroler->MouseMove_Others(id);
4302 _flagMouseMove = false;
4306 // ----------------------------------------------------------------------------
4307 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4309 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4311 // ----------------------------------------------------------------------------
4312 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4314 return _manualcontour3Vcontroler;
4316 // ----------------------------------------------------------------------------
4317 bool manualContourPerpPlaneControler::OnChar() // virtual
4319 if (manualContourControler::OnChar()==false )
4321 _manualcontour3Vcontroler->OnChar_Others();
4325 // ----------------------------------------------------------------------------
4326 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4328 manualContourControler::OnMouseMove();
4329 return _flagMouseMove;
4331 // ----------------------------------------------------------------------------
4332 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4334 manualContourControler::OnLeftDClick();
4335 return _flagMouseDClick;
4337 // ----------------------------------------------------------------------------
4338 void manualContourPerpPlaneControler::ResetContour() // virtual
4340 manualContourControler::ResetContour();
4341 _manualcontour3Vcontroler->ResetContour_Others();
4344 // ----------------------------------------------------------------------------
4345 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4347 _flagMouseDClick=true;
4348 manualContourControler::MouseDLeft(x,y);
4350 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4352 _flagMouseDClick = false;
4353 _vtkinteractorstyleplane2D->OnLeftDClick();
4354 ResetOrientationPlane();
4355 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4358 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4359 // if ( (GetState()==0) && (id!=-1) )
4361 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4362 // _vtkmprbasedata->SetX( mp->GetX() );
4363 // _vtkmprbasedata->SetY( mp->GetY() );
4364 // _vtkmprbasedata->SetZ( mp->GetZ() );
4365 // ResetOrientationPlane();
4366 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4372 // ----------------------------------------------------------------------------
4373 void manualContourPerpPlaneControler::ResetOrientationPlane()
4375 double p[3],rp[3],rn[3];
4376 p[0] = _vtkmprbasedata->GetX( );
4377 p[1] = _vtkmprbasedata->GetY( );
4378 p[2] = _vtkmprbasedata->GetZ( );
4379 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4381 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4384 // ----------------------------------------------------------------------------
4385 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4387 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4389 // ----------------------------------------------------------------------------
4390 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4392 return _vtkinteractorstyleplane2D;
4395 // ----------------------------------------------------------------------------
4396 // ----------------------------------------------------------------------------
4397 // ----------------------------------------------------------------------------
4399 // _state = 0 // ..nothing..
4400 // _state = 5 // move point
4401 // _state = 6 // move all
4402 // _state = 7 // Empty mouse drag
4404 manualRoiControler::manualRoiControler()
4407 // ----------------------------------------------------------------------------
4408 manualRoiControler::~manualRoiControler()
4411 // ----------------------------------------------------------------------------
4412 manualRoiControler * manualRoiControler :: Clone() // virtual
4414 manualRoiControler * clone = new manualRoiControler();
4415 CopyAttributesTo(clone);
4419 // ---------------------------------------------------------------------------
4420 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4423 manualContourBaseControler::CopyAttributesTo(cloneObject);
4426 // ----------------------------------------------------------------------------
4427 void manualRoiControler::Configure() //virtual
4429 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4432 // ----------------------------------------------------------------------------
4434 void manualRoiControler::MouseClickLeft(int x, int y){
4438 { // move control point
4439 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4440 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4446 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4447 GetManualViewBaseContour()->InitMove(x,y,z);
4451 // if the firs time create 4 control points and move one point
4452 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4453 if (GetState()==0) {
4459 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4465 if (GetState()==0) {
4477 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4482 GetManualViewBaseContour()->Refresh();
4485 // ----------------------------------------------------------------------------
4486 void manualRoiControler::MouseMove(int x, int y) // virtual
4490 // this->_vtkInteractorStyleBaseView->
4493 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4494 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4497 SetPoint( bakIdPoint , x , y ,z);
4520 GetManualViewBaseContour()->MoveContour(x,y,z);
4522 GetManualViewBaseContour()->Refresh();
4524 // ----------------------------------------------------------------------------
4525 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4528 // ----------------------------------------------------------------------------
4529 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4534 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4543 double pp1=porcentage;
4544 double pp2=1-porcentage;
4546 mp = GetManualContourModel()->GetManualPoint(2);
4548 mp->SetPoint(ww*pp1,hh*pp1,zz);
4550 mp = GetManualContourModel()->GetManualPoint(1);
4552 mp->SetPoint(ww*pp2,hh*pp1,zz);
4554 mp = GetManualContourModel()->GetManualPoint(0);
4556 mp->SetPoint(ww*pp2,hh*pp2,zz);
4558 mp = GetManualContourModel()->GetManualPoint(3);
4560 mp->SetPoint(ww*pp1,hh*pp2,zz);
4562 GetManualViewBaseContour() ->UpdateViewPoint(0);
4563 GetManualViewBaseContour() ->UpdateViewPoint(1);
4564 GetManualViewBaseContour() ->UpdateViewPoint(2);
4565 GetManualViewBaseContour() ->UpdateViewPoint(3);
4568 GetManualViewBaseContour()->Refresh();
4571 // ----------------------------------------------------------------------------
4572 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4575 InitRoi( 0 , 0 , 0.2 );
4576 mp = GetManualContourModel()->GetManualPoint(2);
4580 mp = GetManualContourModel()->GetManualPoint(1);
4584 mp = GetManualContourModel()->GetManualPoint(0);
4588 mp = GetManualContourModel()->GetManualPoint(3);
4592 GetManualViewBaseContour() ->UpdateViewPoint(0);
4593 GetManualViewBaseContour() ->UpdateViewPoint(1);
4594 GetManualViewBaseContour() ->UpdateViewPoint(2);
4595 GetManualViewBaseContour() ->UpdateViewPoint(3);
4599 // ----------------------------------------------------------------------------
4600 // ----------------------------------------------------------------------------
4601 // ----------------------------------------------------------------------------
4605 // _state = 0 // ..nothing..
4606 // _state = 5 // move point
4607 // _state = 6 // move all
4608 // _state = 7 // Empty mouse drag
4610 manualCircleControler::manualCircleControler()
4613 // ----------------------------------------------------------------------------
4614 manualCircleControler::~manualCircleControler()
4617 // ----------------------------------------------------------------------------
4618 manualCircleControler * manualCircleControler :: Clone() // virtual
4620 manualCircleControler * clone = new manualCircleControler();
4621 CopyAttributesTo(clone);
4625 // ---------------------------------------------------------------------------
4626 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4629 manualContourBaseControler::CopyAttributesTo(cloneObject);
4632 // ----------------------------------------------------------------------------
4633 void manualCircleControler::Configure() //virtual
4635 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4638 // ----------------------------------------------------------------------------
4639 void manualCircleControler::MouseClickLeft(int x, int y){
4643 { // move control point
4644 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4645 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4651 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4652 GetManualViewBaseContour()->InitMove(x,y,z);
4656 // firstime create 2 control points and move one control point
4657 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4658 if (GetState()==0) {
4662 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4668 if (GetState()==0) {
4676 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4681 GetManualViewBaseContour()->Refresh();
4683 // ----------------------------------------------------------------------------
4685 void manualCircleControler::MouseMove(int x, int y) // virtual
4688 // this->_vtkInteractorStyleBaseView->
4690 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4691 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4694 SetPoint( bakIdPoint , x , y ,z);
4697 GetManualViewBaseContour()->MoveContour(x,y,z);
4699 GetManualViewBaseContour()->Refresh();
4703 // ----------------------------------------------------------------------------
4704 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4707 // ----------------------------------------------------------------------------
4709 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4714 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4719 // AddPoint(0,0,zz);
4720 // AddPoint(0,0,zz);
4723 double pp1=porcentage;
4724 double pp2=1-porcentage;
4726 // mp = GetManualContourModel()->GetManualPoint(2);
4727 // zz=(int)mp->GetZ();
4728 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4730 mp = GetManualContourModel()->GetManualPoint(1);
4732 mp->SetPoint(ww*pp2,hh*pp1,zz);
4734 mp = GetManualContourModel()->GetManualPoint(0);
4736 mp->SetPoint(ww*pp2,hh*pp2,zz);
4738 // mp = GetManualContourModel()->GetManualPoint(3);
4739 // zz=(int)mp->GetZ();
4740 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4742 GetManualViewBaseContour() ->UpdateViewPoint(0);
4743 GetManualViewBaseContour() ->UpdateViewPoint(1);
4744 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4745 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4748 GetManualViewBaseContour()->Refresh();
4751 // ----------------------------------------------------------------------------
4753 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4756 InitRoi( 0 , 0 , 0.2 );
4757 mp = GetManualContourModel()->GetManualPoint(2);
4761 mp = GetManualContourModel()->GetManualPoint(1);
4765 mp = GetManualContourModel()->GetManualPoint(0);
4769 mp = GetManualContourModel()->GetManualPoint(3);
4773 GetManualViewBaseContour() ->UpdateViewPoint(0);
4774 GetManualViewBaseContour() ->UpdateViewPoint(1);
4775 GetManualViewBaseContour() ->UpdateViewPoint(2);
4776 GetManualViewBaseContour() ->UpdateViewPoint(3);
4781 // ----------------------------------------------------------------------------
4782 // ----------------------------------------------------------------------------
4783 // ----------------------------------------------------------------------------
4787 // _state = 0 // ..nothing..
4788 // _state = 5 // move point
4789 // _state = 6 // move all
4790 // _state = 7 // Empty mouse drag
4792 manualLineControler::manualLineControler()
4795 // ----------------------------------------------------------------------------
4796 manualLineControler::~manualLineControler()
4799 // ----------------------------------------------------------------------------
4800 manualLineControler * manualLineControler :: Clone() // virtual
4802 manualLineControler * clone = new manualLineControler();
4803 CopyAttributesTo(clone);
4807 // ---------------------------------------------------------------------------
4808 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4811 manualContourBaseControler::CopyAttributesTo(cloneObject);
4815 // ----------------------------------------------------------------------------
4816 void manualLineControler::MouseClickLeft(int x, int y){
4820 { // move control point
4821 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4822 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4828 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4829 GetManualViewBaseContour()->InitMove(x,y,z);
4833 // fist time create 2 control points and move a control point
4834 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4835 if (GetState()==0) {
4839 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4846 if (GetState()==0) {
4854 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4859 GetManualViewBaseContour()->Refresh();
4861 // ----------------------------------------------------------------------------
4863 void manualLineControler::MouseMove(int x, int y) // virtual
4867 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4868 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4872 SetPoint( bakIdPoint , x , y ,z);
4876 GetManualViewBaseContour()->MoveContour(x,y,z);
4878 GetManualViewBaseContour()->Refresh();
4882 // ----------------------------------------------------------------------------
4883 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4886 // ----------------------------------------------------------------------------
4888 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4893 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4900 double pp1=porcentage;
4901 double pp2=1-porcentage;
4903 mp = GetManualContourModel()->GetManualPoint(0);
4905 mp->SetPoint(ww*pp2,hh*pp2,zz);
4907 mp = GetManualContourModel()->GetManualPoint(1);
4909 mp->SetPoint(ww*pp2,hh*pp1,zz);
4911 GetManualViewBaseContour() ->UpdateViewPoint(0);
4912 GetManualViewBaseContour() ->UpdateViewPoint(1);
4915 GetManualViewBaseContour()->Refresh();
4918 // ----------------------------------------------------------------------------
4919 // ----------------------------------------------------------------------------
4920 // ----------------------------------------------------------------------------
4923 manualContourBaseControler::manualContourBaseControler()
4925 _manViewBaseCont = NULL;
4926 _manContModel = NULL;
4930 _posibleToMove = true;
4933 _keyBoardMoving = false;
4935 // ----------------------------------------------------------------------------
4936 manualContourBaseControler::~manualContourBaseControler()
4940 // ----------------------------------------------------------------------------
4941 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4943 manualContourBaseControler * clone = new manualContourBaseControler();
4944 CopyAttributesTo(clone);
4948 // ---------------------------------------------------------------------------
4950 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4953 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4954 cloneObject->SetZ( this->GetZ() );
4955 cloneObject->SetState( this->GetState() );
4956 cloneObject->SetEditable( this->IsEditable() );
4957 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4958 cloneObject->SetMoving( this->IsMoving() );
4959 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4960 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4963 // ----------------------------------------------------------------------------
4964 void manualContourBaseControler::Configure() //virtual
4968 // ----------------------------------------------------------------------------
4969 bool manualContourBaseControler::OnChar()
4971 if ( _vtkInteractorStyleBaseView!=NULL )
4973 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4976 wxVTKRenderWindowInteractor *_wxVTKiren;
4977 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4978 _wxVTKiren->GetEventPosition(X, Y);
4979 //int Z = GetZ(); // JPRx
4981 if ((keyCode==8) || (keyCode==127))
4984 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4986 DeleteActualMousePoint(X,Y);
4988 GetManualViewBaseContour()->Refresh();
4989 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4997 GetManualViewBaseContour()->Refresh();
4998 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5000 else if( !IsEditable() )
5002 if ( keyCode == 'L' )
5004 GetManualViewBaseContour()->MoveContour( -1, 0 );
5005 SetKeyBoardMoving( true );
5007 else if ( keyCode == 'R' )
5009 GetManualViewBaseContour()->MoveContour( 1, 0 );
5010 SetKeyBoardMoving( true );
5012 else if ( keyCode == 'U' )
5014 GetManualViewBaseContour()->MoveContour( 0, -1 );
5015 SetKeyBoardMoving( true );
5017 else if ( keyCode == 'D' )
5019 GetManualViewBaseContour()->MoveContour( 0, 1 );
5020 SetKeyBoardMoving( true );
5022 else if ( keyCode == 'W' )//Diagonal left down
5024 GetManualViewBaseContour()->MoveContour( -1, 1 );
5025 SetKeyBoardMoving( true );
5027 else if ( keyCode == 'Q' )//Diagonal left up
5029 GetManualViewBaseContour()->MoveContour( -1, -1 );
5030 SetKeyBoardMoving( true );
5032 else if( keyCode == 'P' )//Diagonal right up
5034 GetManualViewBaseContour()->MoveContour( 1, -1 );
5035 SetKeyBoardMoving( true );
5037 else if( keyCode == 'M' )//Diagonal right down
5039 GetManualViewBaseContour()->MoveContour( 1, 1 );
5040 SetKeyBoardMoving( true );
5042 if( GetKeyBoardMoving() )
5044 GetManualViewBaseContour()->Refresh();
5045 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5052 // ----------------------------------------------------------------------------
5053 bool manualContourBaseControler::OnMouseMove()
5056 if ( _vtkInteractorStyleBaseView!=NULL)
5059 wxVTKRenderWindowInteractor *_wxVTKiren;
5060 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5061 _wxVTKiren->GetEventPosition( X , Y );
5064 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5065 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5071 // ----------------------------------------------------------------------------
5072 bool manualContourBaseControler::OnLeftButtonDown()
5074 SetKeyBoardMoving( false );
5075 if ( _vtkInteractorStyleBaseView!=NULL )
5078 wxVTKRenderWindowInteractor *wxVTKiren;
5079 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5080 wxVTKiren->GetEventPosition(X,Y);
5082 MouseClickLeft(X,Y);
5086 // ----------------------------------------------------------------------------
5087 bool manualContourBaseControler::OnLeftButtonUp()
5089 if ( _vtkInteractorStyleBaseView!=NULL )
5092 wxVTKRenderWindowInteractor *wxVTKiren;
5093 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5094 wxVTKiren->GetEventPosition(X,Y);
5095 MouseReleaseLeft(X,Y);
5099 // ----------------------------------------------------------------------------
5100 bool manualContourBaseControler::OnLeftDClick()
5102 if ( _vtkInteractorStyleBaseView!=NULL )
5105 wxVTKRenderWindowInteractor *wxVTKiren;
5106 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5107 wxVTKiren->GetEventPosition(X,Y);
5109 this->MouseDLeft(X,Y);
5113 // ----------------------------------------------------------------------------
5114 bool manualContourBaseControler::OnMiddleButtonDown()
5116 // SetKeyBoardMoving( false );
5117 if ( _vtkInteractorStyleBaseView!=NULL )
5120 wxVTKRenderWindowInteractor *wxVTKiren;
5121 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5122 wxVTKiren->GetEventPosition(X,Y);
5123 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5127 // ----------------------------------------------------------------------------
5128 bool manualContourBaseControler::OnMiddleButtonUp()
5132 // ----------------------------------------------------------------------------
5133 bool manualContourBaseControler::OnRightButtonDown()
5135 if( _vtkInteractorStyleBaseView!= NULL )
5138 wxVTKRenderWindowInteractor *wxVTKiren;
5139 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5140 wxVTKiren->GetEventPosition(X, Y);
5142 SetCompleteCreation( true );
5143 SetKeyBoardMoving( false );
5144 MouseClickRight(X,Y);
5148 // ----------------------------------------------------------------------------
5149 bool manualContourBaseControler::OnRightButtonUp()
5153 // ----------------------------------------------------------------------------
5154 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5155 _manContModel = manContModel;
5156 _manViewBaseCont = manViewBaseCont;
5157 _manViewBaseCont->SetEditable( &_editable );
5159 // ----------------------------------------------------------------------------
5160 manualContourModel* manualContourBaseControler::GetManualContourModel()
5162 return _manContModel;
5164 // ----------------------------------------------------------------------------
5165 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5167 return _manViewBaseCont;
5169 // ----------------------------------------------------------------------------
5170 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5174 // ----------------------------------------------------------------------------
5175 void manualContourBaseControler::MouseClickRight(int x, int y)
5181 SetEditable( false );
5182 SetPosibleToMove( false );
5185 //EED 24Avril2009 _state=7;
5187 // ----------------------------------------------------------------------------
5188 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5190 if (_state==5){ _state = 0; }
5191 if (_state==6){ _state = 0; }
5192 if (_state==7){ _state = 0; }
5194 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5195 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5197 SetEditable( false );
5198 SetPosibleToMove( false );
5201 // ----------------------------------------------------------------------------
5202 void manualContourBaseControler::MouseDLeft(int x, int y )
5207 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5208 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5209 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5215 // ----------------------------------------------------------------------------
5216 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5219 // ----------------------------------------------------------------------------
5220 void manualContourBaseControler::SetState(int state)
5224 // ----------------------------------------------------------------------------
5225 int manualContourBaseControler::GetState()
5229 // ----------------------------------------------------------------------------
5230 bool manualContourBaseControler::IsEditable( )
5234 // ----------------------------------------------------------------------------
5235 void manualContourBaseControler::SetEditable( bool condition )
5237 if (GetManualViewBaseContour()!=NULL) {
5240 GetManualViewBaseContour()->RemoveControlPoints();
5242 GetManualViewBaseContour()->SetSelected( condition );
5244 _editable = condition;
5247 // ----------------------------------------------------------------------------
5248 bool manualContourBaseControler::GetPosibleToMove()
5250 return _posibleToMove;
5252 // ----------------------------------------------------------------------------
5253 void manualContourBaseControler::SetPosibleToMove( bool condition )
5255 _posibleToMove = condition;
5257 // ----------------------------------------------------------------------------
5258 bool manualContourBaseControler::IsMoving()
5262 // ----------------------------------------------------------------------------
5263 void manualContourBaseControler::SetMoving( bool condition )
5265 _moving = condition;
5267 // ----------------------------------------------------------------------------
5268 void manualContourBaseControler::SetCompleteCreation( bool condition )
5270 _created = condition;
5272 // ----------------------------------------------------------------------------
5273 bool manualContourBaseControler::GetIfCompleteCreation ( )
5277 // ----------------------------------------------------------------------------
5278 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5280 _keyBoardMoving = condition;
5282 // ----------------------------------------------------------------------------
5283 bool manualContourBaseControler::GetKeyBoardMoving( )
5285 return _keyBoardMoving;
5287 // ----------------------------------------------------------------------------
5288 void manualContourBaseControler::CreateNewManualContour(){
5289 _manViewBaseCont->CreateNewContour();
5291 // ----------------------------------------------------------------------------
5292 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5293 return _manViewBaseCont->GetNumberOfPoints();
5295 // ----------------------------------------------------------------------------
5297 //JSTG - 25-02-08 -------------------------------------------------------------
5298 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5299 //return _manViewBaseCont->GetNumberOfPointsSpline();
5300 return _manContModel->GetNumberOfPointsSpline();
5302 // ----------------------------------------------------------------------------
5304 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5305 return _manViewBaseCont->GetVectorPointsXManualContour();
5307 // ----------------------------------------------------------------------------
5308 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5309 return _manViewBaseCont->GetVectorPointsYManualContour();
5311 // ----------------------------------------------------------------------------
5312 void manualContourBaseControler::DeleteContour(){
5313 _manViewBaseCont->DeleteContour();
5314 _manContModel->DeleteAllPoints();
5316 // ----------------------------------------------------------------------------
5317 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5319 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5321 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5322 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5323 _manContModel->DeletePoint(id);
5324 _manViewBaseCont->DeletePoint(id);
5330 // ----------------------------------------------------------------------------
5331 void manualContourBaseControler::Magnet(int x, int y)
5335 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5336 if (GetManualContourModel()!=NULL){
5340 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5341 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5344 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5345 mp->SetPoint(xx,yy,zz);
5347 // GetManualViewBaseContour()->UpdateViewPoint(id);
5353 // ----------------------------------------------------------------------------
5354 void manualContourBaseControler::SetZ(int z)
5358 // ----------------------------------------------------------------------------
5359 int manualContourBaseControler::GetZ()
5363 // ----------------------------------------------------------------------------
5364 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5366 if (GetManualContourModel()!=NULL){
5370 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5371 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5372 GetManualViewBaseContour()->AddPoint();
5373 // GetManualViewBaseContour()->UpdateViewPoint(id);
5376 // ----------------------------------------------------------------------------
5377 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5381 if (GetManualContourModel()!=NULL){
5385 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5386 if (GetManualContourModel()->GetSizeLstPoints()>1){
5387 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5388 GetManualViewBaseContour()->InsertPoint(id);
5389 // GetManualViewBaseContour()->UpdateViewPoint(id);
5391 GetManualContourModel()->AddPoint(xx,yy,zz);
5392 GetManualViewBaseContour()->AddPoint();
5394 // GetManualViewBaseContour()->UpdateViewPoint(id);
5399 // ----------------------------------------------------------------------------
5400 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5401 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5405 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5406 manualPoint *mp = _manContModel->GetManualPoint(id);
5407 mp->SetPoint(xx,yy,zz);
5408 GetManualViewBaseContour()->UpdateViewPoint(id);
5411 // ----------------------------------------------------------------------------
5412 void manualContourBaseControler::SetPointX( int id ,int x ){
5413 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5417 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5418 manualPoint *mp = _manContModel->GetManualPoint(id);
5420 GetManualViewBaseContour()->UpdateViewPoint(id);
5423 // ----------------------------------------------------------------------------
5424 void manualContourBaseControler::SetPointY( int id ,int y ){
5425 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5429 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5430 manualPoint *mp = _manContModel->GetManualPoint(id);
5432 GetManualViewBaseContour()->UpdateViewPoint(id);
5435 // ----------------------------------------------------------------------------
5436 void manualContourBaseControler::SetPointZ( int id ,int z ){
5437 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5441 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5442 manualPoint *mp = _manContModel->GetManualPoint(id);
5444 GetManualViewBaseContour()->UpdateViewPoint(id);
5447 // ----------------------------------------------------------------------------
5448 void manualContourBaseControler::ResetContour() // virtual
5450 this->DeleteContour();
5451 GetManualViewBaseContour()->CreateNewContour();