3 #include <vtkProperty.h>
5 #include <vtkCellArray.h>
6 #include <vtkRenderer.h>
7 #include <vtkCoordinate.h>
8 #include <vtkTextProperty.h>
9 #include <vtkTextActor.h>
10 #include <vtkProperty2D.h>
11 #include <vtkPointPicker.h>
12 #include "widgets/UtilVtk3DGeometriSelection.h"
15 #include "manualContour.h"
18 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 manualPoint::manualPoint(){
24 // ----------------------------------------------------------------------------
25 manualPoint::~manualPoint(){
27 // ----------------------------------------------------------------------------
28 void manualPoint::SetPoint(double x,double y,double z){
33 // ----------------------------------------------------------------------------
34 void manualPoint::SetPointX(double x){
37 // ----------------------------------------------------------------------------
38 void manualPoint::SetPointY(double y){
41 // ----------------------------------------------------------------------------
42 void manualPoint::SetPointZ(double z){
45 // ----------------------------------------------------------------------------
46 double manualPoint::GetX(){
49 // ----------------------------------------------------------------------------
50 double manualPoint::GetY(){
53 // ----------------------------------------------------------------------------
54 double manualPoint::GetZ(){
57 // ----------------------------------------------------------------------------
58 manualPoint * manualPoint :: Clone()
60 manualPoint * clone = new manualPoint();
61 clone->SetPoint( GetX(), GetY(), GetZ());
66 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 manualContourModelCircle::manualContourModelCircle()
71 : manualContourModel()
75 manualContourModelCircle::~manualContourModelCircle()
80 // ----------------------------------------------------------------------------
81 manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
83 manualContourModelCircle * clone = new manualContourModelCircle();
84 CopyAttributesTo(clone);
88 // ---------------------------------------------------------------------------
90 void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
93 manualContourModel::CopyAttributesTo(cloneObject);
96 //----------------------------------------------------------------
97 int manualContourModelCircle::GetTypeModel() //virtual
102 //----------------------------------------------------------------
103 void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
105 double angle = _deltaAngle*i;
106 *x = _radio*cos(angle) + _centerX;
107 *y = _radio*sin(angle) + _centerY;
112 // ---------------------------------------------------------------------------
113 void manualContourModelCircle::UpdateSpline() // virtal
115 manualPoint *mpA,*mpB;
117 int np = GetSizeLstPoints( );
118 int nps = GetNumberOfPointsSpline();
119 _deltaAngle=(3.14159265*2)/(nps-1);
122 mpA = GetManualPoint(0);
123 mpB = GetManualPoint(1);
124 difX = mpA->GetX() - mpB->GetX();
125 difY = mpA->GetY() - mpB->GetY();
126 _radio = sqrt( difX*difX + difY*difY );
127 _centerX = mpA->GetX();
128 _centerY = mpA->GetY();
129 _centerZ = mpA->GetZ();
138 // ----------------------------------------------------------------------------
139 // ----------------------------------------------------------------------------
140 // ----------------------------------------------------------------------------
144 manualContourModelLine::manualContourModelLine()
145 : manualContourModel()
147 SetNumberOfPointsSpline(2);
148 SetNumberOfPointsSpline(2);
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
177 //----------------------------------------------------------------
178 void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
180 int np = GetSizeLstPoints();
190 mp = GetManualPoint(0);
201 mp = GetManualPoint(0);
205 mp = GetManualPoint(1);
216 int np = GetSizeLstPoints( );
217 int nps = GetNumberOfPointsSpline();
218 // _deltaAngle=(3.14159265*2)/(nps-1);
219 _deltaAngle = 100/nps;
224 mp = GetManualPoint(0);
226 mp = GetManualPoint(1);
243 // ----------------------------------------------------------------------------
244 // ----------------------------------------------------------------------------
245 // ----------------------------------------------------------------------------
246 manualContourModelBullEye::manualContourModelBullEye()
247 : manualContourModel()
249 _numberPointsSlineBySector=101; // impaire
252 manualContourModelBullEye::~manualContourModelBullEye()
257 // ----------------------------------------------------------------------------
258 manualContourModelBullEye * manualContourModelBullEye :: Clone() // virtual
260 manualContourModelBullEye * clone = new manualContourModelBullEye();
261 CopyAttributesTo(clone);
265 // ---------------------------------------------------------------------------
267 void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cloneObject)
270 manualContourModel::CopyAttributesTo(cloneObject);
273 //----------------------------------------------------------------
274 int manualContourModelBullEye::GetTypeModel() //virtual
279 //----------------------------------------------------------------
280 int manualContourModelBullEye::GetNumberOfPointsSplineSectorBulleEje()
282 return _numberPointsSlineBySector;
285 //----------------------------------------------------------------
286 void manualContourModelBullEye::SetNumberOfPointsSplineSectorBulleEje(int numpoints)
288 this->_numberPointsSlineBySector = numpoints;
291 //----------------------------------------------------------------
292 void manualContourModelBullEye::AddSector( double radioA,
297 manualContourModelBullEyeSector *modelSector = new manualContourModelBullEyeSector();
298 modelSector->SetSector(radioA,radioB,ang,angDelta);
299 modelSector->SetNumberOfPointsSpline( this->GetNumberOfPointsSplineSectorBulleEje() );
300 _lstModelBullEyeSector.push_back(modelSector);
303 //----------------------------------------------------------------
304 manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int id)
306 return _lstModelBullEyeSector[id];
309 //----------------------------------------------------------------
310 void manualContourModelBullEye::GetSector(int id,
316 _lstModelBullEyeSector[id]->GetSector(radioA,radioB,ang,angDelta);
319 void manualContourModelBullEye::UpdateSpline() // virtual
321 manualContourModel::UpdateSpline();
323 if (this->GetSizeLstPoints()>2){
326 manualPoint *mpA = GetManualPoint(0);
327 manualPoint *mpB = GetManualPoint(2);
328 cx = (mpA->GetX() + mpB->GetX()) / 2.0;
329 cy = (mpA->GetY() + mpB->GetY()) / 2.0;
330 ww = fabs( mpA->GetX() - mpB->GetX() )/2.0;
331 hh = fabs( mpA->GetY() - mpB->GetY() )/2.0;
332 int i,size = _lstModelBullEyeSector.size();
335 _lstModelBullEyeSector[i]->SetCenter(cx,cy);
336 _lstModelBullEyeSector[i]->SetSize(ww,hh);
342 //----------------------------------------------------------------
343 void manualContourModelBullEye::ResetSectors()
345 int i,size=_lstModelBullEyeSector.size();
348 delete _lstModelBullEyeSector[i];
350 _lstModelBullEyeSector.clear();
353 //----------------------------------------------------------------
354 int manualContourModelBullEye::GetSizeOfSectorLst()
356 return _lstModelBullEyeSector.size();
359 //----------------------------------------------------------------
360 void manualContourModelBullEye::Save(FILE *ff) // virtual
362 manualContourModel::Save(ff);
363 int i,size = GetSizeOfSectorLst();
364 fprintf(ff,"numberOfSections %d \n",size);
365 for ( i=0 ; i<size ; i++ )
367 _lstModelBullEyeSector[i]->Save(ff);
371 //----------------------------------------------------------------
372 void manualContourModelBullEye::Open(FILE *ff) // virtual
374 manualContourModel::Open(ff);
380 int numberOfSections;
381 // double radioA,radioB,ang,deltaAng;
383 fscanf(ff,"%s",tmp); // NumberOfSections
384 fscanf(ff,"%s",tmp); // ##
385 numberOfSections = atoi(tmp);
386 for (i=0;i<numberOfSections;i++)
389 _lstModelBullEyeSector[i]->Open(ff);
394 // ----------------------------------------------------------------------------
395 std::vector<manualContourModel*> manualContourModelBullEye::ExploseModel( )
398 std::vector<manualContourModel*> lstTmp;
399 int i,iSize=_lstModelBullEyeSector.size();
400 for (i=0;i<iSize;i++)
402 lstTmp.push_back( _lstModelBullEyeSector[i] );
408 // ----------------------------------------------------------------------------
409 // ----------------------------------------------------------------------------
410 // ----------------------------------------------------------------------------
411 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
412 : manualContourModel()
416 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
421 // ----------------------------------------------------------------------------
422 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
424 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
425 CopyAttributesTo(clone);
429 // ---------------------------------------------------------------------------
431 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
434 manualContourModel::CopyAttributesTo(cloneObject);
437 //----------------------------------------------------------------
438 int manualContourModelBullEyeSector::GetTypeModel() //virtual
444 //----------------------------------------------------------------
445 void manualContourModelBullEyeSector::SetSector( double radioA,
452 _ang = ang*3.14159265/180.0;
453 _angDelta = angDelta*3.14159265/180.0;
456 //----------------------------------------------------------------
457 void manualContourModelBullEyeSector::GetSector(
466 *angDelta = _angDelta;
469 // ----------------------------------------------------------------------------
470 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
476 //----------------------------------------------------------------
477 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
483 //----------------------------------------------------------------
484 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
490 double ang,angcos, angsin;
493 nps = GetNumberOfPointsSpline() - 3;
495 if (i==GetNumberOfPointsSpline()-1)
508 ang = ((double)ii/(nps/2))*_angDelta + _ang;
512 *x = _ww*radio*angcos + _cx;
513 *y = _hh*radio*angsin + _cy;
517 //----------------------------------------------------------------
518 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
520 manualContourModel::Save(ff);
521 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
524 //----------------------------------------------------------------
525 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
528 fscanf(ff,"%s",tmp); // TypeModel
529 fscanf(ff,"%s",tmp); // ##
531 manualContourModel::Open(ff);
534 fscanf(ff,"%s",tmp); // radioA=
535 fscanf(ff,"%s",tmp); // radioA
538 fscanf(ff,"%s",tmp); // radioB=
539 fscanf(ff,"%s",tmp); // radioB
542 fscanf(ff,"%s",tmp); // ang=
543 fscanf(ff,"%s",tmp); // ang
546 fscanf(ff,"%s",tmp); // deltaAng=
547 fscanf(ff,"%s",tmp); // deltaAng
548 _angDelta = atof(tmp);
553 // ---------------------------------------------------------------------------
554 // ---------------------------------------------------------------------------
555 // ---------------------------------------------------------------------------
556 // ---------------------------------------------------------------------------
558 //JSTG 25-02-08 --------------------------------------------------
559 manualContourModelRoi::manualContourModelRoi()
560 : manualContourModel()
562 SetNumberOfPointsSpline(5);
565 manualContourModelRoi::~manualContourModelRoi()
570 // ----------------------------------------------------------------------------
571 manualContourModelRoi * manualContourModelRoi :: Clone() // virtual
573 manualContourModelRoi * clone = new manualContourModelRoi();
574 CopyAttributesTo(clone);
578 // ---------------------------------------------------------------------------
580 void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObject)
583 manualContourModel::CopyAttributesTo(cloneObject);
586 //----------------------------------------------------------------
587 int manualContourModelRoi::GetTypeModel() //virtual
592 //----------------------------------------------------------------
595 // ----------------------------------------------------------------------------
596 // ----------------------------------------------------------------------------
597 // ----------------------------------------------------------------------------
599 manualContourModel::manualContourModel()
601 _cntSplineX = vtkKochanekSpline::New( );
602 _cntSplineY = vtkKochanekSpline::New( );
603 _cntSplineZ = vtkKochanekSpline::New( );
605 this->SetCloseContour(true);
607 _cntSplineX->SetDefaultTension( 0 );
608 _cntSplineX->SetDefaultBias( 0 );
609 _cntSplineX->SetDefaultContinuity( 0 );
611 _cntSplineY->SetDefaultTension( 0 );
612 _cntSplineY->SetDefaultBias( 0 );
613 _cntSplineY->SetDefaultContinuity( 0 );
615 _cntSplineZ->SetDefaultTension( 0 );
616 _cntSplineZ->SetDefaultBias( 0 );
617 _cntSplineZ->SetDefaultContinuity( 0 );
619 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
621 // this parameter is reset in the VIRTUAL manualContourBaseControler::Configure
622 _sizePointsContour = 100; //JSTG 25-02-08 The change in the inisialization of these variable is critical.
625 //---------------------------------------------------------------------------------------------------------------
628 // ----------------------------------------------------------------------------
629 manualContourModel::~manualContourModel()
631 int i,size=_lstPoints.size();
632 for (i=0;i<size; i++){
633 delete _lstPoints[i];
637 _cntSplineX->Delete();
638 _cntSplineY->Delete();
639 _cntSplineZ->Delete();
641 // ----------------------------------------------------------------------------
642 int manualContourModel::AddPoint(double x,double y,double z)
644 manualPoint *mp = new manualPoint();
649 return _lstPoints.size()-1;
651 // ----------------------------------------------------------------------------
652 int manualContourModel::InsertPoint(double x,double y,double z)
654 double dd,ddmin=9999999;
659 int i,ii,iii,size=_lstPoints.size();
660 double j,MaxDivisions=20,porcentage;
663 if (_closeContour==false)
670 for ( i=0 ; i<size ; i++ )
674 x1=_lstPoints[ii]->GetX();
675 y1=_lstPoints[ii]->GetY();
676 z1=_lstPoints[ii]->GetZ();
677 x2=_lstPoints[iii]->GetX();
678 y2=_lstPoints[iii]->GetY();
679 z2=_lstPoints[iii]->GetZ();
680 for (j=0; j<=MaxDivisions; j++)
682 porcentage=(j/MaxDivisions);
683 xx=(x2-x1)*porcentage+x1;
684 yy=(y2-y1)*porcentage+y1;
685 zz=(z2-z1)*porcentage+z1;
686 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
696 if (_closeContour==false)
698 if ( (ibak==1) && (jbak==0) )
702 if ( ( ibak==size ) && ( jbak==MaxDivisions ) )
709 //JSTG - 25-04-08 ----------------------------------------------------------
710 //manualPoint *mp = new manualPoint();
711 //mp->SetPoint(x,y,z);
712 //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
713 //_lstPoints.insert(itNum,mp);
714 InsertPoint_id(ibak,x,y,z);
715 //----------------------------------------------------------------------------
719 // ----------------------------------------------------------------------------
720 void manualContourModel::InsertPoint_id(int id, double x, double y, double z)
722 manualPoint *mp = new manualPoint();
724 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + id;
725 _lstPoints.insert(itNum,mp);
727 // ----------------------------------------------------------------------------
729 void manualContourModel::DeletePoint(int i)
731 std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + i;
732 _lstPoints.erase(itNum);
734 // ----------------------------------------------------------------------------
735 void manualContourModel::DeleteAllPoints()
737 int i,size=_lstPoints.size();
738 for (i=0;i<size;i++){
739 _lstPoints.erase( _lstPoints.begin() );
741 this->UpdateSpline();
743 // ----------------------------------------------------------------------------
745 void manualContourModel::MovePoint(int i,double dx,double dy,double dz)
747 manualPoint *mp=_lstPoints[i];
748 double x=mp->GetX()+dx;
749 double y=mp->GetY()+dy;
750 double z=mp->GetZ()+dz;
753 // ----------------------------------------------------------------------------
754 void manualContourModel::MoveLstPoints(double dx,double dy,double dz)
758 // ----------------------------------------------------------------------------
759 void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
761 int i,size=_lstPoints.size();
762 for (i=0;i<size;i++){
763 MovePoint(i,dx,dy,dz);
768 // ----------------------------------------------------------------------------
774 int manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
776 double range = i_range+1;
778 double xx,yy,zz,dd,ddmin=9999999;
780 int i,size=_lstPoints.size();
781 for (i=0;i<size;i++){
782 manualPoint *mp=_lstPoints[i];
789 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
790 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
799 if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
800 dd=sqrt( (yy-y)*(yy-y) + (zz-z)*(zz-z) );
809 if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
810 dd=sqrt( (xx-x)*(xx-x) + (zz-z)*(zz-z) );
819 if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
820 dd=sqrt( (xx-x)*(xx-x) + (yy-y)*(yy-y) );
830 // ----------------------------------------------------------------------------
831 manualPoint* manualContourModel::GetManualPoint(int id)
833 return _lstPoints[id];
835 // ----------------------------------------------------------------------------
836 int manualContourModel::GetSizeLstPoints()
838 return _lstPoints.size();
840 //----------------------------------------------------------------------------
841 int manualContourModel::GetNumberOfPointsSpline()
843 return _sizePointsContour;
845 //----------------------------------------------------------------------------
846 void manualContourModel::SetNumberOfPointsSpline(int size)
848 _sizePointsContour = size;
852 // ----------------------------------------------------------------------------
854 void manualContourModel::SetCloseContour(bool closeContour)
856 _closeContour = closeContour;
857 if (_closeContour==true)
859 _cntSplineX->ClosedOn();
860 _cntSplineY->ClosedOn();
861 _cntSplineZ->ClosedOn();
863 _cntSplineX->ClosedOff();
864 _cntSplineY->ClosedOff();
865 _cntSplineZ->ClosedOff();
869 // ----------------------------------------------------------------------------
870 bool manualContourModel::IfCloseContour()
872 return _closeContour;
875 // ----------------------------------------------------------------------------
877 void manualContourModel::UpdateSpline() // virtual
880 np = _lstPoints.size();
882 _cntSplineX->RemoveAllPoints();
883 _cntSplineY->RemoveAllPoints();
884 _cntSplineZ->RemoveAllPoints();
885 for( i = 0; i < np; i++ ) {
886 mp = GetManualPoint(i);
887 _cntSplineX->AddPoint( i, mp->GetX() );
888 _cntSplineY->AddPoint( i, mp->GetY() );
889 _cntSplineZ->AddPoint( i, mp->GetZ() );
892 //JSTG 25-02-08 ---------------------------------------------------------------------------------------------
893 if (this->_closeContour==true)
895 _delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
897 _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
899 //-----------------------------------------------------------------------------------------------------------
902 //---------------------------------------------------------------------------------
904 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
906 double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
907 double t = delta*(double)i;
908 GetSplinePoint(t, x, y, z);
911 //-----------------------------------------------------------------------------
913 //JSTG 25-02-08 ---------------------------------------------------------------
914 void manualContourModel::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
916 GetSpline_t_Point(i*_delta_JSTG,x,y,z);
919 // ----------------------------------------------------------------------------
921 //JSTG 25-02-08 ---------------------------------------------------------------
922 void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, double *z)
924 if (_lstPoints.size()==0)
930 if (_lstPoints.size()==1)
933 mp = GetManualPoint(0);
938 if (_lstPoints.size()>=2)
940 *x = _cntSplineX->Evaluate(t);
941 *y = _cntSplineY->Evaluate(t);
942 *z = _cntSplineZ->Evaluate(t);
946 // ----------------------------------------------------------------------------
949 /*void manualContourModel::GetSplinePoint(double t, double &x, double &y, double &z)
951 if (_lstPoints.size()==0)
957 if (_lstPoints.size()==1)
960 mp = GetManualPoint(0);
965 if (_lstPoints.size()>=2)
967 x = _cntSplineX->Evaluate(t);
968 y = _cntSplineY->Evaluate(t);
969 z = _cntSplineZ->Evaluate(t);
972 // ----------------------------------------------------------------------------
973 double manualContourModel::GetPathSize()
979 // JSTG 25-02-08 -----------------------------
983 //--------------------------------------------
985 if (_lstPoints.size()==2)
987 x1=_lstPoints[0]->GetX();
988 y1=_lstPoints[0]->GetY();
989 z1=_lstPoints[0]->GetZ();
990 x2=_lstPoints[1]->GetX();
991 y2=_lstPoints[1]->GetY();
992 z2=_lstPoints[1]->GetZ();
993 result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
995 if (_lstPoints.size()>2)
998 // JSTG 25-02-08 ------------------------------------------
999 //np = _lstPoints.size( );
1001 //delta=( double ) ( np ) / ( double ) ( nps );
1003 //GetSplinePoint(0,x1,y1,z1);
1004 GetSpline_i_Point(0,&x1,&y1,&z1);
1006 //for( i = 1; i < nps; i++ )
1007 for( i = 1; i < GetNumberOfPointsSpline(); i++ )
1009 //t = delta * (double)i;
1010 //GetSplinePoint(t,x2,y2,z2);
1011 GetSpline_i_Point(i,&x2,&y2,&z2);
1012 //---------------------------------------------------------
1013 result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
1022 // ----------------------------------------------------------------------------
1023 double manualContourModel::GetPathArea()
1025 double result = 555;
1026 if ((_lstPoints.size()>=3) && IfCloseContour()==true )
1029 //JSTG 25-02-08 ---------------------------------------------
1031 //-----------------------------------------------------------
1037 // This uses Green's theorem:
1038 // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
1039 // A < 0 -> A = |A| (a negative value could raise because points are
1040 // given in clockwise order).
1042 //JSTG 25-02-08 -------------------------------------------------
1043 //int np = _lstPoints.size( );
1045 int nps = GetNumberOfPointsSpline();
1046 //double delta=( double ) ( np ) / ( double ) ( nps );
1048 for( i = 0, area = 0.0; i < nps; i++ )
1050 j = ( i + 1 ) % nps;
1051 //ti = delta * (double)i;
1052 //tj = delta * (double)j;
1053 //GetSplinePoint(ti,x1,y1,z1);
1054 //GetSplinePoint(tj,x2,y2,z2);
1055 GetSpline_i_Point(i,&x1,&y1,&z1);
1056 GetSpline_i_Point(j,&x2,&y2,&z2);
1057 //----------------------------------------------------------------
1067 area = fabs( area );
1070 for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
1072 j = ( i + 1 ) % _lstPoints.size();
1075 (_lstPoints[i]->GetX() * _lstPoints[j]->GetY() ) -
1076 ( _lstPoints[j]->GetX() * _lstPoints[i]->GetY() );
1077 if (_lstPoints[0]->GetZ()!=_lstPoints[i]->GetZ())
1083 area = fabs( area );
1099 // ----------------------------------------------------------------------------
1100 // p[x,y,z] : data in
1101 // rp[x,y,z] : data out result point
1102 // rn[x,y,z] : data out result normal
1104 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp, double *rn)
1106 double distMin=999999999;
1107 double dist,dx,dy,dz;
1112 //JSTG 25-02-08 -------------------
1116 //---------------------------------
1118 np = _lstPoints.size( );
1121 // JSTG 25-02-08 ------------------------------------------
1123 nps = GetNumberOfPointsSpline();
1124 //delta = ( double ) ( np ) / ( double ) ( nps );
1126 //GetSplinePoint(0,x1,y1,z1);
1127 GetSpline_i_Point(0,&x1,&y1,&z1);
1128 for( i = 0; i < nps; i++ )
1130 //t = delta * (double)i;
1131 //GetSplinePoint(t,x1,y1,z1);
1132 GetSpline_i_Point(i,&x1,&y1,&z1);
1133 //----------------------------------------------------------
1137 dist = sqrt( dx*dx + dy*dy + dz*dz );
1155 // JSTG 25-02-08 ------------------------------------------
1159 //t = delta * (double)1.0;
1160 //GetSplinePoint(t,x1,y1,z1);
1161 GetSpline_i_Point(i,&x1,&y1,&z1);
1162 //----------------------------------------------------------
1179 // ----------------------------------------------------------------------------
1180 manualContourModel * manualContourModel :: Clone() // virtual
1182 manualContourModel * clone = new manualContourModel();
1183 CopyAttributesTo(clone);
1187 // ----------------------------------------------------------------------------
1188 void manualContourModel::Open(FILE *ff) // virtual
1192 int numberOfControlPoints;
1195 fscanf(ff,"%s",tmp); // NumberOfControlPoints
1196 fscanf(ff,"%s",tmp); // ##
1197 numberOfControlPoints = atoi(tmp);
1198 for (i=0;i<numberOfControlPoints;i++)
1200 fscanf(ff,"%s",tmp); // X
1202 fscanf(ff,"%s",tmp); // Y
1204 fscanf(ff,"%s",tmp); // Z
1211 // ----------------------------------------------------------------------------
1212 int manualContourModel::GetTypeModel() //virtual
1224 // ----------------------------------------------------------------------------
1225 void manualContourModel::Save(FILE *ff) // virtual
1227 int i,size=_lstPoints.size();
1228 fprintf(ff,"TypeModel %d\n", GetTypeModel() );
1229 fprintf(ff,"NumberOfControlPoints %d\n",size);
1230 for (i=0;i<size;i++)
1232 manualPoint *mp=_lstPoints[i];
1233 fprintf(ff,"%f %f %f\n", mp->GetX(), mp->GetY(), mp->GetZ() );
1238 // ---------------------------------------------------------------------------
1240 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
1243 //XXXX::CopyAttributesTo(cloneObject);
1245 cloneObject->SetCloseContour( this->IfCloseContour() );
1246 int i, size = GetSizeLstPoints();
1247 for( i=0; i<size; i++ )
1249 cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
1251 cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
1252 cloneObject->SetCloseContour( _closeContour );
1253 cloneObject->UpdateSpline();
1257 // ---------------------------------------------------------------------------
1258 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
1260 _lstPoints.push_back( theManualPoint );
1263 std::vector<manualContourModel*> manualContourModel::ExploseModel( )
1265 std::vector<manualContourModel*> lstTmp;
1266 lstTmp.push_back(this);
1271 // ---------------------------------------------------------------------------
1272 // ----------------------------------------------------------------------------
1273 // ----------------------------------------------------------------------------
1275 //int manualViewPoint::range=1;
1278 manualViewPoint::manualViewPoint(wxVtkBaseView *wxvtkbaseview){
1280 _posibleSelected = false;
1283 _pointVtkActor = NULL;
1285 _wxvtkbaseview = wxvtkbaseview;
1293 // ----------------------------------------------------------------------------
1294 manualViewPoint::~manualViewPoint(){
1298 // ----------------------------------------------------------------------------
1299 void manualViewPoint::SetWidthLine( double width)
1304 // ----------------------------------------------------------------------------
1305 void manualViewPoint::SetSelected(bool selected){
1308 // ----------------------------------------------------------------------------
1309 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
1310 _posibleSelected=posibleSelected;
1312 // ----------------------------------------------------------------------------
1313 bool manualViewPoint::GetSelected(){
1316 // ----------------------------------------------------------------------------
1317 bool manualViewPoint::GetPosibleSelected(){
1318 return _posibleSelected;
1320 // ----------------------------------------------------------------------------
1321 void manualViewPoint::DeleteVtkObjects(){
1322 if (_pointVtkActor !=NULL) { _pointVtkActor->Delete(); }
1323 if (_bboxMapper !=NULL) { _bboxMapper ->Delete(); }
1324 if (_pts !=NULL) { _pts ->Delete(); }
1325 if (_pd !=NULL) { _pd ->Delete(); }
1326 _pointVtkActor = NULL;
1334 // ----------------------------------------------------------------------------
1335 vtkActor* manualViewPoint::CreateVtkPointActor()
1339 _pts = vtkPoints::New();
1340 _pts->SetNumberOfPoints(8);
1341 _pts->SetPoint(0, -1000 , -1000 , 0 );
1342 _pts->SetPoint(1, 1000 , -1000 , 0 );
1343 _pts->SetPoint(2, 1000 , 1000 , 0 );
1344 _pts->SetPoint(3, -1000 , 1000 , 0 );
1345 _pts->SetPoint(4, -1000 , 1000 , 0 );
1346 _pts->SetPoint(5, -1000 , 1000 , 0 );
1347 _pts->SetPoint(6, -1000 , 1000 , 0 );
1348 _pts->SetPoint(7, -1000 , 1000 , 0 );
1350 vtkCellArray *lines = vtkCellArray::New();
1351 lines->InsertNextCell(17);
1352 lines->InsertCellPoint(0);
1353 lines->InsertCellPoint(1);
1354 lines->InsertCellPoint(2);
1355 lines->InsertCellPoint(3);
1356 lines->InsertCellPoint(0);
1357 lines->InsertCellPoint(4);
1358 lines->InsertCellPoint(5);
1359 lines->InsertCellPoint(6);
1360 lines->InsertCellPoint(7);
1361 lines->InsertCellPoint(4);
1362 lines->InsertCellPoint(0);
1363 lines->InsertCellPoint(3);
1364 lines->InsertCellPoint(7);
1365 lines->InsertCellPoint(6);
1366 lines->InsertCellPoint(2);
1367 lines->InsertCellPoint(1);
1368 lines->InsertCellPoint(5);
1370 _pd = vtkPolyData::New();
1371 _pd->SetPoints( _pts );
1372 _pd->SetLines( lines );
1373 lines->Delete(); //do not delete lines ??
1375 _pointVtkActor = vtkActor::New();
1376 _bboxMapper = vtkPolyDataMapper::New();
1378 _bboxMapper->SetInput(_pd);
1379 _bboxMapper->ImmediateModeRenderingOn();
1380 _pointVtkActor->SetMapper(_bboxMapper);
1381 _pointVtkActor->GetProperty()->BackfaceCullingOn();
1383 _pd->ComputeBounds();
1385 return _pointVtkActor;
1387 // ----------------------------------------------------------------------------
1388 vtkActor* manualViewPoint::GetVtkActor(){
1389 return _pointVtkActor;
1391 // ----------------------------------------------------------------------------
1392 void manualViewPoint::SetPositionXY(double x, double y,double i_range,double posZ)
1394 // double range=0.2; // i_range;
1395 // double range=(double)manualViewPoint::range;
1397 double range=i_range;
1402 posZ = posZ * _spc[2];
1405 _pts->SetPoint(0, x-range, y+range, posZ-range);
1406 _pts->SetPoint(1, x+range, y+range, posZ-range);
1407 _pts->SetPoint(2, x+range, y-range, posZ-range);
1408 _pts->SetPoint(3, x-range, y-range, posZ-range);
1409 _pts->SetPoint(4, x-range, y+range, posZ+range);
1410 _pts->SetPoint(5, x+range, y+range, posZ+range);
1411 _pts->SetPoint(6, x+range, y-range, posZ+range);
1412 _pts->SetPoint(7, x-range, y-range, posZ+range);
1417 // ----------------------------------------------------------------------------
1418 void manualViewPoint::UpdateColorActor()
1420 if (_pointVtkActor!=NULL){
1422 _pointVtkActor->GetProperty()->SetLineWidth( _widthline );
1423 _pointVtkActor->GetProperty()->SetDiffuseColor(1,0,0);
1424 if (_posibleSelected==true){
1425 _pointVtkActor->GetProperty()->SetDiffuseColor(1,1,0);
1429 // ----------------------------------------------------------------------------
1430 void manualViewPoint::GetSpacing(double spc[3])
1436 // ----------------------------------------------------------------------------
1437 void manualViewPoint::SetSpacing(double spc[3])
1446 // ----------------------------------------------------------------------------
1447 // ----------------------------------------------------------------------------
1448 // ----------------------------------------------------------------------------
1450 manualViewContour::manualViewContour()
1452 _id_viewPoint_for_text = 0;
1454 _initialConoturModel = new manualContourModel();
1456 // ----------------------------------------------------------------------------
1457 manualViewContour::~manualViewContour()
1459 delete _initialConoturModel;
1461 // ----------------------------------------------------------------------------
1463 // ----------------------------------------------------------------------------
1464 manualViewContour * manualViewContour :: Clone()
1466 manualViewContour * clone = new manualViewContour();
1467 CopyAttributesTo(clone);
1471 // ---------------------------------------------------------------------------
1473 void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
1475 // Call to Fathers object
1476 manualViewBaseContour::CopyAttributesTo(cloneObject);
1478 cloneObject->SetMesureScale(_mesureScale);
1481 // ---------------------------------------------------------------------------
1483 int manualViewContour::GetType() // virtual
1488 // ----------------------------------------------------------------------------
1490 void manualViewContour::Save(FILE *pFile)
1492 manualViewBaseContour::Save(pFile);
1495 // ----------------------------------------------------------------------------
1497 void manualViewContour::Open(FILE *pFile)
1503 // ----------------------------------------------------------------------------
1504 void manualViewContour::RefreshContour() // virtual
1509 //JSTG 25-02-08 --------------------
1510 //double t,delta, x,y,z;
1512 //----------------------------------
1514 _manContModel->UpdateSpline();
1515 np = GetNumberOfPoints( );
1516 //nps = GetNumberOfPointsSpline();
1517 nps = _manContModel->GetNumberOfPointsSpline();
1518 //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
1520 //printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
1526 for( i = 0; i < nps; i++ )
1528 //JSTG 25-02-08 ------------------------------------------------
1529 //t = delta * (double)i;
1530 //_manContModel->GetSplinePoint(t,x,y,z);
1531 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
1532 //--------------------------------------------------------------
1534 // _pts->SetPoint(i, x,y,z );
1535 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
1538 // printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
1546 _pts->SetPoint(0, 0 , 0 , 0);
1547 _pts->SetPoint(1, 0 , 0 , 0);
1552 // ----------------------------------------------------------------------------
1553 void manualViewContour::RefreshText() // virtual
1556 if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
1557 int size = GetNumberOfPoints();
1559 char resultText[50];
1560 strcpy(resultText," ");
1563 strcpy(resultText,"L= ");
1564 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1565 strcat(resultText,text);
1569 if (_manContModel->IfCloseContour()==true)
1571 strcpy(resultText,"P= ");
1572 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1573 strcat(resultText,text);
1574 gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text );
1575 strcat(resultText," A= ");
1576 strcat(resultText,text);
1578 strcpy(resultText,"L= ");
1579 gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text );
1580 strcat(resultText,text);
1584 _textActor -> SetInput(resultText);
1589 for (i=0; i<size; i++)
1591 if (_lstViewPoints[i]->GetPosibleSelected()==true)
1593 _id_viewPoint_for_text = i;
1597 int id = _id_viewPoint_for_text;
1598 double px = _manContModel->GetManualPoint(id)->GetX();
1599 double py = _manContModel->GetManualPoint(id)->GetY();
1605 _textActor->SetPosition(px+GetRange()+1,py);
1611 // ----------------------------------------------------------------------------
1612 bool manualViewContour::ifTouchContour(int x,int y,int z){
1620 TransfromeCoordViewWorld(xx,yy,zz);
1627 unsigned int i, nps,nps_t;
1628 nps = _sizePointsContour;
1630 if (this->_manContModel->IfCloseContour()==true)
1638 //printf("\n Number of points %d ",nps_t);
1640 for( i = 0; i < nps_t; i++ )
1642 _pts->GetPoint(i%nps, ppA);
1643 _pts->GetPoint((i+1)%nps, ppB);
1644 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1645 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1646 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]));
1649 //printf("\n Dist1 %f Dist2 %f Dist3 %f PT %d", d1,d2,d3,i);
1651 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
1660 // ----------------------------------------------------------------------------
1661 void manualViewContour::DeletePoint(int id) // virtual
1663 if (_lstViewPoints.size()>2)
1665 manualViewBaseContour::DeletePoint( id );
1668 // ----------------------------------------------------------------------------
1670 void manualViewContour::ClearPoint(int id)
1672 manualViewBaseContour::DeletePoint( id );
1675 //-------------------------------------------------------------------
1676 void manualViewContour::SetMesureScale(double mesureScale)
1678 _mesureScale = mesureScale;
1680 //-------------------------------------------------------------------
1681 void manualViewContour::InitMove(int x, int y, int z)
1683 _initialConoturModel->DeleteAllPoints();
1685 manualPoint *mp = NULL;
1689 TransfromeCoordViewWorld(XX,YY,ZZ);
1691 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1692 for ( i=0; i<manualPointsSZ; i++ )
1694 mp = _manContModel->GetManualPoint( i );
1695 this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
1698 //-------------------------------------------------------------------
1699 void manualViewContour::MoveContour(int x, int y, int z)
1701 manualPoint *mpOrigin = NULL;
1702 manualPoint *mpMoving = NULL;
1707 TransfromeCoordViewWorld(XX,YY,ZZ);
1709 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1710 for ( i=0; i<manualPointsSZ; i++ )
1712 mpOrigin = _manContModel->GetManualPoint( i );
1713 mpMoving = _initialConoturModel->GetManualPoint(i);
1714 mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
1718 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
1720 manualPoint *mpOrigin = NULL;
1722 int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
1723 for ( i=0; i<manualPointsSZ; i++ )
1725 mpOrigin = _manContModel->GetManualPoint( i );
1726 mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
1730 // ----------------------------------------------------------------------------
1731 // ----------------------------------------------------------------------------
1732 // ----------------------------------------------------------------------------
1735 manualView3VContour::manualView3VContour(int type)
1738 // JSTG 25-02-08 ------------------------------
1739 //_manContModel= new manualContourModel();
1740 //---------------------------------------------
1742 // ----------------------------------------------------------------------------
1743 manualView3VContour::~manualView3VContour()
1749 // ----------------------------------------------------------------------------
1750 manualView3VContour * manualView3VContour :: Clone()
1752 manualView3VContour * clone = new manualView3VContour( GetType() );
1753 CopyAttributesTo(clone);
1757 // ---------------------------------------------------------------------------
1759 void manualView3VContour::CopyAttributesTo( manualView3VContour * cloneObject)
1762 manualViewContour::CopyAttributesTo(cloneObject);
1765 int manualView3VContour::GetType()
1770 // ----------------------------------------------------------------------------
1771 void manualView3VContour::FilterCordinateXYZ(double &x,double &y,double &z)
1786 // ----------------------------------------------------------------------------
1788 void manualView3VContour::RefreshContour() // virtula
1790 manualViewContour::RefreshContour();
1793 // JSTG 25-02-08 ----------------------------------------
1794 //int nps = GetNumberOfPointsSpline();
1795 int nps = _manContModel->GetNumberOfPointsSpline();
1796 //-------------------------------------------------------
1797 for( i = 0; i < nps; i++ )
1799 _pts->GetPoint( i, pp );
1800 FilterCordinateXYZ(pp[0],pp[1],pp[2]);
1803 _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
1808 // ----------------------------------------------------------------------------
1810 void manualView3VContour::UpdateViewPoint(int id){ // virtual
1812 manualPoint *mp = _manContModel->GetManualPoint(id);
1817 FilterCordinateXYZ(x,y,z);
1818 _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
1821 // ----------------------------------------------------------------------------
1823 int manualView3VContour::GetIdPoint(int x, int y, int z) // virtual
1826 if (_manContModel!=NULL){
1830 TransfromeCoordViewWorld(xx,yy,zz,-1);
1831 ii=_manContModel->GetIdPoint(xx,yy,zz,GetRange(),_type);
1836 // ----------------------------------------------------------------------------
1837 bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
1845 TransfromeCoordViewWorld(xx,yy,zz,-1);
1852 unsigned int i, nps,nps_t;
1853 nps = _sizePointsContour;
1854 if (this->_manContModel->IfCloseContour()==true)
1860 FilterCordinateXYZ(xx,yy,zz);
1862 for( i = 0; i < nps_t; i++ ) {
1863 _pts->GetPoint(i%nps, ppA);
1864 _pts->GetPoint((i+1)%nps, ppB);
1865 FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
1866 FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
1867 d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
1868 d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
1869 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]));
1870 if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
1877 // ----------------------------------------------------------------------------
1878 // ----------------------------------------------------------------------------
1879 // ----------------------------------------------------------------------------
1880 manualView3DContour::manualView3DContour()
1883 // ----------------------------------------------------------------------------
1884 manualView3DContour::~manualView3DContour()
1888 // ----------------------------------------------------------------------------
1889 manualView3DContour * manualView3DContour :: Clone()
1891 manualView3DContour * clone = new manualView3DContour();
1892 CopyAttributesTo(clone);
1896 // ---------------------------------------------------------------------------
1897 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
1900 manualViewContour::CopyAttributesTo(cloneObject);
1902 cloneObject->SetDimensions ( _w , _h , _d );
1904 // ----------------------------------------------------------------------------
1905 void manualView3DContour::SetDimensions(int w, int h, int d)
1911 // ----------------------------------------------------------------------------
1912 void manualView3DContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type)
1914 X = _vtkmprbasedata->GetX();
1915 Y = _vtkmprbasedata->GetY();
1916 Z = _vtkmprbasedata->GetZ();
1918 // ----------------------------------------------------------------------------
1919 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
1921 _vtkmprbasedata = vtkmprbasedata;
1923 // ----------------------------------------------------------------------------
1924 int manualView3DContour::GetIdPoint2(int x, int y)
1927 double p[3],pA[3],pB[3];
1929 double pickPoint[ 3 ], cameraPos[ 3 ];
1930 vtkPointPicker* picker = vtkPointPicker::New( );
1931 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
1932 picker->Pick( x, y, 0.0, pRenderer );
1933 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
1934 picker->GetPickPosition( pickPoint );
1937 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
1938 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
1940 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
1942 double dist,distMin=999999999;
1943 int i,size=this->_manContModel->GetSizeLstPoints();
1944 for (i=0;i<size;i++)
1946 manualPoint *mp = this->_manContModel->GetManualPoint(i);
1950 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
1951 if ( (dist<=2*GetRange()) && (dist<distMin) )
1960 // ----------------------------------------------------------------------------
1961 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
1963 SelectAllPossibleSelected(false);
1964 int id=GetIdPoint2(x,y);
1967 SetPointPosibleSelected(id,true);
1975 // ----------------------------------------------------------------------------
1976 // ----------------------------------------------------------------------------
1977 // ----------------------------------------------------------------------------
1982 // ----------------------------------------------------------------------------
1983 // ----------------------------------------------------------------------------
1984 // ----------------------------------------------------------------------------
1985 manualViewBullEyeSector::manualViewBullEyeSector()
1989 // ----------------------------------------------------------------------------
1990 void manualViewBullEyeSector::RefreshContour()
1995 //----------------------------------
1997 _manContModel->UpdateSpline();
1998 nps = _manContModel->GetNumberOfPointsSpline();
2002 for( i = 0; i < nps; i++ )
2004 _manContModel->GetSpline_i_Point(i,&x,&y,&z);
2005 _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
2011 // ----------------------------------------------------------------------------
2012 // ----------------------------------------------------------------------------
2013 // ----------------------------------------------------------------------------
2016 manualViewBullEye::manualViewBullEye()
2020 // ----------------------------------------------------------------------------
2021 manualViewBullEye::~manualViewBullEye()
2024 int i,size=lstSectorBullEye.size();
2025 for (i=0;i<size;i++)
2027 delete lstSectorBullEye[i];
2029 lstSectorBullEye.clear();
2033 // ----------------------------------------------------------------------------
2034 manualViewBullEye * manualViewBullEye :: Clone()
2036 manualViewBullEye * clone = new manualViewBullEye();
2037 CopyAttributesTo(clone);
2041 // ---------------------------------------------------------------------------
2043 void manualViewBullEye::CopyAttributesTo( manualViewBullEye * cloneObject)
2046 manualViewBaseContour::CopyAttributesTo(cloneObject);
2050 // ----------------------------------------------------------------------------
2051 int manualViewBullEye::GetType() // virtual
2057 // ----------------------------------------------------------------------------
2058 void manualViewBullEye::RefreshContour() // virtual
2060 // External Rectangle
2061 manualViewRoi::RefreshContour();
2063 _manContModel->UpdateSpline();
2064 int np = GetNumberOfPoints( );
2065 // Refres sectors of BullEye(s)
2069 int i,size = lstSectorBullEye.size();
2070 for (i=0;i<size;i++)
2072 lstSectorBullEye[i]->RefreshContour();
2079 // ----------------------------------------------------------------------------
2080 void manualViewBullEye::ConstructVTKObjects() // virtual
2082 manualViewRoi::ConstructVTKObjects();
2085 this->GetSpacing(spc);
2086 manualViewBullEyeSector *mvbc;
2087 manualContourModelBullEye *mcmbe = (manualContourModelBullEye*)this->_manContModel;
2088 int i,size = mcmbe->GetSizeOfSectorLst();
2089 for ( i=0 ; i<size ; i++ )
2091 mvbc = new manualViewBullEyeSector();
2092 mvbc->SetModel( mcmbe->GetModelSector(i) );
2093 mvbc->SetWxVtkBaseView( this->GetWxVtkBaseView() );
2094 mvbc->SetRange( 2 );
2096 mvbc->SetSpacing(spc);
2097 mvbc->SetColorNormalContour(1, 0, 0);
2098 // mvbc->SetColorEditContour(0.5, 0.5, 0.5);
2099 // mvbc->SetColorSelectContour(1, 0.8, 0);
2100 mvbc->SetWidthLine( this->GetWidthLine() );
2102 mvbc->ConstructVTKObjects();
2103 lstSectorBullEye.push_back( mvbc );
2109 // ----------------------------------------------------------------------------
2110 void manualViewBullEye::AddSplineActor() // virtual
2112 manualViewRoi::AddSplineActor();
2113 int i,size=lstSectorBullEye.size();
2114 for (i=0;i<size;i++)
2116 lstSectorBullEye[i]->AddSplineActor();
2120 // ----------------------------------------------------------------------------
2121 void manualViewBullEye::RemoveSplineActor() // virtual
2123 manualViewRoi::RemoveSplineActor();
2124 int i,size=lstSectorBullEye.size();
2125 for (i=0;i<size;i++)
2127 lstSectorBullEye[i]->RemoveSplineActor();
2132 // ----------------------------------------------------------------------------
2133 // ----------------------------------------------------------------------------
2134 // ----------------------------------------------------------------------------
2136 manualViewRoi::manualViewRoi()
2138 _sizePointsContour=5;
2140 // ----------------------------------------------------------------------------
2141 manualViewRoi::~manualViewRoi()
2146 // ----------------------------------------------------------------------------
2147 manualViewRoi * manualViewRoi :: Clone()
2149 manualViewRoi * clone = new manualViewRoi();
2150 CopyAttributesTo(clone);
2154 // ---------------------------------------------------------------------------
2156 void manualViewRoi::CopyAttributesTo( manualViewRoi * cloneObject)
2159 manualViewBaseContour::CopyAttributesTo(cloneObject);
2162 // ----------------------------------------------------------------------------
2163 void manualViewRoi::RefreshContour() // virtual
2165 unsigned int i,ii, np;
2166 np = GetNumberOfPoints( );
2173 for( i = 0; i < np+1; i++ ) {
2175 mp = _manContModel->GetManualPoint(ii);
2178 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2179 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2180 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2183 // _pts->SetPoint(i, XX,YY,ZZ );
2184 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2188 _pts->SetPoint(0, 0 , 0 , 0);
2189 _pts->SetPoint(1, 0 , 0 , 0);
2194 // ----------------------------------------------------------------------------
2195 int manualViewRoi::GetType() // virtual
2200 // ----------------------------------------------------------------------------
2202 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2213 unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
2215 for( i = 0; i < size; i++ )
2218 mp=_manContModel->GetManualPoint(i);
2253 // ----------------------------------------------------------------------------
2256 bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
2259 double px1=99999,py1=99999,px2=-99999,py2=-99999;
2261 GetMinMax(px1,py1, px2, py2);
2266 TransfromeCoordViewWorld(xx,yy,zz);
2270 double ddx=GetRange();
2271 double ddy=GetRange();
2273 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2278 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2283 if ((ok1==true) && (ok2==false))
2291 // ----------------------------------------------------------------------------
2293 void manualViewRoi::InitMove(int x, int y, int z) // virtual
2299 TransfromeCoordViewWorld(XX,YY,ZZ);
2301 if (_manContModel->GetSizeLstPoints()==4){
2302 mp = _manContModel->GetManualPoint(0);
2303 _dp0[0]= mp->GetX() - XX;
2304 _dp0[1]= mp->GetY() - YY;
2305 _dp0[2]= mp->GetZ();
2307 mp = _manContModel->GetManualPoint(1);
2308 _dp1[0]= mp->GetX() - XX;
2309 _dp1[1]= mp->GetY() - YY;
2310 _dp1[2]= mp->GetZ();
2312 mp = _manContModel->GetManualPoint(2);
2313 _dp2[0]= mp->GetX() - XX;
2314 _dp2[1]= mp->GetY() - YY;
2315 _dp2[2]= mp->GetZ();
2317 mp = _manContModel->GetManualPoint(3);
2318 _dp3[0]= mp->GetX() - XX;
2319 _dp3[1]= mp->GetY() - YY;
2320 _dp3[2]= mp->GetZ();
2324 // ----------------------------------------------------------------------------
2326 void manualViewRoi::MoveContour(int x, int y, int z) // virtual
2332 TransfromeCoordViewWorld(XX,YY,ZZ);
2334 mp = _manContModel->GetManualPoint(0);
2335 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2337 mp = _manContModel->GetManualPoint(1);
2338 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2340 mp = _manContModel->GetManualPoint(2);
2341 mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2343 mp = _manContModel->GetManualPoint(3);
2344 mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2355 // ----------------------------------------------------------------------------
2356 // ----------------------------------------------------------------------------
2357 // ----------------------------------------------------------------------------
2361 manualViewCircle::manualViewCircle()
2363 // _sizePointsContour=5; // default 100
2365 // ----------------------------------------------------------------------------
2366 manualViewCircle::~manualViewCircle()
2371 // ----------------------------------------------------------------------------
2372 manualViewCircle * manualViewCircle :: Clone()
2374 manualViewCircle * clone = new manualViewCircle();
2375 CopyAttributesTo(clone);
2379 // ---------------------------------------------------------------------------
2381 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
2384 manualViewBaseContour::CopyAttributesTo(cloneObject);
2388 // ----------------------------------------------------------------------------
2390 void manualViewCircle::RefreshContour(){ // virtual
2392 manualPoint *mpA,*mpB;
2393 unsigned int i, np,nps;
2397 np = GetNumberOfPoints( );
2398 nps = _manContModel->GetNumberOfPointsSpline();
2399 double deltaAngle=(3.14159265*2)/(nps-1);
2404 mpA = _manContModel->GetManualPoint(0);
2405 mpB = _manContModel->GetManualPoint(1);
2406 difX = mpA->GetX() - mpB->GetX();
2407 difY = mpA->GetY() - mpB->GetY();
2408 radio = sqrt( difX*difX + difY*difY );
2409 manualContourModelCircle *manContModelCir = (manualContourModelCircle*)_manContModel;
2410 manContModelCir->SetRadio(radio);
2412 for( i = 0; i < nps; i++ ) {
2413 manContModelCir->GetSpline_i_Point(i, &XX, &YY, &ZZ);
2414 // angle = deltaAngle*i;
2415 // XX = cos(angle)*radio+mpA->GetX();
2416 // YY = sin(angle)*radio+mpA->GetY();
2418 _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
2421 _pts->SetPoint(0, 0 , 0 , 0);
2422 _pts->SetPoint(1, 0 , 0 , 0);
2428 // ----------------------------------------------------------------------------
2429 int manualViewCircle::GetType() // virtual
2434 // ----------------------------------------------------------------------------
2436 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
2438 manualPoint *mpA,*mpB;
2442 np = GetNumberOfPoints( );
2445 mpA = _manContModel->GetManualPoint(0);
2446 mpB = _manContModel->GetManualPoint(1);
2447 difX = mpA->GetX() - mpB->GetX();
2448 difY = mpA->GetY() - mpB->GetY();
2449 radio = sqrt( difX*difX + difY*difY );
2450 minX=mpA->GetX()-radio;
2451 minY=mpA->GetY()-radio;
2452 maxX=mpA->GetX()+radio;
2453 maxY=mpA->GetY()+radio;
2463 // ----------------------------------------------------------------------------
2464 bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
2467 double px1=99999,py1=99999,px2=-9999,py2=-99999;
2469 GetMinMax(px1,py1, px2, py2);
2474 TransfromeCoordViewWorld(xx,yy,zz);
2478 double ddx=GetRange();
2479 double ddy=GetRange();
2481 if ((xx>px1-ddx)&&(xx<px2+ddx) && (yy>py1-ddy)&&(yy<py2+ddy))
2486 if ((xx>px1+ddx)&&(xx<px2-ddx) && (yy>py1+ddy)&&(yy<py2-ddy))
2491 if ((ok1==true) && (ok2==false))
2500 // ----------------------------------------------------------------------------
2502 void manualViewCircle::InitMove(int x, int y, int z) // virtual
2508 TransfromeCoordViewWorld(XX,YY,ZZ);
2510 if (_manContModel->GetSizeLstPoints()==2){
2511 mp = _manContModel->GetManualPoint(0);
2512 _dp0[0]= mp->GetX() - XX;
2513 _dp0[1]= mp->GetY() - YY;
2514 _dp0[2]= mp->GetZ();
2516 mp = _manContModel->GetManualPoint(1);
2517 _dp1[0]= mp->GetX() - XX;
2518 _dp1[1]= mp->GetY() - YY;
2519 _dp1[2]= mp->GetZ();
2521 mp = _manContModel->GetManualPoint(2);
2522 _dp2[0]= mp->GetX() - XX;
2523 _dp2[1]= mp->GetY() - YY;
2524 _dp2[2]= mp->GetZ();
2526 mp = _manContModel->GetManualPoint(3);
2527 _dp3[0]= mp->GetX() - XX;
2528 _dp3[1]= mp->GetY() - YY;
2529 _dp3[2]= mp->GetZ();
2535 // ----------------------------------------------------------------------------
2536 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
2542 TransfromeCoordViewWorld(XX,YY,ZZ);
2544 mp = _manContModel->GetManualPoint(0);
2545 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2547 mp = _manContModel->GetManualPoint(1);
2548 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2550 // mp = _manContModel->GetManualPoint(2);
2551 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
2553 // mp = _manContModel->GetManualPoint(3);
2554 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
2558 // UpdateViewPoint(2);
2559 // UpdateViewPoint(3);
2565 // ----------------------------------------------------------------------------
2566 // ----------------------------------------------------------------------------
2567 // ----------------------------------------------------------------------------
2571 manualViewLine::manualViewLine()
2574 // ----------------------------------------------------------------------------
2575 manualViewLine::~manualViewLine()
2580 // ----------------------------------------------------------------------------
2581 manualViewLine * manualViewLine :: Clone()
2583 manualViewLine * clone = new manualViewLine();
2584 CopyAttributesTo(clone);
2588 // ---------------------------------------------------------------------------
2590 void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
2593 manualViewBaseContour::CopyAttributesTo(cloneObject);
2596 // ----------------------------------------------------------------------------
2597 int manualViewLine::GetType() // virtual
2603 // ----------------------------------------------------------------------------
2605 void manualViewLine::InitMove(int x, int y, int z) // virtual
2611 TransfromeCoordViewWorld(XX,YY,ZZ);
2613 if (_manContModel->GetSizeLstPoints()==2)
2615 mp = _manContModel->GetManualPoint(0);
2616 _dp0[0]= mp->GetX() - XX;
2617 _dp0[1]= mp->GetY() - YY;
2618 _dp0[2]= mp->GetZ();
2620 mp = _manContModel->GetManualPoint(1);
2621 _dp1[0]= mp->GetX() - XX;
2622 _dp1[1]= mp->GetY() - YY;
2623 _dp1[2]= mp->GetZ();
2629 // ----------------------------------------------------------------------------
2630 void manualViewLine::MoveContour(int x, int y, int z) // virtual
2636 TransfromeCoordViewWorld(XX,YY,ZZ);
2638 mp = _manContModel->GetManualPoint(0);
2639 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
2641 mp = _manContModel->GetManualPoint(1);
2642 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
2650 // ----------------------------------------------------------------------------
2651 // ----------------------------------------------------------------------------
2652 // ----------------------------------------------------------------------------
2655 manualViewBaseContour::manualViewBaseContour()
2659 _manContModel = NULL;
2660 _wxvtkbaseview = NULL;
2662 _posibleSelected = false;
2663 _viewControlPoints = false;
2666 _contourVtkActor = NULL;
2669 _sizePointsContour = 100;
2678 _coulorNormal_r = 1;
2679 _coulorNormal_g = 0;
2680 _coulorNormal_b = 1;
2682 _coulorSelection_r = 0;
2683 _coulorSelection_g = 1;
2684 _coulorSelection_b = 0;
2689 // ----------------------------------------------------------------------------
2690 manualViewBaseContour::~manualViewBaseContour()
2692 int i,size=_lstViewPoints.size();
2693 for (i=0;i<size; i++){
2694 delete _lstViewPoints[i];
2696 _lstViewPoints.clear();
2698 // ----------------------------------------------------------------------------
2701 int manualViewBaseContour::GetType() // virtual
2704 //int manualViewBaseContour::GetType() 0;
2705 //int manualViewContour::GetType() 1;
2706 //int manualViewRoi::GetType() 2;
2707 //int manualViewCircle::GetType() 3;
2708 //int manualViewStar::GetType() 4;
2709 //int manualViewLine::GetType() 6;
2714 // ----------------------------------------------------------------------------
2716 void manualViewBaseContour::Save(FILE *pFile)
2718 fprintf(pFile,"TypeView %d\n", GetType() );
2721 // ----------------------------------------------------------------------------
2722 void manualViewBaseContour::Open(FILE *pFile)
2726 // ----------------------------------------------------------------------------
2727 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
2729 _viewControlPoints = ifControlPoints;
2730 /*vtkRenderer * theRenderer = */ _wxvtkbaseview->GetRenderer(); // JPRx ??
2735 //Adding each control point
2736 if( ifControlPoints )
2741 // ---------------------------------------------------------------------------
2743 void manualViewBaseContour :: RemoveCompleteContourActor()
2745 /*vtkRenderer * theRenderer =*/ _wxvtkbaseview->GetRenderer(); // JPRx ??
2746 //Removing the spline
2747 RemoveSplineActor();
2750 //Removing each point
2751 RemoveControlPoints();
2755 // ---------------------------------------------------------------------------
2756 manualViewBaseContour * manualViewBaseContour :: Clone( )//virtual
2758 manualViewBaseContour * clone = new manualViewBaseContour();
2759 CopyAttributesTo(clone);
2764 // ---------------------------------------------------------------------------
2766 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
2769 //XXXX::CopyAttributesTo(cloneObject);
2771 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
2772 cloneObject-> SetSelected( this->GetSelected() );
2773 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
2774 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
2775 cloneObject-> SetRange( this->GetRange() );
2776 cloneObject-> SetZ( this->GetZ() );
2777 cloneObject-> SetSpacing( _spc );
2778 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
2779 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
2780 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
2782 int i, size = _lstViewPoints.size();
2783 for ( i=0; i<size; i++ )
2785 cloneObject->AddPoint( );
2789 // ----------------------------------------------------------------------------
2790 void manualViewBaseContour :: AddSplineActor()
2792 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2793 if (_contourVtkActor!=NULL)
2794 theRenderer->AddActor( _contourVtkActor );
2796 // ----------------------------------------------------------------------------
2797 void manualViewBaseContour :: RemoveSplineActor() // virtual
2799 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2800 if (_contourVtkActor!=NULL)
2801 theRenderer->RemoveActor( _contourVtkActor );
2803 // ----------------------------------------------------------------------------
2804 void manualViewBaseContour :: RemoveControlPoints()
2806 if (_wxvtkbaseview!=NULL){
2807 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2808 int i,size=_lstViewPoints.size();
2809 for (i=0;i<size; i++)
2811 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2812 theRenderer->RemoveActor( pointActor );
2815 SetIfViewControlPoints( false );
2817 // ----------------------------------------------------------------------------
2818 void manualViewBaseContour :: AddControlPoints()
2820 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
2821 SetIfViewControlPoints( true );
2822 if( _viewControlPoints )
2824 int i,size=_lstViewPoints.size();
2825 for (i=0;i<size; i++)
2827 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
2828 theRenderer->AddActor( pointActor );
2832 // ----------------------------------------------------------------------------
2833 void manualViewBaseContour::AddTextActor()
2835 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
2837 // ----------------------------------------------------------------------------
2838 void manualViewBaseContour::RemoveTextActor()
2840 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
2842 // ----------------------------------------------------------------------------
2843 void manualViewBaseContour::DeleteVtkObjects()
2845 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
2846 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
2847 if ( _pts != NULL ) { _pts -> Delete(); }
2848 if ( _pd != NULL ) { _pd -> Delete(); }
2849 _contourVtkActor = NULL;
2856 // ----------------------------------------------------------------------------
2857 void manualViewBaseContour::SetWidthLine(double width)
2860 this->UpdateColorActor();
2862 // for the control points
2863 int id, size = _lstViewPoints.size();
2864 for( id=0; id<size; id++)
2866 this->_lstViewPoints[id]->SetWidthLine(_widthline);
2871 // ----------------------------------------------------------------------------
2872 double manualViewBaseContour::GetWidthLine()
2877 // ----------------------------------------------------------------------------
2878 void manualViewBaseContour::ConstructVTKObjects()
2880 //JSTG 29-02-08 -----------------------------------------------
2881 //int i , nps = _sizePointsContour;
2883 int nps = _manContModel->GetNumberOfPointsSpline();
2884 //-------------------------------------------------------------
2886 _pts = vtkPoints::New();
2887 _pts->SetNumberOfPoints(nps);
2889 for (i=0 ; i<nps ; i++){
2890 _pts->SetPoint(i, 0 , 0 , 0 );
2892 // This is for the boundaring inicialisation
2895 _pts->SetPoint(0, 0 , 0 , -1000 );
2896 _pts->SetPoint(1, 0 , 0 , 1000 );
2897 // _pts->SetPoint(0, -1000 , -1000 , -1000 );
2898 // _pts->SetPoint(1, 1000 , 1000 , 1000 );
2901 vtkCellArray *lines = vtkCellArray::New();
2902 lines->InsertNextCell( nps /* +1 */ );
2903 for ( i=0 ; i<nps+1 ; i++ ){
2904 lines->InsertCellPoint(i % nps );
2907 _pd = vtkPolyData::New();
2908 _pd->SetPoints( _pts );
2909 _pd->SetLines( lines );
2910 lines->Delete(); //do not delete lines ??
2912 _contourVtkActor = vtkActor::New();
2913 _bboxMapper = vtkPolyDataMapper::New();
2914 _bboxMapper->ScalarVisibilityOff( );
2916 _bboxMapper->SetInput(_pd);
2917 _bboxMapper->ImmediateModeRenderingOn();
2918 _contourVtkActor->SetMapper(_bboxMapper);
2919 _contourVtkActor->GetProperty()->BackfaceCullingOff();
2923 _pd->ComputeBounds();
2926 _textActor = vtkTextActor::New();
2927 // _textActor->SetDisplayPosition(200, 200);
2928 _textActor->SetInput("");
2929 // Set coordinates to match the old vtkScaledTextActor default value
2930 // _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
2931 // _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
2932 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
2933 // _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
2935 vtkTextProperty *tprop = _textActor->GetTextProperty();
2936 tprop->SetFontSize(14);
2937 tprop->SetFontFamilyToArial();
2938 tprop->SetColor(0, 0, 1);
2940 // ----------------------------------------------------------------------------
2941 void manualViewBaseContour::CreateNewContour()
2943 ConstructVTKObjects();
2945 _wxvtkbaseview->GetRenderer()->AddActor( _contourVtkActor );
2946 _wxvtkbaseview->GetRenderer()->AddActor2D(_textActor);*/
2947 AddCompleteContourActor();
2949 // ----------------------------------------------------------------------------
2950 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
2952 manualPoint *mp = _manContModel->GetManualPoint(id);
2955 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
2956 // wxVtk2DBaseView *wxvtk2Dbasevie = (wxVtk2DBaseView*)this->GetWxVtkBaseView();
2957 // wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
2959 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
2962 // ----------------------------------------------------------------------------
2963 void manualViewBaseContour :: UpdateViewPoints()
2965 int id, size = _lstViewPoints.size();
2966 for( id=0; id<size; id++)
2968 UpdateViewPoint( id );
2972 // ----------------------------------------------------------------------------
2973 void manualViewBaseContour::AddPoint()
2975 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2978 // ----------------------------------------------------------------------------
2979 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
2981 _lstViewPoints.push_back( manualViewPoint );
2984 manualViewPoint->SetSpacing(_spc);
2986 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
2987 _wxvtkbaseview->GetRenderer()->AddActor( actor );
2990 // ----------------------------------------------------------------------------
2991 void manualViewBaseContour::InsertPoint(int id)
2993 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
2996 mvp->SetSpacing(_spc);
2998 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
2999 _lstViewPoints.insert(itNum,mvp);
3000 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
3002 // ----------------------------------------------------------------------------
3003 void manualViewBaseContour::DeleteContour()
3005 RemoveCompleteContourActor();
3006 /*if (_contourVtkActor!=NULL){
3007 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3010 int i,size=_lstViewPoints.size();
3011 for (i=0;i<size;i++){
3012 manualViewBaseContour::DeletePoint(0);
3016 // ----------------------------------------------------------------------------
3017 void manualViewBaseContour::DeletePoint(int id) // virtual
3019 int size=_lstViewPoints.size();
3020 if ( (id>=0) && (id<size) ){
3021 manualViewPoint *mvp =_lstViewPoints[id];
3023 // _handlePicker->DeletePickList(mvp->GetVtkActor());
3024 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
3025 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
3026 _lstViewPoints.erase(itNum);
3031 // ----------------------------------------------------------------------------
3032 void manualViewBaseContour::DeletePoint(int x, int y, int z)
3034 int id=GetIdPoint(x,y,z);
3039 // ----------------------------------------------------------------------------
3040 void manualViewBaseContour::SetSelected(bool selected)
3044 // ----------------------------------------------------------------------------
3045 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
3047 _posibleSelected=posibleSelected;
3049 // ----------------------------------------------------------------------------
3050 bool manualViewBaseContour::GetEditable()
3054 // ----------------------------------------------------------------------------
3055 void manualViewBaseContour::SetEditable( bool * condition )
3057 _editable = condition;
3059 // ----------------------------------------------------------------------------
3060 bool manualViewBaseContour::GetSelected()
3064 // ----------------------------------------------------------------------------
3065 bool manualViewBaseContour::GetPosibleSelected()
3067 return _posibleSelected;
3069 // ----------------------------------------------------------------------------
3070 void manualViewBaseContour::DeleteSelectedPoints()
3072 int i,size=_lstViewPoints.size();
3073 for (i=size-1;i>=0;i--){
3074 if (_lstViewPoints[i]->GetSelected()==true){
3080 // ----------------------------------------------------------------------------
3081 void manualViewBaseContour::SelectPoint(int i, bool select)
3083 _lstViewPoints[i]->SetSelected(select);
3085 // ----------------------------------------------------------------------------
3086 void manualViewBaseContour::SelectLstPoints()
3090 // ----------------------------------------------------------------------------
3091 void manualViewBaseContour::SelectAllPoints(bool select)
3093 int i,size=_lstViewPoints.size();
3094 for (i=0;i<size;i++){
3095 SelectPoint(i,select);
3098 //-----------------------------------------------------------------------------
3099 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
3101 _viewControlPoints = ifShow;
3103 // ----------------------------------------------------------------------------
3104 bool manualViewBaseContour:: GetIfViewControlPoints()
3106 return _viewControlPoints;
3109 // ----------------------------------------------------------------------------
3110 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
3112 _lstViewPoints[id]->SetPosibleSelected(select);
3114 // ----------------------------------------------------------------------------
3115 void manualViewBaseContour::SetPointSelected(int id,bool select)
3117 _lstViewPoints[id]->SetSelected(select);
3119 // ----------------------------------------------------------------------------
3120 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
3122 int i,size=_lstViewPoints.size();
3123 for (i=0;i<size;i++){
3124 SetPointPosibleSelected(i,select);
3127 // ----------------------------------------------------------------------------
3128 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z) // virtual
3130 SelectAllPossibleSelected(false);
3132 int id = GetIdPoint(x,y,z);
3135 SetPointPosibleSelected(id,true);
3139 // ----------------------------------------------------------------------------
3140 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
3143 SetPosibleSelected(result);
3144 int id = GetIdPoint(x,y,z);
3145 if( !GetEditable() && !_selected && id!= -1)
3148 SetPosibleSelected(result);
3152 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
3154 if (ifTouchContour(x,y,z)==true)
3157 SetPosibleSelected(result);
3161 if (GetEditable()==false)
3163 if (ifTouchContour(x,y,z)==true)
3166 SetPosibleSelected(result);
3174 // ----------------------------------------------------------------------------
3175 bool manualViewBaseContour::ifTouchContour(int x,int y, int z) // virtual
3179 // ----------------------------------------------------------------------------
3180 void manualViewBaseContour::UnSelectPoint(int i){
3181 _lstViewPoints[i]->SetSelected(false);
3184 // ----------------------------------------------------------------------------
3185 void manualViewBaseContour::UnSelectLstPoints(){
3188 // ----------------------------------------------------------------------------
3189 void manualViewBaseContour::UnSelectAllPoints(){
3190 int i,size=_lstViewPoints.size();
3191 for (i=0;i<size;i++){
3196 // ----------------------------------------------------------------------------
3197 void manualViewBaseContour::SetModel(manualContourModel *manContModel){
3198 _manContModel=manContModel;
3200 // ----------------------------------------------------------------------------
3201 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
3202 _wxvtkbaseview = wxvtkbaseview;
3204 // ----------------------------------------------------------------------------
3205 void manualViewBaseContour::RefreshContour() // Virtual
3208 // ----------------------------------------------------------------------------
3209 double* manualViewBaseContour::GetVectorPointsXManualContour(){
3211 int i,size = _sizePointsContour;
3212 double *vx = (double*)malloc(sizeof(double)*size);
3213 for (i=0;i<size;i++){
3214 _pts->GetPoint(i,pp);
3219 // ----------------------------------------------------------------------------
3220 double* manualViewBaseContour::GetVectorPointsYManualContour()
3223 int i,size = _sizePointsContour;
3224 double *vy = (double*)malloc(sizeof(double)*size);
3225 for (i=0;i<size;i++){
3226 _pts->GetPoint(i,pp);
3231 // ----------------------------------------------------------------------------
3232 double* manualViewBaseContour::GetVectorPointsZManualContour()
3235 int i,size = _sizePointsContour;
3236 double *vz = (double*)malloc(sizeof(double)*size);
3237 for (i=0;i<size;i++){
3238 _pts->GetPoint(i,pp);
3243 // ----------------------------------------------------------------------------
3244 void manualViewBaseContour::Refresh() // virtual
3246 if (_contourVtkActor!=NULL){
3249 int i,size=_lstViewPoints.size();
3250 for (i=0;i<size;i++){
3252 _lstViewPoints[i]->UpdateColorActor();
3256 if (_show_text==true)
3261 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
3264 _wxvtkbaseview->GetRenWin()->Render();
3268 // ----------------------------------------------------------------------------
3269 void manualViewBaseContour::RefreshText() // virtual
3271 if( _textActor!=NULL)
3272 _textActor -> SetInput(" ");
3274 // ----------------------------------------------------------------------------
3275 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
3277 _coulorNormal_r = r;
3278 _coulorNormal_g = g;
3279 _coulorNormal_b = b;
3281 // ----------------------------------------------------------------------------
3282 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
3284 r = _coulorNormal_r;
3285 g = _coulorNormal_g;
3286 b = _coulorNormal_b;
3288 // ----------------------------------------------------------------------------
3289 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
3295 // ----------------------------------------------------------------------------
3296 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
3302 // ----------------------------------------------------------------------------
3303 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
3305 _coulorSelection_r = r;
3306 _coulorSelection_g = g;
3307 _coulorSelection_b = b;
3309 // ----------------------------------------------------------------------------
3310 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
3312 r = _coulorSelection_r;
3313 g = _coulorSelection_g;
3314 b = _coulorSelection_b;
3316 // ----------------------------------------------------------------------------
3317 void manualViewBaseContour::UpdateColorActor()
3319 if (_contourVtkActor!=NULL)
3321 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
3322 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
3323 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
3325 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
3329 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
3333 // ----------------------------------------------------------------------------
3334 int manualViewBaseContour::GetIdPoint(int x, int y, int z) // virtual
3337 if (_manContModel!=NULL){
3341 TransfromeCoordViewWorld(xx,yy,zz);
3342 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
3347 // ----------------------------------------------------------------------------
3350 int manualViewBaseContour::GetNumberOfPoints()
3352 return _lstViewPoints.size();
3355 // ----------------------------------------------------------------------------
3357 //JSTG 25-02-08 ---------------------------------------------------------------
3358 /*int manualViewBaseContour::GetNumberOfPointsSpline()
3360 return _sizePointsContour;
3362 //----------------------------------------------------------------------------
3364 //JSTG 25-02-08 ---------------------------------------------------------------
3365 /*void manualViewBaseContour::SetNumberOfPointsSpline(int size)
3367 _sizePointsContour = size;
3369 //----------------------------------------------------------------------------
3371 void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // Virtual
3373 _wxvtkbaseview->TransfromeCoordScreenToWorld(X, Y, Z, type);
3378 // wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
3379 // wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
3382 // ----------------------------------------------------------------------------
3383 void manualViewBaseContour::SetRange(int range)
3387 // ----------------------------------------------------------------------------
3388 int manualViewBaseContour::GetRange()
3392 // ----------------------------------------------------------------------------
3393 void manualViewBaseContour::SetZ(int z)
3397 // ----------------------------------------------------------------------------
3398 int manualViewBaseContour::GetZ()
3403 // ----------------------------------------------------------------------------
3404 void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
3408 // ----------------------------------------------------------------------------
3409 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
3412 // ----------------------------------------------------------------------------
3413 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
3417 // ----------------------------------------------------------------------------
3418 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
3423 int size=_manContModel->GetSizeLstPoints();
3428 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
3434 for( i = 0; i < size; i++ )
3436 mp=_manContModel->GetManualPoint(i);
3488 // ----------------------------------------------------------------------------
3489 void manualViewBaseContour::ClearContour()
3491 if (_contourVtkActor!=NULL){
3492 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
3495 int i,size=_lstViewPoints.size();
3496 for (i=0;i<size;i++){
3501 // ----------------------------------------------------------------------------
3502 void manualViewBaseContour::ClearPoint(int id)
3506 // ----------------------------------------------------------------------------
3507 void manualViewBaseContour::SetVisible(bool ok)
3518 int i,size=_lstViewPoints.size();
3519 for (i=0;i<size;i++){
3520 actor = _lstViewPoints[i]->GetVtkActor();
3521 actor->GetProperty()->SetOpacity( opacity );
3523 _contourVtkActor->GetProperty()->SetOpacity( opacity );
3524 _textActor->GetProperty()->SetOpacity( opacity );
3525 _textActor->SetInput(" ");
3528 // ----------------------------------------------------------------------------
3529 void manualViewBaseContour::SetShowText(bool ok)
3532 if (_show_text==false)
3534 _textActor->SetInput(" ");
3537 // ----------------------------------------------------------------------------
3538 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
3540 return this->_wxvtkbaseview;
3542 // ----------------------------------------------------------------------------
3543 void manualViewBaseContour::GetSpacing(double spc[3])
3549 // ----------------------------------------------------------------------------
3550 void manualViewBaseContour::SetSpacing(double spc[3])
3558 // ----------------------------------------------------------------------------
3559 // ----------------------------------------------------------------------------
3560 // ----------------------------------------------------------------------------
3562 // _type = 0 Sagital
3563 // _type = 1 Coronal
3565 // _type = -1 View 3D
3567 manualContour3VControler::manualContour3VControler(int type)
3572 // _manViewBaseCont1 = NULL;
3573 // _manViewBaseCont2 = NULL;
3574 // _manViewBaseCont3 = NULL;
3576 //----------------------------------------------------------------------------
3577 manualContour3VControler::~manualContour3VControler()
3581 // ----------------------------------------------------------------------------
3582 manualContour3VControler * manualContour3VControler :: Clone() // virtual
3584 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
3585 CopyAttributesTo(clone);
3589 // ---------------------------------------------------------------------------
3590 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
3593 manualContourControler::CopyAttributesTo(cloneObject);
3595 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3597 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
3600 // ----------------------------------------------------------------------------
3601 int manualContour3VControler::GetType()
3606 // ----------------------------------------------------------------------------
3607 void manualContour3VControler::AddPoint_Others()
3609 manualViewBaseContour *mvbc;
3610 int i,size=this->_lstManualViewBaseContour.size();
3611 for ( i = 0 ; i < size ; i++ )
3613 mvbc = _lstManualViewBaseContour[i];
3618 // if (_manViewBaseCont1!=NULL){
3619 // _manViewBaseCont1->AddPoint();
3620 // _manViewBaseCont2->AddPoint();
3621 // _manViewBaseCont3->AddPoint();
3622 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3625 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3627 // ----------------------------------------------------------------------------
3628 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
3631 z=(int)_vtkmprbasedata->GetZ();
3632 if (GetManualContourModel()!=NULL){
3636 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3640 xx=_vtkmprbasedata->GetX();
3645 yy=_vtkmprbasedata->GetY();
3649 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
3650 GetManualViewBaseContour()->AddPoint();
3656 // ----------------------------------------------------------------------------
3657 void manualContour3VControler::InsertPoint_Others(int id)
3660 manualViewBaseContour *mvbc;
3661 int i,size=this->_lstManualViewBaseContour.size();
3662 for ( i = 0 ; i < size ; i++ )
3664 mvbc = _lstManualViewBaseContour[i];
3665 mvbc->InsertPoint(id);
3669 if (_manViewBaseCont1!=NULL){
3670 _manViewBaseCont1->InsertPoint(id);
3671 _manViewBaseCont2->InsertPoint(id);
3672 _manViewBaseCont3->InsertPoint(id);
3673 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3677 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3680 // ----------------------------------------------------------------------------
3681 void manualContour3VControler::InsertPoint(int x, int y, int z)
3684 if (GetManualContourModel()!=NULL){
3685 if (GetManualContourModel()->GetSizeLstPoints()>1){
3686 z=(int)_vtkmprbasedata->GetZ();
3690 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3693 xx=_vtkmprbasedata->GetX();
3698 yy=_vtkmprbasedata->GetY();
3701 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
3703 GetManualViewBaseContour()->InsertPoint(id);
3704 InsertPoint_Others(0);
3711 // ----------------------------------------------------------------------------
3715 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
3716 manualViewBaseContour *manViewBaseCont0,
3717 manualViewBaseContour *manViewBaseCont1,
3718 manualViewBaseContour *manViewBaseCont2,
3719 manualViewBaseContour *manViewBaseCont3)
3721 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
3722 _manViewBaseCont1 = manViewBaseCont1;
3723 _manViewBaseCont2 = manViewBaseCont2;
3724 _manViewBaseCont3 = manViewBaseCont3;
3728 // ----------------------------------------------------------------------------
3729 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
3731 _lstManualViewBaseContour.push_back( manViewBaseCont );
3734 // ----------------------------------------------------------------------------
3735 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3737 _vtkmprbasedata=vtkmprbasedata;
3739 // ----------------------------------------------------------------------------
3740 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
3742 return _vtkmprbasedata;
3744 // ----------------------------------------------------------------------------
3745 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
3747 z=(int)_vtkmprbasedata->GetZ();
3748 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
3752 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
3756 xx=_vtkmprbasedata->GetX();
3760 yy=_vtkmprbasedata->GetY();
3763 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
3764 mp->SetPoint(xx,yy,zz);
3768 // ----------------------------------------------------------------------------
3769 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
3771 manualViewBaseContour *mvbc;
3772 int i,size=this->_lstManualViewBaseContour.size();
3773 for ( i = 0 ; i < size ; i++ )
3775 mvbc = _lstManualViewBaseContour[i];
3776 mvbc->DeletePoint(id);
3781 if (_manViewBaseCont1!=NULL){
3782 _manViewBaseCont1->DeletePoint(id);
3783 _manViewBaseCont2->DeletePoint(id);
3784 _manViewBaseCont3->DeletePoint(id);
3786 _manViewBaseCont1->Refresh();
3787 _manViewBaseCont2->Refresh();
3788 _manViewBaseCont3->Refresh();
3790 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3793 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3795 // ----------------------------------------------------------------------------
3796 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
3798 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
3800 manualContourBaseControler::DeleteActualMousePoint( x , y );
3801 DeleteActualMousePoint_Others( id );
3804 // ----------------------------------------------------------------------------
3805 void manualContour3VControler::MouseMove_Others(int id) // virtual
3807 manualViewBaseContour *mvbc;
3808 int i,size=this->_lstManualViewBaseContour.size();
3809 for ( i = 0 ; i < size ; i++ )
3811 mvbc = _lstManualViewBaseContour[i];
3812 mvbc->SelectAllPossibleSelected(false);
3815 mvbc->SetPointPosibleSelected(id,true);
3817 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3823 if (_manViewBaseCont1!=NULL){
3824 _manViewBaseCont1->SelectAllPossibleSelected(false);
3825 _manViewBaseCont2->SelectAllPossibleSelected(false);
3826 _manViewBaseCont3->SelectAllPossibleSelected(false);
3828 _manViewBaseCont1->SetPointPosibleSelected(id,true);
3829 _manViewBaseCont2->SetPointPosibleSelected(id,true);
3830 _manViewBaseCont3->SetPointPosibleSelected(id,true);
3832 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3833 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3834 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
3836 _manViewBaseCont1->Refresh();
3837 _manViewBaseCont2->Refresh();
3838 _manViewBaseCont3->Refresh();
3840 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3843 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3847 // ----------------------------------------------------------------------------
3848 void manualContour3VControler::MouseMove(int x, int y) // virtual
3850 manualContourControler::MouseMove( x , y );
3851 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
3852 MouseMove_Others( id );
3855 // ----------------------------------------------------------------------------
3856 void manualContour3VControler::OnChar_Others()
3858 manualViewBaseContour *mvbc;
3859 int i,size=this->_lstManualViewBaseContour.size();
3860 for ( i = 0 ; i < size ; i++ )
3862 mvbc = _lstManualViewBaseContour[i];
3867 _manViewBaseCont1->Refresh();
3868 _manViewBaseCont2->Refresh();
3869 _manViewBaseCont3->Refresh();
3871 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3873 // ----------------------------------------------------------------------------
3874 bool manualContour3VControler::OnChar()
3876 manualContourControler::OnChar();
3880 // ----------------------------------------------------------------------------
3881 void manualContour3VControler::ResetContour() // virtual
3883 manualContourControler::ResetContour();
3884 ResetContour_Others();
3887 // ----------------------------------------------------------------------------
3888 void manualContour3VControler::ResetContour_Others()
3890 manualViewBaseContour *mvbc;
3891 int i,size=this->_lstManualViewBaseContour.size();
3892 for ( i = 0 ; i < size ; i++ )
3894 mvbc = _lstManualViewBaseContour[i];
3895 mvbc->DeleteContour();
3896 mvbc->CreateNewContour();
3901 _manViewBaseCont1->DeleteContour();
3902 _manViewBaseCont2->DeleteContour();
3903 _manViewBaseCont3->DeleteContour();
3904 _manViewBaseCont1->CreateNewContour();
3905 _manViewBaseCont2->CreateNewContour();
3906 _manViewBaseCont3->CreateNewContour();
3910 // ----------------------------------------------------------------------------
3911 // ----------------------------------------------------------------------------
3912 // ----------------------------------------------------------------------------
3913 manualContour3DControler::manualContour3DControler()
3916 // ----------------------------------------------------------------------------
3917 manualContour3DControler::~manualContour3DControler()
3920 // ----------------------------------------------------------------------------
3921 manualContour3DControler * manualContour3DControler :: Clone() // virtual
3923 manualContour3DControler * clone = new manualContour3DControler();
3924 CopyAttributesTo(clone);
3928 // ---------------------------------------------------------------------------
3929 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
3932 manualContourControler::CopyAttributesTo(cloneObject);
3934 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
3937 // ----------------------------------------------------------------------------
3938 bool manualContour3DControler::OnLeftButtonDown()
3941 wxVTKRenderWindowInteractor *wxVTKiren;
3942 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
3943 wxVTKiren->GetEventPosition(X,Y);
3944 MouseClickLeft(X,Y);
3947 // ----------------------------------------------------------------------------
3948 void manualContour3DControler::ResetOrientationPlane()
3950 double p[3],rp[3],rn[3];
3951 p[0] = this->GetVtkMPRBaseData()->GetX( );
3952 p[1] = this->GetVtkMPRBaseData()->GetY( );
3953 p[2] = this->GetVtkMPRBaseData()->GetZ( );
3954 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
3955 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
3957 // ----------------------------------------------------------------------------
3958 void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
3960 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
3961 int id=manualview3Dcontour->GetIdPoint2(x,y);
3962 if ( (GetState()==0) && (id!=-1) )
3964 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
3966 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
3967 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
3968 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
3969 ResetOrientationPlane();
3970 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
3974 manualContourControler::MouseClickLeft(x,y);
3977 // ----------------------------------------------------------------------------
3978 bool manualContour3DControler::OnChar()
3981 manualContourControler::OnChar();
3982 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
3985 ResetOrientationPlane();
3986 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
3991 // ----------------------------------------------------------------------------
3992 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
3994 _vtkmprbasedata=vtkmprbasedata;
3996 // ----------------------------------------------------------------------------
3997 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
3999 return _vtkmprbasedata;
4002 // ----------------------------------------------------------------------------
4003 void manualContour3DControler::InsertPoint(int x, int y, int z ) // virtual
4005 manualContourControler::InsertPoint( x, y, z );
4006 ResetOrientationPlane();
4011 // ----------------------------------------------------------------------------
4012 // ----------------------------------------------------------------------------
4013 // ----------------------------------------------------------------------------
4015 manualContour3V3DControler::manualContour3V3DControler()
4018 // ----------------------------------------------------------------------------
4019 manualContour3V3DControler::~manualContour3V3DControler()
4023 // ----------------------------------------------------------------------------
4024 manualContour3V3DControler * manualContour3V3DControler :: Clone() // virtual
4026 manualContour3V3DControler * clone = new manualContour3V3DControler();
4027 CopyAttributesTo(clone);
4031 // ---------------------------------------------------------------------------
4032 void manualContour3V3DControler::CopyAttributesTo( manualContour3V3DControler * cloneObject)
4035 manualContour3DControler::CopyAttributesTo(cloneObject);
4037 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4039 // ----------------------------------------------------------------------------
4040 void manualContour3V3DControler::InsertPoint(int x, int y, int z ) // virtual
4042 manualContour3DControler::InsertPoint( x, y, z );
4043 _manualcontour3Vcontroler->InsertPoint_Others(0);
4045 // ----------------------------------------------------------------------------
4046 void manualContour3V3DControler::AddPoint( int x, int y, int z )
4048 manualContour3DControler::AddPoint( x, y, z );
4049 _manualcontour3Vcontroler->AddPoint_Others();
4051 // ----------------------------------------------------------------------------
4052 void manualContour3V3DControler::DeleteActualMousePoint(int x, int y)
4054 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4055 manualContour3DControler::DeleteActualMousePoint( x , y );
4056 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4058 // ----------------------------------------------------------------------------
4059 void manualContour3V3DControler::MouseMove( int x, int y )
4061 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4062 if ((this->GetState()!=7) && (ss!=1)){
4063 manualContour3DControler::MouseMove( x , y );
4064 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4065 _manualcontour3Vcontroler->MouseMove_Others(id);
4068 // ----------------------------------------------------------------------------
4069 void manualContour3V3DControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4071 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4073 // ----------------------------------------------------------------------------
4074 manualContour3VControler *manualContour3V3DControler::GetManualContour3VControler()
4076 return _manualcontour3Vcontroler;
4078 // ----------------------------------------------------------------------------
4079 bool manualContour3V3DControler::OnChar() // virtual
4081 if (manualContour3DControler::OnChar()==false )
4083 _manualcontour3Vcontroler->OnChar_Others();
4088 // ----------------------------------------------------------------------------
4089 void manualContour3V3DControler::ResetContour() // virtual
4091 manualContourControler::ResetContour();
4092 _manualcontour3Vcontroler->ResetContour_Others();
4096 // ----------------------------------------------------------------------------
4097 // ----------------------------------------------------------------------------
4098 // ----------------------------------------------------------------------------
4100 // _state = 0 // ..nothing..
4101 // _state = 1 // move with add point
4102 // _state = 5 // move
4103 // _state = 6 // move with insert point
4104 // _state = 7 // move with non selection
4106 manualContourControler::manualContourControler()
4108 _easyCreation = true;
4111 // ----------------------------------------------------------------------------
4112 manualContourControler::~manualContourControler()
4115 // ----------------------------------------------------------------------------
4116 manualContourControler * manualContourControler :: Clone() // virtual
4118 manualContourControler * clone = new manualContourControler();
4119 CopyAttributesTo(clone);
4122 // ---------------------------------------------------------------------------
4123 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
4126 manualContourBaseControler::CopyAttributesTo(cloneObject);
4127 cloneObject->SetEasyCreation( this->GetEasyCreation() );
4130 // ----------------------------------------------------------------------------
4131 void manualContourControler::Configure() //virtual
4133 // this->_manContModel->SetNumberOfPointsSpline(100);
4136 // ----------------------------------------------------------------------------
4137 void manualContourControler::MouseClickLeft(int x, int y){
4142 int size= GetManualViewBaseContour()->GetNumberOfPoints();
4144 // Insert a Control Point with shift+ClickLeft
4145 // int tt = GetState(); // JPRx
4146 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
4150 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
4156 // Start to Insert Control Points with ClickLeft (Empty contour)
4157 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
4163 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
4164 if ((GetState()==1) && (_easyCreation==true) )
4168 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
4170 // Insert Control Points IF Contour si Selected
4171 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
4175 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4178 // Chose id of Control Point to be move
4179 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
4182 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4185 // If nothing selected _state=7
4186 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
4189 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4195 SetPosibleToMove( true );
4196 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
4198 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
4202 GetManualViewBaseContour()->InitMove(x,y,z);
4207 GetManualViewBaseContour()->Refresh();
4210 // ----------------------------------------------------------------------------
4211 void manualContourControler::MouseMove(int x, int y) // virtual
4214 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4215 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4216 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
4217 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
4218 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
4220 GetManualViewBaseContour()->MoveContour(x,y,z);
4222 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
4223 GetManualViewBaseContour()->Refresh();
4224 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4228 GetManualViewBaseContour()->RemoveControlPoints();
4229 GetManualViewBaseContour()->RemoveTextActor();
4230 GetManualViewBaseContour()->Refresh();
4231 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4236 // ----------------------------------------------------------------------------
4237 void manualContourControler::MouseDLeft( int x, int y)//virtual
4239 manualContourBaseControler::MouseDLeft( x, y);
4242 GetManualViewBaseContour()->AddControlPoints();
4243 GetManualViewBaseContour()->AddTextActor();
4244 GetManualViewBaseContour()->Refresh();
4245 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4248 // ----------------------------------------------------------------------------
4249 void manualContourControler::SetEasyCreation(bool easyCreation)
4251 _easyCreation=easyCreation;
4253 // ----------------------------------------------------------------------------
4254 bool manualContourControler::GetEasyCreation()
4256 return _easyCreation;
4260 // ----------------------------------------------------------------------------
4261 // ----------------------------------------------------------------------------
4262 // ----------------------------------------------------------------------------
4263 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
4265 _flagMouseMove = true;
4267 // ----------------------------------------------------------------------------
4268 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
4271 // ----------------------------------------------------------------------------
4272 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
4274 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
4275 CopyAttributesTo(clone);
4279 // ---------------------------------------------------------------------------
4280 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
4283 manualContourControler::CopyAttributesTo(cloneObject);
4285 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
4286 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
4287 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
4290 // ----------------------------------------------------------------------------
4291 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
4293 _vtkmprbasedata = vtkmprbasedata;
4296 // ----------------------------------------------------------------------------
4297 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
4299 return _vtkmprbasedata;
4303 // ----------------------------------------------------------------------------
4304 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
4306 manualContourControler::InsertPoint( x, y, z );
4307 _manualcontour3Vcontroler->InsertPoint_Others(0);
4309 // ----------------------------------------------------------------------------
4310 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
4312 manualContourControler::AddPoint( x, y, z );
4313 _manualcontour3Vcontroler->AddPoint_Others();
4315 // ----------------------------------------------------------------------------
4316 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
4318 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4319 manualContourControler::DeleteActualMousePoint( x , y );
4320 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
4322 // ----------------------------------------------------------------------------
4323 void manualContourPerpPlaneControler::MouseMove( int x, int y )
4325 _flagMouseMove = true;
4326 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
4327 if ((this->GetState()!=7) && (ss!=1)){
4328 manualContourControler::MouseMove( x , y );
4329 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
4332 _manualcontour3Vcontroler->MouseMove_Others(id);
4333 _flagMouseMove = false;
4337 // ----------------------------------------------------------------------------
4338 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
4340 _manualcontour3Vcontroler = manualcontour3Vcontroler;
4342 // ----------------------------------------------------------------------------
4343 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
4345 return _manualcontour3Vcontroler;
4347 // ----------------------------------------------------------------------------
4348 bool manualContourPerpPlaneControler::OnChar() // virtual
4350 if (manualContourControler::OnChar()==false )
4352 _manualcontour3Vcontroler->OnChar_Others();
4356 // ----------------------------------------------------------------------------
4357 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
4359 manualContourControler::OnMouseMove();
4360 return _flagMouseMove;
4362 // ----------------------------------------------------------------------------
4363 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
4365 manualContourControler::OnLeftDClick();
4366 return _flagMouseDClick;
4368 // ----------------------------------------------------------------------------
4369 void manualContourPerpPlaneControler::ResetContour() // virtual
4371 manualContourControler::ResetContour();
4372 _manualcontour3Vcontroler->ResetContour_Others();
4375 // ----------------------------------------------------------------------------
4376 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
4378 _flagMouseDClick=true;
4379 manualContourControler::MouseDLeft(x,y);
4381 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
4383 _flagMouseDClick = false;
4384 _vtkinteractorstyleplane2D->OnLeftDClick();
4385 ResetOrientationPlane();
4386 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4389 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
4390 // if ( (GetState()==0) && (id!=-1) )
4392 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
4393 // _vtkmprbasedata->SetX( mp->GetX() );
4394 // _vtkmprbasedata->SetY( mp->GetY() );
4395 // _vtkmprbasedata->SetZ( mp->GetZ() );
4396 // ResetOrientationPlane();
4397 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
4403 // ----------------------------------------------------------------------------
4404 void manualContourPerpPlaneControler::ResetOrientationPlane()
4406 double p[3],rp[3],rn[3];
4407 p[0] = _vtkmprbasedata->GetX( );
4408 p[1] = _vtkmprbasedata->GetY( );
4409 p[2] = _vtkmprbasedata->GetZ( );
4410 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
4412 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
4415 // ----------------------------------------------------------------------------
4416 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
4418 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
4420 // ----------------------------------------------------------------------------
4421 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
4423 return _vtkinteractorstyleplane2D;
4426 // ----------------------------------------------------------------------------
4427 // ----------------------------------------------------------------------------
4428 // ----------------------------------------------------------------------------
4430 // _state = 0 // ..nothing..
4431 // _state = 5 // move point
4432 // _state = 6 // move all
4433 // _state = 7 // Empty mouse drag
4435 manualRoiControler::manualRoiControler()
4438 // ----------------------------------------------------------------------------
4439 manualRoiControler::~manualRoiControler()
4442 // ----------------------------------------------------------------------------
4443 manualRoiControler * manualRoiControler :: Clone() // virtual
4445 manualRoiControler * clone = new manualRoiControler();
4446 CopyAttributesTo(clone);
4450 // ---------------------------------------------------------------------------
4451 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
4454 manualContourBaseControler::CopyAttributesTo(cloneObject);
4457 // ----------------------------------------------------------------------------
4458 void manualRoiControler::Configure() //virtual
4460 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4463 // ----------------------------------------------------------------------------
4464 void manualRoiControler::MouseClickLeft(int x, int y){
4466 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4467 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4470 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4471 GetManualViewBaseContour()->InitMove(x,y,z);
4474 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4475 if (GetState()==0) {
4487 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4490 GetManualViewBaseContour()->Refresh();
4492 // ----------------------------------------------------------------------------
4493 void manualRoiControler::MouseMove(int x, int y) // virtual
4497 // this->_vtkInteractorStyleBaseView->
4499 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4500 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4503 SetPoint( bakIdPoint , x , y ,z);
4526 GetManualViewBaseContour()->MoveContour(x,y,z);
4528 GetManualViewBaseContour()->Refresh();
4530 // ----------------------------------------------------------------------------
4531 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
4534 // ----------------------------------------------------------------------------
4535 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
4540 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4549 double pp1=porcentage;
4550 double pp2=1-porcentage;
4552 mp = GetManualContourModel()->GetManualPoint(2);
4554 mp->SetPoint(ww*pp1,hh*pp1,zz);
4556 mp = GetManualContourModel()->GetManualPoint(1);
4558 mp->SetPoint(ww*pp2,hh*pp1,zz);
4560 mp = GetManualContourModel()->GetManualPoint(0);
4562 mp->SetPoint(ww*pp2,hh*pp2,zz);
4564 mp = GetManualContourModel()->GetManualPoint(3);
4566 mp->SetPoint(ww*pp1,hh*pp2,zz);
4568 GetManualViewBaseContour() ->UpdateViewPoint(0);
4569 GetManualViewBaseContour() ->UpdateViewPoint(1);
4570 GetManualViewBaseContour() ->UpdateViewPoint(2);
4571 GetManualViewBaseContour() ->UpdateViewPoint(3);
4574 GetManualViewBaseContour()->Refresh();
4577 // ----------------------------------------------------------------------------
4578 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
4581 InitRoi( 0 , 0 , 0.2 );
4582 mp = GetManualContourModel()->GetManualPoint(2);
4586 mp = GetManualContourModel()->GetManualPoint(1);
4590 mp = GetManualContourModel()->GetManualPoint(0);
4594 mp = GetManualContourModel()->GetManualPoint(3);
4598 GetManualViewBaseContour() ->UpdateViewPoint(0);
4599 GetManualViewBaseContour() ->UpdateViewPoint(1);
4600 GetManualViewBaseContour() ->UpdateViewPoint(2);
4601 GetManualViewBaseContour() ->UpdateViewPoint(3);
4605 // ----------------------------------------------------------------------------
4606 // ----------------------------------------------------------------------------
4607 // ----------------------------------------------------------------------------
4611 // _state = 0 // ..nothing..
4612 // _state = 5 // move point
4613 // _state = 6 // move all
4614 // _state = 7 // Empty mouse drag
4616 manualCircleControler::manualCircleControler()
4619 // ----------------------------------------------------------------------------
4620 manualCircleControler::~manualCircleControler()
4623 // ----------------------------------------------------------------------------
4624 manualCircleControler * manualCircleControler :: Clone() // virtual
4626 manualCircleControler * clone = new manualCircleControler();
4627 CopyAttributesTo(clone);
4631 // ---------------------------------------------------------------------------
4632 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
4635 manualContourBaseControler::CopyAttributesTo(cloneObject);
4638 // ----------------------------------------------------------------------------
4639 void manualCircleControler::Configure() //virtual
4641 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
4644 // ----------------------------------------------------------------------------
4645 void manualCircleControler::MouseClickLeft(int x, int y){
4647 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4648 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4651 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4652 GetManualViewBaseContour()->InitMove(x,y,z);
4655 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4656 if (GetState()==0) {
4665 // SetPoint(2,x,y,z);
4666 // SetPoint(3,x,y,z);
4668 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4671 GetManualViewBaseContour()->Refresh();
4673 // ----------------------------------------------------------------------------
4675 void manualCircleControler::MouseMove(int x, int y) // virtual
4679 // this->_vtkInteractorStyleBaseView->
4681 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4682 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4685 SetPoint( bakIdPoint , x , y ,z);
4711 GetManualViewBaseContour()->MoveContour(x,y,z);
4713 GetManualViewBaseContour()->Refresh();
4717 // ----------------------------------------------------------------------------
4718 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
4721 // ----------------------------------------------------------------------------
4723 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
4728 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4733 // AddPoint(0,0,zz);
4734 // AddPoint(0,0,zz);
4737 double pp1=porcentage;
4738 double pp2=1-porcentage;
4740 // mp = GetManualContourModel()->GetManualPoint(2);
4741 // zz=(int)mp->GetZ();
4742 // mp->SetPoint(ww*pp1,hh*pp1,zz);
4744 mp = GetManualContourModel()->GetManualPoint(1);
4746 mp->SetPoint(ww*pp2,hh*pp1,zz);
4748 mp = GetManualContourModel()->GetManualPoint(0);
4750 mp->SetPoint(ww*pp2,hh*pp2,zz);
4752 // mp = GetManualContourModel()->GetManualPoint(3);
4753 // zz=(int)mp->GetZ();
4754 // mp->SetPoint(ww*pp1,hh*pp2,zz);
4756 GetManualViewBaseContour() ->UpdateViewPoint(0);
4757 GetManualViewBaseContour() ->UpdateViewPoint(1);
4758 // GetManualViewBaseContour() ->UpdateViewPoint(2);
4759 // GetManualViewBaseContour() ->UpdateViewPoint(3);
4762 GetManualViewBaseContour()->Refresh();
4765 // ----------------------------------------------------------------------------
4767 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
4770 InitRoi( 0 , 0 , 0.2 );
4771 mp = GetManualContourModel()->GetManualPoint(2);
4775 mp = GetManualContourModel()->GetManualPoint(1);
4779 mp = GetManualContourModel()->GetManualPoint(0);
4783 mp = GetManualContourModel()->GetManualPoint(3);
4787 GetManualViewBaseContour() ->UpdateViewPoint(0);
4788 GetManualViewBaseContour() ->UpdateViewPoint(1);
4789 GetManualViewBaseContour() ->UpdateViewPoint(2);
4790 GetManualViewBaseContour() ->UpdateViewPoint(3);
4795 // ----------------------------------------------------------------------------
4796 // ----------------------------------------------------------------------------
4797 // ----------------------------------------------------------------------------
4801 // _state = 0 // ..nothing..
4802 // _state = 5 // move point
4803 // _state = 6 // move all
4804 // _state = 7 // Empty mouse drag
4806 manualLineControler::manualLineControler()
4809 // ----------------------------------------------------------------------------
4810 manualLineControler::~manualLineControler()
4813 // ----------------------------------------------------------------------------
4814 manualLineControler * manualLineControler :: Clone() // virtual
4816 manualLineControler * clone = new manualLineControler();
4817 CopyAttributesTo(clone);
4821 // ---------------------------------------------------------------------------
4822 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
4825 manualContourBaseControler::CopyAttributesTo(cloneObject);
4828 // ----------------------------------------------------------------------------
4829 void manualLineControler::MouseClickLeft(int x, int y){
4831 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
4832 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4835 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
4836 GetManualViewBaseContour()->InitMove(x,y,z);
4839 int size=GetManualViewBaseContour()->GetNumberOfPoints();
4840 if (GetState()==0) {
4848 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
4851 GetManualViewBaseContour()->Refresh();
4853 // ----------------------------------------------------------------------------
4855 void manualLineControler::MouseMove(int x, int y) // virtual
4859 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
4860 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
4864 SetPoint( bakIdPoint , x , y ,z);
4868 GetManualViewBaseContour()->MoveContour(x,y,z);
4870 GetManualViewBaseContour()->Refresh();
4874 // ----------------------------------------------------------------------------
4875 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
4878 // ----------------------------------------------------------------------------
4880 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
4885 if (GetManualContourModel()->GetSizeLstPoints() ==0)
4892 double pp1=porcentage;
4893 double pp2=1-porcentage;
4895 mp = GetManualContourModel()->GetManualPoint(0);
4897 mp->SetPoint(ww*pp2,hh*pp2,zz);
4899 mp = GetManualContourModel()->GetManualPoint(1);
4901 mp->SetPoint(ww*pp2,hh*pp1,zz);
4903 GetManualViewBaseContour() ->UpdateViewPoint(0);
4904 GetManualViewBaseContour() ->UpdateViewPoint(1);
4907 GetManualViewBaseContour()->Refresh();
4910 // ----------------------------------------------------------------------------
4911 // ----------------------------------------------------------------------------
4912 // ----------------------------------------------------------------------------
4915 manualContourBaseControler::manualContourBaseControler()
4917 _manViewBaseCont = NULL;
4918 _manContModel = NULL;
4922 _posibleToMove = true;
4925 _keyBoardMoving = false;
4927 // ----------------------------------------------------------------------------
4928 manualContourBaseControler::~manualContourBaseControler()
4932 // ----------------------------------------------------------------------------
4933 manualContourBaseControler * manualContourBaseControler :: Clone() // virtual
4935 manualContourBaseControler * clone = new manualContourBaseControler();
4936 CopyAttributesTo(clone);
4940 // ---------------------------------------------------------------------------
4942 void manualContourBaseControler::CopyAttributesTo( manualContourBaseControler * cloneObject)
4945 InteractorStyleMaracas::CopyAttributesTo(cloneObject);
4946 cloneObject->SetZ( this->GetZ() );
4947 cloneObject->SetState( this->GetState() );
4948 cloneObject->SetEditable( this->IsEditable() );
4949 cloneObject->SetPosibleToMove( this->GetPosibleToMove() );
4950 cloneObject->SetMoving( this->IsMoving() );
4951 cloneObject->SetCompleteCreation( this->GetIfCompleteCreation() );
4952 cloneObject->SetKeyBoardMoving( this->GetKeyBoardMoving() );
4955 // ----------------------------------------------------------------------------
4956 void manualContourBaseControler::Configure() //virtual
4960 // ----------------------------------------------------------------------------
4961 bool manualContourBaseControler::OnChar()
4963 if ( _vtkInteractorStyleBaseView!=NULL )
4965 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
4968 wxVTKRenderWindowInteractor *_wxVTKiren;
4969 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
4970 _wxVTKiren->GetEventPosition(X, Y);
4971 //int Z = GetZ(); // JPRx
4973 if ((keyCode==8) || (keyCode==127))
4976 if (!GetManualViewBaseContour()->GetPosibleSelected()==true)
4978 DeleteActualMousePoint(X,Y);
4980 GetManualViewBaseContour()->Refresh();
4981 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4989 GetManualViewBaseContour()->Refresh();
4990 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
4992 else if( !IsEditable() )
4994 if ( keyCode == 'L' )
4996 GetManualViewBaseContour()->MoveContour( -1, 0 );
4997 SetKeyBoardMoving( true );
4999 else if ( keyCode == 'R' )
5001 GetManualViewBaseContour()->MoveContour( 1, 0 );
5002 SetKeyBoardMoving( true );
5004 else if ( keyCode == 'U' )
5006 GetManualViewBaseContour()->MoveContour( 0, -1 );
5007 SetKeyBoardMoving( true );
5009 else if ( keyCode == 'D' )
5011 GetManualViewBaseContour()->MoveContour( 0, 1 );
5012 SetKeyBoardMoving( true );
5014 else if ( keyCode == 'W' )//Diagonal left down
5016 GetManualViewBaseContour()->MoveContour( -1, 1 );
5017 SetKeyBoardMoving( true );
5019 else if ( keyCode == 'Q' )//Diagonal left up
5021 GetManualViewBaseContour()->MoveContour( -1, -1 );
5022 SetKeyBoardMoving( true );
5024 else if( keyCode == 'P' )//Diagonal right up
5026 GetManualViewBaseContour()->MoveContour( 1, -1 );
5027 SetKeyBoardMoving( true );
5029 else if( keyCode == 'M' )//Diagonal right down
5031 GetManualViewBaseContour()->MoveContour( 1, 1 );
5032 SetKeyBoardMoving( true );
5034 if( GetKeyBoardMoving() )
5036 GetManualViewBaseContour()->Refresh();
5037 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
5044 // ----------------------------------------------------------------------------
5045 bool manualContourBaseControler::OnMouseMove()
5047 if ( _vtkInteractorStyleBaseView!=NULL)
5050 wxVTKRenderWindowInteractor *_wxVTKiren;
5051 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5052 _wxVTKiren->GetEventPosition( X , Y );
5055 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
5056 (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
5062 // ----------------------------------------------------------------------------
5063 bool manualContourBaseControler::OnLeftButtonDown()
5065 SetKeyBoardMoving( false );
5066 if ( _vtkInteractorStyleBaseView!=NULL )
5069 wxVTKRenderWindowInteractor *wxVTKiren;
5070 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5071 wxVTKiren->GetEventPosition(X,Y);
5073 MouseClickLeft(X,Y);
5077 // ----------------------------------------------------------------------------
5078 bool manualContourBaseControler::OnLeftButtonUp()
5080 if ( _vtkInteractorStyleBaseView!=NULL )
5083 wxVTKRenderWindowInteractor *wxVTKiren;
5084 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5085 wxVTKiren->GetEventPosition(X,Y);
5086 MouseReleaseLeft(X,Y);
5090 // ----------------------------------------------------------------------------
5091 bool manualContourBaseControler::OnLeftDClick()
5093 if ( _vtkInteractorStyleBaseView!=NULL )
5096 wxVTKRenderWindowInteractor *wxVTKiren;
5097 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5098 wxVTKiren->GetEventPosition(X,Y);
5100 this->MouseDLeft(X,Y);
5104 // ----------------------------------------------------------------------------
5105 bool manualContourBaseControler::OnMiddleButtonDown()
5107 // SetKeyBoardMoving( false );
5108 if ( _vtkInteractorStyleBaseView!=NULL )
5111 wxVTKRenderWindowInteractor *wxVTKiren;
5112 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5113 wxVTKiren->GetEventPosition(X,Y);
5114 GetManualViewBaseContour()->InitMove( X, Y,GetZ());
5118 // ----------------------------------------------------------------------------
5119 bool manualContourBaseControler::OnMiddleButtonUp()
5123 // ----------------------------------------------------------------------------
5124 bool manualContourBaseControler::OnRightButtonDown()
5126 if( _vtkInteractorStyleBaseView!= NULL )
5129 wxVTKRenderWindowInteractor *wxVTKiren;
5130 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
5131 wxVTKiren->GetEventPosition(X, Y);
5133 SetCompleteCreation( true );
5134 SetKeyBoardMoving( false );
5135 MouseClickRight(X,Y);
5139 // ----------------------------------------------------------------------------
5140 bool manualContourBaseControler::OnRightButtonUp()
5144 // ----------------------------------------------------------------------------
5145 void manualContourBaseControler::SetModelView(manualContourModel *manContModel, manualViewBaseContour *manViewBaseCont){
5146 _manContModel = manContModel;
5147 _manViewBaseCont = manViewBaseCont;
5148 _manViewBaseCont->SetEditable( &_editable );
5150 // ----------------------------------------------------------------------------
5151 manualContourModel* manualContourBaseControler::GetManualContourModel()
5153 return _manContModel;
5155 // ----------------------------------------------------------------------------
5156 manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
5158 return _manViewBaseCont;
5160 // ----------------------------------------------------------------------------
5161 void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
5165 // ----------------------------------------------------------------------------
5166 void manualContourBaseControler::MouseClickRight(int x, int y)
5172 SetEditable( false );
5173 SetPosibleToMove( false );
5177 // ----------------------------------------------------------------------------
5178 void manualContourBaseControler::MouseReleaseLeft(int x, int y)
5180 if (_state==5){ _state = 0; }
5181 if (_state==6){ _state = 0; }
5182 if (_state==7){ _state = 0; }
5184 GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
5185 if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1) )
5187 SetEditable( false );
5188 SetPosibleToMove( false );
5191 // ----------------------------------------------------------------------------
5192 void manualContourBaseControler::MouseDLeft(int x, int y )
5197 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
5198 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
5199 if ( GetManualViewBaseContour()->GetPosibleSelected() )
5205 // ----------------------------------------------------------------------------
5206 void manualContourBaseControler::MouseMove(int x, int y) // virtual
5209 // ----------------------------------------------------------------------------
5210 void manualContourBaseControler::SetState(int state)
5214 // ----------------------------------------------------------------------------
5215 int manualContourBaseControler::GetState()
5219 // ----------------------------------------------------------------------------
5220 bool manualContourBaseControler::IsEditable( )
5224 // ----------------------------------------------------------------------------
5225 void manualContourBaseControler::SetEditable( bool condition )
5227 if (GetManualViewBaseContour()!=NULL) {
5230 GetManualViewBaseContour()->RemoveControlPoints();
5232 GetManualViewBaseContour()->SetSelected( condition );
5234 _editable = condition;
5237 // ----------------------------------------------------------------------------
5238 bool manualContourBaseControler::GetPosibleToMove()
5240 return _posibleToMove;
5242 // ----------------------------------------------------------------------------
5243 void manualContourBaseControler::SetPosibleToMove( bool condition )
5245 _posibleToMove = condition;
5247 // ----------------------------------------------------------------------------
5248 bool manualContourBaseControler::IsMoving()
5252 // ----------------------------------------------------------------------------
5253 void manualContourBaseControler::SetMoving( bool condition )
5255 _moving = condition;
5257 // ----------------------------------------------------------------------------
5258 void manualContourBaseControler::SetCompleteCreation( bool condition )
5260 _created = condition;
5262 // ----------------------------------------------------------------------------
5263 bool manualContourBaseControler::GetIfCompleteCreation ( )
5267 // ----------------------------------------------------------------------------
5268 void manualContourBaseControler::SetKeyBoardMoving( bool condition )
5270 _keyBoardMoving = condition;
5272 // ----------------------------------------------------------------------------
5273 bool manualContourBaseControler::GetKeyBoardMoving( )
5275 return _keyBoardMoving;
5277 // ----------------------------------------------------------------------------
5278 void manualContourBaseControler::CreateNewManualContour(){
5279 _manViewBaseCont->CreateNewContour();
5281 // ----------------------------------------------------------------------------
5282 int manualContourBaseControler::GetNumberOfPointsManualContour(){
5283 return _manViewBaseCont->GetNumberOfPoints();
5285 // ----------------------------------------------------------------------------
5287 //JSTG - 25-02-08 -------------------------------------------------------------
5288 int manualContourBaseControler::GetNumberOfPointsSplineManualContour(){
5289 //return _manViewBaseCont->GetNumberOfPointsSpline();
5290 return _manContModel->GetNumberOfPointsSpline();
5292 // ----------------------------------------------------------------------------
5294 double* manualContourBaseControler::GetVectorPointsXManualContour(){
5295 return _manViewBaseCont->GetVectorPointsXManualContour();
5297 // ----------------------------------------------------------------------------
5298 double* manualContourBaseControler::GetVectorPointsYManualContour(){
5299 return _manViewBaseCont->GetVectorPointsYManualContour();
5301 // ----------------------------------------------------------------------------
5302 void manualContourBaseControler::DeleteContour(){
5303 _manViewBaseCont->DeleteContour();
5304 _manContModel->DeleteAllPoints();
5306 // ----------------------------------------------------------------------------
5307 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
5309 if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
5311 int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
5312 if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
5313 _manContModel->DeletePoint(id);
5314 _manViewBaseCont->DeletePoint(id);
5320 // ----------------------------------------------------------------------------
5321 void manualContourBaseControler::Magnet(int x, int y)
5325 /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
5326 if (GetManualContourModel()!=NULL){
5330 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5331 int id = GetManualContourModel()->GetIdPoint(xx,yy,zz,32000,-1);
5334 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
5335 mp->SetPoint(xx,yy,zz);
5337 // GetManualViewBaseContour()->UpdateViewPoint(id);
5343 // ----------------------------------------------------------------------------
5344 void manualContourBaseControler::SetZ(int z)
5348 // ----------------------------------------------------------------------------
5349 int manualContourBaseControler::GetZ()
5353 // ----------------------------------------------------------------------------
5354 void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
5356 if (GetManualContourModel()!=NULL){
5360 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5361 /*int id =*/ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
5362 GetManualViewBaseContour()->AddPoint();
5363 // GetManualViewBaseContour()->UpdateViewPoint(id);
5366 // ----------------------------------------------------------------------------
5367 void manualContourBaseControler::InsertPoint(int x,int y,int z) // virtual
5371 if (GetManualContourModel()!=NULL){
5375 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5376 if (GetManualContourModel()->GetSizeLstPoints()>1){
5377 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
5378 GetManualViewBaseContour()->InsertPoint(id);
5379 // GetManualViewBaseContour()->UpdateViewPoint(id);
5381 GetManualContourModel()->AddPoint(xx,yy,zz);
5382 GetManualViewBaseContour()->AddPoint();
5384 // GetManualViewBaseContour()->UpdateViewPoint(id);
5389 // ----------------------------------------------------------------------------
5390 void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // virtual
5391 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5395 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5396 manualPoint *mp = _manContModel->GetManualPoint(id);
5397 mp->SetPoint(xx,yy,zz);
5398 GetManualViewBaseContour()->UpdateViewPoint(id);
5401 // ----------------------------------------------------------------------------
5402 void manualContourBaseControler::SetPointX( int id ,int x ){
5403 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5407 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5408 manualPoint *mp = _manContModel->GetManualPoint(id);
5410 GetManualViewBaseContour()->UpdateViewPoint(id);
5413 // ----------------------------------------------------------------------------
5414 void manualContourBaseControler::SetPointY( int id ,int y ){
5415 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5419 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5420 manualPoint *mp = _manContModel->GetManualPoint(id);
5422 GetManualViewBaseContour()->UpdateViewPoint(id);
5425 // ----------------------------------------------------------------------------
5426 void manualContourBaseControler::SetPointZ( int id ,int z ){
5427 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
5431 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
5432 manualPoint *mp = _manContModel->GetManualPoint(id);
5434 GetManualViewBaseContour()->UpdateViewPoint(id);
5437 // ----------------------------------------------------------------------------
5438 void manualContourBaseControler::ResetContour() // virtual
5440 this->DeleteContour();
5441 GetManualViewBaseContour()->CreateNewContour();