Skip to content
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

Extend viewer3 d #1259

Merged
merged 11 commits into from
Apr 8, 2017
Merged

Conversation

JacquesOlivierLachaud
Copy link
Member

@JacquesOlivierLachaud JacquesOlivierLachaud commented Apr 2, 2017

PR Description

This PR provides a reasonnable and easy way to extend the QGLViewer-based viewer of DGtal. Indeed, one cannot derive directly from the Viewer3D class and override methods. We provide here an Extension base class, that users have to derive in order to create a new interface. A simple example is provided.
Note also that this PR fixes some typos in class Viewer3D.

Checklist

  • NA Unit-test of your feature with Catch.
  • Doxygen documentation of the code completed (classes, methods, types, members...)
  • Documentation module page added or updated.
  • New entry in the ChangeLog.md added.
  • No warning raised in Debug cmake mode (otherwise, Travis C.I. will fail).
  • All continuous integration tests pass (Travis & appveyor)

@JacquesOlivierLachaud
Copy link
Member Author

For codacy/pr, I think the issue raised are stupid (methods are not called because it is event programming).
I modify the dox comments for travis-ci.

@dcoeurjo
Copy link
Member

dcoeurjo commented Apr 3, 2017

agree... the code coverage tests in codacy are a bit crappy

@JacquesOlivierLachaud
Copy link
Member Author

I don't understand why travis fails ? Is there a configuration problem ?

@dcoeurjo
Copy link
Member

dcoeurjo commented Apr 5, 2017

there is a brew issue when installing the deps on macOS bots. Just try to relaunch the build (there is nothing we can do I think)

@dcoeurjo
Copy link
Member

dcoeurjo commented Apr 6, 2017

Travis ok now.

@kerautret
Copy link
Member

yes nice I look it! for codacy agree we can désactivante some detection i think ;)

@kerautret kerautret self-assigned this Apr 6, 2017
( rand() % d[ 1 ] ) + p[ 1 ],
( rand() % d[ 2 ] ) + p[ 2 ] );
viewer << a;
viewer << Viewer::updateDisplay;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, the updateDisplay resets the camera settings .. which is a bit odd..
Maybe this could be fixed in the Viewer3D, @kerautret, any idea?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, updateDisplay call updateList with the update of the boundingbox (looks natural in classical use) but with this nice extension is should be better to add a new something like Viewer::updateDisplayFix which is equivalent but with no update.
Else you can simply equivalently call viewer.updateList(false); instead Viewer::updateDisplay; and you will have it ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied an improvement to avoid to add new display options, @JacquesOlivierLachaud I PR it on your branch: it checked if the BB has changed and it changed camera position only if the BB changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kerautret With your PR, do I have now to call viewer.updateList(false); instead of Viewer::updateDisplay ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary in your example the BB don't change so the camera will not move. And in other cases it is looks fine if the BB scene change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I fix David's comment and the PR will be ready.

*
* This part of the manual describes how to extend the standard
* Viewer3D interface of DGtal. For instance, you wish to assign new
* reactions to keys or to mouse event, or you wish to display or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reactions -> handlers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if you prefer.

* - Viewer3D::Extension::keyPressEvent. This method may be
* overloaded to capture other key events.
*
* - Viewer3D::Extension::drawWithNames. This method is useful for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting.. would you have an example of that ?

Copy link
Member Author

@JacquesOlivierLachaud JacquesOlivierLachaud Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used indirectly in the mini-interaction method, see for instance
https://github.com/DGtal-team/DGtal/blob/master/examples/io/viewers/viewer3D-10-interaction.cpp
I do not have a useful example here for overriding it, but it was natural to provide ways to override all the standard methods provided by libQGLViewer.

@dcoeurjo
Copy link
Member

dcoeurjo commented Apr 7, 2017

👌
Can I merge, @JacquesOlivierLachaud ?

@kerautret
Copy link
Member

fine also for me ;)

@JacquesOlivierLachaud
Copy link
Member Author

I think so !

@dcoeurjo
Copy link
Member

dcoeurjo commented Apr 8, 2017

go... ;)

@dcoeurjo dcoeurjo merged commit 61a3ce7 into DGtal-team:master Apr 8, 2017
@JacquesOlivierLachaud JacquesOlivierLachaud deleted the ExtendViewer3D branch April 8, 2017 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants