Commit 6de08d43 authored by Joshua Santana's avatar Joshua Santana
Browse files

Merge branch 'top2021s5/#105_fix_gradient_hiding' into 'sprint_5'

[MERGE] properties for transfer function color bar name label and max scale value

See merge request top/21s/sivert-vis/sivert-vis-project!87
parents ecdc87d4 7ff285ab
......@@ -147,6 +147,10 @@ void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArra
}
}
m_colorBar->getProperties()->getProperty( "Max scale value" )->set( 0.0 );
m_colorBar->getProperties()->getProperty( "Max scale value" )->set( maxClusterSize );
m_colorBar->getProperties()->getProperty( "Description" )->set( std::string( "Clustersize " ) );
bool activated = m_propertyStatus->getVisualizationPropertyHandler()->getColorFromEdep()->get();
m_colorBar->getProperties()->getProperty( "active" )->toPropBool()->set( activated );
......
......@@ -99,6 +99,10 @@ void WMTransferFunctionColorBar::properties()
m_colorBarLabels->setMin( 0 );
m_colorBarLabels->setMax( 55 );
m_maxScaleValue = m_properties->addProperty( "Max scale value", "Maximum scale value in dataset", 1.0, true );
m_colorBarDescription = m_properties->addProperty( "Description", "Description of current transfer function",
std::string( "TransferFunction" ), true ),
WModule::properties();
}
......@@ -214,7 +218,7 @@ void WMTransferFunctionColorBar::moduleMain()
osg::ref_ptr< WGELabel > nameLabel = new WGELabel();
nameLabel->setPosition( osg::Vec3( 0.015, 0.9, 0.0 ) );
// nameLabel->setText( format( dataSet->getTexture()->name()->get() ) );
nameLabel->setText( format( "TransferFunction" ) );
nameLabel->setText( format( m_colorBarDescription->get() ) );
nameLabel->setCharacterSize( 0.015 );
nameLabel->setLayout( osgText::TextBase::VERTICAL );
nameLabel->setAlignment( osgText::Text::BASE_LINE );
......@@ -247,7 +251,7 @@ void WMTransferFunctionColorBar::moduleMain()
m_barProjection->addChild( matrix );
m_valueMin = 0.0; // dataSet->getTexture()->minimum()->get();
m_valueScale = 1.0; // dataSet->getTexture()->scale()->get();
m_valueScale = m_maxScaleValue->get(); // dataSet->getTexture()->scale()->get();
// add
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_barProjection );
......@@ -281,7 +285,7 @@ void WMTransferFunctionColorBar::activate()
void WMTransferFunctionColorBar::updateColorbarScale( osg::Node* scaleLabels )
{
if( m_colorBarLabels->changed( true ) )
if( m_colorBarLabels->changed( true ) || m_maxScaleValue->changed( true ) )
{
const double labelXPos = 0.060;
osg::Geode* g = scaleLabels->asGeode();
......@@ -289,7 +293,7 @@ void WMTransferFunctionColorBar::updateColorbarScale( osg::Node* scaleLabels )
size_t num = m_colorBarLabels->get( true );
double coordStep = 0.8 / static_cast< double >( num - 1 );
double valueStep = m_valueScale / static_cast< double >( num - 1 );
double valueStep = m_maxScaleValue->get() / static_cast< double >( num - 1 );
// less than 2 labels is useless
if( num < 2 )
......
......@@ -147,6 +147,16 @@ private:
*/
WPropBool m_colorBarBorder;
/**
* Maximum scaling factor of the current dataset.
*/
WPropDouble m_maxScaleValue;
/**
* Description of the color bar.
*/
WPropString m_colorBarDescription;
/**
* The projection node for the colorbar and labels
*/
......
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