From f355ea6d7c2e7306c0015f9b0f53391306be9385 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Sat, 19 Apr 2014 22:04:24 +0200 Subject: [PATCH] identation update --- .../processing/algs/grass/GrassUtils.py | 2 +- .../processing/algs/otb/OTBAlgorithm.py | 2 +- .../processing/algs/saga/SagaAlgorithm.py | 2 +- .../algs/saga/SagaGroupNameDecorator.py | 4 +- python/plugins/processing/core/Processing.py | 2 +- .../processing/core/ProcessingConfig.py | 2 +- .../gui/AlgorithmExecutionDialog.py | 16 +- .../gui/BatchInputSelectionPanel.py | 24 +- .../processing/gui/EditScriptAction.py | 2 +- python/plugins/processing/gui/Help2Html.py | 6 +- .../processing/gui/MultipleFileInputDialog.py | 2 +- .../plugins/processing/gui/ParametersPanel.py | 2 +- .../modeler/ModelerParametersDialog.py | 10 +- src/app/qgisapp.cpp | 6 +- src/app/qgsidentifyresultsdialog.cpp | 6 +- src/core/qgssnapper.cpp | 2 +- src/gui/qgshighlight.cpp | 2 +- src/gui/raster/qwt5_histogram_item.h | 458 +++++++++--------- src/providers/wfs/qgswfscapabilities.cpp | 4 +- src/providers/wfs/qgswfsprovider.h | 2 +- 20 files changed, 278 insertions(+), 278 deletions(-) diff --git a/python/plugins/processing/algs/grass/GrassUtils.py b/python/plugins/processing/algs/grass/GrassUtils.py index 338e9dd982c8..f2d0688913ec 100644 --- a/python/plugins/processing/algs/grass/GrassUtils.py +++ b/python/plugins/processing/algs/grass/GrassUtils.py @@ -94,7 +94,7 @@ def grassPath(): for subfolder in os.listdir(testfolder): if subfolder.startswith('grass'): folder = os.path.join(testfolder, subfolder) - break + break else: folder = os.path.join(QgsApplication.prefixPath(), 'grass') if not os.path.isdir(folder): diff --git a/python/plugins/processing/algs/otb/OTBAlgorithm.py b/python/plugins/processing/algs/otb/OTBAlgorithm.py index ae3504220cd7..5a5828ea2dc7 100644 --- a/python/plugins/processing/algs/otb/OTBAlgorithm.py +++ b/python/plugins/processing/algs/otb/OTBAlgorithm.py @@ -89,7 +89,7 @@ def adapt_list_to_string(self, c_list): if c_list[0] == "ParameterType_InputImageList": a_list[3] = 3 elif c_list[0] == "ParameterType_InputFilenameList": - a_list[3] = 4 + a_list[3] = 4 else: a_list[3] = -1 diff --git a/python/plugins/processing/algs/saga/SagaAlgorithm.py b/python/plugins/processing/algs/saga/SagaAlgorithm.py index 61f9fbe46356..bd8fc78c408b 100644 --- a/python/plugins/processing/algs/saga/SagaAlgorithm.py +++ b/python/plugins/processing/algs/saga/SagaAlgorithm.py @@ -505,7 +505,7 @@ def checkParameterValuesBeforeExecuting(self): def help(self): name = self.cmdname.lower() validChars = 'abcdefghijklmnopqrstuvwxyz' - name = ''.join(c for c in name if c in validChars) + name = ''.join(c for c in name if c in validChars) html = getHtmlFromRstFile(os.path.join(os.path.dirname(__file__), 'help', name + '.rst')) imgpath = os.path.join(os.path.dirname(__file__),os.pardir, os.pardir, 'images', 'saga100x100.jpg') diff --git a/python/plugins/processing/algs/saga/SagaGroupNameDecorator.py b/python/plugins/processing/algs/saga/SagaGroupNameDecorator.py index f7eab42055e3..5d41754a9bb0 100644 --- a/python/plugins/processing/algs/saga/SagaGroupNameDecorator.py +++ b/python/plugins/processing/algs/saga/SagaGroupNameDecorator.py @@ -89,6 +89,6 @@ class SagaGroupNameDecorator: groups['vigra'] = 'Vigra' @staticmethod - def getDecoratedName(groupName): + def getDecoratedName(groupName): return SagaGroupNameDecorator.groups.get(groupName, groupName) - + diff --git a/python/plugins/processing/core/Processing.py b/python/plugins/processing/core/Processing.py index c11d4c9c6cd1..af7279de7be1 100644 --- a/python/plugins/processing/core/Processing.py +++ b/python/plugins/processing/core/Processing.py @@ -146,7 +146,7 @@ def initialize(): Processing.addProvider(OTBAlgorithmProvider()) Processing.addProvider(RAlgorithmProvider()) Processing.addProvider(SagaAlgorithmProvider()) - Processing.addProvider(GrassAlgorithmProvider()) + Processing.addProvider(GrassAlgorithmProvider()) Processing.addProvider(Grass7AlgorithmProvider()) Processing.addProvider(ScriptAlgorithmProvider()) Processing.addProvider(TauDEMAlgorithmProvider()) diff --git a/python/plugins/processing/core/ProcessingConfig.py b/python/plugins/processing/core/ProcessingConfig.py index dac9ae9c8238..2302d7557730 100644 --- a/python/plugins/processing/core/ProcessingConfig.py +++ b/python/plugins/processing/core/ProcessingConfig.py @@ -188,7 +188,7 @@ class Setting: STRING = 0 FILE = 1 FOLDER = 2 - + def __init__(self, group, name, description, default, hidden=False, valuetype = None): self.group = group self.name = name diff --git a/python/plugins/processing/gui/AlgorithmExecutionDialog.py b/python/plugins/processing/gui/AlgorithmExecutionDialog.py index 14330f4f8d2f..e230f7752a46 100644 --- a/python/plugins/processing/gui/AlgorithmExecutionDialog.py +++ b/python/plugins/processing/gui/AlgorithmExecutionDialog.py @@ -108,21 +108,21 @@ def __init__(self, alg, mainWidget): url = None try: isText, help = self.alg.help() - if help is not None: + if help is not None: if isText: html = help; else: - url = QtCore.QUrl(help) + url = QtCore.QUrl(help) else: html = '

Sorry, no help is available for this \ algorithm.

' except WrongHelpFileException, e: - html = e.args[0] + html = e.args[0] try: if html: self.webView.setHtml(html) - elif url: - print url + elif url: + print url self.webView.load(url) except: self.webView.setHtml('

Could not open help file :-(

') @@ -199,11 +199,11 @@ def setParamValue(self, param, widget): elif isinstance(param, ParameterMultipleInput): if param.datatype == ParameterMultipleInput.TYPE_FILE: return param.setValue(widget.selectedoptions) - else: + else: if param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY: - options = dataobjects.getVectorLayers() + options = dataobjects.getVectorLayers() else: - options = dataobjects.getRasterLayers() + options = dataobjects.getRasterLayers() return param.setValue([options[i] for i in widget.selectedoptions]) elif isinstance(param, (ParameterNumber, ParameterFile, ParameterCrs, ParameterExtent)): diff --git a/python/plugins/processing/gui/BatchInputSelectionPanel.py b/python/plugins/processing/gui/BatchInputSelectionPanel.py index 7d24e3412490..785b403f46d4 100644 --- a/python/plugins/processing/gui/BatchInputSelectionPanel.py +++ b/python/plugins/processing/gui/BatchInputSelectionPanel.py @@ -54,13 +54,13 @@ def __init__(self, param, row, col, batchDialog, parent=None): self.horizontalLayout.addWidget(self.text) self.pushButton = QtGui.QPushButton() self.pushButton.setText('...') - self.pushButton.clicked.connect(self.showPopupMenu) + self.pushButton.clicked.connect(self.showPopupMenu) self.horizontalLayout.addWidget(self.pushButton) self.setLayout(self.horizontalLayout) - + def showPopupMenu(self): popupmenu = QtGui.QMenu() - if not (isinstance(self.param, ParameterMultipleInput) + if not (isinstance(self.param, ParameterMultipleInput) and self.param.datatype == ParameterMultipleInput.TYPE_FILE): selectLayerAction = QtGui.QAction('Select from open layers', self.pushButton) @@ -70,28 +70,28 @@ def showPopupMenu(self): self.pushButton) selectFileAction.triggered.connect(self.showFileSelectionDialog) popupmenu.addAction(selectFileAction) - popupmenu.exec_(QtGui.QCursor.pos()) + popupmenu.exec_(QtGui.QCursor.pos()) def showLayerSelectionDialog(self): if (isinstance(self.param, ParameterRaster) - or (isinstance(self.param, ParameterMultipleInput) + or (isinstance(self.param, ParameterMultipleInput) and self.param.datatype == ParameterMultipleInput.TYPE_RASTER)): - layers = dataobjects.getRasterLayers() + layers = dataobjects.getRasterLayers() elif isinstance(self.param, ParameterTable): - layers = dataobjects.getTables() + layers = dataobjects.getTables() else: if isinstance(self.param, ParameterVector): datatype = self.param.shapetype else: datatype = [self.param.datatype] - layers = dataobjects.getVectorLayers(datatype) + layers = dataobjects.getVectorLayers(datatype) dlg = MultipleInputDialog([layer.name() for layer in layers]) dlg.exec_() - if dlg.selectedoptions is not None: - selected = dlg.selectedoptions + if dlg.selectedoptions is not None: + selected = dlg.selectedoptions if len(selected) == 1: self.text.setText(layers[selected[0]]) - else: + else: if isinstance(self.param, ParameterMultipleInput): self.text.setText(';'.join(layers[idx].name() for idx in selected)) else: @@ -101,7 +101,7 @@ def showLayerSelectionDialog(self): for i, layeridx in enumerate(selected): self.table.cellWidget(i + self.row, self.col).setText(layers[layeridx].name()) - + def showFileSelectionDialog(self): settings = QtCore.QSettings() text = unicode(self.text.text()) diff --git a/python/plugins/processing/gui/EditScriptAction.py b/python/plugins/processing/gui/EditScriptAction.py index 81538dc8c586..d673c4154448 100644 --- a/python/plugins/processing/gui/EditScriptAction.py +++ b/python/plugins/processing/gui/EditScriptAction.py @@ -55,4 +55,4 @@ def execute(self): self.toolbox.updateProvider('script') elif self.scriptType == ScriptEditorDialog.SCRIPT_R: self.toolbox.updateProvider('r') - + diff --git a/python/plugins/processing/gui/Help2Html.py b/python/plugins/processing/gui/Help2Html.py index 89af6e0c5639..13b4387f1403 100644 --- a/python/plugins/processing/gui/Help2Html.py +++ b/python/plugins/processing/gui/Help2Html.py @@ -36,7 +36,7 @@ ALG_HELP_CREATOR = 'ALG_HELP_CREATOR' exps = [(r"\*(.*?)\*", r"\1"), - ("``(.*?)``", r'\1'), + ("``(.*?)``", r'\1'), ("(.*?)\n==+\n+?", r'

\1

'), ("(.*?)\n--+\n+?", r'

\1

'), (r"::(\s*\n(\s*\n)*((\s+).*?\n)(((\4).*?\n)|(\s*\n))*)",r"
\1
"), @@ -45,14 +45,14 @@ def getHtmlFromRstFile(rst): with open(rst) as f: - lines = f.readlines() + lines = f.readlines() s = "".join(lines) for exp, replace in exps: p = re.compile(exp) s = p.sub(replace, s) print s return s - + def getHtmlFromHelpFile(alg, helpFile): if not os.path.exists(helpFile): return None diff --git a/python/plugins/processing/gui/MultipleFileInputDialog.py b/python/plugins/processing/gui/MultipleFileInputDialog.py index ee68ac2a6401..c65d03b8d06a 100644 --- a/python/plugins/processing/gui/MultipleFileInputDialog.py +++ b/python/plugins/processing/gui/MultipleFileInputDialog.py @@ -31,7 +31,7 @@ import os class MultipleFileInputDialog(QtGui.QDialog): - + def __init__(self, selectedoptions): self.selectedoptions = selectedoptions self.options=selectedoptions diff --git a/python/plugins/processing/gui/ParametersPanel.py b/python/plugins/processing/gui/ParametersPanel.py index fd884f856669..b138ae0b8b1d 100644 --- a/python/plugins/processing/gui/ParametersPanel.py +++ b/python/plugins/processing/gui/ParametersPanel.py @@ -283,7 +283,7 @@ def getWidgetFromParameter(self, param): item = MultipleFileInputPanel() else: if param.datatype == ParameterMultipleInput.TYPE_RASTER: - options = dataobjects.getRasterLayers() + options = dataobjects.getRasterLayers() elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY: options = dataobjects.getVectorLayers() else: diff --git a/python/plugins/processing/modeler/ModelerParametersDialog.py b/python/plugins/processing/modeler/ModelerParametersDialog.py index 2f85bbdca73c..be5aafa983bf 100644 --- a/python/plugins/processing/modeler/ModelerParametersDialog.py +++ b/python/plugins/processing/modeler/ModelerParametersDialog.py @@ -164,25 +164,25 @@ def setupUi(self): self.scrollArea.setWidgetResizable(True) self.tabWidget.addTab(self.scrollArea, 'Parameters') self.webView = QtWebKit.QWebView() - + html = None url = None try: isText, help = self.alg.help() - if help is not None: + if help is not None: if isText: html = help; else: - url = QtCore.QUrl(help) + url = QtCore.QUrl(help) else: html = '

Sorry, no help is available for this \ algorithm.

' except WrongHelpFileException, e: - html = e.args[0] + html = e.args[0] try: if html: self.webView.setHtml(html) - elif url: + elif url: self.webView.load(url) except: self.webView.setHtml('

Could not open help file :-(

') diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 206f080d8b42..62d57de5ac01 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -9119,8 +9119,8 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion ) if ( settings.value( "/qgis/warnOldProjectVersion", QVariant( true ) ).toBool() ) { QString smalltext = tr( "This project file was saved by an older version of QGIS." - " When saving this project file, QGIS will update it to the latest version, " - "possibly rendering it useless for older versions of QGIS."); + " When saving this project file, QGIS will update it to the latest version, " + "possibly rendering it useless for older versions of QGIS." ); QString text = tr( "

This project file was saved by an older version of QGIS." " When saving this project file, QGIS will update it to the latest version, " @@ -9154,7 +9154,7 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion ) ); box.exec(); #else - messageBar()->pushMessage( title, smalltext); + messageBar()->pushMessage( title, smalltext ); #endif } return; diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 564754ade6d4..dbb2f00c71da 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -473,10 +473,10 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat void QgsIdentifyResultsDialog::mapLayerActionDestroyed() { QTreeWidgetItemIterator it( lstResults ); - while( *it ) + while ( *it ) { - if( (*it)->data( 0, Qt::UserRole ) == "map_layer_action" && - (*it)->data( 0, Qt::UserRole + 1 ).value< QObject *>() == sender() ) + if (( *it )->data( 0, Qt::UserRole ) == "map_layer_action" && + ( *it )->data( 0, Qt::UserRole + 1 ).value< QObject *>() == sender() ) delete *it; else ++it; diff --git a/src/core/qgssnapper.cpp b/src/core/qgssnapper.cpp index 7c7322bfb819..abcd25196a6f 100644 --- a/src/core/qgssnapper.cpp +++ b/src/core/qgssnapper.cpp @@ -99,7 +99,7 @@ int QgsSnapper::snapPoint( const QPoint& startPoint, QList& s QgsSnappingResult returnResult = evalIt.value(); for ( evalIt = snappingResultList.begin(); evalIt != snappingResultList.end(); ++evalIt ) { - if( evalIt.value().snappedVertexNr != -1 ) + if ( evalIt.value().snappedVertexNr != -1 ) { returnResult = evalIt.value(); snappingResultList.erase( evalIt ); diff --git a/src/gui/qgshighlight.cpp b/src/gui/qgshighlight.cpp index 02b90a811389..29cff575077a 100644 --- a/src/gui/qgshighlight.cpp +++ b/src/gui/qgshighlight.cpp @@ -344,7 +344,7 @@ void QgsHighlight::paint( QPainter* p ) else if ( mFeature.geometry() ) { QgsVectorLayer *layer = qobject_cast( mLayer ); - if( !layer ) + if ( !layer ) return; QgsMapSettings mapSettings = mMapCanvas->mapSettings(); QgsRenderContext context = QgsRenderContext::fromMapSettings( mapSettings ); diff --git a/src/gui/raster/qwt5_histogram_item.h b/src/gui/raster/qwt5_histogram_item.h index a66d53363ec0..9940f686ac1c 100644 --- a/src/gui/raster/qwt5_histogram_item.h +++ b/src/gui/raster/qwt5_histogram_item.h @@ -13,50 +13,50 @@ #include #include -#include "qwt_plot_item.h" +#include "qwt_plot_item.h" class QwtIntervalData; class QString; class HistogramItem: public QwtPlotItem { -public: - explicit HistogramItem(const QString &title = QString::null); - explicit HistogramItem(const QwtText &title); + public: + explicit HistogramItem( const QString &title = QString::null ); + explicit HistogramItem( const QwtText &title ); virtual ~HistogramItem(); - void setData(const QwtIntervalData &data); + void setData( const QwtIntervalData &data ); const QwtIntervalData &data() const; - void setColor(const QColor &); + void setColor( const QColor & ); QColor color() const; virtual QwtDoubleRect boundingRect() const; virtual int rtti() const; - virtual void draw(QPainter *, const QwtScaleMap &xMap, - const QwtScaleMap &yMap, const QRect &) const; + virtual void draw( QPainter *, const QwtScaleMap &xMap, + const QwtScaleMap &yMap, const QRect & ) const; - virtual void updateLegend(QwtLegend *) const; + virtual void updateLegend( QwtLegend * ) const; - void setBaseline(double reference); + void setBaseline( double reference ); double baseline() const; enum HistogramAttribute { - Auto = 0, - Xfy = 1 + Auto = 0, + Xfy = 1 }; - void setHistogramAttribute(HistogramAttribute, bool on = true); - bool testHistogramAttribute(HistogramAttribute) const; + void setHistogramAttribute( HistogramAttribute, bool on = true ); + bool testHistogramAttribute( HistogramAttribute ) const; -protected: - virtual void drawBar(QPainter *, - Qt::Orientation o, const QRect &) const; + protected: + virtual void drawBar( QPainter *, + Qt::Orientation o, const QRect & ) const; -private: + private: void init(); class PrivateData; @@ -73,337 +73,337 @@ class HistogramItem: public QwtPlotItem class HistogramItem::PrivateData { -public: + public: int attributes; QwtIntervalData data; QColor color; double reference; }; -HistogramItem::HistogramItem(const QwtText &title): - QwtPlotItem(title) +HistogramItem::HistogramItem( const QwtText &title ): + QwtPlotItem( title ) { - init(); + init(); } -HistogramItem::HistogramItem(const QString &title): - QwtPlotItem(QwtText(title)) +HistogramItem::HistogramItem( const QString &title ): + QwtPlotItem( QwtText( title ) ) { - init(); + init(); } HistogramItem::~HistogramItem() { - delete d_data; + delete d_data; } void HistogramItem::init() { - d_data = new PrivateData(); - d_data->reference = 0.0; - d_data->attributes = HistogramItem::Auto; + d_data = new PrivateData(); + d_data->reference = 0.0; + d_data->attributes = HistogramItem::Auto; - setItemAttribute(QwtPlotItem::AutoScale, true); - setItemAttribute(QwtPlotItem::Legend, true); + setItemAttribute( QwtPlotItem::AutoScale, true ); + setItemAttribute( QwtPlotItem::Legend, true ); - setZ(20.0); + setZ( 20.0 ); } -void HistogramItem::setBaseline(double reference) +void HistogramItem::setBaseline( double reference ) { - if ( d_data->reference != reference ) - { - d_data->reference = reference; - itemChanged(); - } + if ( d_data->reference != reference ) + { + d_data->reference = reference; + itemChanged(); + } } double HistogramItem::baseline() const { - return d_data->reference; + return d_data->reference; } -void HistogramItem::setData(const QwtIntervalData &data) +void HistogramItem::setData( const QwtIntervalData &data ) { - d_data->data = data; - itemChanged(); + d_data->data = data; + itemChanged(); } const QwtIntervalData &HistogramItem::data() const { - return d_data->data; + return d_data->data; } -void HistogramItem::setColor(const QColor &color) +void HistogramItem::setColor( const QColor &color ) { - if ( d_data->color != color ) - { - d_data->color = color; - itemChanged(); - } + if ( d_data->color != color ) + { + d_data->color = color; + itemChanged(); + } } QColor HistogramItem::color() const { - return d_data->color; + return d_data->color; } QwtDoubleRect HistogramItem::boundingRect() const { - QwtDoubleRect rect = d_data->data.boundingRect(); - if ( !rect.isValid() ) - return rect; - - if ( d_data->attributes & Xfy ) - { - rect = QwtDoubleRect( rect.y(), rect.x(), - rect.height(), rect.width() ); - - if ( rect.left() > d_data->reference ) - rect.setLeft( d_data->reference ); - else if ( rect.right() < d_data->reference ) - rect.setRight( d_data->reference ); - } - else - { - if ( rect.bottom() < d_data->reference ) - rect.setBottom( d_data->reference ); - else if ( rect.top() > d_data->reference ) - rect.setTop( d_data->reference ); - } - + QwtDoubleRect rect = d_data->data.boundingRect(); + if ( !rect.isValid() ) return rect; + + if ( d_data->attributes & Xfy ) + { + rect = QwtDoubleRect( rect.y(), rect.x(), + rect.height(), rect.width() ); + + if ( rect.left() > d_data->reference ) + rect.setLeft( d_data->reference ); + else if ( rect.right() < d_data->reference ) + rect.setRight( d_data->reference ); + } + else + { + if ( rect.bottom() < d_data->reference ) + rect.setBottom( d_data->reference ); + else if ( rect.top() > d_data->reference ) + rect.setTop( d_data->reference ); + } + + return rect; } int HistogramItem::rtti() const { - return QwtPlotItem::Rtti_PlotHistogram; + return QwtPlotItem::Rtti_PlotHistogram; } -void HistogramItem::setHistogramAttribute(HistogramAttribute attribute, bool on) +void HistogramItem::setHistogramAttribute( HistogramAttribute attribute, bool on ) { - if ( bool(d_data->attributes & attribute) == on ) - return; + if ( bool( d_data->attributes & attribute ) == on ) + return; - if ( on ) - d_data->attributes |= attribute; - else - d_data->attributes &= ~attribute; + if ( on ) + d_data->attributes |= attribute; + else + d_data->attributes &= ~attribute; - itemChanged(); + itemChanged(); } -bool HistogramItem::testHistogramAttribute(HistogramAttribute attribute) const +bool HistogramItem::testHistogramAttribute( HistogramAttribute attribute ) const { - return d_data->attributes & attribute; + return d_data->attributes & attribute; } -void HistogramItem::draw(QPainter *painter, const QwtScaleMap &xMap, - const QwtScaleMap &yMap, const QRect &) const +void HistogramItem::draw( QPainter *painter, const QwtScaleMap &xMap, + const QwtScaleMap &yMap, const QRect & ) const { - const QwtIntervalData &iData = d_data->data; + const QwtIntervalData &iData = d_data->data; - painter->setPen(QPen(d_data->color)); + painter->setPen( QPen( d_data->color ) ); - const int x0 = xMap.transform(baseline()); - const int y0 = yMap.transform(baseline()); + const int x0 = xMap.transform( baseline() ); + const int y0 = yMap.transform( baseline() ); - for ( int i = 0; i < (int)iData.size(); i++ ) + for ( int i = 0; i < ( int )iData.size(); i++ ) + { + if ( d_data->attributes & HistogramItem::Xfy ) { - if ( d_data->attributes & HistogramItem::Xfy ) + const int x2 = xMap.transform( iData.value( i ) ); + if ( x2 == x0 ) + continue; + + int y1 = yMap.transform( iData.interval( i ).minValue() ); + int y2 = yMap.transform( iData.interval( i ).maxValue() ); + if ( y1 > y2 ) + qSwap( y1, y2 ); + + if ( i < ( int )iData.size() - 2 ) + { + const int yy1 = yMap.transform( iData.interval( i + 1 ).minValue() ); + const int yy2 = yMap.transform( iData.interval( i + 1 ).maxValue() ); + + if ( y2 == qwtMin( yy1, yy2 ) ) { - const int x2 = xMap.transform(iData.value(i)); - if ( x2 == x0 ) - continue; - - int y1 = yMap.transform( iData.interval(i).minValue()); - int y2 = yMap.transform( iData.interval(i).maxValue()); - if ( y1 > y2 ) - qSwap(y1, y2); - - if ( i < (int)iData.size() - 2 ) - { - const int yy1 = yMap.transform(iData.interval(i+1).minValue()); - const int yy2 = yMap.transform(iData.interval(i+1).maxValue()); - - if ( y2 == qwtMin(yy1, yy2) ) - { - const int xx2 = xMap.transform( - iData.interval(i+1).minValue()); - if ( xx2 != x0 && ( (xx2 < x0 && x2 < x0) || - (xx2 > x0 && x2 > x0) ) ) - { - // One pixel distance between neighboured bars - y2++; - } - } - } - - drawBar(painter, Qt::Horizontal, - QRect(x0, y1, x2 - x0, y2 - y1)); + const int xx2 = xMap.transform( + iData.interval( i + 1 ).minValue() ); + if ( xx2 != x0 && (( xx2 < x0 && x2 < x0 ) || + ( xx2 > x0 && x2 > x0 ) ) ) + { + // One pixel distance between neighboured bars + y2++; + } } - else + } + + drawBar( painter, Qt::Horizontal, + QRect( x0, y1, x2 - x0, y2 - y1 ) ); + } + else + { + const int y2 = yMap.transform( iData.value( i ) ); + if ( y2 == y0 ) + continue; + + int x1 = xMap.transform( iData.interval( i ).minValue() ); + int x2 = xMap.transform( iData.interval( i ).maxValue() ); + if ( x1 > x2 ) + qSwap( x1, x2 ); + + if ( i < ( int )iData.size() - 2 ) + { + const int xx1 = xMap.transform( iData.interval( i + 1 ).minValue() ); + const int xx2 = xMap.transform( iData.interval( i + 1 ).maxValue() ); + + if ( x2 == qwtMin( xx1, xx2 ) ) { - const int y2 = yMap.transform(iData.value(i)); - if ( y2 == y0 ) - continue; - - int x1 = xMap.transform(iData.interval(i).minValue()); - int x2 = xMap.transform(iData.interval(i).maxValue()); - if ( x1 > x2 ) - qSwap(x1, x2); - - if ( i < (int)iData.size() - 2 ) - { - const int xx1 = xMap.transform(iData.interval(i+1).minValue()); - const int xx2 = xMap.transform(iData.interval(i+1).maxValue()); - - if ( x2 == qwtMin(xx1, xx2) ) - { - const int yy2 = yMap.transform(iData.value(i+1)); - if ( yy2 != y0 && ( (yy2 < y0 && y2 < y0) || - (yy2 > y0 && y2 > y0) ) ) - { - // One pixel distance between neighboured bars - x2--; - } - } - } - drawBar(painter, Qt::Vertical, - QRect(x1, y0, x2 - x1, y2 - y0) ); + const int yy2 = yMap.transform( iData.value( i + 1 ) ); + if ( yy2 != y0 && (( yy2 < y0 && y2 < y0 ) || + ( yy2 > y0 && y2 > y0 ) ) ) + { + // One pixel distance between neighboured bars + x2--; + } } + } + drawBar( painter, Qt::Vertical, + QRect( x1, y0, x2 - x1, y2 - y0 ) ); } + } } -void HistogramItem::drawBar(QPainter *painter, - Qt::Orientation, const QRect& rect) const +void HistogramItem::drawBar( QPainter *painter, + Qt::Orientation, const QRect& rect ) const { - painter->save(); + painter->save(); - const QColor color(painter->pen().color()); + const QColor color( painter->pen().color() ); #if QT_VERSION >= 0x040000 - const QRect r = rect.normalized(); + const QRect r = rect.normalized(); #else - const QRect r = rect.normalize(); + const QRect r = rect.normalize(); #endif - const int factor = 125; - const QColor light(color.light(factor)); - const QColor dark(color.dark(factor)); + const int factor = 125; + const QColor light( color.light( factor ) ); + const QColor dark( color.dark( factor ) ); - painter->setBrush(color); - painter->setPen(Qt::NoPen); - QwtPainter::drawRect(painter, r.x() + 1, r.y() + 1, - r.width() - 2, r.height() - 2); - painter->setBrush(Qt::NoBrush); + painter->setBrush( color ); + painter->setPen( Qt::NoPen ); + QwtPainter::drawRect( painter, r.x() + 1, r.y() + 1, + r.width() - 2, r.height() - 2 ); + painter->setBrush( Qt::NoBrush ); - painter->setPen(QPen(light, 2)); + painter->setPen( QPen( light, 2 ) ); #if QT_VERSION >= 0x040000 - QwtPainter::drawLine(painter, - r.left() + 1, r.top() + 2, r.right() + 1, r.top() + 2); + QwtPainter::drawLine( painter, + r.left() + 1, r.top() + 2, r.right() + 1, r.top() + 2 ); #else - QwtPainter::drawLine(painter, - r.left(), r.top() + 2, r.right() + 1, r.top() + 2); + QwtPainter::drawLine( painter, + r.left(), r.top() + 2, r.right() + 1, r.top() + 2 ); #endif - painter->setPen(QPen(dark, 2)); + painter->setPen( QPen( dark, 2 ) ); #if QT_VERSION >= 0x040000 - QwtPainter::drawLine(painter, - r.left() + 1, r.bottom(), r.right() + 1, r.bottom()); + QwtPainter::drawLine( painter, + r.left() + 1, r.bottom(), r.right() + 1, r.bottom() ); #else - QwtPainter::drawLine(painter, - r.left(), r.bottom(), r.right() + 1, r.bottom()); + QwtPainter::drawLine( painter, + r.left(), r.bottom(), r.right() + 1, r.bottom() ); #endif - painter->setPen(QPen(light, 1)); + painter->setPen( QPen( light, 1 ) ); #if QT_VERSION >= 0x040000 - QwtPainter::drawLine(painter, - r.left(), r.top() + 1, r.left(), r.bottom()); - QwtPainter::drawLine(painter, - r.left() + 1, r.top() + 2, r.left() + 1, r.bottom() - 1); + QwtPainter::drawLine( painter, + r.left(), r.top() + 1, r.left(), r.bottom() ); + QwtPainter::drawLine( painter, + r.left() + 1, r.top() + 2, r.left() + 1, r.bottom() - 1 ); #else - QwtPainter::drawLine(painter, - r.left(), r.top() + 1, r.left(), r.bottom() + 1); - QwtPainter::drawLine(painter, - r.left() + 1, r.top() + 2, r.left() + 1, r.bottom()); + QwtPainter::drawLine( painter, + r.left(), r.top() + 1, r.left(), r.bottom() + 1 ); + QwtPainter::drawLine( painter, + r.left() + 1, r.top() + 2, r.left() + 1, r.bottom() ); #endif - painter->setPen(QPen(dark, 1)); + painter->setPen( QPen( dark, 1 ) ); #if QT_VERSION >= 0x040000 - QwtPainter::drawLine(painter, - r.right() + 1, r.top() + 1, r.right() + 1, r.bottom()); - QwtPainter::drawLine(painter, - r.right(), r.top() + 2, r.right(), r.bottom() - 1); + QwtPainter::drawLine( painter, + r.right() + 1, r.top() + 1, r.right() + 1, r.bottom() ); + QwtPainter::drawLine( painter, + r.right(), r.top() + 2, r.right(), r.bottom() - 1 ); #else - QwtPainter::drawLine(painter, - r.right() + 1, r.top() + 1, r.right() + 1, r.bottom() + 1); - QwtPainter::drawLine(painter, - r.right(), r.top() + 2, r.right(), r.bottom()); + QwtPainter::drawLine( painter, + r.right() + 1, r.top() + 1, r.right() + 1, r.bottom() + 1 ); + QwtPainter::drawLine( painter, + r.right(), r.top() + 2, r.right(), r.bottom() ); #endif - painter->restore(); + painter->restore(); } //! Update the widget that represents the curve on the legend // this was adapted from QwtPlotCurve::updateLegend() -void HistogramItem::updateLegend(QwtLegend *legend) const +void HistogramItem::updateLegend( QwtLegend *legend ) const { - if ( !legend ) - return; + if ( !legend ) + return; - QwtPlotItem::updateLegend(legend); + QwtPlotItem::updateLegend( legend ); - QWidget *widget = legend->find(this); - if ( !widget || !widget->inherits("QwtLegendItem") ) - return; + QWidget *widget = legend->find( this ); + if ( !widget || !widget->inherits( "QwtLegendItem" ) ) + return; - QwtLegendItem *legendItem = (QwtLegendItem *)widget; + QwtLegendItem *legendItem = ( QwtLegendItem * )widget; #if QT_VERSION < 0x040000 - const bool doUpdate = legendItem->isUpdatesEnabled(); + const bool doUpdate = legendItem->isUpdatesEnabled(); #else - const bool doUpdate = legendItem->updatesEnabled(); + const bool doUpdate = legendItem->updatesEnabled(); #endif - legendItem->setUpdatesEnabled(false); + legendItem->setUpdatesEnabled( false ); - const int policy = legend->displayPolicy(); + const int policy = legend->displayPolicy(); - if (policy == QwtLegend::FixedIdentifier) - { - int mode = legend->identifierMode(); + if ( policy == QwtLegend::FixedIdentifier ) + { + int mode = legend->identifierMode(); - legendItem->setCurvePen(QPen(color())); + legendItem->setCurvePen( QPen( color() ) ); - if (mode & QwtLegendItem::ShowText) - legendItem->setText(title()); - else - legendItem->setText(QwtText()); + if ( mode & QwtLegendItem::ShowText ) + legendItem->setText( title() ); + else + legendItem->setText( QwtText() ); - legendItem->setIdentifierMode(mode); + legendItem->setIdentifierMode( mode ); + } + else if ( policy == QwtLegend::AutoIdentifier ) + { + int mode = 0; + + legendItem->setCurvePen( QPen( color() ) ); + mode |= QwtLegendItem::ShowLine; + if ( !title().isEmpty() ) + { + legendItem->setText( title() ); + mode |= QwtLegendItem::ShowText; } - else if (policy == QwtLegend::AutoIdentifier) + else { - int mode = 0; - - legendItem->setCurvePen(QPen(color())); - mode |= QwtLegendItem::ShowLine; - if ( !title().isEmpty() ) - { - legendItem->setText(title()); - mode |= QwtLegendItem::ShowText; - } - else - { - legendItem->setText(QwtText()); - } - legendItem->setIdentifierMode(mode); + legendItem->setText( QwtText() ); } + legendItem->setIdentifierMode( mode ); + } - legendItem->setUpdatesEnabled(doUpdate); - legendItem->update(); + legendItem->setUpdatesEnabled( doUpdate ); + legendItem->update(); } #endif diff --git a/src/providers/wfs/qgswfscapabilities.cpp b/src/providers/wfs/qgswfscapabilities.cpp index 511f4ee7d8fb..17b550b82d92 100644 --- a/src/providers/wfs/qgswfscapabilities.cpp +++ b/src/providers/wfs/qgswfscapabilities.cpp @@ -138,8 +138,8 @@ QString QgsWFSCapabilities::uriGetFeature( QString typeName, QString crsString, //add authorization information if ( mUri.hasParam( "username" ) && mUri.hasParam( "password" ) ) { - uri += "&username="+mUri.param( "username" ); - uri += "&password="+mUri.param( "password" ); + uri += "&username=" + mUri.param( "username" ); + uri += "&password=" + mUri.param( "password" ); } QgsDebugMsg( uri ); return uri; diff --git a/src/providers/wfs/qgswfsprovider.h b/src/providers/wfs/qgswfsprovider.h index e71dffd7d1ae..f8688992335f 100644 --- a/src/providers/wfs/qgswfsprovider.h +++ b/src/providers/wfs/qgswfsprovider.h @@ -153,7 +153,7 @@ class QgsWFSProvider: public QgsVectorDataProvider private: bool mNetworkRequestFinished; friend class QgsWFSFeatureSource; - + //! http authorization details QgsWFSAuthorization mAuth;