From: ouv Date: Thu, 1 Nov 2012 09:45:59 +0000 (+0000) Subject: Issue 0001171: External Task 3.4: Visualisation of THREED by cylinder X-Git-Tag: CTH_1_8_0~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e848436d4d54451cea9793266cb37f140a434d10;p=modules%2Fgui.git Issue 0001171: External Task 3.4: Visualisation of THREED by cylinder Porting to VTK-5.8.0 supporting polyhedron cells. --- diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx index 8751cd5eb..38a9222da 100755 --- a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx @@ -76,6 +76,8 @@ int VTKViewer_ShrinkFilter::RequestData( vtkIdType tenth; vtkFloatingPointType decimal; + vtkIdType* pointMap = new vtkIdType[input->GetNumberOfPoints()]; + vtkDebugMacro(<<"Shrinking cells"); numCells=input->GetNumberOfCells(); @@ -150,9 +152,25 @@ int VTKViewer_ShrinkFilter::RequestData( newId = newPts->InsertNextPoint(pt); if(myStoreMapping) myVTK2ObjIds.push_back(oldId); - newPtIds->InsertId(i,newId); outPD->CopyData(pd, oldId, newId); + + pointMap[oldId] = newId; + } + + // special handling for polyhedron cells + if (vtkUnstructuredGrid::SafeDownCast(input) && + input->GetCellType(cellId) == VTK_POLYHEDRON) + { + vtkUnstructuredGrid::SafeDownCast(input)->GetFaceStream(cellId, newPtIds); + vtkUnstructuredGrid::ConvertFaceStreamPointIds(newPtIds, pointMap); + } + else + { + for(vtkIdType i=0; i < numIds; ++i) + { + newPtIds->InsertId(i, pointMap[ptIds->GetId(i)]); + } } output->InsertNextCell(input->GetCellType(cellId), newPtIds); }//for all cells @@ -167,6 +185,8 @@ int VTKViewer_ShrinkFilter::RequestData( ptIds->Delete(); newPtIds->Delete(); newPts->Delete(); + + delete [] pointMap; return 1; }