00001 #include "manualViewBaseContour.h"
00002
00003
00004
00005
00006
00007
00008 manualViewBaseContour::manualViewBaseContour()
00009 {
00010 _show_text = true;
00011 _textActor = NULL;
00012 _manContModel = NULL;
00013 _wxvtkbaseview = NULL;
00014 _selected = false;
00015 _posibleSelected = false;
00016 _viewControlPoints = false;
00017 _pts = NULL;
00018 _pd = NULL;
00019 _contourVtkActor = NULL;
00020 _bboxMapper = NULL;
00021 _range = 1;
00022 _sizePointsContour = 100;
00023 _spc[0] = 1;
00024 _spc[1] = 1;
00025 _spc[2] = 1;
00026
00027 _coulorEdit_r = 1;
00028 _coulorEdit_g = 1;
00029 _coulorEdit_b = 0;
00030
00031 _coulorNormal_r = 1;
00032 _coulorNormal_g = 0;
00033 _coulorNormal_b = 1;
00034
00035 _coulorSelection_r = 0;
00036 _coulorSelection_g = 1;
00037 _coulorSelection_b = 0;
00038
00039 _widthline = 1;
00040
00041 }
00042
00043 manualViewBaseContour::~manualViewBaseContour()
00044 {
00045 int i,size=_lstViewPoints.size();
00046 for (i=0;i<size; i++){
00047 delete _lstViewPoints[i];
00048 }
00049 _lstViewPoints.clear();
00050 }
00051
00052
00053
00054 int manualViewBaseContour::GetType()
00055 {
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 return 0;
00067 }
00068
00069
00070 void manualViewBaseContour::Save(FILE *pFile)
00071 {
00072 fprintf(pFile,"TypeView %d\n", GetType() );
00073 }
00074
00075
00076 void manualViewBaseContour::Open(FILE *pFile)
00077 {
00078 }
00079
00080
00081 void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints )
00082 {
00083 _viewControlPoints = ifControlPoints;
00084 _wxvtkbaseview->GetRenderer();
00085
00086 AddSplineActor();
00087
00088 AddTextActor();
00089
00090 if( ifControlPoints )
00091 AddControlPoints();
00092 RefreshContour();
00093 Refresh();
00094 }
00095
00096
00097 void manualViewBaseContour :: RemoveCompleteContourActor()
00098 {
00099 _wxvtkbaseview->GetRenderer();
00100
00101 RemoveSplineActor();
00102 RemoveTextActor();
00103
00104
00105 RemoveControlPoints();
00106 RefreshContour();
00107 Refresh();
00108 }
00109
00110 manualViewBaseContour * manualViewBaseContour :: Clone( )
00111 {
00112 manualViewBaseContour * clone = new manualViewBaseContour();
00113 CopyAttributesTo(clone);
00114 return clone;
00115
00116 }
00117
00118
00119
00120 void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObject)
00121 {
00122
00123
00124
00125 cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
00126 cloneObject-> SetSelected( this->GetSelected() );
00127 cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
00128 cloneObject-> SetIfViewControlPoints( this->GetIfViewControlPoints() );
00129 cloneObject-> SetRange( this->GetRange() );
00130 cloneObject-> SetZ( this->GetZ() );
00131 cloneObject-> SetSpacing( _spc );
00132 cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
00133 cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
00134 cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
00135
00136 int i, size = _lstViewPoints.size();
00137 for ( i=0; i<size; i++ )
00138 {
00139 cloneObject->AddPoint( );
00140 }
00141 }
00142
00143
00144 void manualViewBaseContour :: AddSplineActor()
00145 {
00146 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
00147 if (_contourVtkActor!=NULL)
00148 theRenderer->AddActor( _contourVtkActor );
00149 }
00150
00151 void manualViewBaseContour :: RemoveSplineActor()
00152 {
00153 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
00154 if (_contourVtkActor!=NULL)
00155 theRenderer->RemoveActor( _contourVtkActor );
00156 }
00157
00158 void manualViewBaseContour :: RemoveControlPoints()
00159 {
00160 if (_wxvtkbaseview!=NULL){
00161 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
00162 int i,size=_lstViewPoints.size();
00163 for (i=0;i<size; i++)
00164 {
00165 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
00166 theRenderer->RemoveActor( pointActor );
00167 }
00168 }
00169 SetIfViewControlPoints( false );
00170 }
00171
00172 void manualViewBaseContour::AddControlPoints()
00173 {
00174 vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
00175 SetIfViewControlPoints( true );
00176 if( _viewControlPoints )
00177 {
00178 int i,size=_lstViewPoints.size();
00179 for (i=0;i<size; i++)
00180 {
00181 vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
00182 theRenderer->AddActor( pointActor );
00183 }
00184 }
00185 }
00186
00187 void manualViewBaseContour::AddTextActor()
00188 {
00189 _wxvtkbaseview->GetRenderer()->AddActor2D( _textActor );
00190 }
00191
00192 void manualViewBaseContour::RemoveTextActor()
00193 {
00194 _wxvtkbaseview->GetRenderer()->RemoveActor2D( _textActor );
00195 }
00196
00197 void manualViewBaseContour::DeleteVtkObjects()
00198 {
00199 if ( _contourVtkActor != NULL ) { _contourVtkActor -> Delete(); }
00200 if ( _bboxMapper != NULL ) { _bboxMapper -> Delete(); }
00201 if ( _pts != NULL ) { _pts -> Delete(); }
00202 if ( _pd != NULL ) { _pd -> Delete(); }
00203 _contourVtkActor = NULL;
00204 _bboxMapper = NULL;
00205 _pts = NULL;
00206 _pd = NULL;
00207 }
00208
00209
00210
00211 void manualViewBaseContour::SetWidthLine(double width)
00212 {
00213 _widthline = width;
00214 this->UpdateColorActor();
00215
00216
00217 int id, size = _lstViewPoints.size();
00218 for( id=0; id<size; id++)
00219 {
00220 this->_lstViewPoints[id]->SetWidthLine(_widthline);
00221 }
00222
00223 }
00224
00225
00226 double manualViewBaseContour::GetWidthLine()
00227 {
00228 return _widthline;
00229 }
00230
00231
00232 void manualViewBaseContour::ConstructVTKObjects()
00233 {
00234
00235
00236
00237
00238 int i;
00239 int nps = _manContModel->GetNumberOfPointsSpline();
00240
00241
00242 DeleteVtkObjects();
00243 _pts = vtkPoints::New();
00244 _pts->SetNumberOfPoints(nps);
00245 for (i=0 ; i<nps ; i++){
00246 _pts->SetPoint(i, 0 , 0 , 0 );
00247 }
00248
00249
00250
00251
00252
00253 _pts->SetPoint(0, -1000 , -1000 , -1000 );
00254 _pts->SetPoint(1, 1000 , 1000 , 1000 );
00255
00256 vtkCellArray *lines = vtkCellArray::New();
00257 lines->InsertNextCell( nps );
00258 for ( i=0 ; i<nps+1 ; i++ ){
00259 lines->InsertCellPoint(i % nps );
00260 }
00261 _pd = vtkPolyData::New();
00262 _pd->SetPoints( _pts );
00263 _pd->SetLines( lines );
00264 lines->Delete();
00265
00266 _contourVtkActor = vtkActor::New();
00267 _bboxMapper = vtkPolyDataMapper::New();
00268 _bboxMapper->ScalarVisibilityOff( );
00269
00270
00271 _bboxMapper->SetInput(_pd);
00272 _bboxMapper->ImmediateModeRenderingOn();
00273 _contourVtkActor->SetMapper(_bboxMapper);
00274 _contourVtkActor->GetProperty()->BackfaceCullingOff();
00275
00276
00277 UpdateColorActor();
00278
00279 _pd->ComputeBounds();
00280
00281 InitTextActor();
00282
00283
00284 }
00285
00286 void manualViewBaseContour::InitTextActor()
00287 {
00288
00289 _textActor = vtkTextActor::New();
00290
00291 _textActor->SetInput("00");
00292
00293
00294
00295 _textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld ();
00296
00297
00298 vtkTextProperty *tprop = _textActor->GetTextProperty();
00299 tprop->SetFontSize(14);
00300 tprop->SetFontFamilyToArial();
00301 tprop->SetColor(0, 0, 1);
00302 }
00303
00304
00305 void manualViewBaseContour::CreateNewContour()
00306 {
00307 ConstructVTKObjects();
00308
00309
00310
00311 AddCompleteContourActor();
00312 }
00313
00314 void manualViewBaseContour::UpdateViewPoint(int id)
00315 {
00316 manualPoint *mp = _manContModel->GetManualPoint(id);
00317
00318
00319 double XX=mp->GetX(),YY=mp->GetY(),ZZ=mp->GetZ();
00320
00321
00322
00323 _lstViewPoints[id]->SetPositionXY( XX , YY ,_range, ZZ );
00324 }
00325
00326
00327 void manualViewBaseContour::UpdateViewPoints()
00328 {
00329 int id, size = _lstViewPoints.size();
00330 for( id=0; id<size; id++)
00331 {
00332 UpdateViewPoint( id );
00333 }
00334 }
00335
00336
00337 void manualViewBaseContour::AddPoint()
00338 {
00339 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
00340 AddPoint( mvp );
00341 }
00342
00343 void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
00344 {
00345 _lstViewPoints.push_back( manualViewPoint );
00346
00347
00348 manualViewPoint->SetSpacing(_spc);
00349
00350 vtkActor *actor = manualViewPoint->CreateVtkPointActor();
00351 _wxvtkbaseview->GetRenderer()->AddActor( actor );
00352 }
00353
00354
00355 void manualViewBaseContour::InsertPoint(int id)
00356 {
00357 manualViewPoint *mvp = new manualViewPoint( this->GetWxVtkBaseView() );
00358
00359
00360 mvp->SetSpacing(_spc);
00361
00362 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
00363 _lstViewPoints.insert(itNum,mvp);
00364 _wxvtkbaseview->GetRenderer()->AddActor( mvp->CreateVtkPointActor() );
00365 }
00366
00367 void manualViewBaseContour::DeleteContour()
00368 {
00369 RemoveCompleteContourActor();
00370
00371
00372
00373 DeleteVtkObjects();
00374 int i,size=_lstViewPoints.size();
00375 for (i=0;i<size;i++){
00376 manualViewBaseContour::DeletePoint(0);
00377 }
00378 Refresh();
00379 }
00380
00381 void manualViewBaseContour::DeletePoint(int id)
00382 {
00383 int size=_lstViewPoints.size();
00384 if ( (id>=0) && (id<size) ){
00385 manualViewPoint *mvp =_lstViewPoints[id];
00386
00387
00388 _wxvtkbaseview->GetRenderer()->RemoveActor( mvp->GetVtkActor() );
00389 std::vector<manualViewPoint*>::iterator itNum = _lstViewPoints.begin() + id;
00390 _lstViewPoints.erase(itNum);
00391 delete mvp;
00392 Refresh();
00393 }
00394 }
00395
00396 void manualViewBaseContour::DeletePoint(int x, int y, int z)
00397 {
00398 int id=GetIdPoint(x,y,z);
00399 if (id!=-1){
00400 DeletePoint(id);
00401 }
00402 }
00403
00404 void manualViewBaseContour::SetSelected(bool selected)
00405 {
00406 _selected=selected;
00407 }
00408
00409 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
00410 {
00411 _posibleSelected=posibleSelected;
00412 }
00413
00414 bool manualViewBaseContour::GetEditable()
00415 {
00416 return *_editable;
00417 }
00418
00419 void manualViewBaseContour::SetEditable( bool * condition )
00420 {
00421 _editable = condition;
00422 }
00423
00424 bool manualViewBaseContour::GetSelected()
00425 {
00426 return _selected;
00427 }
00428
00429 bool manualViewBaseContour::GetPosibleSelected()
00430 {
00431 return _posibleSelected;
00432 }
00433
00434 void manualViewBaseContour::DeleteSelectedPoints()
00435 {
00436 int i,size=_lstViewPoints.size();
00437 for (i=size-1;i>=0;i--){
00438 if (_lstViewPoints[i]->GetSelected()==true){
00439 DeletePoint(i);
00440 }
00441 }
00442 Refresh();
00443 }
00444
00445 void manualViewBaseContour::SelectPoint(int i, bool select)
00446 {
00447 _lstViewPoints[i]->SetSelected(select);
00448 }
00449
00450 void manualViewBaseContour::SelectLstPoints()
00451 {
00452
00453 }
00454
00455 void manualViewBaseContour::SelectAllPoints(bool select)
00456 {
00457 int i,size=_lstViewPoints.size();
00458 for (i=0;i<size;i++){
00459 SelectPoint(i,select);
00460 }
00461 }
00462
00463 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
00464 {
00465 _viewControlPoints = ifShow;
00466 }
00467
00468 bool manualViewBaseContour:: GetIfViewControlPoints()
00469 {
00470 return _viewControlPoints;
00471 }
00472
00473
00474 void manualViewBaseContour::SetPointPosibleSelected(int id,bool select)
00475 {
00476 _lstViewPoints[id]->SetPosibleSelected(select);
00477 }
00478
00479 void manualViewBaseContour::SetPointSelected(int id,bool select)
00480 {
00481 _lstViewPoints[id]->SetSelected(select);
00482 }
00483
00484 void manualViewBaseContour::SelectAllPossibleSelected(bool select)
00485 {
00486 int i,size=_lstViewPoints.size();
00487 for (i=0;i<size;i++){
00488 SetPointPosibleSelected(i,select);
00489 }
00490 }
00491
00492 int manualViewBaseContour::SelectPosiblePoint(int x, int y, int z)
00493 {
00494 SelectAllPossibleSelected(false);
00495
00496 int id = GetIdPoint(x,y,z);
00497 if (id!=-1)
00498 {
00499 SetPointPosibleSelected(id,true);
00500 }
00501 return id;
00502 }
00503
00504 bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
00505 {
00506 bool result=false;
00507 SetPosibleSelected(result);
00508 int id = GetIdPoint(x,y,z);
00509
00510 if( !GetEditable() && !_selected && id!= -1)
00511 {
00512 result=true;
00513 _posibleSelected=true;
00514 }
00515 else
00516 {
00517 if ( (GetEditable()==true) && (id==-1 ) && (this->_lstViewPoints.size()>=2) )
00518 {
00519 if (ifTouchContour(x,y,z)==true)
00520 {
00521 result=true;
00522 SetPosibleSelected(result);
00523 }
00524 }
00525
00526 if (GetEditable()==false)
00527 {
00528 if (ifTouchContour(x,y,z)==true)
00529 {
00530 result=true;
00531 SetPosibleSelected(result);
00532 }
00533 }
00534
00535 }
00536 return result;
00537 }
00538
00539 bool manualViewBaseContour::ifTouchContour(int x,int y, int z)
00540 {
00541 return false;
00542 }
00543
00544 void manualViewBaseContour::UnSelectPoint(int i){
00545 _lstViewPoints[i]->SetSelected(false);
00546 Refresh();
00547 }
00548
00549 void manualViewBaseContour::UnSelectLstPoints(){
00550
00551 }
00552
00553 void manualViewBaseContour::UnSelectAllPoints(){
00554 int i,size=_lstViewPoints.size();
00555 for (i=0;i<size;i++){
00556 UnSelectPoint(i);
00557 }
00558 Refresh();
00559 }
00560
00561 void manualViewBaseContour::SetModel(manualBaseModel *manContModel){
00562 _manContModel=manContModel;
00563 }
00564
00565 void manualViewBaseContour::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview){
00566 _wxvtkbaseview = wxvtkbaseview;
00567 }
00568
00569 void manualViewBaseContour::RefreshContour()
00570 {
00571 }
00572
00573 double* manualViewBaseContour::GetVectorPointsXManualContour(){
00574 double pp[3];
00575 int i,size = _sizePointsContour;
00576 double *vx = (double*)malloc(sizeof(double)*size);
00577 for (i=0;i<size;i++){
00578 _pts->GetPoint(i,pp);
00579 vx[i]=pp[0];
00580 }
00581 return vx;
00582 }
00583
00584 double* manualViewBaseContour::GetVectorPointsYManualContour()
00585 {
00586 double pp[3];
00587 int i,size = _sizePointsContour;
00588 double *vy = (double*)malloc(sizeof(double)*size);
00589 for (i=0;i<size;i++){
00590 _pts->GetPoint(i,pp);
00591 vy[i]=pp[1];
00592 }
00593 return vy;
00594 }
00595
00596 double* manualViewBaseContour::GetVectorPointsZManualContour()
00597 {
00598 double pp[3];
00599 int i,size = _sizePointsContour;
00600 double *vz = (double*)malloc(sizeof(double)*size);
00601 for (i=0;i<size;i++){
00602 _pts->GetPoint(i,pp);
00603 vz[i]=pp[2];
00604 }
00605 return vz;
00606 }
00607
00608 void manualViewBaseContour::Refresh()
00609 {
00610 if (_contourVtkActor!=NULL){
00611 RefreshContour();
00612 }
00613 int i,size=_lstViewPoints.size();
00614 for (i=0;i<size;i++){
00615 UpdateViewPoint(i);
00616 _lstViewPoints[i]->UpdateColorActor();
00617 }
00618 UpdateColorActor();
00619
00620 if (_show_text==true)
00621 {
00622 RefreshText();
00623 }
00624
00625 vtkRenderWindowInteractor *vri = _wxvtkbaseview->GetWxVTKRenderWindowInteractor ();
00626 if (vri==NULL)
00627 {
00628 _wxvtkbaseview->GetRenWin()->Render();
00629 printf("EED %p How to optimize manualViewBaseContour::Refresh() \n",this);
00630 }
00631
00632 }
00633
00634 void manualViewBaseContour::RefreshText()
00635 {
00636 if( _textActor!=NULL)
00637 _textActor -> SetInput("00");
00638 }
00639
00640 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
00641 {
00642 _coulorNormal_r = r;
00643 _coulorNormal_g = g;
00644 _coulorNormal_b = b;
00645 }
00646
00647 void manualViewBaseContour::GetColorNormalContour(double &r, double &g, double &b)
00648 {
00649 r = _coulorNormal_r;
00650 g = _coulorNormal_g;
00651 b = _coulorNormal_b;
00652 }
00653
00654 void manualViewBaseContour::SetColorEditContour(double r, double g, double b)
00655 {
00656 _coulorEdit_r = r;
00657 _coulorEdit_g = g;
00658 _coulorEdit_b = b;
00659 }
00660
00661 void manualViewBaseContour::GetColorEditContour(double &r, double &g, double &b)
00662 {
00663 r = _coulorEdit_r;
00664 g = _coulorEdit_g;
00665 b = _coulorEdit_b;
00666 }
00667
00668 void manualViewBaseContour::SetColorSelectContour(double r, double g, double b)
00669 {
00670 _coulorSelection_r = r;
00671 _coulorSelection_g = g;
00672 _coulorSelection_b = b;
00673 }
00674
00675 void manualViewBaseContour::GetColorSelectContour(double &r, double &g, double &b)
00676 {
00677 r = _coulorSelection_r;
00678 g = _coulorSelection_g;
00679 b = _coulorSelection_b;
00680 }
00681
00682 void manualViewBaseContour::UpdateColorActor()
00683 {
00684 if (_contourVtkActor!=NULL)
00685 {
00686 _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
00687 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
00688 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
00689 {
00690 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
00691 }
00692 if( _selected )
00693 {
00694 _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
00695 }
00696 }
00697 }
00698
00699 int manualViewBaseContour::GetIdPoint(int x, int y, int z)
00700 {
00701 int ii = -1;
00702 if (_manContModel!=NULL){
00703 double xx = x;
00704 double yy = y;
00705 double zz = z;
00706 TransfromCoordViewWorld(xx,yy,zz);
00707 ii=_manContModel->GetIdPoint(xx,yy,zz,_range,-1);
00708 }
00709 return ii;
00710 }
00711
00712
00713
00714
00715 int manualViewBaseContour::GetNumberOfPoints()
00716 {
00717 return _lstViewPoints.size();
00718 }
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736 void manualViewBaseContour::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type)
00737 {
00738 _wxvtkbaseview->TransFromCoordScreenToWorld(X, Y, Z,false, type);
00739
00740
00741
00742
00743
00744
00745
00746 }
00747
00748 void manualViewBaseContour::SetRange(double range)
00749 {
00750 _range=range;
00751 }
00752
00753 double manualViewBaseContour::GetRange()
00754 {
00755 return _range;
00756 }
00757
00758 void manualViewBaseContour::SetZ(int z)
00759 {
00760
00761 }
00762
00763 int manualViewBaseContour::GetZ()
00764 {
00765
00766 return 0;
00767 }
00768
00769 void manualViewBaseContour::InitMove(int x, int y, int z)
00770 {
00771
00772 }
00773
00774 void manualViewBaseContour::MoveContour(int x, int y, int z)
00775 {
00776 }
00777
00778 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )
00779 {
00780
00781 }
00782
00783 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )
00784 {
00785 double pp[3];
00786 manualPoint *mp;
00787 int i;
00788 int size=_manContModel->GetSizeLstPoints();
00789 minX=99999;
00790 minY=99999;
00791 maxX=-99999;
00792 maxY=-99999;
00793 bool ifFindZ = minZ!=-1.0 && maxZ!=-1.0;
00794 if ( ifFindZ )
00795 {
00796 minZ=99999;
00797 maxZ=-99999;
00798 }
00799 for( i = 0; i < size; i++ )
00800 {
00801 mp=_manContModel->GetManualPoint(i);
00802 pp[0]=mp->GetX();
00803 pp[1]=mp->GetY();
00804 if ( ifFindZ )
00805 pp[2]=mp->GetZ();
00806
00807
00808 if (pp[0]<minX)
00809 {
00810 minX=pp[0];
00811 }
00812
00813 if (pp[1]<minY)
00814 {
00815 minY=pp[1];
00816 }
00817
00818 if (pp[0]>maxX)
00819 {
00820 maxX=pp[0];
00821 }
00822
00823 if (pp[1]>maxY)
00824 {
00825 maxY=pp[1];
00826 }
00827 if ( ifFindZ )
00828 {
00829
00830 if (pp[2]<minZ)
00831 {
00832 minZ=pp[2];
00833 }
00834
00835 if (pp[2]>maxZ)
00836 {
00837 maxZ=pp[2];
00838 }
00839 }
00840 }
00841 if ( size<1 )
00842 {
00843 minX = 0;
00844 maxX = 0;
00845
00846 minY = 0;
00847 maxY = 0;
00848
00849 minZ = 0;
00850 maxZ = 0;
00851 }
00852 }
00853
00854 void manualViewBaseContour::ClearContour()
00855 {
00856 if (_contourVtkActor!=NULL){
00857 _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
00858 }
00859 DeleteVtkObjects();
00860 int i,size=_lstViewPoints.size();
00861 for (i=0;i<size;i++){
00862 ClearPoint(0);
00863 }
00864 Refresh();
00865 }
00866
00867 void manualViewBaseContour::ClearPoint(int id)
00868 {
00869 DeletePoint(id);
00870 }
00871
00872 void manualViewBaseContour::SetVisible(bool ok)
00873 {
00874 double opacity;
00875 if (ok==true)
00876 {
00877 opacity=1;
00878 } else {
00879 opacity=0.5;
00880 }
00881 vtkActor *actor;
00882 int i,size=_lstViewPoints.size();
00883 for (i=0;i<size;i++){
00884 actor = _lstViewPoints[i]->GetVtkActor();
00885 actor->GetProperty()->SetOpacity( opacity );
00886 }
00887 _contourVtkActor->GetProperty()->SetOpacity( opacity );
00888 _textActor->GetProperty()->SetOpacity( opacity );
00889 _textActor->SetInput("00");
00890
00891 }
00892
00893 void manualViewBaseContour::SetShowText(bool ok)
00894 {
00895 _show_text = ok;
00896 if (_show_text==false)
00897 {
00898 _textActor->SetInput("00");
00899 }
00900 }
00901
00902 wxVtkBaseView *manualViewBaseContour::GetWxVtkBaseView()
00903 {
00904 return this->_wxvtkbaseview;
00905 }
00906
00907 void manualViewBaseContour::GetSpacing(double spc[3])
00908 {
00909 spc[0] = _spc[0];
00910 spc[1] = _spc[1];
00911 spc[2] = _spc[2];
00912 }
00913
00914 void manualViewBaseContour::SetSpacing(double spc[3])
00915 {
00916 _spc[0] = spc[0];
00917 _spc[1] = spc[1];
00918 _spc[2] = spc[2];
00919 }