X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkMeshCutByAxis.cxx;h=7af703c93e6c65824714e9aa40c458ab01f7046a;hb=6b5dabc10fd9780f19f7ce0ee287a9f8d9a09267;hp=111efb526a8a5b24e53b26dea94f5363cc59ee82;hpb=d4d007ec0086a1145c20e922e87e0fee1b2f12d8;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx index 111efb5..7af703c 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshCutByAxis.cxx @@ -7,7 +7,7 @@ #include #include #include - +#include namespace bbcreaVtk { @@ -39,9 +39,18 @@ void MeshCutByAxis::Process() vtkPlane *clipPlane = vtkPlane::New(); vtkBox *clipBox = vtkBox::New(); vtkClipPolyData *clipper = vtkClipPolyData::New(); +// clipper->GenerateClipScalarsOn(); +// clipper->GenerateClippedOutputOff(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 clipper -> SetInput( bbGetInputIn() ); +#else +// vtkPolyDataNormals *nn = vtkPolyDataNormals::New(); +// nn->SetInputData( bbGetInputIn() ); +// clipper -> SetInputData( nn->GetOutput() ); + clipper -> SetInputData( bbGetInputIn() ); +#endif clipper->SetInsideOut( bbGetInputInsideVol() ); - int a; // correction border if (bbGetInputInsideVol()==false) { @@ -49,15 +58,12 @@ void MeshCutByAxis::Process() } else { a=0; } - int px=bbGetInputPoint()[0]; int py=bbGetInputPoint()[1]; int pz=bbGetInputPoint()[2]; - if ( bbGetInputType()=="x" ) { clipPlane->SetNormal(1, 0, 0); ok=1; } else if ( bbGetInputType()=="y" ) { clipPlane->SetNormal(0, 1, 0); ok=1; } else if ( bbGetInputType()=="z" ) { clipPlane->SetNormal(0, 0, 1); ok=1; } else - if ( bbGetInputType()=="x+y+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x-y+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x+y-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz-sb ,pz+sb ); ok=2; } else @@ -73,7 +79,6 @@ void MeshCutByAxis::Process() if ( bbGetInputType()=="x+z-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="x-z-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else - if ( bbGetInputType()=="x+y+z+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x-y+z+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x+y-z+" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else @@ -85,11 +90,14 @@ void MeshCutByAxis::Process() if (ok==1) { clipPlane -> SetOrigin(px,py,pz); + clipPlane -> Modified(); clipper -> SetClipFunction(clipPlane); + clipper -> Update(); bbSetOutputOut( clipper->GetOutput() ); - } else if (ok==2) { - - clipper -> SetClipFunction(clipBox); + } else if (ok==2) { + clipBox -> Modified(); + clipper -> SetClipFunction(clipBox); + clipper -> Update(); bbSetOutputOut( clipper->GetOutput() ); } else { bbSetOutputOut( bbGetInputIn() );