PointCloudLibrary / PointCloudLibrary/pcl

PCLVisualizerInteractorStyle protects inherited member functions

Open
#2,561 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: visualization needs: code review
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Your Environment

  • Operating System and version: Ubuntu Mate 16.04.5 LTS
  • Compiler: GCC 5.4.0
  • PCL Version: 1.8.0

Context

The member functions OnChar, OnKeyDown, OnKeyUp, OnMouseMove, OnLeftButtonDown, OnLeftButtonUp, OnMiddleButtonDown, OnMiddleButtonUp, OnRightButtonDown, OnRightButtonUp, OnMouseWheelForward, OnMouseWheelBackward, OnTimer, zoomIn and zoomOut are protected in PCLVisualizerInteractorStyle.

In my case, I want to control the QVTKWidget by buttons in a QT GUI including a zoom feature which could conveniently be implemented by accessing zoomIn and zoomOut.

PCLVisualizerInteractorStyle inherits from vtkInteractorStyleRubberBandPick, where the member functions above are public, so for me there is no apparent reason why they should be protected.
Using a custom interactor style via setupInteractor from PCLVisualizer does not work either, because the only interactors which can be loaded have to inherit from PCLVisualizerInteractorStyle.

Reimplementing the behaviour of zoomIn and zoomOut by accessing the interactor style via getInteractorStyle() is not possible as well because void vtkInteractorStyleTrackballCamera::Dolly(double factor) from VTK is a protected function as well.

Expected Behavior

The member functions listed above should be public to be able to access them from user programs which try to alter the behaviour of the PCLVisualizer. There is no apparent reason why they should be protected, because they cannot leak any information or could be used in a malicious way.

The described behaviour has not been changed in master.

Possible Solution

Make "OnChar, OnKeyDown, OnKeyUp, OnMouseMove, OnLeftButtonDown, OnLeftButtonUp, OnMiddleButtonDown, OnMiddleButtonUp, OnRightButtonDown, OnRightButtonUp, OnMouseWheelForward, OnMouseWheelBackward, OnTimer, zoomIn and zoomOut" public instead of protected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the declaration of PCLVisualizerInteractorStyle and inspect how the listed handlers and zoomIn/zoomOut are exposed relative to the inherited VTK interactor style. Make the requested API visibility change, then build the visualization component and verify that user code can access the listed functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.