Skip to content
Permalink
Browse files
indentation update
  • Loading branch information
jef-n committed Feb 9, 2014
1 parent f3b2649 commit 780443e200298e4413042d91d337d5fcc93dccf2
@@ -294,7 +294,7 @@ def getRasterSRS( parent, fileName ):
proj = ds.GetProjectionRef()
if proj is None:
return ''

sr = osr.SpatialReference()
if sr.ImportFromWkt(proj) != gdal.CE_None:
return ''
@@ -75,7 +75,7 @@ def onRun( self ):

def batchRun(self):
self.inFiles = Utils.getRasterFiles( self.getInputFileName(), self.isRecursiveScanEnabled() )
if len(self.inFiles) == 0:
if len(self.inFiles) == 0:
QMessageBox.warning( self, self.tr( "Warning" ), self.tr( "No input files to process." ) )
return

@@ -35,7 +35,7 @@
# @param mainwindow is the DBManager mainwindow
def load(db, mainwindow):
# check whether the selected database supports topology
# (search for topology.topology)
# (search for topology.topology)
sql = u"""SELECT count(*)
FROM pg_class AS cls JOIN pg_namespace AS nsp ON nsp.oid = cls.relnamespace
WHERE cls.relname = 'topology' AND nsp.nspname = 'topology'"""
@@ -76,7 +76,7 @@ def run(item, action, mainwindow):
c = db.connector._get_cursor()
db.connector._execute( c, sql )
res = db.connector._fetchone( c )
isTopoSchema = res != None
isTopoSchema = res != None

if not isTopoSchema:
QMessageBox.critical(mainwindow, "Invalid topology", u'Schema "%s" is not registered in topology.topology.' % item.schema().name)
@@ -116,7 +116,7 @@ def run(item, action, mainwindow):
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)
face_extent = layer.extent()
face_extent = layer.extent()

# face geometry
sql = u'SELECT face_id, topology.ST_GetFaceGeometry(%s, face_id) as geom ' \
@@ -30,7 +30,7 @@
*/
static const unsigned SIZE = 624;
static const unsigned PERIOD = 397;
static const unsigned DIFF = SIZE-PERIOD;
static const unsigned DIFF = SIZE - PERIOD;

static uint32_t MT[SIZE];
static unsigned index = 0;
@@ -65,26 +65,28 @@ static inline void generate_numbers()
register uint32_t y, i;

// i = [0 ... 226]
for ( i=0; i<DIFF; ++i ) {
for ( i = 0; i < DIFF; ++i )
{
/*
* We're doing 226 = 113*2, an even number of steps, so we can
* safely unroll one more step here for speed:
*/
y = M32(MT[i]) | L31(MT[i+1]);
MT[i] = MT[i+PERIOD] ^ (y>>1) ^ MATRIX[ODD(y)];
y = M32( MT[i] ) | L31( MT[i+1] );
MT[i] = MT[i+PERIOD] ^( y >> 1 ) ^ MATRIX[ODD( y )];

++i;
y = M32(MT[i]) | L31(MT[i+1]);
MT[i] = MT[i+PERIOD] ^ (y>>1) ^ MATRIX[ODD(y)];
y = M32( MT[i] ) | L31( MT[i+1] );
MT[i] = MT[i+PERIOD] ^( y >> 1 ) ^ MATRIX[ODD( y )];
}

#define UNROLL \
y = M32(MT[i]) | L31(MT[i+1]); \
MT[i] = MT[i-DIFF] ^ (y>>1) ^ MATRIX[ODD(y)]; \
++i;
#define UNROLL \
y = M32(MT[i]) | L31(MT[i+1]); \
MT[i] = MT[i-DIFF] ^ (y>>1) ^ MATRIX[ODD(y)]; \
++i;

// i = [227 ... 622]
for ( i=DIFF; i<(SIZE-1); ) {
for ( i = DIFF; i < ( SIZE - 1 ); )
{
/*
* 623-227 = 396 = 2*2*3*3*11, so we can unroll this loop in any
* number that evenly divides 396 (2, 4, 6, etc).
@@ -99,11 +101,11 @@ static inline void generate_numbers()
}

// i = [623]
y = M32(MT[SIZE-1]) | L31(MT[SIZE-1]);
MT[SIZE-1] = MT[PERIOD-1] ^ (y>>1) ^ MATRIX[ODD(y)];
y = M32( MT[SIZE-1] ) | L31( MT[SIZE-1] );
MT[SIZE-1] = MT[PERIOD-1] ^( y >> 1 ) ^ MATRIX[ODD( y )];
}

extern "C" void seed(uint32_t value)
extern "C" void seed( uint32_t value )
{
/*
* The equation below is a linear congruential generator (LCG),
@@ -140,8 +142,8 @@ extern "C" void seed(uint32_t value)
MT[0] = value;
index = 0;

for ( register unsigned i=1; i<SIZE; ++i )
MT[i] = 0x6c078965*(MT[i-1] ^ MT[i-1]>>30) + i;
for ( register unsigned i = 1; i < SIZE; ++i )
MT[i] = 0x6c078965 * ( MT[i-1] ^ MT[i-1] >> 30 ) + i;
}

extern "C" uint32_t rand_u32()
@@ -152,10 +154,10 @@ extern "C" uint32_t rand_u32()
register uint32_t y = MT[index];

// Tempering
y ^= y>>11;
y ^= y<< 7 & 0x9d2c5680;
y ^= y<<15 & 0xefc60000;
y ^= y>>18;
y ^= y >> 11;
y ^= y << 7 & 0x9d2c5680;
y ^= y << 15 & 0xefc60000;
y ^= y >> 18;

if ( ++index == SIZE )
index = 0;
@@ -180,45 +182,45 @@ extern "C" int mt_rand()
* compatible with 64-bit MT[], so we'll just use that here.
*
*/
return static_cast<int>(0x7FFFFFFF & rand_u32());
return static_cast<int>( 0x7FFFFFFF & rand_u32() );
}

extern "C" void mt_srand(unsigned value)
extern "C" void mt_srand( unsigned value )
{
seed(static_cast<uint32_t>(value));
seed( static_cast<uint32_t>( value ) );
}

extern "C" float randf_cc()
{
return static_cast<float>(rand_u32())/MD_UINT32_MAX;
return static_cast<float>( rand_u32() ) / MD_UINT32_MAX;
}

extern "C" float randf_co()
{
return static_cast<float>(rand_u32())/(MD_UINT32_MAX+1.0f);
return static_cast<float>( rand_u32() ) / ( MD_UINT32_MAX + 1.0f );
}

extern "C" float randf_oo()
{
return (static_cast<float>(rand_u32())+0.5f)/(MD_UINT32_MAX+1.0f);
return ( static_cast<float>( rand_u32() ) + 0.5f ) / ( MD_UINT32_MAX + 1.0f );
}

extern "C" double randd_cc()
{
return static_cast<double>(rand_u32())/MD_UINT32_MAX;
return static_cast<double>( rand_u32() ) / MD_UINT32_MAX;
}

extern "C" double randd_co()
{
return static_cast<double>(rand_u32())/(MD_UINT32_MAX+1.0);
return static_cast<double>( rand_u32() ) / ( MD_UINT32_MAX + 1.0 );
}

extern "C" double randd_oo()
{
return (static_cast<double>(rand_u32())+0.5)/(MD_UINT32_MAX+1.0);
return ( static_cast<double>( rand_u32() ) + 0.5 ) / ( MD_UINT32_MAX + 1.0 );
}

extern "C" uint64_t rand_u64()
{
return static_cast<uint64_t>(rand_u32())<<32 | rand_u32();
return static_cast<uint64_t>( rand_u32() ) << 32 | rand_u32();
}
@@ -33,76 +33,77 @@ typedef unsigned __int64 uint64_t;
#include <limits>

#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif

/*
* Maximum number you can get from rand().
*/
/*
* Maximum number you can get from rand().
*/
#define MD_RAND_MAX std::numeric_limits<int32_t>::max()

/*
* Initialize the number generator with given seed.
* (LIBC REPLACEMENT FUNCTION)
*/
void mt_srand(unsigned seed_value);

/*
* Extract a pseudo-random integer in the range 0 ... MD_RAND_MAX.
* (LIBC REPLACEMENT FUNCTION)
*/
int mt_rand();

/*
* Extract a pseudo-random unsigned 32-bit integer in the range 0 ... MD_UINT32_MAX
*/
uint32_t rand_u32();

/*
* Combine two unsigned 32-bit pseudo-random numbers into one 64-bit
*/
uint64_t rand_u64();

/*
* Initialize Mersenne Twister with given seed value.
*/
void seed(uint32_t seed_value);

/*
* Return a random float in the CLOSED range [0, 1]
* Mnemonic: randf_co = random float 0=closed 1=closed
*/
float randf_cc();

/*
* Return a random float in the OPEN range [0, 1>
* Mnemonic: randf_co = random float 0=closed 1=open
*/
float randf_co();

/*
* Return a random float in the OPEN range <0, 1>
* Mnemonic: randf_oo = random float 0=open 1=open
*/
float randf_oo();

/*
* Return a random double in the CLOSED range [0, 1]
* Mnemonic: randd_co = random double 0=closed 1=closed
*/
double randd_cc();

/*
* Return a random double in the OPEN range [0, 1>
* Mnemonic: randd_co = random double 0=closed 1=open
*/
double randd_co();

/*
* Return a random double in the OPEN range <0, 1>
* Mnemonic: randd_oo = random double 0=open 1=open
*/
double randd_oo();
/*
* Initialize the number generator with given seed.
* (LIBC REPLACEMENT FUNCTION)
*/
void mt_srand( unsigned seed_value );

/*
* Extract a pseudo-random integer in the range 0 ... MD_RAND_MAX.
* (LIBC REPLACEMENT FUNCTION)
*/
int mt_rand();

/*
* Extract a pseudo-random unsigned 32-bit integer in the range 0 ... MD_UINT32_MAX
*/
uint32_t rand_u32();

/*
* Combine two unsigned 32-bit pseudo-random numbers into one 64-bit
*/
uint64_t rand_u64();

/*
* Initialize Mersenne Twister with given seed value.
*/
void seed( uint32_t seed_value );

/*
* Return a random float in the CLOSED range [0, 1]
* Mnemonic: randf_co = random float 0=closed 1=closed
*/
float randf_cc();

/*
* Return a random float in the OPEN range [0, 1>
* Mnemonic: randf_co = random float 0=closed 1=open
*/
float randf_co();

/*
* Return a random float in the OPEN range <0, 1>
* Mnemonic: randf_oo = random float 0=open 1=open
*/
float randf_oo();

/*
* Return a random double in the CLOSED range [0, 1]
* Mnemonic: randd_co = random double 0=closed 1=closed
*/
double randd_cc();

/*
* Return a random double in the OPEN range [0, 1>
* Mnemonic: randd_co = random double 0=closed 1=open
*/
double randd_co();

/*
* Return a random double in the OPEN range <0, 1>
* Mnemonic: randd_oo = random double 0=open 1=open
*/
double randd_oo();

#ifdef __cplusplus
} // extern "C"
@@ -50,7 +50,7 @@ void QgsGpsMarker::setCenter( const QgsPoint& point )
}
catch ( QgsCsException &e ) //silently ignore transformation exceptions
{
Q_UNUSED( e );
Q_UNUSED( e );
return;
}
}
@@ -589,7 +589,7 @@ void QgsProjectProperties::apply()
// write the currently selected projections _proj string_ to project settings
QgsDebugMsg( QString( "SpatialRefSys/ProjectCRSProj4String: %1" ).arg( projectionSelector->selectedProj4String() ) );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projectionSelector->selectedProj4String() );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) projectionSelector->selectedCrsId() );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSID", ( int ) projectionSelector->selectedCrsId() );
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCrs", projectionSelector->selectedAuthId() );

// Set the map units to the projected coordinates if we are projecting
@@ -407,7 +407,7 @@ void QgsVectorLayerProperties::syncToLayer( void )
mSimplifyDrawingAtProvider->setChecked( !simplifyMethod.forceLocalOptimization() );
mSimplifyDrawingAtProvider->setEnabled( mSimplifyDrawingGroupBox->isChecked() );
}

// disable simplification for point layers, now it is not implemented
if ( layer->geometryType() == QGis::Point )
{
@@ -2315,14 +2315,14 @@ bool QgsExpression::NodeCondition::prepare( QgsExpression* parent, const QgsFiel

QString QgsExpression::NodeCondition::dump() const
{
QString msg = QString("CASE ");
QString msg = QString( "CASE " );
foreach ( WhenThen* cond, mConditions )
{
msg += QString( "WHEN %1 THEN %2" ).arg( cond->mWhenExp->dump() ).arg( cond->mThenExp->dump() );
}
if ( mElseExp )
msg += QString( "ELSE %1" ).arg( mElseExp->dump() );
msg += QString(" END");
msg += QString( " END" );
return msg;
}

@@ -5857,8 +5857,8 @@ int QgsGeometry::avoidIntersections( QMap<QgsVectorLayer*, QSet< QgsFeatureId >
ignoreIds = ignoreIt.value();

QgsFeatureIterator fi = currentLayer->getFeatures( QgsFeatureRequest( boundingBox() )
.setFlags( QgsFeatureRequest::ExactIntersect )
.setSubsetOfAttributes( QgsAttributeList() ) );
.setFlags( QgsFeatureRequest::ExactIntersect )
.setSubsetOfAttributes( QgsAttributeList() ) );
QgsFeature f;
while ( fi.nextFeature( f ) )
{
@@ -182,7 +182,7 @@ int QgsLogger::debugLevel()
if ( sPrefixLength == -1 )
{
sPrefixLength = sizeof( CMAKE_SOURCE_DIR );
if( CMAKE_SOURCE_DIR[sPrefixLength-1] == '/' )
if ( CMAKE_SOURCE_DIR[sPrefixLength-1] == '/' )
sPrefixLength++;
}

0 comments on commit 780443e

Please sign in to comment.