X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkClosePolyData.cxx;h=06e631622e47d38cd0d7b43053dc2f6bc02acc16;hb=659bcd2c2a608cfb8c5854ffe84e9248871df9a1;hp=4b0aef797825d3695f89eb07c8d3e1b0885c1ae9;hpb=e4ef2b5df5aac431ff3b806f83b7dd5e55e89d86;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx index 4b0aef7..06e6316 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx @@ -42,7 +42,6 @@ =========================================================================*/ #include "vtkClosePolyData.h" -#include "vtkObjectFactory.h" #include "vtkPolyData.h" #include "vtkFeatureEdges.h" #include "vtkStripper.h" @@ -51,7 +50,17 @@ #include "vtkAppendPolyData.h" #include "vtkCleanPolyData.h" -vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.3 $"); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.3 $"); +#else + #include "vtkDataObject.h" + #include "vtkInformation.h" + #include "vtkDemandDrivenPipeline.h" + #include "vtkInformationVector.h" +#endif + vtkStandardNewMacro(vtkClosePolyData); //---------------------------------------------------------------------------- @@ -64,54 +73,117 @@ vtkClosePolyData::~vtkClosePolyData() { } + //---------------------------------------------------------------------------- -// This method is much too long, and has to be broken up! -// Furthermore we are loosing the normals !!! -void vtkClosePolyData::Execute() + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // This method is much too long, and has to be broken up! + // Furthermore we are loosing the normals !!! + void vtkClosePolyData::Execute() + { + vtkPolyData *input = this->GetInput(); + vtkPolyData *output = this->GetOutput(); + + //#closing the polydata see : close.py for details + vtkFeatureEdges *boundary = vtkFeatureEdges::New(); + boundary->SetInput( input ); + boundary->BoundaryEdgesOn (); + boundary->FeatureEdgesOff (); + boundary->NonManifoldEdgesOff (); + boundary->ManifoldEdgesOff (); + //boundary->ColoringOff (); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( boundary->GetOutput() ); + stripper->Update(); //important + boundary->Delete(); + + vtkPolyData *pd = vtkPolyData::New(); + pd->SetPoints ( stripper->GetOutput()->GetPoints() ); + pd->SetPolys ( stripper->GetOutput()->GetLines() ); + stripper->Delete(); + + //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInput( pd ); + pd->Delete(); + + vtkAppendPolyData *append = vtkAppendPolyData::New(); + append->AddInput( input ); + append->AddInput( triangle->GetOutput()); + triangle->Delete(); + vtkInformation + vtkCleanPolyData *clean = vtkCleanPolyData::New(); + clean->SetInput( append->GetOutput()); + append->Delete(); + + // When all optimizations are complete, this squeeze will be unecessary. + // (But it does not seem to cost much.) + clean->Update(); //important before ShallowCopy + output->ShallowCopy( clean->GetOutput() ); + clean->Delete(); + } + +#else + +int vtkClosePolyData::RequestData( vtkInformation *vtkNotUsed(request), vtkInformationVector **inputVector, vtkInformationVector *outputVector) { - vtkPolyData *input = this->GetInput(); - vtkPolyData *output = this->GetOutput(); - - //#closing the polydata see : close.py for details - vtkFeatureEdges *boundary = vtkFeatureEdges::New(); - boundary->SetInput( input ); - boundary->BoundaryEdgesOn (); - boundary->FeatureEdgesOff (); - boundary->NonManifoldEdgesOff (); - boundary->ManifoldEdgesOff (); - //boundary->ColoringOff (); - - vtkStripper *stripper = vtkStripper::New(); - stripper->SetInput( boundary->GetOutput() ); - stripper->Update(); //important - boundary->Delete(); - - vtkPolyData *pd = vtkPolyData::New(); - pd->SetPoints ( stripper->GetOutput()->GetPoints() ); - pd->SetPolys ( stripper->GetOutput()->GetLines() ); - stripper->Delete(); - - //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); - vtkTriangleFilter *triangle = vtkTriangleFilter::New(); - triangle->SetInput( pd ); - pd->Delete(); - - vtkAppendPolyData *append = vtkAppendPolyData::New(); - append->AddInput( input ); - append->AddInput( triangle->GetOutput()); - triangle->Delete(); - - vtkCleanPolyData *clean = vtkCleanPolyData::New(); - clean->SetInput( append->GetOutput()); - append->Delete(); - - // When all optimizations are complete, this squeeze will be unecessary. - // (But it does not seem to cost much.) - clean->Update(); //important before ShallowCopy - output->ShallowCopy( clean->GetOutput() ); - clean->Delete(); + // get the info objects + vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + // get the input and output + vtkPolyData *input = vtkPolyData::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkPolyData *output = vtkPolyData::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT())); + //#closing the polydata see : close.py for details + + vtkFeatureEdges *boundary = vtkFeatureEdges::New(); + boundary->SetInputData( input ); + boundary->BoundaryEdgesOn (); + boundary->FeatureEdgesOff (); + boundary->NonManifoldEdgesOff (); + boundary->ManifoldEdgesOff (); + // boundary->ColoringOff (); + boundary->Update(); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInputConnection( boundary->GetOutputPort() ); + stripper->Update(); //important + + vtkPolyData *pd = vtkPolyData::New(); + pd->SetPoints ( stripper->GetOutput()->GetPoints() ); + pd->SetPolys ( stripper->GetOutput()->GetLines() ); + //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); + + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInputData( pd ); + triangle->Update( ); + + vtkAppendPolyData *append = vtkAppendPolyData::New(); + append->AddInputData( input ); + append->AddInputConnection( triangle->GetOutputPort() ); + append->Update(); + + vtkCleanPolyData *clean = vtkCleanPolyData::New(); + clean->SetInputConnection( append->GetOutputPort()); + // When all optimizations are complete, this squeeze will be unecessary. + // (But it does not seem to cost much.) + clean->Update(); //important before ShallowCopy + + output->ShallowCopy( clean->GetOutput() ); + + append -> Delete(); + clean -> Delete(); + boundary -> Delete(); + stripper -> Delete(); + pd -> Delete(); + triangle -> Delete(); + + return 1; } +#endif + //---------------------------------------------------------------------------- void vtkClosePolyData::PrintSelf(ostream& os, vtkIndent indent) {