diff --git a/src/Cxx/IO/ImportPolyDataScene.cxx b/src/Cxx/IO/ImportPolyDataScene.cxx index a248583a380f40b90829fe0b4844a05aac72b800..6b24cc6fdeca8f62702f25427c2ae40028a5873c 100644 --- a/src/Cxx/IO/ImportPolyDataScene.cxx +++ b/src/Cxx/IO/ImportPolyDataScene.cxx @@ -1,39 +1,37 @@ -#include <vtkSmartPointer.h> - -#include <vtkXMLMultiBlockDataReader.h> -#include <vtkMultiBlockDataSet.h> +#include <vtkActor.h> +#include <vtkCamera.h> #include <vtkCompositeDataSet.h> #include <vtkDataObjectTreeIterator.h> - -#include <vtkPolyData.h> #include <vtkFieldData.h> - -#include <vtkActor.h> +#include <vtkMultiBlockDataSet.h> +#include <vtkNamedColors.h> +#include <vtkPolyData.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h> -#include <vtkCamera.h> - -#include <vtkNamedColors.h> +#include <vtkSmartPointer.h> +#include <vtkVersion.h> +#include <vtkXMLMultiBlockDataReader.h> #include <vtksys/SystemTools.hxx> -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 #include <vtkDataObjectTreeRange.h> #endif -namespace -{ -void ImportMultiBlockScene(vtkRenderer *renderer, std::string fileName); -void RestoreCameraFromFieldData(std::string, vtkCamera *, vtkPolyData *); -void RestorePropertyFromFieldData(std::string, vtkProperty *, vtkPolyData *); -void RestoreActorFromFieldData(std::string, vtkActor *, vtkPolyData *); -//void RestoreMapperFromFieldData(std::string, vtkPolyDataMapper *, vtkPolyData *); -//void RestoreLookupTableFromFieldData(std::string, vtkScalarsToColors *, vtkPolyData *); -} +namespace { +void ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName); +void RestoreCameraFromFieldData(std::string, vtkCamera*, vtkPolyData*); +void RestorePropertyFromFieldData(std::string, vtkProperty*, vtkPolyData*); +void RestoreActorFromFieldData(std::string, vtkActor*, vtkPolyData*); +// void RestoreMapperFromFieldData(std::string, vtkPolyDataMapper *, vtkPolyData +// *); void RestoreLookupTableFromFieldData(std::string, vtkScalarsToColors *, +// vtkPolyData *); +} // namespace -int main (int argc, char *argv[]) +int main(int argc, char* argv[]) { if (argc < 2) { @@ -42,185 +40,251 @@ int main (int argc, char *argv[]) } // Visualization - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); - vtkSmartPointer<vtkRenderer> renderer = - vtkSmartPointer<vtkRenderer>::New(); - vtkSmartPointer<vtkRenderWindow> renderWindow = - vtkSmartPointer<vtkRenderWindow>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); + auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer(renderer); - vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = - vtkSmartPointer<vtkRenderWindowInteractor>::New(); + auto renderWindowInteractor = + vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor->SetRenderWindow(renderWindow); - ImportMultiBlockScene (renderer.GetPointer(),std::string(argv[1])); + ImportMultiBlockScene(renderer.GetPointer(), std::string(argv[1])); renderWindow->Render(); renderer->SetBackground(colors->GetColor3d("Silver").GetData()); renderWindow->SetSize(640, 480); renderWindow->Render(); - renderWindowInteractor->Start(); + renderWindowInteractor->Start(); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } -namespace -{ -void ImportMultiBlockScene(vtkRenderer *renderer, std::string fileName) +namespace { +void ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName) { - vtkCamera *camera = renderer->GetActiveCamera(); + vtkCamera* camera = renderer->GetActiveCamera(); std::string prefix; prefix = vtksys::SystemTools::GetFilenameName(fileName); // Read the multiblock data - vtkSmartPointer<vtkXMLMultiBlockDataReader> reader = - vtkSmartPointer<vtkXMLMultiBlockDataReader>::New(); + auto reader = vtkSmartPointer<vtkXMLMultiBlockDataReader>::New(); + vtkSmartPointer<vtkXMLMultiBlockDataReader>::New(); reader->SetFileName(fileName.c_str()); reader->Update(); - std::cout << "Importing " << dynamic_cast<vtkMultiBlockDataSet*>(reader->GetOutput())->GetNumberOfBlocks() << " actors" << std::endl; + std::cout << "Importing " + << dynamic_cast<vtkMultiBlockDataSet*>(reader->GetOutput())->GetNumberOfBlocks() + << " actors" << std::endl; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 - vtkDataObjectTree *input = - dynamic_cast<vtkDataObjectTree*>(reader->GetOutput()); +#if VTK890 + vtkDataObjectTree* input = + dynamic_cast<vtkDataObjectTree*>(reader->GetOutput()); using Opts = vtk::DataObjectTreeOptions; - for (vtkDataObject *dso : vtk::Range(input, Opts::SkipEmptyNodes | - Opts::VisitOnlyLeaves)) + for (vtkDataObject* dso : + vtk::Range(input, Opts::SkipEmptyNodes | Opts::VisitOnlyLeaves)) { - vtkPolyData *pd = dynamic_cast<vtkPolyData*>(dso); - RestoreCameraFromFieldData("Camera", - camera, - pd); - vtkSmartPointer<vtkPolyDataMapper> mapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso); + RestoreCameraFromFieldData("Camera", camera, pd); + auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputData(pd); - vtkSmartPointer<vtkActor> actor = - vtkSmartPointer<vtkActor>::New(); + auto actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); - RestorePropertyFromFieldData("Property", - actor->GetProperty(), - pd); - vtkSmartPointer<vtkProperty> backProperty = - vtkSmartPointer<vtkProperty>::New(); + RestorePropertyFromFieldData("Property", actor->GetProperty(), pd); + auto backProperty = vtkSmartPointer<vtkProperty>::New(); actor->SetBackfaceProperty(backProperty); RestorePropertyFromFieldData("BackfaceProperty", - actor->GetBackfaceProperty(), - pd); - RestoreActorFromFieldData("Actor", - actor, - pd); + actor->GetBackfaceProperty(), pd); + RestoreActorFromFieldData("Actor", actor, pd); renderer->AddActor(actor); } #else - vtkCompositeDataSet *input = - dynamic_cast<vtkCompositeDataSet*>(reader->GetOutput()); + vtkCompositeDataSet* input = + dynamic_cast<vtkCompositeDataSet*>(reader->GetOutput()); - vtkSmartPointer<vtkDataObjectTreeIterator> iter = - vtkSmartPointer<vtkDataObjectTreeIterator>::New(); + auto iter = vtkSmartPointer<vtkDataObjectTreeIterator>::New(); iter->SetDataSet(input); iter->SkipEmptyNodesOn(); iter->VisitOnlyLeavesOn(); for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) { - vtkDataObject *dso = iter->GetCurrentDataObject(); - vtkPolyData *pd = dynamic_cast<vtkPolyData*>(dso); - RestoreCameraFromFieldData("Camera", - camera, - pd); - vtkSmartPointer<vtkPolyDataMapper> mapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + vtkDataObject* dso = iter->GetCurrentDataObject(); + vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso); + RestoreCameraFromFieldData("Camera", camera, pd); + auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputData(pd); - vtkSmartPointer<vtkActor> actor = - vtkSmartPointer<vtkActor>::New(); + auto actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); - RestorePropertyFromFieldData("Property", - actor->GetProperty(), - pd); - vtkSmartPointer<vtkProperty> backProperty = - vtkSmartPointer<vtkProperty>::New(); + RestorePropertyFromFieldData("Property", actor->GetProperty(), pd); + auto backProperty = vtkSmartPointer<vtkProperty>::New(); actor->SetBackfaceProperty(backProperty); RestorePropertyFromFieldData("BackfaceProperty", - actor->GetBackfaceProperty(), - pd); - RestoreActorFromFieldData("Actor", - actor, - pd); + actor->GetBackfaceProperty(), pd); + RestoreActorFromFieldData("Actor", actor, pd); renderer->AddActor(actor); } #endif } -void RestoreCameraFromFieldData(std::string arrayPrefix, - vtkCamera *camera, - vtkPolyData *pd) +void RestoreCameraFromFieldData(std::string arrayPrefix, vtkCamera* camera, + vtkPolyData* pd) { - vtkFieldData *fd = pd->GetFieldData(); - camera->SetFocalPoint(fd->GetArray(std::string(arrayPrefix + ":" + "FocalPoint").c_str())->GetTuple(0)); - camera->SetPosition(fd->GetArray(std::string(arrayPrefix + ":" + "Position").c_str())->GetTuple(0)); - camera->SetViewUp(fd->GetArray(std::string(arrayPrefix + ":" + "ViewUp").c_str())->GetTuple(0)); - camera->SetClippingRange(fd->GetArray(std::string(arrayPrefix + ":" + "ClippingRange").c_str())->GetTuple(0)); - camera->SetViewAngle(fd->GetArray(std::string(arrayPrefix + ":" + "ViewAngle").c_str())->GetTuple1(0)); + vtkFieldData* fd = pd->GetFieldData(); + camera->SetFocalPoint( + fd->GetArray(std::string(arrayPrefix + ":" + "FocalPoint").c_str()) + ->GetTuple(0)); + camera->SetPosition( + fd->GetArray(std::string(arrayPrefix + ":" + "Position").c_str()) + ->GetTuple(0)); + camera->SetViewUp( + fd->GetArray(std::string(arrayPrefix + ":" + "ViewUp").c_str()) + ->GetTuple(0)); + camera->SetClippingRange( + fd->GetArray(std::string(arrayPrefix + ":" + "ClippingRange").c_str()) + ->GetTuple(0)); + camera->SetViewAngle( + fd->GetArray(std::string(arrayPrefix + ":" + "ViewAngle").c_str()) + ->GetTuple1(0)); } void RestorePropertyFromFieldData(std::string arrayPrefix, - vtkProperty *property, - vtkPolyData *pd) + vtkProperty* property, vtkPolyData* pd) { if (property) { - vtkFieldData *fd = pd->GetFieldData(); - - property->SetAmbient(fd->GetArray(std::string(arrayPrefix + ":" + "Ambient").c_str())->GetTuple1(0)); - property->SetAmbientColor(fd->GetArray(std::string(arrayPrefix + ":" + "AmbientColor").c_str())->GetTuple(0)); - property->SetAmbientColor(fd->GetArray(std::string(arrayPrefix + ":" + "AmbientColor").c_str())->GetTuple(0)); - property->SetDiffuse(fd->GetArray(std::string(arrayPrefix + ":" + "Diffuse").c_str())->GetTuple1(0)); - property->SetDiffuseColor(fd->GetArray(std::string(arrayPrefix + ":" + "DiffuseColor").c_str())->GetTuple(0)); - property->SetSpecular(fd->GetArray(std::string(arrayPrefix + ":" + "Specular").c_str())->GetTuple1(0)); - property->SetSpecularColor(fd->GetArray(std::string(arrayPrefix + ":" + "SpecularColor").c_str())->GetTuple(0)); - property->SetSpecularPower(fd->GetArray(std::string(arrayPrefix + ":" + "SpecularPower").c_str())->GetTuple1(0)); - property->SetEdgeColor(fd->GetArray(std::string(arrayPrefix + ":" + "EdgeColor").c_str())->GetTuple(0)); - property->SetEdgeVisibility(fd->GetArray(std::string(arrayPrefix + ":" + "EdgeVisibility").c_str())->GetTuple1(0)); - property->SetVertexColor(fd->GetArray(std::string(arrayPrefix + ":" + "VertexColor").c_str())->GetTuple(0)); - property->SetVertexVisibility(fd->GetArray(std::string(arrayPrefix + ":" + "VertexVisibility").c_str())->GetTuple1(0)); - property->SetInterpolation(fd->GetArray(std::string(arrayPrefix + ":" + "Interpolation").c_str())->GetTuple1(0)); - property->SetOpacity(fd->GetArray(std::string(arrayPrefix + ":" + "Opacity").c_str())->GetTuple1(0)); - property->SetRepresentation(fd->GetArray(std::string(arrayPrefix + ":" + "Representation").c_str())->GetTuple1(0)); - property->SetBackfaceCulling(fd->GetArray(std::string(arrayPrefix + ":" + "BackfaceCulling").c_str())->GetTuple1(0)); - property->SetFrontfaceCulling(fd->GetArray(std::string(arrayPrefix + ":" + "FrontfaceCulling").c_str())->GetTuple1(0)); - property->SetPointSize(fd->GetArray(std::string(arrayPrefix + ":" + "PointSize").c_str())->GetTuple1(0)); - property->SetLineWidth(fd->GetArray(std::string(arrayPrefix + ":" + "LineWidth").c_str())->GetTuple1(0)); - property->SetLineStipplePattern(fd->GetArray(std::string(arrayPrefix + ":" + "LineStipplePattern").c_str())->GetTuple1(0)); - property->SetLineStippleRepeatFactor(fd->GetArray(std::string(arrayPrefix + ":" + "LineStippleRepeatFactor").c_str())->GetTuple1(0)); + vtkFieldData* fd = pd->GetFieldData(); + + property->SetAmbient( + fd->GetArray(std::string(arrayPrefix + ":" + "Ambient").c_str()) + ->GetTuple1(0)); + property->SetAmbientColor( + fd->GetArray(std::string(arrayPrefix + ":" + "AmbientColor").c_str()) + ->GetTuple(0)); + property->SetAmbientColor( + fd->GetArray(std::string(arrayPrefix + ":" + "AmbientColor").c_str()) + ->GetTuple(0)); + property->SetDiffuse( + fd->GetArray(std::string(arrayPrefix + ":" + "Diffuse").c_str()) + ->GetTuple1(0)); + property->SetDiffuseColor( + fd->GetArray(std::string(arrayPrefix + ":" + "DiffuseColor").c_str()) + ->GetTuple(0)); + property->SetSpecular( + fd->GetArray(std::string(arrayPrefix + ":" + "Specular").c_str()) + ->GetTuple1(0)); + property->SetSpecularColor( + fd->GetArray(std::string(arrayPrefix + ":" + "SpecularColor").c_str()) + ->GetTuple(0)); + property->SetSpecularPower( + fd->GetArray(std::string(arrayPrefix + ":" + "SpecularPower").c_str()) + ->GetTuple1(0)); + property->SetEdgeColor( + fd->GetArray(std::string(arrayPrefix + ":" + "EdgeColor").c_str()) + ->GetTuple(0)); + property->SetEdgeVisibility( + fd->GetArray(std::string(arrayPrefix + ":" + "EdgeVisibility").c_str()) + ->GetTuple1(0)); + property->SetVertexColor( + fd->GetArray(std::string(arrayPrefix + ":" + "VertexColor").c_str()) + ->GetTuple(0)); + property->SetVertexVisibility( + fd->GetArray( + std::string(arrayPrefix + ":" + "VertexVisibility").c_str()) + ->GetTuple1(0)); + property->SetInterpolation( + fd->GetArray(std::string(arrayPrefix + ":" + "Interpolation").c_str()) + ->GetTuple1(0)); + property->SetOpacity( + fd->GetArray(std::string(arrayPrefix + ":" + "Opacity").c_str()) + ->GetTuple1(0)); + property->SetRepresentation( + fd->GetArray(std::string(arrayPrefix + ":" + "Representation").c_str()) + ->GetTuple1(0)); + property->SetBackfaceCulling( + fd->GetArray(std::string(arrayPrefix + ":" + "BackfaceCulling").c_str()) + ->GetTuple1(0)); + property->SetFrontfaceCulling( + fd->GetArray( + std::string(arrayPrefix + ":" + "FrontfaceCulling").c_str()) + ->GetTuple1(0)); + property->SetPointSize( + fd->GetArray(std::string(arrayPrefix + ":" + "PointSize").c_str()) + ->GetTuple1(0)); + property->SetLineWidth( + fd->GetArray(std::string(arrayPrefix + ":" + "LineWidth").c_str()) + ->GetTuple1(0)); + property->SetLineStipplePattern( + fd->GetArray( + std::string(arrayPrefix + ":" + "LineStipplePattern").c_str()) + ->GetTuple1(0)); + property->SetLineStippleRepeatFactor( + fd->GetArray(std::string(arrayPrefix + ":" + "LineStippleRepeatFactor") + .c_str()) + ->GetTuple1(0)); property->SetLighting( - fd->GetArray(std::string(arrayPrefix + ":" + "Lighting").c_str())->GetTuple1(0) == 1.0 ? true: false); + fd->GetArray(std::string(arrayPrefix + ":" + "Lighting").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); property->SetRenderPointsAsSpheres( - fd->GetArray(std::string(arrayPrefix + ":" + "RenderPointsAsSpheres").c_str())->GetTuple1(0) == 1.0 ? true: false); - property->SetRenderLinesAsTubes(fd->GetArray(std::string(arrayPrefix + ":" + "RenderLinesAsTubes").c_str())->GetTuple1(0) == 1.0 ? true: false); + fd->GetArray( + std::string(arrayPrefix + ":" + "RenderPointsAsSpheres").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); + property->SetRenderLinesAsTubes( + fd->GetArray( + std::string(arrayPrefix + ":" + "RenderLinesAsTubes").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); property->SetShading( - fd->GetArray(std::string(arrayPrefix + ":" + "Shading").c_str())->GetTuple1(0) == 1.0 ? true: false); + fd->GetArray(std::string(arrayPrefix + ":" + "Shading").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); } } -void RestoreActorFromFieldData(std::string arrayPrefix, - vtkActor *actor, - vtkPolyData *pd) +void RestoreActorFromFieldData(std::string arrayPrefix, vtkActor* actor, + vtkPolyData* pd) { - vtkFieldData *fd = pd->GetFieldData(); + vtkFieldData* fd = pd->GetFieldData(); actor->SetDragable( - fd->GetArray(std::string(arrayPrefix + ":" + "Dragable").c_str())->GetTuple1(0) == 1.0 ? true: false); + fd->GetArray(std::string(arrayPrefix + ":" + "Dragable").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); actor->SetPickable( - fd->GetArray(std::string(arrayPrefix + ":" + "Pickable").c_str())->GetTuple1(0) == 1.0 ? true: false); - actor->SetVisibility(fd->GetArray(std::string(arrayPrefix + ":" + "Visibility").c_str())->GetTuple1(0)); - actor->SetPosition(fd->GetArray(std::string(arrayPrefix + ":" + "Position").c_str())->GetTuple(0)); - actor->SetOrientation(fd->GetArray(std::string(arrayPrefix + ":" + "Orientation").c_str())->GetTuple(0)); - actor->SetOrigin(fd->GetArray(std::string(arrayPrefix + ":" + "Origin").c_str())->GetTuple(0)); - actor->SetScale(fd->GetArray(std::string(arrayPrefix + ":" + "Scale").c_str())->GetTuple(0)); - actor->SetForceOpaque(fd->GetArray( - std::string(arrayPrefix + ":" + "ForceOpaque").c_str())->GetTuple1(0) == 1.0 ? true: false); - actor->SetForceTranslucent(fd->GetArray( - std::string(arrayPrefix + ":" + "ForceTranslucent").c_str())->GetTuple1(0) == 1.0 ? true: false); -} + fd->GetArray(std::string(arrayPrefix + ":" + "Pickable").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); + actor->SetVisibility( + fd->GetArray(std::string(arrayPrefix + ":" + "Visibility").c_str()) + ->GetTuple1(0)); + actor->SetPosition( + fd->GetArray(std::string(arrayPrefix + ":" + "Position").c_str()) + ->GetTuple(0)); + actor->SetOrientation( + fd->GetArray(std::string(arrayPrefix + ":" + "Orientation").c_str()) + ->GetTuple(0)); + actor->SetOrigin( + fd->GetArray(std::string(arrayPrefix + ":" + "Origin").c_str()) + ->GetTuple(0)); + actor->SetScale(fd->GetArray(std::string(arrayPrefix + ":" + "Scale").c_str()) + ->GetTuple(0)); + actor->SetForceOpaque( + fd->GetArray(std::string(arrayPrefix + ":" + "ForceOpaque").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); + actor->SetForceTranslucent( + fd->GetArray(std::string(arrayPrefix + ":" + "ForceTranslucent").c_str()) + ->GetTuple1(0) == 1.0 + ? true + : false); } +} // namespace diff --git a/src/Cxx/Picking/HighlightSelectedPoints.cxx b/src/Cxx/Picking/HighlightSelectedPoints.cxx index 6889e401d28aa169d17fbea9e24fa60c96c9de74..96d87d2d832254c4966c3415dfb3ac1386189f9c 100644 --- a/src/Cxx/Picking/HighlightSelectedPoints.cxx +++ b/src/Cxx/Picking/HighlightSelectedPoints.cxx @@ -23,6 +23,10 @@ #include <vtkVersion.h> #include <vtkVertexGlyphFilter.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Define interaction style class InteractorStyle : public vtkInteractorStyleRubberBandPick { @@ -39,24 +43,21 @@ public: virtual void OnLeftButtonUp() override { - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); - // Forward events + // Forward events vtkInteractorStyleRubberBandPick::OnLeftButtonUp(); vtkPlanes* frustum = static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker()) ->GetFrustum(); - vtkSmartPointer<vtkExtractGeometry> extractGeometry = - vtkSmartPointer<vtkExtractGeometry>::New(); + auto extractGeometry = vtkSmartPointer<vtkExtractGeometry>::New(); extractGeometry->SetImplicitFunction(frustum); extractGeometry->SetInputData(this->Points); extractGeometry->Update(); - vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter = - vtkSmartPointer<vtkVertexGlyphFilter>::New(); + auto glyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New(); glyphFilter->SetInputConnection(extractGeometry->GetOutputPort()); glyphFilter->Update(); @@ -98,18 +99,15 @@ vtkStandardNewMacro(InteractorStyle); int main(int, char*[]) { - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); - vtkSmartPointer<vtkPointSource> pointSource = - vtkSmartPointer<vtkPointSource>::New(); + auto pointSource = vtkSmartPointer<vtkPointSource>::New(); pointSource->SetNumberOfPoints(20); pointSource->Update(); - vtkSmartPointer<vtkIdFilter> idFilter = - vtkSmartPointer<vtkIdFilter>::New(); + auto idFilter = vtkSmartPointer<vtkIdFilter>::New(); idFilter->SetInputConnection(pointSource->GetOutputPort()); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 idFilter->SetCellIdsArrayName("OriginalIds"); idFilter->SetPointIdsArrayName("OriginalIds"); #else @@ -117,33 +115,27 @@ int main(int, char*[]) #endif idFilter->Update(); - vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter = - vtkSmartPointer<vtkDataSetSurfaceFilter>::New(); + auto surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New(); surfaceFilter->SetInputConnection(idFilter->GetOutputPort()); surfaceFilter->Update(); vtkPolyData* input = surfaceFilter->GetOutput(); // Create a mapper and actor - vtkSmartPointer<vtkPolyDataMapper> mapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputData(input); mapper->ScalarVisibilityOff(); - vtkSmartPointer<vtkActor> actor = - vtkSmartPointer<vtkActor>::New(); + auto actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); // Visualize - vtkSmartPointer<vtkRenderer> renderer = - vtkSmartPointer<vtkRenderer>::New(); - vtkSmartPointer<vtkRenderWindow> renderWindow = - vtkSmartPointer<vtkRenderWindow>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); + auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer(renderer); - vtkSmartPointer<vtkAreaPicker> areaPicker = - vtkSmartPointer<vtkAreaPicker>::New(); - vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = + auto areaPicker = vtkSmartPointer<vtkAreaPicker>::New(); + auto renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor->SetPicker(areaPicker); renderWindowInteractor->SetRenderWindow(renderWindow); @@ -153,8 +145,7 @@ int main(int, char*[]) renderWindow->Render(); - vtkSmartPointer<InteractorStyle> style = - vtkSmartPointer<InteractorStyle>::New(); + auto style = vtkSmartPointer<InteractorStyle>::New(); style->SetPoints(input); renderWindowInteractor->SetInteractorStyle(style); diff --git a/src/Cxx/Picking/HighlightSelection.cxx b/src/Cxx/Picking/HighlightSelection.cxx index 85669777511eef2783c9bf35fbbf1ffa02b87c5d..6fa6291f897a859f3719678740bf0488b76ef533 100644 --- a/src/Cxx/Picking/HighlightSelection.cxx +++ b/src/Cxx/Picking/HighlightSelection.cxx @@ -23,6 +23,10 @@ #include <vtkVersion.h> #include <vtkVertexGlyphFilter.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + #include <vtkBYUReader.h> #include <vtkOBJReader.h> #include <vtkPLYReader.h> @@ -34,8 +38,7 @@ #define VTKISRBP_ORIENT 0 #define VTKISRBP_SELECT 1 -namespace -{ +namespace { // Define interaction style class HighlightInteractorStyle : public vtkInteractorStyleRubberBandPick { @@ -57,14 +60,13 @@ public: if (this->CurrentMode == VTKISRBP_SELECT) { - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); vtkPlanes* frustum = static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker()) ->GetFrustum(); - vtkSmartPointer<vtkExtractPolyDataGeometry> extractPolyDataGeometry = + auto extractPolyDataGeometry = vtkSmartPointer<vtkExtractPolyDataGeometry>::New(); extractPolyDataGeometry->SetInputData(this->PolyData); extractPolyDataGeometry->SetImplicitFunction(frustum); @@ -104,23 +106,21 @@ private: vtkSmartPointer<vtkDataSetMapper> SelectedMapper; }; vtkStandardNewMacro(HighlightInteractorStyle); -} -namespace -{ -vtkSmartPointer<vtkPolyData> ReadPolyData(const char *fileName); -} -int main(int argc, char*argv[]) +vtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName); +} // namespace + + +int main(int argc, char* argv[]) { - vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : "");; + auto polyData = ReadPolyData(argc > 1 ? argv[1] : ""); + ; - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); - vtkSmartPointer<vtkIdFilter> idFilter = - vtkSmartPointer<vtkIdFilter>::New(); + auto idFilter = vtkSmartPointer<vtkIdFilter>::New(); idFilter->SetInputData(polyData); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 idFilter->SetCellIdsArrayName("OriginalIds"); idFilter->SetPointIdsArrayName("OriginalIds"); #else @@ -130,37 +130,32 @@ int main(int argc, char*argv[]) // This is needed to convert the ouput of vtkIdFilter (vtkDataSet) back to // vtkPolyData - vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter = - vtkSmartPointer<vtkDataSetSurfaceFilter>::New(); + auto surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New(); surfaceFilter->SetInputConnection(idFilter->GetOutputPort()); surfaceFilter->Update(); vtkPolyData* input = surfaceFilter->GetOutput(); // Create a mapper and actor - vtkSmartPointer<vtkPolyDataMapper> mapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputData(polyData); mapper->ScalarVisibilityOff(); - vtkSmartPointer<vtkActor> actor = - vtkSmartPointer<vtkActor>::New(); + auto actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(5); - actor->GetProperty()->SetDiffuseColor(colors->GetColor3d("Peacock").GetData()); + actor->GetProperty()->SetDiffuseColor( + colors->GetColor3d("Peacock").GetData()); // Visualize - vtkSmartPointer<vtkRenderer> renderer = - vtkSmartPointer<vtkRenderer>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); renderer->UseHiddenLineRemovalOn(); - vtkSmartPointer<vtkRenderWindow> renderWindow = - vtkSmartPointer<vtkRenderWindow>::New(); + auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer(renderer); renderWindow->SetSize(640, 480); - vtkSmartPointer<vtkAreaPicker> areaPicker = - vtkSmartPointer<vtkAreaPicker>::New(); - vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = + auto areaPicker = vtkSmartPointer<vtkAreaPicker>::New(); + auto renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor->SetPicker(areaPicker); renderWindowInteractor->SetRenderWindow(renderWindow); @@ -170,8 +165,7 @@ int main(int argc, char*argv[]) renderWindow->Render(); - vtkSmartPointer<HighlightInteractorStyle> style = - vtkSmartPointer<HighlightInteractorStyle>::New(); + auto style = vtkSmartPointer<HighlightInteractorStyle>::New(); style->SetPolyData(input); renderWindowInteractor->SetInteractorStyle(style); @@ -179,67 +173,60 @@ int main(int argc, char*argv[]) return EXIT_SUCCESS; } -namespace -{ -vtkSmartPointer<vtkPolyData> ReadPolyData(const char *fileName) +namespace { +vtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName) { vtkSmartPointer<vtkPolyData> polyData; - std::string extension = vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName)); + std::string extension = + vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName)); if (extension == ".ply") { - vtkSmartPointer<vtkPLYReader> reader = - vtkSmartPointer<vtkPLYReader>::New(); - reader->SetFileName (fileName); + auto reader = vtkSmartPointer<vtkPLYReader>::New(); + reader->SetFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else if (extension == ".vtp") { - vtkSmartPointer<vtkXMLPolyDataReader> reader = - vtkSmartPointer<vtkXMLPolyDataReader>::New(); - reader->SetFileName (fileName); + auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New(); + reader->SetFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else if (extension == ".obj") { - vtkSmartPointer<vtkOBJReader> reader = - vtkSmartPointer<vtkOBJReader>::New(); - reader->SetFileName (fileName); + auto reader = vtkSmartPointer<vtkOBJReader>::New(); + reader->SetFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else if (extension == ".stl") { - vtkSmartPointer<vtkSTLReader> reader = - vtkSmartPointer<vtkSTLReader>::New(); - reader->SetFileName (fileName); + auto reader = vtkSmartPointer<vtkSTLReader>::New(); + reader->SetFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else if (extension == ".vtk") { - vtkSmartPointer<vtkPolyDataReader> reader = - vtkSmartPointer<vtkPolyDataReader>::New(); - reader->SetFileName (fileName); + auto reader = vtkSmartPointer<vtkPolyDataReader>::New(); + reader->SetFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else if (extension == ".g") { - vtkSmartPointer<vtkBYUReader> reader = - vtkSmartPointer<vtkBYUReader>::New(); - reader->SetGeometryFileName (fileName); + auto reader = vtkSmartPointer<vtkBYUReader>::New(); + reader->SetGeometryFileName(fileName); reader->Update(); polyData = reader->GetOutput(); } else { - vtkSmartPointer<vtkSphereSource> source = - vtkSmartPointer<vtkSphereSource>::New(); + auto source = vtkSmartPointer<vtkSphereSource>::New(); source->Update(); polyData = source->GetOutput(); } return polyData; } -} +} // namespace diff --git a/src/Cxx/PolyData/ImplicitDataSetClipping.cxx b/src/Cxx/PolyData/ImplicitDataSetClipping.cxx index 06f13861552ad58511cc2eafa729f0aba277edf0..11d37b2d4cb84a372385353ade01fc5732952a39 100644 --- a/src/Cxx/PolyData/ImplicitDataSetClipping.cxx +++ b/src/Cxx/PolyData/ImplicitDataSetClipping.cxx @@ -19,6 +19,10 @@ #include <vtkVersion.h> #include <vtkXMLPolyDataWriter.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + namespace { void WritePolyData(vtkPolyData* const polyData, const std::string& filename); @@ -27,13 +31,11 @@ void WriteDataSet(vtkDataSet* const dataSet, const std::string& filename); int main(int, char*[]) { - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); colors->SetColor("Bkg", 0.2, 0.3, 0.4); - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->SetCenter(.75, 0, 0); unsigned int res = 10; @@ -47,12 +49,11 @@ int main(int, char*[]) << " cells. " << std::endl; // Add ids to the points and cells of the sphere - vtkSmartPointer<vtkIdFilter> cellIdFilter = - vtkSmartPointer<vtkIdFilter>::New(); + auto cellIdFilter = vtkSmartPointer<vtkIdFilter>::New(); cellIdFilter->SetInputConnection(sphereSource->GetOutputPort()); cellIdFilter->SetCellIds(true); cellIdFilter->SetPointIds(false); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 cellIdFilter->SetCellIdsArrayName("CellIds"); #else cellIdFilter->SetIdsArrayName("CellIds"); @@ -61,12 +62,11 @@ int main(int, char*[]) WriteDataSet(cellIdFilter->GetOutput(), "CellIdFilter.vtp"); - vtkSmartPointer<vtkIdFilter> pointIdFilter = - vtkSmartPointer<vtkIdFilter>::New(); + auto pointIdFilter = vtkSmartPointer<vtkIdFilter>::New(); pointIdFilter->SetInputConnection(cellIdFilter->GetOutputPort()); pointIdFilter->SetCellIds(false); pointIdFilter->SetPointIds(true); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 pointIdFilter->SetPointIdsArrayName("PointIds"); #else pointIdFilter->SetIdsArrayName("PointIds"); @@ -77,15 +77,13 @@ int main(int, char*[]) WriteDataSet(sphereWithIds, "BothIdFilter.vtp"); - vtkSmartPointer<vtkCubeSource> cubeSource = - vtkSmartPointer<vtkCubeSource>::New(); + auto cubeSource = vtkSmartPointer<vtkCubeSource>::New(); cubeSource->Update(); - vtkSmartPointer<vtkBox> implicitCube = vtkSmartPointer<vtkBox>::New(); + auto implicitCube = vtkSmartPointer<vtkBox>::New(); implicitCube->SetBounds(cubeSource->GetOutput()->GetBounds()); - vtkSmartPointer<vtkClipPolyData> clipper = - vtkSmartPointer<vtkClipPolyData>::New(); + auto clipper = vtkSmartPointer<vtkClipPolyData>::New(); clipper->SetClipFunction(implicitCube); clipper->SetInputData(sphereWithIds); clipper->InsideOutOn(); @@ -101,8 +99,8 @@ int main(int, char*[]) std::cout << "There are " << clipped->GetNumberOfCells() << " clipped cells." << std::endl; - vtkIdTypeArray* clippedCellIds = - dynamic_cast<vtkIdTypeArray*>(clipped->GetCellData()->GetArray("CellIds")); + vtkIdTypeArray* clippedCellIds = dynamic_cast<vtkIdTypeArray*>( + clipped->GetCellData()->GetArray("CellIds")); for (vtkIdType i = 0; i < clippedCellIds->GetNumberOfTuples(); i++) { @@ -111,31 +109,28 @@ int main(int, char*[]) } // Create a mapper and actor for clipped sphere - vtkSmartPointer<vtkPolyDataMapper> clippedMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto clippedMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); clippedMapper->SetInputConnection(clipper->GetOutputPort()); clippedMapper->ScalarVisibilityOff(); - vtkSmartPointer<vtkActor> clippedActor = vtkSmartPointer<vtkActor>::New(); + auto clippedActor = vtkSmartPointer<vtkActor>::New(); clippedActor->SetMapper(clippedMapper); clippedActor->GetProperty()->SetRepresentationToWireframe(); // Create a mapper and actor for cube - vtkSmartPointer<vtkPolyDataMapper> cubeMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto cubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); cubeMapper->SetInputConnection(cubeSource->GetOutputPort()); - vtkSmartPointer<vtkActor> cubeActor = vtkSmartPointer<vtkActor>::New(); + auto cubeActor = vtkSmartPointer<vtkActor>::New(); cubeActor->SetMapper(cubeMapper); cubeActor->GetProperty()->SetRepresentationToWireframe(); cubeActor->GetProperty()->SetOpacity(0.5); // Create a renderer, render window, and interactor - vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New(); - vtkSmartPointer<vtkRenderWindow> renderWindow = - vtkSmartPointer<vtkRenderWindow>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); + auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer(renderer); - vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = + auto renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor->SetRenderWindow(renderWindow); @@ -162,8 +157,7 @@ int main(int, char*[]) namespace { void WritePolyData(vtkPolyData* const polyData, const std::string& filename) { - vtkSmartPointer<vtkXMLPolyDataWriter> writer = - vtkSmartPointer<vtkXMLPolyDataWriter>::New(); + auto writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New(); writer->SetInputData(polyData); writer->SetFileName(filename.c_str()); writer->Write(); @@ -171,8 +165,7 @@ void WritePolyData(vtkPolyData* const polyData, const std::string& filename) void WriteDataSet(vtkDataSet* const dataSet, const std::string& filename) { - vtkSmartPointer<vtkDataSetWriter> writer = - vtkSmartPointer<vtkDataSetWriter>::New(); + auto writer = vtkSmartPointer<vtkDataSetWriter>::New(); writer->SetInputData(dataSet); writer->SetFileName(filename.c_str()); writer->Write(); diff --git a/src/Cxx/PolyData/ImplicitSelectionLoop.cxx b/src/Cxx/PolyData/ImplicitSelectionLoop.cxx index 8a1dbfb9ce4ebac935ed56af423d45c6d7f29122..edae3db013c386295fcc18bf30a326291e497648 100644 --- a/src/Cxx/PolyData/ImplicitSelectionLoop.cxx +++ b/src/Cxx/PolyData/ImplicitSelectionLoop.cxx @@ -1,106 +1,93 @@ -#include <vtkSmartPointer.h> -#include <vtkProperty.h> -#include <vtkImplicitSelectionLoop.h> -#include <vtkSphereSource.h> #include <vtkClipPolyData.h> -#include <vtkProperty.h> -#include <vtkPolyDataMapper.h> +#include <vtkImplicitSelectionLoop.h> #include <vtkLODActor.h> -#include <vtkRenderWindowInteractor.h> +#include <vtkNamedColors.h> +#include <vtkPolyDataMapper.h> +#include <vtkProperty.h> #include <vtkRenderWindow.h> +#include <vtkRenderWindowInteractor.h> #include <vtkRenderer.h> +#include <vtkSmartPointer.h> +#include <vtkSphereSource.h> -#include <vtkNamedColors.h> - -int main(int, char *[]) +int main(int, char*[]) { - - vtkSmartPointer<vtkNamedColors> colors = - vtkSmartPointer<vtkNamedColors>::New(); - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto colors = vtkSmartPointer<vtkNamedColors>::New(); + + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->SetPhiResolution(100); sphereSource->SetThetaResolution(100); sphereSource->Update(); - - vtkSmartPointer<vtkPoints> selectionPoints = - vtkSmartPointer<vtkPoints>::New(); - - selectionPoints->InsertPoint( 0, -0.16553, 0.135971, 0.451972 ); - selectionPoints->InsertPoint( 1, -0.0880123, -0.134952, 0.4747); - selectionPoints->InsertPoint( 2, 0.00292618, -0.134604, 0.482459 ); - selectionPoints->InsertPoint( 3, 0.0641941, 0.067112, 0.490947); - selectionPoints->InsertPoint( 4, 0.15577, 0.0734765, 0.469245); - selectionPoints->InsertPoint( 5, 0.166667, -0.129217, 0.454622 ); - selectionPoints->InsertPoint( 6, 0.241259, -0.123363, 0.420581); - selectionPoints->InsertPoint( 7, 0.240334, 0.0727106, 0.432555); - selectionPoints->InsertPoint( 8, 0.308529, 0.0844311, 0.384357 ); - selectionPoints->InsertPoint( 9, 0.32672, -0.121674, 0.359187); - selectionPoints-> InsertPoint( 10, 0.380721, -0.117342, 0.302527); - selectionPoints ->InsertPoint( 11, 0.387804, 0.0455074, 0.312375 ); - selectionPoints ->InsertPoint( 12, 0.43943, -0.111673, 0.211707); - selectionPoints ->InsertPoint( 13, 0.470984, -0.0801913, 0.147919); - selectionPoints ->InsertPoint( 14, 0.436777, 0.0688872, 0.233021 ); - selectionPoints ->InsertPoint( 15, 0.44874, 0.188852, 0.109882); - selectionPoints ->InsertPoint( 16, 0.391352, 0.254285, 0.176943); - selectionPoints ->InsertPoint( 17, 0.373274, 0.154162, 0.294296 ); - selectionPoints ->InsertPoint( 18, 0.274659, 0.311654, 0.276609); - selectionPoints ->InsertPoint( 19, 0.206068, 0.31396, 0.329702); - selectionPoints ->InsertPoint( 20, 0.263789, 0.174982, 0.387308 ); - selectionPoints ->InsertPoint( 21, 0.213034, 0.175485, 0.417142); - selectionPoints ->InsertPoint( 22, 0.169113, 0.261974, 0.390286); - selectionPoints ->InsertPoint( 23, 0.102552, 0.25997, 0.414814 ); - selectionPoints ->InsertPoint( 24, 0.131512, 0.161254, 0.454705); - selectionPoints ->InsertPoint( 25, 0.000192443, 0.156264, 0.475307); - selectionPoints ->InsertPoint( 26, -0.0392091, 0.000251724, 0.499943); - selectionPoints ->InsertPoint( 27, -0.096161, 0.159646, 0.46438 ); - - vtkSmartPointer<vtkImplicitSelectionLoop> loop = - vtkSmartPointer<vtkImplicitSelectionLoop>::New(); + + auto selectionPoints = vtkSmartPointer<vtkPoints>::New(); + + selectionPoints->InsertPoint(0, -0.16553, 0.135971, 0.451972); + selectionPoints->InsertPoint(1, -0.0880123, -0.134952, 0.4747); + selectionPoints->InsertPoint(2, 0.00292618, -0.134604, 0.482459); + selectionPoints->InsertPoint(3, 0.0641941, 0.067112, 0.490947); + selectionPoints->InsertPoint(4, 0.15577, 0.0734765, 0.469245); + selectionPoints->InsertPoint(5, 0.166667, -0.129217, 0.454622); + selectionPoints->InsertPoint(6, 0.241259, -0.123363, 0.420581); + selectionPoints->InsertPoint(7, 0.240334, 0.0727106, 0.432555); + selectionPoints->InsertPoint(8, 0.308529, 0.0844311, 0.384357); + selectionPoints->InsertPoint(9, 0.32672, -0.121674, 0.359187); + selectionPoints->InsertPoint(10, 0.380721, -0.117342, 0.302527); + selectionPoints->InsertPoint(11, 0.387804, 0.0455074, 0.312375); + selectionPoints->InsertPoint(12, 0.43943, -0.111673, 0.211707); + selectionPoints->InsertPoint(13, 0.470984, -0.0801913, 0.147919); + selectionPoints->InsertPoint(14, 0.436777, 0.0688872, 0.233021); + selectionPoints->InsertPoint(15, 0.44874, 0.188852, 0.109882); + selectionPoints->InsertPoint(16, 0.391352, 0.254285, 0.176943); + selectionPoints->InsertPoint(17, 0.373274, 0.154162, 0.294296); + selectionPoints->InsertPoint(18, 0.274659, 0.311654, 0.276609); + selectionPoints->InsertPoint(19, 0.206068, 0.31396, 0.329702); + selectionPoints->InsertPoint(20, 0.263789, 0.174982, 0.387308); + selectionPoints->InsertPoint(21, 0.213034, 0.175485, 0.417142); + selectionPoints->InsertPoint(22, 0.169113, 0.261974, 0.390286); + selectionPoints->InsertPoint(23, 0.102552, 0.25997, 0.414814); + selectionPoints->InsertPoint(24, 0.131512, 0.161254, 0.454705); + selectionPoints->InsertPoint(25, 0.000192443, 0.156264, 0.475307); + selectionPoints->InsertPoint(26, -0.0392091, 0.000251724, 0.499943); + selectionPoints->InsertPoint(27, -0.096161, 0.159646, 0.46438); + + auto loop = vtkSmartPointer<vtkImplicitSelectionLoop>::New(); loop->SetLoop(selectionPoints); - - vtkSmartPointer<vtkClipPolyData> clip = //clips out positive region - vtkSmartPointer<vtkClipPolyData>::New(); + + auto clip = // clips out positive region + vtkSmartPointer<vtkClipPolyData>::New(); clip->SetInputConnection(sphereSource->GetOutputPort()); clip->SetClipFunction(loop); clip->SetValue(0.0); - vtkSmartPointer<vtkPolyDataMapper> clipMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto clipMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); clipMapper->SetInputConnection(clip->GetOutputPort()); clipMapper->ScalarVisibilityOff(); - vtkSmartPointer<vtkProperty> backProp = - vtkSmartPointer<vtkProperty>::New(); + auto backProp = vtkSmartPointer<vtkProperty>::New(); backProp->SetColor(colors->GetColor3d("tomato").GetData()); - vtkSmartPointer<vtkLODActor> clipActor = - vtkSmartPointer<vtkLODActor>::New(); + auto clipActor = vtkSmartPointer<vtkLODActor>::New(); clipActor->SetMapper(clipMapper); clipActor->SetBackfaceProperty(backProp); clipActor->GetProperty()->SetColor(colors->GetColor3d("banana").GetData()); - vtkSmartPointer<vtkRenderer> renderer = - vtkSmartPointer<vtkRenderer>::New(); - - vtkSmartPointer<vtkRenderWindow> renderWindow = - vtkSmartPointer<vtkRenderWindow>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); + + auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer(renderer); - - vtkSmartPointer<vtkRenderWindowInteractor> interactor = - vtkSmartPointer<vtkRenderWindowInteractor>::New(); + + auto interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); interactor->SetRenderWindow(renderWindow); // Add the actors to the renderer, set the background and size - renderer->AddActor (clipActor); - renderer->SetBackground (colors->GetColor3d("slate_grey").GetData()); + renderer->AddActor(clipActor); + renderer->SetBackground(colors->GetColor3d("slate_grey").GetData()); - renderWindow->SetSize (500, 500); + renderWindow->SetSize(500, 500); renderWindow->Render(); interactor->Start(); - return EXIT_SUCCESS; } diff --git a/src/Cxx/PolyData/PointCellIds.cxx b/src/Cxx/PolyData/PointCellIds.cxx index 097b290a4e18fa1984a040a2a5a0709e03394aae..d65823fe3372723649f1cdf5aaef3d2e54d96c79 100644 --- a/src/Cxx/PolyData/PointCellIds.cxx +++ b/src/Cxx/PolyData/PointCellIds.cxx @@ -6,10 +6,13 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + int main(int, char*[]) { - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->Update(); std::cout << "There are " << sphereSource->GetOutput()->GetNumberOfPoints() @@ -17,9 +20,9 @@ int main(int, char*[]) std::cout << "There are " << sphereSource->GetOutput()->GetNumberOfCells() << " cells." << std::endl; - vtkSmartPointer<vtkIdFilter> idFilter = vtkSmartPointer<vtkIdFilter>::New(); + auto idFilter = vtkSmartPointer<vtkIdFilter>::New(); idFilter->SetInputConnection(sphereSource->GetOutputPort()); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 idFilter->SetPointIdsArrayName("ids"); idFilter->SetCellIdsArrayName("ids"); #else diff --git a/src/Cxx/Qt/BorderWidgetQt.cxx b/src/Cxx/Qt/BorderWidgetQt.cxx index 1edc078a33759e258142a5c8ff2df668f47cb99d..e127b7a9e200387df7a8c60bb938986b5e1bbb2b 100644 --- a/src/Cxx/Qt/BorderWidgetQt.cxx +++ b/src/Cxx/Qt/BorderWidgetQt.cxx @@ -13,6 +13,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + class BorderCallback : public vtkCommand { public: @@ -40,7 +44,7 @@ BorderWidgetQt::BorderWidgetQt() vtkNew<vtkNamedColors> colors; vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidget->setRenderWindow(renderWindow); #else this->qvtkWidget->SetRenderWindow(renderWindow); @@ -61,7 +65,7 @@ BorderWidgetQt::BorderWidgetQt() renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData()); // Connect VTK with Qt -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidget->renderWindow()->AddRenderer(renderer); #else this->qvtkWidget->GetRenderWindow()->AddRenderer(renderer); @@ -70,7 +74,7 @@ BorderWidgetQt::BorderWidgetQt() // Add a border widget to the right renderer vtkNew<vtkBorderWidget> bw; this->BorderWidget = bw; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->BorderWidget->SetInteractor(this->qvtkWidget->interactor()); #else this->BorderWidget->SetInteractor(this->qvtkWidget->GetInteractor()); diff --git a/src/Cxx/Qt/EventQtSlotConnect.cxx b/src/Cxx/Qt/EventQtSlotConnect.cxx index 4db46b8b793783c4db521e0e6b646b47a811d7fd..898e4f17c4da35b9986945fb97e432b4fcbde0fa 100644 --- a/src/Cxx/Qt/EventQtSlotConnect.cxx +++ b/src/Cxx/Qt/EventQtSlotConnect.cxx @@ -13,6 +13,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Constructor EventQtSlotConnect::EventQtSlotConnect() { @@ -21,7 +25,7 @@ EventQtSlotConnect::EventQtSlotConnect() vtkNew<vtkNamedColors> colors; vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidget->setRenderWindow(renderWindow); #else this->qvtkWidget->SetRenderWindow(renderWindow); @@ -45,13 +49,13 @@ EventQtSlotConnect::EventQtSlotConnect() renderer->AddActor(sphereActor); renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData()); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidget->renderWindow()->AddRenderer(renderer); #else this->qvtkWidget->GetRenderWindow()->AddRenderer(renderer); #endif -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->Connections->Connect( this->qvtkWidget->renderWindow()->GetInteractor(), vtkCommand::LeftButtonPressEvent, this, diff --git a/src/Cxx/Qt/RenderWindowNoUiFile.cxx b/src/Cxx/Qt/RenderWindowNoUiFile.cxx index 98ebfd5cb99f86b048311eec15f2f8ec0784d97a..b5302a532336ce53a7549342b941c5fb05edd1fb 100644 --- a/src/Cxx/Qt/RenderWindowNoUiFile.cxx +++ b/src/Cxx/Qt/RenderWindowNoUiFile.cxx @@ -11,6 +11,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + #include <QSurfaceFormat> #include <QVTKOpenGLNativeWidget.h> @@ -26,7 +30,7 @@ int main(int argc, char** argv) vtkNew<vtkNamedColors> colors; vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 widget.setRenderWindow(renderWindow); #else widget.SetRenderWindow(renderWindow); @@ -47,7 +51,7 @@ int main(int argc, char** argv) renderer->AddActor(sphereActor); renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData()); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 widget.renderWindow()->AddRenderer(renderer); widget.renderWindow()->SetWindowName("RenderWindowNoUIFile"); #else diff --git a/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx b/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx index 0fbef2866e6b028cf1d94f0513ca26ba7f00d541..6d0fe6850e3565903c9a292cbdb2b3cabb54a191 100644 --- a/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx +++ b/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx @@ -11,6 +11,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Constructor RenderWindowUIMultipleInheritance::RenderWindowUIMultipleInheritance() { @@ -19,30 +23,28 @@ RenderWindowUIMultipleInheritance::RenderWindowUIMultipleInheritance() vtkNew<vtkNamedColors> colors; vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 qvtkWidget->setRenderWindow(renderWindow); #else qvtkWidget->SetRenderWindow(renderWindow); #endif // Sphere - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->Update(); - vtkSmartPointer<vtkPolyDataMapper> sphereMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto sphereMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); - vtkSmartPointer<vtkActor> sphereActor = vtkSmartPointer<vtkActor>::New(); + auto sphereActor = vtkSmartPointer<vtkActor>::New(); sphereActor->SetMapper(sphereMapper); sphereActor->GetProperty()->SetColor(colors->GetColor4d("Tomato").GetData()); // VTK Renderer - vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New(); + auto renderer = vtkSmartPointer<vtkRenderer>::New(); renderer->AddActor(sphereActor); renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData()); // VTK/Qt wedded -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidget->renderWindow()->AddRenderer(renderer); this->qvtkWidget->renderWindow()->SetWindowName( "RenderWindowUIMultipleInheritance"); diff --git a/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx b/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx index ea4487eec353ae6ac58f694c219cdf754b788fa6..8aa6c17dc3c5944a31a34b488a924586d99b380e 100644 --- a/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx +++ b/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx @@ -14,15 +14,20 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Constructor -RenderWindowUISingleInheritance::RenderWindowUISingleInheritance() { +RenderWindowUISingleInheritance::RenderWindowUISingleInheritance() +{ this->ui = new Ui_RenderWindowUISingleInheritance; this->ui->setupUi(this); vtkNew<vtkNamedColors> colors; vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->ui->qvtkWidget->setRenderWindow(renderWindow); #else this->ui->qvtkWidget->SetRenderWindow(renderWindow); @@ -43,7 +48,7 @@ RenderWindowUISingleInheritance::RenderWindowUISingleInheritance() { renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData()); // VTK/Qt wedded -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer); this->ui->qvtkWidget->renderWindow()->SetWindowName( "RenderWindowUISingleInheritance"); @@ -56,4 +61,7 @@ RenderWindowUISingleInheritance::RenderWindowUISingleInheritance() { connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); } -void RenderWindowUISingleInheritance::slotExit() { qApp->exit(); } +void RenderWindowUISingleInheritance::slotExit() +{ + qApp->exit(); +} diff --git a/src/Cxx/Qt/ShareCameraQt.cxx b/src/Cxx/Qt/ShareCameraQt.cxx index 68756ad45898ff8d78c46200f51ca2986e201c7a..f0dc1fd394016c42ed47cdb166f4224ff68c4fe8 100644 --- a/src/Cxx/Qt/ShareCameraQt.cxx +++ b/src/Cxx/Qt/ShareCameraQt.cxx @@ -17,6 +17,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Constructor ShareCameraQt::ShareCameraQt() { @@ -26,7 +30,7 @@ ShareCameraQt::ShareCameraQt() vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft; vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetLeft->setRenderWindow(renderWindowLeft); this->qvtkWidgetRight->setRenderWindow(renderWindowRight); #else @@ -35,43 +39,37 @@ ShareCameraQt::ShareCameraQt() #endif // Sphere - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->Update(); - vtkSmartPointer<vtkPolyDataMapper> sphereMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto sphereMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); - vtkSmartPointer<vtkActor> sphereActor = vtkSmartPointer<vtkActor>::New(); + auto sphereActor = vtkSmartPointer<vtkActor>::New(); sphereActor->SetMapper(sphereMapper); sphereActor->GetProperty()->SetColor(colors->GetColor4d("Tomato").GetData()); // Cube - vtkSmartPointer<vtkCubeSource> cubeSource = - vtkSmartPointer<vtkCubeSource>::New(); + auto cubeSource = vtkSmartPointer<vtkCubeSource>::New(); cubeSource->Update(); - vtkSmartPointer<vtkPolyDataMapper> cubeMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto cubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); cubeMapper->SetInputConnection(cubeSource->GetOutputPort()); - vtkSmartPointer<vtkActor> cubeActor = vtkSmartPointer<vtkActor>::New(); + auto cubeActor = vtkSmartPointer<vtkActor>::New(); cubeActor->SetMapper(cubeMapper); cubeActor->GetProperty()->SetColor( colors->GetColor4d("MediumSeaGreen").GetData()); // VTK Renderer - vtkSmartPointer<vtkRenderer> leftRenderer = - vtkSmartPointer<vtkRenderer>::New(); + auto leftRenderer = vtkSmartPointer<vtkRenderer>::New(); leftRenderer->AddActor(sphereActor); leftRenderer->SetBackground(colors->GetColor3d("LightSteelBlue").GetData()); - vtkSmartPointer<vtkRenderer> rightRenderer = - vtkSmartPointer<vtkRenderer>::New(); + auto rightRenderer = vtkSmartPointer<vtkRenderer>::New(); // Add Actor to renderer rightRenderer->AddActor(cubeActor); rightRenderer->SetBackground(colors->GetColor3d("LightSteelBlue").GetData()); // VTK/Qt wedded -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer); this->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer); #else @@ -94,7 +92,7 @@ ShareCameraQt::ShareCameraQt() // Set up action signals and slots connect(this->actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetLeft->renderWindow()->AddObserver( vtkCommand::ModifiedEvent, this, &ShareCameraQt::ModifiedHandler); #else @@ -105,7 +103,7 @@ ShareCameraQt::ShareCameraQt() void ShareCameraQt::ModifiedHandler() { -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetRight->renderWindow()->Render(); #else this->qvtkWidgetRight->GetRenderWindow()->Render(); diff --git a/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx b/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx index 3643adc58d89f918f4f7ab31fc0ca0baa4f43e6c..edcc681f43fb65dfbe7c2b154121299163a779e8 100644 --- a/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx +++ b/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx @@ -15,6 +15,10 @@ #include <vtkSphereSource.h> #include <vtkVersion.h> +#if VTK_VERSION_NUMBER >= 89000000000ULL +#define VTK890 1 +#endif + // Constructor SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() { @@ -24,7 +28,7 @@ SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft; vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight; -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetLeft->setRenderWindow(renderWindowLeft); this->qvtkWidgetRight->setRenderWindow(renderWindowRight); #else @@ -33,8 +37,7 @@ SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() #endif // Sphere - vtkSmartPointer<vtkSphereSource> sphereSource = - vtkSmartPointer<vtkSphereSource>::New(); + auto sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->SetPhiResolution(30); sphereSource->SetThetaResolution(30); sphereSource->Update(); @@ -42,34 +45,29 @@ SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() sphereElev->SetInputConnection(sphereSource->GetOutputPort()); sphereElev->SetLowPoint(0, -1.0, 0); sphereElev->SetHighPoint(0, 1.0, 0); - vtkSmartPointer<vtkPolyDataMapper> sphereMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto sphereMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); sphereMapper->SetInputConnection(sphereElev->GetOutputPort()); - vtkSmartPointer<vtkActor> sphereActor = vtkSmartPointer<vtkActor>::New(); + auto sphereActor = vtkSmartPointer<vtkActor>::New(); sphereActor->SetMapper(sphereMapper); // Cube - vtkSmartPointer<vtkCubeSource> cubeSource = - vtkSmartPointer<vtkCubeSource>::New(); + auto cubeSource = vtkSmartPointer<vtkCubeSource>::New(); cubeSource->Update(); vtkNew<vtkElevationFilter> cubeElev; cubeElev->SetInputConnection(cubeSource->GetOutputPort()); cubeElev->SetLowPoint(0, -1.0, 0); cubeElev->SetHighPoint(0, 1.0, 0); - vtkSmartPointer<vtkPolyDataMapper> cubeMapper = - vtkSmartPointer<vtkPolyDataMapper>::New(); + auto cubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); cubeMapper->SetInputConnection(cubeElev->GetOutputPort()); - vtkSmartPointer<vtkActor> cubeActor = vtkSmartPointer<vtkActor>::New(); + auto cubeActor = vtkSmartPointer<vtkActor>::New(); cubeActor->SetMapper(cubeMapper); // VTK Renderer - vtkSmartPointer<vtkRenderer> leftRenderer = - vtkSmartPointer<vtkRenderer>::New(); + auto leftRenderer = vtkSmartPointer<vtkRenderer>::New(); leftRenderer->AddActor(sphereActor); leftRenderer->SetBackground(colors->GetColor3d("LightSteelBlue").GetData()); - vtkSmartPointer<vtkRenderer> rightRenderer = - vtkSmartPointer<vtkRenderer>::New(); + auto rightRenderer = vtkSmartPointer<vtkRenderer>::New(); // Add Actor to renderer rightRenderer->AddActor(cubeActor); @@ -80,7 +78,7 @@ SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() rightRenderer->GetActiveCamera()->Zoom(0.8); // VTK/Qt wedded -#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90 +#if VTK890 this->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer); this->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer); #else