Commit b14a051e authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - show axial/coronal and sagittal props now reside in selection...

[CHANGE] - show axial/coronal and sagittal props now reside in selection manager and are therefore available to others too
parent 0c3af408
......@@ -45,9 +45,14 @@ WSelectionManager::WSelectionManager() :
"Properties relating to the Axial,Coronal and Sagittal Slices." ) );
// create dummy properties for slices. Get updated by modules.
m_axialPos = m_sliceGroup->addProperty( "Sagittal Position", "Slice X position.", 0.0, true );
m_coronalPos = m_sliceGroup->addProperty( "Coronal Position", "Slice Y position.", 0.0, true );
m_sagittalPos = m_sliceGroup->addProperty( "Axial Position", "Slice Z position.", 0.0, true );
m_axialPos = m_sliceGroup->addProperty( "Axial Position", "Slice X position.", 0.0, true );
m_coronalPos = m_sliceGroup->addProperty( "Coronal Position", "Slice Y position.", 0.0, true );
m_sagittalPos = m_sliceGroup->addProperty( "Sagittal Position", "Slice Z position.", 0.0, true );
// visibility flags
m_axialShow = m_sliceGroup->addProperty( "Show Axial Slice", "Slice visible?", true, true );
m_coronalShow = m_sliceGroup->addProperty( "Show Coronal Slice", "Slice visible?", true, true );
m_sagittalShow = m_sliceGroup->addProperty( "Show Sagittal Slice", "Slice visible?", true, true );
// until now, no bbox information is available.
m_axialPos->setMin( 0.0 );
......@@ -204,6 +209,21 @@ WPropDouble WSelectionManager::getPropSagittalPos()
return m_sagittalPos;
}
WPropBool WSelectionManager::getPropAxialShow()
{
return m_axialShow;
}
WPropBool WSelectionManager::getPropCoronalShow()
{
return m_coronalShow;
}
WPropBool WSelectionManager::getPropSagittalShow()
{
return m_sagittalShow;
}
void WSelectionManager::setShader( int shader )
{
m_shader = shader;
......
......@@ -122,40 +122,47 @@ public:
void setTextureOpacity( float value );
/**
* setter. These props automatically update the crosshair position
* \param prop
* The property controlling the current axial position of slices.
*
* \return property as double
*/
void setPropAxialPos( WPropDouble prop );
WPropDouble getPropAxialPos();
/**
* setter. These props automatically update the crosshair position
* \param prop
* The property controlling the current coronal position of slices.
*
* \return property as double
*/
void setPropCoronalPos( WPropDouble prop );
WPropDouble getPropCoronalPos();
/**
* setter. These props automatically update the crosshair position
* \param prop
* The property controlling the current sagittal position of slices.
*
* \return property as double
*/
void setPropSagittalPos( WPropDouble prop );
WPropDouble getPropSagittalPos();
/**
* getter
* \return property
* The property controlling the current axial visible-flag.
*
* \return property as bool
*/
WPropDouble getPropAxialPos();
WPropBool getPropAxialShow();
/**
* getter
* \return property
* The property controlling the current coronal visible-flag.
*
* \return property as bool
*/
WPropDouble getPropCoronalPos();
WPropBool getPropCoronalShow();
/**
* getter
* \return property
* The property controlling the current sagittal visible-flag.
*
* \return property as bool
*/
WPropDouble getPropSagittalPos();
WPropBool getPropSagittalShow();
/**
* setter for the shader index to be used with the custom texture
......@@ -198,6 +205,21 @@ private:
*/
WPropDouble m_sagittalPos;
/**
* Axial visible-flag.
*/
WPropBool m_axialShow;
/**
* Coronal visible-flag.
*/
WPropBool m_coronalShow;
/**
* Sagittal visible-flag.
*/
WPropBool m_sagittalShow;
/**
* The connection for the axial property
*/
......
......@@ -94,14 +94,14 @@ void WMNavigationSlices::properties()
// enable slices
// Flags denoting whether the glyphs should be shown on the specific slice
m_showonX = m_sliceGroup->addProperty( "Show Sagittal", "Show vectors on sagittal slice.", true );
m_showonY = m_sliceGroup->addProperty( "Show Coronal", "Show vectors on coronal slice.", true );
m_showonZ = m_sliceGroup->addProperty( "Show Axial", "Show vectors on axial slice.", true );
m_showonX = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalShow() );
m_showonY = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalShow() );
m_showonZ = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialShow() );
// The slice positions.
m_xPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalPos() );
m_yPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalPos() );
m_zPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialPos() );
m_xPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalPos() );
m_yPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalPos() );
m_zPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialPos() );
// call WModule's initialization
WModule::properties();
......
......@@ -396,6 +396,25 @@ void WMainWindow::setupGUI()
}
}
// create the show/hide actions using the selection manager's props
WQtPropertyBoolAction* showAxial = new WQtPropertyBoolAction( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialShow(),
m_permanentToolBar );
showAxial->setToolTip( "Toggle Axial Slice" );
showAxial->setText( "Toggle Axial Slice" );
showAxial->setIcon( m_iconManager.getIcon( "axial icon" ) );
WQtPropertyBoolAction* showCoronal = new WQtPropertyBoolAction( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalShow(),
m_permanentToolBar );
showCoronal->setToolTip( "Toggle Coronal Slice" );
showCoronal->setText( "Toggle Coronal Slice" );
showCoronal->setIcon( m_iconManager.getIcon( "coronal icon" ) );
WQtPropertyBoolAction* showSagittal = new WQtPropertyBoolAction( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalShow(),
m_permanentToolBar );
showSagittal->setToolTip( "Toggle Sagittal Slice" );
showSagittal->setText( "Toggle Sagittal Slice" );
showSagittal->setIcon( m_iconManager.getIcon( "sagittal icon" ) );
// Temporarily disabled. We need a proper command prompt implementation first.
// create command prompt toolbar
// m_commandPrompt = new WQtCommandPromptToolbar( "Command Prompt", this );
......@@ -411,6 +430,10 @@ void WMainWindow::setupGUI()
m_permanentToolBar->addAction( resetButton );
m_permanentToolBar->addAction( roiButton );
m_permanentToolBar->addSeparator();
m_permanentToolBar->addAction( showAxial );
m_permanentToolBar->addAction( showCoronal );
m_permanentToolBar->addAction( showSagittal );
m_permanentToolBar->addSeparator();
// after creating the GUI, restore its saved state
restoreSavedState();
......@@ -426,25 +449,9 @@ void WMainWindow::autoAdd( boost::shared_ptr< WModule > module, std::string prot
}
}
void WMainWindow::moduleSpecificCleanup( boost::shared_ptr< WModule > module )
void WMainWindow::moduleSpecificCleanup( boost::shared_ptr< WModule > /* module */ )
{
// nav slices use separate buttons for slice on/off switching
if( module->getName() == "Navigation Slices" )
{
boost::shared_ptr< WPropertyBase > prop;
prop = module->getProperties()->findProperty( "showAxial" );
m_permanentToolBar->removeAction( propertyActionMap[prop] );
propertyActionMap.erase( prop );
prop = module->getProperties()->findProperty( "showCoronal" );
m_permanentToolBar->removeAction( propertyActionMap[prop] );
propertyActionMap.erase( prop );
prop = module->getProperties()->findProperty( "showSagittal" );
m_permanentToolBar->removeAction( propertyActionMap[prop] );
propertyActionMap.erase( prop );
}
// called for each removed module. Use this to undo modifications done due to added modules (moduleSpecificSetup)
}
void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
......@@ -485,61 +492,6 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
autoAdd( module, "EEG View" );
}
}
// nav slices use separate buttons for slice on/off switching
if( module->getName() == "Navigation Slices" )
{
boost::shared_ptr< WPropertyBase > prop = module->getProperties()->findProperty( "Slices/Show Axial" );
if( !prop )
{
WLogger::getLogger()->
addLogMessage( "Navigation Slices module does not provide the property \"Show Axial\", which is required by the GUI.", "GUI",
LL_ERROR );
}
else
{
WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
a->setToolTip( "Toggle Axial Slice" );
a->setText( "Toggle Axial Slice" );
a->setIcon( m_iconManager.getIcon( "axial icon" ) );
m_permanentToolBar->addAction( a );
propertyActionMap[prop] = a;
}
prop = module->getProperties()->findProperty( "Slices/Show Coronal" );
if( !prop )
{
WLogger::getLogger()->
addLogMessage( "Navigation Slices module does not provide the property \"Show Coronal\", which is required by the GUI.", "GUI",
LL_ERROR );
}
else
{
WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
a->setToolTip( "Toggle Coronal Slice" );
a->setText( "Toggle Coronal Slice" );
a->setIcon( m_iconManager.getIcon( "coronal icon" ) );
m_permanentToolBar->addAction( a );
propertyActionMap[prop] = a;
}
prop = module->getProperties()->findProperty( "Slices/Show Sagittal" );
if( !prop )
{
WLogger::getLogger()->
addLogMessage( "Navigation Slices module does not provide the property \"Show Sagittal\", which is required by the GUI.", "GUI",
LL_ERROR );
}
else
{
WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
a->setToolTip( "Toggle Saggital Slice" );
a->setText( "Toggle Saggital Slice" );
a->setIcon( m_iconManager.getIcon( "sagittal icon" ) );
m_permanentToolBar->addAction( a );
propertyActionMap[prop] = a;
}
}
}
void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar )
......
......@@ -330,12 +330,6 @@ private:
bool m_navSlicesAlreadyLoaded; //!< if true, the navslices have been loaded already
/**
* Map holding the actions for module properties added automatically. So they can be removed again automatically
* if the module is removed.
*/
std::map< boost::shared_ptr< WPropertyBase >, WQtPropertyBoolAction* > propertyActionMap;
/**
* Loads the window states and geometries from a file.
*/
......
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