Skip to content

Commit

Permalink
Address review comments and update to latest cmake_common_scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mpowelson committed Jul 8, 2020
1 parent b342ee4 commit 39913fa
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion noether_filtering/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>Apache 2.0</license>
<author email="[email protected]">Jorge Nicho</author>

<depend>console_bridge</depend>
<depend>libconsole-bridge-dev</depend>
<depend>pluginlib</depend>
<depend>libpcl-all-dev</depend>
<export>
Expand Down
13 changes: 10 additions & 3 deletions vtk_viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})

Expand Down
5 changes: 2 additions & 3 deletions vtk_viewer/cmake/vtk_viewer-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}/@[email protected]")
2 changes: 1 addition & 1 deletion vtk_viewer/include/vtk_viewer/mouse_interactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions vtk_viewer/include/vtk_viewer/vtk_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> color);
void addPolyDataDisplay(vtkPolyData* polydata, const std::vector<float>& color);

/**
* @brief addPolyNormalsDisplay Add a renderer and actor for a polydata
Expand All @@ -55,22 +55,22 @@ 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<float> color, double scale);
void addPolyNormalsDisplay(vtkPolyData* polydata, const std::vector<float>& 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<float> color);
void addPointDataDisplay(vtkPoints* points, const std::vector<float>& color);

/**
* @brief addCellNormalDisplay Displays the normals for a mesh object
* @param polydata The mesh object to be displayed
* @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<float> color, double scale);
void addCellNormalDisplay(vtkPolyData* polydata, const std::vector<float>& color, double scale);

/**
* @brief renderDisplay Calls the VTK window Render() command to visualize
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vtk_viewer/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<buildtool_depend>catkin</buildtool_depend>
<build_depend>cmake_common_scripts</build_depend>
<depend>console_bridge</depend>
<depend>libconsole-bridge-dev</depend>
<depend>libpcl-all-dev</depend>

<test_depend>rosunit</test_depend>
Expand Down
8 changes: 4 additions & 4 deletions vtk_viewer/src/vtk_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace vtk_viewer
this->iren_->Start();
}

void VTKViewer::addPointDataDisplay(vtkPoints* points, std::vector<float> color)
void VTKViewer::addPointDataDisplay(vtkPoints* points, const std::vector<float>& color)
{
// Add the grid points to a polydata object
vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
Expand All @@ -81,7 +81,7 @@ namespace vtk_viewer

}

void VTKViewer::addPolyDataDisplay(vtkPolyData* polydata , std::vector<float> color)
void VTKViewer::addPolyDataDisplay(vtkPolyData* polydata, const std::vector<float>& color)
{
// create mapper and add to list
vtkSmartPointer<vtkPolyDataMapper> triangulated_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
Expand Down Expand Up @@ -144,7 +144,7 @@ namespace vtk_viewer
glyph->Update();
}

void VTKViewer::addPolyNormalsDisplay(vtkPolyData* polydata, std::vector<float> color, double scale)
void VTKViewer::addPolyNormalsDisplay(vtkPolyData* polydata, const std::vector<float>& color, double scale)
{
VTK_SP(vtkGlyph3D, glyph);
makeGlyphs(polydata, false, glyph, scale);
Expand All @@ -166,7 +166,7 @@ namespace vtk_viewer
this->renderer_->AddActor(actors_.back());
}

void VTKViewer::addCellNormalDisplay(vtkPolyData *polydata, std::vector<float> color, double scale)
void VTKViewer::addCellNormalDisplay(vtkPolyData *polydata, const std::vector<float>& color, double scale)
{
// get cell and point data

Expand Down
7 changes: 5 additions & 2 deletions vtk_viewer/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 9 additions & 11 deletions vtk_viewer/test/utest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> 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);
Expand Down

0 comments on commit 39913fa

Please sign in to comment.