X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FmanualContour%2FmanualViewBaseContour.cpp;h=91f1c1bb14a24c7f80c6167217f5a82daa53a6a8;hb=c7ed224abb3d3ea251339303f03e8c170d562115;hp=1e765740c51f3cc035f42b6b24d34d0fb312e66b;hpb=e6ad041870eb71089ffa29ff8b8c78b84a26b9b3;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp index 1e76574..91f1c1b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp @@ -113,7 +113,9 @@ void manualViewBaseContour :: AddCompleteContourActor( bool ifControlPoints ) //Adding each control point if( ifControlPoints ) + { AddControlPoints(); + } RefreshContour(); Refresh(); } @@ -275,7 +277,8 @@ void manualViewBaseContour::ConstructVTKObjects() DeleteVtkObjects(); _pts = vtkPoints::New(); _pts->SetNumberOfPoints(nps); - for (i=0 ; iSetPoint(i, 0 , 0 , 0 ); } // This is for the boundaring inicialisation @@ -286,15 +289,25 @@ void manualViewBaseContour::ConstructVTKObjects() _pts->SetPoint(0, -1000 , -1000 , -1000 ); _pts->SetPoint(1, 1000 , 1000 , 1000 ); - vtkCellArray *lines = vtkCellArray::New(); - lines->InsertNextCell( nps /* +1 */ ); - for ( i=0 ; iInsertCellPoint(i % nps ); + // This is the structure for the spline + _splineCell = vtkCellArray::New(); + _splineCell->InsertNextCell( nps /* +1 */ ); + for ( i=0 ; iInsertCellPoint(i % nps ); } + + // This is the structure for the spline justo to points (line) + // This will be use in the refresh part, in case the spline have only 2 points + _lineCell = vtkCellArray::New(); + _lineCell->InsertNextCell(2); + _lineCell->InsertCellPoint(0); + _lineCell->InsertCellPoint(1); + _pd = vtkPolyData::New(); _pd->SetPoints( _pts ); - _pd->SetLines( lines ); - lines->Delete(); //do not delete lines ?? + _pd->SetLines( _splineCell ); + // lines->Delete(); //do not delete lines ?? _contourVtkActor = vtkActor::New(); _bboxMapper = vtkPolyDataMapper::New(); @@ -312,6 +325,16 @@ void manualViewBaseContour::ConstructVTKObjects() InitTextActor(); } +void manualViewBaseContour::SetCellArray(bool type) +{ + if (type==true) + { + _pd->SetLines( _splineCell ); + } else { + _pd->SetLines( _lineCell ); + }// if type +} + // ---------------------------------------------------------------------------- void manualViewBaseContour::InitTextActor() { @@ -653,7 +676,8 @@ double* manualViewBaseContour::GetVectorPointsZManualContour() // ---------------------------------------------------------------------------- void manualViewBaseContour::Refresh() // virtual { - if (_contourVtkActor!=NULL){ + if (_contourVtkActor!=NULL) + { RefreshContour(); } int i,size=_lstViewPoints.size();