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
1497 //printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
1503 for( i = 0; i < nps; i++ )
1505 //JSTG 25-02-08 ------------------------------------------------
1506 //t = delta * (double)i;
1507 //_manContModel->GetSplinePoint(t,x,y,z);
1508 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1509 //--------------------------------------------------------------
1511 // _pts->SetPoint(i, x,y,z );
1512 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1515 // printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
1523 _pts->SetPoint(0, 0 , 0 , 0);
1524 _pts->SetPoint(1, 0 , 0 , 0);
1529 // ----------------------------------------------------------------------------
1530 void manualViewContour::RefreshText() // virtual
1533 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1534 int size = GetNumberOfPoints();
1536 char resultText[50];
1537 strcpy(resultText," ");
1540 strcpy(resultText,"L= ");
1541 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1542 strcat(resultText,text);
1546 if (_manContModel->IfCloseContour()==true)
1548 strcpy(resultText,"P= ");
1549 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1550 strcat(resultText,text);
1551 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1552 strcat(resultText," A= ");
1553 strcat(resultText,text);
1555 strcpy(resultText,"L= ");
1556 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1557 strcat(resultText,text);
1561 _textActor -> SetInput(resultText);
1566 for (i=0; i<size; i++)
1568 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1570 _id_viewPoint_for_text = i;
1574 int id = _id_viewPoint_for_text;
1575 double px = _manContModel->GetManualPoint(id)->GetX();
1576 double py = _manContModel->GetManualPoint(id)->GetY();
1582 _textActor->SetPosition(px+GetRange()+1,py);
1588 // ----------------------------------------------------------------------------
1589 bool manualViewContour::ifTouchContour(int x,int y,int z){
1597 TransfromeCoordViewWorld(xx,yy,zz);
1604 unsigned int i, nps,nps_t;
1605 nps = _sizePointsContour;
1607 if (this->_manContModel->IfCloseContour()==true)
1615 for( i = 0; i < nps_t; i++ )
1617 _pts->GetPoint(i%nps, ppA);
1618 _pts->GetPoint((i+1)%nps, ppB);
1619 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1620 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1621 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]));
1624 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1634 // ----------------------------------------------------------------------------
1635 void manualViewContour::DeletePoint(int id) // virtual
1637 if (_lstViewPoints.size()>2)
1639 manualViewBaseContour::DeletePoint( id );
1642 // ----------------------------------------------------------------------------
1644 void manualViewContour::ClearPoint(int id)
1646 manualViewBaseContour::DeletePoint( id );
1649 //-------------------------------------------------------------------
1650 void manualViewContour::SetMesureScale(double mesureScale)
1652 _mesureScale = mesureScale;
1654 //-------------------------------------------------------------------
1655 void manualViewContour::InitMove(int x, int y, int z)
1657 _initialConoturModel->DeleteAllPoints();
1659 manualPoint *mp = NULL;
1663 TransfromeCoordViewWorld(XX,YY,ZZ);
1665 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1666 for ( i=0; i<manualPointsSZ; i++ )
1668 mp = _manContModel->GetManualPoint( i );
1669 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1672 //-------------------------------------------------------------------
1673 void manualViewContour::MoveContour(int x, int y, int z)
1675 manualPoint *mpOrigin = NULL;
1676 manualPoint *mpMoving = NULL;
1681 TransfromeCoordViewWorld(XX,YY,ZZ);
1683 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1684 for ( i=0; i<manualPointsSZ; i++ )
1686 mpOrigin = _manContModel->GetManualPoint( i );
1687 mpMoving = _initialConoturModel->GetManualPoint(i);
1688 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1692 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1694 manualPoint *mpOrigin = NULL;
1696 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1697 for ( i=0; i<manualPointsSZ; i++ )
1699 mpOrigin = _manContModel->GetManualPoint( i );
1700 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1704 // ----------------------------------------------------------------------------
1705 // ----------------------------------------------------------------------------
1706 // ----------------------------------------------------------------------------
1709 manualView3VContour::manualView3VContour(int type)
1712 // JSTG 25-02-08 ------------------------------
1713 //_manContModel= new manualContourModel();
1714 //---------------------------------------------
1716 // ----------------------------------------------------------------------------
1717 manualView3VContour::~manualView3VContour()
1723 // ----------------------------------------------------------------------------
1724 manualView3VContour * manualView3VContour :: Clone()
1726 manualView3VContour * clone = new manualView3VContour( GetType() );
1727 CopyAttributesTo(clone);
1731 // ---------------------------------------------------------------------------
1733 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1736 manualViewContour::CopyAttributesTo(cloneObject);
1739 int manualView3VContour::GetType()
1744 // ----------------------------------------------------------------------------
1745 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1760 // ----------------------------------------------------------------------------
1762 void manualView3VContour::RefreshContour() // virtula
1764 manualViewContour::RefreshContour();
1767 // JSTG 25-02-08 ----------------------------------------
1768 //int nps = GetNumberOfPointsSpline();
1769 int nps = _manContModel->GetNumberOfPointsSpline();
1770 //-------------------------------------------------------
1771 for( i = 0; i < nps; i++ )
1773 _pts->GetPoint( i, pp );
1774 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1777 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1782 // ----------------------------------------------------------------------------
1784 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1786 manualPoint *mp = _manContModel->GetManualPoint(id);
1791 FilterCordinateXYZ(x,y,z);
1792 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1795 // ----------------------------------------------------------------------------
1797 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1800 if (_manContModel!=NULL){
1804 TransfromeCoordViewWorld(xx,yy,zz,-1);
1805 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1810 // ----------------------------------------------------------------------------
1811 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1819 TransfromeCoordViewWorld(xx,yy,zz,-1);
1826 unsigned int i, nps,nps_t;
1827 nps = _sizePointsContour;
1828 if (this->_manContModel->IfCloseContour()==true)
1834 FilterCordinateXYZ(xx,yy,zz);
1836 for( i = 0; i < nps_t; i++ ) {
1837 _pts->GetPoint(i%nps, ppA);
1838 _pts->GetPoint((i+1)%nps, ppB);
1839 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1840 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1841 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1842 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1843 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]));
1844 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1851 // ----------------------------------------------------------------------------
1852 // ----------------------------------------------------------------------------
1853 // ----------------------------------------------------------------------------
1854 manualView3DContour::manualView3DContour()
1857 // ----------------------------------------------------------------------------
1858 manualView3DContour::~manualView3DContour()
1862 // ----------------------------------------------------------------------------
1863 manualView3DContour * manualView3DContour :: Clone()
1865 manualView3DContour * clone = new manualView3DContour();
1866 CopyAttributesTo(clone);
1870 // ---------------------------------------------------------------------------
1871 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1874 manualViewContour::CopyAttributesTo(cloneObject);
1876 cloneObject->SetDimensions ( _w , _h , _d );
1878 // ----------------------------------------------------------------------------
1879 void manualView3DContour::SetDimensions(int w, int h, int d)
1885 // ----------------------------------------------------------------------------
1886 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1888 X = _vtkmprbasedata->GetX();
1889 Y = _vtkmprbasedata->GetY();
1890 Z = _vtkmprbasedata->GetZ();
1892 // ----------------------------------------------------------------------------
1893 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1895 _vtkmprbasedata = vtkmprbasedata;
1897 // ----------------------------------------------------------------------------
1898 int manualView3DContour::GetIdPoint2(int x, int y)
1901 double p[3],pA[3],pB[3];
1903 double pickPoint[ 3 ], cameraPos[ 3 ];
1904 vtkPointPicker* picker = vtkPointPicker::New( );
1905 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1906 picker->Pick( x, y, 0.0, pRenderer );
1907 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1908 picker->GetPickPosition( pickPoint );
1911 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1912 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1914 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1916 double dist,distMin=999999999;
1917 int i,size=this->_manContModel->GetSizeLstPoints();
1918 for (i=0;i<size;i++)
1920 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1924 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1925 if ( (dist<=2*GetRange()) && (dist<distMin) )
1934 // ----------------------------------------------------------------------------
1935 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1937 SelectAllPossibleSelected(false);
1938 int id=GetIdPoint2(x,y);
1941 SetPointPosibleSelected(id,true);
1949 // ----------------------------------------------------------------------------
1950 // ----------------------------------------------------------------------------
1951 // ----------------------------------------------------------------------------
1956 // ----------------------------------------------------------------------------
1957 // ----------------------------------------------------------------------------
1958 // ----------------------------------------------------------------------------
1959 manualViewBullEyeSector::manualViewBullEyeSector()
1963 // ----------------------------------------------------------------------------
1964 void manualViewBullEyeSector::RefreshContour()
1969 //----------------------------------
1971 _manContModel->UpdateSpline();
1972 nps = _manContModel->GetNumberOfPointsSpline();
1976 for( i = 0; i < nps; i++ )
1978 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1979 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1985 // ----------------------------------------------------------------------------
1986 // ----------------------------------------------------------------------------
1987 // ----------------------------------------------------------------------------
1990 manualViewBullEye::manualViewBullEye()
1994 // ----------------------------------------------------------------------------
1995 manualViewBullEye::~manualViewBullEye()
1998 int i,size=lstSectorBullEye.size();
1999 for (i=0;i<size;i++)
2001 delete lstSectorBullEye[i];
2003 lstSectorBullEye.clear();
2007 // ----------------------------------------------------------------------------
2008 manualViewBullEye * manualViewBullEye :: Clone()
2010 manualViewBullEye * clone = new manualViewBullEye();
2011 CopyAttributesTo(clone);
2015 // ---------------------------------------------------------------------------
2017 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2020 manualViewBaseContour::CopyAttributesTo(cloneObject);
2024 // ----------------------------------------------------------------------------
2025 int manualViewBullEye::GetType() // virtual
2031 // ----------------------------------------------------------------------------
2032 void manualViewBullEye::RefreshContour() // virtual
2034 // External Rectangle
2035 manualViewRoi::RefreshContour();
2037 _manContModel->UpdateSpline();
2038 int np = GetNumberOfPoints( );
2039 // Refres sectors of BullEye(s)
2043 int i,size = lstSectorBullEye.size();
2044 for (i=0;i<size;i++)
2046 lstSectorBullEye[i]->RefreshContour();
2053 // ----------------------------------------------------------------------------
2054 void manualViewBullEye::ConstructVTKObjects() // virtual
2056 manualViewRoi::ConstructVTKObjects();
2059 this->GetSpacing(spc);
2060 manualViewBullEyeSector *mvbc;
2061 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2062 int i,size = mcmbe->GetSizeOfSectorLst();
2063 for ( i=0 ; i<size ; i++ )
2065 mvbc = new manualViewBullEyeSector();
2066 mvbc->SetModel( mcmbe->GetModelSector(i) );
2067 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2068 mvbc->SetRange( 2 );
2070 mvbc->SetSpacing(spc);
2071 mvbc->SetColorNormalContour(1, 0, 0);
2072 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2073 // mvbc->SetColorSelectContour(1, 0.8, 0);
2074 mvbc->SetWidthLine( this->GetWidthLine() );
2076 mvbc->ConstructVTKObjects();
2077 lstSectorBullEye.push_back( mvbc );
2083 // ----------------------------------------------------------------------------
2084 void manualViewBullEye::AddSplineActor() // virtual
2086 manualViewRoi::AddSplineActor();
2087 int i,size=lstSectorBullEye.size();
2088 for (i=0;i<size;i++)
2090 lstSectorBullEye[i]->AddSplineActor();
2094 // ----------------------------------------------------------------------------
2095 void manualViewBullEye::RemoveSplineActor() // virtual
2097 manualViewRoi::RemoveSplineActor();
2098 int i,size=lstSectorBullEye.size();
2099 for (i=0;i<size;i++)
2101 lstSectorBullEye[i]->RemoveSplineActor();
2106 // ----------------------------------------------------------------------------
2107 // ----------------------------------------------------------------------------
2108 // ----------------------------------------------------------------------------
2110 manualViewRoi::manualViewRoi()
2112 _sizePointsContour=5;
2114 // ----------------------------------------------------------------------------
2115 manualViewRoi::~manualViewRoi()
2120 // ----------------------------------------------------------------------------
2121 manualViewRoi * manualViewRoi :: Clone()
2123 manualViewRoi * clone = new manualViewRoi();
2124 CopyAttributesTo(clone);
2128 // ---------------------------------------------------------------------------
2130 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2133 manualViewBaseContour::CopyAttributesTo(cloneObject);
2136 // ----------------------------------------------------------------------------
2137 void manualViewRoi::RefreshContour() // virtual
2139 unsigned int i,ii, np;
2140 np = GetNumberOfPoints( );
2147 for( i = 0; i < np+1; i++ ) {
2149 mp = _manContModel->GetManualPoint(ii);
2152 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2153 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2154 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2157 // _pts->SetPoint(i, XX,YY,ZZ );
2158 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2162 _pts->SetPoint(0, 0 , 0 , 0);
2163 _pts->SetPoint(1, 0 , 0 , 0);
2168 // ----------------------------------------------------------------------------
2169 int manualViewRoi::GetType() // virtual
2174 // ----------------------------------------------------------------------------
2176 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2187 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2189 for( i = 0; i < size; i++ )
2192 mp=_manContModel->GetManualPoint(i);
2227 // ----------------------------------------------------------------------------
2230 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2233 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2235 GetMinMax(px1,py1, px2, py2);
2240 TransfromeCoordViewWorld(xx,yy,zz);
2244 double ddx=GetRange();
2245 double ddy=GetRange();
2247 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2252 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2257 if ((ok1==true) && (ok2==false))
2265 // ----------------------------------------------------------------------------
2267 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2273 TransfromeCoordViewWorld(XX,YY,ZZ);
2275 if (_manContModel->GetSizeLstPoints()==4){
2276 mp = _manContModel->GetManualPoint(0);
2277 _dp0[0]= mp->GetX() - XX;
2278 _dp0[1]= mp->GetY() - YY;
2279 _dp0[2]= mp->GetZ();
2281 mp = _manContModel->GetManualPoint(1);
2282 _dp1[0]= mp->GetX() - XX;
2283 _dp1[1]= mp->GetY() - YY;
2284 _dp1[2]= mp->GetZ();
2286 mp = _manContModel->GetManualPoint(2);
2287 _dp2[0]= mp->GetX() - XX;
2288 _dp2[1]= mp->GetY() - YY;
2289 _dp2[2]= mp->GetZ();
2291 mp = _manContModel->GetManualPoint(3);
2292 _dp3[0]= mp->GetX() - XX;
2293 _dp3[1]= mp->GetY() - YY;
2294 _dp3[2]= mp->GetZ();
2298 // ----------------------------------------------------------------------------
2300 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2306 TransfromeCoordViewWorld(XX,YY,ZZ);
2308 mp = _manContModel->GetManualPoint(0);
2309 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2311 mp = _manContModel->GetManualPoint(1);
2312 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2314 mp = _manContModel->GetManualPoint(2);
2315 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2317 mp = _manContModel->GetManualPoint(3);
2318 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2329 // ----------------------------------------------------------------------------
2330 // ----------------------------------------------------------------------------
2331 // ----------------------------------------------------------------------------
2335 manualViewCircle::manualViewCircle()
2337 // _sizePointsContour=5; // default 100
2339 // ----------------------------------------------------------------------------
2340 manualViewCircle::~manualViewCircle()
2345 // ----------------------------------------------------------------------------
2346 manualViewCircle * manualViewCircle :: Clone()
2348 manualViewCircle * clone = new manualViewCircle();
2349 CopyAttributesTo(clone);
2353 // ---------------------------------------------------------------------------
2355 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2358 manualViewBaseContour::CopyAttributesTo(cloneObject);
2362 // ----------------------------------------------------------------------------
2364 void manualViewCircle::RefreshContour(){ // virtual
2366 manualPoint *mpA,*mpB;
2367 unsigned int i, np,nps;
2371 np = GetNumberOfPoints( );
2372 nps = _manContModel->GetNumberOfPointsSpline();
2373 double deltaAngle=(3.14159265*2)/(nps-1);
2378 mpA = _manContModel->GetManualPoint(0);
2379 mpB = _manContModel->GetManualPoint(1);
2380 difX = mpA->GetX() - mpB->GetX();
2381 difY = mpA->GetY() - mpB->GetY();
2382 radio = sqrt( difX*difX + difY*difY );
2383 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2384 manContModelCir->SetRadio(radio);
2386 for( i = 0; i < nps; i++ ) {
2387 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2388 // angle = deltaAngle*i;
2389 // XX = cos(angle)*radio+mpA->GetX();
2390 // YY = sin(angle)*radio+mpA->GetY();
2392 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2395 _pts->SetPoint(0, 0 , 0 , 0);
2396 _pts->SetPoint(1, 0 , 0 , 0);
2402 // ----------------------------------------------------------------------------
2403 int manualViewCircle::GetType() // virtual
2408 // ----------------------------------------------------------------------------
2410 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2412 manualPoint *mpA,*mpB;
2416 np = GetNumberOfPoints( );
2419 mpA = _manContModel->GetManualPoint(0);
2420 mpB = _manContModel->GetManualPoint(1);
2421 difX = mpA->GetX() - mpB->GetX();
2422 difY = mpA->GetY() - mpB->GetY();
2423 radio = sqrt( difX*difX + difY*difY );
2424 minX=mpA->GetX()-radio;
2425 minY=mpA->GetY()-radio;
2426 maxX=mpA->GetX()+radio;
2427 maxY=mpA->GetY()+radio;
2437 // ----------------------------------------------------------------------------
2438 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2441 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2443 GetMinMax(px1,py1, px2, py2);
2448 TransfromeCoordViewWorld(xx,yy,zz);
2452 double ddx=GetRange();
2453 double ddy=GetRange();
2455 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2460 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2465 if ((ok1==true) && (ok2==false))
2474 // ----------------------------------------------------------------------------
2476 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2482 TransfromeCoordViewWorld(XX,YY,ZZ);
2484 if (_manContModel->GetSizeLstPoints()==2){
2485 mp = _manContModel->GetManualPoint(0);
2486 _dp0[0]= mp->GetX() - XX;
2487 _dp0[1]= mp->GetY() - YY;
2488 _dp0[2]= mp->GetZ();
2490 mp = _manContModel->GetManualPoint(1);
2491 _dp1[0]= mp->GetX() - XX;
2492 _dp1[1]= mp->GetY() - YY;
2493 _dp1[2]= mp->GetZ();
2495 mp = _manContModel->GetManualPoint(2);
2496 _dp2[0]= mp->GetX() - XX;
2497 _dp2[1]= mp->GetY() - YY;
2498 _dp2[2]= mp->GetZ();
2500 mp = _manContModel->GetManualPoint(3);
2501 _dp3[0]= mp->GetX() - XX;
2502 _dp3[1]= mp->GetY() - YY;
2503 _dp3[2]= mp->GetZ();
2509 // ----------------------------------------------------------------------------
2510 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2516 TransfromeCoordViewWorld(XX,YY,ZZ);
2518 mp = _manContModel->GetManualPoint(0);
2519 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2521 mp = _manContModel->GetManualPoint(1);
2522 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2524 // mp = _manContModel->GetManualPoint(2);
2525 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2527 // mp = _manContModel->GetManualPoint(3);
2528 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2532 // UpdateViewPoint(2);
2533 // UpdateViewPoint(3);
2539 // ----------------------------------------------------------------------------
2540 // ----------------------------------------------------------------------------
2541 // ----------------------------------------------------------------------------
2545 manualViewLine::manualViewLine()
2547 _sizePointsContour=20;
2549 // ----------------------------------------------------------------------------
2550 manualViewLine::~manualViewLine()
2555 // ----------------------------------------------------------------------------
2556 manualViewLine * manualViewLine :: Clone()
2558 manualViewLine * clone = new manualViewLine();
2559 CopyAttributesTo(clone);
2563 // ---------------------------------------------------------------------------
2565 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2568 manualViewBaseContour::CopyAttributesTo(cloneObject);
2571 // ----------------------------------------------------------------------------
2572 int manualViewLine::GetType() // virtual
2578 // ----------------------------------------------------------------------------
2580 void manualViewLine::InitMove(int x, int y, int z) // virtual
2586 TransfromeCoordViewWorld(XX,YY,ZZ);
2588 if (_manContModel->GetSizeLstPoints()==2)
2590 mp = _manContModel->GetManualPoint(0);
2591 _dp0[0]= mp->GetX() - XX;
2592 _dp0[1]= mp->GetY() - YY;
2593 _dp0[2]= mp->GetZ();
2595 mp = _manContModel->GetManualPoint(1);
2596 _dp1[0]= mp->GetX() - XX;
2597 _dp1[1]= mp->GetY() - YY;
2598 _dp1[2]= mp->GetZ();
2604 // ----------------------------------------------------------------------------
2605 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2611 TransfromeCoordViewWorld(XX,YY,ZZ);
2613 mp = _manContModel->GetManualPoint(0);
2614 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2616 mp = _manContModel->GetManualPoint(1);
2617 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2625 // ----------------------------------------------------------------------------
2626 // ----------------------------------------------------------------------------
2627 // ----------------------------------------------------------------------------
2630 manualViewBaseContour::manualViewBaseContour()
2634 _manContModel = NULL;
2635 _wxvtkbaseview = NULL;
2637 _posibleSelected = false;
2638 _viewControlPoints = false;
2641 _contourVtkActor = NULL;
2644 _sizePointsContour = 100;
2653 _coulorNormal_r = 1;
2654 _coulorNormal_g = 0;
2655 _coulorNormal_b = 1;
2657 _coulorSelection_r = 0;
2658 _coulorSelection_g = 1;
2659 _coulorSelection_b = 0;
2664 // ----------------------------------------------------------------------------
2665 manualViewBaseContour::~manualViewBaseContour()
2667 int i,size=_lstViewPoints.size();
2668 for (i=0;i<size; i++){
2669 delete _lstViewPoints[i];
2671 _lstViewPoints.clear();
2673 // ----------------------------------------------------------------------------
2676 int manualViewBaseContour::GetType() // virtual
2679 //int manualViewBaseContour::GetType() 0;
2680 //int manualViewContour::GetType() 1;
2681 //int manualViewRoi::GetType() 2;
2682 //int manualViewCircle::GetType() 3;
2683 //int manualViewStar::GetType() 4;
2684 //int manualViewLine::GetType() 6;
2689 // ----------------------------------------------------------------------------
2691 void manualViewBaseContour::Save(FILE *pFile)
2693 fprintf(pFile,"TypeView %d\n", GetType() );
2696 // ----------------------------------------------------------------------------
2697 void manualViewBaseContour::Open(FILE *pFile)
2701 // ----------------------------------------------------------------------------
2702 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2704 _viewControlPoints = ifControlPoints;
2705 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2710 //Adding each control point
2711 if( ifControlPoints )
2716 // ---------------------------------------------------------------------------
2718 void manualViewBaseContour :: RemoveCompleteContourActor()
2720 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2721 //Removing the spline
2722 RemoveSplineActor();
2725 //Removing each point
2726 RemoveControlPoints();
2730 // ---------------------------------------------------------------------------
2731 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2733 manualViewBaseContour * clone = new manualViewBaseContour();
2734 CopyAttributesTo(clone);
2739 // ---------------------------------------------------------------------------
2741 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2744 //XXXX::CopyAttributesTo(cloneObject);
2746 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2747 cloneObject-> SetSelected( this->GetSelected() );
2748 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2749 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2750 cloneObject-> SetRange( this->GetRange() );
2751 cloneObject-> SetZ( this->GetZ() );
2752 cloneObject-> SetSpacing( _spc );
2753 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2754 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2755 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2757 int i, size = _lstViewPoints.size();
2758 for ( i=0; i<size; i++ )
2760 cloneObject->AddPoint( );
2764 // ----------------------------------------------------------------------------
2765 void manualViewBaseContour :: AddSplineActor()
2767 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2768 if (_contourVtkActor!=NULL)
2769 theRenderer->AddActor( _contourVtkActor );
2771 // ----------------------------------------------------------------------------
2772 void manualViewBaseContour :: RemoveSplineActor() // virtual
2774 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2775 if (_contourVtkActor!=NULL)
2776 theRenderer->RemoveActor( _contourVtkActor );
2778 // ----------------------------------------------------------------------------
2779 void manualViewBaseContour :: RemoveControlPoints()
2781 if (_wxvtkbaseview!=NULL){
2782 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2783 int i,size=_lstViewPoints.size();
2784 for (i=0;i<size; i++)
2786 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2787 theRenderer->RemoveActor( pointActor );
2790 SetIfViewControlPoints( false );
2792 // ----------------------------------------------------------------------------
2793 void manualViewBaseContour :: AddControlPoints()
2795 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2796 SetIfViewControlPoints( true );
2797 if( _viewControlPoints )
2799 int i,size=_lstViewPoints.size();
2800 for (i=0;i<size; i++)
2802 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2803 theRenderer->AddActor( pointActor );
2807 // ----------------------------------------------------------------------------
2808 void manualViewBaseContour::AddTextActor()
2810 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2812 // ----------------------------------------------------------------------------
2813 void manualViewBaseContour::RemoveTextActor()
2815 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2817 // ----------------------------------------------------------------------------
2818 void manualViewBaseContour::DeleteVtkObjects()
2820 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2821 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2822 if ( _pts != NULL ) { _pts -> Delete(); }
2823 if ( _pd != NULL ) { _pd -> Delete(); }
2824 _contourVtkActor = NULL;
2831 // ----------------------------------------------------------------------------
2832 void manualViewBaseContour::SetWidthLine(double width)
2835 this->UpdateColorActor();
2837 // for the control points
2838 int id, size = _lstViewPoints.size();
2839 for( id=0; id<size; id++)
2841 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2846 // ----------------------------------------------------------------------------
2847 double manualViewBaseContour::GetWidthLine()
2852 // ----------------------------------------------------------------------------
2853 void manualViewBaseContour::ConstructVTKObjects()
2855 //JSTG 29-02-08 -----------------------------------------------
2856 //int i , nps = _sizePointsContour;
2858 int nps = _manContModel->GetNumberOfPointsSpline();
2859 //-------------------------------------------------------------
2861 _pts = vtkPoints::New();
2862 _pts->SetNumberOfPoints(nps);
2864 for (i=0 ; i<nps ; i++){
2865 _pts->SetPoint(i, 0 , 0 , 0 );
2867 // This is for the boundaring inicialisation
2870 _pts->SetPoint(0, 0 , 0 , -1000 );
2871 _pts->SetPoint(1, 0 , 0 , 1000 );
2872 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2873 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2876 vtkCellArray *lines = vtkCellArray::New();
2877 lines->InsertNextCell( nps /* +1 */ );
2878 for ( i=0 ; i<nps+1 ; i++ ){
2879 lines->InsertCellPoint(i % nps );
2882 _pd = vtkPolyData::New();
2883 _pd->SetPoints( _pts );
2884 _pd->SetLines( lines );
2885 lines->Delete(); //do not delete lines ??
2887 _contourVtkActor = vtkActor::New();
2888 _bboxMapper = vtkPolyDataMapper::New();
2889 _bboxMapper->ScalarVisibilityOff( );
2891 _bboxMapper->SetInput(_pd);
2892 _bboxMapper->ImmediateModeRenderingOn();
2893 _contourVtkActor->SetMapper(_bboxMapper);
2894 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2898 _pd->ComputeBounds();
2901 _textActor = vtkTextActor::New();
2902 // _textActor->SetDisplayPosition(200, 200);
2903 _textActor->SetInput("");
2904 // Set coordinates to match the old vtkScaledTextActor default value
2905 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2906 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2907 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2908 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2910 vtkTextProperty *tprop = _textActor->GetTextProperty();
2911 tprop->SetFontSize(14);
2912 tprop->SetFontFamilyToArial();
2913 tprop->SetColor(0, 0, 1);
2915 // ----------------------------------------------------------------------------
2916 void manualViewBaseContour::CreateNewContour()
2918 ConstructVTKObjects();
2920 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2921 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2922 AddCompleteContourActor();
2924 // ----------------------------------------------------------------------------
2925 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2927 manualPoint *mp = _manContModel->GetManualPoint(id);
2930 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2931 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2932 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2934 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2937 // ----------------------------------------------------------------------------
2938 void manualViewBaseContour :: UpdateViewPoints()
2940 int id, size = _lstViewPoints.size();
2941 for( id=0; id<size; id++)
2943 UpdateViewPoint( id );
2947 // ----------------------------------------------------------------------------
2948 void manualViewBaseContour::AddPoint()
2950 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2953 // ----------------------------------------------------------------------------
2954 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2956 _lstViewPoints.push_back( manualViewPoint );
2959 manualViewPoint->SetSpacing(_spc);
2961 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2962 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2965 // ----------------------------------------------------------------------------
2966 void manualViewBaseContour::InsertPoint(int id)
2968 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2971 mvp->SetSpacing(_spc);
2973 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2974 _lstViewPoints.insert(itNum,mvp);
2975 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
2977 // ----------------------------------------------------------------------------
2978 void manualViewBaseContour::DeleteContour()
2980 RemoveCompleteContourActor();
2981 /*if (_contourVtkActor!=NULL){
2982 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
2985 int i,size=_lstViewPoints.size();
2986 for (i=0;i<size;i++){
2987 manualViewBaseContour::DeletePoint(0);
2991 // ----------------------------------------------------------------------------
2992 void manualViewBaseContour::DeletePoint(int id) // virtual
2994 int size=_lstViewPoints.size();
2995 if ( (id>=0) && (id<size) ){
2996 manualViewPoint *mvp =_lstViewPoints[id];
2998 // _handlePicker->DeletePickList(mvp->GetVtkActor());
2999 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
3000 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
3001 _lstViewPoints.erase(itNum);
3006 // ----------------------------------------------------------------------------
3007 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3009 int id=GetIdPoint(x,y,z);
3014 // ----------------------------------------------------------------------------
3015 void manualViewBaseContour::SetSelected(bool selected)
3019 // ----------------------------------------------------------------------------
3020 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3022 _posibleSelected=posibleSelected;
3024 // ----------------------------------------------------------------------------
3025 bool manualViewBaseContour::GetEditable()
3029 // ----------------------------------------------------------------------------
3030 void manualViewBaseContour::SetEditable( bool * condition )
3032 _editable = condition;
3034 // ----------------------------------------------------------------------------
3035 bool manualViewBaseContour::GetSelected()
3039 // ----------------------------------------------------------------------------
3040 bool manualViewBaseContour::GetPosibleSelected()
3042 return _posibleSelected;
3044 // ----------------------------------------------------------------------------
3045 void manualViewBaseContour::DeleteSelectedPoints()
3047 int i,size=_lstViewPoints.size();
3048 for (i=size-1;i>=0;i--){
3049 if (_lstViewPoints[i]->GetSelected()==true){
3055 // ----------------------------------------------------------------------------
3056 void manualViewBaseContour::SelectPoint(int i, bool select)
3058 _lstViewPoints[i]->SetSelected(select);
3060 // ----------------------------------------------------------------------------
3061 void manualViewBaseContour::SelectLstPoints()
3065 // ----------------------------------------------------------------------------
3066 void manualViewBaseContour::SelectAllPoints(bool select)
3068 int i,size=_lstViewPoints.size();
3069 for (i=0;i<size;i++){
3070 SelectPoint(i,select);
3073 //-----------------------------------------------------------------------------
3074 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3076 _viewControlPoints = ifShow;
3078 // ----------------------------------------------------------------------------
3079 bool manualViewBaseContour:: GetIfViewControlPoints()
3081 return _viewControlPoints;
3084 // ----------------------------------------------------------------------------
3085 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3087 _lstViewPoints[id]->SetPosibleSelected(select);
3089 // ----------------------------------------------------------------------------
3090 void manualViewBaseContour::SetPointSelected(int id,bool select)
3092 _lstViewPoints[id]->SetSelected(select);
3094 // ----------------------------------------------------------------------------
3095 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3097 int i,size=_lstViewPoints.size();
3098 for (i=0;i<size;i++){
3099 SetPointPosibleSelected(i,select);
3102 // ----------------------------------------------------------------------------
3103 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3105 SelectAllPossibleSelected(false);
3107 int id = GetIdPoint(x,y,z);
3110 SetPointPosibleSelected(id,true);
3114 // ----------------------------------------------------------------------------
3115 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3118 SetPosibleSelected(result);
3119 int id = GetIdPoint(x,y,z);
3120 if( !GetEditable() && !_selected && id!= -1)
3123 SetPosibleSelected(result);
3127 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3129 if (ifTouchContour(x,y,z)==true)
3132 SetPosibleSelected(result);
3136 if (GetEditable()==false)
3138 if (ifTouchContour(x,y,z)==true)
3141 SetPosibleSelected(result);
3149 // ----------------------------------------------------------------------------
3150 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3154 // ----------------------------------------------------------------------------
3155 void manualViewBaseContour::UnSelectPoint(int i){
3156 _lstViewPoints[i]->SetSelected(false);
3159 // ----------------------------------------------------------------------------
3160 void manualViewBaseContour::UnSelectLstPoints(){
3163 // ----------------------------------------------------------------------------
3164 void manualViewBaseContour::UnSelectAllPoints(){
3165 int i,size=_lstViewPoints.size();
3166 for (i=0;i<size;i++){
3171 // ----------------------------------------------------------------------------
3172 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3173 _manContModel=manContModel;
3175 // ----------------------------------------------------------------------------
3176 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3177 _wxvtkbaseview = wxvtkbaseview;
3179 // ----------------------------------------------------------------------------
3180 void manualViewBaseContour::RefreshContour() // Virtual
3183 // ----------------------------------------------------------------------------
3184 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3186 int i,size = _sizePointsContour;
3187 double *vx = (double*)malloc(sizeof(double)*size);
3188 for (i=0;i<size;i++){
3189 _pts->GetPoint(i,pp);
3194 // ----------------------------------------------------------------------------
3195 double* manualViewBaseContour::GetVectorPointsYManualContour()
3198 int i,size = _sizePointsContour;
3199 double *vy = (double*)malloc(sizeof(double)*size);
3200 for (i=0;i<size;i++){
3201 _pts->GetPoint(i,pp);
3206 // ----------------------------------------------------------------------------
3207 double* manualViewBaseContour::GetVectorPointsZManualContour()
3210 int i,size = _sizePointsContour;
3211 double *vz = (double*)malloc(sizeof(double)*size);
3212 for (i=0;i<size;i++){
3213 _pts->GetPoint(i,pp);
3218 // ----------------------------------------------------------------------------
3219 void manualViewBaseContour::Refresh() // virtual
3221 if (_contourVtkActor!=NULL){
3224 int i,size=_lstViewPoints.size();
3225 for (i=0;i<size;i++){
3227 _lstViewPoints[i]->UpdateColorActor();
3231 if (_show_text==true)
3236 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3239 _wxvtkbaseview->GetRenWin()->Render();
3243 // ----------------------------------------------------------------------------
3244 void manualViewBaseContour::RefreshText() // virtual
3246 if( _textActor!=NULL)
3247 _textActor -> SetInput(" ");
3249 // ----------------------------------------------------------------------------
3250 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3252 _coulorNormal_r = r;
3253 _coulorNormal_g = g;
3254 _coulorNormal_b = b;
3256 // ----------------------------------------------------------------------------
3257 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3259 r = _coulorNormal_r;
3260 g = _coulorNormal_g;
3261 b = _coulorNormal_b;
3263 // ----------------------------------------------------------------------------
3264 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3270 // ----------------------------------------------------------------------------
3271 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3277 // ----------------------------------------------------------------------------
3278 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3280 _coulorSelection_r = r;
3281 _coulorSelection_g = g;
3282 _coulorSelection_b = b;
3284 // ----------------------------------------------------------------------------
3285 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3287 r = _coulorSelection_r;
3288 g = _coulorSelection_g;
3289 b = _coulorSelection_b;
3291 // ----------------------------------------------------------------------------
3292 void manualViewBaseContour::UpdateColorActor()
3294 if (_contourVtkActor!=NULL)
3296 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3297 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3298 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3300 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3304 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3308 // ----------------------------------------------------------------------------
3309 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3312 if (_manContModel!=NULL){
3316 TransfromeCoordViewWorld(xx,yy,zz);
3317 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3322 // ----------------------------------------------------------------------------
3325 int manualViewBaseContour::GetNumberOfPoints()
3327 return _lstViewPoints.size();
3330 // ----------------------------------------------------------------------------
3332 //JSTG 25-02-08 ---------------------------------------------------------------
3333 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3335 return _sizePointsContour;
3337 //----------------------------------------------------------------------------
3339 //JSTG 25-02-08 ---------------------------------------------------------------
3340 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3342 _sizePointsContour = size;
3344 //----------------------------------------------------------------------------
3346 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3348 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3353 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3354 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3357 // ----------------------------------------------------------------------------
3358 void manualViewBaseContour::SetRange(int range)
3362 // ----------------------------------------------------------------------------
3363 int manualViewBaseContour::GetRange()
3367 // ----------------------------------------------------------------------------
3368 void manualViewBaseContour::SetZ(int z)
3372 // ----------------------------------------------------------------------------
3373 int manualViewBaseContour::GetZ()
3378 // ----------------------------------------------------------------------------
3379 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3383 // ----------------------------------------------------------------------------
3384 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3387 // ----------------------------------------------------------------------------
3388 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3392 // ----------------------------------------------------------------------------
3393 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3398 int size=_manContModel->GetSizeLstPoints();
3403 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3409 for( i = 0; i < size; i++ )
3411 mp=_manContModel->GetManualPoint(i);
3463 // ----------------------------------------------------------------------------
3464 void manualViewBaseContour::ClearContour()
3466 if (_contourVtkActor!=NULL){
3467 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3470 int i,size=_lstViewPoints.size();
3471 for (i=0;i<size;i++){
3476 // ----------------------------------------------------------------------------
3477 void manualViewBaseContour::ClearPoint(int id)
3481 // ----------------------------------------------------------------------------
3482 void manualViewBaseContour::SetVisible(bool ok)
3493 int i,size=_lstViewPoints.size();
3494 for (i=0;i<size;i++){
3495 actor = _lstViewPoints[i]->GetVtkActor();
3496 actor->GetProperty()->SetOpacity( opacity );
3498 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3499 _textActor->GetProperty()->SetOpacity( opacity );
3500 _textActor->SetInput(" ");
3503 // ----------------------------------------------------------------------------
3504 void manualViewBaseContour::SetShowText(bool ok)
3507 if (_show_text==false)
3509 _textActor->SetInput(" ");
3512 // ----------------------------------------------------------------------------
3513 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3515 return this->_wxvtkbaseview;
3517 // ----------------------------------------------------------------------------
3518 void manualViewBaseContour::GetSpacing(double spc[3])
3524 // ----------------------------------------------------------------------------
3525 void manualViewBaseContour::SetSpacing(double spc[3])
3533 // ----------------------------------------------------------------------------
3534 // ----------------------------------------------------------------------------
3535 // ----------------------------------------------------------------------------
3537 // _type = 0 Sagital
3538 // _type = 1 Coronal
3540 // _type = -1 View 3D
3542 manualContour3VControler::manualContour3VControler(int type)
3547 // _manViewBaseCont1 = NULL;
3548 // _manViewBaseCont2 = NULL;
3549 // _manViewBaseCont3 = NULL;
3551 //----------------------------------------------------------------------------
3552 manualContour3VControler::~manualContour3VControler()
3556 // ----------------------------------------------------------------------------
3557 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3559 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3560 CopyAttributesTo(clone);
3564 // ---------------------------------------------------------------------------
3565 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3568 manualContourControler::CopyAttributesTo(cloneObject);
3570 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3572 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3575 // ----------------------------------------------------------------------------
3576 int manualContour3VControler::GetType()
3581 // ----------------------------------------------------------------------------
3582 void manualContour3VControler::AddPoint_Others()
3584 manualViewBaseContour *mvbc;
3585 int i,size=this->_lstManualViewBaseContour.size();
3586 for ( i = 0 ; i < size ; i++ )
3588 mvbc = _lstManualViewBaseContour[i];
3593 // if (_manViewBaseCont1!=NULL){
3594 // _manViewBaseCont1->AddPoint();
3595 // _manViewBaseCont2->AddPoint();
3596 // _manViewBaseCont3->AddPoint();
3597 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3600 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3602 // ----------------------------------------------------------------------------
3603 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3606 z=(int)_vtkmprbasedata->GetZ();
3607 if (GetManualContourModel()!=NULL){
3611 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3615 xx=_vtkmprbasedata->GetX();
3620 yy=_vtkmprbasedata->GetY();
3624 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3625 GetManualViewBaseContour()->AddPoint();
3631 // ----------------------------------------------------------------------------
3632 void manualContour3VControler::InsertPoint_Others(int id)
3635 manualViewBaseContour *mvbc;
3636 int i,size=this->_lstManualViewBaseContour.size();
3637 for ( i = 0 ; i < size ; i++ )
3639 mvbc = _lstManualViewBaseContour[i];
3640 mvbc->InsertPoint(id);
3644 if (_manViewBaseCont1!=NULL){
3645 _manViewBaseCont1->InsertPoint(id);
3646 _manViewBaseCont2->InsertPoint(id);
3647 _manViewBaseCont3->InsertPoint(id);
3648 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3652 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3655 // ----------------------------------------------------------------------------
3656 void manualContour3VControler::InsertPoint(int x, int y, int z)
3659 if (GetManualContourModel()!=NULL){
3660 if (GetManualContourModel()->GetSizeLstPoints()>1){
3661 z=(int)_vtkmprbasedata->GetZ();
3665 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3668 xx=_vtkmprbasedata->GetX();
3673 yy=_vtkmprbasedata->GetY();
3676 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3678 GetManualViewBaseContour()->InsertPoint(id);
3679 InsertPoint_Others(0);
3686 // ----------------------------------------------------------------------------
3690 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3691 manualViewBaseContour *manViewBaseCont0,
3692 manualViewBaseContour *manViewBaseCont1,
3693 manualViewBaseContour *manViewBaseCont2,
3694 manualViewBaseContour *manViewBaseCont3)
3696 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3697 _manViewBaseCont1 = manViewBaseCont1;
3698 _manViewBaseCont2 = manViewBaseCont2;
3699 _manViewBaseCont3 = manViewBaseCont3;
3703 // ----------------------------------------------------------------------------
3704 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3706 _lstManualViewBaseContour.push_back( manViewBaseCont );
3709 // ----------------------------------------------------------------------------
3710 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3712 _vtkmprbasedata=vtkmprbasedata;
3714 // ----------------------------------------------------------------------------
3715 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3717 return _vtkmprbasedata;
3719 // ----------------------------------------------------------------------------
3720 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3722 z=(int)_vtkmprbasedata->GetZ();
3723 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3727 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3731 xx=_vtkmprbasedata->GetX();
3735 yy=_vtkmprbasedata->GetY();
3738 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3739 mp->SetPoint(xx,yy,zz);
3743 // ----------------------------------------------------------------------------
3744 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3746 manualViewBaseContour *mvbc;
3747 int i,size=this->_lstManualViewBaseContour.size();
3748 for ( i = 0 ; i < size ; i++ )
3750 mvbc = _lstManualViewBaseContour[i];
3751 mvbc->DeletePoint(id);
3756 if (_manViewBaseCont1!=NULL){
3757 _manViewBaseCont1->DeletePoint(id);
3758 _manViewBaseCont2->DeletePoint(id);
3759 _manViewBaseCont3->DeletePoint(id);
3761 _manViewBaseCont1->Refresh();
3762 _manViewBaseCont2->Refresh();
3763 _manViewBaseCont3->Refresh();
3765 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3768 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3770 // ----------------------------------------------------------------------------
3771 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3773 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3775 manualContourBaseControler::DeleteActualMousePoint( x , y );
3776 DeleteActualMousePoint_Others( id );
3779 // ----------------------------------------------------------------------------
3780 void manualContour3VControler::MouseMove_Others(int id) // virtual
3782 manualViewBaseContour *mvbc;
3783 int i,size=this->_lstManualViewBaseContour.size();
3784 for ( i = 0 ; i < size ; i++ )
3786 mvbc = _lstManualViewBaseContour[i];
3787 mvbc->SelectAllPossibleSelected(false);
3790 mvbc->SetPointPosibleSelected(id,true);
3792 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3798 if (_manViewBaseCont1!=NULL){
3799 _manViewBaseCont1->SelectAllPossibleSelected(false);
3800 _manViewBaseCont2->SelectAllPossibleSelected(false);
3801 _manViewBaseCont3->SelectAllPossibleSelected(false);
3803 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3804 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3805 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3807 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3808 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3809 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3811 _manViewBaseCont1->Refresh();
3812 _manViewBaseCont2->Refresh();
3813 _manViewBaseCont3->Refresh();
3815 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3818 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3822 // ----------------------------------------------------------------------------
3823 void manualContour3VControler::MouseMove(int x, int y) // virtual
3825 manualContourControler::MouseMove( x , y );
3826 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3827 MouseMove_Others( id );
3830 // ----------------------------------------------------------------------------
3831 void manualContour3VControler::OnChar_Others()
3833 manualViewBaseContour *mvbc;
3834 int i,size=this->_lstManualViewBaseContour.size();
3835 for ( i = 0 ; i < size ; i++ )
3837 mvbc = _lstManualViewBaseContour[i];
3842 _manViewBaseCont1->Refresh();
3843 _manViewBaseCont2->Refresh();
3844 _manViewBaseCont3->Refresh();
3846 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3848 // ----------------------------------------------------------------------------
3849 bool manualContour3VControler::OnChar()
3851 manualContourControler::OnChar();
3855 // ----------------------------------------------------------------------------
3856 void manualContour3VControler::ResetContour() // virtual
3858 manualContourControler::ResetContour();
3859 ResetContour_Others();
3862 // ----------------------------------------------------------------------------
3863 void manualContour3VControler::ResetContour_Others()
3865 manualViewBaseContour *mvbc;
3866 int i,size=this->_lstManualViewBaseContour.size();
3867 for ( i = 0 ; i < size ; i++ )
3869 mvbc = _lstManualViewBaseContour[i];
3870 mvbc->DeleteContour();
3871 mvbc->CreateNewContour();
3876 _manViewBaseCont1->DeleteContour();
3877 _manViewBaseCont2->DeleteContour();
3878 _manViewBaseCont3->DeleteContour();
3879 _manViewBaseCont1->CreateNewContour();
3880 _manViewBaseCont2->CreateNewContour();
3881 _manViewBaseCont3->CreateNewContour();
3885 // ----------------------------------------------------------------------------
3886 // ----------------------------------------------------------------------------
3887 // ----------------------------------------------------------------------------
3888 manualContour3DControler::manualContour3DControler()
3891 // ----------------------------------------------------------------------------
3892 manualContour3DControler::~manualContour3DControler()
3895 // ----------------------------------------------------------------------------
3896 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3898 manualContour3DControler * clone = new manualContour3DControler();
3899 CopyAttributesTo(clone);
3903 // ---------------------------------------------------------------------------
3904 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3907 manualContourControler::CopyAttributesTo(cloneObject);
3909 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3912 // ----------------------------------------------------------------------------
3913 bool manualContour3DControler::OnLeftButtonDown()
3916 wxVTKRenderWindowInteractor *wxVTKiren;
3917 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3918 wxVTKiren->GetEventPosition(X,Y);
3919 MouseClickLeft(X,Y);
3922 // ----------------------------------------------------------------------------
3923 void manualContour3DControler::ResetOrientationPlane()
3925 double p[3],rp[3],rn[3];
3926 p[0] = this->GetVtkMPRBaseData()->GetX( );
3927 p[1] = this->GetVtkMPRBaseData()->GetY( );
3928 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3929 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3930 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3932 // ----------------------------------------------------------------------------
3933 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3935 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3936 int id=manualview3Dcontour->GetIdPoint2(x,y);
3937 if ( (GetState()==0) && (id!=-1) )
3939 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3941 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3942 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3943 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3944 ResetOrientationPlane();
3945 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3949 manualContourControler::MouseClickLeft(x,y);
3952 // ----------------------------------------------------------------------------
3953 bool manualContour3DControler::OnChar()
3956 manualContourControler::OnChar();
3957 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3960 ResetOrientationPlane();
3961 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3966 // ----------------------------------------------------------------------------
3967 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3969 _vtkmprbasedata=vtkmprbasedata;
3971 // ----------------------------------------------------------------------------
3972 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3974 return _vtkmprbasedata;
3977 // ----------------------------------------------------------------------------
3978 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
3980 manualContourControler::InsertPoint( x, y, z );
3981 ResetOrientationPlane();
3986 // ----------------------------------------------------------------------------
3987 // ----------------------------------------------------------------------------
3988 // ----------------------------------------------------------------------------
3990 manualContour3V3DControler::manualContour3V3DControler()
3993 // ----------------------------------------------------------------------------
3994 manualContour3V3DControler::~manualContour3V3DControler()
3998 // ----------------------------------------------------------------------------
3999 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
4001 manualContour3V3DControler * clone = new manualContour3V3DControler();
4002 CopyAttributesTo(clone);
4006 // ---------------------------------------------------------------------------
4007 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4010 manualContour3DControler::CopyAttributesTo(cloneObject);
4012 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4014 // ----------------------------------------------------------------------------
4015 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4017 manualContour3DControler::InsertPoint( x, y, z );
4018 _manualcontour3Vcontroler->InsertPoint_Others(0);
4020 // ----------------------------------------------------------------------------
4021 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4023 manualContour3DControler::AddPoint( x, y, z );
4024 _manualcontour3Vcontroler->AddPoint_Others();
4026 // ----------------------------------------------------------------------------
4027 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4029 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4030 manualContour3DControler::DeleteActualMousePoint( x , y );
4031 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4033 // ----------------------------------------------------------------------------
4034 void manualContour3V3DControler::MouseMove( int x, int y )
4036 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4037 if ((this->GetState()!=7) && (ss!=1)){
4038 manualContour3DControler::MouseMove( x , y );
4039 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4040 _manualcontour3Vcontroler->MouseMove_Others(id);
4043 // ----------------------------------------------------------------------------
4044 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4046 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4048 // ----------------------------------------------------------------------------
4049 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4051 return _manualcontour3Vcontroler;
4053 // ----------------------------------------------------------------------------
4054 bool manualContour3V3DControler::OnChar() // virtual
4056 if (manualContour3DControler::OnChar()==false )
4058 _manualcontour3Vcontroler->OnChar_Others();
4063 // ----------------------------------------------------------------------------
4064 void manualContour3V3DControler::ResetContour() // virtual
4066 manualContourControler::ResetContour();
4067 _manualcontour3Vcontroler->ResetContour_Others();
4071 // ----------------------------------------------------------------------------
4072 // ----------------------------------------------------------------------------
4073 // ----------------------------------------------------------------------------
4075 // _state = 0 // ..nothing..
4076 // _state = 1 // move with add point
4077 // _state = 5 // move
4078 // _state = 6 // move with insert point
4079 // _state = 7 // move with non selection
4081 manualContourControler::manualContourControler()
4083 _easyCreation = true;
4086 // ----------------------------------------------------------------------------
4087 manualContourControler::~manualContourControler()
4090 // ----------------------------------------------------------------------------
4091 manualContourControler * manualContourControler :: Clone() // virtual
4093 manualContourControler * clone = new manualContourControler();
4094 CopyAttributesTo(clone);
4097 // ---------------------------------------------------------------------------
4098 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4101 manualContourBaseControler::CopyAttributesTo(cloneObject);
4102 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4105 // ----------------------------------------------------------------------------
4106 void manualContourControler::Configure() //virtual
4108 // this->_manContModel->SetNumberOfPointsSpline(100);
4111 // ----------------------------------------------------------------------------
4112 void manualContourControler::MouseClickLeft(int x, int y){
4117 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4119 // Insert a Control Point with shift+ClickLeft
4120 // int tt = GetState(); // JPRx
4121 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4125 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4131 // Start to Insert Control Points with ClickLeft (Empty contour)
4132 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4138 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4139 if ((GetState()==1) && (_easyCreation==true) )
4143 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4145 // Insert Control Points IF Contour si Selected
4146 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4150 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4153 // Chose id of Control Point to be move
4154 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4157 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4160 // If nothing selected _state=7
4161 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4164 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4170 SetPosibleToMove( true );
4171 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4173 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4177 GetManualViewBaseContour()->InitMove(x,y,z);
4182 GetManualViewBaseContour()->Refresh();
4185 // ----------------------------------------------------------------------------
4186 void manualContourControler::MouseMove(int x, int y) // virtual
4189 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4190 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4191 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4192 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4193 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4195 GetManualViewBaseContour()->MoveContour(x,y,z);
4197 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4198 GetManualViewBaseContour()->Refresh();
4199 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4203 GetManualViewBaseContour()->RemoveControlPoints();
4204 GetManualViewBaseContour()->RemoveTextActor();
4205 GetManualViewBaseContour()->Refresh();
4206 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4211 // ----------------------------------------------------------------------------
4212 void manualContourControler::MouseDLeft( int x, int y)//virtual
4214 manualContourBaseControler::MouseDLeft( x, y);
4217 GetManualViewBaseContour()->AddControlPoints();
4218 GetManualViewBaseContour()->AddTextActor();
4219 GetManualViewBaseContour()->Refresh();
4220 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4223 // ----------------------------------------------------------------------------
4224 void manualContourControler::SetEasyCreation(bool easyCreation)
4226 _easyCreation=easyCreation;
4228 // ----------------------------------------------------------------------------
4229 bool manualContourControler::GetEasyCreation()
4231 return _easyCreation;
4235 // ----------------------------------------------------------------------------
4236 // ----------------------------------------------------------------------------
4237 // ----------------------------------------------------------------------------
4238 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4240 _flagMouseMove = true;
4242 // ----------------------------------------------------------------------------
4243 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4246 // ----------------------------------------------------------------------------
4247 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4249 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4250 CopyAttributesTo(clone);
4254 // ---------------------------------------------------------------------------
4255 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4258 manualContourControler::CopyAttributesTo(cloneObject);
4260 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4261 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4262 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4265 // ----------------------------------------------------------------------------
4266 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4268 _vtkmprbasedata = vtkmprbasedata;
4271 // ----------------------------------------------------------------------------
4272 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4274 return _vtkmprbasedata;
4278 // ----------------------------------------------------------------------------
4279 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4281 manualContourControler::InsertPoint( x, y, z );
4282 _manualcontour3Vcontroler->InsertPoint_Others(0);
4284 // ----------------------------------------------------------------------------
4285 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4287 manualContourControler::AddPoint( x, y, z );
4288 _manualcontour3Vcontroler->AddPoint_Others();
4290 // ----------------------------------------------------------------------------
4291 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4293 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4294 manualContourControler::DeleteActualMousePoint( x , y );
4295 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4297 // ----------------------------------------------------------------------------
4298 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4300 _flagMouseMove = true;
4301 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4302 if ((this->GetState()!=7) && (ss!=1)){
4303 manualContourControler::MouseMove( x , y );
4304 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4307 _manualcontour3Vcontroler->MouseMove_Others(id);
4308 _flagMouseMove = false;
4312 // ----------------------------------------------------------------------------
4313 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4315 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4317 // ----------------------------------------------------------------------------
4318 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4320 return _manualcontour3Vcontroler;
4322 // ----------------------------------------------------------------------------
4323 bool manualContourPerpPlaneControler::OnChar() // virtual
4325 if (manualContourControler::OnChar()==false )
4327 _manualcontour3Vcontroler->OnChar_Others();
4331 // ----------------------------------------------------------------------------
4332 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4334 manualContourControler::OnMouseMove();
4335 return _flagMouseMove;
4337 // ----------------------------------------------------------------------------
4338 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4340 manualContourControler::OnLeftDClick();
4341 return _flagMouseDClick;
4343 // ----------------------------------------------------------------------------
4344 void manualContourPerpPlaneControler::ResetContour() // virtual
4346 manualContourControler::ResetContour();
4347 _manualcontour3Vcontroler->ResetContour_Others();
4350 // ----------------------------------------------------------------------------
4351 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4353 _flagMouseDClick=true;
4354 manualContourControler::MouseDLeft(x,y);
4356 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4358 _flagMouseDClick = false;
4359 _vtkinteractorstyleplane2D->OnLeftDClick();
4360 ResetOrientationPlane();
4361 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4364 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4365 // if ( (GetState()==0) && (id!=-1) )
4367 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4368 // _vtkmprbasedata->SetX( mp->GetX() );
4369 // _vtkmprbasedata->SetY( mp->GetY() );
4370 // _vtkmprbasedata->SetZ( mp->GetZ() );
4371 // ResetOrientationPlane();
4372 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4378 // ----------------------------------------------------------------------------
4379 void manualContourPerpPlaneControler::ResetOrientationPlane()
4381 double p[3],rp[3],rn[3];
4382 p[0] = _vtkmprbasedata->GetX( );
4383 p[1] = _vtkmprbasedata->GetY( );
4384 p[2] = _vtkmprbasedata->GetZ( );
4385 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4387 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4390 // ----------------------------------------------------------------------------
4391 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4393 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4395 // ----------------------------------------------------------------------------
4396 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4398 return _vtkinteractorstyleplane2D;
4401 // ----------------------------------------------------------------------------
4402 // ----------------------------------------------------------------------------
4403 // ----------------------------------------------------------------------------
4405 // _state = 0 // ..nothing..
4406 // _state = 5 // move point
4407 // _state = 6 // move all
4408 // _state = 7 // Empty mouse drag
4410 manualRoiControler::manualRoiControler()
4413 // ----------------------------------------------------------------------------
4414 manualRoiControler::~manualRoiControler()
4417 // ----------------------------------------------------------------------------
4418 manualRoiControler * manualRoiControler :: Clone() // virtual
4420 manualRoiControler * clone = new manualRoiControler();
4421 CopyAttributesTo(clone);
4425 // ---------------------------------------------------------------------------
4426 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4429 manualContourBaseControler::CopyAttributesTo(cloneObject);
4432 // ----------------------------------------------------------------------------
4433 void manualRoiControler::Configure() //virtual
4435 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4438 // ----------------------------------------------------------------------------
4439 void manualRoiControler::MouseClickLeft(int x, int y){
4441 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4442 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4445 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4446 GetManualViewBaseContour()->InitMove(x,y,z);
4449 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4450 if (GetState()==0) {
4462 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4465 GetManualViewBaseContour()->Refresh();
4467 // ----------------------------------------------------------------------------
4468 void manualRoiControler::MouseMove(int x, int y) // virtual
4472 // this->_vtkInteractorStyleBaseView->
4474 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4475 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4478 SetPoint( bakIdPoint , x , y ,z);
4501 GetManualViewBaseContour()->MoveContour(x,y,z);
4503 GetManualViewBaseContour()->Refresh();
4505 // ----------------------------------------------------------------------------
4506 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4509 // ----------------------------------------------------------------------------
4510 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4515 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4524 double pp1=porcentage;
4525 double pp2=1-porcentage;
4527 mp = GetManualContourModel()->GetManualPoint(2);
4529 mp->SetPoint(ww*pp1,hh*pp1,zz);
4531 mp = GetManualContourModel()->GetManualPoint(1);
4533 mp->SetPoint(ww*pp2,hh*pp1,zz);
4535 mp = GetManualContourModel()->GetManualPoint(0);
4537 mp->SetPoint(ww*pp2,hh*pp2,zz);
4539 mp = GetManualContourModel()->GetManualPoint(3);
4541 mp->SetPoint(ww*pp1,hh*pp2,zz);
4543 GetManualViewBaseContour() ->UpdateViewPoint(0);
4544 GetManualViewBaseContour() ->UpdateViewPoint(1);
4545 GetManualViewBaseContour() ->UpdateViewPoint(2);
4546 GetManualViewBaseContour() ->UpdateViewPoint(3);
4549 GetManualViewBaseContour()->Refresh();
4552 // ----------------------------------------------------------------------------
4553 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4556 InitRoi( 0 , 0 , 0.2 );
4557 mp = GetManualContourModel()->GetManualPoint(2);
4561 mp = GetManualContourModel()->GetManualPoint(1);
4565 mp = GetManualContourModel()->GetManualPoint(0);
4569 mp = GetManualContourModel()->GetManualPoint(3);
4573 GetManualViewBaseContour() ->UpdateViewPoint(0);
4574 GetManualViewBaseContour() ->UpdateViewPoint(1);
4575 GetManualViewBaseContour() ->UpdateViewPoint(2);
4576 GetManualViewBaseContour() ->UpdateViewPoint(3);
4580 // ----------------------------------------------------------------------------
4581 // ----------------------------------------------------------------------------
4582 // ----------------------------------------------------------------------------
4586 // _state = 0 // ..nothing..
4587 // _state = 5 // move point
4588 // _state = 6 // move all
4589 // _state = 7 // Empty mouse drag
4591 manualCircleControler::manualCircleControler()
4594 // ----------------------------------------------------------------------------
4595 manualCircleControler::~manualCircleControler()
4598 // ----------------------------------------------------------------------------
4599 manualCircleControler * manualCircleControler :: Clone() // virtual
4601 manualCircleControler * clone = new manualCircleControler();
4602 CopyAttributesTo(clone);
4606 // ---------------------------------------------------------------------------
4607 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4610 manualContourBaseControler::CopyAttributesTo(cloneObject);
4613 // ----------------------------------------------------------------------------
4614 void manualCircleControler::Configure() //virtual
4616 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4619 // ----------------------------------------------------------------------------
4620 void manualCircleControler::MouseClickLeft(int x, int y){
4622 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4623 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4626 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4627 GetManualViewBaseContour()->InitMove(x,y,z);
4630 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4631 if (GetState()==0) {
4640 // SetPoint(2,x,y,z);
4641 // SetPoint(3,x,y,z);
4643 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4646 GetManualViewBaseContour()->Refresh();
4648 // ----------------------------------------------------------------------------
4650 void manualCircleControler::MouseMove(int x, int y) // virtual
4654 // this->_vtkInteractorStyleBaseView->
4656 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4657 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4660 SetPoint( bakIdPoint , x , y ,z);
4686 GetManualViewBaseContour()->MoveContour(x,y,z);
4688 GetManualViewBaseContour()->Refresh();
4692 // ----------------------------------------------------------------------------
4693 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4696 // ----------------------------------------------------------------------------
4698 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4703 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4708 // AddPoint(0,0,zz);
4709 // AddPoint(0,0,zz);
4712 double pp1=porcentage;
4713 double pp2=1-porcentage;
4715 // mp = GetManualContourModel()->GetManualPoint(2);
4716 // zz=(int)mp->GetZ();
4717 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4719 mp = GetManualContourModel()->GetManualPoint(1);
4721 mp->SetPoint(ww*pp2,hh*pp1,zz);
4723 mp = GetManualContourModel()->GetManualPoint(0);
4725 mp->SetPoint(ww*pp2,hh*pp2,zz);
4727 // mp = GetManualContourModel()->GetManualPoint(3);
4728 // zz=(int)mp->GetZ();
4729 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4731 GetManualViewBaseContour() ->UpdateViewPoint(0);
4732 GetManualViewBaseContour() ->UpdateViewPoint(1);
4733 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4734 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4737 GetManualViewBaseContour()->Refresh();
4740 // ----------------------------------------------------------------------------
4742 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4745 InitRoi( 0 , 0 , 0.2 );
4746 mp = GetManualContourModel()->GetManualPoint(2);
4750 mp = GetManualContourModel()->GetManualPoint(1);
4754 mp = GetManualContourModel()->GetManualPoint(0);
4758 mp = GetManualContourModel()->GetManualPoint(3);
4762 GetManualViewBaseContour() ->UpdateViewPoint(0);
4763 GetManualViewBaseContour() ->UpdateViewPoint(1);
4764 GetManualViewBaseContour() ->UpdateViewPoint(2);
4765 GetManualViewBaseContour() ->UpdateViewPoint(3);
4770 // ----------------------------------------------------------------------------
4771 // ----------------------------------------------------------------------------
4772 // ----------------------------------------------------------------------------
4776 // _state = 0 // ..nothing..
4777 // _state = 5 // move point
4778 // _state = 6 // move all
4779 // _state = 7 // Empty mouse drag
4781 manualLineControler::manualLineControler()
4784 // ----------------------------------------------------------------------------
4785 manualLineControler::~manualLineControler()
4788 // ----------------------------------------------------------------------------
4789 manualLineControler * manualLineControler :: Clone() // virtual
4791 manualLineControler * clone = new manualLineControler();
4792 CopyAttributesTo(clone);
4796 // ---------------------------------------------------------------------------
4797 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4800 manualContourBaseControler::CopyAttributesTo(cloneObject);
4803 // ----------------------------------------------------------------------------
4804 void manualLineControler::MouseClickLeft(int x, int y){
4806 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4807 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4810 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4811 GetManualViewBaseContour()->InitMove(x,y,z);
4814 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4815 if (GetState()==0) {
4823 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4826 GetManualViewBaseContour()->Refresh();
4828 // ----------------------------------------------------------------------------
4830 void manualLineControler::MouseMove(int x, int y) // virtual
4834 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4835 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4839 SetPoint( bakIdPoint , x , y ,z);
4843 GetManualViewBaseContour()->MoveContour(x,y,z);
4845 GetManualViewBaseContour()->Refresh();
4849 // ----------------------------------------------------------------------------
4850 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4853 // ----------------------------------------------------------------------------
4855 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4860 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4867 double pp1=porcentage;
4868 double pp2=1-porcentage;
4870 mp = GetManualContourModel()->GetManualPoint(0);
4872 mp->SetPoint(ww*pp2,hh*pp2,zz);
4874 mp = GetManualContourModel()->GetManualPoint(1);
4876 mp->SetPoint(ww*pp2,hh*pp1,zz);
4878 GetManualViewBaseContour() ->UpdateViewPoint(0);
4879 GetManualViewBaseContour() ->UpdateViewPoint(1);
4882 GetManualViewBaseContour()->Refresh();
4885 // ----------------------------------------------------------------------------
4886 // ----------------------------------------------------------------------------
4887 // ----------------------------------------------------------------------------
4890 manualContourBaseControler::manualContourBaseControler()
4892 _manViewBaseCont = NULL;
4893 _manContModel = NULL;
4897 _posibleToMove = true;
4900 _keyBoardMoving = false;
4902 // ----------------------------------------------------------------------------
4903 manualContourBaseControler::~manualContourBaseControler()
4907 // ----------------------------------------------------------------------------
4908 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4910 manualContourBaseControler * clone = new manualContourBaseControler();
4911 CopyAttributesTo(clone);
4915 // ---------------------------------------------------------------------------
4917 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4920 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4921 cloneObject->SetZ( this->GetZ() );
4922 cloneObject->SetState( this->GetState() );
4923 cloneObject->SetEditable( this->IsEditable() );
4924 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4925 cloneObject->SetMoving( this->IsMoving() );
4926 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4927 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4930 // ----------------------------------------------------------------------------
4931 void manualContourBaseControler::Configure() //virtual
4935 // ----------------------------------------------------------------------------
4936 bool manualContourBaseControler::OnChar()
4938 if ( _vtkInteractorStyleBaseView!=NULL )
4940 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4943 wxVTKRenderWindowInteractor *_wxVTKiren;
4944 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4945 _wxVTKiren->GetEventPosition(X, Y);
4946 //int Z = GetZ(); // JPRx
4948 if ((keyCode==8) || (keyCode==127))
4951 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4953 DeleteActualMousePoint(X,Y);
4955 GetManualViewBaseContour()->Refresh();
4956 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4964 GetManualViewBaseContour()->Refresh();
4965 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4967 else if( !IsEditable() )
4969 if ( keyCode == 'L' )
4971 GetManualViewBaseContour()->MoveContour( -1, 0 );
4972 SetKeyBoardMoving( true );
4974 else if ( keyCode == 'R' )
4976 GetManualViewBaseContour()->MoveContour( 1, 0 );
4977 SetKeyBoardMoving( true );
4979 else if ( keyCode == 'U' )
4981 GetManualViewBaseContour()->MoveContour( 0, -1 );
4982 SetKeyBoardMoving( true );
4984 else if ( keyCode == 'D' )
4986 GetManualViewBaseContour()->MoveContour( 0, 1 );
4987 SetKeyBoardMoving( true );
4989 else if ( keyCode == 'W' )//Diagonal left down
4991 GetManualViewBaseContour()->MoveContour( -1, 1 );
4992 SetKeyBoardMoving( true );
4994 else if ( keyCode == 'Q' )//Diagonal left up
4996 GetManualViewBaseContour()->MoveContour( -1, -1 );
4997 SetKeyBoardMoving( true );
4999 else if( keyCode == 'P' )//Diagonal right up
5001 GetManualViewBaseContour()->MoveContour( 1, -1 );
5002 SetKeyBoardMoving( true );
5004 else if( keyCode == 'M' )//Diagonal right down
5006 GetManualViewBaseContour()->MoveContour( 1, 1 );
5007 SetKeyBoardMoving( true );
5009 if( GetKeyBoardMoving() )
5011 GetManualViewBaseContour()->Refresh();
5012 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5019 // ----------------------------------------------------------------------------
5020 bool manualContourBaseControler::OnMouseMove()
5022 if ( _vtkInteractorStyleBaseView!=NULL)
5025 wxVTKRenderWindowInteractor *_wxVTKiren;
5026 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5027 _wxVTKiren->GetEventPosition( X , Y );
5030 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5031 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5037 // ----------------------------------------------------------------------------
5038 bool manualContourBaseControler::OnLeftButtonDown()
5040 SetKeyBoardMoving( false );
5041 if ( _vtkInteractorStyleBaseView!=NULL )
5044 wxVTKRenderWindowInteractor *wxVTKiren;
5045 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5046 wxVTKiren->GetEventPosition(X,Y);
5048 MouseClickLeft(X,Y);
5052 // ----------------------------------------------------------------------------
5053 bool manualContourBaseControler::OnLeftButtonUp()
5055 if ( _vtkInteractorStyleBaseView!=NULL )
5058 wxVTKRenderWindowInteractor *wxVTKiren;
5059 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5060 wxVTKiren->GetEventPosition(X,Y);
5061 MouseReleaseLeft(X,Y);
5065 // ----------------------------------------------------------------------------
5066 bool manualContourBaseControler::OnLeftDClick()
5068 if ( _vtkInteractorStyleBaseView!=NULL )
5071 wxVTKRenderWindowInteractor *wxVTKiren;
5072 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5073 wxVTKiren->GetEventPosition(X,Y);
5075 this->MouseDLeft(X,Y);
5079 // ----------------------------------------------------------------------------
5080 bool manualContourBaseControler::OnMiddleButtonDown()
5082 // SetKeyBoardMoving( false );
5083 if ( _vtkInteractorStyleBaseView!=NULL )
5086 wxVTKRenderWindowInteractor *wxVTKiren;
5087 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5088 wxVTKiren->GetEventPosition(X,Y);
5089 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5093 // ----------------------------------------------------------------------------
5094 bool manualContourBaseControler::OnMiddleButtonUp()
5098 // ----------------------------------------------------------------------------
5099 bool manualContourBaseControler::OnRightButtonDown()
5101 if( _vtkInteractorStyleBaseView!= NULL )
5104 wxVTKRenderWindowInteractor *wxVTKiren;
5105 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5106 wxVTKiren->GetEventPosition(X, Y);
5108 SetCompleteCreation( true );
5109 SetKeyBoardMoving( false );
5110 MouseClickRight(X,Y);
5114 // ----------------------------------------------------------------------------
5115 bool manualContourBaseControler::OnRightButtonUp()
5119 // ----------------------------------------------------------------------------
5120 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5121 _manContModel = manContModel;
5122 _manViewBaseCont = manViewBaseCont;
5123 _manViewBaseCont->SetEditable( &_editable );
5125 // ----------------------------------------------------------------------------
5126 manualContourModel* manualContourBaseControler::GetManualContourModel()
5128 return _manContModel;
5130 // ----------------------------------------------------------------------------
5131 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5133 return _manViewBaseCont;
5135 // ----------------------------------------------------------------------------
5136 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5140 // ----------------------------------------------------------------------------
5141 void manualContourBaseControler::MouseClickRight(int x, int y)
5147 SetEditable( false );
5148 SetPosibleToMove( false );
5152 // ----------------------------------------------------------------------------
5153 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5155 if (_state==5){ _state = 0; }
5156 if (_state==6){ _state = 0; }
5157 if (_state==7){ _state = 0; }
5159 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5160 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5162 SetEditable( false );
5163 SetPosibleToMove( false );
5166 // ----------------------------------------------------------------------------
5167 void manualContourBaseControler::MouseDLeft(int x, int y )
5172 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5173 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5174 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5180 // ----------------------------------------------------------------------------
5181 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5184 // ----------------------------------------------------------------------------
5185 void manualContourBaseControler::SetState(int state)
5189 // ----------------------------------------------------------------------------
5190 int manualContourBaseControler::GetState()
5194 // ----------------------------------------------------------------------------
5195 bool manualContourBaseControler::IsEditable( )
5199 // ----------------------------------------------------------------------------
5200 void manualContourBaseControler::SetEditable( bool condition )
5202 if (GetManualViewBaseContour()!=NULL) {
5205 GetManualViewBaseContour()->RemoveControlPoints();
5207 GetManualViewBaseContour()->SetSelected( condition );
5209 _editable = condition;
5212 // ----------------------------------------------------------------------------
5213 bool manualContourBaseControler::GetPosibleToMove()
5215 return _posibleToMove;
5217 // ----------------------------------------------------------------------------
5218 void manualContourBaseControler::SetPosibleToMove( bool condition )
5220 _posibleToMove = condition;
5222 // ----------------------------------------------------------------------------
5223 bool manualContourBaseControler::IsMoving()
5227 // ----------------------------------------------------------------------------
5228 void manualContourBaseControler::SetMoving( bool condition )
5230 _moving = condition;
5232 // ----------------------------------------------------------------------------
5233 void manualContourBaseControler::SetCompleteCreation( bool condition )
5235 _created = condition;
5237 // ----------------------------------------------------------------------------
5238 bool manualContourBaseControler::GetIfCompleteCreation ( )
5242 // ----------------------------------------------------------------------------
5243 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5245 _keyBoardMoving = condition;
5247 // ----------------------------------------------------------------------------
5248 bool manualContourBaseControler::GetKeyBoardMoving( )
5250 return _keyBoardMoving;
5252 // ----------------------------------------------------------------------------
5253 void manualContourBaseControler::CreateNewManualContour(){
5254 _manViewBaseCont->CreateNewContour();
5256 // ----------------------------------------------------------------------------
5257 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5258 return _manViewBaseCont->GetNumberOfPoints();
5260 // ----------------------------------------------------------------------------
5262 //JSTG - 25-02-08 -------------------------------------------------------------
5263 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5264 //return _manViewBaseCont->GetNumberOfPointsSpline();
5265 return _manContModel->GetNumberOfPointsSpline();
5267 // ----------------------------------------------------------------------------
5269 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5270 return _manViewBaseCont->GetVectorPointsXManualContour();
5272 // ----------------------------------------------------------------------------
5273 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5274 return _manViewBaseCont->GetVectorPointsYManualContour();
5276 // ----------------------------------------------------------------------------
5277 void manualContourBaseControler::DeleteContour(){
5278 _manViewBaseCont->DeleteContour();
5279 _manContModel->DeleteAllPoints();
5281 // ----------------------------------------------------------------------------
5282 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5284 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5286 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5287 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5288 _manContModel->DeletePoint(id);
5289 _manViewBaseCont->DeletePoint(id);
5295 // ----------------------------------------------------------------------------
5296 void manualContourBaseControler::Magnet(int x, int y)
5300 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5301 if (GetManualContourModel()!=NULL){
5305 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5306 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5309 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5310 mp->SetPoint(xx,yy,zz);
5312 // GetManualViewBaseContour()->UpdateViewPoint(id);
5318 // ----------------------------------------------------------------------------
5319 void manualContourBaseControler::SetZ(int z)
5323 // ----------------------------------------------------------------------------
5324 int manualContourBaseControler::GetZ()
5328 // ----------------------------------------------------------------------------
5329 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5331 if (GetManualContourModel()!=NULL){
5335 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5336 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5337 GetManualViewBaseContour()->AddPoint();
5338 // GetManualViewBaseContour()->UpdateViewPoint(id);
5341 // ----------------------------------------------------------------------------
5342 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5346 if (GetManualContourModel()!=NULL){
5350 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5351 if (GetManualContourModel()->GetSizeLstPoints()>1){
5352 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5353 GetManualViewBaseContour()->InsertPoint(id);
5354 // GetManualViewBaseContour()->UpdateViewPoint(id);
5356 GetManualContourModel()->AddPoint(xx,yy,zz);
5357 GetManualViewBaseContour()->AddPoint();
5359 // GetManualViewBaseContour()->UpdateViewPoint(id);
5364 // ----------------------------------------------------------------------------
5365 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5366 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5370 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5371 manualPoint *mp = _manContModel->GetManualPoint(id);
5372 mp->SetPoint(xx,yy,zz);
5373 GetManualViewBaseContour()->UpdateViewPoint(id);
5376 // ----------------------------------------------------------------------------
5377 void manualContourBaseControler::SetPointX( int id ,int x ){
5378 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5382 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5383 manualPoint *mp = _manContModel->GetManualPoint(id);
5385 GetManualViewBaseContour()->UpdateViewPoint(id);
5388 // ----------------------------------------------------------------------------
5389 void manualContourBaseControler::SetPointY( int id ,int y ){
5390 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5394 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5395 manualPoint *mp = _manContModel->GetManualPoint(id);
5397 GetManualViewBaseContour()->UpdateViewPoint(id);
5400 // ----------------------------------------------------------------------------
5401 void manualContourBaseControler::SetPointZ( int id ,int z ){
5402 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5406 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5407 manualPoint *mp = _manContModel->GetManualPoint(id);
5409 GetManualViewBaseContour()->UpdateViewPoint(id);
5412 // ----------------------------------------------------------------------------
5413 void manualContourBaseControler::ResetContour() // virtual
5415 this->DeleteContour();
5416 GetManualViewBaseContour()->CreateNewContour();