Commit b612fbd4 authored by schurade's avatar schurade
Browse files

[CHANGE] hide deactived rois in the scene

parent 21785a36
......@@ -459,6 +459,7 @@ float WDataTexture3D::getMinMaxScale()
float WDataTexture3D::scaleInterval( float value ) const
{
return ( value - m_minValue ) / m_scale;
return value;
//return ( value - m_minValue ) / m_scale;
}
......@@ -43,9 +43,29 @@ boost::signals2::signal0< void >* WROI::getSignalIsModified()
void WROI::setNot( bool isNot )
{
m_isNot = isNot;
m_isModified = true;
}
bool WROI::isNot()
{
return m_isNot;
}
bool WROI::isActive()
{
return m_isActive;
}
void WROI::setActive( bool active )
{
m_isActive = active;
m_isModified = true;
}
bool WROI::isModified()
{
bool tmp = m_isModified;
m_isModified = false;
return tmp;
}
......@@ -70,6 +70,26 @@ public:
*/
bool isNot();
/**
* getter
*
* \return the active flag
*/
bool isActive();
/**
* setter
*
* \param active
*/
void setActive( bool active );
/**
* Getter for modified flag
*/
bool isModified();
protected:
osg::ref_ptr< WPickHandler > m_pickHandler; //!< A pointer to the pick handler used to get gui events for moving the box.
......@@ -86,6 +106,8 @@ protected:
bool m_useColor; //!< Indicated whether m_color should be used for display.
bool m_isActive; //!< active or not
private:
/**
* updates the graphics
......
......@@ -199,13 +199,6 @@ wmath::WPosition WROIBox::getMaxPos() const
return m_maxPos;
}
bool WROIBox::isModified()
{
bool tmp = m_isModified;
m_isModified = false;
return tmp;
}
void WROIBox::registerRedrawRequest( WPickInfo pickInfo )
{
boost::unique_lock< boost::shared_mutex > lock;
......@@ -280,13 +273,20 @@ void WROIBox::updateGFX()
if( m_pickInfo.getModifierKey() == WPickInfo::NONE )
{
osg::ref_ptr<osg::Vec4Array> colors = osg::ref_ptr<osg::Vec4Array>( new osg::Vec4Array );
colors->push_back( osg::Vec4( 1.f, .0f, .0f, 0.5f ) );
if ( m_isNot )
{
colors->push_back( osg::Vec4( 1.0f, 0.0f, 0.0f, 0.4f ) );
}
else
{
colors->push_back( osg::Vec4( 0.f, 1.f, 1.f, 0.4f ) );
}
m_surfaceGeometry->setColorArray( colors );
}
if( m_pickInfo.getModifierKey() == WPickInfo::SHIFT && m_pickInfo.getPickNormal() != wmath::WVector3D() )
{
osg::ref_ptr<osg::Vec4Array> colors = osg::ref_ptr<osg::Vec4Array>( new osg::Vec4Array );
colors->push_back( osg::Vec4( .0f, 1.0f, .0f, 0.5f ) );
colors->push_back( osg::Vec4( .0f, 1.0f, .0f, 0.4f ) );
m_surfaceGeometry->setColorArray( colors );
}
}
......@@ -299,10 +299,31 @@ void WROIBox::updateGFX()
if ( m_isPicked && m_pickInfo.getName() == "unpick" )
{
osg::ref_ptr<osg::Vec4Array> colors = osg::ref_ptr<osg::Vec4Array>( new osg::Vec4Array );
colors->push_back( osg::Vec4( 0.f, 0.f, 1.f, 0.5f ) );
if ( m_isNot )
{
colors->push_back( osg::Vec4( 1.0f, 0.f, 0.f, 0.4f ) );
}
else
{
colors->push_back( osg::Vec4( 0.f, 1.f, 1.f, 0.4f ) );
}
m_surfaceGeometry->setColorArray( colors );
m_isPicked = false;
}
if ( isModified() )
{
osg::ref_ptr<osg::Vec4Array> colors = osg::ref_ptr<osg::Vec4Array>( new osg::Vec4Array );
if ( m_isNot )
{
colors->push_back( osg::Vec4( 1.0f, 0.f, 0.f, 0.4f ) );
}
else
{
colors->push_back( osg::Vec4( 0.f, 1.f, 1.f, 0.4f ) );
}
m_surfaceGeometry->setColorArray( colors );
}
lock.unlock();
}
......@@ -61,10 +61,6 @@ public:
*/
wmath::WPosition getMaxPos() const;
/**
* Getter for modified flag
*/
bool isModified();
protected:
private:
......
......@@ -166,6 +166,18 @@ void WRMROIRepresentation::setDirty()
void WRMROIRepresentation::slotToggleNot()
{
m_roi->setNot( m_isNot->get() );
m_roi->setActive( m_isActive->get() );
if ( m_isActive->get() )
{
m_roi->setNodeMask( 0xFFFFFFFF );
}
else
{
m_roi->setNodeMask( 0x0 );
}
setDirty();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment