diff --git a/.travis.yml b/.travis.yml index ad108164..96a94e52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ env: global: - NOT_TEST_BUILD=true - UPSTREAM_WORKSPACE='dependencies_ros1.rosinstall' + - ROSDEP_SKIP_KEYS='iwyu cmake_common_scripts' + - ADDITIONAL_DEBS='iwyu' matrix: include: diff --git a/noether_filtering/package.xml b/noether_filtering/package.xml index 88641d01..2fb776b2 100644 --- a/noether_filtering/package.xml +++ b/noether_filtering/package.xml @@ -7,7 +7,7 @@ Apache 2.0 Jorge Nicho - console_bridge + libconsole-bridge-dev pluginlib libpcl-all-dev diff --git a/vtk_viewer/CMakeLists.txt b/vtk_viewer/CMakeLists.txt index 60ede11c..271415fa 100644 --- a/vtk_viewer/CMakeLists.txt +++ b/vtk_viewer/CMakeLists.txt @@ -20,6 +20,12 @@ endif() find_package(Eigen3 REQUIRED) find_package(console_bridge REQUIRED) +if(NOETHER_ENABLE_TESTING) + set(CLANG_ARGS ${DEFAULT_CLANG_TIDY_ERROR_ARGS}) +else() + set(CLANG_ARGS ${DEFAULT_CLANG_TIDY_WARNING_ARGS}) +endif() + add_code_coverage() add_library(${PROJECT_NAME} SHARED src/mouse_interactor.cpp src/vtk_utils.cpp src/${PROJECT_NAME}.cpp) @@ -30,9 +36,10 @@ target_include_directories(${PROJECT_NAME} PUBLIC target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS}) -target_clang_tidy(${PACKAGE_NAME} ${DEFAULT_CLANG_TIDY_ERROR_ARGS}) -target_include_what_you_use(${PACKAGE_NAME} ${DEFAULT_IWYU_ARGS}) -target_cppcheck(${PACKAGE_NAME} ${DEFAULT_CPPCHECK_ARGS}) +target_cxx_version(${PROJECT_NAME} PUBLIC VERSION 14) +target_clang_tidy(${PROJECT_NAME} ARGUMENTS ${CLANG_ARGS} ENABLE ${NOETHER_ENABLE_TESTING}) +target_include_what_you_use(${PROJECT_NAME} ARGUMENTS ${DEFAULT_IWYU_ARGS} ENABLE ${NOETHER_ENABLE_TESTING}) +target_cppcheck(${PROJECT_NAME} ARGUMENTS ${DEFAULT_CPPCHECK_ARGS} ENABLE ${NOETHER_ENABLE_TESTING}) configure_package(NAMESPACE noether TARGETS ${PROJECT_NAME}) diff --git a/vtk_viewer/cmake/vtk_viewer-config.cmake.in b/vtk_viewer/cmake/vtk_viewer-config.cmake.in index 5bea2682..0a334cef 100644 --- a/vtk_viewer/cmake/vtk_viewer-config.cmake.in +++ b/vtk_viewer/cmake/vtk_viewer-config.cmake.in @@ -5,9 +5,8 @@ set_and_check(@PROJECT_NAME@_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include") set_and_check(@PROJECT_NAME@_LIBRARIES "${PACKAGE_PREFIX_DIR}/lib") include(CMakeFindDependencyMacro) -find_dependency(cmake_common_scripts) find_dependency(console_bridge) -find_dependency(PCL 1.9) -find_dependency(VTK 7.1) +find_dependency(PCL) +find_dependency(VTK) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") diff --git a/vtk_viewer/include/vtk_viewer/mouse_interactor.h b/vtk_viewer/include/vtk_viewer/mouse_interactor.h index 3e7e2524..b100e7f8 100644 --- a/vtk_viewer/include/vtk_viewer/mouse_interactor.h +++ b/vtk_viewer/include/vtk_viewer/mouse_interactor.h @@ -54,7 +54,7 @@ class MouseInteractorStyle : public vtkInteractorStyleTrackballCamera * @brief getSaveLocation Get the current pathway used to save polydata to * @return The current pathway for saving data */ - std::string getSaveLocation(){return save_location_.str().c_str();} + std::string getSaveLocation(){return save_location_.str();} /** * @brief OnLeftButtonDown Callback function for handling left mouse button click events, selects an actor in a window diff --git a/vtk_viewer/include/vtk_viewer/vtk_viewer.h b/vtk_viewer/include/vtk_viewer/vtk_viewer.h index 805d2c09..48434560 100644 --- a/vtk_viewer/include/vtk_viewer/vtk_viewer.h +++ b/vtk_viewer/include/vtk_viewer/vtk_viewer.h @@ -46,7 +46,7 @@ namespace vtk_viewer * @param polydata The polydata to be displayed * @param color The color to use for rendering the data */ - void addPolyDataDisplay(vtkPolyData* polydata, std::vector color); + void addPolyDataDisplay(vtkPolyData* polydata, const std::vector& color); /** * @brief addPolyNormalsDisplay Add a renderer and actor for a polydata @@ -55,14 +55,14 @@ namespace vtk_viewer * @param color The color to use for rendering the data * @param scale The size to scale and show the arrows at */ - void addPolyNormalsDisplay(vtkPolyData* polydata, std::vector color, double scale); + void addPolyNormalsDisplay(vtkPolyData* polydata, const std::vector& color, double scale); /** * @brief addPointDataDisplay Add a renderer and actor for a point data object * @param points The point data to be displayed * @param color The color to use for rendering the data */ - void addPointDataDisplay(vtkPoints* points, std::vector color); + void addPointDataDisplay(vtkPoints* points, const std::vector& color); /** * @brief addCellNormalDisplay Displays the normals for a mesh object @@ -70,7 +70,7 @@ namespace vtk_viewer * @param color The color to use for rendering the data * @param scale The size to scale and show the arrows at */ - void addCellNormalDisplay(vtkPolyData* polydata, std::vector color, double scale); + void addCellNormalDisplay(vtkPolyData* polydata, const std::vector& color, double scale); /** * @brief renderDisplay Calls the VTK window Render() command to visualize @@ -83,7 +83,7 @@ namespace vtk_viewer * objects currently being displayed * @return The number of actor objects */ - int getNumberOfDisplayObjects(){return actors_.size();} + std::size_t getNumberOfDisplayObjects(){return actors_.size();} /** * @brief removeObjectDisplay Remove an object from the list of objects diff --git a/vtk_viewer/package.xml b/vtk_viewer/package.xml index 5be9774d..fdc6a5ee 100644 --- a/vtk_viewer/package.xml +++ b/vtk_viewer/package.xml @@ -8,7 +8,7 @@ catkin cmake_common_scripts - console_bridge + libconsole-bridge-dev libpcl-all-dev rosunit diff --git a/vtk_viewer/src/vtk_viewer.cpp b/vtk_viewer/src/vtk_viewer.cpp index 696923d6..86a6b642 100644 --- a/vtk_viewer/src/vtk_viewer.cpp +++ b/vtk_viewer/src/vtk_viewer.cpp @@ -54,7 +54,7 @@ namespace vtk_viewer this->iren_->Start(); } - void VTKViewer::addPointDataDisplay(vtkPoints* points, std::vector color) + void VTKViewer::addPointDataDisplay(vtkPoints* points, const std::vector& color) { // Add the grid points to a polydata object vtkSmartPointer polydata = vtkSmartPointer::New(); @@ -81,7 +81,7 @@ namespace vtk_viewer } - void VTKViewer::addPolyDataDisplay(vtkPolyData* polydata , std::vector color) + void VTKViewer::addPolyDataDisplay(vtkPolyData* polydata, const std::vector& color) { // create mapper and add to list vtkSmartPointer triangulated_mapper = vtkSmartPointer::New(); @@ -144,7 +144,7 @@ namespace vtk_viewer glyph->Update(); } - void VTKViewer::addPolyNormalsDisplay(vtkPolyData* polydata, std::vector color, double scale) + void VTKViewer::addPolyNormalsDisplay(vtkPolyData* polydata, const std::vector& color, double scale) { VTK_SP(vtkGlyph3D, glyph); makeGlyphs(polydata, false, glyph, scale); @@ -166,7 +166,7 @@ namespace vtk_viewer this->renderer_->AddActor(actors_.back()); } - void VTKViewer::addCellNormalDisplay(vtkPolyData *polydata, std::vector color, double scale) + void VTKViewer::addCellNormalDisplay(vtkPolyData *polydata, const std::vector& color, double scale) { // get cell and point data diff --git a/vtk_viewer/test/CMakeLists.txt b/vtk_viewer/test/CMakeLists.txt index f545416c..2c569f8c 100644 --- a/vtk_viewer/test/CMakeLists.txt +++ b/vtk_viewer/test/CMakeLists.txt @@ -1,9 +1,12 @@ find_package(GTest REQUIRED) add_executable(${PROJECT_NAME}_unit utest.cpp) -target_link_libraries(${PROJECT_NAME}_unit PRIVATE GTest::GTest GTest::Main ${PROJECT_NAME}) +target_link_libraries(${PROJECT_NAME}_unit PRIVATE GTest::GTest GTest::Main ${PROJECT_NAME} ${PCL_LIBRARIES} ${VTK_LIBRARIES}) target_clang_tidy(${PROJECT_NAME}_unit) +target_cxx_version(${PROJECT_NAME} PRIVATE VERSION 14) +target_include_what_you_use(${PROJECT_NAME}) +target_cppcheck(${PROJECT_NAME}) add_code_coverage(${PROJECT_NAME}_unit ALL EXCLUDE ${COVERAGE_EXCLUDE}) add_gtest_discover_tests(${PROJECT_NAME}_unit) -add_dependencies(${PROJECT_NAME}_unit ${PROJECT_NAME}_unit) +add_dependencies(${PROJECT_NAME}_unit ${PROJECT_NAME}) add_dependencies(run_tests ${PROJECT_NAME}_unit) diff --git a/vtk_viewer/test/utest.cpp b/vtk_viewer/test/utest.cpp index ed72e9ae..8c8d4fe4 100644 --- a/vtk_viewer/test/utest.cpp +++ b/vtk_viewer/test/utest.cpp @@ -39,27 +39,25 @@ TEST(ViewerTest, TestCase1) cout << "cutter points: " << cut->GetPoints()->GetNumberOfPoints() << "\n"; cout << "cutter lines: " << cut->GetNumberOfLines() << "\n"; - - vtk_viewer::VTKViewer viz; std::vector color(3); // Display mesh results - color[0] = 0.2; - color[1] = 0.9; - color[2] = 0.9; + color[0] = 0.2f; + color[1] = 0.9f; + color[2] = 0.9f; viz.addPointDataDisplay(points, color); // Display mesh results - color[0] = 0.2; - color[1] = 0.2; - color[2] = 0.9; + color[0] = 0.2f; + color[1] = 0.2f; + color[2] = 0.9f; //viz.addPolyDataDisplay(data, color); - color[0] = 0.1; - color[1] = 0.9; - color[2] = 0.1; + color[0] = 0.1f; + color[1] = 0.9f; + color[2] = 0.1f; //viz.addCellNormalDisplay(data, color, 1.0); viz.addPolyDataDisplay(cut,color);