3 #include <vtkProperty.h>
5 #include <vtkCellArray.h>
6 #include <vtkRenderer.h>
7 #include <vtkCoordinate.h>
8 #include <vtkTextProperty.h>
9 #include <vtkTextActor.h>
10 #include <vtkProperty2D.h>
11 #include <vtkPointPicker.h>
12 #include "widgets/UtilVtk3DGeometriSelection.h"
15 #include "manualContour.h"
18 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 manualPoint::manualPoint(){
24 // ----------------------------------------------------------------------------
25 manualPoint::~manualPoint(){
27 // ----------------------------------------------------------------------------
28 void manualPoint::SetPoint(double x,double y,double z){
33 // ----------------------------------------------------------------------------
34 void manualPoint::SetPointX(double x){
37 // ----------------------------------------------------------------------------
38 void manualPoint::SetPointY(double y){
41 // ----------------------------------------------------------------------------
42 void manualPoint::SetPointZ(double z){
45 // ----------------------------------------------------------------------------
46 double manualPoint::GetX(){
49 // ----------------------------------------------------------------------------
50 double manualPoint::GetY(){
53 // ----------------------------------------------------------------------------
54 double manualPoint::GetZ(){
57 // ----------------------------------------------------------------------------
58 manualPoint * manualPoint :: Clone()
60 manualPoint * clone = new manualPoint();
61 clone->SetPoint( GetX(), GetY(), GetZ());
66 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 manualContourModelCircle::manualContourModelCircle()
71 : manualContourModel()
75 manualContourModelCircle::~manualContourModelCircle()
80 // ----------------------------------------------------------------------------
81 manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
83 manualContourModelCircle * clone = new manualContourModelCircle();
84 CopyAttributesTo(clone);
88 // ---------------------------------------------------------------------------
90 void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
93 manualContourModel::CopyAttributesTo(cloneObject);
96 //----------------------------------------------------------------
97 int manualContourModelCircle::GetTypeModel() //virtual
102 //----------------------------------------------------------------
103 void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
105 double angle = _deltaAngle*i;
106 *x = _radio*cos(angle) + _centerX;
107 *y = _radio*sin(angle) + _centerY;
112 // ---------------------------------------------------------------------------
113 void manualContourModelCircle::UpdateSpline() // virtal
115 manualPoint *mpA,*mpB;
117 int np = GetSizeLstPoints( );
118 int nps = GetNumberOfPointsSpline();
119 _deltaAngle=(3.14159265*2)/(nps-1);
122 mpA = GetManualPoint(0);
123 mpB = GetManualPoint(1);
124 difX = mpA->GetX() - mpB->GetX();
125 difY = mpA->GetY() - mpB->GetY();
126 _radio = sqrt( difX*difX + difY*difY );
127 _centerX = mpA->GetX();
128 _centerY = mpA->GetY();
129 _centerZ = mpA->GetZ();
138 // ----------------------------------------------------------------------------
139 // ----------------------------------------------------------------------------
140 // ----------------------------------------------------------------------------
144 manualContourModelLine::manualContourModelLine()
145 : manualContourModel()
147 SetNumberOfPointsSpline(20);
148 this->SetCloseContour(false);
151 manualContourModelLine::~manualContourModelLine()
156 // ----------------------------------------------------------------------------
157 manualContourModelLine * manualContourModelLine :: Clone() // virtual
159 manualContourModelLine * clone = new manualContourModelLine();
160 CopyAttributesTo(clone);
164 // ---------------------------------------------------------------------------
166 void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
168 manualContourModel::CopyAttributesTo(cloneObject);
171 //----------------------------------------------------------------
172 int manualContourModelLine::GetTypeModel() //virtual
178 //----------------------------------------------------------------
180 void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
182 int np = GetSizeLstPoints();
192 mp = GetManualPoint(0);
203 mp = GetManualPoint(0);
207 mp = GetManualPoint(1);
219 // ----------------------------------------------------------------------------
220 // ----------------------------------------------------------------------------
221 // ----------------------------------------------------------------------------
222 manualContourModelBullEye::manualContourModelBullEye()
223 : manualContourModel()
225 _numberPointsSlineBySector=101; // impaire
228 manualContourModelBullEye::~manualContourModelBullEye()
233 // ----------------------------------------------------------------------------
234 manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
236 manualContourModelBullEye * clone = new manualContourModelBullEye();
237 CopyAttributesTo(clone);
241 // ---------------------------------------------------------------------------
243 void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
246 manualContourModel::CopyAttributesTo(cloneObject);
249 //----------------------------------------------------------------
250 int manualContourModelBullEye::GetTypeModel() //virtual
255 //----------------------------------------------------------------
256 int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
258 return _numberPointsSlineBySector;
261 //----------------------------------------------------------------
262 void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
264 this->_numberPointsSlineBySector = numpoints;
267 //----------------------------------------------------------------
268 void manualContourModelBullEye::AddSector( double radioA,
273 manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
274 modelSector->SetSector(radioA,radioB,ang,angDelta);
275 modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
276 _lstModelBullEyeSector.push_back(modelSector);
279 //----------------------------------------------------------------
280 manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
282 return _lstModelBullEyeSector[id];
285 //----------------------------------------------------------------
286 void manualContourModelBullEye::GetSector(int id,
292 _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
295 void manualContourModelBullEye::UpdateSpline() // virtual
297 manualContourModel::UpdateSpline();
299 if (this->GetSizeLstPoints()>2){
302 manualPoint *mpA = GetManualPoint(0);
303 manualPoint *mpB = GetManualPoint(2);
304 cx = (mpA->GetX() + mpB->GetX()) / 2.0;
305 cy = (mpA->GetY() + mpB->GetY()) / 2.0;
306 ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
307 hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
308 int i,size = _lstModelBullEyeSector.size();
311 _lstModelBullEyeSector[i]->SetCenter(cx,cy);
312 _lstModelBullEyeSector[i]->SetSize(ww,hh);
318 //----------------------------------------------------------------
319 void manualContourModelBullEye::ResetSectors()
321 int i,size=_lstModelBullEyeSector.size();
324 delete _lstModelBullEyeSector[i];
326 _lstModelBullEyeSector.clear();
329 //----------------------------------------------------------------
330 int manualContourModelBullEye::GetSizeOfSectorLst()
332 return _lstModelBullEyeSector.size();
335 //----------------------------------------------------------------
336 void manualContourModelBullEye::Save(FILE *ff) // virtual
338 manualContourModel::Save(ff);
339 int i,size = GetSizeOfSectorLst();
340 fprintf(ff,"numberOfSections %d \n",size);
341 for ( i=0 ; i<size ; i++ )
343 _lstModelBullEyeSector[i]->Save(ff);
347 //----------------------------------------------------------------
348 void manualContourModelBullEye::Open(FILE *ff) // virtual
350 manualContourModel::Open(ff);
356 int numberOfSections;
357 // double radioA,radioB,ang,deltaAng;
359 fscanf(ff,"%s",tmp); // NumberOfSections
360 fscanf(ff,"%s",tmp); // ##
361 numberOfSections = atoi(tmp);
362 for (i=0;i<numberOfSections;i++)
365 _lstModelBullEyeSector[i]->Open(ff);
370 // ----------------------------------------------------------------------------
371 std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
374 std::vector<manualContourModel*> lstTmp;
375 int i,iSize=_lstModelBullEyeSector.size();
376 for (i=0;i<iSize;i++)
378 lstTmp.push_back( _lstModelBullEyeSector[i] );
384 // ----------------------------------------------------------------------------
385 // ----------------------------------------------------------------------------
386 // ----------------------------------------------------------------------------
387 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
388 : manualContourModel()
392 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
397 // ----------------------------------------------------------------------------
398 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
400 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
401 CopyAttributesTo(clone);
405 // ---------------------------------------------------------------------------
407 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
410 manualContourModel::CopyAttributesTo(cloneObject);
413 //----------------------------------------------------------------
414 int manualContourModelBullEyeSector::GetTypeModel() //virtual
420 //----------------------------------------------------------------
421 void manualContourModelBullEyeSector::SetSector( double radioA,
428 _ang = ang*3.14159265/180.0;
429 _angDelta = angDelta*3.14159265/180.0;
432 //----------------------------------------------------------------
433 void manualContourModelBullEyeSector::GetSector(
442 *angDelta = _angDelta;
445 // ----------------------------------------------------------------------------
446 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
452 //----------------------------------------------------------------
453 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
459 //----------------------------------------------------------------
460 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
466 double ang,angcos, angsin;
469 nps = GetNumberOfPointsSpline() - 3;
471 if (i==GetNumberOfPointsSpline()-1)
484 ang = ((double)ii/(nps/2))*_angDelta + _ang;
488 *x = _ww*radio*angcos + _cx;
489 *y = _hh*radio*angsin + _cy;
493 //----------------------------------------------------------------
494 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
496 manualContourModel::Save(ff);
497 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
500 //----------------------------------------------------------------
501 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
504 fscanf(ff,"%s",tmp); // TypeModel
505 fscanf(ff,"%s",tmp); // ##
507 manualContourModel::Open(ff);
510 fscanf(ff,"%s",tmp); // radioA=
511 fscanf(ff,"%s",tmp); // radioA
514 fscanf(ff,"%s",tmp); // radioB=
515 fscanf(ff,"%s",tmp); // radioB
518 fscanf(ff,"%s",tmp); // ang=
519 fscanf(ff,"%s",tmp); // ang
522 fscanf(ff,"%s",tmp); // deltaAng=
523 fscanf(ff,"%s",tmp); // deltaAng
524 _angDelta = atof(tmp);
529 // ---------------------------------------------------------------------------
530 // ---------------------------------------------------------------------------
531 // ---------------------------------------------------------------------------
532 // ---------------------------------------------------------------------------
534 //JSTG 25-02-08 --------------------------------------------------
535 manualContourModelRoi::manualContourModelRoi()
536 : manualContourModel()
538 SetNumberOfPointsSpline(5);
541 manualContourModelRoi::~manualContourModelRoi()
546 // ----------------------------------------------------------------------------
547 manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
549 manualContourModelRoi * clone = new manualContourModelRoi();
550 CopyAttributesTo(clone);
554 // ---------------------------------------------------------------------------
556 void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
559 manualContourModel::CopyAttributesTo(cloneObject);
562 //----------------------------------------------------------------
563 int manualContourModelRoi::GetTypeModel() //virtual
568 //----------------------------------------------------------------
571 // ----------------------------------------------------------------------------
572 // ----------------------------------------------------------------------------
573 // ----------------------------------------------------------------------------
575 manualContourModel::manualContourModel()
577 _cntSplineX = vtkKochanekSpline::New( );
578 _cntSplineY = vtkKochanekSpline::New( );
579 _cntSplineZ = vtkKochanekSpline::New( );
581 this->SetCloseContour(true);
583 _cntSplineX->SetDefaultTension( 0 );
584 _cntSplineX->SetDefaultBias( 0 );
585 _cntSplineX->SetDefaultContinuity( 0 );
587 _cntSplineY->SetDefaultTension( 0 );
588 _cntSplineY->SetDefaultBias( 0 );
589 _cntSplineY->SetDefaultContinuity( 0 );
591 _cntSplineZ->SetDefaultTension( 0 );
592 _cntSplineZ->SetDefaultBias( 0 );
593 _cntSplineZ->SetDefaultContinuity( 0 );
595 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
597 // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
598 _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
601 //---------------------------------------------------------------------------------------------------------------
604 // ----------------------------------------------------------------------------
605 manualContourModel::~manualContourModel()
607 int i,size=_lstPoints.size();
608 for (i=0;i<size; i++){
609 delete _lstPoints[i];
613 _cntSplineX->Delete();
614 _cntSplineY->Delete();
615 _cntSplineZ->Delete();
617 // ----------------------------------------------------------------------------
618 int manualContourModel::AddPoint(double x,double y,double z)
620 manualPoint *mp = new manualPoint();
625 return _lstPoints.size()-1;
627 // ----------------------------------------------------------------------------
628 int manualContourModel::InsertPoint(double x,double y,double z)
630 double dd,ddmin=9999999;
635 int i,ii,iii,size=_lstPoints.size();
636 double j,MaxDivisions=20,porcentage;
639 if (_closeContour==false)
646 for ( i=0 ; i<size ; i++ )
650 x1=_lstPoints[ii]->GetX();
651 y1=_lstPoints[ii]->GetY();
652 z1=_lstPoints[ii]->GetZ();
653 x2=_lstPoints[iii]->GetX();
654 y2=_lstPoints[iii]->GetY();
655 z2=_lstPoints[iii]->GetZ();
656 for (j=0; j<=MaxDivisions; j++)
658 porcentage=(j/MaxDivisions);
659 xx=(x2-x1)*porcentage+x1;
660 yy=(y2-y1)*porcentage+y1;
661 zz=(z2-z1)*porcentage+z1;
662 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
672 if (_closeContour==false)
674 if ( (ibak==1) && (jbak==0) )
678 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
685 //JSTG - 25-04-08 ----------------------------------------------------------
686 //manualPoint *mp = new manualPoint();
687 //mp->SetPoint(x,y,z);
688 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
689 //_lstPoints.insert(itNum,mp);
690 InsertPoint_id(ibak,x,y,z);
691 //----------------------------------------------------------------------------
695 // ----------------------------------------------------------------------------
696 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
698 manualPoint *mp = new manualPoint();
700 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
701 _lstPoints.insert(itNum,mp);
703 // ----------------------------------------------------------------------------
705 void manualContourModel::DeletePoint(int i)
707 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
708 _lstPoints.erase(itNum);
710 // ----------------------------------------------------------------------------
711 void manualContourModel::DeleteAllPoints()
713 int i,size=_lstPoints.size();
714 for (i=0;i<size;i++){
715 _lstPoints.erase( _lstPoints.begin() );
717 this->UpdateSpline();
719 // ----------------------------------------------------------------------------
721 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
723 manualPoint *mp=_lstPoints[i];
724 double x=mp->GetX()+dx;
725 double y=mp->GetY()+dy;
726 double z=mp->GetZ()+dz;
729 // ----------------------------------------------------------------------------
730 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
734 // ----------------------------------------------------------------------------
735 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
737 int i,size=_lstPoints.size();
738 for (i=0;i<size;i++){
739 MovePoint(i,dx,dy,dz);
744 // ----------------------------------------------------------------------------
750 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
752 double range = i_range+1;
754 double xx,yy,zz,dd,ddmin=9999999;
756 int i,size=_lstPoints.size();
757 for (i=0;i<size;i++){
758 manualPoint *mp=_lstPoints[i];
765 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
766 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
775 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
776 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
785 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
786 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
795 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
796 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
806 // ----------------------------------------------------------------------------
807 manualPoint* manualContourModel::GetManualPoint(int id)
809 return _lstPoints[id];
811 // ----------------------------------------------------------------------------
812 int manualContourModel::GetSizeLstPoints()
814 return _lstPoints.size();
816 //----------------------------------------------------------------------------
817 int manualContourModel::GetNumberOfPointsSpline()
819 return _sizePointsContour;
821 //----------------------------------------------------------------------------
822 void manualContourModel::SetNumberOfPointsSpline(int size)
824 _sizePointsContour = size;
828 // ----------------------------------------------------------------------------
830 void manualContourModel::SetCloseContour(bool closeContour)
832 _closeContour = closeContour;
833 if (_closeContour==true)
835 _cntSplineX->ClosedOn();
836 _cntSplineY->ClosedOn();
837 _cntSplineZ->ClosedOn();
839 _cntSplineX->ClosedOff();
840 _cntSplineY->ClosedOff();
841 _cntSplineZ->ClosedOff();
845 // ----------------------------------------------------------------------------
846 bool manualContourModel::IfCloseContour()
848 return _closeContour;
851 // ----------------------------------------------------------------------------
853 void manualContourModel::UpdateSpline() // virtual
856 np = _lstPoints.size();
858 _cntSplineX->RemoveAllPoints();
859 _cntSplineY->RemoveAllPoints();
860 _cntSplineZ->RemoveAllPoints();
861 for( i = 0; i < np; i++ ) {
862 mp = GetManualPoint(i);
863 _cntSplineX->AddPoint( i, mp->GetX() );
864 _cntSplineY->AddPoint( i, mp->GetY() );
865 _cntSplineZ->AddPoint( i, mp->GetZ() );
868 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
869 if (this->_closeContour==true)
871 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
873 // _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
874 _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close
876 //-----------------------------------------------------------------------------------------------------------
879 //---------------------------------------------------------------------------------
881 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
883 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
884 double t = delta*(double)i;
885 GetSplinePoint(t, x, y, z);
888 //-----------------------------------------------------------------------------
890 //JSTG 25-02-08 ---------------------------------------------------------------
891 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
893 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
896 // ----------------------------------------------------------------------------
898 //JSTG 25-02-08 ---------------------------------------------------------------
899 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
901 if (_lstPoints.size()==0)
907 if (_lstPoints.size()==1)
910 mp = GetManualPoint(0);
915 if (_lstPoints.size()>=2)
917 *x = _cntSplineX->Evaluate(t);
918 *y = _cntSplineY->Evaluate(t);
919 *z = _cntSplineZ->Evaluate(t);
923 // ----------------------------------------------------------------------------
926 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
928 if (_lstPoints.size()==0)
934 if (_lstPoints.size()==1)
937 mp = GetManualPoint(0);
942 if (_lstPoints.size()>=2)
944 x = _cntSplineX->Evaluate(t);
945 y = _cntSplineY->Evaluate(t);
946 z = _cntSplineZ->Evaluate(t);
949 // ----------------------------------------------------------------------------
950 double manualContourModel::GetPathSize()
956 // JSTG 25-02-08 -----------------------------
960 //--------------------------------------------
962 if (_lstPoints.size()==2)
964 x1=_lstPoints[0]->GetX();
965 y1=_lstPoints[0]->GetY();
966 z1=_lstPoints[0]->GetZ();
967 x2=_lstPoints[1]->GetX();
968 y2=_lstPoints[1]->GetY();
969 z2=_lstPoints[1]->GetZ();
970 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
972 if (_lstPoints.size()>2)
975 // JSTG 25-02-08 ------------------------------------------
976 //np = _lstPoints.size( );
978 //delta=( double ) ( np ) / ( double ) ( nps );
980 //GetSplinePoint(0,x1,y1,z1);
981 GetSpline_i_Point(0,&x1,&y1,&z1);
983 //for( i = 1; i < nps; i++ )
984 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
986 //t = delta * (double)i;
987 //GetSplinePoint(t,x2,y2,z2);
988 GetSpline_i_Point(i,&x2,&y2,&z2);
989 //---------------------------------------------------------
990 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
999 // ----------------------------------------------------------------------------
1000 double manualContourModel::GetPathArea()
1002 double result = 555;
1003 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1006 //JSTG 25-02-08 ---------------------------------------------
1008 //-----------------------------------------------------------
1014 // This uses Green's theorem:
1015 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1016 // A < 0 -> A = |A| (a negative value could raise because points are
1017 // given in clockwise order).
1019 //JSTG 25-02-08 -------------------------------------------------
1020 //int np = _lstPoints.size( );
1022 int nps = GetNumberOfPointsSpline();
1023 //double delta=( double ) ( np ) / ( double ) ( nps );
1025 for( i = 0, area = 0.0; i < nps; i++ )
1027 j = ( i + 1 ) % nps;
1028 //ti = delta * (double)i;
1029 //tj = delta * (double)j;
1030 //GetSplinePoint(ti,x1,y1,z1);
1031 //GetSplinePoint(tj,x2,y2,z2);
1032 GetSpline_i_Point(i,&x1,&y1,&z1);
1033 GetSpline_i_Point(j,&x2,&y2,&z2);
1034 //----------------------------------------------------------------
1044 area = fabs( area );
1047 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1049 j = ( i + 1 ) % _lstPoints.size();
1052 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1053 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1054 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1060 area = fabs( area );
1076 // ----------------------------------------------------------------------------
1077 // p[x,y,z] : data in
1078 // rp[x,y,z] : data out result point
1079 // rn[x,y,z] : data out result normal
1081 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1083 double distMin=999999999;
1084 double dist,dx,dy,dz;
1089 //JSTG 25-02-08 -------------------
1093 //---------------------------------
1095 np = _lstPoints.size( );
1098 // JSTG 25-02-08 ------------------------------------------
1100 nps = GetNumberOfPointsSpline();
1101 //delta = ( double ) ( np ) / ( double ) ( nps );
1103 //GetSplinePoint(0,x1,y1,z1);
1104 GetSpline_i_Point(0,&x1,&y1,&z1);
1105 for( i = 0; i < nps; i++ )
1107 //t = delta * (double)i;
1108 //GetSplinePoint(t,x1,y1,z1);
1109 GetSpline_i_Point(i,&x1,&y1,&z1);
1110 //----------------------------------------------------------
1114 dist = sqrt( dx*dx + dy*dy + dz*dz );
1132 // JSTG 25-02-08 ------------------------------------------
1136 //t = delta * (double)1.0;
1137 //GetSplinePoint(t,x1,y1,z1);
1138 GetSpline_i_Point(i,&x1,&y1,&z1);
1139 //----------------------------------------------------------
1156 // ----------------------------------------------------------------------------
1157 manualContourModel * manualContourModel :: Clone() // virtual
1159 manualContourModel * clone = new manualContourModel();
1160 CopyAttributesTo(clone);
1164 // ----------------------------------------------------------------------------
1165 void manualContourModel::Open(FILE *ff) // virtual
1169 int numberOfControlPoints;
1172 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1173 fscanf(ff,"%s",tmp); // ##
1174 numberOfControlPoints = atoi(tmp);
1175 for (i=0;i<numberOfControlPoints;i++)
1177 fscanf(ff,"%s",tmp); // X
1179 fscanf(ff,"%s",tmp); // Y
1181 fscanf(ff,"%s",tmp); // Z
1188 // ----------------------------------------------------------------------------
1189 int manualContourModel::GetTypeModel() //virtual
1201 // ----------------------------------------------------------------------------
1202 void manualContourModel::Save(FILE *ff) // virtual
1204 int i,size=_lstPoints.size();
1205 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1206 fprintf(ff,"NumberOfControlPoints %d\n",size);
1207 for (i=0;i<size;i++)
1209 manualPoint *mp=_lstPoints[i];
1210 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1215 // ---------------------------------------------------------------------------
1217 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1220 //XXXX::CopyAttributesTo(cloneObject);
1222 cloneObject->SetCloseContour( this->IfCloseContour() );
1223 int i, size = GetSizeLstPoints();
1224 for( i=0; i<size; i++ )
1226 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1228 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1229 cloneObject->SetCloseContour( _closeContour );
1230 cloneObject->UpdateSpline();
1234 // ---------------------------------------------------------------------------
1235 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1237 _lstPoints.push_back( theManualPoint );
1240 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1242 std::vector<manualContourModel*> lstTmp;
1243 lstTmp.push_back(this);
1248 // ---------------------------------------------------------------------------
1249 // ----------------------------------------------------------------------------
1250 // ----------------------------------------------------------------------------
1252 //int manualViewPoint::range=1;
1255 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1257 _posibleSelected = false;
1260 _pointVtkActor = NULL;
1262 _wxvtkbaseview = wxvtkbaseview;
1270 // ----------------------------------------------------------------------------
1271 manualViewPoint::~manualViewPoint(){
1275 // ----------------------------------------------------------------------------
1276 void manualViewPoint::SetWidthLine( double width)
1281 // ----------------------------------------------------------------------------
1282 void manualViewPoint::SetSelected(bool selected){
1285 // ----------------------------------------------------------------------------
1286 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1287 _posibleSelected=posibleSelected;
1289 // ----------------------------------------------------------------------------
1290 bool manualViewPoint::GetSelected(){
1293 // ----------------------------------------------------------------------------
1294 bool manualViewPoint::GetPosibleSelected(){
1295 return _posibleSelected;
1297 // ----------------------------------------------------------------------------
1298 void manualViewPoint::DeleteVtkObjects(){
1299 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1300 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1301 if (_pts !=NULL) { _pts ->Delete(); }
1302 if (_pd !=NULL) { _pd ->Delete(); }
1303 _pointVtkActor = NULL;
1311 // ----------------------------------------------------------------------------
1312 vtkActor* manualViewPoint::CreateVtkPointActor()
1316 _pts = vtkPoints::New();
1317 _pts->SetNumberOfPoints(8);
1318 _pts->SetPoint(0, -1000 , -1000 , 0 );
1319 _pts->SetPoint(1, 1000 , -1000 , 0 );
1320 _pts->SetPoint(2, 1000 , 1000 , 0 );
1321 _pts->SetPoint(3, -1000 , 1000 , 0 );
1322 _pts->SetPoint(4, -1000 , 1000 , 0 );
1323 _pts->SetPoint(5, -1000 , 1000 , 0 );
1324 _pts->SetPoint(6, -1000 , 1000 , 0 );
1325 _pts->SetPoint(7, -1000 , 1000 , 0 );
1327 vtkCellArray *lines = vtkCellArray::New();
1328 lines->InsertNextCell(17);
1329 lines->InsertCellPoint(0);
1330 lines->InsertCellPoint(1);
1331 lines->InsertCellPoint(2);
1332 lines->InsertCellPoint(3);
1333 lines->InsertCellPoint(0);
1334 lines->InsertCellPoint(4);
1335 lines->InsertCellPoint(5);
1336 lines->InsertCellPoint(6);
1337 lines->InsertCellPoint(7);
1338 lines->InsertCellPoint(4);
1339 lines->InsertCellPoint(0);
1340 lines->InsertCellPoint(3);
1341 lines->InsertCellPoint(7);
1342 lines->InsertCellPoint(6);
1343 lines->InsertCellPoint(2);
1344 lines->InsertCellPoint(1);
1345 lines->InsertCellPoint(5);
1347 _pd = vtkPolyData::New();
1348 _pd->SetPoints( _pts );
1349 _pd->SetLines( lines );
1350 lines->Delete(); //do not delete lines ??
1352 _pointVtkActor = vtkActor::New();
1353 _bboxMapper = vtkPolyDataMapper::New();
1355 _bboxMapper->SetInput(_pd);
1356 _bboxMapper->ImmediateModeRenderingOn();
1357 _pointVtkActor->SetMapper(_bboxMapper);
1358 _pointVtkActor->GetProperty()->BackfaceCullingOn();
1360 _pd->ComputeBounds();
1362 return _pointVtkActor;
1364 // ----------------------------------------------------------------------------
1365 vtkActor* manualViewPoint::GetVtkActor(){
1366 return _pointVtkActor;
1368 // ----------------------------------------------------------------------------
1369 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1371 // double range=0.2; // i_range;
1372 // double range=(double)manualViewPoint::range;
1374 double range=i_range;
1379 posZ = posZ * _spc[2];
1382 _pts->SetPoint(0, x-range, y+range, posZ-range);
1383 _pts->SetPoint(1, x+range, y+range, posZ-range);
1384 _pts->SetPoint(2, x+range, y-range, posZ-range);
1385 _pts->SetPoint(3, x-range, y-range, posZ-range);
1386 _pts->SetPoint(4, x-range, y+range, posZ+range);
1387 _pts->SetPoint(5, x+range, y+range, posZ+range);
1388 _pts->SetPoint(6, x+range, y-range, posZ+range);
1389 _pts->SetPoint(7, x-range, y-range, posZ+range);
1394 // ----------------------------------------------------------------------------
1395 void manualViewPoint::UpdateColorActor()
1397 if (_pointVtkActor!=NULL){
1399 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1400 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1401 if (_posibleSelected==true){
1402 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1406 // ----------------------------------------------------------------------------
1407 void manualViewPoint::GetSpacing(double spc[3])
1413 // ----------------------------------------------------------------------------
1414 void manualViewPoint::SetSpacing(double spc[3])
1423 // ----------------------------------------------------------------------------
1424 // ----------------------------------------------------------------------------
1425 // ----------------------------------------------------------------------------
1427 manualViewContour::manualViewContour()
1429 _id_viewPoint_for_text = 0;
1431 _initialConoturModel = new manualContourModel();
1433 // ----------------------------------------------------------------------------
1434 manualViewContour::~manualViewContour()
1436 delete _initialConoturModel;
1438 // ----------------------------------------------------------------------------
1440 // ----------------------------------------------------------------------------
1441 manualViewContour * manualViewContour :: Clone()
1443 manualViewContour * clone = new manualViewContour();
1444 CopyAttributesTo(clone);
1448 // ---------------------------------------------------------------------------
1450 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1452 // Call to Fathers object
1453 manualViewBaseContour::CopyAttributesTo(cloneObject);
1455 cloneObject->SetMesureScale(_mesureScale);
1458 // ---------------------------------------------------------------------------
1460 int manualViewContour::GetType() // virtual
1465 // ----------------------------------------------------------------------------
1467 void manualViewContour::Save(FILE *pFile)
1469 manualViewBaseContour::Save(pFile);
1472 // ----------------------------------------------------------------------------
1474 void manualViewContour::Open(FILE *pFile)
1480 // ----------------------------------------------------------------------------
1481 void manualViewContour::RefreshContour() // virtual
1486 //JSTG 25-02-08 --------------------
1487 //double t,delta, x,y,z;
1489 //----------------------------------
1491 _manContModel->UpdateSpline();
1492 np = GetNumberOfPoints( );
1493 //nps = GetNumberOfPointsSpline();
1494 nps = _manContModel->GetNumberOfPointsSpline();
1495 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1502 for( i = 0; i < nps; i++ )
1504 //JSTG 25-02-08 ------------------------------------------------
1505 //t = delta * (double)i;
1506 //_manContModel->GetSplinePoint(t,x,y,z);
1507 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1508 //--------------------------------------------------------------
1510 // _pts->SetPoint(i, x,y,z );
1511 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1518 _pts->SetPoint(0, 0 , 0 , 0);
1519 _pts->SetPoint(1, 0 , 0 , 0);
1524 // ----------------------------------------------------------------------------
1525 void manualViewContour::RefreshText() // virtual
1527 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1528 int size = GetNumberOfPoints();
1530 char resultText[50];
1531 strcpy(resultText," ");
1534 strcpy(resultText,"L= ");
1535 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1536 strcat(resultText,text);
1540 if (_manContModel->IfCloseContour()==true)
1542 strcpy(resultText,"P= ");
1543 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1544 strcat(resultText,text);
1545 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1546 strcat(resultText," A= ");
1547 strcat(resultText,text);
1549 strcpy(resultText,"L= ");
1550 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1551 strcat(resultText,text);
1555 _textActor->SetInput(resultText);
1560 for (i=0; i<size; i++)
1562 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1564 _id_viewPoint_for_text = i;
1568 int id = _id_viewPoint_for_text;
1569 double px = _manContModel->GetManualPoint(id)->GetX();
1570 double py = _manContModel->GetManualPoint(id)->GetY();
1576 _textActor->SetPosition(px+GetRange()+1,py);
1582 // ----------------------------------------------------------------------------
1583 bool manualViewContour::ifTouchContour(int x,int y,int z){
1591 TransfromeCoordViewWorld(xx,yy,zz);
1598 unsigned int i, nps,nps_t;
1599 nps = _sizePointsContour;
1601 if (this->_manContModel->IfCloseContour()==true)
1609 for( i = 0; i < nps_t; i++ )
1611 _pts->GetPoint(i%nps, ppA);
1612 _pts->GetPoint((i+1)%nps, ppB);
1613 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1614 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1615 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]));
1618 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1628 // ----------------------------------------------------------------------------
1629 void manualViewContour::DeletePoint(int id) // virtual
1631 if (_lstViewPoints.size()>2)
1633 manualViewBaseContour::DeletePoint( id );
1636 // ----------------------------------------------------------------------------
1638 void manualViewContour::ClearPoint(int id)
1640 manualViewBaseContour::DeletePoint( id );
1643 //-------------------------------------------------------------------
1644 void manualViewContour::SetMesureScale(double mesureScale)
1646 _mesureScale = mesureScale;
1648 //-------------------------------------------------------------------
1649 void manualViewContour::InitMove(int x, int y, int z)
1651 _initialConoturModel->DeleteAllPoints();
1653 manualPoint *mp = NULL;
1657 TransfromeCoordViewWorld(XX,YY,ZZ);
1659 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1660 for ( i=0; i<manualPointsSZ; i++ )
1662 mp = _manContModel->GetManualPoint( i );
1663 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1666 //-------------------------------------------------------------------
1667 void manualViewContour::MoveContour(int x, int y, int z)
1669 manualPoint *mpOrigin = NULL;
1670 manualPoint *mpMoving = NULL;
1675 TransfromeCoordViewWorld(XX,YY,ZZ);
1677 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1678 for ( i=0; i<manualPointsSZ; i++ )
1680 mpOrigin = _manContModel->GetManualPoint( i );
1681 mpMoving = _initialConoturModel->GetManualPoint(i);
1682 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1686 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1688 manualPoint *mpOrigin = NULL;
1690 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1691 for ( i=0; i<manualPointsSZ; i++ )
1693 mpOrigin = _manContModel->GetManualPoint( i );
1694 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1698 // ----------------------------------------------------------------------------
1699 // ----------------------------------------------------------------------------
1700 // ----------------------------------------------------------------------------
1703 manualView3VContour::manualView3VContour(int type)
1706 // JSTG 25-02-08 ------------------------------
1707 //_manContModel= new manualContourModel();
1708 //---------------------------------------------
1710 // ----------------------------------------------------------------------------
1711 manualView3VContour::~manualView3VContour()
1717 // ----------------------------------------------------------------------------
1718 manualView3VContour * manualView3VContour :: Clone()
1720 manualView3VContour * clone = new manualView3VContour( GetType() );
1721 CopyAttributesTo(clone);
1725 // ---------------------------------------------------------------------------
1727 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1730 manualViewContour::CopyAttributesTo(cloneObject);
1733 int manualView3VContour::GetType()
1738 // ----------------------------------------------------------------------------
1739 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1754 // ----------------------------------------------------------------------------
1756 void manualView3VContour::RefreshContour() // virtula
1758 manualViewContour::RefreshContour();
1761 // JSTG 25-02-08 ----------------------------------------
1762 //int nps = GetNumberOfPointsSpline();
1763 int nps = _manContModel->GetNumberOfPointsSpline();
1764 //-------------------------------------------------------
1765 for( i = 0; i < nps; i++ )
1767 _pts->GetPoint( i, pp );
1768 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1771 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1776 // ----------------------------------------------------------------------------
1778 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1780 manualPoint *mp = _manContModel->GetManualPoint(id);
1785 FilterCordinateXYZ(x,y,z);
1786 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1789 // ----------------------------------------------------------------------------
1791 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1794 if (_manContModel!=NULL){
1798 TransfromeCoordViewWorld(xx,yy,zz,-1);
1799 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1804 // ----------------------------------------------------------------------------
1805 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1813 TransfromeCoordViewWorld(xx,yy,zz,-1);
1820 unsigned int i, nps,nps_t;
1821 nps = _sizePointsContour;
1822 if (this->_manContModel->IfCloseContour()==true)
1828 FilterCordinateXYZ(xx,yy,zz);
1830 for( i = 0; i < nps_t; i++ ) {
1831 _pts->GetPoint(i%nps, ppA);
1832 _pts->GetPoint((i+1)%nps, ppB);
1833 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1834 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1835 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1836 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1837 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]));
1838 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1845 // ----------------------------------------------------------------------------
1846 // ----------------------------------------------------------------------------
1847 // ----------------------------------------------------------------------------
1848 manualView3DContour::manualView3DContour()
1851 // ----------------------------------------------------------------------------
1852 manualView3DContour::~manualView3DContour()
1856 // ----------------------------------------------------------------------------
1857 manualView3DContour * manualView3DContour :: Clone()
1859 manualView3DContour * clone = new manualView3DContour();
1860 CopyAttributesTo(clone);
1864 // ---------------------------------------------------------------------------
1865 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1868 manualViewContour::CopyAttributesTo(cloneObject);
1870 cloneObject->SetDimensions ( _w , _h , _d );
1872 // ----------------------------------------------------------------------------
1873 void manualView3DContour::SetDimensions(int w, int h, int d)
1879 // ----------------------------------------------------------------------------
1880 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1882 X = _vtkmprbasedata->GetX();
1883 Y = _vtkmprbasedata->GetY();
1884 Z = _vtkmprbasedata->GetZ();
1886 // ----------------------------------------------------------------------------
1887 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1889 _vtkmprbasedata = vtkmprbasedata;
1891 // ----------------------------------------------------------------------------
1892 int manualView3DContour::GetIdPoint2(int x, int y)
1895 double p[3],pA[3],pB[3];
1897 double pickPoint[ 3 ], cameraPos[ 3 ];
1898 vtkPointPicker* picker = vtkPointPicker::New( );
1899 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1900 picker->Pick( x, y, 0.0, pRenderer );
1901 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1902 picker->GetPickPosition( pickPoint );
1905 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1906 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1908 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1910 double dist,distMin=999999999;
1911 int i,size=this->_manContModel->GetSizeLstPoints();
1912 for (i=0;i<size;i++)
1914 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1918 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1919 if ( (dist<=2*GetRange()) && (dist<distMin) )
1928 // ----------------------------------------------------------------------------
1929 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1931 SelectAllPossibleSelected(false);
1932 int id=GetIdPoint2(x,y);
1935 SetPointPosibleSelected(id,true);
1943 // ----------------------------------------------------------------------------
1944 // ----------------------------------------------------------------------------
1945 // ----------------------------------------------------------------------------
1950 // ----------------------------------------------------------------------------
1951 // ----------------------------------------------------------------------------
1952 // ----------------------------------------------------------------------------
1953 manualViewBullEyeSector::manualViewBullEyeSector()
1957 // ----------------------------------------------------------------------------
1958 void manualViewBullEyeSector::RefreshContour()
1963 //----------------------------------
1965 _manContModel->UpdateSpline();
1966 nps = _manContModel->GetNumberOfPointsSpline();
1970 for( i = 0; i < nps; i++ )
1972 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1973 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1979 // ----------------------------------------------------------------------------
1980 // ----------------------------------------------------------------------------
1981 // ----------------------------------------------------------------------------
1984 manualViewBullEye::manualViewBullEye()
1988 // ----------------------------------------------------------------------------
1989 manualViewBullEye::~manualViewBullEye()
1992 int i,size=lstSectorBullEye.size();
1993 for (i=0;i<size;i++)
1995 delete lstSectorBullEye[i];
1997 lstSectorBullEye.clear();
2001 // ----------------------------------------------------------------------------
2002 manualViewBullEye * manualViewBullEye :: Clone()
2004 manualViewBullEye * clone = new manualViewBullEye();
2005 CopyAttributesTo(clone);
2009 // ---------------------------------------------------------------------------
2011 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2014 manualViewBaseContour::CopyAttributesTo(cloneObject);
2018 // ----------------------------------------------------------------------------
2019 int manualViewBullEye::GetType() // virtual
2025 // ----------------------------------------------------------------------------
2026 void manualViewBullEye::RefreshContour() // virtual
2028 // External Rectangle
2029 manualViewRoi::RefreshContour();
2031 _manContModel->UpdateSpline();
2032 int np = GetNumberOfPoints( );
2033 // Refres sectors of BullEye(s)
2037 int i,size = lstSectorBullEye.size();
2038 for (i=0;i<size;i++)
2040 lstSectorBullEye[i]->RefreshContour();
2047 // ----------------------------------------------------------------------------
2048 void manualViewBullEye::ConstructVTKObjects() // virtual
2050 manualViewRoi::ConstructVTKObjects();
2053 this->GetSpacing(spc);
2054 manualViewBullEyeSector *mvbc;
2055 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2056 int i,size = mcmbe->GetSizeOfSectorLst();
2057 for ( i=0 ; i<size ; i++ )
2059 mvbc = new manualViewBullEyeSector();
2060 mvbc->SetModel( mcmbe->GetModelSector(i) );
2061 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2062 mvbc->SetRange( 2 );
2064 mvbc->SetSpacing(spc);
2065 mvbc->SetColorNormalContour(1, 0, 0);
2066 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2067 // mvbc->SetColorSelectContour(1, 0.8, 0);
2068 mvbc->SetWidthLine( this->GetWidthLine() );
2070 mvbc->ConstructVTKObjects();
2071 lstSectorBullEye.push_back( mvbc );
2077 // ----------------------------------------------------------------------------
2078 void manualViewBullEye::AddSplineActor() // virtual
2080 manualViewRoi::AddSplineActor();
2081 int i,size=lstSectorBullEye.size();
2082 for (i=0;i<size;i++)
2084 lstSectorBullEye[i]->AddSplineActor();
2088 // ----------------------------------------------------------------------------
2089 void manualViewBullEye::RemoveSplineActor() // virtual
2091 manualViewRoi::RemoveSplineActor();
2092 int i,size=lstSectorBullEye.size();
2093 for (i=0;i<size;i++)
2095 lstSectorBullEye[i]->RemoveSplineActor();
2100 // ----------------------------------------------------------------------------
2101 // ----------------------------------------------------------------------------
2102 // ----------------------------------------------------------------------------
2104 manualViewRoi::manualViewRoi()
2106 _sizePointsContour=5;
2108 // ----------------------------------------------------------------------------
2109 manualViewRoi::~manualViewRoi()
2114 // ----------------------------------------------------------------------------
2115 manualViewRoi * manualViewRoi :: Clone()
2117 manualViewRoi * clone = new manualViewRoi();
2118 CopyAttributesTo(clone);
2122 // ---------------------------------------------------------------------------
2124 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2127 manualViewBaseContour::CopyAttributesTo(cloneObject);
2130 // ----------------------------------------------------------------------------
2131 void manualViewRoi::RefreshContour() // virtual
2133 unsigned int i,ii, np;
2134 np = GetNumberOfPoints( );
2141 for( i = 0; i < np+1; i++ ) {
2143 mp = _manContModel->GetManualPoint(ii);
2146 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2147 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2148 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2151 // _pts->SetPoint(i, XX,YY,ZZ );
2152 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2156 _pts->SetPoint(0, 0 , 0 , 0);
2157 _pts->SetPoint(1, 0 , 0 , 0);
2162 // ----------------------------------------------------------------------------
2163 int manualViewRoi::GetType() // virtual
2168 // ----------------------------------------------------------------------------
2170 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2181 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2183 for( i = 0; i < size; i++ )
2186 mp=_manContModel->GetManualPoint(i);
2221 // ----------------------------------------------------------------------------
2224 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2227 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2229 GetMinMax(px1,py1, px2, py2);
2234 TransfromeCoordViewWorld(xx,yy,zz);
2238 double ddx=GetRange();
2239 double ddy=GetRange();
2241 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2246 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2251 if ((ok1==true) && (ok2==false))
2259 // ----------------------------------------------------------------------------
2261 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2267 TransfromeCoordViewWorld(XX,YY,ZZ);
2269 if (_manContModel->GetSizeLstPoints()==4){
2270 mp = _manContModel->GetManualPoint(0);
2271 _dp0[0]= mp->GetX() - XX;
2272 _dp0[1]= mp->GetY() - YY;
2273 _dp0[2]= mp->GetZ();
2275 mp = _manContModel->GetManualPoint(1);
2276 _dp1[0]= mp->GetX() - XX;
2277 _dp1[1]= mp->GetY() - YY;
2278 _dp1[2]= mp->GetZ();
2280 mp = _manContModel->GetManualPoint(2);
2281 _dp2[0]= mp->GetX() - XX;
2282 _dp2[1]= mp->GetY() - YY;
2283 _dp2[2]= mp->GetZ();
2285 mp = _manContModel->GetManualPoint(3);
2286 _dp3[0]= mp->GetX() - XX;
2287 _dp3[1]= mp->GetY() - YY;
2288 _dp3[2]= mp->GetZ();
2292 // ----------------------------------------------------------------------------
2294 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2300 TransfromeCoordViewWorld(XX,YY,ZZ);
2302 mp = _manContModel->GetManualPoint(0);
2303 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2305 mp = _manContModel->GetManualPoint(1);
2306 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2308 mp = _manContModel->GetManualPoint(2);
2309 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2311 mp = _manContModel->GetManualPoint(3);
2312 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2323 // ----------------------------------------------------------------------------
2324 // ----------------------------------------------------------------------------
2325 // ----------------------------------------------------------------------------
2329 manualViewCircle::manualViewCircle()
2331 // _sizePointsContour=5; // default 100
2333 // ----------------------------------------------------------------------------
2334 manualViewCircle::~manualViewCircle()
2339 // ----------------------------------------------------------------------------
2340 manualViewCircle * manualViewCircle :: Clone()
2342 manualViewCircle * clone = new manualViewCircle();
2343 CopyAttributesTo(clone);
2347 // ---------------------------------------------------------------------------
2349 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2352 manualViewBaseContour::CopyAttributesTo(cloneObject);
2356 // ----------------------------------------------------------------------------
2358 void manualViewCircle::RefreshContour(){ // virtual
2360 manualPoint *mpA,*mpB;
2361 unsigned int i, np,nps;
2365 np = GetNumberOfPoints( );
2366 nps = _manContModel->GetNumberOfPointsSpline();
2367 double deltaAngle=(3.14159265*2)/(nps-1);
2372 mpA = _manContModel->GetManualPoint(0);
2373 mpB = _manContModel->GetManualPoint(1);
2374 difX = mpA->GetX() - mpB->GetX();
2375 difY = mpA->GetY() - mpB->GetY();
2376 radio = sqrt( difX*difX + difY*difY );
2377 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2378 manContModelCir->SetRadio(radio);
2380 for( i = 0; i < nps; i++ ) {
2381 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2382 // angle = deltaAngle*i;
2383 // XX = cos(angle)*radio+mpA->GetX();
2384 // YY = sin(angle)*radio+mpA->GetY();
2386 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2389 _pts->SetPoint(0, 0 , 0 , 0);
2390 _pts->SetPoint(1, 0 , 0 , 0);
2396 // ----------------------------------------------------------------------------
2397 int manualViewCircle::GetType() // virtual
2402 // ----------------------------------------------------------------------------
2404 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2406 manualPoint *mpA,*mpB;
2410 np = GetNumberOfPoints( );
2413 mpA = _manContModel->GetManualPoint(0);
2414 mpB = _manContModel->GetManualPoint(1);
2415 difX = mpA->GetX() - mpB->GetX();
2416 difY = mpA->GetY() - mpB->GetY();
2417 radio = sqrt( difX*difX + difY*difY );
2418 minX=mpA->GetX()-radio;
2419 minY=mpA->GetY()-radio;
2420 maxX=mpA->GetX()+radio;
2421 maxY=mpA->GetY()+radio;
2431 // ----------------------------------------------------------------------------
2432 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2435 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2437 GetMinMax(px1,py1, px2, py2);
2442 TransfromeCoordViewWorld(xx,yy,zz);
2446 double ddx=GetRange();
2447 double ddy=GetRange();
2449 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2454 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2459 if ((ok1==true) && (ok2==false))
2468 // ----------------------------------------------------------------------------
2470 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2476 TransfromeCoordViewWorld(XX,YY,ZZ);
2478 if (_manContModel->GetSizeLstPoints()==2){
2479 mp = _manContModel->GetManualPoint(0);
2480 _dp0[0]= mp->GetX() - XX;
2481 _dp0[1]= mp->GetY() - YY;
2482 _dp0[2]= mp->GetZ();
2484 mp = _manContModel->GetManualPoint(1);
2485 _dp1[0]= mp->GetX() - XX;
2486 _dp1[1]= mp->GetY() - YY;
2487 _dp1[2]= mp->GetZ();
2489 mp = _manContModel->GetManualPoint(2);
2490 _dp2[0]= mp->GetX() - XX;
2491 _dp2[1]= mp->GetY() - YY;
2492 _dp2[2]= mp->GetZ();
2494 mp = _manContModel->GetManualPoint(3);
2495 _dp3[0]= mp->GetX() - XX;
2496 _dp3[1]= mp->GetY() - YY;
2497 _dp3[2]= mp->GetZ();
2503 // ----------------------------------------------------------------------------
2504 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2510 TransfromeCoordViewWorld(XX,YY,ZZ);
2512 mp = _manContModel->GetManualPoint(0);
2513 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2515 mp = _manContModel->GetManualPoint(1);
2516 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2518 // mp = _manContModel->GetManualPoint(2);
2519 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2521 // mp = _manContModel->GetManualPoint(3);
2522 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2526 // UpdateViewPoint(2);
2527 // UpdateViewPoint(3);
2533 // ----------------------------------------------------------------------------
2534 // ----------------------------------------------------------------------------
2535 // ----------------------------------------------------------------------------
2539 manualViewLine::manualViewLine()
2541 _sizePointsContour=20;
2543 // ----------------------------------------------------------------------------
2544 manualViewLine::~manualViewLine()
2549 // ----------------------------------------------------------------------------
2550 manualViewLine * manualViewLine :: Clone()
2552 manualViewLine * clone = new manualViewLine();
2553 CopyAttributesTo(clone);
2557 // ---------------------------------------------------------------------------
2559 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2562 manualViewBaseContour::CopyAttributesTo(cloneObject);
2565 // ----------------------------------------------------------------------------
2566 int manualViewLine::GetType() // virtual
2572 // ----------------------------------------------------------------------------
2574 void manualViewLine::InitMove(int x, int y, int z) // virtual
2580 TransfromeCoordViewWorld(XX,YY,ZZ);
2582 if (_manContModel->GetSizeLstPoints()==2)
2584 mp = _manContModel->GetManualPoint(0);
2585 _dp0[0]= mp->GetX() - XX;
2586 _dp0[1]= mp->GetY() - YY;
2587 _dp0[2]= mp->GetZ();
2589 mp = _manContModel->GetManualPoint(1);
2590 _dp1[0]= mp->GetX() - XX;
2591 _dp1[1]= mp->GetY() - YY;
2592 _dp1[2]= mp->GetZ();
2598 // ----------------------------------------------------------------------------
2599 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2605 TransfromeCoordViewWorld(XX,YY,ZZ);
2607 mp = _manContModel->GetManualPoint(0);
2608 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2610 mp = _manContModel->GetManualPoint(1);
2611 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2619 // ----------------------------------------------------------------------------
2620 // ----------------------------------------------------------------------------
2621 // ----------------------------------------------------------------------------
2624 manualViewBaseContour::manualViewBaseContour()
2628 _manContModel = NULL;
2629 _wxvtkbaseview = NULL;
2631 _posibleSelected = false;
2632 _viewControlPoints = false;
2635 _contourVtkActor = NULL;
2638 _sizePointsContour = 100;
2647 _coulorNormal_r = 1;
2648 _coulorNormal_g = 0;
2649 _coulorNormal_b = 1;
2651 _coulorSelection_r = 0;
2652 _coulorSelection_g = 1;
2653 _coulorSelection_b = 0;
2658 // ----------------------------------------------------------------------------
2659 manualViewBaseContour::~manualViewBaseContour()
2661 int i,size=_lstViewPoints.size();
2662 for (i=0;i<size; i++){
2663 delete _lstViewPoints[i];
2665 _lstViewPoints.clear();
2667 // ----------------------------------------------------------------------------
2670 int manualViewBaseContour::GetType() // virtual
2673 //int manualViewBaseContour::GetType() 0;
2674 //int manualViewContour::GetType() 1;
2675 //int manualViewRoi::GetType() 2;
2676 //int manualViewCircle::GetType() 3;
2677 //int manualViewStar::GetType() 4;
2678 //int manualViewLine::GetType() 6;
2683 // ----------------------------------------------------------------------------
2685 void manualViewBaseContour::Save(FILE *pFile)
2687 fprintf(pFile,"TypeView %d\n", GetType() );
2690 // ----------------------------------------------------------------------------
2691 void manualViewBaseContour::Open(FILE *pFile)
2695 // ----------------------------------------------------------------------------
2696 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2698 _viewControlPoints = ifControlPoints;
2699 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2704 //Adding each control point
2705 if( ifControlPoints )
2710 // ---------------------------------------------------------------------------
2712 void manualViewBaseContour :: RemoveCompleteContourActor()
2714 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2715 //Removing the spline
2716 RemoveSplineActor();
2719 //Removing each point
2720 RemoveControlPoints();
2724 // ---------------------------------------------------------------------------
2725 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2727 manualViewBaseContour * clone = new manualViewBaseContour();
2728 CopyAttributesTo(clone);
2733 // ---------------------------------------------------------------------------
2735 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2738 //XXXX::CopyAttributesTo(cloneObject);
2740 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2741 cloneObject-> SetSelected( this->GetSelected() );
2742 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2743 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2744 cloneObject-> SetRange( this->GetRange() );
2745 cloneObject-> SetZ( this->GetZ() );
2746 cloneObject-> SetSpacing( _spc );
2747 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2748 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2749 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2751 int i, size = _lstViewPoints.size();
2752 for ( i=0; i<size; i++ )
2754 cloneObject->AddPoint( );
2758 // ----------------------------------------------------------------------------
2759 void manualViewBaseContour :: AddSplineActor()
2761 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2762 if (_contourVtkActor!=NULL)
2763 theRenderer->AddActor( _contourVtkActor );
2765 // ----------------------------------------------------------------------------
2766 void manualViewBaseContour :: RemoveSplineActor() // virtual
2768 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2769 if (_contourVtkActor!=NULL)
2770 theRenderer->RemoveActor( _contourVtkActor );
2772 // ----------------------------------------------------------------------------
2773 void manualViewBaseContour :: RemoveControlPoints()
2775 if (_wxvtkbaseview!=NULL){
2776 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2777 int i,size=_lstViewPoints.size();
2778 for (i=0;i<size; i++)
2780 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2781 theRenderer->RemoveActor( pointActor );
2784 SetIfViewControlPoints( false );
2786 // ----------------------------------------------------------------------------
2787 void manualViewBaseContour::AddControlPoints()
2789 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2790 SetIfViewControlPoints( true );
2791 if( _viewControlPoints )
2793 int i,size=_lstViewPoints.size();
2794 for (i=0;i<size; i++)
2796 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2797 theRenderer->AddActor( pointActor );
2801 // ----------------------------------------------------------------------------
2802 void manualViewBaseContour::AddTextActor()
2804 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2806 // ----------------------------------------------------------------------------
2807 void manualViewBaseContour::RemoveTextActor()
2809 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2811 // ----------------------------------------------------------------------------
2812 void manualViewBaseContour::DeleteVtkObjects()
2814 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2815 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2816 if ( _pts != NULL ) { _pts -> Delete(); }
2817 if ( _pd != NULL ) { _pd -> Delete(); }
2818 _contourVtkActor = NULL;
2825 // ----------------------------------------------------------------------------
2826 void manualViewBaseContour::SetWidthLine(double width)
2829 this->UpdateColorActor();
2831 // for the control points
2832 int id, size = _lstViewPoints.size();
2833 for( id=0; id<size; id++)
2835 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2840 // ----------------------------------------------------------------------------
2841 double manualViewBaseContour::GetWidthLine()
2846 // ----------------------------------------------------------------------------
2847 void manualViewBaseContour::ConstructVTKObjects()
2849 //JSTG 29-02-08 -----------------------------------------------
2850 //int i , nps = _sizePointsContour;
2852 int nps = _manContModel->GetNumberOfPointsSpline();
2853 //-------------------------------------------------------------
2855 _pts = vtkPoints::New();
2856 _pts->SetNumberOfPoints(nps);
2858 for (i=0 ; i<nps ; i++){
2859 _pts->SetPoint(i, 0 , 0 , 0 );
2861 // This is for the boundaring inicialisation
2864 _pts->SetPoint(0, 0 , 0 , -1000 );
2865 _pts->SetPoint(1, 0 , 0 , 1000 );
2866 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2867 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2870 vtkCellArray *lines = vtkCellArray::New();
2871 lines->InsertNextCell( nps /* +1 */ );
2872 for ( i=0 ; i<nps+1 ; i++ ){
2873 lines->InsertCellPoint(i % nps );
2876 _pd = vtkPolyData::New();
2877 _pd->SetPoints( _pts );
2878 _pd->SetLines( lines );
2879 lines->Delete(); //do not delete lines ??
2881 _contourVtkActor = vtkActor::New();
2882 _bboxMapper = vtkPolyDataMapper::New();
2883 _bboxMapper->ScalarVisibilityOff( );
2885 _bboxMapper->SetInput(_pd);
2886 _bboxMapper->ImmediateModeRenderingOn();
2887 _contourVtkActor->SetMapper(_bboxMapper);
2888 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2892 _pd->ComputeBounds();
2895 _textActor = vtkTextActor::New();
2896 // _textActor->SetDisplayPosition(200, 200);
2897 _textActor->SetInput("00");
2898 // Set coordinates to match the old vtkScaledTextActor default value
2899 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2900 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2901 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2902 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2904 vtkTextProperty *tprop = _textActor->GetTextProperty();
2905 tprop->SetFontSize(14);
2906 tprop->SetFontFamilyToArial();
2907 tprop->SetColor(0, 0, 1);
2909 // ----------------------------------------------------------------------------
2910 void manualViewBaseContour::CreateNewContour()
2912 ConstructVTKObjects();
2914 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2915 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2916 AddCompleteContourActor();
2918 // ----------------------------------------------------------------------------
2919 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2921 manualPoint *mp = _manContModel->GetManualPoint(id);
2924 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2925 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2926 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2928 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2931 // ----------------------------------------------------------------------------
2932 void manualViewBaseContour::UpdateViewPoints()
2934 int id, size = _lstViewPoints.size();
2935 for( id=0; id<size; id++)
2937 UpdateViewPoint( id );
2941 // ----------------------------------------------------------------------------
2942 void manualViewBaseContour::AddPoint()
2944 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2947 // ----------------------------------------------------------------------------
2948 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2950 _lstViewPoints.push_back( manualViewPoint );
2953 manualViewPoint->SetSpacing(_spc);
2955 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2956 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2959 // ----------------------------------------------------------------------------
2960 void manualViewBaseContour::InsertPoint(int id)
2962 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2965 mvp->SetSpacing(_spc);
2967 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2968 _lstViewPoints.insert(itNum,mvp);
2969 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
2971 // ----------------------------------------------------------------------------
2972 void manualViewBaseContour::DeleteContour()
2974 RemoveCompleteContourActor();
2975 /*if (_contourVtkActor!=NULL){
2976 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
2979 int i,size=_lstViewPoints.size();
2980 for (i=0;i<size;i++){
2981 manualViewBaseContour::DeletePoint(0);
2985 // ----------------------------------------------------------------------------
2986 void manualViewBaseContour::DeletePoint(int id) // virtual
2988 int size=_lstViewPoints.size();
2989 if ( (id>=0) && (id<size) ){
2990 manualViewPoint *mvp =_lstViewPoints[id];
2992 // _handlePicker->DeletePickList(mvp->GetVtkActor());
2993 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
2994 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2995 _lstViewPoints.erase(itNum);
3000 // ----------------------------------------------------------------------------
3001 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3003 int id=GetIdPoint(x,y,z);
3008 // ----------------------------------------------------------------------------
3009 void manualViewBaseContour::SetSelected(bool selected)
3013 // ----------------------------------------------------------------------------
3014 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3016 _posibleSelected=posibleSelected;
3018 // ----------------------------------------------------------------------------
3019 bool manualViewBaseContour::GetEditable()
3023 // ----------------------------------------------------------------------------
3024 void manualViewBaseContour::SetEditable( bool * condition )
3026 _editable = condition;
3028 // ----------------------------------------------------------------------------
3029 bool manualViewBaseContour::GetSelected()
3033 // ----------------------------------------------------------------------------
3034 bool manualViewBaseContour::GetPosibleSelected()
3036 return _posibleSelected;
3038 // ----------------------------------------------------------------------------
3039 void manualViewBaseContour::DeleteSelectedPoints()
3041 int i,size=_lstViewPoints.size();
3042 for (i=size-1;i>=0;i--){
3043 if (_lstViewPoints[i]->GetSelected()==true){
3049 // ----------------------------------------------------------------------------
3050 void manualViewBaseContour::SelectPoint(int i, bool select)
3052 _lstViewPoints[i]->SetSelected(select);
3054 // ----------------------------------------------------------------------------
3055 void manualViewBaseContour::SelectLstPoints()
3059 // ----------------------------------------------------------------------------
3060 void manualViewBaseContour::SelectAllPoints(bool select)
3062 int i,size=_lstViewPoints.size();
3063 for (i=0;i<size;i++){
3064 SelectPoint(i,select);
3067 //-----------------------------------------------------------------------------
3068 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3070 _viewControlPoints = ifShow;
3072 // ----------------------------------------------------------------------------
3073 bool manualViewBaseContour:: GetIfViewControlPoints()
3075 return _viewControlPoints;
3078 // ----------------------------------------------------------------------------
3079 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3081 _lstViewPoints[id]->SetPosibleSelected(select);
3083 // ----------------------------------------------------------------------------
3084 void manualViewBaseContour::SetPointSelected(int id,bool select)
3086 _lstViewPoints[id]->SetSelected(select);
3088 // ----------------------------------------------------------------------------
3089 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3091 int i,size=_lstViewPoints.size();
3092 for (i=0;i<size;i++){
3093 SetPointPosibleSelected(i,select);
3096 // ----------------------------------------------------------------------------
3097 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3099 SelectAllPossibleSelected(false);
3101 int id = GetIdPoint(x,y,z);
3104 SetPointPosibleSelected(id,true);
3108 // ----------------------------------------------------------------------------
3109 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3112 SetPosibleSelected(result);
3113 int id = GetIdPoint(x,y,z);
3114 if( !GetEditable() && !_selected && id!= -1)
3117 SetPosibleSelected(result);
3121 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3123 if (ifTouchContour(x,y,z)==true)
3126 SetPosibleSelected(result);
3130 if (GetEditable()==false)
3132 if (ifTouchContour(x,y,z)==true)
3135 SetPosibleSelected(result);
3143 // ----------------------------------------------------------------------------
3144 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3148 // ----------------------------------------------------------------------------
3149 void manualViewBaseContour::UnSelectPoint(int i){
3150 _lstViewPoints[i]->SetSelected(false);
3153 // ----------------------------------------------------------------------------
3154 void manualViewBaseContour::UnSelectLstPoints(){
3157 // ----------------------------------------------------------------------------
3158 void manualViewBaseContour::UnSelectAllPoints(){
3159 int i,size=_lstViewPoints.size();
3160 for (i=0;i<size;i++){
3165 // ----------------------------------------------------------------------------
3166 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3167 _manContModel=manContModel;
3169 // ----------------------------------------------------------------------------
3170 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3171 _wxvtkbaseview = wxvtkbaseview;
3173 // ----------------------------------------------------------------------------
3174 void manualViewBaseContour::RefreshContour() // Virtual
3177 // ----------------------------------------------------------------------------
3178 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3180 int i,size = _sizePointsContour;
3181 double *vx = (double*)malloc(sizeof(double)*size);
3182 for (i=0;i<size;i++){
3183 _pts->GetPoint(i,pp);
3188 // ----------------------------------------------------------------------------
3189 double* manualViewBaseContour::GetVectorPointsYManualContour()
3192 int i,size = _sizePointsContour;
3193 double *vy = (double*)malloc(sizeof(double)*size);
3194 for (i=0;i<size;i++){
3195 _pts->GetPoint(i,pp);
3200 // ----------------------------------------------------------------------------
3201 double* manualViewBaseContour::GetVectorPointsZManualContour()
3204 int i,size = _sizePointsContour;
3205 double *vz = (double*)malloc(sizeof(double)*size);
3206 for (i=0;i<size;i++){
3207 _pts->GetPoint(i,pp);
3212 // ----------------------------------------------------------------------------
3213 void manualViewBaseContour::Refresh() // virtual
3215 if (_contourVtkActor!=NULL){
3218 int i,size=_lstViewPoints.size();
3219 for (i=0;i<size;i++){
3221 _lstViewPoints[i]->UpdateColorActor();
3225 if (_show_text==true)
3230 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3233 _wxvtkbaseview->GetRenWin()->Render();
3237 // ----------------------------------------------------------------------------
3238 void manualViewBaseContour::RefreshText() // virtual
3240 if( _textActor!=NULL)
3241 _textActor -> SetInput("00");
3243 // ----------------------------------------------------------------------------
3244 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3246 _coulorNormal_r = r;
3247 _coulorNormal_g = g;
3248 _coulorNormal_b = b;
3250 // ----------------------------------------------------------------------------
3251 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3253 r = _coulorNormal_r;
3254 g = _coulorNormal_g;
3255 b = _coulorNormal_b;
3257 // ----------------------------------------------------------------------------
3258 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3264 // ----------------------------------------------------------------------------
3265 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3271 // ----------------------------------------------------------------------------
3272 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3274 _coulorSelection_r = r;
3275 _coulorSelection_g = g;
3276 _coulorSelection_b = b;
3278 // ----------------------------------------------------------------------------
3279 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3281 r = _coulorSelection_r;
3282 g = _coulorSelection_g;
3283 b = _coulorSelection_b;
3285 // ----------------------------------------------------------------------------
3286 void manualViewBaseContour::UpdateColorActor()
3288 if (_contourVtkActor!=NULL)
3290 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3291 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3292 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3294 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3298 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3302 // ----------------------------------------------------------------------------
3303 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3306 if (_manContModel!=NULL){
3310 TransfromeCoordViewWorld(xx,yy,zz);
3311 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3316 // ----------------------------------------------------------------------------
3319 int manualViewBaseContour::GetNumberOfPoints()
3321 return _lstViewPoints.size();
3324 // ----------------------------------------------------------------------------
3326 //JSTG 25-02-08 ---------------------------------------------------------------
3327 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3329 return _sizePointsContour;
3331 //----------------------------------------------------------------------------
3333 //JSTG 25-02-08 ---------------------------------------------------------------
3334 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3336 _sizePointsContour = size;
3338 //----------------------------------------------------------------------------
3340 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3342 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3347 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3348 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3351 // ----------------------------------------------------------------------------
3352 void manualViewBaseContour::SetRange(int range)
3356 // ----------------------------------------------------------------------------
3357 int manualViewBaseContour::GetRange()
3361 // ----------------------------------------------------------------------------
3362 void manualViewBaseContour::SetZ(int z)
3366 // ----------------------------------------------------------------------------
3367 int manualViewBaseContour::GetZ()
3372 // ----------------------------------------------------------------------------
3373 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3377 // ----------------------------------------------------------------------------
3378 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3381 // ----------------------------------------------------------------------------
3382 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3386 // ----------------------------------------------------------------------------
3387 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3392 int size=_manContModel->GetSizeLstPoints();
3397 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3403 for( i = 0; i < size; i++ )
3405 mp=_manContModel->GetManualPoint(i);
3457 // ----------------------------------------------------------------------------
3458 void manualViewBaseContour::ClearContour()
3460 if (_contourVtkActor!=NULL){
3461 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3464 int i,size=_lstViewPoints.size();
3465 for (i=0;i<size;i++){
3470 // ----------------------------------------------------------------------------
3471 void manualViewBaseContour::ClearPoint(int id)
3475 // ----------------------------------------------------------------------------
3476 void manualViewBaseContour::SetVisible(bool ok)
3486 int i,size=_lstViewPoints.size();
3487 for (i=0;i<size;i++){
3488 actor = _lstViewPoints[i]->GetVtkActor();
3489 actor->GetProperty()->SetOpacity( opacity );
3491 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3492 _textActor->GetProperty()->SetOpacity( opacity );
3493 _textActor->SetInput("00");
3496 // ----------------------------------------------------------------------------
3497 void manualViewBaseContour::SetShowText(bool ok)
3500 if (_show_text==false)
3502 _textActor->SetInput("00");
3505 // ----------------------------------------------------------------------------
3506 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3508 return this->_wxvtkbaseview;
3510 // ----------------------------------------------------------------------------
3511 void manualViewBaseContour::GetSpacing(double spc[3])
3517 // ----------------------------------------------------------------------------
3518 void manualViewBaseContour::SetSpacing(double spc[3])
3526 // ----------------------------------------------------------------------------
3527 // ----------------------------------------------------------------------------
3528 // ----------------------------------------------------------------------------
3530 // _type = 0 Sagital
3531 // _type = 1 Coronal
3533 // _type = -1 View 3D
3535 manualContour3VControler::manualContour3VControler(int type)
3540 // _manViewBaseCont1 = NULL;
3541 // _manViewBaseCont2 = NULL;
3542 // _manViewBaseCont3 = NULL;
3544 //----------------------------------------------------------------------------
3545 manualContour3VControler::~manualContour3VControler()
3549 // ----------------------------------------------------------------------------
3550 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3552 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3553 CopyAttributesTo(clone);
3557 // ---------------------------------------------------------------------------
3558 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3561 manualContourControler::CopyAttributesTo(cloneObject);
3563 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3565 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3568 // ----------------------------------------------------------------------------
3569 int manualContour3VControler::GetType()
3574 // ----------------------------------------------------------------------------
3575 void manualContour3VControler::AddPoint_Others()
3577 manualViewBaseContour *mvbc;
3578 int i,size=this->_lstManualViewBaseContour.size();
3579 for ( i = 0 ; i < size ; i++ )
3581 mvbc = _lstManualViewBaseContour[i];
3586 // if (_manViewBaseCont1!=NULL){
3587 // _manViewBaseCont1->AddPoint();
3588 // _manViewBaseCont2->AddPoint();
3589 // _manViewBaseCont3->AddPoint();
3590 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3593 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3595 // ----------------------------------------------------------------------------
3596 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3599 z=(int)_vtkmprbasedata->GetZ();
3600 if (GetManualContourModel()!=NULL){
3604 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3608 xx=_vtkmprbasedata->GetX();
3613 yy=_vtkmprbasedata->GetY();
3617 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3618 GetManualViewBaseContour()->AddPoint();
3624 // ----------------------------------------------------------------------------
3625 void manualContour3VControler::InsertPoint_Others(int id)
3628 manualViewBaseContour *mvbc;
3629 int i,size=this->_lstManualViewBaseContour.size();
3630 for ( i = 0 ; i < size ; i++ )
3632 mvbc = _lstManualViewBaseContour[i];
3633 mvbc->InsertPoint(id);
3637 if (_manViewBaseCont1!=NULL){
3638 _manViewBaseCont1->InsertPoint(id);
3639 _manViewBaseCont2->InsertPoint(id);
3640 _manViewBaseCont3->InsertPoint(id);
3641 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3645 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3648 // ----------------------------------------------------------------------------
3649 void manualContour3VControler::InsertPoint(int x, int y, int z)
3652 if (GetManualContourModel()!=NULL){
3653 if (GetManualContourModel()->GetSizeLstPoints()>1){
3654 z=(int)_vtkmprbasedata->GetZ();
3658 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3661 xx=_vtkmprbasedata->GetX();
3666 yy=_vtkmprbasedata->GetY();
3669 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3671 GetManualViewBaseContour()->InsertPoint(id);
3672 InsertPoint_Others(0);
3679 // ----------------------------------------------------------------------------
3683 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3684 manualViewBaseContour *manViewBaseCont0,
3685 manualViewBaseContour *manViewBaseCont1,
3686 manualViewBaseContour *manViewBaseCont2,
3687 manualViewBaseContour *manViewBaseCont3)
3689 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3690 _manViewBaseCont1 = manViewBaseCont1;
3691 _manViewBaseCont2 = manViewBaseCont2;
3692 _manViewBaseCont3 = manViewBaseCont3;
3696 // ----------------------------------------------------------------------------
3697 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3699 _lstManualViewBaseContour.push_back( manViewBaseCont );
3702 // ----------------------------------------------------------------------------
3703 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3705 _vtkmprbasedata=vtkmprbasedata;
3707 // ----------------------------------------------------------------------------
3708 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3710 return _vtkmprbasedata;
3712 // ----------------------------------------------------------------------------
3713 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3715 z=(int)_vtkmprbasedata->GetZ();
3716 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3720 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3724 xx=_vtkmprbasedata->GetX();
3728 yy=_vtkmprbasedata->GetY();
3731 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3732 mp->SetPoint(xx,yy,zz);
3736 // ----------------------------------------------------------------------------
3737 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3739 manualViewBaseContour *mvbc;
3740 int i,size=this->_lstManualViewBaseContour.size();
3741 for ( i = 0 ; i < size ; i++ )
3743 mvbc = _lstManualViewBaseContour[i];
3744 mvbc->DeletePoint(id);
3749 if (_manViewBaseCont1!=NULL){
3750 _manViewBaseCont1->DeletePoint(id);
3751 _manViewBaseCont2->DeletePoint(id);
3752 _manViewBaseCont3->DeletePoint(id);
3754 _manViewBaseCont1->Refresh();
3755 _manViewBaseCont2->Refresh();
3756 _manViewBaseCont3->Refresh();
3758 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3761 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3763 // ----------------------------------------------------------------------------
3764 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3766 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3768 manualContourBaseControler::DeleteActualMousePoint( x , y );
3769 DeleteActualMousePoint_Others( id );
3772 // ----------------------------------------------------------------------------
3773 void manualContour3VControler::MouseMove_Others(int id) // virtual
3775 manualViewBaseContour *mvbc;
3776 int i,size=this->_lstManualViewBaseContour.size();
3777 for ( i = 0 ; i < size ; i++ )
3779 mvbc = _lstManualViewBaseContour[i];
3780 mvbc->SelectAllPossibleSelected(false);
3783 mvbc->SetPointPosibleSelected(id,true);
3785 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3791 if (_manViewBaseCont1!=NULL){
3792 _manViewBaseCont1->SelectAllPossibleSelected(false);
3793 _manViewBaseCont2->SelectAllPossibleSelected(false);
3794 _manViewBaseCont3->SelectAllPossibleSelected(false);
3796 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3797 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3798 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3800 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3801 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3802 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3804 _manViewBaseCont1->Refresh();
3805 _manViewBaseCont2->Refresh();
3806 _manViewBaseCont3->Refresh();
3808 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3811 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3815 // ----------------------------------------------------------------------------
3816 void manualContour3VControler::MouseMove(int x, int y) // virtual
3818 manualContourControler::MouseMove( x , y );
3819 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3820 MouseMove_Others( id );
3823 // ----------------------------------------------------------------------------
3824 void manualContour3VControler::OnChar_Others()
3826 manualViewBaseContour *mvbc;
3827 int i,size=this->_lstManualViewBaseContour.size();
3828 for ( i = 0 ; i < size ; i++ )
3830 mvbc = _lstManualViewBaseContour[i];
3835 _manViewBaseCont1->Refresh();
3836 _manViewBaseCont2->Refresh();
3837 _manViewBaseCont3->Refresh();
3839 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3841 // ----------------------------------------------------------------------------
3842 bool manualContour3VControler::OnChar()
3844 manualContourControler::OnChar();
3848 // ----------------------------------------------------------------------------
3849 void manualContour3VControler::ResetContour() // virtual
3851 manualContourControler::ResetContour();
3852 ResetContour_Others();
3855 // ----------------------------------------------------------------------------
3856 void manualContour3VControler::ResetContour_Others()
3858 manualViewBaseContour *mvbc;
3859 int i,size=this->_lstManualViewBaseContour.size();
3860 for ( i = 0 ; i < size ; i++ )
3862 mvbc = _lstManualViewBaseContour[i];
3863 mvbc->DeleteContour();
3864 mvbc->CreateNewContour();
3869 _manViewBaseCont1->DeleteContour();
3870 _manViewBaseCont2->DeleteContour();
3871 _manViewBaseCont3->DeleteContour();
3872 _manViewBaseCont1->CreateNewContour();
3873 _manViewBaseCont2->CreateNewContour();
3874 _manViewBaseCont3->CreateNewContour();
3878 // ----------------------------------------------------------------------------
3879 // ----------------------------------------------------------------------------
3880 // ----------------------------------------------------------------------------
3881 manualContour3DControler::manualContour3DControler()
3884 // ----------------------------------------------------------------------------
3885 manualContour3DControler::~manualContour3DControler()
3888 // ----------------------------------------------------------------------------
3889 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3891 manualContour3DControler * clone = new manualContour3DControler();
3892 CopyAttributesTo(clone);
3896 // ---------------------------------------------------------------------------
3897 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3900 manualContourControler::CopyAttributesTo(cloneObject);
3902 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3905 // ----------------------------------------------------------------------------
3906 bool manualContour3DControler::OnLeftButtonDown()
3909 wxVTKRenderWindowInteractor *wxVTKiren;
3910 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3911 wxVTKiren->GetEventPosition(X,Y);
3912 MouseClickLeft(X,Y);
3915 // ----------------------------------------------------------------------------
3916 void manualContour3DControler::ResetOrientationPlane()
3918 double p[3],rp[3],rn[3];
3919 p[0] = this->GetVtkMPRBaseData()->GetX( );
3920 p[1] = this->GetVtkMPRBaseData()->GetY( );
3921 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3922 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3923 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3925 // ----------------------------------------------------------------------------
3926 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3928 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3929 int id=manualview3Dcontour->GetIdPoint2(x,y);
3930 if ( (GetState()==0) && (id!=-1) )
3932 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3934 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3935 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3936 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3937 ResetOrientationPlane();
3938 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3942 manualContourControler::MouseClickLeft(x,y);
3945 // ----------------------------------------------------------------------------
3946 bool manualContour3DControler::OnChar()
3949 manualContourControler::OnChar();
3950 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3953 ResetOrientationPlane();
3954 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3959 // ----------------------------------------------------------------------------
3960 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3962 _vtkmprbasedata=vtkmprbasedata;
3964 // ----------------------------------------------------------------------------
3965 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3967 return _vtkmprbasedata;
3970 // ----------------------------------------------------------------------------
3971 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
3973 manualContourControler::InsertPoint( x, y, z );
3974 ResetOrientationPlane();
3979 // ----------------------------------------------------------------------------
3980 // ----------------------------------------------------------------------------
3981 // ----------------------------------------------------------------------------
3983 manualContour3V3DControler::manualContour3V3DControler()
3986 // ----------------------------------------------------------------------------
3987 manualContour3V3DControler::~manualContour3V3DControler()
3991 // ----------------------------------------------------------------------------
3992 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
3994 manualContour3V3DControler * clone = new manualContour3V3DControler();
3995 CopyAttributesTo(clone);
3999 // ---------------------------------------------------------------------------
4000 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4003 manualContour3DControler::CopyAttributesTo(cloneObject);
4005 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4007 // ----------------------------------------------------------------------------
4008 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4010 manualContour3DControler::InsertPoint( x, y, z );
4011 _manualcontour3Vcontroler->InsertPoint_Others(0);
4013 // ----------------------------------------------------------------------------
4014 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4016 manualContour3DControler::AddPoint( x, y, z );
4017 _manualcontour3Vcontroler->AddPoint_Others();
4019 // ----------------------------------------------------------------------------
4020 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4022 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4023 manualContour3DControler::DeleteActualMousePoint( x , y );
4024 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4026 // ----------------------------------------------------------------------------
4027 void manualContour3V3DControler::MouseMove( int x, int y )
4029 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4030 if ((this->GetState()!=7) && (ss!=1)){
4031 manualContour3DControler::MouseMove( x , y );
4032 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4033 _manualcontour3Vcontroler->MouseMove_Others(id);
4036 // ----------------------------------------------------------------------------
4037 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4039 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4041 // ----------------------------------------------------------------------------
4042 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4044 return _manualcontour3Vcontroler;
4046 // ----------------------------------------------------------------------------
4047 bool manualContour3V3DControler::OnChar() // virtual
4049 if (manualContour3DControler::OnChar()==false )
4051 _manualcontour3Vcontroler->OnChar_Others();
4056 // ----------------------------------------------------------------------------
4057 void manualContour3V3DControler::ResetContour() // virtual
4059 manualContourControler::ResetContour();
4060 _manualcontour3Vcontroler->ResetContour_Others();
4064 // ----------------------------------------------------------------------------
4065 // ----------------------------------------------------------------------------
4066 // ----------------------------------------------------------------------------
4068 // _state = 0 // ..nothing..
4069 // _state = 1 // move with add point
4070 // _state = 5 // move
4071 // _state = 6 // move with insert point
4072 // _state = 7 // move with non selection
4074 manualContourControler::manualContourControler()
4076 _easyCreation = true;
4079 // ----------------------------------------------------------------------------
4080 manualContourControler::~manualContourControler()
4083 // ----------------------------------------------------------------------------
4084 manualContourControler * manualContourControler :: Clone() // virtual
4086 manualContourControler * clone = new manualContourControler();
4087 CopyAttributesTo(clone);
4090 // ---------------------------------------------------------------------------
4091 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4094 manualContourBaseControler::CopyAttributesTo(cloneObject);
4095 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4098 // ----------------------------------------------------------------------------
4099 void manualContourControler::Configure() //virtual
4101 // this->_manContModel->SetNumberOfPointsSpline(100);
4104 // ----------------------------------------------------------------------------
4105 void manualContourControler::MouseClickLeft(int x, int y){
4110 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4112 // Insert a Control Point with shift+ClickLeft
4113 // int tt = GetState(); // JPRx
4114 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4118 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4124 // Start to Insert Control Points with ClickLeft (Empty contour)
4125 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4131 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4132 if ((GetState()==1) && (_easyCreation==true) )
4136 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4138 // Insert Control Points IF Contour si Selected
4139 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4143 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4146 // Chose id of Control Point to be move
4147 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4150 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4153 // If nothing selected _state=7
4154 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4157 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4161 SetPosibleToMove( true );
4162 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4165 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4169 GetManualViewBaseContour()->InitMove(x,y,z);
4174 GetManualViewBaseContour()->Refresh();
4177 // ----------------------------------------------------------------------------
4178 void manualContourControler::MouseMove(int x, int y) // virtual
4181 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4182 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4183 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4184 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4185 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4187 GetManualViewBaseContour()->MoveContour(x,y,z);
4189 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4190 GetManualViewBaseContour()->Refresh();
4191 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4195 GetManualViewBaseContour()->RemoveControlPoints();
4196 // GetManualViewBaseContour()->RemoveTextActor();
4197 GetManualViewBaseContour()->Refresh();
4198 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4203 // ----------------------------------------------------------------------------
4204 void manualContourControler::MouseDLeft( int x, int y)//virtual
4206 manualContourBaseControler::MouseDLeft( x, y);
4209 GetManualViewBaseContour()->AddControlPoints();
4210 GetManualViewBaseContour()->AddTextActor();
4211 GetManualViewBaseContour()->Refresh();
4212 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4215 // ----------------------------------------------------------------------------
4216 void manualContourControler::SetEasyCreation(bool easyCreation)
4218 _easyCreation=easyCreation;
4220 // ----------------------------------------------------------------------------
4221 bool manualContourControler::GetEasyCreation()
4223 return _easyCreation;
4227 // ----------------------------------------------------------------------------
4228 // ----------------------------------------------------------------------------
4229 // ----------------------------------------------------------------------------
4230 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4232 _flagMouseMove = true;
4234 // ----------------------------------------------------------------------------
4235 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4238 // ----------------------------------------------------------------------------
4239 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4241 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4242 CopyAttributesTo(clone);
4246 // ---------------------------------------------------------------------------
4247 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4250 manualContourControler::CopyAttributesTo(cloneObject);
4252 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4253 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4254 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4257 // ----------------------------------------------------------------------------
4258 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4260 _vtkmprbasedata = vtkmprbasedata;
4263 // ----------------------------------------------------------------------------
4264 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4266 return _vtkmprbasedata;
4270 // ----------------------------------------------------------------------------
4271 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4273 manualContourControler::InsertPoint( x, y, z );
4274 _manualcontour3Vcontroler->InsertPoint_Others(0);
4276 // ----------------------------------------------------------------------------
4277 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4279 manualContourControler::AddPoint( x, y, z );
4280 _manualcontour3Vcontroler->AddPoint_Others();
4282 // ----------------------------------------------------------------------------
4283 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4285 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4286 manualContourControler::DeleteActualMousePoint( x , y );
4287 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4289 // ----------------------------------------------------------------------------
4290 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4292 _flagMouseMove = true;
4293 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4294 if ((this->GetState()!=7) && (ss!=1)){
4295 manualContourControler::MouseMove( x , y );
4296 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4299 _manualcontour3Vcontroler->MouseMove_Others(id);
4300 _flagMouseMove = false;
4304 // ----------------------------------------------------------------------------
4305 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4307 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4309 // ----------------------------------------------------------------------------
4310 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4312 return _manualcontour3Vcontroler;
4314 // ----------------------------------------------------------------------------
4315 bool manualContourPerpPlaneControler::OnChar() // virtual
4317 if (manualContourControler::OnChar()==false )
4319 _manualcontour3Vcontroler->OnChar_Others();
4323 // ----------------------------------------------------------------------------
4324 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4326 manualContourControler::OnMouseMove();
4327 return _flagMouseMove;
4329 // ----------------------------------------------------------------------------
4330 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4332 manualContourControler::OnLeftDClick();
4333 return _flagMouseDClick;
4335 // ----------------------------------------------------------------------------
4336 void manualContourPerpPlaneControler::ResetContour() // virtual
4338 manualContourControler::ResetContour();
4339 _manualcontour3Vcontroler->ResetContour_Others();
4342 // ----------------------------------------------------------------------------
4343 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4345 _flagMouseDClick=true;
4346 manualContourControler::MouseDLeft(x,y);
4348 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4350 _flagMouseDClick = false;
4351 _vtkinteractorstyleplane2D->OnLeftDClick();
4352 ResetOrientationPlane();
4353 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4356 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4357 // if ( (GetState()==0) && (id!=-1) )
4359 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4360 // _vtkmprbasedata->SetX( mp->GetX() );
4361 // _vtkmprbasedata->SetY( mp->GetY() );
4362 // _vtkmprbasedata->SetZ( mp->GetZ() );
4363 // ResetOrientationPlane();
4364 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4370 // ----------------------------------------------------------------------------
4371 void manualContourPerpPlaneControler::ResetOrientationPlane()
4373 double p[3],rp[3],rn[3];
4374 p[0] = _vtkmprbasedata->GetX( );
4375 p[1] = _vtkmprbasedata->GetY( );
4376 p[2] = _vtkmprbasedata->GetZ( );
4377 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4379 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4382 // ----------------------------------------------------------------------------
4383 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4385 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4387 // ----------------------------------------------------------------------------
4388 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4390 return _vtkinteractorstyleplane2D;
4393 // ----------------------------------------------------------------------------
4394 // ----------------------------------------------------------------------------
4395 // ----------------------------------------------------------------------------
4397 // _state = 0 // ..nothing..
4398 // _state = 5 // move point
4399 // _state = 6 // move all
4400 // _state = 7 // Empty mouse drag
4402 manualRoiControler::manualRoiControler()
4405 // ----------------------------------------------------------------------------
4406 manualRoiControler::~manualRoiControler()
4409 // ----------------------------------------------------------------------------
4410 manualRoiControler * manualRoiControler :: Clone() // virtual
4412 manualRoiControler * clone = new manualRoiControler();
4413 CopyAttributesTo(clone);
4417 // ---------------------------------------------------------------------------
4418 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4421 manualContourBaseControler::CopyAttributesTo(cloneObject);
4424 // ----------------------------------------------------------------------------
4425 void manualRoiControler::Configure() //virtual
4427 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4430 // ----------------------------------------------------------------------------
4432 void manualRoiControler::MouseClickLeft(int x, int y){
4436 { // move control point
4437 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4438 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4444 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4445 GetManualViewBaseContour()->InitMove(x,y,z);
4449 // if the firs time create 4 control points and move one point
4450 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4451 if (GetState()==0) {
4457 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4463 if (GetState()==0) {
4475 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4480 GetManualViewBaseContour()->Refresh();
4483 // ----------------------------------------------------------------------------
4484 void manualRoiControler::MouseMove(int x, int y) // virtual
4488 // this->_vtkInteractorStyleBaseView->
4491 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4492 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4495 if ( (GetState()==5) || (GetState()==1) ){
4496 SetPoint( bakIdPoint , x , y ,z);
4519 GetManualViewBaseContour()->MoveContour(x,y,z);
4521 GetManualViewBaseContour()->Refresh();
4523 // ----------------------------------------------------------------------------
4524 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4527 // ----------------------------------------------------------------------------
4528 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4533 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4542 double pp1=porcentage;
4543 double pp2=1-porcentage;
4545 mp = GetManualContourModel()->GetManualPoint(2);
4547 mp->SetPoint(ww*pp1,hh*pp1,zz);
4549 mp = GetManualContourModel()->GetManualPoint(1);
4551 mp->SetPoint(ww*pp2,hh*pp1,zz);
4553 mp = GetManualContourModel()->GetManualPoint(0);
4555 mp->SetPoint(ww*pp2,hh*pp2,zz);
4557 mp = GetManualContourModel()->GetManualPoint(3);
4559 mp->SetPoint(ww*pp1,hh*pp2,zz);
4561 GetManualViewBaseContour() ->UpdateViewPoint(0);
4562 GetManualViewBaseContour() ->UpdateViewPoint(1);
4563 GetManualViewBaseContour() ->UpdateViewPoint(2);
4564 GetManualViewBaseContour() ->UpdateViewPoint(3);
4567 GetManualViewBaseContour()->Refresh();
4570 // ----------------------------------------------------------------------------
4571 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4574 InitRoi( 0 , 0 , 0.2 );
4575 mp = GetManualContourModel()->GetManualPoint(2);
4579 mp = GetManualContourModel()->GetManualPoint(1);
4583 mp = GetManualContourModel()->GetManualPoint(0);
4587 mp = GetManualContourModel()->GetManualPoint(3);
4591 GetManualViewBaseContour() ->UpdateViewPoint(0);
4592 GetManualViewBaseContour() ->UpdateViewPoint(1);
4593 GetManualViewBaseContour() ->UpdateViewPoint(2);
4594 GetManualViewBaseContour() ->UpdateViewPoint(3);
4598 // ----------------------------------------------------------------------------
4599 // ----------------------------------------------------------------------------
4600 // ----------------------------------------------------------------------------
4604 // _state = 0 // ..nothing..
4605 // _state = 5 // move point
4606 // _state = 6 // move all
4607 // _state = 7 // Empty mouse drag
4609 manualCircleControler::manualCircleControler()
4612 // ----------------------------------------------------------------------------
4613 manualCircleControler::~manualCircleControler()
4616 // ----------------------------------------------------------------------------
4617 manualCircleControler * manualCircleControler :: Clone() // virtual
4619 manualCircleControler * clone = new manualCircleControler();
4620 CopyAttributesTo(clone);
4624 // ---------------------------------------------------------------------------
4625 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4628 manualContourBaseControler::CopyAttributesTo(cloneObject);
4631 // ----------------------------------------------------------------------------
4632 void manualCircleControler::Configure() //virtual
4634 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4637 // ----------------------------------------------------------------------------
4638 void manualCircleControler::MouseClickLeft(int x, int y){
4642 { // move control point
4643 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4644 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4650 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4651 GetManualViewBaseContour()->InitMove(x,y,z);
4655 // firstime create 2 control points and move one control point
4656 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4657 if (GetState()==0) {
4661 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4667 if (GetState()==0) {
4675 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4680 GetManualViewBaseContour()->Refresh();
4682 // ----------------------------------------------------------------------------
4684 void manualCircleControler::MouseMove(int x, int y) // virtual
4687 // this->_vtkInteractorStyleBaseView->
4689 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4690 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4692 if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
4693 if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
4696 GetManualViewBaseContour()->MoveContour(x,y,z);
4698 GetManualViewBaseContour()->Refresh();
4702 // ----------------------------------------------------------------------------
4703 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4706 // ----------------------------------------------------------------------------
4708 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4713 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4718 // AddPoint(0,0,zz);
4719 // AddPoint(0,0,zz);
4722 double pp1=porcentage;
4723 double pp2=1-porcentage;
4725 // mp = GetManualContourModel()->GetManualPoint(2);
4726 // zz=(int)mp->GetZ();
4727 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4729 mp = GetManualContourModel()->GetManualPoint(1);
4731 mp->SetPoint(ww*pp2,hh*pp1,zz);
4733 mp = GetManualContourModel()->GetManualPoint(0);
4735 mp->SetPoint(ww*pp2,hh*pp2,zz);
4737 // mp = GetManualContourModel()->GetManualPoint(3);
4738 // zz=(int)mp->GetZ();
4739 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4741 GetManualViewBaseContour() ->UpdateViewPoint(0);
4742 GetManualViewBaseContour() ->UpdateViewPoint(1);
4743 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4744 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4747 GetManualViewBaseContour()->Refresh();
4750 // ----------------------------------------------------------------------------
4752 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4755 InitRoi( 0 , 0 , 0.2 );
4756 mp = GetManualContourModel()->GetManualPoint(2);
4760 mp = GetManualContourModel()->GetManualPoint(1);
4764 mp = GetManualContourModel()->GetManualPoint(0);
4768 mp = GetManualContourModel()->GetManualPoint(3);
4772 GetManualViewBaseContour() ->UpdateViewPoint(0);
4773 GetManualViewBaseContour() ->UpdateViewPoint(1);
4774 GetManualViewBaseContour() ->UpdateViewPoint(2);
4775 GetManualViewBaseContour() ->UpdateViewPoint(3);
4780 // ----------------------------------------------------------------------------
4781 // ----------------------------------------------------------------------------
4782 // ----------------------------------------------------------------------------
4786 // _state = 0 // ..nothing..
4787 // _state = 5 // move point
4788 // _state = 6 // move all
4789 // _state = 7 // Empty mouse drag
4791 manualLineControler::manualLineControler()
4794 // ----------------------------------------------------------------------------
4795 manualLineControler::~manualLineControler()
4798 // ----------------------------------------------------------------------------
4799 manualLineControler * manualLineControler :: Clone() // virtual
4801 manualLineControler * clone = new manualLineControler();
4802 CopyAttributesTo(clone);
4806 // ---------------------------------------------------------------------------
4807 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4810 manualContourBaseControler::CopyAttributesTo(cloneObject);
4814 // ----------------------------------------------------------------------------
4815 void manualLineControler::MouseClickLeft(int x, int y){
4819 { // move control point
4820 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4821 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4827 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4828 GetManualViewBaseContour()->InitMove(x,y,z);
4832 // fist time create 2 control points and move a control point
4833 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4834 if (GetState()==0) {
4838 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4845 if (GetState()==0) {
4853 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4858 GetManualViewBaseContour()->Refresh();
4860 // ----------------------------------------------------------------------------
4862 void manualLineControler::MouseMove(int x, int y) // virtual
4866 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4867 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4869 if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
4870 if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
4874 GetManualViewBaseContour()->MoveContour(x,y,z);
4876 GetManualViewBaseContour()->Refresh();
4880 // ----------------------------------------------------------------------------
4881 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4884 // ----------------------------------------------------------------------------
4886 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4891 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4898 double pp1=porcentage;
4899 double pp2=1-porcentage;
4901 mp = GetManualContourModel()->GetManualPoint(0);
4903 mp->SetPoint(ww*pp2,hh*pp2,zz);
4905 mp = GetManualContourModel()->GetManualPoint(1);
4907 mp->SetPoint(ww*pp2,hh*pp1,zz);
4909 GetManualViewBaseContour() ->UpdateViewPoint(0);
4910 GetManualViewBaseContour() ->UpdateViewPoint(1);
4913 GetManualViewBaseContour()->Refresh();
4916 // ----------------------------------------------------------------------------
4917 // ----------------------------------------------------------------------------
4918 // ----------------------------------------------------------------------------
4921 manualContourBaseControler::manualContourBaseControler()
4923 _manViewBaseCont = NULL;
4924 _manContModel = NULL;
4928 _posibleToMove = true;
4931 _keyBoardMoving = false;
4933 // ----------------------------------------------------------------------------
4934 manualContourBaseControler::~manualContourBaseControler()
4938 // ----------------------------------------------------------------------------
4939 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4941 manualContourBaseControler * clone = new manualContourBaseControler();
4942 CopyAttributesTo(clone);
4946 // ---------------------------------------------------------------------------
4948 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4951 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4952 cloneObject->SetZ( this->GetZ() );
4953 cloneObject->SetState( this->GetState() );
4954 cloneObject->SetEditable( this->IsEditable() );
4955 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4956 cloneObject->SetMoving( this->IsMoving() );
4957 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4958 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4961 // ----------------------------------------------------------------------------
4962 void manualContourBaseControler::Configure() //virtual
4966 // ----------------------------------------------------------------------------
4967 bool manualContourBaseControler::OnChar()
4969 if ( _vtkInteractorStyleBaseView!=NULL )
4971 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4974 wxVTKRenderWindowInteractor *_wxVTKiren;
4975 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4976 _wxVTKiren->GetEventPosition(X, Y);
4977 //int Z = GetZ(); // JPRx
4979 if ((keyCode==8) || (keyCode==127))
4982 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4984 DeleteActualMousePoint(X,Y);
4986 GetManualViewBaseContour()->Refresh();
4987 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4995 GetManualViewBaseContour()->Refresh();
4996 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4998 else if( !IsEditable() )
5000 if ( keyCode == 'L' )
5002 GetManualViewBaseContour()->MoveContour( -1, 0 );
5003 SetKeyBoardMoving( true );
5005 else if ( keyCode == 'R' )
5007 GetManualViewBaseContour()->MoveContour( 1, 0 );
5008 SetKeyBoardMoving( true );
5010 else if ( keyCode == 'U' )
5012 GetManualViewBaseContour()->MoveContour( 0, -1 );
5013 SetKeyBoardMoving( true );
5015 else if ( keyCode == 'D' )
5017 GetManualViewBaseContour()->MoveContour( 0, 1 );
5018 SetKeyBoardMoving( true );
5020 else if ( keyCode == 'W' )//Diagonal left down
5022 GetManualViewBaseContour()->MoveContour( -1, 1 );
5023 SetKeyBoardMoving( true );
5025 else if ( keyCode == 'Q' )//Diagonal left up
5027 GetManualViewBaseContour()->MoveContour( -1, -1 );
5028 SetKeyBoardMoving( true );
5030 else if( keyCode == 'P' )//Diagonal right up
5032 GetManualViewBaseContour()->MoveContour( 1, -1 );
5033 SetKeyBoardMoving( true );
5035 else if( keyCode == 'M' )//Diagonal right down
5037 GetManualViewBaseContour()->MoveContour( 1, 1 );
5038 SetKeyBoardMoving( true );
5040 if( GetKeyBoardMoving() )
5042 GetManualViewBaseContour()->Refresh();
5043 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5050 // ----------------------------------------------------------------------------
5051 bool manualContourBaseControler::OnMouseMove()
5054 if ( _vtkInteractorStyleBaseView!=NULL)
5057 wxVTKRenderWindowInteractor *_wxVTKiren;
5058 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5059 _wxVTKiren->GetEventPosition( X , Y );
5062 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5063 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5069 // ----------------------------------------------------------------------------
5070 bool manualContourBaseControler::OnLeftButtonDown()
5072 SetKeyBoardMoving( false );
5073 if ( _vtkInteractorStyleBaseView!=NULL )
5076 wxVTKRenderWindowInteractor *wxVTKiren;
5077 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5078 wxVTKiren->GetEventPosition(X,Y);
5080 MouseClickLeft(X,Y);
5084 // ----------------------------------------------------------------------------
5085 bool manualContourBaseControler::OnLeftButtonUp()
5087 if ( _vtkInteractorStyleBaseView!=NULL )
5090 wxVTKRenderWindowInteractor *wxVTKiren;
5091 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5092 wxVTKiren->GetEventPosition(X,Y);
5093 MouseReleaseLeft(X,Y);
5097 // ----------------------------------------------------------------------------
5098 bool manualContourBaseControler::OnLeftDClick()
5100 if ( _vtkInteractorStyleBaseView!=NULL )
5103 wxVTKRenderWindowInteractor *wxVTKiren;
5104 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5105 wxVTKiren->GetEventPosition(X,Y);
5107 this->MouseDLeft(X,Y);
5111 // ----------------------------------------------------------------------------
5112 bool manualContourBaseControler::OnMiddleButtonDown()
5114 // SetKeyBoardMoving( false );
5115 if ( _vtkInteractorStyleBaseView!=NULL )
5118 wxVTKRenderWindowInteractor *wxVTKiren;
5119 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5120 wxVTKiren->GetEventPosition(X,Y);
5121 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5125 // ----------------------------------------------------------------------------
5126 bool manualContourBaseControler::OnMiddleButtonUp()
5130 // ----------------------------------------------------------------------------
5131 bool manualContourBaseControler::OnRightButtonDown()
5133 if( _vtkInteractorStyleBaseView!= NULL )
5136 wxVTKRenderWindowInteractor *wxVTKiren;
5137 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5138 wxVTKiren->GetEventPosition(X, Y);
5140 SetCompleteCreation( true );
5141 SetKeyBoardMoving( false );
5142 MouseClickRight(X,Y);
5146 // ----------------------------------------------------------------------------
5147 bool manualContourBaseControler::OnRightButtonUp()
5151 // ----------------------------------------------------------------------------
5152 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5153 _manContModel = manContModel;
5154 _manViewBaseCont = manViewBaseCont;
5155 _manViewBaseCont->SetEditable( &_editable );
5157 // ----------------------------------------------------------------------------
5158 manualContourModel* manualContourBaseControler::GetManualContourModel()
5160 return _manContModel;
5162 // ----------------------------------------------------------------------------
5163 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5165 return _manViewBaseCont;
5167 // ----------------------------------------------------------------------------
5168 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5172 // ----------------------------------------------------------------------------
5173 void manualContourBaseControler::MouseClickRight(int x, int y)
5179 SetEditable( false );
5180 SetPosibleToMove( false );
5183 //EED 24Avril2009 _state=7;
5185 // ----------------------------------------------------------------------------
5186 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5188 if (_state==5){ _state = 0; }
5189 if (_state==6){ _state = 0; }
5190 if (_state==7){ _state = 0; }
5192 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5193 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5195 SetEditable( false );
5196 SetPosibleToMove( false );
5199 // ----------------------------------------------------------------------------
5200 void manualContourBaseControler::MouseDLeft(int x, int y )
5205 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5206 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5207 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5213 // ----------------------------------------------------------------------------
5214 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5217 // ----------------------------------------------------------------------------
5218 void manualContourBaseControler::SetState(int state)
5222 // ----------------------------------------------------------------------------
5223 int manualContourBaseControler::GetState()
5227 // ----------------------------------------------------------------------------
5228 bool manualContourBaseControler::IsEditable( )
5232 // ----------------------------------------------------------------------------
5233 void manualContourBaseControler::SetEditable( bool condition )
5235 if (GetManualViewBaseContour()!=NULL) {
5238 GetManualViewBaseContour()->RemoveControlPoints();
5240 GetManualViewBaseContour()->SetSelected( condition );
5242 _editable = condition;
5245 // ----------------------------------------------------------------------------
5246 bool manualContourBaseControler::GetPosibleToMove()
5248 return _posibleToMove;
5250 // ----------------------------------------------------------------------------
5251 void manualContourBaseControler::SetPosibleToMove( bool condition )
5253 _posibleToMove = condition;
5255 // ----------------------------------------------------------------------------
5256 bool manualContourBaseControler::IsMoving()
5260 // ----------------------------------------------------------------------------
5261 void manualContourBaseControler::SetMoving( bool condition )
5263 _moving = condition;
5265 // ----------------------------------------------------------------------------
5266 void manualContourBaseControler::SetCompleteCreation( bool condition )
5268 _created = condition;
5270 // ----------------------------------------------------------------------------
5271 bool manualContourBaseControler::GetIfCompleteCreation ( )
5275 // ----------------------------------------------------------------------------
5276 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5278 _keyBoardMoving = condition;
5280 // ----------------------------------------------------------------------------
5281 bool manualContourBaseControler::GetKeyBoardMoving( )
5283 return _keyBoardMoving;
5285 // ----------------------------------------------------------------------------
5286 void manualContourBaseControler::CreateNewManualContour(){
5287 _manViewBaseCont->CreateNewContour();
5289 // ----------------------------------------------------------------------------
5290 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5291 return _manViewBaseCont->GetNumberOfPoints();
5293 // ----------------------------------------------------------------------------
5295 //JSTG - 25-02-08 -------------------------------------------------------------
5296 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5297 //return _manViewBaseCont->GetNumberOfPointsSpline();
5298 return _manContModel->GetNumberOfPointsSpline();
5300 // ----------------------------------------------------------------------------
5302 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5303 return _manViewBaseCont->GetVectorPointsXManualContour();
5305 // ----------------------------------------------------------------------------
5306 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5307 return _manViewBaseCont->GetVectorPointsYManualContour();
5309 // ----------------------------------------------------------------------------
5310 void manualContourBaseControler::DeleteContour(){
5311 _manViewBaseCont->DeleteContour();
5312 _manContModel->DeleteAllPoints();
5314 // ----------------------------------------------------------------------------
5315 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5317 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5319 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5320 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5321 _manContModel->DeletePoint(id);
5322 _manViewBaseCont->DeletePoint(id);
5328 // ----------------------------------------------------------------------------
5329 void manualContourBaseControler::Magnet(int x, int y)
5333 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5334 if (GetManualContourModel()!=NULL){
5338 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5339 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5342 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5343 mp->SetPoint(xx,yy,zz);
5345 // GetManualViewBaseContour()->UpdateViewPoint(id);
5351 // ----------------------------------------------------------------------------
5352 void manualContourBaseControler::SetZ(int z)
5356 // ----------------------------------------------------------------------------
5357 int manualContourBaseControler::GetZ()
5361 // ----------------------------------------------------------------------------
5362 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5364 if (GetManualContourModel()!=NULL){
5368 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5369 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5370 GetManualViewBaseContour()->AddPoint();
5371 // GetManualViewBaseContour()->UpdateViewPoint(id);
5374 // ----------------------------------------------------------------------------
5375 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5379 if (GetManualContourModel()!=NULL){
5383 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5384 if (GetManualContourModel()->GetSizeLstPoints()>1){
5385 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5386 GetManualViewBaseContour()->InsertPoint(id);
5387 // GetManualViewBaseContour()->UpdateViewPoint(id);
5389 GetManualContourModel()->AddPoint(xx,yy,zz);
5390 GetManualViewBaseContour()->AddPoint();
5392 // GetManualViewBaseContour()->UpdateViewPoint(id);
5397 // ----------------------------------------------------------------------------
5398 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5399 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5403 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5404 manualPoint *mp = _manContModel->GetManualPoint(id);
5405 mp->SetPoint(xx,yy,zz);
5406 GetManualViewBaseContour()->UpdateViewPoint(id);
5409 // ----------------------------------------------------------------------------
5410 void manualContourBaseControler::SetPointX( int id ,int x ){
5411 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5415 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5416 manualPoint *mp = _manContModel->GetManualPoint(id);
5418 GetManualViewBaseContour()->UpdateViewPoint(id);
5421 // ----------------------------------------------------------------------------
5422 void manualContourBaseControler::SetPointY( int id ,int y ){
5423 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5427 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5428 manualPoint *mp = _manContModel->GetManualPoint(id);
5430 GetManualViewBaseContour()->UpdateViewPoint(id);
5433 // ----------------------------------------------------------------------------
5434 void manualContourBaseControler::SetPointZ( int id ,int z ){
5435 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5439 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5440 manualPoint *mp = _manContModel->GetManualPoint(id);
5442 GetManualViewBaseContour()->UpdateViewPoint(id);
5445 // ----------------------------------------------------------------------------
5446 void manualContourBaseControler::ResetContour() // virtual
5448 this->DeleteContour();
5449 GetManualViewBaseContour()->CreateNewContour();