Commit c0d4db71 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[MERGE]

parents 06d2fa79 6084c618
......@@ -152,5 +152,8 @@ ENDIF()
# Modules
# build modules
ADD_SUBDIRECTORY( modules )
OPTION( OW_MODULE_BUILD "Enable this to build the modules." ON )
IF( OW_MODULE_BUILD )
ADD_SUBDIRECTORY( modules )
ENDIF()
......@@ -65,7 +65,7 @@ namespace wlimits
*
* \return True if the value is a NaN, false otherwise.
*/
template< typename T > bool isnan( T value );
template< typename T > bool isNaN( T value );
/**
* Determines if a number is considered as infinity or not.
......@@ -76,15 +76,15 @@ namespace wlimits
*
* \return True if the value is infinity, false otherwise.
*/
template< typename T > bool isinf( T value );
template< typename T > bool isInf( T value );
}
template< typename T > bool wlimits::isnan( T value )
template< typename T > bool wlimits::isNaN( T value )
{
return boost::math::isnan( value );
}
template< typename T > bool wlimits::isinf( T value )
template< typename T > bool wlimits::isInf( T value )
{
return boost::math::isinf( value );
}
......
......@@ -29,7 +29,6 @@
#include <boost/math/constants/constants.hpp>
#include "WLine.h"
#include "WPlane.h"
#include "linearAlgebra/WLinearAlgebra.h"
......@@ -50,22 +49,6 @@ const float piFloat = boost::math::constants::pi<float>();
*/
const double piDouble = boost::math::constants::pi<double>();
/**
* Tests whether the number stored in the parameter is finite.
* \param number the number to be tested
*/
inline int myIsfinite( double number )
{
#if defined( __linux__ ) || defined( __APPLE__ )
// C99 defines isfinite() as a macro.
return std::isfinite(number);
#elif defined( _WIN32 )
// Microsoft Visual C++ and Borland C++ Builder use _finite().
return _finite(number);
#else
WAssert( false, "isfinite not provided on this platform or platform not known." );
#endif
}
/**
* Checks if the triangle intersects with the given plane. If you are interested in the points of
* intersection if any \see intersection().
......
......@@ -51,7 +51,7 @@ WDataSetTimeSeries::WDataSetTimeSeries( std::vector< boost::shared_ptr< WDataSet
{
WAssert( *dit, "" );
WAssert( g == boost::shared_dynamic_cast< WGridRegular3D >( ( *dit )->getGrid() ), "" );
WAssert( !wlimits::isnan( *tit ), "" );
WAssert( !wlimits::isNaN( *tit ), "" );
WAssert( d == ( *dit )->getValueSet()->getDataType(), "" );
WAssert( ( *dit )->getValueSet()->dimension() == 1, "" );
WAssert( ( *dit )->getValueSet()->order() == 0, "" );
......@@ -107,7 +107,7 @@ bool WDataSetTimeSeries::isTimeSlice( float time ) const
float WDataSetTimeSeries::findNearestTimeSlice( float time ) const
{
WAssert( !wlimits::isnan( time ), "" );
WAssert( !wlimits::isNaN( time ), "" );
if( time > getMaxTime() )
{
return getMaxTime();
......@@ -129,7 +129,7 @@ boost::shared_ptr< WDataSetScalar const > WDataSetTimeSeries::getDataSetPtrAtTim
boost::shared_ptr< WDataSetScalar const > WDataSetTimeSeries::calcDataSetAtTime( float time, std::string const& name ) const
{
WAssert( !wlimits::isnan( time ), "" );
WAssert( !wlimits::isNaN( time ), "" );
if( time < getMinTime() || time > getMaxTime() )
{
return boost::shared_ptr< WDataSetScalar const >();
......
......@@ -263,8 +263,8 @@ Data_T WDataSetTimeSeries::interpolate( WVector3d const& pos, float time, bool*
{
static const float inf = std::numeric_limits< float >::infinity();
WAssert( success, "" );
WAssert( !wlimits::isnan( length( pos ) ), "" );
WAssert( !wlimits::isnan( time ), "" );
WAssert( !wlimits::isNaN( length( pos ) ), "" );
WAssert( !wlimits::isNaN( time ), "" );
if( time < getMinTime() || time > getMaxTime() )
{
*success = false;
......
......@@ -49,7 +49,7 @@ namespace wtracking
// find t such that job.first() + t * dir is a point on the boundary of the current voxel
double t = getDistanceToBoundary( g, job.first, dir );
WAssert( !wlimits::isinf( t ) && !wlimits::isnan( t ), "Warning in WTrackingUtility::followToNextVoxel NaN's or INF's occured" );
WAssert( !wlimits::isInf( t ) && !wlimits::isNaN( t ), "Warning in WTrackingUtility::followToNextVoxel NaN's or INF's occured" );
WAssert( t > 0.0, "" );
WAssert( onBoundary( g, job.first + dir * t ), "" );
......
......@@ -37,7 +37,6 @@
#include <osg/Texture3D>
#include "callbacks/WGEFunctorCallback.h"
#include "../common/WLimits.h"
#include "../common/WBoundingBox.h"
#include "../common/WProperties.h"
#include "../common/WPropertyHelper.h"
......
......@@ -422,7 +422,7 @@ WSymmetricSphericalHarmonic WMBermanTracking::createRandomODF( std::size_t i )
// "-", because the residuals in the input dataset have differing sign
q( k, 0 ) = v( k, 0 ) - ( m_dataSetResidual->getValueAt( i * v.rows() + z ) / ( sqrt( 1.0 - m_HMat( k, k ) ) ) );
WAssert( !wlimits::isnan( q( k, 0 ) ), "" );
WAssert( !wlimits::isNaN( q( k, 0 ) ), "" );
}
// now calc new sh coeffs from the resampled hardi data
......
......@@ -291,7 +291,7 @@ bool WMSplineSurface::save() const
// for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
// {
// point = m_triMesh->getVertex( i );
// if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
// if( !( !wlimits::isInf( point[0] ) && !wlimits::isInf( point[1] ) && !wlimits::isInf( point[2] ) ) )
// {
// WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Marching Cubes", LL_ERROR );
// return false;
......
......@@ -29,6 +29,7 @@
#include "core/common/WStringUtils.h"
#include "core/common/math/WMath.h"
#include "core/common/WPathHelper.h"
#include "core/common/WLimits.h"
#include "core/kernel/WKernel.h"
#include "WMWriteMesh.xpm"
#include "WMWriteMesh.h"
......@@ -186,7 +187,7 @@ bool WMWriteMesh::saveVTKASCII() const
for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
{
point = m_triMesh->getVertex( i );
if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
if( !( !wlimits::isInf( point[0] ) && !wlimits::isInf( point[1] ) && !wlimits::isInf( point[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
return false;
......@@ -267,7 +268,7 @@ bool WMWriteMesh::saveJson()
for( size_t i = 0; i < meshes[k]->vertSize() - 1; ++i )
{
point = meshes[k]->getVertex( i );
if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
if( !( !wlimits::isInf( point[0] ) && !wlimits::isInf( point[1] ) && !wlimits::isInf( point[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
return false;
......@@ -282,7 +283,7 @@ bool WMWriteMesh::saveJson()
for( size_t i = 0; i < meshes[k]->vertSize() - 1; ++i )
{
normal = meshes[k]->getNormal( i );
if( !( myIsfinite( normal[0] ) && myIsfinite( normal[1] ) && myIsfinite( normal[2] ) ) )
if( !( !wlimits::isInf( normal[0] ) && !wlimits::isInf( normal[1] ) && !wlimits::isInf( normal[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
return false;
......
......@@ -70,7 +70,8 @@
WQtControlPanel::WQtControlPanel( WMainWindow* parent )
: QDockWidget( "Control Panel", parent ),
m_ignoreSelectionChange( false ),
m_activeModule( WModule::SPtr() )
m_activeModule( WModule::SPtr() ),
m_previousTab()
{
setObjectName( "Control Panel Dock" );
......@@ -874,6 +875,45 @@ void WQtControlPanel::setActiveModule( WModule::SPtr module, bool forceUpdate )
buildPropTab( module->getProperties(), module->getInformationProperties() );
}
// re-select the previous tab
bool foundTab = false;
std::map< QString, int > priorityList;
if( m_previousTab != "" )
{
// search the tab with the previous title
for( size_t idx = 0; idx < m_tabWidget->count(); ++idx )
{
if( m_tabWidget->tabText( idx ) == m_previousTab )
{
m_tabWidget->setCurrentIndex( idx );
foundTab = true;
break;
}
// keep track of the indices in the tab. we use this map later as priority list. Please not that we add 1 to the index. This ensures
// that the invalid index is 0, even if it is -1 in Qt.
priorityList[ m_tabWidget->tabText( idx ) ] = idx + 1;
}
if( !foundTab )
{
// the tab does not exist anymore. We need to use our priority list
if( priorityList[ "Settings" ] != 0 )
{
m_tabWidget->setCurrentIndex( priorityList[ "Settings" ] - 1 );
}
else if( priorityList[ "Information" ] != 0 )
{
m_tabWidget->setCurrentIndex( priorityList[ "Settings" ] - 1 );
}
else
{
// there is no info and no settings tab. Set the first tab.
m_tabWidget->setCurrentIndex( 0 );
}
}
}
// update compatibles toolbar
createCompatibleButtons( module );
......@@ -943,13 +983,16 @@ void WQtControlPanel::buildPropTab( boost::shared_ptr< WProperties > props, boos
int propIdx = addTabWidgetContent( tab );
// select the property widget preferably
if( propIdx != -1 )
{
m_tabWidget->setCurrentIndex( propIdx );
}
else if( infoIdx != -1 )
if( m_previousTab == "" )
{
m_tabWidget->setCurrentIndex( infoIdx );
if( propIdx != -1 )
{
m_tabWidget->setCurrentIndex( propIdx );
}
else if( infoIdx != -1 )
{
m_tabWidget->setCurrentIndex( infoIdx );
}
}
}
......@@ -1240,6 +1283,11 @@ QAction* WQtControlPanel::getMissingModuleAction() const
void WQtControlPanel::clearAndDeleteTabs()
{
if( m_tabWidget->currentIndex() != -1 )
{
m_previousTab = m_tabWidget->tabText( m_tabWidget->currentIndex() );
}
m_tabWidget->setDisabled( true );
QWidget *widget;
while( ( widget = m_tabWidget->widget( 0 ) ))
......
......@@ -379,6 +379,12 @@ private:
* The module currently active
*/
WModule::SPtr m_activeModule;
/**
* The title of the last selected tab in the control panel. This needs to be done using the tab name as the tab index is not consistent(
* depending on the number of tabs. Sometimes, some tabs are not visible).
*/
QString m_previousTab;
private slots:
/**
* function that gets called when a tree item is selected, on a new select that tab widget
......
......@@ -244,11 +244,19 @@ ADD_DEFINITIONS( "-DBOOST_FILESYSTEM_VERSION=3" )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# OpenGL, at least 1.2
# See http://www.opengl.org
#
FIND_PACKAGE( OpenGL REQUIRED )
# include the OpenGL header paths
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} )
# Find OpenGL or OpenGL ES on Android
IF( ANDROID )
# on Android, we rely on the fact the the GLES headers reside in the correct NDK search paths
# -> so we do not add the include dir directly. We only set the variables needed to fake a found OpenGL:
SET( OPENGL_FOUND ON )
# link against GLES 2
SET( OPENGL_LIBRARIES "GLESv2" )
ELSE()
FIND_PACKAGE( OpenGL REQUIRED )
# include the OpenGL header paths
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} )
ENDIF()
# -----------------------------------------------------------------------------------------------------------------------------------------------
# OpenSceneGraph, at least 2.8.0
......
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