Skip to content
Snippets Groups Projects
Commit a60f7842 authored by Marc SCHWEITZER's avatar Marc SCHWEITZER :bicyclist:
Browse files

enh(graphics): add default visibility configuration for SNegato2D

Uses the tag from IAdaptor to configure default visibility in `SNegato2D`.  
Enables the possibility to hide the adaptor by default in the xml configuration

Closes #634

Merge branch '634-graphics-add-default-visibility-configuration-for-snegato2d' into 'dev'

See merge request sight/sight!513
parents 3d051e17 37b8c957
Branches 636-video-add-new-videolive-module
Tags
No related merge requests found
......@@ -46,13 +46,17 @@ namespace visuOgreAdaptor
* - \b sliceType(int, int): updates image slice index .
* - \b sliceIndex(int, int, int): updates image slice type.
* - @deprecated \b newImage(): updates the image display to show the new content. call \b update() instead.
* - \b updateVisibility(bool): shows or hides the negato.
* - \b toggleVisibility(): toggle whether the negato is shown or not.
* - \b show(): shows the negato.
* - \b hide(): hides the negato.
*
* @section XML XML Configuration
* @code{.xml}
<service type="::visuOgreAdaptor::SNegato2D">
<inout key="image" uid="..." />
<inout key="tf" uid="..." optional="yes" />
<config layer="default" sliceIndex="axial" filtering="none" tfalpha="true" />
<config layer="default" sliceIndex="axial" filtering="none" tfalpha="true" visible="true" />
</service>
@endcode
*
......@@ -67,6 +71,7 @@ namespace visuOgreAdaptor
* - \b filtering (optional, none/linear/anisotropic, default=none): texture filter type of the negato.
* - \b tfalpha (optional, bool, default=false): if true, the alpha channel of the transfer function is used.
* - \b border (optional, bool, default=true): allows to display the plane border.
* - \b visible (optional, bool, default=true): the visibility of the adaptor.
*/
class VISUOGREADAPTOR_CLASS_API SNegato2D final : public ::fwRenderOgre::IAdaptor
{
......@@ -116,6 +121,12 @@ protected:
/// Disconnects the attached data from the received slot.
VISUOGREADAPTOR_API void stopping() override;
/**
* @brief Sets the negato visibility.
* @param _visible the visibility status of the negato.
*/
VISUOGREADAPTOR_API void setVisible(bool _visible) override;
private:
/// Updates the displayed transfer function.
......
......
......@@ -149,6 +149,7 @@ void SNegato2D::starting()
m_orientation, m_3DOgreTexture, m_filtering, m_border);
this->newImage();
this->setVisible(m_isVisible);
}
//------------------------------------------------------------------------------
......@@ -173,6 +174,7 @@ void SNegato2D::stopping()
void SNegato2D::updating()
{
this->newImage();
this->setVisible(m_isVisible);
this->requestRender();
}
......@@ -360,10 +362,24 @@ void SNegato2D::updateTF()
void SNegato2D::createPlane(const ::Ogre::Vector3& _spacing)
{
this->getRenderService()->makeCurrent();
// Fits the plane to the new texture
m_plane->setVoxelSpacing(_spacing);
m_plane->initializePlane();
m_plane->enableAlpha(m_enableAlpha);
}
//------------------------------------------------------------------------------
void SNegato2D::setVisible(bool _visible)
{
if(m_negatoSceneNode)
{
m_negatoSceneNode->setVisible(_visible);
this->requestRender();
}
}
//-----------------------------------------------------------------------------
} // namespace visuOgreAdaptor.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment