Commit 11acd86f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents 23069be1 42467dc3
...@@ -78,18 +78,13 @@ void WPathHelper::setBasePaths( boost::filesystem::path appPath, boost::filesyst ...@@ -78,18 +78,13 @@ void WPathHelper::setBasePaths( boost::filesystem::path appPath, boost::filesyst
void WPathHelper::setBasePathsOSXBundle( boost::filesystem::path appPath, boost::filesystem::path homePath ) void WPathHelper::setBasePathsOSXBundle( boost::filesystem::path appPath, boost::filesystem::path homePath )
{ {
//W_ASSERT( appPath.substr( size()-sizeof( "MacOS" ), sizeof( "MacOS" ) ) == "MacOS" ); setBasePaths( appPath, homePath ); // set all to ordinary paths, but the following are different:
m_appPath = appPath;
m_homePath = homePath;
m_sharePath = m_appPath / "../Resources/openwalnut"; m_sharePath = m_appPath / "../Resources/openwalnut";
m_docPath = m_appPath / "../Resources/doc"; m_docPath = m_appPath / "../Resources/doc";
m_configPath = m_appPath / "../Resources/openwalnut"; m_configPath = m_appPath / "../Resources/openwalnut";
m_libPath = m_appPath / ".." / W_LIB_DIR_RELATIVE; // NOTE: this variable is set by CMake.
// This is the default search path. Use getAllModulePaths for finding all modules, including those whose
// directories where defined by the user.
m_modulePath = m_appPath / "../Resources/modules"; m_modulePath = m_appPath / "../Resources/modules";
// this is the relative path for module resources. It is relative to the path of the lib containing the module.
// The MacOSX bundle stores the modules in Resources/modules. We want the additional resources to be stored in the module's directory. // The MacOSX bundle stores the modules in Resources/modules. We want the additional resources to be stored in the module's directory.
m_moduleResourcePathRelative = boost::filesystem::path( "." ); m_moduleResourcePathRelative = boost::filesystem::path( "." );
} }
......
...@@ -32,7 +32,7 @@ WDataTexture3D::WDataTexture3D( boost::shared_ptr< WValueSetBase > valueSet, boo ...@@ -32,7 +32,7 @@ WDataTexture3D::WDataTexture3D( boost::shared_ptr< WValueSetBase > valueSet, boo
WGETexture3D( static_cast< float >( valueSet->getMaximumValue() - valueSet->getMinimumValue() ), WGETexture3D( static_cast< float >( valueSet->getMaximumValue() - valueSet->getMinimumValue() ),
static_cast< float >( valueSet->getMinimumValue() ) ), static_cast< float >( valueSet->getMinimumValue() ) ),
m_valueSet( valueSet ), m_valueSet( valueSet ),
m_boundingBox( grid->getBoundingBoxIncludingBorder() ) m_boundingBox( grid->getVoxelBoundingBox() )
{ {
// initialize members // initialize members
setTextureSize( grid->getNbCoordsX(), grid->getNbCoordsY(), grid->getNbCoordsZ() ); setTextureSize( grid->getNbCoordsX(), grid->getNbCoordsY(), grid->getNbCoordsZ() );
...@@ -61,9 +61,9 @@ WDataTexture3D::WDataTexture3D( boost::shared_ptr< WValueSetBase > valueSet, boo ...@@ -61,9 +61,9 @@ WDataTexture3D::WDataTexture3D( boost::shared_ptr< WValueSetBase > valueSet, boo
// Move to voxel center. This scaling is NOT included in the grid's transform, so we need to add it here // Move to voxel center. This scaling is NOT included in the grid's transform, so we need to add it here
WMatrix4d offset = WMatrix4d::identity(); WMatrix4d offset = WMatrix4d::identity();
offset( 0, 3 ) = 0.5 / grid->getNbCoordsX(); offset( 3, 0 ) = 0.5 / grid->getNbCoordsX();
offset( 1, 3 ) = 0.5 / grid->getNbCoordsY(); offset( 3, 1 ) = 0.5 / grid->getNbCoordsY();
offset( 2, 3 ) = 0.5 / grid->getNbCoordsZ(); offset( 3, 2 ) = 0.5 / grid->getNbCoordsZ();
transformation()->set( invert( static_cast< WMatrix4d >( grid->getTransform() ) ) * scale * offset ); transformation()->set( invert( static_cast< WMatrix4d >( grid->getTransform() ) ) * scale * offset );
......
...@@ -278,6 +278,13 @@ public: ...@@ -278,6 +278,13 @@ public:
*/ */
virtual WBoundingBox getBoundingBox() const; virtual WBoundingBox getBoundingBox() const;
/**
* Copy the values of all properties except the texture transformation into the properties of this texture.
*
* \param from The texture to copy property values from.
*/
virtual void copyPropertiesExceptTransformation( osg::ref_ptr< WGETexture< TextureType > > const& from );
protected: protected:
/** /**
* Handles all property updates. Called by m_propCondition. * Handles all property updates. Called by m_propCondition.
...@@ -774,6 +781,29 @@ WBoundingBox WGETexture< TextureType >::getBoundingBox() const ...@@ -774,6 +781,29 @@ WBoundingBox WGETexture< TextureType >::getBoundingBox() const
return WBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ); return WBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 );
} }
template < typename TextureType >
void WGETexture< TextureType >::copyPropertiesExceptTransformation( osg::ref_ptr< WGETexture< TextureType > > const& from )
{
m_name->set( from->m_name->get() );
m_sortIdx->set( from->m_sortIdx->get() );
m_min->set( from->m_min->get() );
m_scale->set( from->m_scale->get() );
m_alpha->set( from->m_alpha->get() );
m_clipZero->set( from->m_clipZero->get() );
m_thresholdEnabled->set( from->m_thresholdEnabled->get() );
m_thresholdLower->set( from->m_thresholdLower->get() );
m_thresholdUpper->set( from->m_thresholdUpper->get() );
m_windowEnabled->set( from->m_windowEnabled->get() );
m_window->set( from->m_window->get() );
m_interpolation->set( from->m_interpolation->get() );
m_colorMapSelectionsList = from->m_colorMapSelectionsList;
m_colorMap->set( from->m_colorMap->get() );
m_active->set( from->m_active->get() );
}
template < typename TextureType > template < typename TextureType >
WPVBaseTypes::PV_INT WGETexture< TextureType >::getUnsetSortIndex() WPVBaseTypes::PV_INT WGETexture< TextureType >::getUnsetSortIndex()
{ {
......
...@@ -333,10 +333,11 @@ void WMData::matrixUpdate() ...@@ -333,10 +333,11 @@ void WMData::matrixUpdate()
// Update the m_dataSet // Update the m_dataSet
m_dataSet = m_dataSetAsSingle->clone( newGrid ); m_dataSet = m_dataSetAsSingle->clone( newGrid );
// Update textures? Keep trakc of old
// carry over old properties (i.e. colormap) except for the new transform
if( m_dataSet->isTexture() && m_dataSet->getTexture() ) if( m_dataSet->isTexture() && m_dataSet->getTexture() )
{ {
m_dataSet->getTexture()->getProperties()->set( m_dataSetAsSingle->getTexture()->getProperties() ); m_dataSet->getTexture()->copyPropertiesExceptTransformation( m_dataSetAsSingle->getTexture() );
} }
m_dataSetAsSingle = boost::dynamic_pointer_cast< WDataSetSingle >( m_dataSet ); m_dataSetAsSingle = boost::dynamic_pointer_cast< WDataSetSingle >( m_dataSet );
......
...@@ -53,8 +53,7 @@ ...@@ -53,8 +53,7 @@
W_LOADABLE_MODULE( WMNavigationSlices ) W_LOADABLE_MODULE( WMNavigationSlices )
WMNavigationSlices::WMNavigationSlices(): WMNavigationSlices::WMNavigationSlices():
WModule(), WModule()
m_first( true )
{ {
} }
...@@ -154,14 +153,10 @@ void WMNavigationSlices::initOSG() ...@@ -154,14 +153,10 @@ void WMNavigationSlices::initOSG()
m_yPos->setHidden( false ); m_yPos->setHidden( false );
m_zPos->setHidden( false ); m_zPos->setHidden( false );
// if this is done the first time, set the slices to the center of the dataset // always update slice positions if they happen to be outside the bounding box (i.e. after shrinking the box)
if( m_first ) m_xPos->setRecommendedValue( midBB[0] );
{ m_yPos->setRecommendedValue( midBB[1] );
m_first = false; m_zPos->setRecommendedValue( midBB[2] );
m_xPos->setRecommendedValue( midBB[0] );
m_yPos->setRecommendedValue( midBB[1] );
m_zPos->setRecommendedValue( midBB[2] );
}
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// Navigation View Setup // Navigation View Setup
......
...@@ -225,11 +225,6 @@ private: ...@@ -225,11 +225,6 @@ private:
WPropBool m_showonY; //!< indicates whether the vector should be shown on slice Y WPropBool m_showonY; //!< indicates whether the vector should be shown on slice Y
WPropBool m_showonZ; //!< indicates whether the vector should be shown on slice Z WPropBool m_showonZ; //!< indicates whether the vector should be shown on slice Z
/**
* If true, the nav slices get positioned in the middle of the first dataset.
*/
bool m_first;
}; };
#endif // WMNAVIGATIONSLICES_H #endif // WMNAVIGATIONSLICES_H
......
...@@ -277,7 +277,18 @@ void WMainWindow::setupGUI() ...@@ -277,7 +277,18 @@ void WMainWindow::setupGUI()
m_permanentToolBar = new WQtToolBar( "Standard Toolbar", this ); m_permanentToolBar = new WQtToolBar( "Standard Toolbar", this );
addToolBar( Qt::TopToolBarArea, m_permanentToolBar ); addToolBar( Qt::TopToolBarArea, m_permanentToolBar );
m_permanentToolBar->setVisible( false );
// math: Due to this issue: http://www.openwalnut.org/issues/406 resp.
// http://stackoverflow.com/questions/31983269/how-to-identify-a-certain-qt-widget
// There might be a white box, on Apple Mac OSX only, which sometimes hides the window buttons
// for maximization, minimization and closing. This is extremely disturbing, hence, we leave them
// visible as a default. I know this fixes only the symptom, but not the origin, but I've searched
// some days by now and couldn't find anything. I will describe all I found so far in the ticket 406.
#ifndef W_OS_OSX
m_permanentToolBar->setVisible( false );
#else
m_permanentToolBar->setVisible( true );
#endif
m_loadButton = new QAction( m_iconManager.getIcon( "load" ), "Load Dataset or Project", m_permanentToolBar ); m_loadButton = new QAction( m_iconManager.getIcon( "load" ), "Load Dataset or Project", m_permanentToolBar );
m_loadButton->setShortcut( QKeySequence( QKeySequence::Open ) ); m_loadButton->setShortcut( QKeySequence( QKeySequence::Open ) );
...@@ -537,7 +548,18 @@ void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar ) ...@@ -537,7 +548,18 @@ void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar )
m_currentCompatiblesToolbar, SLOT( setToolButtonStyle( Qt::ToolButtonStyle ) ) ); m_currentCompatiblesToolbar, SLOT( setToolButtonStyle( Qt::ToolButtonStyle ) ) );
// and the position of the toolbar // and the position of the toolbar
toolbar->setVisible( false ); // math: Due to this issue: http://www.openwalnut.org/issues/406 resp.
// http://stackoverflow.com/questions/31983269/how-to-identify-a-certain-qt-widget
// There might be a white box, on Apple Mac OSX only, which sometimes hides the window buttons
// for maximization, minimization and closing. This is extremely disturbing, hence, we leave them
// visible as a default. I know this fixes only the symptom, but not the origin, but I've searched
// some days by now and couldn't find anything. I will describe all I found so far in the ticket 406.
#ifndef W_OS_OSX
toolbar->setVisible( false );
#else
toolbar->setVisible( true );
#endif
addToolBar( Qt::TopToolBarArea, m_currentCompatiblesToolbar ); addToolBar( Qt::TopToolBarArea, m_currentCompatiblesToolbar );
} }
......
...@@ -158,7 +158,7 @@ int WQtGui::run() ...@@ -158,7 +158,7 @@ int WQtGui::run()
WApplication appl( m_argc, m_argv, true ); WApplication appl( m_argc, m_argv, true );
// the call path of the application, this uses QApplication which needs to be instantiated. // the call path of the application, this uses QApplication which needs to be instantiated.
boost::filesystem::path walnutBin = boost::filesystem::path( QApplication::applicationDirPath().toStdString() ); boost::filesystem::path walnutBin( QApplication::applicationDirPath().toStdString() );
// setup path helper which provides several paths to others // setup path helper which provides several paths to others
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
......
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