Skip to content
Permalink
Browse files

cleanup: replace boolean comparison (x==true => x / x==false => x) (f…

…ollowup b40868c)
  • Loading branch information
jef-n committed Apr 22, 2014
1 parent 59c0ff2 commit bc7a5517ddb8173acda4e0ea40a33ad5246c05cb
@@ -408,7 +408,7 @@ void QgsCustomProjectionDialog::on_buttonBox_accepted()
for ( size_t i = 0; i < customCRSids.size(); ++i )
{
CRS.createFromProj4( customCRSparameters[i] );
if ( CRS.isValid() == false )
if ( !CRS.isValid() )
{
QMessageBox::information( this, tr( "QGIS Custom Projection" ),
tr( "The proj4 definition of '%1' is not valid." ).arg( customCRSnames[i] ) );
@@ -45,7 +45,7 @@ QgsMapToolRotateFeature::~QgsMapToolRotateFeature()

void QgsMapToolRotateFeature::canvasMoveEvent( QMouseEvent * e )
{
if ( mCtrl == true )
if ( mCtrl )
{
if ( !mAnchorPoint )
{
@@ -76,7 +76,7 @@ void QgsMapToolRotateFeature::canvasMoveEvent( QMouseEvent * e )
void QgsMapToolRotateFeature::canvasPressEvent( QMouseEvent * e )
{
mRotation = 0;
if ( mCtrl == true )
if ( mCtrl )
{
return;
}
@@ -483,7 +483,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :

// set if base unit of measure tool should be changed
bool baseUnit = settings.value( "qgis/measure/keepbaseunit", false ).toBool();
if ( baseUnit == true )
if ( baseUnit )
{
mKeepBaseUnitCheckBox->setChecked( true );
}
@@ -391,15 +391,15 @@ string ASFormatter::nextLine()
isAppendPostBlockEmptyLineRequested = false;
isInLineComment = true;
// do not indent if in column 1 or 2
if (lineCommentNoIndent == false)
if (!lineCommentNoIndent)
{
if (charNum == 0)
lineCommentNoIndent = true;
else if (charNum == 1 && currentLine[0] == ' ')
lineCommentNoIndent = true;
}
// move comment if spaces were added or deleted
if (lineCommentNoIndent == false && spacePadNum != 0)
if (!lineCommentNoIndent && spacePadNum != 0)
adjustComments();
formattedLineCommentNum = formattedLine.length();
appendSequence(AS_OPEN_LINE_COMMENT);
@@ -1865,7 +1865,7 @@ int main(int argc, char *argv[])

// check for unprocessed excludes
for (size_t ix = 0; ix < g_excludeHitsVector.size(); ix++)
if (g_excludeHitsVector[ix] == false)
if (!g_excludeHitsVector[ix])
error("Unmatched exclude", g_excludeVector[ix].c_str());

// check if files were found (probably an input error if not)
@@ -313,7 +313,7 @@ bool QgsComposerAttributeTable::writeXML( QDomElement& elem, QDomDocument & doc
{
QDomElement columnElem = doc.createElement( "column" );
columnElem.setAttribute( "index", QString::number( sortIt->first ) );
columnElem.setAttribute( "ascending", sortIt->second == true ? "true" : "false" );
columnElem.setAttribute( "ascending", sortIt->second ? "true" : "false" );
sortColumnsElem.appendChild( columnElem );
}
composerTableElem.appendChild( sortColumnsElem );
@@ -990,7 +990,7 @@ void QgsWMSProjectParser::addLayers( QDomDocument &doc,
if ( !hrefString.isEmpty() )
{
QStringList getLayerLegendGraphicFormats;
if ( customHrefString == false )
if ( !customHrefString )
{
getLayerLegendGraphicFormats << "image/png"; // << "jpeg" << "image/jpeg"

@@ -1010,7 +1010,7 @@ void QgsWMSProjectParser::addLayers( QDomDocument &doc,
}

// no parameters on custom hrefUrl, because should link directly to graphic
if ( customHrefString == false )
if ( !customHrefString )
{
QUrl mapUrl( hrefString );
mapUrl.addQueryItem( "SERVICE", "WMS" );
@@ -1628,8 +1628,8 @@ bool DL_Dxf::handleHatchData( DL_CreationInterface* /*creationInterface*/ )
// QgsDebugMsg(QString("92 flag: '%1'").arg(values[92]));
// QgsDebugMsg(QString("92 flag (int): '%1'").arg(atoi(values[92])));

if ( hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].defined == false )
if ( !hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].defined )
{
if ( hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].type == 1 )
@@ -2277,7 +2277,7 @@ int DL_Dxf::stringToInt( const char* s, bool* ok )
}
else if ( s[i] == '.' )
{
if ( dot == true )
if ( dot )
{
// QgsDebugMsg("two dots");
*ok = false;
@@ -2294,7 +2294,7 @@ int DL_Dxf::stringToInt( const char* s, bool* ok )
}
i++;
}
while ( s[i] != '\0' && *ok == true );
while ( s[i] != '\0' && *ok );
}

return atoi( s );
@@ -3287,7 +3287,7 @@ void DL_Dxf::writeHatch1( DL_WriterA& dw,
dw.dxfReal( 210, 0.0 ); // extrusion dir.
dw.dxfReal( 220, 0.0 );
dw.dxfReal( 230, 1.0 );
if ( data.solid == false )
if ( !data.solid )
{
dw.dxfString( 2, data.pattern );
}
@@ -3316,7 +3316,7 @@ void DL_Dxf::writeHatch2( DL_WriterA& dw,

dw.dxfInt( 75, 0 ); // odd parity
dw.dxfInt( 76, 1 ); // pattern type
if ( data.solid == false )
if ( !data.solid )
{
dw.dxfReal( 52, data.angle );
dw.dxfReal( 41, data.scale );
@@ -319,7 +319,7 @@ void
Control::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( cx );
if ( visible() == true )
if ( visible() )
{
_renderSize.set(
width().value() + padding().x(),
@@ -394,7 +394,7 @@ Control::draw(const ControlContext& cx, DrawableList& out )
{
// by default, rendering a Control directly results in a colored quad. Usually however
// you will not render a Control directly, but rather one of its subclasses.
if ( visible() == true )
if ( visible() )
{
if ( !(_backColor.isSet() && _backColor->a() == 0) && _renderSize.x() > 0 && _renderSize.y() > 0 )
{
@@ -499,7 +499,7 @@ void
ImageControl::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( cx );
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

@@ -546,7 +546,7 @@ ImageControl::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
void
ImageControl::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true && _image.valid() )
if ( visible() && _image.valid() )
{
//TODO: this is not precisely correct..images get deformed slightly..
osg::Geometry* g = new osg::Geometry();
@@ -558,7 +558,7 @@ ImageControl::draw( const ControlContext& cx, DrawableList& out )
osg::Vec3Array* verts = new osg::Vec3Array(4);
g->setVertexArray( verts );

if ( _rotation_rad != 0.0f || _fixSizeForRot == true )
if ( _rotation_rad != 0.0f || _fixSizeForRot )
{
osg::Vec2f rc( rx+_renderSize.x()/2, (vph-ry)-_renderSize.y()/2 );
float ra = osg::PI - _rotation_rad;
@@ -711,7 +711,7 @@ HSliderControl::draw( const ControlContext& cx, DrawableList& out )
{
Control::draw( cx, out );

if ( visible() == true )
if ( visible() )
{
osg::ref_ptr<osg::Geometry> g = new osg::Geometry();

@@ -806,7 +806,7 @@ CheckBoxControl::draw( const ControlContext& cx, DrawableList& out )
{
Control::draw( cx, out );

if ( visible() == true )
if ( visible() )
{
osg::Geometry* g = new osg::Geometry();

@@ -1016,7 +1016,7 @@ void
Container::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( out_size );
if ( visible() == true )
if ( visible() )
{
if ( _frame.valid() )
{
@@ -1049,7 +1049,7 @@ Container::calcPos(const ControlContext& context, const osg::Vec2f& cursor, cons
Control::calcPos( context, cursor, parentSize );

// process the frame.. it's not a child of the container
if ( visible() == true && _frame.valid() )
if ( visible() && _frame.valid() )
{
_frame->calcPos( context, _renderPos - padding().offset(), parentSize );
}
@@ -1058,7 +1058,7 @@ Container::calcPos(const ControlContext& context, const osg::Vec2f& cursor, cons
void
Container::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true )
if ( visible() )
{
Control::draw( cx, out );
if ( _frame.valid() )
@@ -1121,7 +1121,7 @@ VBox::clearControls()
void
VBox::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

@@ -1218,7 +1218,7 @@ VBox::calcPos(const ControlContext& cx, const osg::Vec2f& cursor, const osg::Vec
void
VBox::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true )
if ( visible() )
{
Container::draw( cx, out );
for( ControlList::const_iterator i = _controls.begin(); i != _controls.end(); ++i )
@@ -1257,7 +1257,7 @@ HBox::clearControls()
void
HBox::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

@@ -1451,7 +1451,7 @@ Grid::clearControls()
void
Grid::calcSize( const ControlContext& cx, osg::Vec2f& out_size )
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

@@ -1560,7 +1560,7 @@ Grid::calcPos( const ControlContext& cx, const osg::Vec2f& cursor, const osg::Ve
void
Grid::draw( const ControlContext& cx, DrawableList& out )
{
if (visible() == true)
if ( visible() )
{
Container::draw( cx, out );
for( ControlList::const_iterator i = _children.begin(); i != _children.end(); ++i )
@@ -1730,7 +1730,7 @@ ControlNode::traverse( osg::NodeVisitor& nv )
{
data._obscured = true;
}
else if ( data._obscured == true )
else if ( data._obscured )
{
data._obscured = false;
data._visibleTime = cv->getFrameStamp()->getReferenceTime();
@@ -1848,7 +1848,7 @@ ControlNodeBin::draw( const ControlContext& context, bool newContext, int bin )
visible = false;
}

else if ( nodeData._obscured == false )
else if ( !nodeData._obscured )
{
const osg::Vec3f& nPos = nodeData._screenPos;
const osg::Vec2f& size = control->renderSize();
@@ -1889,7 +1889,7 @@ ControlNodeBin::draw( const ControlContext& context, bool newContext, int bin )
}
}

if ( nodeData._obscured == false )
if ( !nodeData._obscured )
{
if ( _sortingEnabled )
_taken.push_back( bbox );
@@ -213,7 +213,7 @@ int Pty::start( const QString& program,

pty()->setWinSize( _windowLines, _windowColumns );

if ( K3Process::start( NotifyOnExit, ( Communication )( Stdin | Stdout ) ) == false )
if ( !K3Process::start( NotifyOnExit, ( Communication )( Stdin | Stdout ) ) )
return -1;

resume(); // Start...
@@ -505,7 +505,7 @@ void Session::updateTerminalSize()
while ( viewIter.hasNext() )
{
TerminalDisplay* view = viewIter.next();
if ( view->isHidden() == false &&
if ( !view->isHidden() &&
view->lines() >= VIEW_LINES_THRESHOLD &&
view->columns() >= VIEW_COLUMNS_THRESHOLD )
{
@@ -760,7 +760,7 @@ void QgsSpatialQueryDialog::apply()
void QgsSpatialQueryDialog::visibleResult( bool show )
{
blockSignals( true );
if ( show == false )
if ( !show )
{
mRubberSelectId->reset();
}
@@ -500,7 +500,7 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg

QgsGeometry* g1 = it->feature.geometry();

if ( g1->isGeosValid() == false )
if ( !g1->isGeosValid() )
{
qDebug() << "invalid geometry(g1) found..skipping.." << it->feature.id();
continue;
@@ -538,7 +538,7 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
continue;
}

if ( g2->isGeosValid() == false )
if ( !g2->isGeosValid() )
{
QgsMessageLog::logMessage( tr( "Skipping invalid second geometry of feature %1 in overlaps test." ).arg( it->feature.id() ), tr( "Topology plugin" ) );
continue;
@@ -633,7 +633,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec
continue;
}

if ( g1->isGeosValid() == false )
if ( !g1->isGeosValid() )
{
qDebug() << "invalid geometry found..skipping.." << it->feature.id();
continue;
@@ -229,7 +229,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
}

// return item without testing if:
// scanExtSetting == true
// scanExtSetting
// or zipfile and scan zip == "Basic scan"
if ( scanExtSetting ||
(( is_vsizip || is_vsitar ) && scanZipSetting == "basic" ) )
@@ -330,7 +330,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
}

// return item without testing if:
// scanExtSetting == true
// scanExtSetting
// or zipfile and scan zip == "Basic scan"
if ( scanExtSetting ||
(( is_vsizip || is_vsitar ) && scanZipSetting == "basic" ) )
@@ -86,7 +86,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
recentVersion = true;
#endif

if ( ret == LayoutCurrent && recentVersion == false )
if ( ret == LayoutCurrent && !recentVersion )
{
// obsolete library version
mErrorMsg = tr( "obsolete libspatialite: connecting to this DB requires using v.4.0 (or any subsequent)" );
@@ -4104,7 +4104,7 @@ bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr
if ( lyr->AuthInfos->IsReadOnly )
mReadOnly = true;
}
else if ( mViewBased == true )
else if ( mViewBased )
{
mReadOnly = !hasTriggers();
}
@@ -156,7 +156,7 @@ void QgsSpatiaLiteSourceSelect::updateStatistics()

// trying to connect to SpatiaLite DB
QgsSpatiaLiteConnection conn( subKey );
if ( conn.updateStatistics() == true )
if ( conn.updateStatistics() )
{
QMessageBox::information( this, tr( "Update Statistics" ),
tr( "Internal statistics successfully updated for: %1" ).arg( subKey ) );

0 comments on commit bc7a551

Please sign in to comment.
You can’t perform that action at this time.