indentation update

This commit is contained in:
Juergen E. Fischer 2012-09-21 21:01:31 +02:00
parent 3e08931e40
commit 413e9dcd4e
18 changed files with 129 additions and 128 deletions

View File

@ -66,13 +66,13 @@ void QgsAppLegendInterface::updateIndex( QModelIndex oldIndex, QModelIndex newIn
void QgsAppLegendInterface::setGroupExpanded( int groupIndex, bool expand )
{
QTreeWidgetItem * item = getItem (groupIndex);
if ( !item )
{
return;
}
QTreeWidgetItem * item = getItem( groupIndex );
if ( !item )
{
return;
}
item->setExpanded(expand);
item->setExpanded( expand );
}
void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
@ -82,29 +82,30 @@ void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
return;
}
Qt::CheckState state = visible ? Qt::Checked : Qt::Unchecked;
getItem (groupIndex)->setCheckState( 0, state );
Qt::CheckState state = visible ? Qt::Checked : Qt::Unchecked;
getItem( groupIndex )->setCheckState( 0, state );
}
QTreeWidgetItem *QgsAppLegendInterface::getItem(int itemIndex)
QTreeWidgetItem *QgsAppLegendInterface::getItem( int itemIndex )
{
int itemCount = 0;
for (QTreeWidgetItem* theItem = mLegend->firstItem(); theItem; theItem = mLegend->nextItem( theItem ) )
{
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
if (itemCount == itemIndex)
{
return theItem;
}
else
{
itemCount = itemCount + 1;
}
}
}
int itemCount = 0;
for ( QTreeWidgetItem* theItem = mLegend->firstItem(); theItem; theItem = mLegend->nextItem( theItem ) )
{
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
{
if ( itemCount == itemIndex )
{
return theItem;
}
else
{
itemCount = itemCount + 1;
}
}
}
return NULL;
return NULL;
}
void QgsAppLegendInterface::setLayerVisible( QgsMapLayer * ml, bool visible )
@ -128,24 +129,24 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
bool QgsAppLegendInterface::groupExists( int groupIndex )
{
QTreeWidgetItem * item = getItem (groupIndex);
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( item );
QTreeWidgetItem * item = getItem( groupIndex );
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( item );
if ( !legendItem )
{
return false;
}
if ( !legendItem )
{
return false;
}
return legendItem->type() == QgsLegendItem::LEGEND_GROUP;
return legendItem->type() == QgsLegendItem::LEGEND_GROUP;
}
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
{
QTreeWidgetItem * item = getItem (groupIndex);
if ( !item )
{
return false;
}
QTreeWidgetItem * item = getItem( groupIndex );
if ( !item )
{
return false;
}
return item->isExpanded();
}

View File

@ -94,7 +94,7 @@ class QgsAppLegendInterface : public QgsLegendInterface
//! Pointer to QgsLegend object
QgsLegend *mLegend;
QTreeWidgetItem *getItem(int itemIndex);
QTreeWidgetItem *getItem( int itemIndex );
};
#endif //QGSLEGENDAPPIFACE_H

View File

@ -43,20 +43,20 @@ class QgsDiagramLayerSettings;
class CORE_EXPORT QgsLabelPosition
{
public:
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down, bool diagram = false, bool pinned = false ):
featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( rect ), width( w ), height( h ), layerID( layer ), upsideDown( upside_down ), isDiagram( diagram ), isPinned( pinned ) {}
QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRectangle() ), width( 0 ), height( 0 ), layerID( "" ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
int featureId;
double rotation;
QVector< QgsPoint > cornerPoints;
QgsRectangle labelRect;
double width;
double height;
QString layerID;
bool upsideDown;
bool isDiagram;
bool isPinned;
public:
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down, bool diagram = false, bool pinned = false ):
featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( rect ), width( w ), height( h ), layerID( layer ), upsideDown( upside_down ), isDiagram( diagram ), isPinned( pinned ) {}
QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRectangle() ), width( 0 ), height( 0 ), layerID( "" ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
int featureId;
double rotation;
QVector< QgsPoint > cornerPoints;
QgsRectangle labelRect;
double width;
double height;
QString layerID;
bool upsideDown;
bool isDiagram;
bool isPinned;
};
/** Labeling engine interface.

View File

@ -198,11 +198,11 @@ void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & e
if ( !bandData[*bandIt] )
{
// We should free the alloced mem from block().
QgsDebugMsg("No input band" );
QgsDebugMsg( "No input band" );
bandIt--;
for ( ; bandIt != bands.constBegin(); bandIt-- )
{
VSIFree( bandData[*bandIt] );
VSIFree( bandData[*bandIt] );
}
return 0;
}

View File

@ -105,7 +105,7 @@ void * QgsPalettedRasterRenderer::readBlock( int bandNo, QgsRectangle const & e
void* rasterData = mInput->block( bandNo, extent, width, height );
if ( ! rasterData )
{
QgsDebugMsg("No raster data!" );
QgsDebugMsg( "No raster data!" );
return 0;
}

View File

@ -64,7 +64,7 @@ void * QgsSingleBandColorDataRenderer::readBlock( int bandNo, QgsRectangle cons
void* rasterData = mInput->block( bandNo, extent, width, height );
if ( ! rasterData )
{
QgsDebugMsg("No raster data!" );
QgsDebugMsg( "No raster data!" );
return 0;
}

View File

@ -218,7 +218,7 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen
QMap< QString, QMap< int, QString > > aliasInfo = layerAliasInfo();
QMap< QString, QSet<QString> > hiddenAttrs = hiddenAttributes();
foreach( const QDomElement &elem, mProjectLayerElements )
foreach ( const QDomElement &elem, mProjectLayerElements )
{
QString type = elem.attribute( "type" );
if ( type == "vector" )

View File

@ -57,7 +57,7 @@ class QgsSLDParser: public QgsConfigParser
void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
void featureTypeList( QDomElement &, QDomDocument & ) const {};
void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const {};
/**Returns number of layers in configuration*/

View File

@ -264,7 +264,7 @@ QDomDocument QgsWFSServer::describeFeatureType()
{
typeName = "";
}
mConfigParser->describeFeatureType( typeName, schemaElement, doc);
mConfigParser->describeFeatureType( typeName, schemaElement, doc );
return doc;
}
@ -511,7 +511,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
if ( format == "GeoJSON" )
{
fcString = "{\"type\": \"FeatureCollection\",\n";
fcString += " \"bbox\": [ "+ QString::number( rect->xMinimum(), 'f' ) +", "+ QString::number( rect->yMinimum(), 'f' ) +", "+ QString::number( rect->xMaximum(), 'f' ) +", "+ QString::number( rect->yMaximum(), 'f' ) +"],\n";
fcString += " \"bbox\": [ " + QString::number( rect->xMinimum(), 'f' ) + ", " + QString::number( rect->yMinimum(), 'f' ) + ", " + QString::number( rect->xMaximum(), 'f' ) + ", " + QString::number( rect->yMaximum(), 'f' ) + "],\n";
fcString += " \"features\": [\n";
result = fcString.toUtf8();
request.startGetFeatureResponse( &result, format );
@ -599,7 +599,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
fcString += " xmlns=\"http://www.opengis.net/wfs\"";
fcString += " xmlns:wfs=\"http://www.opengis.net/wfs\"";
fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
fcString += " xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.opengis.net/gml "+ hrefString.replace( "&", "&amp;" ) +"\"";
fcString += " xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.opengis.net/gml " + hrefString.replace( "&", "&amp;" ) + "\"";
fcString += " xmlns:ogc=\"http://www.opengis.net/ogc\"";
fcString += " xmlns:gml=\"http://www.opengis.net/gml\"";
fcString += " xmlns:ows=\"http://www.opengis.net/ows\"";
@ -691,7 +691,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
{
QgsRectangle box = geom->boundingBox();
fStr += " \"bbox\": [ "+ QString::number( box.xMinimum(), 'f' ) +", "+ QString::number( box.yMinimum(), 'f' ) +", "+ QString::number( box.xMaximum(), 'f' ) +", "+ QString::number( box.yMaximum(), 'f' ) +"],\n";
fStr += " \"bbox\": [ " + QString::number( box.xMinimum(), 'f' ) + ", " + QString::number( box.yMinimum(), 'f' ) + ", " + QString::number( box.xMaximum(), 'f' ) + ", " + QString::number( box.yMaximum(), 'f' ) + "],\n";
fStr += " \"geometry\": ";
fStr += geom->exportToGeoJSON();
@ -1020,7 +1020,7 @@ QDomElement QgsWFSServer::createCoordinateElem( const QVector<QgsPoint> points,
{
coordString += " ";
}
coordString += QString::number( pointIt->x(), 'f');
coordString += QString::number( pointIt->x(), 'f' );
coordString += ",";
coordString += QString::number( pointIt->y(), 'f' );
}

View File

@ -144,7 +144,7 @@ void QgsGCPListModel::updateModel()
// interested in the residual in this direction
if ( mGeorefTransform->transformWorldToRaster( p->mapCoords(), dst ) )
{
dX = ( dst.x() - pixel.x() );
dX = ( dst.x() - pixel.x() );
dY = -( dst.y() - pixel.y() );
}
}

View File

@ -632,10 +632,10 @@ void QgsGeorefPluginGui::showGeorefConfigDialog()
// Histogram stretch slots
void QgsGeorefPluginGui::fullHistogramStretch()
{
mLayer->setContrastEnhancementAlgorithm( "StretchToMinimumMaximum" );
mLayer->setMinimumMaximumUsingDataset();
mLayer->setCacheImage( NULL );
mCanvas->refresh();
mLayer->setContrastEnhancementAlgorithm( "StretchToMinimumMaximum" );
mLayer->setMinimumMaximumUsingDataset();
mLayer->setCacheImage( NULL );
mCanvas->refresh();
}
void QgsGeorefPluginGui::localHistogramStretch()
@ -863,11 +863,11 @@ void QgsGeorefPluginGui::createActions()
// Histogram stretch
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
connect( mActionLocalHistogramStretch, SIGNAL( triggered() ), this, SLOT( localHistogramStretch() ) );
mActionLocalHistogramStretch->setEnabled(false);
mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setIcon( getThemeIcon( "/mActionFullHistogramStretch.png" ) );
connect( mActionFullHistogramStretch, SIGNAL( triggered() ), this, SLOT( fullHistogramStretch() ) );
mActionFullHistogramStretch->setEnabled(false);
mActionFullHistogramStretch->setEnabled( false );
// Help actions
mActionHelp = new QAction( tr( "Help" ), this );
@ -1041,7 +1041,7 @@ void QgsGeorefPluginGui::createStatusBar()
statusBar()->addPermanentWidget( mCoordsLabel, 0 );
mEPSG = createBaseLabelStatus();
mEPSG->setText("EPSG:");
mEPSG->setText( "EPSG:" );
statusBar()->addPermanentWidget( mEPSG, 0 );
}
@ -1121,8 +1121,8 @@ void QgsGeorefPluginGui::addRaster( QString file )
mAgainAddRaster = false;
mActionLocalHistogramStretch->setEnabled(true);
mActionFullHistogramStretch->setEnabled(true);
mActionLocalHistogramStretch->setEnabled( true );
mActionFullHistogramStretch->setEnabled( true );
// Status Bar
if ( mGeorefTransform.hasCrs() )
@ -1133,8 +1133,8 @@ void QgsGeorefPluginGui::addRaster( QString file )
}
else
{
mEPSG->setText( tr("None") );
mEPSG->setToolTip( tr("Coordinate of image(column/line)") );
mEPSG->setText( tr( "None" ) );
mEPSG->setToolTip( tr( "Coordinate of image(column/line)" ) );
}
}

View File

@ -179,7 +179,7 @@ void QgsGeorefTransform::selectTransformParametrisation( TransformParametrisatio
void QgsGeorefTransform::setRasterChangeCoords( const QString &fileRaster )
{
mRasterChangeCoords.setRaster( fileRaster );
mRasterChangeCoords.setRaster( fileRaster );
}
bool QgsGeorefTransform::providesAccurateInverseTransformation() const
@ -210,13 +210,13 @@ bool QgsGeorefTransform::updateParametersFromGCPs( const std::vector<QgsPoint> &
}
if ( mRasterChangeCoords.hasCrs() )
{
std::vector<QgsPoint> pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords(pixelCoords);
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoordsCorrect );
pixelCoordsCorrect.clear();
std::vector<QgsPoint> pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords( pixelCoords );
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoordsCorrect );
pixelCoordsCorrect.clear();
}
else
{
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoords );
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoords );
}
return mParametersInitialized;
}

View File

@ -90,10 +90,10 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface
bool hasCrs() const { return mRasterChangeCoords.hasCrs(); }
//! \returns Coordinates of image
QgsPoint toColumnLine(const QgsPoint &pntMap) { return mRasterChangeCoords.toColumnLine( pntMap ); }
QgsPoint toColumnLine( const QgsPoint &pntMap ) { return mRasterChangeCoords.toColumnLine( pntMap ); }
//! \returns Bounding box of image(transform to coordinate of Map or Image )
QgsRectangle getBoundingBox(const QgsRectangle &rect, bool toPixel) { return mRasterChangeCoords.getBoundingBox( rect, toPixel); }
QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel ) { return mRasterChangeCoords.getBoundingBox( rect, toPixel ); }
//! \brief The transform parametrisation currently in use.
TransformParametrisation transformParametrisation() const;

View File

@ -28,64 +28,64 @@
QgsRasterChangeCoords::QgsRasterChangeCoords()
{
mHasCrs = false;
mHasCrs = false;
}
void QgsRasterChangeCoords::setRaster( const QString &fileRaster )
{
GDALAllRegister();
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
double adfGeoTransform[6];
if( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform(hDS, adfGeoTransform) == CE_None)
GDALAllRegister();
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
double adfGeoTransform[6];
if ( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform( hDS, adfGeoTransform ) == CE_None )
//if ( false )
{
mHasCrs = true;
mUL_X = adfGeoTransform[0];
mUL_Y = adfGeoTransform[3];
mResX = adfGeoTransform[1];
mResY = adfGeoTransform[5];
}
else
{
mHasCrs = false;
}
GDALClose( hDS );
{
mHasCrs = true;
mUL_X = adfGeoTransform[0];
mUL_Y = adfGeoTransform[3];
mResX = adfGeoTransform[1];
mResY = adfGeoTransform[5];
}
else
{
mHasCrs = false;
}
GDALClose( hDS );
}
std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords(const std::vector<QgsPoint> &mapCoords)
std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords( const std::vector<QgsPoint> &mapCoords )
{
const int size = mapCoords.size();
std::vector<QgsPoint> pixelCoords( size );
for ( int i = 0; i < size; i++ )
{
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
}
return pixelCoords;
const int size = mapCoords.size();
std::vector<QgsPoint> pixelCoords( size );
for ( int i = 0; i < size; i++ )
{
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
}
return pixelCoords;
}
QgsRectangle QgsRasterChangeCoords::getBoundingBox(const QgsRectangle &rect, bool toPixel)
QgsRectangle QgsRasterChangeCoords::getBoundingBox( const QgsRectangle &rect, bool toPixel )
{
QgsRectangle rectReturn;
QgsPoint p1( rect.xMinimum(), rect.yMinimum() );
QgsPoint p2( rect.xMaximum(), rect.yMaximum() );
QgsPoint ( QgsRasterChangeCoords::* func )( const QgsPoint & );
QgsPoint( QgsRasterChangeCoords::* func )( const QgsPoint & );
func = toPixel ? &QgsRasterChangeCoords::toColumnLine : &QgsRasterChangeCoords::toXY;
rectReturn.set( ( this->*func ) (p1), ( this->*func )(p2) );
rectReturn.set(( this->*func )( p1 ), ( this->*func )( p2 ) );
return rectReturn;
}
QgsPoint QgsRasterChangeCoords::toColumnLine(const QgsPoint &pntMap)
QgsPoint QgsRasterChangeCoords::toColumnLine( const QgsPoint &pntMap )
{
double col = ( pntMap.x() - mUL_X ) / mResX;
double line = ( mUL_Y - pntMap.y() ) / mResY;
return QgsPoint(col, line);
double col = ( pntMap.x() - mUL_X ) / mResX;
double line = ( mUL_Y - pntMap.y() ) / mResY;
return QgsPoint( col, line );
}
QgsPoint QgsRasterChangeCoords::toXY(const QgsPoint &pntPixel)
QgsPoint QgsRasterChangeCoords::toXY( const QgsPoint &pntPixel )
{
double x = mUL_X + ( pntPixel.x() * mResX );
double y = mUL_Y + ( pntPixel.y() * -mResY );
return QgsPoint(x, y);
return QgsPoint( x, y );
}

View File

@ -27,10 +27,10 @@ class QgsRasterChangeCoords
QgsRasterChangeCoords( );
void setRaster( const QString &fileRaster );
bool hasCrs() const { return mHasCrs; }
std::vector<QgsPoint> getPixelCoords(const std::vector<QgsPoint> &mapCoords);
QgsRectangle getBoundingBox(const QgsRectangle &rect, bool toPixel);
QgsPoint toColumnLine(const QgsPoint &pntMap);
QgsPoint toXY(const QgsPoint &pntPixel);
std::vector<QgsPoint> getPixelCoords( const std::vector<QgsPoint> &mapCoords );
QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel );
QgsPoint toColumnLine( const QgsPoint &pntMap );
QgsPoint toXY( const QgsPoint &pntPixel );
private:
bool mHasCrs;

View File

@ -1029,7 +1029,7 @@ bool QgsPostgresProvider::loadFields()
QString attnum = tresult.PQgetvalue( 0, 0 );
formattedFieldType = tresult.PQgetvalue( 0, 1 );
if( !attnum.isEmpty() )
if ( !attnum.isEmpty() )
{
sql = QString( "SELECT description FROM pg_description WHERE objoid=%1 AND objsubid=%2" )
.arg( tableoid ).arg( attnum );

View File

@ -83,7 +83,7 @@ class TestQgsDiagram: public QObject
QString myPointsFileName = mTestDataDir + "points.shp";
QFileInfo myPointFileInfo( myPointsFileName );
mPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(),
myPointFileInfo.completeBaseName(), "ogr" );
myPointFileInfo.completeBaseName(), "ogr" );
// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayers(
@ -159,14 +159,14 @@ class TestQgsDiagram: public QObject
dls.placement = QgsDiagramLayerSettings::OverPoint;
dls.renderer = dr;
dynamic_cast<QgsPalLabeling*> (mMapRenderer->labelingEngine())->setShowingAllLabels( true );
dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() )->setShowingAllLabels( true );
mPointsLayer->setDiagramLayerSettings( dls );
mComposerMap->setNewExtent( QgsRectangle( -122, -79, -70, 47 ) );
QgsCompositionChecker checker( "Composer map render", mComposition, QString( QString( TEST_DATA_DIR )
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
+ "expected_piediagram.png" ) );
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
+ "expected_piediagram.png" ) );
QVERIFY( checker.testComposition() );

View File

@ -32,7 +32,7 @@ class TestProjectionIssues: public QObject
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
void issue5895();// test for #5895
void issue5895();// test for #5895
private:
QgsRasterLayer* mRasterLayer;
QgsMapCanvas* mMapCanvas;
@ -50,8 +50,8 @@ void TestProjectionIssues::initTestCase()
// Set to WGS84
QgsCoordinateReferenceSystem sourceCRS;
sourceCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
mRasterLayer->setCrs( sourceCRS, false);
mRasterLayer->setCrs( sourceCRS, false );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
mRasterLayer->setRenderer( rasterRenderer );