-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve 'u' key in PCLVisualizer: search in shapes LUT too #1241
Improve 'u' key in PCLVisualizer: search in shapes LUT too #1241
Conversation
I wonder how you plan to implement the third item :) |
I don't think that will be ever possible! |
The code needs a lot of cleaning/refactoring but I think the idea is there. |
Smart! |
So you are now VTK and LUT expert, Victor... maybe you can address #1158 as well? |
Because of #1244 I'm stuck. |
Pull request/first message updated, please test with the example code provided! |
I don't understand how your code makes sure that the LUT for the last cloud/shape added to the rendered is displayed. Can you explain the logic? Specifically, why you use forward iterators and |
It's an error, it should be If no cloud/shape id is specified, we'll search for any cloud/shape that has a scalars to display the lookup table. If we found none, we should not display any lookup table. ( When we exit the loop, if I'm still updating this, it's not ready for merging but I would like this to be reviewed by other people. |
But since you want the last one added, shouldn't you rather iterate from the end to the beginning?
To make the status of a pull request clear we may adopt a wide-spread convention: prefix the name with |
I'm not sure how I can achieve this, the typedef boost::unordered_map<std::string, vtkSmartPointer<vtkProp> > ShapeActorMap; As is; the LUT displayed is the last found, it does not especially correspond to the last shape added. |
I'm on vacation till the end of the month. Will have a look early next week. |
/** \brief ID used to fetch/display the look up table on the visualizer | ||
* It should be set by PCLVisualizer \ref setLookUpTableID | ||
* @note If empty, a random actor added to the interactor will be used */ | ||
std::string lut_actor_id_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that a getter/setter would add useless complexity so I made it public.
The PCLVisualizer directly modifies the string here for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PCLVisualizer
is a friend, so will be able access this even if it is made private. I would strongly prefer to not have public member fields.
You are right, sorry. Unordered map does not have a reverse iterator. |
@taketwo Some free time for reviewing? |
For me this last section is a bit hard to follow, e.g. it's not immediately obvious that all cases/possibilities are covered. But since I don't have any specific suggestions how it could be improved, and since it actually works (until proved otherwise :) ), I think I'm fine with merging this pull request. Please make a fix according to my inline comment though. Thanks! |
Yes this section is quite tricky and handles all the cases well from what I've tested. |
Improve 'u' key in PCLVisualizer: search in shapes LUT too
Fixes #1240
Features
1st commit
addModelFromPolyData(vtkPolyDataMapper)
because it is not needed (mapper can be set to avtkPolyData
) and causes some visualization functions to crash (setting shading for example)2nd commit
setLookUpTableID
setShapeProperties
. The LUT is only updated if the shape updated is the one used for the LUT display (either because it is the one found automatically or the user defined which ID should be used)Examples