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

@ -206,7 +206,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
settings.setValue("pythonConsole/caretLineColor", self.caretLineColor.color())
settings.setValue("pythonConsole/caretLineColorEditor", self.caretLineColorEditor.color())
settings.setValue("pythonConsole/stderrFontColor", self.stderrFontColor.color())
settings.setValue("pythonConsole/singleQuoteFontColor", self.singleQuoteFontColor.color())
settings.setValue("pythonConsole/singleQuoteFontColorEditor", self.singleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/doubleQuoteFontColor", self.doubleQuoteFontColor.color())
@ -215,7 +215,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
settings.setValue("pythonConsole/tripleSingleQuoteFontColorEditor", self.tripleSingleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColor", self.tripleDoubleQuoteFontColor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColorEditor", self.tripleDoubleQuoteFontColorEditor.color())
def restoreSettings(self):
settings = QSettings()
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
@ -285,7 +285,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(Qt.black))))
self.cursorColorEditor.setColor(QColor(settings.value("pythonConsole/cursorColorEditor", QColor(Qt.black))))
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(Qt.red))))
self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue)))
self.singleQuoteFontColorEditor.setColor(settings.value("pythonConsole/singleQuoteFontColorEditor", QColor(Qt.blue)))
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue)))
@ -311,7 +311,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
self.doubleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleSingleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleDoubleQuoteFontColor.setColor(QColor(Qt.blue))
def _resetFontColorEditor(self):
self.defaultFontColorEditor.setColor(QColor(Qt.black))

View File

@ -121,8 +121,8 @@ class SaveSelectedFeatures(GeoAlgorithm):
# toolbox. The self.crs variable has to be changed in case this
# is not true, or in case there are no input layer from which
# the output crs can be infered
provider = vectorLayer.dataProvider()
writer = output.getVectorWriter(provider.fields(),
@ -131,12 +131,12 @@ class SaveSelectedFeatures(GeoAlgorithm):
# Now we take the selected features and add them to the output
# layer
features = vector.features(vectorLayer)
total = len(features)
total = len(features)
for (i, feat) in enumerate(features):
writer.addFeature(feat)
# We use the progress object to communicate with the user
progress.setPercentage(100 * i / float(total))
progress.setPercentage(100 * i / float(total))
del writer
# There is nothing more to do here. We do not have to open the

View File

@ -36,10 +36,10 @@ from processing.tools import dataobjects, vector
class ExtractByLocation(GeoAlgorithm):
INPUT = 'INPUT'
INTERSECT = 'INTERSECT'
INTERSECT = 'INTERSECT'
OUTPUT = 'OUTPUT'
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by location'
self.group = 'Vector selection tools'
self.addParameter(ParameterVector(self.INPUT, 'Layer to select from',
@ -55,7 +55,7 @@ class ExtractByLocation(GeoAlgorithm):
filename = self.getParameterValue(self.INTERSECT)
selectLayer = dataobjects.getObjectFromUri(filename)
index = vector.spatialindex(layer)
geom = QgsGeometry()
selectedSet = []
current = 0
@ -70,15 +70,15 @@ class ExtractByLocation(GeoAlgorithm):
feat = layer.getFeatures(request).next()
tmpGeom = QgsGeometry(feat.geometry())
if geom.intersects(tmpGeom):
selectedSet.append(feat.id())
selectedSet.append(feat.id())
progress.setPercentage(int(current * total))
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
for (i, feat) in enumerate(features):
if feat.id() in selectedSet:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer

View File

@ -49,7 +49,7 @@ class RandomExtract(GeoAlgorithm):
METHODS = ['Number of selected features',
'Percentage of selected features']
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract'
self.group = 'Vector selection tools'
@ -69,7 +69,7 @@ class RandomExtract(GeoAlgorithm):
features = vector.features(layer)
featureCount = len(features)
value = int(self.getParameterValue(self.NUMBER))
value = int(self.getParameterValue(self.NUMBER))
if method == 0:
if value > featureCount:
@ -85,12 +85,12 @@ class RandomExtract(GeoAlgorithm):
selran = random.sample(xrange(0, featureCount), value)
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer

View File

@ -50,7 +50,7 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
METHODS = ['Number of selected features',
'Percentage of selected features']
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract within subsets'
self.group = 'Vector selection tools'
@ -72,12 +72,12 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
layer = dataobjects.getObjectFromUri(filename)
field = self.getParameterValue(self.FIELD)
method = self.getParameterValue(self.METHOD)
index = layer.fieldNameIndex(field)
features = vector.features(layer)
featureCount = len(features)
unique = vector.getUniqueValues(layer, index)
unique = vector.getUniqueValues(layer, index)
value = int(self.getParameterValue(self.NUMBER))
if method == 0:
if value > featureCount:
@ -92,11 +92,11 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
value = value / 100.0
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
selran = []
selran = []
current = 0
total = 100.0 / float(featureCount * len(unique))
features = vector.features(layer)
@ -129,6 +129,6 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
features = vector.features(layer)
for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer

View File

@ -67,7 +67,7 @@ class SelectByLocation(GeoAlgorithm):
oldSelection = set(inputLayer.selectedFeaturesIds())
index = vector.spatialindex(inputLayer)
geom = QgsGeometry()
selectedSet = []
current = 0

View File

@ -1098,7 +1098,7 @@ class mmqgisx_select_algorithm(GeoAlgorithm):
layer.setSelectedFeatures(selected)
self.setOutputValue(self.RESULT, filename)
class mmqgisx_extract_algorithm(GeoAlgorithm):
LAYERNAME = 'LAYERNAME'
@ -1107,7 +1107,7 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
COMPARISON = 'COMPARISON'
RESULT = 'RESULT'
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by attribute'
self.group = 'Vector selection tools'
@ -1142,19 +1142,19 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
comparisonvalue = self.getParameterValue(self.COMPARISONVALUE)
selected = select(layer, attribute, comparison, comparisonvalue, progress)
features = vector.features(layer)
featureCount = len(features)
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
for (i, feat) in enumerate(features):
if feat.id() in selected:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
def select(layer, attribute, comparison, comparisonvalue, progress):
def select(layer, attribute, comparison, comparisonvalue, progress):
selectindex = layer.dataProvider().fieldNameIndex(attribute)
selectType = layer.dataProvider().fields()[selectindex].type()
selectionError = False
@ -1263,7 +1263,7 @@ def select(layer, attribute, comparison, comparisonvalue, progress):
selected.append(feature.id())
progress.setPercentage(float(readcount) / totalcount * 100)
return selected
class mmqgisx_text_to_float_algorithm(GeoAlgorithm):

View File

@ -71,8 +71,8 @@ class GeoAlgorithm:
# appear in the toolbox or modeler
self.showInToolbox = True
self.showInModeler = True
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#or batch ptocessing interface
self.allowOnlyOpenedLayers = False

View File

@ -30,7 +30,7 @@ class SilentProgress:
def error(self, msg):
print msg
def setText(self, text):
pass

View File

@ -64,7 +64,7 @@ class gdaladdo(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-overview.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalogr:overviews"

View File

@ -44,7 +44,7 @@ class information(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-info.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalorg:rasterinfo"

View File

@ -110,10 +110,10 @@ class Ogr2Ogr(OgrAlgorithm):
''))
self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer'))
def commandLineName(self):
return "gdalogr:ogr2ogr"
def processAlgorithm(self, progress):
if not gdalAvailable:

View File

@ -56,9 +56,9 @@ class OgrInfo(OgrAlgorithm):
[ParameterVector.VECTOR_TYPE_ANY], False))
self.addOutput(OutputHTML(self.OUTPUT, 'Layer information'))
def commandLineName(self):
return "gdalogr:vectorinfo"
return "gdalogr:vectorinfo"
def processAlgorithm(self, progress):

View File

@ -44,7 +44,7 @@ class polygonize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/polygonize.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalogr:polygonize"

View File

@ -52,7 +52,7 @@ class proximity(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/proximity.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalogr:proximity"

View File

@ -50,7 +50,7 @@ class rasterize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/rasterize.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalogr:rasterize"

View File

@ -57,7 +57,7 @@ class translate(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/translate.png'
return QtGui.QIcon(filepath)
def commandLineName(self):
return "gdalogr:translate"

View File

@ -382,7 +382,7 @@ class GrassAlgorithm(GeoAlgorithm):
else:
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='
if self.grassName == 'r.horizon':
command += out.name + uniqueSufix + '_0'
else:

View File

@ -126,9 +126,9 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
self.buttonBox.rejected.connect(self.close)
self.buttonBox.button(
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)
self.showDebug = ProcessingConfig.getSetting(
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
def setParamValues(self):
params = self.alg.parameters

View File

@ -139,7 +139,7 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
def getDescription(self, name):
if name in self.descriptions:
return self.descriptions[name].replace('\n', '<br>')
return self.descriptions[name].replace('\n', '<br>')
else:
return ''

View File

@ -45,10 +45,10 @@ class MessageBarProgress:
def error(self, msg):
interface.iface.messageBar().clearWidgets()
interface.iface.messageBar().pushMessage("Error", msg,
interface.iface.messageBar().pushMessage("Error", msg,
level = QgsMessageBar.CRITICAL,
duration = 3)
def setText(self, text):
pass

View File

@ -16,7 +16,7 @@
* *
***************************************************************************
"""
__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@ -120,7 +120,7 @@ class ModelerAlgorithm(GeoAlgorithm):
self.algParameters = []
self.algOutputs = []
self.paramValues = {}
self.dependencies = []
self.dependencies = []
self.descriptionFile = filename
lines = codecs.open(filename, 'r', encoding='utf-8')
line = lines.readline().strip('\n').strip('\r')

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,11 +645,12 @@ void QgsLegend::updateGroupCheckStates( QTreeWidgetItem *item )
void QgsLegend::mouseReleaseEvent( QMouseEvent * e )
{
if (mGetLegendGraphicPopup) {
if ( mGetLegendGraphicPopup )
{
delete mGetLegendGraphicPopup;
mGetLegendGraphicPopup = 0;
}
QStringList layersPriorToEvent = layerIDs();
QTreeWidget::mouseReleaseEvent( e );
mMousePressedFlag = false;
@ -3243,7 +3244,7 @@ QImage QgsLegend::getWmsLegendPixmap( QTreeWidgetItem *item )
}
QTreeWidgetItem *parent = item->parent();
if ( !parent )
if ( !parent )
{
return QImage();
}
@ -3270,7 +3271,7 @@ QImage QgsLegend::getWmsLegendPixmap( QTreeWidgetItem *item )
{
return QImage();
}
return rasterLayer->dataProvider()->getLegendGraphic( canvas()->scale() );
}

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

@ -209,8 +209,8 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
itemList.reserve( rasterItemList.size() );
#endif
// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
// is not supported by server
// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
// 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

@ -43,7 +43,7 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
}

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

@ -233,29 +233,29 @@ int QgsLegendModel::addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer*
if ( rasterLayer->providerType() == "wms" )
{
QgsComposerRasterSymbolItem* currentSymbolItem = new QgsComposerRasterSymbolItem( "" );
// GetLegendGraphics in case of WMS service... image can return null if GetLegendGraphics
// is not supported by server
// GetLegendGraphics in case of WMS service... image can return null if GetLegendGraphics
// 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

@ -184,7 +184,7 @@ namespace pal
return false;
}
bool LabelPosition::isIntersect( double *bbox )
{
int i;
@ -201,13 +201,13 @@ namespace pal
else
return false;
}
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] ) )
y[i] >= bbox[1] && y[i] <= bbox[3] ) )
return false;
}

View File

@ -121,7 +121,7 @@ namespace pal
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
*/
bool isIntersect( double *bbox );
/**
* \brief Is the labelposition inside the bounding-box ?
*

View File

@ -106,9 +106,9 @@ namespace pal
point_p = 8;
line_p = 8;
poly_p = 8;
showPartial = true;
this->map_unit = pal::METER;
std::cout.precision( 12 );
@ -901,8 +901,8 @@ namespace pal
if ( dpi > 0 )
this->dpi = dpi;
}
void Pal::setShowPartial(bool show)
void Pal::setShowPartial( bool show )
{
this->showPartial = show;
}
@ -936,7 +936,7 @@ namespace pal
{
return dpi;
}
bool Pal::getShowPartial()
{
return showPartial;

View File

@ -166,7 +166,7 @@ namespace pal
int ejChainDeg;
int tenure;
double candListSize;
/**
* \brief show partial labels (cut-off by the map canvas) or not
*/
@ -357,14 +357,14 @@ namespace pal
* @return map resolution (dot per inch)
*/
int getDpi();
/**
*\brief Set flag show partial label
*
* @param show flag value
*/
void setShowPartial(bool show);
*/
void setShowPartial( bool show );
/**
* \brief Get flag show partial label
*

View File

@ -4816,7 +4816,7 @@ void QgsPalLabeling::loadEngineSettings()
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
"PAL", "/ShowingAllLabels", false, &saved );
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
mSavedWithProject = saved;
}
@ -4852,6 +4852,6 @@ QgsLabelingEngineInterface* QgsPalLabeling::clone()
lbl->mShowingAllLabels = mShowingAllLabels;
lbl->mShowingCandidates = mShowingCandidates;
lbl->mShowingShadowRects = mShowingShadowRects;
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
return lbl;
}

View File

@ -687,7 +687,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
// implemented methods from labeling engine interface
//! called when we're going to start with rendering

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

@ -431,7 +431,7 @@ void QgsComposerView::endMarqueeSelect( QMouseEvent* e )
}
QRectF boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
//determine item selection mode, default to intersection
Qt::ItemSelectionMode selectionMode = Qt::IntersectsItemShape;

View File

@ -3661,7 +3661,7 @@ void QgsProjectParser::loadLabelSettings( QgsLabelingEngineInterface* lbl )
{
pal->setShowingAllLabels( showAllLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 );
}
//mShowingPartialsLabels
QDomElement showPartialsLabelsElem = palElem.firstChildElement( "ShowingPartialsLabels" );
if ( !showPartialsLabelsElem.isNull() )

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();
@ -4611,7 +4611,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
forceRefresh = true;
QgsDebugMsg( QString( "Download again due to scale change from: %1 to: %2" ).arg( mGetLegendGraphicScale ).arg( scale ) );
}
if ( forceRefresh )
{
if ( scale )
@ -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 )
{
if ( url.queryItemValue( "map_resolution" ) != "" )
{
setQueryItem( url, "map_resolution", QString::number(defaultLegendGraphicResolution) );
setQueryItem( url, "map_resolution", QString::number( defaultLegendGraphicResolution ) );
}
else if (url.queryItemValue("dpi") != "")
else if ( url.queryItemValue( "dpi" ) != "" )
{
setQueryItem( url, "dpi", QString::number(defaultLegendGraphicResolution) );
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"));
else
{
QgsLogger::warning( tr( "getLegendGraphic: Can not determine resolution uri parameter [map_resolution | dpi]. No resolution parameter will be used" ) );
}
}
@ -4709,7 +4714,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
QgsDebugMsg( "exiting." );
return mGetLegendGraphicImage;
return mGetLegendGraphicImage;
}
void QgsWmsProvider::getLegendGraphicReplyFinished()
@ -4761,7 +4766,7 @@ void QgsWmsProvider::getLegendGraphicReplyFinished()
if ( myLocalImage.isNull() )
{
QgsMessageLog::logMessage( tr( "Returned legend image is flawed [URL: %2]" )
.arg( mGetLegendGraphicReply->url().toString() ), tr( "WMS" ) );
.arg( mGetLegendGraphicReply->url().toString() ), tr( "WMS" ) );
}
else
{
@ -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

@ -650,15 +650,15 @@ 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
* \brief Get GetLegendGraphic if service available otherwise QImage()
* 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
* \param forceRefresh Optional bool parameter to force refresh getLegendGraphic call
* \param forceRefresh Optional bool parameter to force refresh getLegendGraphic call
*/
QImage getLegendGraphic( double scale = 0, bool forceRefresh = false );

View File

@ -31,15 +31,15 @@
class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
TestSignalReceiver() : QObject( 0 ), blendMode( QPainter::CompositionMode_SourceOver ) {}
QPainter::CompositionMode blendMode;
public slots:
void onBlendModeChanged( const QPainter::CompositionMode blendMode )
{
this->blendMode = blendMode;
}
public:
TestSignalReceiver() : QObject( 0 ), blendMode( QPainter::CompositionMode_SourceOver ) {}
QPainter::CompositionMode blendMode;
public slots:
void onBlendModeChanged( const QPainter::CompositionMode blendMode )
{
this->blendMode = blendMode;
}
};
/** \ingroup UnitTests
@ -55,7 +55,7 @@ class TestQgsMapLayer: public QObject
void cleanup() {};// will be called after every testfunction.
void isValid();
void setBlendMode();
private:
QgsMapLayer * mpLayer;
@ -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

@ -89,17 +89,17 @@ class TestQgsRasterLayer: public QObject
class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false )
{}
bool rendererChanged;
public slots:
void onRendererChanged()
{
rendererChanged = true;
}
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false )
{}
bool rendererChanged;
public slots:
void onRendererChanged()
{
rendererChanged = true;
}
};
//runs before all tests
@ -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

@ -39,29 +39,29 @@
class TestSignalReceiver : public QObject
{
Q_OBJECT;
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false ),
featureBlendMode( QPainter::CompositionMode(0) ),
transparency( 0 )
{}
bool rendererChanged;
QPainter::CompositionMode featureBlendMode;
int transparency;
public slots:
void onRendererChanged()
{
rendererChanged = true;
}
void onFeatureBlendModeChanged( const QPainter::CompositionMode blendMode )
{
featureBlendMode = blendMode;
}
void onLayerTransparencyChanged( int layerTransparency )
{
transparency = layerTransparency;
}
public:
TestSignalReceiver() : QObject( 0 ),
rendererChanged( false ),
featureBlendMode( QPainter::CompositionMode( 0 ) ),
transparency( 0 )
{}
bool rendererChanged;
QPainter::CompositionMode featureBlendMode;
int transparency;
public slots:
void onRendererChanged()
{
rendererChanged = true;
}
void onFeatureBlendModeChanged( const QPainter::CompositionMode blendMode )
{
featureBlendMode = blendMode;
}
void onLayerTransparencyChanged( int layerTransparency )
{
transparency = layerTransparency;
}
};
/** \ingroup UnitTests
@ -676,21 +676,21 @@ class TestQgsVectorLayer: public QObject
};
void QgsVectorLayersetFeatureBlendMode()
{
void QgsVectorLayersetFeatureBlendMode()
{
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
TestSignalReceiver receiver;
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 );
}
}
void QgsVectorLayersetLayerTransparency()
{
void QgsVectorLayersetLayerTransparency()
{
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
TestSignalReceiver receiver;
QObject::connect( vLayer, SIGNAL( layerTransparencyChanged( int ) ),
@ -700,7 +700,7 @@ class TestQgsVectorLayer: public QObject
vLayer->setLayerTransparency( 50 );
QCOMPARE( receiver.transparency, 50 );
QCOMPARE( vLayer->layerTransparency(), 50 );
}
}
};
QTEST_MAIN( TestQgsVectorLayer )

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.

View File

@ -299,24 +299,24 @@ class TestPALConfig(TestQgsPalLabeling):
msg = '\nLayer settings read not same as settings written'
self.assertDictEqual(lyr1dict, lyr2dict, msg)
def test_default_partials_labels_enabled(self):
# Verify ShowingPartialsLabels is enabled for PAL by default
pal = QgsPalLabeling()
self.assertTrue(pal.isShowingPartialsLabels())
def test_partials_labels_activate(self):
pal = QgsPalLabeling()
# Enable partials labels
pal.setShowingPartialsLabels(True)
self.assertTrue(pal.isShowingPartialsLabels())
def test_partials_labels_deactivate(self):
pal = QgsPalLabeling()
# Disable partials labels
pal.setShowingPartialsLabels(False)
self.assertFalse(pal.isShowingPartialsLabels())
def runSuite(module, tests):

View File

@ -51,7 +51,7 @@ class TestPointBase(object):
# Label color change
self.lyr.textColor = Qt.blue
self.checkTest()
def test_partials_labels_enabled(self):
# Set Big font size
font = QFont(self._TestFont)