Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cleanups
- remove superfluous backslashes
- fix QgsDebugMsg macro
- disable code with #if 0/#endif instead of commenting it out
- remove namespaces from ogr converter plugin



git-svn-id: http://svn.osgeo.org/qgis/trunk@9218 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 30, 2008
1 parent f6e43c7 commit 1e4e5fa
Show file tree
Hide file tree
Showing 46 changed files with 107 additions and 179 deletions.
4 changes: 2 additions & 2 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -155,7 +155,7 @@ void QgsLegend::removeLayer( QString layer_key )
}

QTreeWidgetItem* theItem = firstItem();
QgsDebugMsg( "called." )
QgsDebugMsg( "called." );

while ( theItem )
{
Expand Down Expand Up @@ -1255,7 +1255,7 @@ QTreeWidgetItem* QgsLegend::nextItem( QTreeWidgetItem* item )
{
return ( dynamic_cast<QgsLegendItem*>( litem->parent()->parent() )->nextSibling() );
}
else if ( litem->parent() && litem->parent()->parent() && litem->parent()->parent()->parent() && \
else if ( litem->parent() && litem->parent()->parent() && litem->parent()->parent()->parent() &&
(( QgsLegendItem* )( litem->parent()->parent()->parent() ) )->nextSibling() )//maximum four nesting states in the current legend
{
return ( dynamic_cast<QgsLegendItem*>( litem->parent()->parent()->parent() )->nextSibling() );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -2859,7 +2859,7 @@ void QgisApp::newVectorLayer()
{
QgsDebugMsg( "ogr provider loaded" );

typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QGis::WKBTYPE, \
typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QGis::WKBTYPE,
const std::list<std::pair<QString, QString> >& );
createEmptyDataSourceProc createEmptyDataSource = ( createEmptyDataSourceProc ) cast_to_fptr( myLib->resolve( "createEmptyDataSource" ) );
if ( createEmptyDataSource )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.cpp
Expand Up @@ -77,7 +77,7 @@ QgsRasterLayer* QgisAppInterface::addRasterLayer( QString rasterLayerPath, QStri
return qgis->addRasterLayer( rasterLayerPath, baseName );
}

QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey, \
QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey,
const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs )
{
return qgis->addRasterLayer( url, baseName, providerKey, layers, styles, format, crs );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.h
Expand Up @@ -55,7 +55,7 @@ class QgisAppInterface : public QgisInterface
//! Add a raster layer given its file name
QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QString baseName );
//! Add a WMS layer
QgsRasterLayer* addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey, \
QgsRasterLayer* addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey,
const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs );

//! Add a project
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -53,7 +53,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
QGis::WKBTYPE layerWKBType = vlayer->geometryType();

//no support for adding features to 2.5D types yet
if ( layerWKBType == QGis::WKBLineString25D || layerWKBType == QGis::WKBPolygon25D || \
if ( layerWKBType == QGis::WKBLineString25D || layerWKBType == QGis::WKBPolygon25D ||
layerWKBType == QGis::WKBMultiLineString25D || layerWKBType == QGis::WKBPoint25D || layerWKBType == QGis::WKBMultiPoint25D )
{
QMessageBox::critical( 0, QObject::tr( "2.5D shape type not supported" ), QObject::tr( "Adding features to 2.5D shapetypes is not supported yet" ) );
Expand Down Expand Up @@ -109,7 +109,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ), \
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ),
QObject::tr( "Cannot transform the point to the layers coordinate system" ) );
return;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
else if ( error == 2 )
{
//problem with coordinate transformation
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ), \
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ),
QObject::tr( "Cannot transform the point to the layers coordinate system" ) );
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooladdisland.cpp
Expand Up @@ -40,7 +40,7 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )

if ( !vlayer )
{
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ), \
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ),
QObject::tr( "The current layer is not a vector layer" ) );
return;
}
Expand All @@ -63,7 +63,7 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )
else if ( error == 2 )
{
//problem with coordinate transformation
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ), \
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ),
QObject::tr( "Cannot transform the point to the layers coordinate system" ) );
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooladdring.cpp
Expand Up @@ -40,7 +40,7 @@ void QgsMapToolAddRing::canvasReleaseEvent( QMouseEvent * e )

if ( !vlayer )
{
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ), \
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ),
QObject::tr( "The current layer is not a vector layer" ) );
return;
}
Expand All @@ -63,7 +63,7 @@ void QgsMapToolAddRing::canvasReleaseEvent( QMouseEvent * e )
else if ( error == 2 )
{
//problem with coordinate transformation
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ), \
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ),
QObject::tr( "Cannot transform the point to the layers coordinate system" ) );
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolsplitfeatures.cpp
Expand Up @@ -39,7 +39,7 @@ void QgsMapToolSplitFeatures::canvasReleaseEvent( QMouseEvent * e )

if ( !vlayer )
{
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ), \
QMessageBox::information( 0, QObject::tr( "Not a vector layer" ),
QObject::tr( "The current layer is not a vector layer" ) );
return;
}
Expand All @@ -62,7 +62,7 @@ void QgsMapToolSplitFeatures::canvasReleaseEvent( QMouseEvent * e )
else if ( error == 2 )
{
//problem with coordinate transformation
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ), \
QMessageBox::information( 0, QObject::tr( "Coordinate transform error" ),
QObject::tr( "Cannot transform the point to the layers coordinate system" ) );
return;
}
Expand Down
17 changes: 0 additions & 17 deletions src/app/qgspastetransformations.cpp
Expand Up @@ -175,23 +175,6 @@ void QgsPasteTransformations::layerChanged( const QString& layerName, std::vecto
// Fetch the fields that will be populated into the Transfer rows.
QgsDebugMsg( QString( "Layer changed to %1." ).arg( layerName ) );

/*
// XXX What does this code do??? [MD]
std::vector<QgsField> layerFields =
(mMapNameLookup[ layerName ])->fields();
fields->clear();
for (std::vector<QgsField>::iterator it = layerFields.begin();
it != layerFields.end();
++it )
{
QgsDebugMsg(QString("Got field %1.").arg(it->name()));
fields->push_back(it->name());
}
*/

restoreTransfers( sourceLayerComboBox ->currentText(),
destinationLayerComboBox->currentText() );
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgspluginmanager.cpp
Expand Up @@ -272,23 +272,23 @@ void QgsPluginManager::getPluginDescriptions()
}
else
{
QgsDebugMsg( "Plugin name not returned when queried\n" );
QgsDebugMsg( "Plugin name not returned when queried" );
}
if ( pDesc )
{
QgsDebugMsg( "Plugin description: " + pDesc() );
}
else
{
QgsDebugMsg( "Plugin description not returned when queried\n" );
QgsDebugMsg( "Plugin description not returned when queried" );
}
if ( pVersion )
{
QgsDebugMsg( "Plugin version: " + pVersion() );
}
else
{
QgsDebugMsg( "Plugin version not returned when queried\n" );
QgsDebugMsg( "Plugin version not returned when queried" );
}

if ( !pName || !pDesc || !pVersion )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -2561,7 +2561,7 @@ void QgsRasterLayerProperties::on_mClassifyButton_clicked()
{
//because the highest value is also an entry, there are (numberOfEntries - 1)
//intervals
intervalDiff = ( myRasterBandStats.maxVal - myRasterBandStats.minVal ) / \
intervalDiff = ( myRasterBandStats.maxVal - myRasterBandStats.minVal ) /
( numberOfEntries - 1 );
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgssnappingdialog.h
Expand Up @@ -43,7 +43,7 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
QgsSnappingDialog( QgsMapCanvas* canvas, const QMap<QString, LayerEntry >& settings );
~QgsSnappingDialog();

/**Returns the snapping settings per layer. Key of the map is the layer id and value the \
/**Returns the snapping settings per layer. Key of the map is the layer id and value the
corresponding layer entry*/
void layerSettings( QMap<QString, LayerEntry>& settings ) const;

Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerlabel.cpp
Expand Up @@ -51,7 +51,7 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*

//support multiline labels
double penWidth = pen().widthF();
QRectF painterRect(penWidth, penWidth, rect().width() - 2 * penWidth, \
QRectF painterRect(penWidth, penWidth, rect().width() - 2 * penWidth,
rect().height() - 2 * penWidth);
painter->drawText(painterRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, mText);

Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgsnumericscalebarstyle.cpp
Expand Up @@ -50,7 +50,7 @@ void QgsNumericScaleBarStyle::draw( QPainter* p, double xOffset ) const
p->save();

p->setFont( mScaleBar->font() );
p->drawText( QPointF( mScaleBar->pen().widthF() + mScaleBar->boxContentSpace(), mScaleBar->boxContentSpace() \
p->drawText( QPointF( mScaleBar->pen().widthF() + mScaleBar->boxContentSpace(), mScaleBar->boxContentSpace()
+ mScaleBar->fontHeight() ), scaleText() );

p->restore();
Expand All @@ -65,8 +65,8 @@ QRectF QgsNumericScaleBarStyle::calculateBoxSize() const
}

QFontMetricsF fontMetrics( mScaleBar->font() );
return QRectF( mScaleBar->transform().dx(), mScaleBar->transform().dy(), 2 * mScaleBar->boxContentSpace() \
+ 2 * mScaleBar->pen().width() + fontMetrics.width( scaleText() ), \
return QRectF( mScaleBar->transform().dx(), mScaleBar->transform().dy(), 2 * mScaleBar->boxContentSpace()
+ 2 * mScaleBar->pen().width() + fontMetrics.width( scaleText() ),
mScaleBar->fontHeight() + 2 * mScaleBar->boxContentSpace() );
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -246,7 +246,7 @@ bool QgsCoordinateReferenceSystem::createFromWkt( QString theWkt )

if ( theWkt.isEmpty() )
{
QgsDebugMsg( "theWkt is uninitialised, operation failed" )
QgsDebugMsg( "theWkt is uninitialised, operation failed" );
QgsLogger::critical( "QgsCoordinateReferenceSystem::createFromWkt -- theWkt is uninitialised, operation failed" );
return mIsValidFlag;
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -121,7 +121,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
// row for this ellipsoid wasn't found?
if ( radius.isEmpty() || parameter2.isEmpty() )
{
QgsDebugMsg( QString( "setEllipsoid: no row in tbl_ellipsoid for acronym '" ) + ellipsoid.toLocal8Bit().data() + "'" )
QgsDebugMsg( QString( "setEllipsoid: no row in tbl_ellipsoid for acronym '" ) + ellipsoid.toLocal8Bit().data() + "'" );
return false;
}

Expand All @@ -130,7 +130,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
mSemiMajor = radius.mid( 2 ).toDouble();
else
{
QgsDebugMsg( QString( "setEllipsoid: wrong format of radius field: '" ) + radius.toLocal8Bit().data() + "'" )
QgsDebugMsg( QString( "setEllipsoid: wrong format of radius field: '" ) + radius.toLocal8Bit().data() + "'" );
return false;
}

Expand All @@ -149,11 +149,11 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
}
else
{
QgsDebugMsg( QString( "setEllipsoid: wrong format of parameter2 field: '" ) + parameter2.toLocal8Bit().data() + "'" )
QgsDebugMsg( QString( "setEllipsoid: wrong format of parameter2 field: '" ) + parameter2.toLocal8Bit().data() + "'" );
return false;
}

QgsDebugMsg( QString( "setEllipsoid: a=" ) + mSemiMajor + ", b=" + mSemiMinor + ", 1/f=" + mInvFlattening )
QgsDebugMsg( QString( "setEllipsoid: a=" ) + mSemiMajor + ", b=" + mSemiMinor + ", 1/f=" + mInvFlattening );


// get spatial ref system for ellipsoid
Expand Down
11 changes: 2 additions & 9 deletions src/core/qgsgeometry.cpp
Expand Up @@ -35,13 +35,6 @@ email : morb at ozemail dot com dot au
return r; \
}

#define RELAY_GEOS() \
catch (GEOSException &e) \
{ \
Q_UNUSED(e); \
throw; \
}

class GEOSException
{
public:
Expand Down Expand Up @@ -4479,8 +4472,8 @@ bool QgsGeometry::convertToMultiType()

QGis::WKBTYPE geomType = wkbType();

if ( geomType == QGis::WKBMultiPoint || geomType == QGis::WKBMultiPoint25D || \
geomType == QGis::WKBMultiLineString || geomType == QGis::WKBMultiLineString25D || \
if ( geomType == QGis::WKBMultiPoint || geomType == QGis::WKBMultiPoint25D ||
geomType == QGis::WKBMultiLineString || geomType == QGis::WKBMultiLineString25D ||
geomType == QGis::WKBMultiPolygon || geomType == QGis::WKBMultiPolygon25D || geomType == QGis::WKBUnknown )
{
return false; //no need to convert
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsgeometry.h
Expand Up @@ -132,7 +132,7 @@ class CORE_EXPORT QgsGeometry
double distance( QgsGeometry& geom );

/**
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target pointand \
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point
and the indices of the vertices before/after. The vertices before/after are -1 if not present
*/
QgsPoint closestVertex( const QgsPoint& point, int& atVertex, int& beforeVertex, int& afterVertex, double& sqrDist );
Expand Down Expand Up @@ -220,7 +220,7 @@ class CORE_EXPORT QgsGeometry
double closestSegmentWithContext( const QgsPoint& point, QgsPoint& minDistPoint, int& beforeVertex );

/**Adds a new ring to this geometry. This makes only sense for polygon and multipolygons.
@return 0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed, \
@return 0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed,
3 ring is not valid geometry, 4 ring not disjoint with existing rings, 5 no polygon found which contained the ring*/
int addRing( const QList<QgsPoint>& ring );

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgslogger.h
Expand Up @@ -23,9 +23,9 @@
#include <QString>

#ifdef QGISDEBUG
#define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNCTION__, __LINE__);
#define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNCTION__, __LINE__)
#define QgsDebugMsgLevel(str, level) QgsLogger::debug(QString(str), level,\
__FILE__, __FUNCTION__, __LINE__);
__FILE__, __FUNCTION__, __LINE__)
#else
#define QgsDebugMsg(str)
#define QgsDebugMsgLevel(str, level)
Expand Down Expand Up @@ -100,7 +100,7 @@ class CORE_EXPORT QgsLogger
static void fatal( const QString& msg );

private:
/**Reads the environment variable QGIS_DEBUG and converts it to int. If QGIS_DEBUG is not set,\
/**Reads the environment variable QGIS_DEBUG and converts it to int. If QGIS_DEBUG is not set,
the function returns 1 if QGISDEBUG is defined and 0 if not*/
static int debugLevel();

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgspoint.cpp
Expand Up @@ -98,7 +98,7 @@ int QgsPoint::onSegment( const QgsPoint& a, const QgsPoint& b ) const
{
//algorithm from 'graphics GEMS', A. Paeth: 'A Fast 2D Point-on-line test'
if (
fabs(( b.y() - a.y() ) * ( m_x - a.x() ) - ( m_y - a.y() ) * ( b.x() - a.x() ) ) \
fabs(( b.y() - a.y() ) * ( m_x - a.x() ) - ( m_y - a.y() ) * ( b.x() - a.x() ) )
>= qMax( fabs( b.x() - a.x() ), fabs( b.y() - a.y() ) )
)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsprojectfiletransform.cpp
Expand Up @@ -60,7 +60,7 @@ bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )

void QgsProjectFileTransform::dump()
{
QgsDebugMsg( QString( "Current project file version is %1.%2.%3\n" )
QgsDebugMsg( QString( "Current project file version is %1.%2.%3" )
.arg( mCurrentVersion.majorVersion() )
.arg( mCurrentVersion.minorVersion() )
.arg( mCurrentVersion.subVersion() ) );
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2150,14 +2150,14 @@ bool QgsVectorLayer::readXml( QDomNode & layer_node )
enableLabels( true );
}

QgsDebugMsg( "Testing if qgsvectorlayer can call label readXML routine" )
QgsDebugMsg( "Testing if qgsvectorlayer can call label readXML routine" );


QDomNode labelattributesnode = layer_node.namedItem( "labelattributes" );

if ( !labelattributesnode.isNull() )
{
QgsDebugMsg( "qgsvectorlayer calling label readXML routine" )
QgsDebugMsg( "qgsvectorlayer calling label readXML routine" );
mLabel->readXML( labelattributesnode );
}

Expand Down

0 comments on commit 1e4e5fa

Please sign in to comment.