Commit f1bc88bc authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[STYLE] Removed space between (if|for|while|switch) and the opening bracket.

parent 003a852c
......@@ -88,7 +88,7 @@ std::string WLogEntry::getLogString( std::string format, bool colors ) const
boost::ireplace_first( s, "%t", m_timeColor + m_time + !m_timeColor );
switch ( m_level )
switch( m_level )
{
case LL_DEBUG:
boost::ireplace_first( s, "%l", m_debugColor + "DEBUG " + !m_debugColor );
......
......@@ -72,7 +72,7 @@ WLogger* WLogger::getLogger()
boost::signals2::connection WLogger::subscribeSignal( LogEvent event, LogEntryCallback callback )
{
switch ( event ) // subscription
switch( event ) // subscription
{
case AddLog:
return m_addLogSignal.connect( callback );
......
......@@ -82,13 +82,13 @@ namespace PROPERTY_TYPE_HELPER
tokens = string_utils::tokenize( str, ";" );
//WAssert( tokens.size() >= 16, "There weren't 16 values for a 4x4 Matrix" );
size_t idx = 0;
while ( idx < tokens.size() )
while( idx < tokens.size() )
{
std::vector< std::string > innerTokens;
innerTokens = string_utils::tokenize( tokens[ idx ], ":" );
// evaluate inner tokens
{
if ( innerTokens[ 0 ] == "c" )
if( innerTokens[ 0 ] == "c" )
{
tf.addColor( boost::lexical_cast< double >( innerTokens[ 1 ].c_str() ), // isovalue
WColor( boost::lexical_cast< double >( innerTokens[ 2 ].c_str() ), // red
......@@ -111,19 +111,19 @@ namespace PROPERTY_TYPE_HELPER
{
std::ostringstream out;
size_t numColors = tf.numColors();
for ( size_t i = 0; i < numColors; ++i )
for( size_t i = 0; i < numColors; ++i )
{
double iso = tf.getColorIsovalue( i );
WColor c = tf.getColor( i );
out << "c:" << iso << ":" << c[ 0 ] << ":" << c[ 1 ] << ":" << c[ 2 ] << ";";
}
size_t numAlphas = tf.numAlphas();
for ( size_t i = 0; i < numAlphas; ++i )
for( size_t i = 0; i < numAlphas; ++i )
{
double iso = tf.getAlphaIsovalue( i );
double alpha = tf.getAlpha( i );
out << "a:" << iso << ":" << alpha;
if ( i != numAlphas-1 )
if( i != numAlphas-1 )
{
out << ";";
}
......
......@@ -142,7 +142,7 @@ void WThreadedRunner::msleep( const int32_t t ) const
boost::signals2::connection WThreadedRunner::subscribeSignal( THREAD_SIGNAL signal, t_ThreadErrorSignalHandlerType notifier )
{
switch (signal)
switch( signal)
{
case WTHREAD_ERROR:
return signal_thread_error.connect( notifier );
......
......@@ -32,18 +32,18 @@
bool WTransferFunction::operator==( const WTransferFunction &rhs ) const
{
if ( histogram.size() != rhs.histogram.size() )
if( histogram.size() != rhs.histogram.size() )
{
return false;
}
{
std::vector< double >::const_iterator ait1 = histogram.begin();
std::vector< double >::const_iterator ait2 = rhs.histogram.begin();
for ( ;
for( ;
ait1 != histogram.end();
++ait1, ++ait2 )
{
if ( *ait1 != *ait2 )
if( *ait1 != *ait2 )
{
return false;
}
......@@ -51,23 +51,23 @@ bool WTransferFunction::operator==( const WTransferFunction &rhs ) const
}
if ( colors.size() != rhs.colors.size() || alphas.size() != rhs.alphas.size() )
if( colors.size() != rhs.colors.size() || alphas.size() != rhs.alphas.size() )
{
return false;
}
if ( isomin != rhs.isomin && isomax != rhs.isomax )
if( isomin != rhs.isomin && isomax != rhs.isomax )
{
return false;
}
std::vector< ColorEntry >::const_iterator it1 = colors.begin();
std::vector< ColorEntry >::const_iterator it2 = rhs.colors.begin();
for ( ;
for( ;
it1 != colors.end();
++it1, ++it2 )
{
if ( !( *it1 == *it2 ) )
if( !( *it1 == *it2 ) )
{
return false;
}
......@@ -75,11 +75,11 @@ bool WTransferFunction::operator==( const WTransferFunction &rhs ) const
std::vector< AlphaEntry >::const_iterator ait1 = alphas.begin();
std::vector< AlphaEntry >::const_iterator ait2 = rhs.alphas.begin();
for ( ;
for( ;
ait1 != alphas.end();
++ait1, ++ait2 )
{
if ( !( *ait1 == *ait2 ) )
if( !( *ait1 == *ait2 ) )
{
return false;
}
......@@ -114,8 +114,8 @@ namespace
void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width, double min, double max ) const
{
if ( colors.size() < 1 ) return;
if ( alphas.size() < 1 ) return;
if( colors.size() < 1 ) return;
if( alphas.size() < 1 ) return;
std::vector< ColorEntry >::const_iterator c1 = colors.begin();
std::vector< ColorEntry >::const_iterator c2 = c1+1;
......@@ -123,12 +123,12 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
std::vector< AlphaEntry >::const_iterator a1 = alphas.begin();
std::vector< AlphaEntry >::const_iterator a2 = a1+1;
for ( int i = 0; i < width; ++i )
for( int i = 0; i < width; ++i )
{
WColor color;
double iso = ( double )i/( double )width * ( max-min ) + min;
if ( iso <= isomin )
if( iso <= isomin )
{
color = colors.begin()->color;
color[ 3 ] = alphas.begin()->alpha;
......@@ -140,7 +140,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
}
else
{
while ( c2 != colors.end() && iso > c2->iso )
while( c2 != colors.end() && iso > c2->iso )
{
WAssert( c2 != colors.end(), "Corruption of internal data structure." );
c1++;
......@@ -148,7 +148,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
WAssert( c1 != colors.end(), "Corruption of internal data structure." );
}
while ( a2 != alphas.end() && iso > a2->iso )
while( a2 != alphas.end() && iso > a2->iso )
{
WAssert( a2 != alphas.end(), "Corruption of internal data structure." );
a1++;
......@@ -156,7 +156,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
WAssert( a1 != alphas.end(), "Corruption of internal data structure." );
}
if ( c2 == colors.end() )
if( c2 == colors.end() )
{
color = c1->color;
}
......@@ -165,7 +165,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
double colorParameter = ( iso - c1->iso )/( c2->iso - c1->iso );
color = blend( c1->color, 1.-colorParameter, c2->color, colorParameter );
}
if ( a2 == alphas.end() )
if( a2 == alphas.end() )
{
color[ 3 ] = a1->alpha;
}
......@@ -175,7 +175,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
color[ 3 ] = ablend( a1->alpha, 1.-alphaParameter, a2->alpha, alphaParameter );
}
}
for ( int j = 0; j < 4; ++j )
for( int j = 0; j < 4; ++j )
{
array[ 4*i + j ] = color[ j ]*255.;
}
......@@ -185,7 +185,7 @@ void WTransferFunction::sample1DTransferFunction( unsigned char*array, int width
void WTransferFunction::addColor( double iso, const WColor& color )
{
if ( colors.size() == 0 )
if( colors.size() == 0 )
{
colors.push_back( ColorEntry( iso, color ) );
}
......@@ -195,7 +195,7 @@ void WTransferFunction::addColor( double iso, const WColor& color )
colors.insert( e, ColorEntry( iso, color ) );
}
if ( alphas.size() >= 1 )
if( alphas.size() >= 1 )
{
isomin = std::min( colors.front().iso, alphas.front().iso );
isomax = std::max( colors.back().iso, alphas.back().iso );
......@@ -209,7 +209,7 @@ void WTransferFunction::addColor( double iso, const WColor& color )
void WTransferFunction::addAlpha( double iso, double alpha )
{
if ( alphas.size() == 0 )
if( alphas.size() == 0 )
{
alphas.push_back( AlphaEntry( iso, alpha ) );
}
......@@ -219,7 +219,7 @@ void WTransferFunction::addAlpha( double iso, double alpha )
alphas.insert( e, AlphaEntry( iso, alpha ) );
}
if ( colors.size() >= 1 )
if( colors.size() >= 1 )
{
isomin = std::min( colors.front().iso, alphas.front().iso );
isomax = std::max( colors.back().iso, alphas.back().iso );
......@@ -244,7 +244,7 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
std::vector < float > values( size );
// copy channel
for ( size_t i = 0; i < size; ++i )
for( size_t i = 0; i < size; ++i )
{
values[ i ] = static_cast<double>( rgba[ i*4+3 ] );
}
......@@ -256,15 +256,15 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
std::vector < float > errors( size );
size_t seed = 0;
while ( seed < size-1 )
while( seed < size-1 )
{
// start at first pixel and fit a line to the data
size_t to = seed+1;
while ( to < size )
while( to < size )
{
double error = 0.0;
double incline = ( values[ to ] - values[ seed ] )/( to-seed );
for ( size_t j = seed+1; j < to; ++j )
for( size_t j = seed+1; j < to; ++j )
{
error += std::sqrt( std::pow( values[ j ] - values[ seed ] - incline * ( j-seed ), 2 ) );
}
......@@ -273,19 +273,19 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
}
size_t minElement = size-1;
double minerror = errors[ minElement ];
for ( to = size-1; to > seed; --to )
for( to = size-1; to > seed; --to )
{
if ( errors[ to ] < minerror )
if( errors[ to ] < minerror )
{
minElement = to;
minerror = errors[ to ];
if ( minerror < MIN_ERROR_THRESHOLD )
if( minerror < MIN_ERROR_THRESHOLD )
{
break;
}
}
}
if ( minElement < size-1 )
if( minElement < size-1 )
{
rgbatf.addAlpha( ( double )minElement/( double )( size-1 ), values[ minElement ]/255. );
}
......@@ -301,18 +301,18 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
// first try of code: use combined RGB errors
seed = 0;
while ( seed < size-1 )
while( seed < size-1 )
{
// start at first pixel and fit a line to the data
size_t to = seed+1;
while ( to < size )
while( to < size )
{
double error = 0.0;
double inclineR = ( rgba[ to*4+0 ] - rgba[ seed*4+0 ] )/( to-seed );
double inclineG = ( rgba[ to*4+1 ] - rgba[ seed*4+1 ] )/( to-seed );
double inclineB = ( rgba[ to*4+2 ] - rgba[ seed*4+2 ] )/( to-seed );
for ( size_t j = seed; j < to; ++j )
for( size_t j = seed; j < to; ++j )
{
error += std::sqrt(
std::pow( rgba[ 4*j+0 ] - rgba[ 4*seed+0 ] - inclineR * ( j-seed ), 2 ) +
......@@ -327,19 +327,19 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
size_t minElement = size-1;
double minerror = errors[ size-1 ];
// traverse from back
for ( to = size-2; to > seed; --to )
for( to = size-2; to > seed; --to )
{
if ( errors[ to ] < minerror )
if( errors[ to ] < minerror )
{
minElement = to;
minerror = errors[ to ];
}
if ( minerror < MIN_ERROR_THRESHOLD*2.0 ) //! the threshold here is larger than for alpha, becuase we compare all colors at once
if( minerror < MIN_ERROR_THRESHOLD*2.0 ) //! the threshold here is larger than for alpha, becuase we compare all colors at once
{
break;
}
}
if ( minElement < size-1 )
if( minElement < size-1 )
{
rgbatf.addColor( ( double )minElement/( double )( size-1 ),
WColor( rgba[ minElement*4+0 ]/255.f, rgba[ minElement*4+1 ]/255.f, rgba[ minElement*4+2 ]/255.f, 0.f ) );
......@@ -354,19 +354,19 @@ WTransferFunction WTransferFunction::createFromRGBA( unsigned char const * const
std::ostream& operator << ( std::ostream& out, const WTransferFunction& tf )
{
size_t numColors = tf.numColors();
for ( size_t i = 0; i < numColors; ++i )
for( size_t i = 0; i < numColors; ++i )
{
double iso = tf.getColorIsovalue( i );
WColor c = tf.getColor( i );
out << "c:" << iso << ":" << c[ 0 ] << ":" << c[ 1 ] << ":" << c[ 2 ] << ";";
}
size_t numAlphas = tf.numAlphas();
for ( size_t i = 0; i < numAlphas; ++i )
for( size_t i = 0; i < numAlphas; ++i )
{
double iso = tf.getAlphaIsovalue( i );
double alpha = tf.getAlpha( i );
out << "a:" << iso << ":" << alpha;
if ( i != numAlphas-1 )
if( i != numAlphas-1 )
{
out << ";";
}
......
......@@ -214,7 +214,7 @@ template< typename T > WValue< T > WDataSetRawHARDI::getNonZeroGradientSignals(
size_t idx = 0;
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
WValue< T > signal( vs->getWValue( index ) );
for ( std::vector< size_t >::const_iterator cit = m_nonZeroGradientIndexes.begin(); cit != m_nonZeroGradientIndexes.end(); ++cit )
for( std::vector< size_t >::const_iterator cit = m_nonZeroGradientIndexes.begin(); cit != m_nonZeroGradientIndexes.end(); ++cit )
{
result[ idx ] = signal[ *cit ];
++idx;
......
......@@ -85,7 +85,7 @@ WDataSetSingle::SPtr WDataSetSegmentation::clone() const
boost::shared_ptr< WPrototyped > WDataSetSegmentation::getPrototype()
{
if ( !m_prototype )
if( !m_prototype )
{
m_prototype = boost::shared_ptr< WPrototyped >( new WDataSetSegmentation() );
}
......
......@@ -205,13 +205,13 @@ WDataSetSegmentation::copyDataSetsToArray( const std::vector< boost::shared_ptr<
{
const size_t voxelDim = dataSets.size();
size_t countVoxels = 0;
if ( !dataSets.empty() ) countVoxels = ( *dataSets.begin() )->getValueSet()->size();
if( !dataSets.empty() ) countVoxels = ( *dataSets.begin() )->getValueSet()->size();
std::vector< T > data( countVoxels * voxelDim );
// loop over images
size_t dimIndex = 0;
for ( std::vector< boost::shared_ptr< WDataSetScalar > >::const_iterator it = dataSets.begin(); it != dataSets.end(); it++ )
for( std::vector< boost::shared_ptr< WDataSetScalar > >::const_iterator it = dataSets.begin(); it != dataSets.end(); it++ )
{
for( size_t voxelNumber = 0; voxelNumber < countVoxels; voxelNumber++ )
{
......
......@@ -80,7 +80,7 @@ void WGEScreenCapture::operator()( osg::RenderInfo& renderInfo ) const // NOLIN
RecordingInformation& frameCounter = w->get();
// is there something to record?
if ( !frameCounter.m_framesLeft )
if( !frameCounter.m_framesLeft )
{
return;
}
......@@ -92,7 +92,7 @@ void WGEScreenCapture::operator()( osg::RenderInfo& renderInfo ) const // NOLIN
size_t width = 0;
size_t height = 0;
GLenum pixelFormat = GL_RGB;
if (gc->getTraits())
if( gc->getTraits())
{
width = gc->getTraits()->width;
height = gc->getTraits()->height;
......
......@@ -135,7 +135,7 @@ WColor wge::createColorFromHSV( int h, float s, float v )
float q = v * ( 1.0 - s * f );
float t = v * ( 1.0 - s * ( 1.0 - f ) );
switch ( hi )
switch( hi )
{
case 0:
return WColor( v, t, p, 1.0 );
......
......@@ -134,7 +134,7 @@ WGEViewer::getView()
void WGEViewer::setCameraManipulator( osg::ref_ptr<osgGA::MatrixManipulator> manipulator )
{
if ( !m_inAnimationMode )
if( !m_inAnimationMode )
{
m_View->setCameraManipulator( manipulator );
}
......@@ -260,7 +260,7 @@ std::string WGEViewer::QueryCallback::getVendor() const
WGEAnimationManipulator::RefPtr WGEViewer::animationMode( bool on )
{
if ( m_inAnimationMode && !on ) // turn off mode
if( m_inAnimationMode && !on ) // turn off mode
{
m_inAnimationMode = false;
......
......@@ -74,7 +74,7 @@ WGraphicsEngine::~WGraphicsEngine()
void WGraphicsEngine::setMultiThreadedViews( bool enable )
{
#ifdef __APPLE__
if ( enable )
if( enable )
{
WLogger::getLogger()->addLogMessage( "WGraphicsEngine::setMultiThreadedViews not implemented for OSX, yet", "GE", LL_INFO );
}
......@@ -236,7 +236,7 @@ void WGraphicsEngine::requestShaderReload()
boost::signals2::connection WGraphicsEngine::subscribeSignal( GE_SIGNAL signal, t_GEGenericSignalHandlerType notifier )
{
switch ( signal )
switch( signal )
{
case GE_RELOADSHADERS:
return m_reloadShadersSignal.connect( notifier );
......
......@@ -66,7 +66,7 @@ boost::signals2::signal1< void, WPickInfo >* WPickHandler::getPickSignal()
bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
switch ( ea.getEventType() )
switch( ea.getEventType() )
{
case osgGA::GUIEventAdapter::DRAG : // Mouse pushed an dragged
case osgGA::GUIEventAdapter::PUSH : // Mousebutton pushed
......
......@@ -48,7 +48,7 @@ WPointXYZId WMarchingCubesAlgorithm::interpolate( double fX1, double fY1, double
int WMarchingCubesAlgorithm::getEdgeID( unsigned int nX, unsigned int nY, unsigned int nZ, unsigned int nEdgeNo )
{
switch ( nEdgeNo )
switch( nEdgeNo )
{
case 0:
return 3 * getVertexID( nX, nY, nZ ) + 1;
......
......@@ -412,7 +412,7 @@ template< typename T > WPointXYZId WMarchingCubesAlgorithm::calculateIntersectio
unsigned int v2y = nY;
unsigned int v2z = nZ;
switch ( nEdgeNo )
switch( nEdgeNo )
{
case 0:
v2y += 1;
......
......@@ -45,7 +45,7 @@ void WMarchingLegoAlgorithm::addSurface( size_t x, size_t y, size_t z, size_t su
pt3.newID = 0;
pt4.newID = 0;
switch ( surface )
switch( surface )
{
case 1:
{
......@@ -308,7 +308,7 @@ boost::shared_ptr<WTriangleMesh> WMarchingLegoAlgorithm::genSurfaceOneValue( siz
size_t nPointsInSlice = nX * nY;
boost::shared_ptr< WProgress > progress;
if ( mainProgress )
if( mainProgress )
{
progress = boost::shared_ptr< WProgress >( new WProgress( "Marching Legos", m_nCellsZ ) );
mainProgress->addSubProgress( progress );
......@@ -317,7 +317,7 @@ boost::shared_ptr<WTriangleMesh> WMarchingLegoAlgorithm::genSurfaceOneValue( siz
// Generate isosurface.
for( size_t z = 0; z < m_nCellsZ; z++ )
{
if ( progress )
if( progress )
{
++*progress;
}
......@@ -432,7 +432,7 @@ boost::shared_ptr<WTriangleMesh> WMarchingLegoAlgorithm::genSurfaceOneValue( siz
vecIterator++;
}
if ( progress )
if( progress )
{
progress->finish();
}
......
......@@ -175,7 +175,7 @@ WMarchingLegoAlgorithm::generateSurface( size_t nbCoordsX, size_t nbCoordsY, siz
size_t nPointsInSlice = nX * nY;
boost::shared_ptr< WProgress > progress;
if ( mainProgress )
if( mainProgress )
{
progress = boost::shared_ptr< WProgress >( new WProgress( "Marching Cubes", m_nCellsZ ) );
mainProgress->addSubProgress( progress );
......@@ -184,7 +184,7 @@ WMarchingLegoAlgorithm::generateSurface( size_t nbCoordsX, size_t nbCoordsY, siz
// Generate isosurface.
for( size_t z = 0; z < m_nCellsZ; z++ )
{
if ( progress )
if( progress )
{
++*progress;
}
......@@ -298,7 +298,7 @@ WMarchingLegoAlgorithm::generateSurface( size_t nbCoordsX, size_t nbCoordsY, siz
triMesh->addTriangle( ( *vecIterator ).pointID[0], ( *vecIterator ).pointID[1], ( *vecIterator ).pointID[2] );
vecIterator++;
}
if ( progress )
if( progress )
{
progress->finish();
}
......
......@@ -123,11 +123,11 @@ double radToDeg( double rad )
template < typename T >
T sign( T value )
{
if ( value > T( 0 ) )
if( value > T( 0 ) )
{
return 1;
}
if ( value < T( 0 ) )
if( value < T( 0 ) )
{
return -1;
}
......@@ -152,11 +152,11 @@ T positive( T value )
*/
double smooth( double value, double min, double max )
{
if ( value >= max )
if( value >= max )
{
return max;
}
if ( value < min )
if( value < min )
{
return min;
}
......@@ -277,7 +277,7 @@ public:
{
// get a scaling factor
double zfactor = abs( factor );
if ( factor < 1.0 )
if( factor < 1.0 )
{
zfactor = 1.0 / factor;
}
......@@ -289,7 +289,7 @@ public:
double rtime = time - startTime;
double sfactor = 1.0 + smooth( ( speed * rtime ), 0.0, zfactor );
if ( factor < 1.0 )
if( factor < 1.0 )
{
makeScale( 1.0 / sfactor, 1.0 / sfactor, 1.0 / sfactor );
}
......