indentation update and a few fixed typos

This commit is contained in:
Juergen E. Fischer 2013-10-24 15:26:39 +02:00
parent 8fb20f038d
commit ec0f0bea28
53 changed files with 240 additions and 231 deletions

View File

@ -404,15 +404,15 @@ void QgsLegend::mousePressEvent( QMouseEvent * e )
if ( !legend.isNull() )
{
mGetLegendGraphicPopup = new QFrame();
mGetLegendGraphicPopup->setFrameStyle(QFrame::Box | QFrame::Raised);
mGetLegendGraphicPopup->setLineWidth(2);
mGetLegendGraphicPopup->setAutoFillBackground(true);
mGetLegendGraphicPopup->setFrameStyle( QFrame::Box | QFrame::Raised );
mGetLegendGraphicPopup->setLineWidth( 2 );
mGetLegendGraphicPopup->setAutoFillBackground( true );
QVBoxLayout *layout = new QVBoxLayout;
QLabel *label = new QLabel(mGetLegendGraphicPopup);
label->setPixmap( QPixmap::fromImage(legend) );
layout->addWidget(label);
mGetLegendGraphicPopup->setLayout(layout);
mGetLegendGraphicPopup->move(e->globalX(), e->globalY());
QLabel *label = new QLabel( mGetLegendGraphicPopup );
label->setPixmap( QPixmap::fromImage( legend ) );
layout->addWidget( label );
mGetLegendGraphicPopup->setLayout( layout );
mGetLegendGraphicPopup->move( e->globalX(), e->globalY() );
mGetLegendGraphicPopup->show();
}
@ -645,7 +645,8 @@ void QgsLegend::updateGroupCheckStates( QTreeWidgetItem *item )
void QgsLegend::mouseReleaseEvent( QMouseEvent * e )
{
if (mGetLegendGraphicPopup) {
if ( mGetLegendGraphicPopup )
{
delete mGetLegendGraphicPopup;
mGetLegendGraphicPopup = 0;
}

View File

@ -591,9 +591,9 @@ class QgsLegend : public QTreeWidget
bool verifyDrawingOrder();
/*!
* Check if current LegendItem belogs to a WMS layer
* Check if current LegendItem belongs to a WMS layer
* @param item LegendItem to check if belongs to a WMS layer
* @return QImage A valid Legend image if belogs to WMS otherwise QImage()
* @return QImage A valid Legend image if belongs to WMS otherwise QImage()
*/
QImage getWmsLegendPixmap( QTreeWidgetItem *item );

View File

@ -210,7 +210,7 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
#endif
// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
// is not supported by server
// is not supported by the server
QgsDebugMsg( QString( "layer providertype:: %1" ).arg( layer->providerType() ) );
if ( layer->providerType() == "wms" )
{
@ -219,12 +219,12 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
QImage legendGraphic = layer->dataProvider()->getLegendGraphic( currentScale );
if ( !legendGraphic.isNull() )
{
QgsDebugMsg( QString( "downloaded legend with dimension Width:" )+QString::number(legendGraphic.width())+QString(" and Height:")+QString::number(legendGraphic.height()) );
QgsDebugMsg( QString( "downloaded legend with dimension width:" ) + QString::number( legendGraphic.width() ) + QString( " and Height:" ) + QString::number( legendGraphic.height() ) );
#if QT_VERSION >= 0x40700
if ( rasterItemList.size() == 0) itemList.reserve( 1 );
if ( rasterItemList.size() == 0 ) itemList.reserve( 1 );
#endif
itemList.append( qMakePair( QString(""), QPixmap::fromImage(legendGraphic) ) );
itemList.append( qMakePair( QString( "" ), QPixmap::fromImage( legendGraphic ) ) );
}
}

View File

@ -8902,7 +8902,7 @@ void QgisApp::keyReleaseEvent( QKeyEvent *event )
case QMessageBox::No:
break;
}
event->setAccepted( accepted ); // dont't close my Top Level Widget !
event->setAccepted( accepted ); // don't close my Top Level Widget !
accepted = false;// close the app next time when the user press back button
}
}

View File

@ -142,7 +142,7 @@ class APP_EXPORT QgsClipboard : public QObject
const QgsFields &fields() { return mFeatureFields; }
signals:
/** Emited when content changed */
/** Emitted when content changed */
void changed();
private:

View File

@ -40,7 +40,7 @@ class QgsGuiVectorLayerTools : public QgsVectorLayerTools, public QObject
bool addFeature( QgsVectorLayer *layer, QgsAttributeMap defaultValues, const QgsGeometry &defaultGeometry );
/**
* This should be called, whenever a vector layer should be switched to edit mode. If succesful
* This should be called, whenever a vector layer should be switched to edit mode. If successful
* the layer is switched to editable and an edit sessions started.
*
* @param layer The layer on which to start an edit session

View File

@ -546,7 +546,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cmbLegendDoubleClickAction->setCurrentIndex( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() );
// WMS getLegendGraphic setting
mLegendGraphicResolutionSpinBox->setValue( settings.value("/qgis/defaultLegendGraphicResolution", 0).toInt() );
mLegendGraphicResolutionSpinBox->setValue( settings.value( "/qgis/defaultLegendGraphicResolution", 0 ).toInt() );
//
// Raster properties

View File

@ -363,10 +363,10 @@ QgsComposerLegend::Nucleon QgsComposerLegend::drawSymbolItem( QgsComposerLegendI
if ( maxWidth < size.width() ) maxWidth = size.width();
if ( maxHeight < size.height() ) maxHeight = size.height();
}
QSize maxSize(maxWidth, maxHeight);
QSize maxSize( maxWidth, maxHeight );
// get and print legend
QImage legend = symbolIcon.pixmap(maxWidth, maxHeight).toImage();
QImage legend = symbolIcon.pixmap( maxWidth, maxHeight ).toImage();
if ( painter )
{
painter->drawImage( QRectF( point.x(), point.y(), mWmsLegendWidth, mWmsLegendHeight ), legend, QRectF( 0, 0, maxWidth, maxHeight ) );

View File

@ -234,28 +234,28 @@ int QgsLegendModel::addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer*
{
QgsComposerRasterSymbolItem* currentSymbolItem = new QgsComposerRasterSymbolItem( "" );
// GetLegendGraphics in case of WMS service... image can return null if GetLegendGraphics
// is not supported by server
// is not supported by the server
// double currentScale = legend()->canvas()->scale();
// BEAWARE getLegendGraphic() COULD BE USED WITHOUT SCALE PARAMETER IF IT WAS ALREADY CALLED WITH
// THIS PARAMER FROM A COMPONENT THAT CAN RECOVER CURRENT SCALE => LEGEND IN THE DESKTOP
// BEWARE getLegendGraphic() COULD BE USED WITHOUT SCALE PARAMETER IF IT WAS ALREADY CALLED WITH
// THIS PARAMETER FROM A COMPONENT THAT CAN RECOVER CURRENT SCALE => LEGEND IN THE DESKTOP
// OTHERWISE IT RETURN A INVALID PIXMAP (QPixmap().isNull() == False)
QImage legendGraphic = rasterLayer->dataProvider()->getLegendGraphic();
if ( !legendGraphic.isNull() )
{
QgsDebugMsg( QString( "downloaded legend with dimension Width:" )+QString::number(legendGraphic.width())+QString(" and Height:")+QString::number(legendGraphic.height()) );
QgsDebugMsg( QString( "downloaded legend with dimension width:" ) + QString::number( legendGraphic.width() ) + QString( " and Height:" ) + QString::number( legendGraphic.height() ) );
if ( mHasTopLevelWindow )
{
currentSymbolItem->setIcon( QIcon( QPixmap::fromImage(legendGraphic) ) );
currentSymbolItem->setIcon( QIcon( QPixmap::fromImage( legendGraphic ) ) );
}
}
else
{
currentSymbolItem->setText(tr("No Legend Available"));
currentSymbolItem->setText( tr( "No Legend Available" ) );
}
currentSymbolItem->setLayerID( rasterLayer->id() );
currentSymbolItem->setColor( QColor() );
layerItem->removeRows(0, layerItem->rowCount());
layerItem->removeRows( 0, layerItem->rowCount() );
layerItem->setChild( layerItem->rowCount(), 0, currentSymbolItem );
}
else

View File

@ -97,7 +97,7 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
public slots:
void removeLayer( const QString& layerId );
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, QString rule="" );
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, QString rule = "" );
signals:
void layersChanged();

View File

@ -204,7 +204,7 @@ namespace pal
bool LabelPosition::isInside( double *bbox )
{
for (int i = 0; i < 4; i++ )
for ( int i = 0; i < 4; i++ )
{
if ( !( x[i] >= bbox[0] && x[i] <= bbox[2] &&
y[i] >= bbox[1] && y[i] <= bbox[3] ) )

View File

@ -902,7 +902,7 @@ namespace pal
this->dpi = dpi;
}
void Pal::setShowPartial(bool show)
void Pal::setShowPartial( bool show )
{
this->showPartial = show;
}

View File

@ -363,7 +363,7 @@ namespace pal
*
* @param show flag value
*/
void setShowPartial(bool show);
void setShowPartial( bool show );
/**
* \brief Get flag show partial label

View File

@ -189,7 +189,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** \brief Returns the legend rendered as pixmap
* useful for that layer that need to get legend layer remotly as WMS */
virtual QImage getLegendGraphic( double scale=0, bool forceRefresh = false )
virtual QImage getLegendGraphic( double scale = 0, bool forceRefresh = false )
{
Q_UNUSED( scale );
Q_UNUSED( forceRefresh );

View File

@ -184,7 +184,8 @@ QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems( double scal
for ( RuleList::iterator it = mChildren.begin(); it != mChildren.end(); ++it )
{
Rule* rule = *it;
if ( scaleDenominator == -1 || rule->isScaleOK(scaleDenominator) ) {
if ( scaleDenominator == -1 || rule->isScaleOK( scaleDenominator ) )
{
lst << rule->legendSymbolItems( scaleDenominator, ruleFilter );
}
}

View File

@ -390,7 +390,8 @@ QImage* QgsWMSServer::getLegendGraphics()
return 0;
}
if ( !rule.isEmpty() ) {
if ( !rule.isEmpty() )
{
//create second image with the right dimensions
QImage* paintImage = createImage( symbolWidth, symbolHeight );
@ -399,7 +400,8 @@ QImage* QgsWMSServer::getLegendGraphics()
p.setRenderHint( QPainter::Antialiasing, true );
QgsComposerLegendItem* currentComposerItem = dynamic_cast<QgsComposerLegendItem*>( rootItem->child( 0 )->child( 0 ) );
if ( currentComposerItem != NULL ) {
if ( currentComposerItem != NULL )
{
QgsComposerLegendItem::ItemType type = currentComposerItem->itemType();
switch ( type )
{

View File

@ -4001,7 +4001,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
if ( !myExtent.isEmpty() )
{
// we cannot reliably identify WMS if theExtent is specified but theWidth or theHeight
// are not, because we dont know original resolution
// are not, because we don't know original resolution
if ( theWidth == 0 || theHeight == 0 )
{
return QgsRasterIdentifyResult( ERROR( tr( "Context not fully specified (extent was defined but width and/or height was not)." ) ) );
@ -4600,7 +4600,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
// the layer tags inside capabilities
QgsDebugMsg( "entering." );
if ( !scale && !mGetLegendGraphicScale)
if ( !scale && !mGetLegendGraphicScale )
{
QgsDebugMsg( QString( "No scale factor set" ) );
return QImage();
@ -4620,42 +4620,45 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
}
// if style is not defined, set as "default"
QString currentStyle("default");
QString currentStyle( "default" );
if ( mActiveSubStyles[0] != "" )
{
currentStyle = mActiveSubStyles[0];
}
#if 0
// add WMS GetGraphicLegend request
// TODO set sld version using instance var something like mSldVersion
// TODO at this moment LSD version can be get from LegendURL in getCapability,but parsing of
// this tag is not complete. Below the code that should work if pasing whould correct
// if ( mActiveSubLayers[0] == mCapabilities.capability.layer.name )
// {
// foreach( QgsWmsStyleProperty style, mCapabilities.capability.layer.style )
// {
// if ( currentStyle == style.name )
// {
// url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
// }
// }
// } // is a sublayer
// else if ( mActiveSubLayers[0].contains( mCapabilities.capability.layer.name ) )
// {
// foreach( QgsWmsLayerProperty layerProperty, mCapabilities.capability.layer.layer )
// {
// if ( mActiveSubLayers[0] == layerProperty.name )
// {
// foreach( QgsWmsStyleProperty style, layerProperty.style )
// {
// if ( currentStyle == style.name )
// {
// url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
// }
// }
// }
// }
// }
// this tag is not complete. Below the code that should work if parsing would correct
if ( mActiveSubLayers[0] == mCapabilities.capability.layer.name )
{
foreach ( QgsWmsStyleProperty style, mCapabilities.capability.layer.style )
{
if ( currentStyle == style.name )
{
url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
}
}
} // is a sublayer
else if ( mActiveSubLayers[0].contains( mCapabilities.capability.layer.name ) )
{
foreach ( QgsWmsLayerProperty layerProperty, mCapabilities.capability.layer.layer )
{
if ( mActiveSubLayers[0] == layerProperty.name )
{
foreach ( QgsWmsStyleProperty style, layerProperty.style )
{
if ( currentStyle == style.name )
{
url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
}
}
}
}
}
#endif
QUrl url( mIgnoreGetMapUrl ? mBaseUrl : getMapUrl(), QUrl::StrictMode );
setQueryItem( url, "SERVICE", "WMS" );
setQueryItem( url, "VERSION", mCapabilities.version );
@ -4663,24 +4666,26 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
setQueryItem( url, "LAYER", mActiveSubLayers[0] );
setQueryItem( url, "STYLE", currentStyle );
setQueryItem( url, "SCALE", QString::number( scale, 'f') );
setQueryItem( url, "SCALE", QString::number( scale, 'f' ) );
setQueryItem( url, "FORMAT", mImageMimeType );
// add config parameter related to resolution
QSettings s;
int defaultLegendGraphicResolution = s.value( "/qgis/defaultLegendGraphicResolution", 0 ).toInt();
QgsDebugMsg( QString( "defaultLegendGraphicResolution: %1" ).arg( defaultLegendGraphicResolution ) );
if ( defaultLegendGraphicResolution ) {
if (url.queryItemValue("map_resolution") != "")
if ( defaultLegendGraphicResolution )
{
setQueryItem( url, "map_resolution", QString::number(defaultLegendGraphicResolution) );
}
else if (url.queryItemValue("dpi") != "")
if ( url.queryItemValue( "map_resolution" ) != "" )
{
setQueryItem( url, "dpi", QString::number(defaultLegendGraphicResolution) );
setQueryItem( url, "map_resolution", QString::number( defaultLegendGraphicResolution ) );
}
else{
QgsLogger::warning(tr("getLegendGraphic: Can not determine resolution uri parameter [map_resolution | dpi]. No resolution parameter will be used"));
else if ( url.queryItemValue( "dpi" ) != "" )
{
setQueryItem( url, "dpi", QString::number( defaultLegendGraphicResolution ) );
}
else
{
QgsLogger::warning( tr( "getLegendGraphic: Can not determine resolution uri parameter [map_resolution | dpi]. No resolution parameter will be used" ) );
}
}
@ -4769,8 +4774,8 @@ void QgsWmsProvider::getLegendGraphicReplyFinished()
#ifdef QGISDEBUG
QString filename = QDir::tempPath() + "/GetLegendGraphic.png";
mGetLegendGraphicImage.save(filename);
QgsDebugMsg( "saved GetLegendGraphic result in debug ile: "+filename );
mGetLegendGraphicImage.save( filename );
QgsDebugMsg( "saved GetLegendGraphic result in debug ile: " + filename );
#endif
}
}

View File

@ -651,10 +651,10 @@ class QgsWmsProvider : public QgsRasterDataProvider
/**
* \brief Get GetLegendGraphic if service available otherwise QImage()
* BEAWARE call it the first time specifying scale parameter otherwise it always return QImage()
* \todo some services dowsn't expose getLegendGraphic in capabilities but adding LegendURL in
* BEWARE call it the first time specifying scale parameter otherwise it always return QImage()
* \todo some services doesn't expose getLegendGraphic in capabilities but adds LegendURL in
* the layer tags inside capabilities, but LegendURL parsing is still not developed => getLegendGraphic is
* always called assuming that error means service is not available. Other drowback is that SLD_VERSION
* always called assuming that error means service is not available. Other drawback is that SLD_VERSION
* is inside LegendURL, so at this moment it is fixed to 1.1.0 waiting a correct parsing of LegendURL
* in getCapability
* \param scale Optional parameter that is the Scale of the wms layer

View File

@ -32,10 +32,10 @@ class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
public:
TestSignalReceiver() : QObject( 0 ), blendMode( QPainter::CompositionMode_SourceOver ) {}
QPainter::CompositionMode blendMode;
public slots:
public slots:
void onBlendModeChanged( const QPainter::CompositionMode blendMode )
{
this->blendMode = blendMode;
@ -90,7 +90,7 @@ void TestQgsMapLayer::setBlendMode()
TestSignalReceiver receiver;
QObject::connect( mpLayer, SIGNAL( blendModeChanged( const QPainter::CompositionMode ) ),
&receiver, SLOT( onBlendModeChanged( const QPainter::CompositionMode ) ) );
QCOMPARE( int(receiver.blendMode), 0 );
QCOMPARE( int( receiver.blendMode ), 0 );
mpLayer->setBlendMode( QPainter::CompositionMode_Screen );
// check the signal has been correctly emitted
QCOMPARE( receiver.blendMode, QPainter::CompositionMode_Screen );

View File

@ -90,12 +90,12 @@ class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false )
{}
bool rendererChanged;
public slots:
public slots:
void onRendererChanged()
{
rendererChanged = true;
@ -502,7 +502,7 @@ void TestQgsRasterLayer::setRenderer()
TestSignalReceiver receiver;
QObject::connect( mpRasterLayer, SIGNAL( rendererChanged() ),
&receiver, SLOT( onRendererChanged() ) );
QgsRasterRenderer* renderer = (QgsRasterRenderer*) mpRasterLayer->renderer()->clone();
QgsRasterRenderer* renderer = ( QgsRasterRenderer* ) mpRasterLayer->renderer()->clone();
QCOMPARE( receiver.rendererChanged, false );
mpRasterLayer->setRenderer( renderer );
QCOMPARE( receiver.rendererChanged, true );

View File

@ -40,16 +40,16 @@ class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false ),
featureBlendMode( QPainter::CompositionMode(0) ),
featureBlendMode( QPainter::CompositionMode( 0 ) ),
transparency( 0 )
{}
bool rendererChanged;
QPainter::CompositionMode featureBlendMode;
int transparency;
public slots:
public slots:
void onRendererChanged()
{
rendererChanged = true;
@ -683,7 +683,7 @@ class TestQgsVectorLayer: public QObject
QObject::connect( vLayer, SIGNAL( featureBlendModeChanged( const QPainter::CompositionMode ) ),
&receiver, SLOT( onFeatureBlendModeChanged( const QPainter::CompositionMode ) ) );
QCOMPARE( int(receiver.featureBlendMode), 0 );
QCOMPARE( int( receiver.featureBlendMode ), 0 );
vLayer->setFeatureBlendMode( QPainter::CompositionMode_Screen );
QCOMPARE( receiver.featureBlendMode, QPainter::CompositionMode_Screen );
QCOMPARE( vLayer->featureBlendMode(), QPainter::CompositionMode_Screen );

View File

@ -206,7 +206,7 @@ class ServerConfigNotAccessibleError(Exception):
port = 80 or a user-defined port above 1024
fcgipath = path to working qgis_mapserv.fcgi as known by server
sourceurl = DO NOT ADJUST
projdir = path WRITEABLE by this user and READABLE by www server
projdir = path WRITABLE by this user and READABLE by www server
Sample configuration (default):
sourceurl (built) = http://localhost:80/cgi-bin/qgis_mapserv.fcgi
@ -340,7 +340,7 @@ def _checkItemReadable(item, path):
def _checkItemWriteable(item, path):
msg = ('Server configuration {0} is not writeable from:\n'
msg = ('Server configuration {0} is not writable from:\n'
' {1}'.format(item, path))
assert os.access(path, os.W_OK), msg

View File

@ -95,7 +95,7 @@ __all__ = ['WSGIServer']
class WSGIServer(BaseAJPServer, ThreadedServer):
"""
AJP1.3/WSGI server. Runs your WSGI application as a persistant program
AJP1.3/WSGI server. Runs your WSGI application as a persistent program
that understands AJP1.3. Opens up a TCP socket, binds it, and then
waits for forwarded requests from your webserver.