diff --git a/CMake/CheckCxxStandard.cmake b/CMake/CheckCxxStandard.cmake new file mode 100644 index 00000000000..c96457a233d --- /dev/null +++ b/CMake/CheckCxxStandard.cmake @@ -0,0 +1,20 @@ +# Check if user has specified C++ 11 or newer +# using the old style flags. +# (this does not check Compiler's capability) + +string(FIND "${CMAKE_CXX_FLAGS}" "c++11" FLAG_FOUND) + +if (NOT FLAG_FOUND EQUAL -1) + MESSAGE(STATUS "CXX_STANDARD: Found c++11 in CMAKE_CXX_FLAGS") + string(REPLACE "-std=c++11" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + string(REPLACE "-std=gnu++11" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + set(CMAKE_CXX_STANDARD 11) + set(USING_CPP11 1) + +elseif ((CMAKE_CXX_STANDARD EQUAL 11) OR (CMAKE_CXX_STANDARD GREATER 11)) + MESSAGE(STATUS "CXX_STANDARD: User specified CMAKE_CXX_STANDARD " ${CMAKE_CXX_STANDARD}) + set(USING_CPP11 1) + +else() + MESSAGE(STATUS "CXX_STANDARD: default (C++98)") +endif() diff --git a/CMake/RequiresCxxVersion.cmake b/CMake/RequiresCxxVersion.cmake new file mode 100644 index 00000000000..9387def01cf --- /dev/null +++ b/CMake/RequiresCxxVersion.cmake @@ -0,0 +1,12 @@ +macro(Requires_CxxVersion example version_min) + if ((CMAKE_CXX_STANDARD EQUAL 11) OR (CMAKE_CXX_STANDARD GREATER 11)) + # Compile this example + else() + # If variable is not set or less than 11: + message(STATUS "VTKWikiExamples: ${example} requires C++${version_min} or newer") + string(REGEX REPLACE "[^;]*${example}.cxx" + "" ALL_FILES "${ALL_FILES}") + string(REGEX REPLACE "[^;]*${example}.ui" + "" ALL_UI_FILES "${ALL_UI_FILES}") + endif() +endmacro() diff --git a/CMake/RequiresVersion.cmake b/CMake/RequiresVersion.cmake index bb34c92b0bd..70b3e4cdd4e 100644 --- a/CMake/RequiresVersion.cmake +++ b/CMake/RequiresVersion.cmake @@ -3,5 +3,7 @@ macro(Requires_Version example version_min) message(STATUS "VTKWikiExamples: ${example} requires VTK version ${version_min} or newer but the current version is ${VTK_VERSION}") string(REGEX REPLACE "[^;]*${example}.cxx" "" ALL_FILES "${ALL_FILES}") + string(REGEX REPLACE "[^;]*${example}.ui" + "" ALL_UI_FILES "${ALL_UI_FILES}") endif() endmacro() diff --git a/CMakeLists.txt b/CMakeLists.txt index 46abc306943..272f911b240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(WikiExamples) +# VTK follows the C++03 standard +#set(CMAKE_CXX_STANDARD 11) # Compile examples that require C++11 + +# Check if C++11 was enabled in flags +include(${WikiExamples_SOURCE_DIR}/CMake/CheckCxxStandard.cmake) + # Display type of build set(_msg "VTKWikiExamples: Building VTKWikiExamples stand-alone") message(STATUS "${_msg}") diff --git a/src/Cxx/Developers/CMakeLists.txt b/src/Cxx/Developers/CMakeLists.txt index c9427fd4c4d..3b837e421af 100644 --- a/src/Cxx/Developers/CMakeLists.txt +++ b/src/Cxx/Developers/CMakeLists.txt @@ -15,14 +15,20 @@ else() endif() # +if (USING_CPP11) +# vtkTest.cxx needs C++11 add_executable(AlgorithmFilter AlgorithmFilter vtkTestAlgorithmFilter vtkTest) target_link_libraries(AlgorithmFilter ${VTK_LIBRARIES}) add_executable(AlgorithmSource AlgorithmSource vtkTestAlgorithmSource vtkTest1) target_link_libraries(AlgorithmSource ${VTK_LIBRARIES}) +endif() +if(NOT ${VTK_VERSION} VERSION_EQUAL "7.0.0") +# Does not compile with VTK 7.0.0 add_executable(ProgressReport ProgressReport.cxx vtkTestProgressReportFilter.cxx) target_link_libraries(ProgressReport ${VTK_LIBRARIES}) +endif() add_executable(FilterSelfProgress FilterSelfProgress.cxx vtkTestFilterSelfProgressFilter.cxx) target_link_libraries(FilterSelfProgress ${VTK_LIBRARIES}) @@ -36,5 +42,8 @@ target_link_libraries(GraphAlgorithmSource ${VTK_LIBRARIES}) add_executable(ImageAlgorithmFilter ImageAlgorithmFilter vtkImageAlgorithmFilter.cxx) target_link_libraries(ImageAlgorithmFilter ${VTK_LIBRARIES}) +if(NOT ${VTK_VERSION} VERSION_EQUAL "7.0.0") +# Does not compile with VTK 7.0.0 add_executable(MultipleInputPorts MultipleInputPorts vtkTestMultipleInputPortsFilter) target_link_libraries(MultipleInputPorts ${VTK_LIBRARIES}) +endif() diff --git a/src/Cxx/GeometricObjects/CMakeLists.txt b/src/Cxx/GeometricObjects/CMakeLists.txt index 47cbede8b6d..374f3a7930b 100644 --- a/src/Cxx/GeometricObjects/CMakeLists.txt +++ b/src/Cxx/GeometricObjects/CMakeLists.txt @@ -11,11 +11,33 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(Cell3DDemonstration 11 ALL_FILES) +Requires_CxxVersion(GeometricObjectsDemo 11 ALL_FILES) +Requires_CxxVersion(Hexahedron 11 ALL_FILES) +Requires_CxxVersion(IsoparametricCellsDemo 11 ALL_FILES) +Requires_CxxVersion(OrientedArrow 11 ALL_FILES) +Requires_CxxVersion(OrientedCylinder 11 ALL_FILES) +Requires_CxxVersion(ParametricKuenDemo 11 ALL_FILES) +Requires_CxxVersion(ParametricObjects 11 ALL_FILES) +Requires_CxxVersion(ParametricObjectsDemo2 11 ALL_FILES) +Requires_CxxVersion(ParametricObjectsDemo 11 ALL_FILES) +Requires_CxxVersion(ParametricSuperEllipsoidDemo 11 ALL_FILES) +Requires_CxxVersion(ParametricSuperToroidDemo 11 ALL_FILES) +Requires_CxxVersion(Plane 11 ALL_FILES) +Requires_CxxVersion(PolyLine1 11 ALL_FILES) +Requires_CxxVersion(SourceObjectsDemo 11 ALL_FILES) + include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) set(VERSION_MIN "7.0") Requires_Version(ParametricKuenDemo ${VERSION_MIN} ALL_FILES) Requires_Version(ParametricObjectsDemo2 ${VERSION_MIN} ALL_FILES) +Requires_Version(QuadraticHexahedronDemo "7.1.0" ALL_FILES) +Requires_Version(QuadraticTetraDemo "7.1.0" ALL_FILES) +Requires_Version(CellTypeSource "8.0.0" ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/GeometricObjects/CellTypeSource.cxx b/src/Cxx/GeometricObjects/CellTypeSource.cxx index 4aed64d13ca..8a5d2cc1a99 100644 --- a/src/Cxx/GeometricObjects/CellTypeSource.cxx +++ b/src/Cxx/GeometricObjects/CellTypeSource.cxx @@ -87,10 +87,10 @@ int main (int argc, char *argv[]) vtkSmartPointer rng = vtkSmartPointer::New(); rng->SetSeed(5070); // for testing - for (auto i = 0; i GetNumberOfPoints(); ++i) + for (vtkIdType i = 0; i GetNumberOfPoints(); ++i) { double perturbation[3]; - for (auto j = 0; j < 3; ++j) + for (vtkIdType j = 0; j < 3; ++j) { rng->Next(); perturbation[j] = rng->GetRangeValue(-0.1,0.1); @@ -103,12 +103,12 @@ int main (int argc, char *argv[]) } source->GetOutput()->SetPoints(points); - int numCells = source->GetOutput()->GetNumberOfCells(); + vtkIdType numCells = source->GetOutput()->GetNumberOfCells(); std::cout << "Number of cells: " << numCells << std::endl; vtkSmartPointer idArray = vtkSmartPointer::New(); idArray->SetNumberOfTuples(numCells); - for (auto i = 0; i < numCells; ++i) + for (vtkIdType i = 0; i < numCells; ++i) { idArray->InsertTuple1(i, i + 1); } diff --git a/src/Cxx/GeometricObjects/EllipticalCylinder.cxx b/src/Cxx/GeometricObjects/EllipticalCylinder.cxx index c94fd4de67a..d16f6c23418 100644 --- a/src/Cxx/GeometricObjects/EllipticalCylinder.cxx +++ b/src/Cxx/GeometricObjects/EllipticalCylinder.cxx @@ -1,7 +1,9 @@ #include #include +#include #include #include +#include #include #include #include diff --git a/src/Cxx/GeometricObjects/EllipticalCylinderDemo.cxx b/src/Cxx/GeometricObjects/EllipticalCylinderDemo.cxx index 098c66eb830..aded094a97e 100644 --- a/src/Cxx/GeometricObjects/EllipticalCylinderDemo.cxx +++ b/src/Cxx/GeometricObjects/EllipticalCylinderDemo.cxx @@ -1,8 +1,10 @@ #include #include #include +#include #include #include +#include #include #include #include diff --git a/src/Cxx/GeometricObjects/ParametricKuenDemo.cxx b/src/Cxx/GeometricObjects/ParametricKuenDemo.cxx index 6299bfd15ca..4bf499a6918 100644 --- a/src/Cxx/GeometricObjects/ParametricKuenDemo.cxx +++ b/src/Cxx/GeometricObjects/ParametricKuenDemo.cxx @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/GeometricObjects/Planes.cxx b/src/Cxx/GeometricObjects/Planes.cxx index 24a43408432..acb454892fd 100644 --- a/src/Cxx/GeometricObjects/Planes.cxx +++ b/src/Cxx/GeometricObjects/Planes.cxx @@ -24,9 +24,12 @@ int main(int, char* []) vtkSmartPointer::New(); // These are the two methods we will use. - std::vector titles{"Using frustum planes", "Using bounds"}; - std::vector> planes; - for (auto i = 0; i < titles.size(); ++i) + std::vector titles; + titles.push_back("Using frustum planes"); + titles.push_back("Using bounds"); + + std::vector > planes; + for (std::vector::size_type i = 0; i < titles.size(); ++i) { planes.push_back(vtkSmartPointer::New()); } @@ -66,15 +69,15 @@ int main(int, char* []) vtkSmartPointer::New(); iRen->SetRenderWindow(renWin); - std::vector> hulls; - std::vector> pds; - std::vector> mappers; - std::vector> actors; - std::vector> textMappers; - std::vector> textActors; - std::vector> renderers; + std::vector > hulls; + std::vector > pds; + std::vector > mappers; + std::vector > actors; + std::vector > textMappers; + std::vector > textActors; + std::vector > renderers; - for (auto i = 0; i < titles.size(); ++i) + for (std::vector::size_type i = 0; i < titles.size(); ++i) { hulls.push_back(vtkSmartPointer::New()); hulls[i]->SetPlanes(planes[i]); @@ -115,16 +118,16 @@ int main(int, char* []) } // Setup the viewports - auto xGridDimensions = 2; - auto yGridDimensions = 1; - auto rendererSize = 300; + const int xGridDimensions = 2; + const int yGridDimensions = 1; + const int rendererSize = 300; renWin->SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions); - for (auto row = 0; row < yGridDimensions; ++row) + for (int row = 0; row < yGridDimensions; ++row) { - for (auto col = 0; col < xGridDimensions; ++col) + for (int col = 0; col < xGridDimensions; ++col) { - auto index = row * xGridDimensions + col; + const int index = row * xGridDimensions + col; // (xmin, ymin, xmax, ymax) double viewport[4] = { diff --git a/src/Cxx/GeometricObjects/PlatonicSolids.cxx b/src/Cxx/GeometricObjects/PlatonicSolids.cxx index 31bf30e83b2..30fc6124a46 100644 --- a/src/Cxx/GeometricObjects/PlatonicSolids.cxx +++ b/src/Cxx/GeometricObjects/PlatonicSolids.cxx @@ -50,11 +50,11 @@ int main(int, char* []) lut->SetTableValue(18, 0.4, 0, 0); lut->SetTableValue(19, 0.4, 0, 0.4); - std::vector> mappers; - std::vector> actors; - std::vector> textMappers; - std::vector> textActors; - std::vector> renderers; + std::vector > mappers; + std::vector > actors; + std::vector > textMappers; + std::vector > textActors; + std::vector > renderers; // Create a common text property. vtkSmartPointer textProperty = @@ -71,10 +71,15 @@ int main(int, char* []) iRen->SetRenderWindow(renWin); // There are five platonic solids. - std::vector names{"Tetrahedron", "Cube", "Octahedron", - "Icosahedron", "Dodecahedron"}; - std::vector> PlatonicSolids; - for (auto i = 0; i < names.size(); ++i) + std::vector names; + names.push_back("Tetrahedron"); + names.push_back("Cube"); + names.push_back("Octahedron"); + names.push_back("Icosahedron"); + names.push_back("Dodecahedron"); + + std::vector > PlatonicSolids; + for (std::vector::size_type i = 0; i < names.size(); ++i) { PlatonicSolids.push_back(vtkSmartPointer::New()); PlatonicSolids[i]->SetSolidType(i); @@ -103,16 +108,16 @@ int main(int, char* []) } // Setup the viewports - auto xGridDimensions = 3; - auto yGridDimensions = 2; - auto rendererSize = 300; + const int xGridDimensions = 3; + const int yGridDimensions = 2; + const int rendererSize = 300; renWin->SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions); - for (auto row = 0; row < yGridDimensions; ++row) + for (int row = 0; row < yGridDimensions; ++row) { - for (auto col = 0; col < xGridDimensions; ++col) + for (int col = 0; col < xGridDimensions; ++col) { - auto index = row * xGridDimensions + col; + const int index = row * xGridDimensions + col; // (xmin, ymin, xmax, ymax) double viewport[4] = { diff --git a/src/Cxx/GeometricObjects/QuadraticHexahedron.cxx b/src/Cxx/GeometricObjects/QuadraticHexahedron.cxx index a4e2e3051fd..9612f06330f 100644 --- a/src/Cxx/GeometricObjects/QuadraticHexahedron.cxx +++ b/src/Cxx/GeometricObjects/QuadraticHexahedron.cxx @@ -104,10 +104,10 @@ vtkSmartPointer MakeQuadraticHexahedron() vtkSmartPointer::New(); points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints()); rng->SetSeed(5070); // for testing - for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i) + for (vtkIdType i = 0; i < aHexahedron->GetNumberOfPoints(); ++i) { double perturbation[3]; - for (auto j = 0; j < 3; ++j) + for (vtkIdType j = 0; j < 3; ++j) { rng->Next(); perturbation[j] = rng->GetRangeValue(-0.1, 0.1); diff --git a/src/Cxx/GeometricObjects/QuadraticHexahedronDemo.cxx b/src/Cxx/GeometricObjects/QuadraticHexahedronDemo.cxx index 03ab8085bcf..88bf4dc4cdd 100644 --- a/src/Cxx/GeometricObjects/QuadraticHexahedronDemo.cxx +++ b/src/Cxx/GeometricObjects/QuadraticHexahedronDemo.cxx @@ -247,10 +247,10 @@ vtkSmartPointer MakeQuadraticHexahedron() vtkSmartPointer::New(); points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints()); rng->SetSeed(5070); // for testing - for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i) + for (vtkIdType i = 0; i < aHexahedron->GetNumberOfPoints(); ++i) { double perturbation[3]; - for (auto j = 0; j < 3; ++j) + for (vtkIdType j = 0; j < 3; ++j) { rng->Next(); perturbation[j] = rng->GetRangeValue(-0.1, 0.1); diff --git a/src/Cxx/GeometricObjects/QuadraticTetra.cxx b/src/Cxx/GeometricObjects/QuadraticTetra.cxx index cbe0404396e..77942e8d35b 100644 --- a/src/Cxx/GeometricObjects/QuadraticTetra.cxx +++ b/src/Cxx/GeometricObjects/QuadraticTetra.cxx @@ -103,10 +103,10 @@ vtkSmartPointer MakeQuadraticTetra() vtkSmartPointer::New(); points->SetNumberOfPoints(aTetra->GetNumberOfPoints()); rng->SetSeed(5070); // for testing - for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i) + for (vtkIdType i = 0; i < aTetra->GetNumberOfPoints(); ++i) { double perturbation[3]; - for (auto j = 0; j < 3; ++j) + for (vtkIdType j = 0; j < 3; ++j) { rng->Next(); perturbation[j] = rng->GetRangeValue(-0.1, 0.1); diff --git a/src/Cxx/GeometricObjects/QuadraticTetraDemo.cxx b/src/Cxx/GeometricObjects/QuadraticTetraDemo.cxx index f55b1e7a3f7..6aa796cde67 100644 --- a/src/Cxx/GeometricObjects/QuadraticTetraDemo.cxx +++ b/src/Cxx/GeometricObjects/QuadraticTetraDemo.cxx @@ -247,10 +247,10 @@ vtkSmartPointer MakeQuadraticTetra() vtkSmartPointer::New(); points->SetNumberOfPoints(aTetra->GetNumberOfPoints()); rng->SetSeed(5070); // for testing - for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i) + for (vtkIdType i = 0; i < aTetra->GetNumberOfPoints(); ++i) { double perturbation[3]; - for (auto j = 0; j < 3; ++j) + for (vtkIdType j = 0; j < 3; ++j) { rng->Next(); perturbation[j] = rng->GetRangeValue(-0.2, 0.2); diff --git a/src/Cxx/HyperTreeGrid/HyperTreeGridSource.cxx b/src/Cxx/HyperTreeGrid/HyperTreeGridSource.cxx index 17be0d25e4e..b350afd7f98 100644 --- a/src/Cxx/HyperTreeGrid/HyperTreeGridSource.cxx +++ b/src/Cxx/HyperTreeGrid/HyperTreeGridSource.cxx @@ -9,6 +9,7 @@ #include #include #include +#include #include int main( int, char*[] ) diff --git a/src/Cxx/IO/CMakeLists.txt b/src/Cxx/IO/CMakeLists.txt index 358986e7743..df5623b1fab 100644 --- a/src/Cxx/IO/CMakeLists.txt +++ b/src/Cxx/IO/CMakeLists.txt @@ -13,6 +13,17 @@ file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresGitLfs.cmake) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(ImageWriter 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(VRMLImporterDemo "7.1.0" ALL_FILES) +Requires_Version(ExportPolyDataScene "8.0.0" ALL_FILES) +Requires_Version(ImportPolyDataScene "8.0.0" ALL_FILES) +Requires_Version(OBJImporter "8.0.0" ALL_FILES) +Requires_Version(ImageWriter "8.1.0" ALL_FILES) + Requires_GitLfs(DEMReader ALL_FILES) foreach(SOURCE_FILE ${ALL_FILES}) diff --git a/src/Cxx/IO/ImageWriter.cxx b/src/Cxx/IO/ImageWriter.cxx index a23275c2ade..b92b8960306 100644 --- a/src/Cxx/IO/ImageWriter.cxx +++ b/src/Cxx/IO/ImageWriter.cxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/src/Cxx/IO/ReadAllPolyDataTypesDemo.cxx b/src/Cxx/IO/ReadAllPolyDataTypesDemo.cxx index 1a364cc6c0d..31ae1f83931 100644 --- a/src/Cxx/IO/ReadAllPolyDataTypesDemo.cxx +++ b/src/Cxx/IO/ReadAllPolyDataTypesDemo.cxx @@ -51,7 +51,7 @@ int main (int argc, char *argv[]) // Setup render window vtkSmartPointer renderWindow = vtkSmartPointer::New(); - std::vector> renderers; + std::vector > renderers; for (int i = 1; i < argc; ++i) { vtkSmartPointer polyData = diff --git a/src/Cxx/ImageProcessing/CMakeLists.txt b/src/Cxx/ImageProcessing/CMakeLists.txt index 1a0fa60f4a9..e64b20a082d 100644 --- a/src/Cxx/ImageProcessing/CMakeLists.txt +++ b/src/Cxx/ImageProcessing/CMakeLists.txt @@ -12,6 +12,10 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(IsoSubsample 11 ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Images/CMakeLists.txt b/src/Cxx/Images/CMakeLists.txt index c396a31e1fc..a48d532c328 100644 --- a/src/Cxx/Images/CMakeLists.txt +++ b/src/Cxx/Images/CMakeLists.txt @@ -19,6 +19,14 @@ endif() # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(ImageWarp 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +set(VERSION_MIN "7.0") +Requires_Version(RGBToYIQ ${VERSION_MIN} ALL_FILES) + if(NOT VTK_USE_SYSTEM_FREETYPE) message(STATUS "VTKWikiExamples: ImageText requires VTK_USE_SYSTEM_FREETYPE and will not be built") string(REGEX REPLACE "[^;]*ImageText.cxx" diff --git a/src/Cxx/Images/ResizeImageDemo.cxx b/src/Cxx/Images/ResizeImageDemo.cxx index cf34d5c1355..26779f86d07 100644 --- a/src/Cxx/Images/ResizeImageDemo.cxx +++ b/src/Cxx/Images/ResizeImageDemo.cxx @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) vtkSmartPointer::New(); - std::vector> renderers; + std::vector > renderers; for (int i = -1; i <= 10; ++i) { vtkSmartPointer interpolator = diff --git a/src/Cxx/ImplicitFunctions/CMakeLists.txt b/src/Cxx/ImplicitFunctions/CMakeLists.txt index 5195db9643d..25335815aed 100644 --- a/src/Cxx/ImplicitFunctions/CMakeLists.txt +++ b/src/Cxx/ImplicitFunctions/CMakeLists.txt @@ -13,9 +13,15 @@ if("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 5.8) else() set(KIT_LIBS ${VTK_LIBRARIES}) endif() + # # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) + +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(ImplicitSphere 11 ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Interaction/CMakeLists.txt b/src/Cxx/Interaction/CMakeLists.txt index 7913c1a7000..732590e3a5d 100644 --- a/src/Cxx/Interaction/CMakeLists.txt +++ b/src/Cxx/Interaction/CMakeLists.txt @@ -16,6 +16,11 @@ endif() # # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) + +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(CallBack 11 ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Interaction/CallBack.cxx b/src/Cxx/Interaction/CallBack.cxx index de645309be9..6d52733db2e 100644 --- a/src/Cxx/Interaction/CallBack.cxx +++ b/src/Cxx/Interaction/CallBack.cxx @@ -18,6 +18,7 @@ We also add call data. #include #include #include +#include #include #include diff --git a/src/Cxx/Interaction/DoubleClick.cxx b/src/Cxx/Interaction/DoubleClick.cxx index a1daf079910..f85d19051ea 100644 --- a/src/Cxx/Interaction/DoubleClick.cxx +++ b/src/Cxx/Interaction/DoubleClick.cxx @@ -8,7 +8,7 @@ #include #include #include - +#include // vtkStandardNewMacro #include namespace diff --git a/src/Cxx/Interaction/MouseEvents.cxx b/src/Cxx/Interaction/MouseEvents.cxx index 8b9bfcaeea5..4a70f1c899e 100644 --- a/src/Cxx/Interaction/MouseEvents.cxx +++ b/src/Cxx/Interaction/MouseEvents.cxx @@ -9,6 +9,7 @@ #include #include #include +#include // vtkStandardNewMacro // Define interaction style class customMouseInteractorStyle : public vtkInteractorStyleTrackballCamera diff --git a/src/Cxx/Interaction/vtkTestFilter.h b/src/Cxx/Interaction/vtkTestFilter.h index 674923953ed..0d422f52806 100644 --- a/src/Cxx/Interaction/vtkTestFilter.h +++ b/src/Cxx/Interaction/vtkTestFilter.h @@ -53,7 +53,7 @@ int vtkTestFilter::RequestData(vtkInformation *vtkNotUsed(request), // vtkPolyData *output = vtkPolyData::SafeDownCast( // outInfo->Get(vtkDataObject::DATA_OBJECT())); - this->InvokeEvent(this->RefreshEvent, nullptr); + this->InvokeEvent(this->RefreshEvent, NULL); return 1; } diff --git a/src/Cxx/Medical/CMakeLists.txt b/src/Cxx/Medical/CMakeLists.txt index f9190a294e6..76de49c06a8 100644 --- a/src/Cxx/Medical/CMakeLists.txt +++ b/src/Cxx/Medical/CMakeLists.txt @@ -11,6 +11,17 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(MedicalDemo1 11 ALL_FILES) +Requires_CxxVersion(MedicalDemo2 11 ALL_FILES) +Requires_CxxVersion(MedicalDemo3 11 ALL_FILES) +Requires_CxxVersion(MedicalDemo4 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(MedicalDemo3 "7.1.0" ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresGitLfs.cmake) Requires_GitLfs(GenerateModelsFromLabels ALL_FILES) Requires_GitLfs(GenerateCubesFromLabels ALL_FILES) diff --git a/src/Cxx/Meshes/CMakeLists.txt b/src/Cxx/Meshes/CMakeLists.txt index c51f3df5b7b..e9537d7cec6 100644 --- a/src/Cxx/Meshes/CMakeLists.txt +++ b/src/Cxx/Meshes/CMakeLists.txt @@ -24,6 +24,8 @@ include(${WikiExamples_SOURCE_DIR}/CMake/RequiresModule.cmake) set(VERSION_MIN "6.0") Requires_Version(DeformPointSet ${VERSION_MIN} ALL_FILES) +Requires_Version(QuadricDecimation "7.1.0" ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Modelling/Bottle.cxx b/src/Cxx/Modelling/Bottle.cxx index 73a3a44d5d8..3f668d779fd 100644 --- a/src/Cxx/Modelling/Bottle.cxx +++ b/src/Cxx/Modelling/Bottle.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/Cxx/Modelling/CMakeLists.txt b/src/Cxx/Modelling/CMakeLists.txt index 645cb7c288f..7a990edda8c 100644 --- a/src/Cxx/Modelling/CMakeLists.txt +++ b/src/Cxx/Modelling/CMakeLists.txt @@ -13,6 +13,14 @@ file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresGitLfs.cmake) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(Finance 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(Delaunay3D "7.1.0" ALL_FILES) +Requires_Version(Delaunay3DDemo "7.1.0" ALL_FILES) + Requires_GitLfs(ExtractLargestIsosurface ALL_FILES) foreach(SOURCE_FILE ${ALL_FILES}) diff --git a/src/Cxx/Modelling/DelaunayMesh.cxx b/src/Cxx/Modelling/DelaunayMesh.cxx index fe5d1e02d64..79f4e8424b0 100644 --- a/src/Cxx/Modelling/DelaunayMesh.cxx +++ b/src/Cxx/Modelling/DelaunayMesh.cxx @@ -20,6 +20,7 @@ We create a fancy image of a 2D Delaunay triangulation. Points are #include #include #include +#include #include #include @@ -35,7 +36,7 @@ int main(int, char *[]) randomSequence->SetSeed(1); double p1; double p2; - for (auto i = 0; i < 50; ++i) + for (vtkIdType i = 0; i < 50; ++i) { p1 = randomSequence->GetValue(); randomSequence->Next(); diff --git a/src/Cxx/Modelling/FinanceFieldData.cxx b/src/Cxx/Modelling/FinanceFieldData.cxx index b8d24eb699c..e019e269bfd 100644 --- a/src/Cxx/Modelling/FinanceFieldData.cxx +++ b/src/Cxx/Modelling/FinanceFieldData.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/Cxx/Modelling/Spring.cxx b/src/Cxx/Modelling/Spring.cxx index c6b9d0b5e23..0de7baab070 100644 --- a/src/Cxx/Modelling/Spring.cxx +++ b/src/Cxx/Modelling/Spring.cxx @@ -11,6 +11,7 @@ #include #include #include +#include int main (int, char *[]) { diff --git a/src/Cxx/Points/CMakeLists.txt b/src/Cxx/Points/CMakeLists.txt index 585a3c06094..3811b6ceb71 100644 --- a/src/Cxx/Points/CMakeLists.txt +++ b/src/Cxx/Points/CMakeLists.txt @@ -20,20 +20,21 @@ file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresModule.cmake) - -set(VERSION_MIN "7.0") -Requires_Version(DensifyPoints ${VERSION_MIN} ALL_FILES) +set(VERSION_MIN "7.1.0") Requires_Version(ExtractClusters ${VERSION_MIN} ALL_FILES) Requires_Version(ExtractPointsDemo ${VERSION_MIN} ALL_FILES) Requires_Version(ExtractSurface ${VERSION_MIN} ALL_FILES) Requires_Version(ExtractSurfaceDemo ${VERSION_MIN} ALL_FILES) Requires_Version(FitImplicitFunction ${VERSION_MIN} ALL_FILES) -Requires_Version(MaskPointsFilter ${VERSION_MIN} ALL_FILES) Requires_Version(NormalEstimation ${VERSION_MIN} ALL_FILES) -Requires_Version(PointOccupancy ${VERSION_MIN} ALL_FILES) Requires_Version(RadiusOutlierRemoval ${VERSION_MIN} ALL_FILES) Requires_Version(SignedDistance ${VERSION_MIN} ALL_FILES) -Requires_Version(UnsignedDistance ${VERSION_MIN} ALL_FILES) + +Requires_Version(DensifyPoints "8.0.0" ALL_FILES) +Requires_Version(MaskPointsFilter "8.0.0" ALL_FILES) +Requires_Version(PointOccupancy "8.0.0" ALL_FILES) +Requires_Version(UnsignedDistance "8.0.0" ALL_FILES) + Requires_Module(PowercrustExtractSurface Powercrust) Requires_Module(PoissonExtractSurface PoissonReconstruction) Requires_Module(CompareExtractSurface Powercrust) diff --git a/src/Cxx/Points/CompareExtractSurface.cxx b/src/Cxx/Points/CompareExtractSurface.cxx index 4b3ad40a0a8..d0e99751e15 100644 --- a/src/Cxx/Points/CompareExtractSurface.cxx +++ b/src/Cxx/Points/CompareExtractSurface.cxx @@ -47,7 +47,7 @@ vtkSmartPointer MakeExtractSurface(vtkPolyData *); vtkSmartPointer MakePoissonExtractSurface(vtkPolyData *); vtkSmartPointer MakePowercrustExtractSurface(vtkPolyData *); void MakeViewportGrid( - std::vector> &renderers, + std::vector > &renderers, unsigned int renderersize, unsigned int xGridDimensions, unsigned int yGridDimensions); @@ -72,7 +72,7 @@ int main (int argc, char *argv[]) surfaceObjects.push_back(MakePoissonExtractSurface(polyData.GetPointer())); surfaceObjects.push_back(MakePowercrustExtractSurface(polyData.GetPointer())); - std::vector> renderers; + std::vector > renderers; // One camera for all vtkSmartPointer camera = @@ -339,7 +339,7 @@ vtkSmartPointer MakePowercrustExtractSurface(vtkPolyData * } void MakeViewportGrid( - std::vector> &renderers, + std::vector > &renderers, unsigned int rendererSize, unsigned int xGridDimensions, unsigned int yGridDimensions) diff --git a/src/Cxx/PolyData/CMakeLists.txt b/src/Cxx/PolyData/CMakeLists.txt index c3b76f5aa8e..671b62d8288 100644 --- a/src/Cxx/PolyData/CMakeLists.txt +++ b/src/Cxx/PolyData/CMakeLists.txt @@ -14,6 +14,7 @@ file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) Requires_Version(Curvatures "6.0.0" ALL_FILES) +Requires_Version(LoopBooleanPolyDataFilter "8.1.0" ALL_FILES) foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) diff --git a/src/Cxx/PolyData/KochanekSplineDemo.cxx b/src/Cxx/PolyData/KochanekSplineDemo.cxx index 7fe21d48050..0756b18a7fd 100644 --- a/src/Cxx/PolyData/KochanekSplineDemo.cxx +++ b/src/Cxx/PolyData/KochanekSplineDemo.cxx @@ -25,6 +25,7 @@ #include #include #include +#include namespace { diff --git a/src/Cxx/Qt/BorderWidgetQt.cxx b/src/Cxx/Qt/BorderWidgetQt.cxx index 120bd7ab82e..46003f1a326 100644 --- a/src/Cxx/Qt/BorderWidgetQt.cxx +++ b/src/Cxx/Qt/BorderWidgetQt.cxx @@ -33,26 +33,54 @@ BorderWidgetQt::BorderWidgetQt() { this->setupUi(this); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindow; +#else + vtkSmartPointer renderWindow = vtkSmartPointer::New(); +#endif this->qvtkWidget->SetRenderWindow(renderWindow); // Sphere +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereSource; +#else + vtkSmartPointer sphereSource = vtkSmartPointer::New(); +#endif sphereSource->Update(); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereMapper; +#else + vtkSmartPointer sphereMapper = vtkSmartPointer::New(); +#endif sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor; +#else + vtkSmartPointer sphereActor = vtkSmartPointer::New(); +#endif sphereActor->SetMapper(sphereMapper); // VTK Renderer +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew renderer; +#else + vtkSmartPointer renderer = vtkSmartPointer::New(); +#endif renderer->AddActor(sphereActor); // Connect VTK with Qt this->qvtkWidget->GetRenderWindow()->AddRenderer(renderer); // Add a border widget to the right renderer +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew bw; +#else + vtkSmartPointer bw = vtkSmartPointer::New(); +#endif + this->BorderWidget = bw; this->BorderWidget->SetInteractor(this->qvtkWidget->GetInteractor()); this->BorderWidget->On(); diff --git a/src/Cxx/Qt/CMakeLists.txt b/src/Cxx/Qt/CMakeLists.txt index 7d859d79313..da72bce3c45 100644 --- a/src/Cxx/Qt/CMakeLists.txt +++ b/src/Cxx/Qt/CMakeLists.txt @@ -39,8 +39,24 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) file(GLOB ALL_UI_FILES *.ui) file(GLOB ALL_FILES *.cxx) +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresModule.cmake) +set(VERSION_MIN "8.0.0") +Requires_Version(BorderWidgetQt ${VERSION_MIN} ALL_FILES) +Requires_Version(BorderWidgetQtDriver ${VERSION_MIN} ALL_FILES) +Requires_Version(EventQtSlotConnect ${VERSION_MIN} ALL_FILES) +Requires_Version(EventQtSlotConnectDriver ${VERSION_MIN} ALL_FILES) +Requires_Version(RenderWindowNoUiFile ${VERSION_MIN} ALL_FILES) +Requires_Version(RenderWindowUIMultipleInheritance ${VERSION_MIN} ALL_FILES) +Requires_Version(RenderWindowUIMultipleInheritanceDriver ${VERSION_MIN} ALL_FILES) +Requires_Version(RenderWindowUISingleInheritance ${VERSION_MIN} ALL_FILES) +Requires_Version(RenderWindowUISingleInheritanceDriver ${VERSION_MIN} ALL_FILES) +Requires_Version(ShareCameraQt ${VERSION_MIN} ALL_FILES) +Requires_Version(ShareCameraQtDriver ${VERSION_MIN} ALL_FILES) +Requires_Version(SideBySideRenderWindowsQt ${VERSION_MIN} ALL_FILES) +Requires_Version(SideBySideRenderWindowsQtDriver ${VERSION_MIN} ALL_FILES) + Requires_Module(ShareCameraQt vtkViewsQt) Requires_Module(ShareCameraQtDriver vtkViewsQt) Requires_Module(SideBySideRenderWindowsQt vtkViewsQt) diff --git a/src/Cxx/Qt/EventQtSlotConnect.cxx b/src/Cxx/Qt/EventQtSlotConnect.cxx index a1f55c22903..1ff991c085c 100644 --- a/src/Cxx/Qt/EventQtSlotConnect.cxx +++ b/src/Cxx/Qt/EventQtSlotConnect.cxx @@ -14,23 +14,50 @@ EventQtSlotConnect::EventQtSlotConnect() { this->setupUi(this); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindow; +#else + vtkSmartPointer renderWindow = vtkSmartPointer::New(); +#endif this->qvtkWidget->SetRenderWindow(renderWindow); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew slotConnector; +#else + vtkSmartPointer slotConnector = vtkSmartPointer::New(); +#endif this->Connections = slotConnector; // Sphere +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereSource; +#else + vtkSmartPointer sphereSource = vtkSmartPointer::New(); +#endif sphereSource->Update(); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereMapper; +#else + vtkSmartPointer sphereMapper = vtkSmartPointer::New(); +#endif sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor; +#else + vtkSmartPointer sphereActor = vtkSmartPointer::New(); +#endif sphereActor->SetMapper(sphereMapper); // VTK Renderer +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew renderer; +#else + vtkSmartPointer renderer = vtkSmartPointer::New(); +#endif renderer->AddActor(sphereActor); this->qvtkWidget->GetRenderWindow()->AddRenderer(renderer); diff --git a/src/Cxx/Qt/RenderWindowNoUiFile.cxx b/src/Cxx/Qt/RenderWindowNoUiFile.cxx index a41cb37621b..e15465b9eb3 100644 --- a/src/Cxx/Qt/RenderWindowNoUiFile.cxx +++ b/src/Cxx/Qt/RenderWindowNoUiFile.cxx @@ -19,20 +19,42 @@ int main(int argc, char** argv) QApplication app(argc, argv); QVTKOpenGLWidget widget; + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindow; +#else + vtkSmartPointer renderWindow = vtkSmartPointer::New(); +#endif widget.SetRenderWindow(renderWindow); widget.resize( 256, 256 ); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereSource; +#else + vtkSmartPointer sphereSource = vtkSmartPointer::New(); +#endif +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereMapper; +#else + vtkSmartPointer sphereMapper = vtkSmartPointer::New(); +#endif sphereMapper->SetInputConnection( sphereSource->GetOutputPort() ); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor; +#else + vtkSmartPointer sphereActor = vtkSmartPointer::New(); +#endif sphereActor->SetMapper( sphereMapper ); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew renderer; +#else + vtkSmartPointer renderer = vtkSmartPointer::New(); +#endif renderer->AddActor( sphereActor ); widget.GetRenderWindow()->AddRenderer( renderer ); diff --git a/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx b/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx index 6c51cf63265..5d65cf56d16 100644 --- a/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx +++ b/src/Cxx/Qt/RenderWindowUIMultipleInheritance.cxx @@ -12,7 +12,12 @@ RenderWindowUIMultipleInheritance::RenderWindowUIMultipleInheritance() { this->setupUi(this); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindow; +#else + vtkSmartPointer renderWindow = vtkSmartPointer::New(); +#endif qvtkWidget->SetRenderWindow(renderWindow); // Sphere diff --git a/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx b/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx index 736513ffcbc..412b0dd6ae8 100644 --- a/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx +++ b/src/Cxx/Qt/RenderWindowUISingleInheritance.cxx @@ -17,20 +17,42 @@ RenderWindowUISingleInheritance::RenderWindowUISingleInheritance() this->ui = new Ui_RenderWindowUISingleInheritance; this->ui->setupUi(this); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindow; +#else + vtkSmartPointer renderWindow = vtkSmartPointer::New(); +#endif this->ui->qvtkWidget->SetRenderWindow(renderWindow); - // Sphere +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereSource; +#else + vtkSmartPointer sphereSource = vtkSmartPointer::New(); +#endif sphereSource->Update(); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereMapper; +#else + vtkSmartPointer sphereMapper = vtkSmartPointer::New(); +#endif sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor; +#else + vtkSmartPointer sphereActor = vtkSmartPointer::New(); +#endif sphereActor->SetMapper(sphereMapper); // VTK Renderer +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew renderer; +#else + vtkSmartPointer renderer = vtkSmartPointer::New(); +#endif renderer->AddActor(sphereActor); // VTK/Qt wedded diff --git a/src/Cxx/Qt/ShareCameraQt.cxx b/src/Cxx/Qt/ShareCameraQt.cxx index 4b370041459..74b573bdb5b 100644 --- a/src/Cxx/Qt/ShareCameraQt.cxx +++ b/src/Cxx/Qt/ShareCameraQt.cxx @@ -18,12 +18,17 @@ ShareCameraQt::ShareCameraQt() { this->setupUi(this); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindowLeft; - this->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft); vtkNew renderWindowRight; +#else + vtkSmartPointer renderWindowLeft = vtkSmartPointer::New(); + vtkSmartPointer renderWindowRight = vtkSmartPointer::New(); +#endif + this->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft); this->qvtkWidgetRight->SetRenderWindow(renderWindowRight); - // Sphere vtkSmartPointer sphereSource = vtkSmartPointer::New(); sphereSource->Update(); diff --git a/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx b/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx index 20d4626a79a..e717f96c531 100644 --- a/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx +++ b/src/Cxx/Qt/SideBySideRenderWindowsQt.cxx @@ -16,13 +16,17 @@ SideBySideRenderWindowsQt::SideBySideRenderWindowsQt() { this->setupUi(this); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew renderWindowLeft; - this->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft); - vtkNew renderWindowRight; +#else + vtkSmartPointer renderWindowLeft = vtkSmartPointer::New(); + vtkSmartPointer renderWindowRight = vtkSmartPointer::New(); +#endif + this->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft); this->qvtkWidgetRight->SetRenderWindow(renderWindowRight); - // Sphere vtkSmartPointer sphereSource = vtkSmartPointer::New(); diff --git a/src/Cxx/Qt/SideBySideRenderWindowsQtDriver.cxx b/src/Cxx/Qt/SideBySideRenderWindowsQtDriver.cxx index 1a8d68bdd42..97e900e574d 100644 --- a/src/Cxx/Qt/SideBySideRenderWindowsQtDriver.cxx +++ b/src/Cxx/Qt/SideBySideRenderWindowsQtDriver.cxx @@ -1,7 +1,7 @@ #include #include +#include -#include "QVTKOpenGLWidget.h" #include "SideBySideRenderWindowsQt.h" int main( int argc, char** argv ) diff --git a/src/Cxx/RenderMan/CMakeLists.txt b/src/Cxx/RenderMan/CMakeLists.txt index c789373e058..98109654bad 100644 --- a/src/Cxx/RenderMan/CMakeLists.txt +++ b/src/Cxx/RenderMan/CMakeLists.txt @@ -15,7 +15,7 @@ endif() file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) -set(VERSION_MIN "6.0") +set(VERSION_MIN "7.0") Requires_Version(PolyDataRIB ${VERSION_MIN} ALL_FILES) foreach(SOURCE_FILE ${ALL_FILES}) diff --git a/src/Cxx/Rendering/CMakeLists.txt b/src/Cxx/Rendering/CMakeLists.txt index c9f78bdde49..dd980959e32 100644 --- a/src/Cxx/Rendering/CMakeLists.txt +++ b/src/Cxx/Rendering/CMakeLists.txt @@ -10,6 +10,26 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) + +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(CameraBlur 11 ALL_FILES) +Requires_CxxVersion(Model 11 ALL_FILES) +Requires_CxxVersion(MotionBlur 11 ALL_FILES) +Requires_CxxVersion(Rotations 11 ALL_FILES) +Requires_CxxVersion(RotationsA 11 ALL_FILES) +Requires_CxxVersion(RotationsB 11 ALL_FILES) +Requires_CxxVersion(RotationsC 11 ALL_FILES) +Requires_CxxVersion(RotationsD 11 ALL_FILES) +Requires_CxxVersion(SpecularSpheres 11 ALL_FILES) +Requires_CxxVersion(WalkCow 11 ALL_FILES) +Requires_CxxVersion(WalkCowA 11 ALL_FILES) +Requires_CxxVersion(WalkCowB 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(StippledLine "7.1.0" ALL_FILES) +Requires_Version(MotionBlur "8.1.0" ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Rendering/CameraBlur.cxx b/src/Cxx/Rendering/CameraBlur.cxx index 6ad1d607886..da4341a23c6 100644 --- a/src/Cxx/Rendering/CameraBlur.cxx +++ b/src/Cxx/Rendering/CameraBlur.cxx @@ -8,51 +8,105 @@ #include #include #include +#include #include #include int main(int, char* []) { - vtkNew colors; +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ + vtkNew colors; +#else + vtkSmartPointer colors = vtkSmartPointer::New(); +#endif // Set the background color. std::array bkg{{26, 51, 102, 255}}; colors->SetColor("Bkg", bkg.data()); // Create the rendering objects. +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew ren1; vtkNew renWin; - renWin->AddRenderer(ren1); vtkNew iren; +#else + vtkSmartPointer ren1 = vtkSmartPointer::New(); + vtkSmartPointer renWin = vtkSmartPointer::New(); + vtkSmartPointer iren = vtkSmartPointer::New(); +#endif + renWin->AddRenderer(ren1); iren->SetRenderWindow(renWin); // Create the pipeline, ball and spikes. +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphere; +#else + vtkSmartPointer sphere = vtkSmartPointer::New(); +#endif sphere->SetPhiResolution(7); sphere->SetThetaResolution(7); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereMapper; +#else + vtkSmartPointer sphereMapper = vtkSmartPointer::New(); +#endif sphereMapper->SetInputConnection(sphere->GetOutputPort()); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor; +#else + vtkSmartPointer sphereActor = vtkSmartPointer::New(); +#endif sphereActor->SetMapper(sphereMapper); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew sphereActor2; +#else + vtkSmartPointer sphereActor2 = vtkSmartPointer::New(); +#endif sphereActor2->SetMapper(sphereMapper); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew cone; +#else + vtkSmartPointer cone = vtkSmartPointer::New(); +#endif cone->SetResolution(5); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew glyph; +#else + vtkSmartPointer glyph = vtkSmartPointer::New(); +#endif glyph->SetInputConnection(sphere->GetOutputPort()); glyph->SetSourceConnection(cone->GetOutputPort()); glyph->SetVectorModeToUseNormal(); glyph->SetScaleModeToScaleByVector(); glyph->SetScaleFactor(0.25); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew spikeMapper; +#else + vtkSmartPointer spikeMapper = vtkSmartPointer::New(); +#endif spikeMapper->SetInputConnection(glyph->GetOutputPort()); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew spikeActor; +#else + vtkSmartPointer spikeActor = vtkSmartPointer::New(); +#endif spikeActor->SetMapper(spikeMapper); + +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew spikeActor2; +#else + vtkSmartPointer spikeActor2 = vtkSmartPointer::New(); +#endif spikeActor2->SetMapper(spikeMapper); - spikeActor->SetPosition(0, 0.7, 0); sphereActor->SetPosition(0, 0.7, 0); spikeActor2->SetPosition(0, -1.0, -10); diff --git a/src/Cxx/Rendering/Cone3.cxx b/src/Cxx/Rendering/Cone3.cxx index 9fca36c12d1..a2bdeae11a0 100644 --- a/src/Cxx/Rendering/Cone3.cxx +++ b/src/Cxx/Rendering/Cone3.cxx @@ -13,7 +13,7 @@ #include #include #include - +#include int main(int, char* []) { diff --git a/src/Cxx/Rendering/Cone4.cxx b/src/Cxx/Rendering/Cone4.cxx index 0f393b85815..e6863643fd8 100644 --- a/src/Cxx/Rendering/Cone4.cxx +++ b/src/Cxx/Rendering/Cone4.cxx @@ -14,7 +14,7 @@ #include #include #include - +#include int main(int, char* []) { diff --git a/src/Cxx/Rendering/FlatVersusGouraud.cxx b/src/Cxx/Rendering/FlatVersusGouraud.cxx index 50327c6c9ce..d1919a21bd1 100644 --- a/src/Cxx/Rendering/FlatVersusGouraud.cxx +++ b/src/Cxx/Rendering/FlatVersusGouraud.cxx @@ -13,7 +13,7 @@ #include #include #include - +#include #include namespace @@ -34,7 +34,7 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - std::vector> renderers; + std::vector > renderers; // Create the 8 renderers vtkSmartPointer flatSphereRenderer = diff --git a/src/Cxx/Rendering/Mace.cxx b/src/Cxx/Rendering/Mace.cxx index ed70095705a..be9dcc59bfb 100644 --- a/src/Cxx/Rendering/Mace.cxx +++ b/src/Cxx/Rendering/Mace.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include int main( int, char *[] ) diff --git a/src/Cxx/Rendering/Rainbow.cxx b/src/Cxx/Rendering/Rainbow.cxx index a148aea5947..7c949cc1e6f 100644 --- a/src/Cxx/Rendering/Rainbow.cxx +++ b/src/Cxx/Rendering/Rainbow.cxx @@ -43,7 +43,7 @@ int main (int argc, char *argv[]) vtkStructuredGrid *pl3dOutput = vtkStructuredGrid::SafeDownCast(pl3d->GetOutput()->GetBlock(0)); - std::vector> renderers; + std::vector > renderers; // Create the 4 renderers vtkSmartPointer grayScaleRenderer = diff --git a/src/Cxx/Rendering/Rotations.cxx b/src/Cxx/Rendering/Rotations.cxx index 67848e50beb..5d68f74e9bb 100644 --- a/src/Cxx/Rendering/Rotations.cxx +++ b/src/Cxx/Rendering/Rotations.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/Rendering/StripFran.cxx b/src/Cxx/Rendering/StripFran.cxx index f1569d9ca6a..7d2f173765c 100644 --- a/src/Cxx/Rendering/StripFran.cxx +++ b/src/Cxx/Rendering/StripFran.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include int main (int argc, char *argv[]) diff --git a/src/Cxx/Rendering/TransformSphere.cxx b/src/Cxx/Rendering/TransformSphere.cxx index ab87b356958..c7d16ea740e 100644 --- a/src/Cxx/Rendering/TransformSphere.cxx +++ b/src/Cxx/Rendering/TransformSphere.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/Shaders/BozoShaderDemo.cxx b/src/Cxx/Shaders/BozoShaderDemo.cxx index 05b4845c3b5..fa65b56a519 100644 --- a/src/Cxx/Shaders/BozoShaderDemo.cxx +++ b/src/Cxx/Shaders/BozoShaderDemo.cxx @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) // textProperty->SetJustificationToCentered(); textProperty->SetColor(0.3, 0.3, 0.3); - std::vector> renderers; + std::vector > renderers; for (int i = 2; i < argc; ++i) { std::cout << "Reading file: " << argv[i] << std::endl; diff --git a/src/Cxx/Shaders/CMakeLists.txt b/src/Cxx/Shaders/CMakeLists.txt index d7f4a72dbe3..1ec74212f2e 100644 --- a/src/Cxx/Shaders/CMakeLists.txt +++ b/src/Cxx/Shaders/CMakeLists.txt @@ -9,6 +9,20 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) + +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(SpatterShader 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(BozoShader "8.0.0" ALL_FILES) +Requires_Version(BozoShaderDemo "8.0.0" ALL_FILES) +Requires_Version(MarbleShader "8.0.0" ALL_FILES) +Requires_Version(MarbleShaderDemo "8.0.0" ALL_FILES) +Requires_Version(ColorByNormal "8.0.0" ALL_FILES) +Requires_Version(CubeMap "8.1.0" ALL_FILES) +Requires_Version(SphereMap "8.2.0" ALL_FILES) + foreach(SOURCE_FILE ${ALL_FILES}) string(REPLACE ".cxx" "" TMP ${SOURCE_FILE}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" EXAMPLE ${TMP}) diff --git a/src/Cxx/Shaders/SpatterShader.cxx b/src/Cxx/Shaders/SpatterShader.cxx index aba38ffb433..807898a83f7 100644 --- a/src/Cxx/Shaders/SpatterShader.cxx +++ b/src/Cxx/Shaders/SpatterShader.cxx @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/src/Cxx/StructuredGrid/SGrid.cxx b/src/Cxx/StructuredGrid/SGrid.cxx index 5cc5c4809f1..58bb283f87c 100644 --- a/src/Cxx/StructuredGrid/SGrid.cxx +++ b/src/Cxx/StructuredGrid/SGrid.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include int main(int, char *[]) diff --git a/src/Cxx/Texture/AnimateVectors.cxx b/src/Cxx/Texture/AnimateVectors.cxx index a346b24fbb4..233ef05c04d 100644 --- a/src/Cxx/Texture/AnimateVectors.cxx +++ b/src/Cxx/Texture/AnimateVectors.cxx @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/Texture/CMakeLists.txt b/src/Cxx/Texture/CMakeLists.txt index 531a93ee31d..42ce40f8d33 100644 --- a/src/Cxx/Texture/CMakeLists.txt +++ b/src/Cxx/Texture/CMakeLists.txt @@ -11,6 +11,10 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # Build all .cxx files in the directory file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(TextureThreshold 11 ALL_FILES) + include(${WikiExamples_SOURCE_DIR}/CMake/RequiresGitLfs.cmake) foreach(SOURCE_FILE ${ALL_FILES}) diff --git a/src/Cxx/Texture/TexturePlane.cxx b/src/Cxx/Texture/TexturePlane.cxx index ed66e3c55a0..288da0d8453 100644 --- a/src/Cxx/Texture/TexturePlane.cxx +++ b/src/Cxx/Texture/TexturePlane.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include // // This simple example shows how to do basic texture mapping. diff --git a/src/Cxx/Texture/TextureThreshold.cxx b/src/Cxx/Texture/TextureThreshold.cxx index 415c6796c28..cfd5afde179 100644 --- a/src/Cxx/Texture/TextureThreshold.cxx +++ b/src/Cxx/Texture/TextureThreshold.cxx @@ -22,6 +22,7 @@ shown. #include #include #include +#include #include #include #include diff --git a/src/Cxx/UnstructuredGrid/UGrid.cxx b/src/Cxx/UnstructuredGrid/UGrid.cxx index 44eacf13af4..65ee1101c8d 100644 --- a/src/Cxx/UnstructuredGrid/UGrid.cxx +++ b/src/Cxx/UnstructuredGrid/UGrid.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include int main( int, char *[] ) diff --git a/src/Cxx/Utilities/SaveSceneToFile.cxx b/src/Cxx/Utilities/SaveSceneToFile.cxx index 94304860b11..892ccf48a86 100644 --- a/src/Cxx/Utilities/SaveSceneToFile.cxx +++ b/src/Cxx/Utilities/SaveSceneToFile.cxx @@ -100,7 +100,9 @@ void SaveSceneToFile(std::string fileName, // Position, orientation, origin, scale, usrmatrix, usertransform //Camera // FocalPoint, Position, ViewUp, ViewAngle, ClippingRange - std::ofstream saveFile(fileName, std::ofstream::out); + + //std::ofstream saveFile(fileName, std::ofstream::out); // C++11 + std::ofstream saveFile(fileName.c_str()); // default is ios::out double vector[3]; double scalar; @@ -136,7 +138,8 @@ void RestoreSceneFromFile(std::string fileName, vtkActor * /* actor */, vtkCamera *camera) { - std::ifstream saveFile(fileName); + //std::ifstream saveFile(fileName); // C++11 + std::ifstream saveFile(fileName.c_str()); std::string line; vtksys::RegularExpression reCP("^Camera:Position"); diff --git a/src/Cxx/Utilities/ShareCamera.cxx b/src/Cxx/Utilities/ShareCamera.cxx index e9e2b4380e5..9ece3c7dda5 100644 --- a/src/Cxx/Utilities/ShareCamera.cxx +++ b/src/Cxx/Utilities/ShareCamera.cxx @@ -24,7 +24,7 @@ int main(int, char *[]) double ymins[4] = {0,0,.5,.5}; double ymaxs[4]= {0.5,0.5,1,1}; - vtkCamera* camera = nullptr; + vtkCamera* camera = NULL; for(unsigned i = 0; i < 4; i++) { diff --git a/src/Cxx/Visualization/AlphaFrequency.cxx b/src/Cxx/Visualization/AlphaFrequency.cxx index 47b0f00f3e2..5330025f56f 100644 --- a/src/Cxx/Visualization/AlphaFrequency.cxx +++ b/src/Cxx/Visualization/AlphaFrequency.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/Cxx/Visualization/Blow.cxx b/src/Cxx/Visualization/Blow.cxx index 63c08bfc4a4..570267a8054 100644 --- a/src/Cxx/Visualization/Blow.cxx +++ b/src/Cxx/Visualization/Blow.cxx @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) } // Default is to display all ten frames. - auto dataPoint = -1; + int dataPoint = -1; std::string fileName = argv[1]; if (argc > 2) { @@ -53,7 +53,7 @@ int main(int argc, char* argv[]) std::vector thickness; std::vector displacement; - for (auto i = 0; i < 10; ++i) + for (int i = 0; i < 10; ++i) { std::ostringstream os; os << i; @@ -62,26 +62,26 @@ int main(int argc, char* argv[]) os.str(""); } - std::vector> reader; - std::vector> warp; - std::vector> connect; - std::vector> mold; - std::vector> moldMapper; - std::vector> moldActor; - std::vector> connect2; - std::vector> parison; - std::vector> normals2; - std::vector> parisonMapper; - std::vector> parisonActor; - std::vector> cf; - std::vector> contourMapper; - std::vector> contours; - std::vector> ren; + std::vector > reader; + std::vector > warp; + std::vector > connect; + std::vector > mold; + std::vector > moldMapper; + std::vector > moldActor; + std::vector > connect2; + std::vector > parison; + std::vector > normals2; + std::vector > parisonMapper; + std::vector > parisonActor; + std::vector > cf; + std::vector > contourMapper; + std::vector > contours; + std::vector > ren; vtkSmartPointer lut = vtkSmartPointer::New(); lut->SetHueRange(0.0, 0.66667); - for (auto i = 0; i < 10; ++i) + for (int i = 0; i < 10; ++i) { // Create the reader and warp the data vith vectors. reader.push_back(vtkSmartPointer::New()); @@ -152,9 +152,9 @@ int main(int argc, char* argv[]) vtkSmartPointer iren = vtkSmartPointer::New(); iren->SetRenderWindow(renWin); - auto rendererSizeX = 750; - auto rendererSizeY = 400; - auto renWinScale = 0.5; + const int rendererSizeX = 750; + const int rendererSizeY = 400; + const double renWinScale = 0.5; renWin->SetWindowName("Blow"); if (dataPoint >= 0 && dataPoint < 10) { @@ -163,20 +163,20 @@ int main(int argc, char* argv[]) } else { - auto gridDimensionsX = 2; - auto gridDimensionsY = 5; + int gridDimensionsX = 2; + int gridDimensionsY = 5; renWin->SetSize(int(rendererSizeX * gridDimensionsX * renWinScale), int(rendererSizeY * gridDimensionsY * renWinScale)); // Add and position the renders to the render window. - for (auto row = 0; row < gridDimensionsY; ++row) + for (int row = 0; row < gridDimensionsY; ++row) { - for (auto col = 0; col < gridDimensionsX; ++col) + for (int col = 0; col < gridDimensionsX; ++col) { - auto idx = row * gridDimensionsX + col; - auto x0 = double(col) / gridDimensionsX; - auto y0 = double(gridDimensionsY - row - 1) / gridDimensionsY; - auto x1 = double(col + 1) / gridDimensionsX; - auto y1 = double(gridDimensionsY - row) / gridDimensionsY; + const int idx = row * gridDimensionsX + col; + const double x0 = static_cast(col) / gridDimensionsX; + const double y0 = static_cast(gridDimensionsY - row - 1) / gridDimensionsY; + const double x1 = static_cast(col + 1) / gridDimensionsX; + const double y1 = static_cast(gridDimensionsY - row) / gridDimensionsY; renWin->AddRenderer(ren[idx]); ren[idx]->SetViewport(x0, y0, x1, y1); } diff --git a/src/Cxx/Visualization/CMakeLists.txt b/src/Cxx/Visualization/CMakeLists.txt index 2fcd0dbbd2b..dfdfdc86395 100644 --- a/src/Cxx/Visualization/CMakeLists.txt +++ b/src/Cxx/Visualization/CMakeLists.txt @@ -9,9 +9,21 @@ set(KIT_LIBS ${VTK_LIBRARIES}) # # Build all .cxx files in the directory - file(GLOB ALL_FILES *.cxx) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(CameraModel1 11 ALL_FILES) +Requires_CxxVersion(CameraModel2 11 ALL_FILES) +Requires_CxxVersion(CurvatureBandsWithGlyphs 11 ALL_FILES) +Requires_CxxVersion(ElevationBandsWithGlyphs 11 ALL_FILES) +Requires_CxxVersion(FlyingFrogSkinAndTissue 11 ALL_FILES) +Requires_CxxVersion(Hanoi 11 ALL_FILES) +Requires_CxxVersion(HanoiInitial 11 ALL_FILES) +Requires_CxxVersion(HanoiIntermediate 11 ALL_FILES) +Requires_CxxVersion(Hawaii 11 ALL_FILES) +Requires_CxxVersion(Kitchen 11 ALL_FILES) + include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresModule.cmake) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresSettingOff.cmake) @@ -27,7 +39,10 @@ Requires_Module(ExtrudePolyDataAlongLine SplineDrivenImageSlicer) Requires_Version(CurvatureBandsWithGlyphs ${VERSION_MIN} ALL_FILES) Requires_Version(PointDataSubdivision ${VERSION_MIN} ALL_FILES) Requires_Version(ProjectSphere ${VERSION_MIN} ALL_FILES) + Requires_Version(BillboardTextActor3D "7.1.0" ALL_FILES) +Requires_Version(Glyph3DMapper "7.1.0" ALL_FILES) + Requires_Module(Shadows vtkRenderingOpenGL) #Requires_Setting_Off(StreamLines VTK_LEGACY_REMOVE) Requires_GitLfs(Hawaii ALL_FILES) diff --git a/src/Cxx/Visualization/ChooseTextColorDemo.cxx b/src/Cxx/Visualization/ChooseTextColorDemo.cxx index 245dad799ed..c6dcb40f6ab 100644 --- a/src/Cxx/Visualization/ChooseTextColorDemo.cxx +++ b/src/Cxx/Visualization/ChooseTextColorDemo.cxx @@ -66,7 +66,7 @@ int main (int argc, char *argv[]) // Setup render window vtkSmartPointer renderWindow = vtkSmartPointer::New(); - std::vector> renderers; + std::vector > renderers; unsigned int xGridDimensions = 10; unsigned int yGridDimensions = 10; for (int i = 0; i < static_cast(xGridDimensions * yGridDimensions); ++i) diff --git a/src/Cxx/Visualization/CubeAxesActor.cxx b/src/Cxx/Visualization/CubeAxesActor.cxx index cd4c010b4d8..df3bc7f20e4 100644 --- a/src/Cxx/Visualization/CubeAxesActor.cxx +++ b/src/Cxx/Visualization/CubeAxesActor.cxx @@ -47,14 +47,17 @@ int main(int, char *[]) cubeAxesActor->DrawXGridlinesOn(); cubeAxesActor->DrawYGridlinesOn(); cubeAxesActor->DrawZGridlinesOn(); -#if VTK_MAJOR_VERSION == 6 + +#if VTK_MAJOR_VERSION < 7 + // Works with 6.2 cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); +#elif VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION == 0 + // Works with 7.0.0 + cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); +#else + // Works with 7.1.0+ + cubeAxesActor->SetGridLineLocation(vtkCubeAxesActor::VTK_GRID_LINES_FURTHEST); #endif -#if VTK_MAJOR_VERSION > 6 - cubeAxesActor->SetGridLineLocation( - cubeAxesActor->VTK_GRID_LINES_FURTHEST); -#endif - cubeAxesActor->XAxisMinorTickVisibilityOff(); cubeAxesActor->YAxisMinorTickVisibilityOff(); cubeAxesActor->ZAxisMinorTickVisibilityOff(); diff --git a/src/Cxx/Visualization/CurvatureBandsWithGlyphs.cxx b/src/Cxx/Visualization/CurvatureBandsWithGlyphs.cxx index 694fe8726f7..09cd53400ca 100644 --- a/src/Cxx/Visualization/CurvatureBandsWithGlyphs.cxx +++ b/src/Cxx/Visualization/CurvatureBandsWithGlyphs.cxx @@ -121,7 +121,7 @@ class STLHelpers @param nearestInteger - if True then [floor(min), ceil(max)] is used. @return A List consisting of [min, midpoint, max] for each band. */ -std::vector> MakeBands( +std::vector > MakeBands( double const dR[2], int const& numberOfBands, bool const& nearestInteger); //! Divide a range into custom bands @@ -135,7 +135,7 @@ like this: x = [[r1, r2], [r2, r3], [r3, r4]...] @param numberOfBands - the number of bands, a positive integer. @return A List consisting of [min, midpoint, max] for each band. */ -std::vector> MakeCustomBands( +std::vector > MakeCustomBands( double const dR[2], int const& numberOfBands); //! Divide a range into integral bands @@ -144,13 +144,13 @@ Divide a range into bands @param dR - [min, max] the range that is to be covered by the bands. @return A List consisting of [min, midpoint, max] for each band. */ -std::vector> MakeIntegralBands(double const dR[2]); +std::vector > MakeIntegralBands(double const dR[2]); //! Print the bands. /*! @param bands - the bands. */ -void PrintBands(std::vector> const& bands); +void PrintBands(std::vector > const& bands); //! Generate elevations over the surface. /*! @@ -219,7 +219,7 @@ void ReverseLUT(vtkLookupTable* lut, vtkLookupTable* lutr); @return The frequencies of the scalars in each band. */ std::vector Frequencies( - std::vector> const& bands, vtkPolyData* src); + std::vector > const& bands, vtkPolyData* src); //! Print the frequency table. /*! @@ -265,10 +265,10 @@ int main(int, char* []) namespace { //----------------------------------------------------------------------------- -std::vector> MakeBands( +std::vector > MakeBands( double const dR[2], int const& numberOfBands, bool const& nearestInteger) { - std::vector> bands; + std::vector > bands; if ((dR[1] < dR[0]) || (numberOfBands <= 0)) { return bands; @@ -300,10 +300,10 @@ std::vector> MakeBands( } //----------------------------------------------------------------------------- -std::vector> MakeCustomBands( +std::vector > MakeCustomBands( double const dR[2], int const& numberOfBands) { - std::vector> bands; + std::vector > bands; if ((dR[1] < dR[0]) || (numberOfBands <= 0)) { return bands; @@ -311,7 +311,7 @@ std::vector> MakeCustomBands( // We can do this much better in c++11! double myBands[][2] = {{-0.7, -0.05}, {-0.05, 0}, {0, 0.13}, {0.13, 1.07}, {1.07, 35.4}, {35.4, 37.1}}; - std::vector> x; + std::vector > x; for (int i = 0; i < 6; ++i) { std::vector tmp(2); @@ -343,9 +343,9 @@ std::vector> MakeCustomBands( } //----------------------------------------------------------------------------- -std::vector> MakeIntegralBands(double const dR[2]) +std::vector > MakeIntegralBands(double const dR[2]) { - std::vector> bands; + std::vector > bands; if (dR[1] < dR[0]) { return bands; @@ -362,10 +362,10 @@ std::vector> MakeIntegralBands(double const dR[2]) } //----------------------------------------------------------------------------- -void PrintBands(std::vector> const& bands) +void PrintBands(std::vector > const& bands) { STLHelpers stlHelpers = STLHelpers(); - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { if (p == bands.begin()) @@ -621,7 +621,7 @@ void ReverseLUT(vtkLookupTable* lut, vtkLookupTable* lutr) //----------------------------------------------------------------------------- std::vector Frequencies( - std::vector> const& bands, vtkPolyData* src) + std::vector > const& bands, vtkPolyData* src) { std::vector freq(bands.size(), 0); vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples(); @@ -765,7 +765,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) vtkSmartPointer::New(); MakeLUT(lut); vtkIdType numberOfBands = lut->GetNumberOfTableValues(); - std::vector> bands; + std::vector > bands; if (st == PARAMETRIC_HILLS) { // Comment this out if you want to see how allocating @@ -790,7 +790,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) // We will use the midpoint of the band as the label. std::vector labels; - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { std::ostringstream os; @@ -821,7 +821,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) bcf->SetInputData(src); // Use either the minimum or maximum value for each band. int i = 0; - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { bcf->SetValue(i, (*p)[2]); diff --git a/src/Cxx/Visualization/DisplayCoordinateAxes.cxx b/src/Cxx/Visualization/DisplayCoordinateAxes.cxx index e25095f77cd..eb844d5944a 100644 --- a/src/Cxx/Visualization/DisplayCoordinateAxes.cxx +++ b/src/Cxx/Visualization/DisplayCoordinateAxes.cxx @@ -62,7 +62,7 @@ int main (int, char *[]) vtkSmartPointer widget = vtkSmartPointer::New(); - double rgba[4]{0.0, 0.0, 0.0, 0.0}; + double rgba[4] = {0.0, 0.0, 0.0, 0.0}; colors->GetColor("Carrot",rgba); widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]); widget->SetOrientationMarker( axes ); diff --git a/src/Cxx/Visualization/ElevationBandsWithGlyphs.cxx b/src/Cxx/Visualization/ElevationBandsWithGlyphs.cxx index a015b80d747..43b89ef3140 100644 --- a/src/Cxx/Visualization/ElevationBandsWithGlyphs.cxx +++ b/src/Cxx/Visualization/ElevationBandsWithGlyphs.cxx @@ -88,7 +88,7 @@ class STLHelpers @param nearestInteger - if True then [floor(min), ceil(max)] is used. @return A List consisting of [min, midpoint, max] for each band. */ -std::vector> MakeBands( +std::vector > MakeBands( double const dR[2], int const& numberOfBands, bool const& nearestInteger); //! Divide a range into integral bands @@ -97,13 +97,13 @@ Divide a range into bands @param dR - [min, max] the range that is to be covered by the bands. @return A List consisting of [min, midpoint, max] for each band. */ -std::vector> MakeIntegralBands(double const dR[2]); +std::vector > MakeIntegralBands(double const dR[2]); //! Print the bands. /*! @param bands - the bands. */ -void PrintBands(std::vector> const& bands); +void PrintBands(std::vector > const& bands); //! Generate elevations over the surface. /*! @@ -150,7 +150,7 @@ void ReverseLUT(vtkLookupTable* lut, vtkLookupTable* lutr); @return The frequencies of the scalars in each band. */ std::vector Frequencies( - std::vector> const& bands, vtkPolyData* src); + std::vector > const& bands, vtkPolyData* src); //! Print the frequency table. /*! @@ -197,10 +197,10 @@ int main(int, char* []) namespace { //----------------------------------------------------------------------------- -std::vector> MakeBands( +std::vector > MakeBands( double const dR[2], int const& numberOfBands, bool const& nearestInteger) { - std::vector> bands; + std::vector > bands; if ((dR[1] < dR[0]) || (numberOfBands <= 0)) { return bands; @@ -232,9 +232,9 @@ std::vector> MakeBands( } //----------------------------------------------------------------------------- -std::vector> MakeIntegralBands(double const dR[2]) +std::vector > MakeIntegralBands(double const dR[2]) { - std::vector> bands; + std::vector > bands; if (dR[1] < dR[0]) { return bands; @@ -251,10 +251,10 @@ std::vector> MakeIntegralBands(double const dR[2]) } //----------------------------------------------------------------------------- -void PrintBands(std::vector> const& bands) +void PrintBands(std::vector > const& bands) { STLHelpers stlHelpers = STLHelpers(); - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { if (p == bands.begin()) @@ -403,7 +403,7 @@ void ReverseLUT(vtkLookupTable* lut, vtkLookupTable* lutr) //----------------------------------------------------------------------------- std::vector Frequencies( - std::vector> const& bands, vtkPolyData* src) + std::vector > const& bands, vtkPolyData* src) { std::vector freq(bands.size(), 0); vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples(); @@ -539,7 +539,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) lut->SetTableRange(scalarRange); vtkIdType numberOfBands = lut->GetNumberOfTableValues(); - std::vector> bands = + std::vector > bands = MakeBands(scalarRange, numberOfBands, false); // PrintBands(bands); @@ -550,7 +550,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) // We will use the midpoint of the band as the label. std::vector labels; - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { std::ostringstream os; @@ -581,7 +581,7 @@ void Display(SURFACE_TYPE st, vtkRenderWindowInteractor* iren) bcf->SetInputData(src); // Use either the minimum or maximum value for each band. int i = 0; - for (std::vector>::const_iterator p = bands.begin(); + for (std::vector >::const_iterator p = bands.begin(); p != bands.end(); ++p) { bcf->SetValue(i, (*p)[2]); diff --git a/src/Cxx/Visualization/Kitchen.cxx b/src/Cxx/Visualization/Kitchen.cxx index 6abd1c99cf0..d2b395cdfcf 100644 --- a/src/Cxx/Visualization/Kitchen.cxx +++ b/src/Cxx/Visualization/Kitchen.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/Visualization/LoopShrink.cxx b/src/Cxx/Visualization/LoopShrink.cxx index 32375097766..26af5981a7c 100644 --- a/src/Cxx/Visualization/LoopShrink.cxx +++ b/src/Cxx/Visualization/LoopShrink.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include diff --git a/src/Cxx/Visualization/Lorenz.cxx b/src/Cxx/Visualization/Lorenz.cxx index e6db929e835..243f2e19010 100644 --- a/src/Cxx/Visualization/Lorenz.cxx +++ b/src/Cxx/Visualization/Lorenz.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include int main( int, char *[] ) @@ -76,11 +77,11 @@ int main( int, char *[] ) vtkSmartPointer scalars = vtkSmartPointer::New(); s = scalars->WritePointer(0,numPts); - for (auto i=0; i < numPts; i++) + for (int i=0; i < numPts; i++) { s[i] = 0; } - for (auto j = 0; j < iter; j++) + for (int j = 0; j < iter; j++) { // integrate to next time step xx = x + h * Pr * (y - x); diff --git a/src/Cxx/Visualization/Morph3D.cxx b/src/Cxx/Visualization/Morph3D.cxx index 46724c8c79e..145d55b0512 100644 --- a/src/Cxx/Visualization/Morph3D.cxx +++ b/src/Cxx/Visualization/Morph3D.cxx @@ -9,7 +9,7 @@ #include #include #include - +#include #include #include diff --git a/src/Cxx/Visualization/NamedColorPatches.cxx b/src/Cxx/Visualization/NamedColorPatches.cxx index 52222f2a98e..2ca67955060 100644 --- a/src/Cxx/Visualization/NamedColorPatches.cxx +++ b/src/Cxx/Visualization/NamedColorPatches.cxx @@ -332,10 +332,10 @@ class ColorStructures //--------------------------------------------------------------------------- //! Convert a dictionary to a map. - std::map> ParseDictionary( + std::map > ParseDictionary( std::string const& str) { - std::map> result; + std::map > result; size_t idx0 = 0; size_t idx1 = 0; size_t idx2 = 0; @@ -368,14 +368,14 @@ class ColorStructures } public: - std::map> cn; + std::map > cn; // Ordering of the tables and when to start and end a column of // tables in the layout. std::vector cnOrder; std::vector cnStartTable; std::vector cnEndTable; - std::map> vtkcn; + std::map > vtkcn; // Ordering of the tables and when to start and end a column of // tables in the layout. std::vector vtkcnOrder; @@ -511,7 +511,7 @@ class HTMLTableMaker } //----------------------------------------------------------------------------- - std::vector> ParseSynonyms( + std::vector > ParseSynonyms( const vtkStdString& synonyms) { // The delimiter for a string of synonyms. @@ -519,7 +519,7 @@ class HTMLTableMaker size_t start = 0; size_t end = synonyms.find(synonymDelimiter); std::vector cn; - std::vector> syn; + std::vector > syn; vtkStdString str; while (end != std::string::npos) { @@ -739,10 +739,10 @@ class HTMLTableMaker //----------------------------------------------------------------------------- std::string MakeSynonymColorTable() { - std::vector> synonyms = + std::vector > synonyms = this->ParseSynonyms(this->nc->GetSynonyms()); std::vector cn; - for (std::map>::const_iterator p = + for (std::map >::const_iterator p = cs.cn.begin(); p != cs.cn.end(); ++p) { @@ -762,7 +762,7 @@ class HTMLTableMaker res += "\n"; res += "\n"; res += this->MakeSynonymTableHeader(); - for (std::vector>::iterator p = synonyms.begin(); + for (std::vector >::iterator p = synonyms.begin(); p != synonyms.end(); ++p) { for (std::vector::iterator q = p->begin(); q != p->end(); diff --git a/src/Cxx/Visualization/NamedColors.cxx b/src/Cxx/Visualization/NamedColors.cxx index 503b291bb46..ed14922e431 100644 --- a/src/Cxx/Visualization/NamedColors.cxx +++ b/src/Cxx/Visualization/NamedColors.cxx @@ -42,7 +42,7 @@ std::vector ParseColorNames(const vtkStdString& colorNames); // Parse the synonyms returning a std::vector > // synonyms is a string of synonyms separated by a double linefeed where // each synonym is two or more color names separated by a linefeed. -std::vector> ParseSynonyms( +std::vector > ParseSynonyms( const vtkStdString& synonyms); // Print out the colors. @@ -94,7 +94,7 @@ std::vector ParseColorNames(const vtkStdString& colorNames) } //----------------------------------------------------------------------------- -std::vector> ParseSynonyms( +std::vector > ParseSynonyms( const vtkStdString& synonyms) { // The delimiter for a string of synonyms. @@ -102,7 +102,7 @@ std::vector> ParseSynonyms( size_t start = 0; size_t end = synonyms.find("\n\n"); // The delimiter for a string of synonyms. std::vector cn; - std::vector> syn; + std::vector > syn; vtkStdString str; while (end != std::string::npos) { @@ -176,10 +176,10 @@ void PrintColors(vtkNamedColors* namedColors) void PrintSynonyms(vtkNamedColors* namedColors) { // Get the synonyms: - std::vector> synonyms = + std::vector > synonyms = ParseSynonyms(namedColors->GetSynonyms()); std::cout << "There are " << synonyms.size() << " synonyms:" << std::endl; - for (std::vector>::const_iterator p = + for (std::vector >::const_iterator p = synonyms.begin(); p != synonyms.end(); ++p) { diff --git a/src/Cxx/Visualization/QuadricVisualization.cxx b/src/Cxx/Visualization/QuadricVisualization.cxx index ec08efedef1..0c32208c409 100644 --- a/src/Cxx/Visualization/QuadricVisualization.cxx +++ b/src/Cxx/Visualization/QuadricVisualization.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace diff --git a/src/Cxx/Visualization/VectorField.cxx b/src/Cxx/Visualization/VectorField.cxx index 77c025fea65..6e58f5c518d 100644 --- a/src/Cxx/Visualization/VectorField.cxx +++ b/src/Cxx/Visualization/VectorField.cxx @@ -35,11 +35,11 @@ int main(int, char*[]) int* dims = image->GetDimensions(); // Zero the image - for (auto z = 0; z < dims[2]; ++z) + for (int z = 0; z < dims[2]; ++z) { - for (auto y = 0; y < dims[1]; ++y) + for (int y = 0; y < dims[1]; ++y) { - for (auto x = 0; x < dims[0]; ++x) + for (int x = 0; x < dims[0]; ++x) { float* pixel = static_cast(image->GetScalarPointer(x, y, z)); pixel[0] = 0.0; diff --git a/src/Cxx/VisualizationAlgorithms/CMakeLists.txt b/src/Cxx/VisualizationAlgorithms/CMakeLists.txt index 7abc7f6679b..44ed9c2ed3a 100644 --- a/src/Cxx/VisualizationAlgorithms/CMakeLists.txt +++ b/src/Cxx/VisualizationAlgorithms/CMakeLists.txt @@ -13,6 +13,21 @@ file(GLOB ALL_FILES *.cxx) include(${WikiExamples_SOURCE_DIR}/CMake/RequiresGitLfs.cmake) +# VTK follows the C++03 standard but some examples require C++11 +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresCxxVersion.cmake) +Requires_CxxVersion(AnatomicalOrientation 11 ALL_FILES) +Requires_CxxVersion(DataSetSurface 11 ALL_FILES) +Requires_CxxVersion(FlyingHeadSlice 11 ALL_FILES) +Requires_CxxVersion(Office 11 ALL_FILES) +Requires_CxxVersion(OfficeA 11 ALL_FILES) +Requires_CxxVersion(OfficeB 11 ALL_FILES) +Requires_CxxVersion(PlateVibration 11 ALL_FILES) +Requires_CxxVersion(StreamlinesWithLineWidget 11 ALL_FILES) +Requires_CxxVersion(VelocityProfile 11 ALL_FILES) + +include(${WikiExamples_SOURCE_DIR}/CMake/RequiresVersion.cmake) +Requires_Version(FlyingHeadSlice "7.0" ALL_FILES) + Requires_GitLfs(PineRootConnectivity ALL_FILES) Requires_GitLfs(PineRootConnectivityA ALL_FILES) Requires_GitLfs(PineRootDecimation ALL_FILES) diff --git a/src/Cxx/VisualizationAlgorithms/CarotidFlow.cxx b/src/Cxx/VisualizationAlgorithms/CarotidFlow.cxx index abf6e8bc65f..9533628a393 100644 --- a/src/Cxx/VisualizationAlgorithms/CarotidFlow.cxx +++ b/src/Cxx/VisualizationAlgorithms/CarotidFlow.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs.cxx b/src/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs.cxx index 425e4883307..4786c0f558f 100644 --- a/src/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs.cxx +++ b/src/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/ClipSphereCylinder.cxx b/src/Cxx/VisualizationAlgorithms/ClipSphereCylinder.cxx index 183f93d1328..16d5c8e741a 100644 --- a/src/Cxx/VisualizationAlgorithms/ClipSphereCylinder.cxx +++ b/src/Cxx/VisualizationAlgorithms/ClipSphereCylinder.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/CombustorIsosurface.cxx b/src/Cxx/VisualizationAlgorithms/CombustorIsosurface.cxx index 78acd350cba..d55600ec8a7 100644 --- a/src/Cxx/VisualizationAlgorithms/CombustorIsosurface.cxx +++ b/src/Cxx/VisualizationAlgorithms/CombustorIsosurface.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include int main (int argc, char *argv[]) diff --git a/src/Cxx/VisualizationAlgorithms/ContourQuadric.cxx b/src/Cxx/VisualizationAlgorithms/ContourQuadric.cxx index f394a9f6c74..707cf00cffc 100644 --- a/src/Cxx/VisualizationAlgorithms/ContourQuadric.cxx +++ b/src/Cxx/VisualizationAlgorithms/ContourQuadric.cxx @@ -10,6 +10,7 @@ #include #include #include +#include int main( int, char *[] ) { diff --git a/src/Cxx/VisualizationAlgorithms/CreateBFont.cxx b/src/Cxx/VisualizationAlgorithms/CreateBFont.cxx index d83d89872d6..da330b072a7 100644 --- a/src/Cxx/VisualizationAlgorithms/CreateBFont.cxx +++ b/src/Cxx/VisualizationAlgorithms/CreateBFont.cxx @@ -11,6 +11,7 @@ #include #include #include +#include int main (int argc, char *argv[]) { diff --git a/src/Cxx/VisualizationAlgorithms/CutStructuredGrid.cxx b/src/Cxx/VisualizationAlgorithms/CutStructuredGrid.cxx index 84a48f6e182..414a0596378 100644 --- a/src/Cxx/VisualizationAlgorithms/CutStructuredGrid.cxx +++ b/src/Cxx/VisualizationAlgorithms/CutStructuredGrid.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/DecimateFran.cxx b/src/Cxx/VisualizationAlgorithms/DecimateFran.cxx index 36b8cdd224d..fff9e35838f 100644 --- a/src/Cxx/VisualizationAlgorithms/DecimateFran.cxx +++ b/src/Cxx/VisualizationAlgorithms/DecimateFran.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include int main (int argc, char *argv[]) diff --git a/src/Cxx/VisualizationAlgorithms/DisplacementPlot.cxx b/src/Cxx/VisualizationAlgorithms/DisplacementPlot.cxx index 3ce334de6ce..d63f3f9f71f 100644 --- a/src/Cxx/VisualizationAlgorithms/DisplacementPlot.cxx +++ b/src/Cxx/VisualizationAlgorithms/DisplacementPlot.cxx @@ -128,7 +128,7 @@ void MakeLUT(int const& colorScheme, vtkLookupTable* lut) { // See: [Diverging Color Maps for Scientific Visualization] // (http://www.kennethmoreland.com/color-maps/) - auto nc = 256; + const vtkIdType nc = 256; vtkSmartPointer ctf = vtkSmartPointer::New(); switch (colorScheme) @@ -141,7 +141,7 @@ void MakeLUT(int const& colorScheme, vtkLookupTable* lut) ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150); lut->SetNumberOfTableValues(nc); lut->Build(); - for (auto i = 0; i < nc; ++i) + for (vtkIdType i = 0; i < nc; ++i) { double rgb[4] = {0.0, 0.0, 0.0, 1.0}; ctf->GetColor(static_cast(i) / nc, rgb); @@ -155,7 +155,7 @@ void MakeLUT(int const& colorScheme, vtkLookupTable* lut) ctf->AddRGBPoint(1.0, 0.436, 0.308, 0.631); lut->SetNumberOfTableValues(nc); lut->Build(); - for (auto i = 0; i < nc; ++i) + for (vtkIdType i = 0; i < nc; ++i) { double rgb[4] = {0.0, 0.0, 0.0, 1.0}; ctf->GetColor(static_cast(i) / nc, rgb); @@ -167,19 +167,19 @@ void MakeLUT(int const& colorScheme, vtkLookupTable* lut) // Make a lookup table, black in the centre with bright areas // at the beginning and end of the table. // This is from the original code. - auto nc2 = nc / 2; + const vtkIdType nc2 = nc / 2; lut->SetNumberOfColors(nc); lut->Build(); - for (auto i = 0; i < nc2; ++i) + for (vtkIdType i = 0; i < nc2; ++i) { // White to black. - auto v = (double(nc2) - i) / double(nc2); + const double v = (static_cast(nc2) - i) / static_cast(nc2); lut->SetTableValue(i, v, v, v, 1); } - for (auto i = nc2; i < nc; ++i) + for (vtkIdType i = nc2; i < nc; ++i) { // Black to white. - auto v = (i - double(nc2)) / double(nc2); + const double v = (i - static_cast(nc2)) / static_cast(nc2); lut->SetTableValue(i, v, v, v, 1); } break; diff --git a/src/Cxx/VisualizationAlgorithms/ExtractData.cxx b/src/Cxx/VisualizationAlgorithms/ExtractData.cxx index f6183f11ce1..c544b267786 100644 --- a/src/Cxx/VisualizationAlgorithms/ExtractData.cxx +++ b/src/Cxx/VisualizationAlgorithms/ExtractData.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/FlyingHeadSlice.cxx b/src/Cxx/VisualizationAlgorithms/FlyingHeadSlice.cxx index 3aa59733a16..cf8de1b78a1 100644 --- a/src/Cxx/VisualizationAlgorithms/FlyingHeadSlice.cxx +++ b/src/Cxx/VisualizationAlgorithms/FlyingHeadSlice.cxx @@ -53,21 +53,40 @@ int main(int argc, char* argv[]) std::cout << "Using vtkFlyingEdges2D." << std::endl; } +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 + // 8.1.0+ vtkNew colors; +#else + vtkSmartPointer colors = vtkSmartPointer::New(); +#endif // Create the RenderWindow, Renderer and both Actors. +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew ren1; vtkNew renWin; - renWin->AddRenderer(ren1); vtkNew iren; +#else + vtkSmartPointer ren1 = vtkSmartPointer::New(); + vtkSmartPointer renWin = vtkSmartPointer::New(); + vtkSmartPointer iren = vtkSmartPointer::New(); +#endif + renWin->AddRenderer(ren1); iren->SetRenderWindow(renWin); // Create the pipeline. +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew reader; +#else + vtkSmartPointer reader = vtkSmartPointer::New(); +#endif reader->SetFileName(argv[1]); reader->Update(); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew extractVOI; +#else + vtkSmartPointer extractVOI = vtkSmartPointer::New(); +#endif extractVOI->SetInputConnection(reader->GetOutputPort()); extractVOI->SetVOI(0, 255, 0, 255, 45, 45); extractVOI->Update(); @@ -75,9 +94,16 @@ int main(int argc, char* argv[]) std::array scalarRange = {{500, 1150}}; // std::cout << scalarRange[0] << ", " << scalarRange[1] << std::endl; +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew contour; vtkNew flyingEdges; vtkNew isoMapper; +#else + vtkSmartPointer contour = vtkSmartPointer::New(); + vtkSmartPointer flyingEdges = vtkSmartPointer::New(); + vtkSmartPointer isoMapper = vtkSmartPointer::New(); +#endif + if (useContourFilter) { contour->SetInputConnection(extractVOI->GetOutputPort()); @@ -93,17 +119,33 @@ int main(int argc, char* argv[]) isoMapper->ScalarVisibilityOn(); isoMapper->SetScalarRange(scalarRange.data()); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew isoActor; +#else + vtkSmartPointer isoActor = vtkSmartPointer::New(); +#endif isoActor->SetMapper(isoMapper); isoActor->GetProperty()->SetColor(colors->GetColor3d("Wheat").GetData()); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew outline; +#else + vtkSmartPointer outline = vtkSmartPointer::New(); +#endif outline->SetInputConnection(extractVOI->GetOutputPort()); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew outlineMapper; +#else + vtkSmartPointer outlineMapper = vtkSmartPointer::New(); +#endif outlineMapper->SetInputConnection(outline->GetOutputPort()); +#if VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION > 0 vtkNew outlineActor; +#else + vtkSmartPointer outlineActor = vtkSmartPointer::New(); +#endif outlineActor->SetMapper(outlineMapper); // Add the actors to the renderer, set the background and size. diff --git a/src/Cxx/VisualizationAlgorithms/HeadBone.cxx b/src/Cxx/VisualizationAlgorithms/HeadBone.cxx index 4928d4f1cd1..3e5cb8b11e2 100644 --- a/src/Cxx/VisualizationAlgorithms/HeadBone.cxx +++ b/src/Cxx/VisualizationAlgorithms/HeadBone.cxx @@ -10,6 +10,7 @@ #include #include #include +#include int main (int argc, char *argv[]) { diff --git a/src/Cxx/VisualizationAlgorithms/HeadSlice.cxx b/src/Cxx/VisualizationAlgorithms/HeadSlice.cxx index b789e1ff32b..dfad0df8a24 100644 --- a/src/Cxx/VisualizationAlgorithms/HeadSlice.cxx +++ b/src/Cxx/VisualizationAlgorithms/HeadSlice.cxx @@ -10,6 +10,7 @@ #include #include #include +#include int main (int argc, char *argv[]) { diff --git a/src/Cxx/VisualizationAlgorithms/Hello.cxx b/src/Cxx/VisualizationAlgorithms/Hello.cxx index 60d557e8caf..fef5bcb7b1b 100644 --- a/src/Cxx/VisualizationAlgorithms/Hello.cxx +++ b/src/Cxx/VisualizationAlgorithms/Hello.cxx @@ -9,6 +9,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { diff --git a/src/Cxx/VisualizationAlgorithms/HyperStreamline.cxx b/src/Cxx/VisualizationAlgorithms/HyperStreamline.cxx index 5f56c4a25cf..6d9d3dec100 100644 --- a/src/Cxx/VisualizationAlgorithms/HyperStreamline.cxx +++ b/src/Cxx/VisualizationAlgorithms/HyperStreamline.cxx @@ -13,6 +13,7 @@ #include #include #include +#include int main (int, char *[]) { diff --git a/src/Cxx/VisualizationAlgorithms/IceCream.cxx b/src/Cxx/VisualizationAlgorithms/IceCream.cxx index f554e4b6697..a923204a6a2 100644 --- a/src/Cxx/VisualizationAlgorithms/IceCream.cxx +++ b/src/Cxx/VisualizationAlgorithms/IceCream.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include int main (int, char *[]) diff --git a/src/Cxx/VisualizationAlgorithms/IronIsoSurface.cxx b/src/Cxx/VisualizationAlgorithms/IronIsoSurface.cxx index 275913db4db..66445643325 100644 --- a/src/Cxx/VisualizationAlgorithms/IronIsoSurface.cxx +++ b/src/Cxx/VisualizationAlgorithms/IronIsoSurface.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include int main(int argc, char *argv[]) diff --git a/src/Cxx/VisualizationAlgorithms/LOx.cxx b/src/Cxx/VisualizationAlgorithms/LOx.cxx index 27c987b9274..3abfb0fb9af 100644 --- a/src/Cxx/VisualizationAlgorithms/LOx.cxx +++ b/src/Cxx/VisualizationAlgorithms/LOx.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/LOxGrid.cxx b/src/Cxx/VisualizationAlgorithms/LOxGrid.cxx index bfd85bcbcb1..fd2b74c6591 100644 --- a/src/Cxx/VisualizationAlgorithms/LOxGrid.cxx +++ b/src/Cxx/VisualizationAlgorithms/LOxGrid.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/LOxSeeds.cxx b/src/Cxx/VisualizationAlgorithms/LOxSeeds.cxx index 4b2a7c22096..cf54e2d28d4 100644 --- a/src/Cxx/VisualizationAlgorithms/LOxSeeds.cxx +++ b/src/Cxx/VisualizationAlgorithms/LOxSeeds.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,7 @@ int main (int argc, char *argv[]) seeds.push_back(seed3); seeds.push_back(seed4); - std::vector> renderers; + std::vector > renderers; for (size_t s = 0; s < seeds.size(); ++s) { diff --git a/src/Cxx/VisualizationAlgorithms/MarchingCases.cxx b/src/Cxx/VisualizationAlgorithms/MarchingCases.cxx index 1e934d4b94b..4cbcf3af054 100644 --- a/src/Cxx/VisualizationAlgorithms/MarchingCases.cxx +++ b/src/Cxx/VisualizationAlgorithms/MarchingCases.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -69,9 +70,9 @@ int main(int argc, char* argv[]) cases[14] = &case14; std::vector mcCases; - auto mcCase = 7; - auto rotation = 0; - auto label = true; + int mcCase = 7; + int rotation = 0; + bool label = true; if (argc > 1) { if (argc < 3) @@ -79,13 +80,13 @@ int main(int argc, char* argv[]) std::cerr << ProgramParameters(argv[0]) << std::endl; return EXIT_FAILURE; } - auto numberOfCases = std::abs(atoi(argv[1])); + int numberOfCases = std::abs(atoi(argv[1])); if (argc < numberOfCases + 2) { std::cerr << ProgramParameters(argv[0]) << std::endl; return EXIT_FAILURE; } - for (auto i = 0; i < numberOfCases; ++i) + for (int i = 0; i < numberOfCases; ++i) { mcCase = atoi(argv[i + 2]); if (std::abs(mcCase) < 0 || std::abs(mcCase) > 14) @@ -140,7 +141,7 @@ int main(int argc, char* argv[]) iren->SetRenderWindow(renWin); // Always use a grid of four columns unless number of cases < 4. - std::vector> renderers; + std::vector > renderers; int gridSize = ((static_cast(mcCases.size()) + 3) / 4) * 4; gridSize = static_cast(mcCases.size()) < 4 ? static_cast(mcCases.size()) diff --git a/src/Cxx/VisualizationAlgorithms/Motor.cxx b/src/Cxx/VisualizationAlgorithms/Motor.cxx index aac7cfa512c..68e4da3c91b 100644 --- a/src/Cxx/VisualizationAlgorithms/Motor.cxx +++ b/src/Cxx/VisualizationAlgorithms/Motor.cxx @@ -16,6 +16,7 @@ This code is based on the VTK file: /IO/Geometry/Testing/Python/motor.py. #include #include #include +#include #include #include @@ -72,20 +73,26 @@ int main(int argc, char* argv[]) // Set up the pipelines for the parts of the motor. // We will use lists of pipeline objects. - auto numberOfParts = 5; - std::vector> byu; - std::vector> normals; - std::vector> tex; - std::vector> byuMapper; - std::vector> byuActor; - std::vector partColours{"cold_grey", "peacock", "raw_sienna", - "banana", "peach_puff"}; + int numberOfParts = 5; + std::vector > byu; + std::vector > normals; + std::vector > tex; + std::vector > byuMapper; + std::vector > byuActor; + + std::vector partColours; + partColours.push_back("cold_grey"); + partColours.push_back("peacock"); + partColours.push_back("raw_sienna"); + partColours.push_back("banana"); + partColours.push_back("peach_puff"); + // Use this to control which parts to display. std::vector displayParts(numberOfParts, true); // If displayParts[2] = false; then an image like that in the VTK tests is // produced. - for (auto i = 0; i < numberOfParts; ++i) + for (int i = 0; i < numberOfParts; ++i) { byu.push_back(vtkSmartPointer::New()); byu[i]->SetGeometryFileName(motorFile.c_str()); diff --git a/src/Cxx/VisualizationAlgorithms/Office.cxx b/src/Cxx/VisualizationAlgorithms/Office.cxx index dbd04b21066..d26e77a146e 100644 --- a/src/Cxx/VisualizationAlgorithms/Office.cxx +++ b/src/Cxx/VisualizationAlgorithms/Office.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/OfficeTube.cxx b/src/Cxx/VisualizationAlgorithms/OfficeTube.cxx index 911008bd315..0d7c2e9f11b 100644 --- a/src/Cxx/VisualizationAlgorithms/OfficeTube.cxx +++ b/src/Cxx/VisualizationAlgorithms/OfficeTube.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/PlateVibration.cxx b/src/Cxx/VisualizationAlgorithms/PlateVibration.cxx index 3ec9bc7a675..18a7c8144c5 100644 --- a/src/Cxx/VisualizationAlgorithms/PlateVibration.cxx +++ b/src/Cxx/VisualizationAlgorithms/PlateVibration.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/ProbeCombustor.cxx b/src/Cxx/VisualizationAlgorithms/ProbeCombustor.cxx index cdf4d6fff04..be33d8d3caf 100644 --- a/src/Cxx/VisualizationAlgorithms/ProbeCombustor.cxx +++ b/src/Cxx/VisualizationAlgorithms/ProbeCombustor.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/SpikeFran.cxx b/src/Cxx/VisualizationAlgorithms/SpikeFran.cxx index 06eec6eee95..038c9fddceb 100644 --- a/src/Cxx/VisualizationAlgorithms/SpikeFran.cxx +++ b/src/Cxx/VisualizationAlgorithms/SpikeFran.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/src/Cxx/VisualizationAlgorithms/SplatFace.cxx b/src/Cxx/VisualizationAlgorithms/SplatFace.cxx index 9713802d57f..b44f799e349 100644 --- a/src/Cxx/VisualizationAlgorithms/SplatFace.cxx +++ b/src/Cxx/VisualizationAlgorithms/SplatFace.cxx @@ -11,6 +11,7 @@ #include #include #include +#include int main (int argc, char *argv[]) { diff --git a/src/Cxx/VisualizationAlgorithms/Stocks.cxx b/src/Cxx/VisualizationAlgorithms/Stocks.cxx index 0b73fc61081..a1e8d1cdbdc 100644 --- a/src/Cxx/VisualizationAlgorithms/Stocks.cxx +++ b/src/Cxx/VisualizationAlgorithms/Stocks.cxx @@ -25,7 +25,7 @@ namespace { -void AddStock(std::vector> renderers, +void AddStock(std::vector > renderers, char *filename, std::string name, double &zPosition, @@ -38,7 +38,7 @@ int main (int argc, char *argv[]) vtkSmartPointer::New(); // set up the stocks - std::vector> renderers; + std::vector > renderers; vtkSmartPointer topRenderer = vtkSmartPointer::New(); vtkSmartPointer bottomRenderer = @@ -100,7 +100,7 @@ int main (int argc, char *argv[]) namespace { // create the stocks -void AddStock(std::vector> renderers, +void AddStock(std::vector > renderers, char *filename, std::string name, double &zPosition, diff --git a/src/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget.cxx b/src/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget.cxx index 7ba18e8d691..0bf12122970 100644 --- a/src/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget.cxx +++ b/src/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget.cxx @@ -51,7 +51,7 @@ class EnableActorCallback : public vtkCommand this->actor->VisibilityOn(); } EnableActorCallback() - : actor(nullptr) + : actor(NULL) { } vtkActor* actor; @@ -69,8 +69,8 @@ class LWCallback : public vtkCommand this->renWin->Render(); } LWCallback() - : polyData(nullptr) - , renWin(nullptr) + : polyData(NULL) + , renWin(NULL) { } vtkPolyData* polyData; @@ -95,8 +95,8 @@ int main(int argc, char* argv[]) << std::endl; return EXIT_FAILURE; } - auto numOfStreamLines = 25; - auto illustration = false; + int numOfStreamLines = 25; + int illustration = false; std::string fileName1 = argv[1]; std::string fileName2 = argv[2]; if (argc > 3) diff --git a/src/Cxx/VisualizationAlgorithms/WarpCombustor.cxx b/src/Cxx/VisualizationAlgorithms/WarpCombustor.cxx index 88b0094e62a..cd2d4f843e4 100644 --- a/src/Cxx/VisualizationAlgorithms/WarpCombustor.cxx +++ b/src/Cxx/VisualizationAlgorithms/WarpCombustor.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT.cxx b/src/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT.cxx index 2c51db916e9..a8e182cdaee 100644 --- a/src/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT.cxx +++ b/src/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Cxx/VolumeRendering/PseudoVolumeRendering.cxx b/src/Cxx/VolumeRendering/PseudoVolumeRendering.cxx index 6281a2fdaad..c607946f972 100644 --- a/src/Cxx/VolumeRendering/PseudoVolumeRendering.cxx +++ b/src/Cxx/VolumeRendering/PseudoVolumeRendering.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include