9 changes: 4 additions & 5 deletions python/plugins/processing/gui/MessageBarProgress.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
from PyQt4 import QtGui

class MessageBarProgress():

def __init__(self):
self.progressMessageBar = interface.iface.messageBar().createMessage("Executing algorithm")
self.progress = QtGui.QProgressBar()
self.progress.setMaximum(100)
self.progress.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
self.progressMessageBar.layout().addWidget(self.progress)
interface.iface.messageBar().pushWidget(self.progressMessageBar, interface.iface.messageBar().INFO)
self.progressMessageBar.layout().addWidget(self.progress)
interface.iface.messageBar().pushWidget(self.progressMessageBar, interface.iface.messageBar().INFO)

def setText(self, text):
pass
Expand All @@ -55,8 +55,7 @@ def setDebugInfo(self, _):

def setConsoleInfo(self, _):
pass

def close(self):
interface.iface.messageBar().clearWidgets()


2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ParametersDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ParametersDialog(AlgorithmExecutionDialog):
'''the default parameters dialog, to be used when an algorithm is called from the toolbox'''
def __init__(self, alg):
self.paramTable = ParametersPanel(self, alg)
self.scrollArea = QtGui.QScrollArea()
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setWidget(self.paramTable)
self.scrollArea.setWidgetResizable(True)
AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/UnthreadedAlgorithmExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.tools import dataobjects
from processing.tools.system import *
from processing.tools import vector
from processing.tools import vector
from processing.core.ProcessingLog import ProcessingLog
from processing.gui.Postprocessing import Postprocessing
from processing.core.SilentProgress import SilentProgress
Expand All @@ -45,12 +45,12 @@ def runalg(alg, progress):
alg.execute(progress)
return True
except GeoAlgorithmExecutionException, e :
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
QMessageBox.critical(None, "Error", e.msg)
return False
except Exception:
msg = "Error executing " + str(alg.name) + "\nSee log for more information"
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
QMessageBox.critical(None, "Uncaught error", msg)
return False

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/modeler/ModelerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def prepareAlgorithm(self, alg, iAlg):
value = self.getValueFromAlgorithmAndParameter(aap)
layerslist.append(str(value))
value = ";".join(layerslist)

#if not param.setValue(value):
#raise GeoAlgorithmExecutionException("Wrong value: " + str(value))

Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,22 @@ def processAlgorithm(self, progress):
formatIndex = 1 if saga208 else 4
sessionExportedLayers[filename] = filename2
dontExport = True

#Do not export is the output is not a final output of the model
if self.model is not None and optim:
for subalg in self.model.algOutputs:
if out.name in subalg:
if subalg[out.name] is not None:
dontExport = False
break
break
if dontExport:
continue
continue

if isWindows() or isMac() or not saga208:
commands.append("io_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT " + str(formatIndex) +" -TYPE 0 -FILE \"" + filename + "\"");
else:
commands.append("libio_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT 1 -TYPE 0 -FILE \"" + filename + "\"");



#4 Run SAGA
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/saga/SagaUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SagaUtils:
SAGA_RESAMPLING_REGION_CELLSIZE = "SAGA_RESAMPLING_REGION_CELLSIZE"
SAGA_FOLDER = "SAGA_FOLDER"
SAGA_IMPORT_EXPORT_OPTIMIZATION = "SAGA_IMPORT_EXPORT_OPTIMIZATION"


@staticmethod
def sagaBatchJobFilename():
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tests/ProcessingToolsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
table, polygonsGeoJson, raster
from processing.core import Processing
from processing.tools.vector import values
from processing.tools.dataobjects import *
from processing.tools.dataobjects import *

class ProcessingToolsTest(unittest.TestCase):
'''tests the method imported when doing an "import processing", and also in processing.tools.
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/dataobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def getObjectFromUri(uri, forceLoad = True):
'''returns an object (layer/table) given a file location.
if forceLoad is true, it tries to load it if it is not currently open
Otherwise, it will return the object only if it is loaded in QGIS'''

if uri is None:
return None
layers = getRasterLayers()
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/tools/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def __init__(self, layer):
if len(self.selected) > 0:
self.selection = True
self.idx = 0;

def __iter__(self):
return self

def next(self):
if self.selection:
if self.idx < len(self.selected):
Expand All @@ -65,13 +65,13 @@ def next(self):
else:
self.iter.close()
raise StopIteration()

def __len__(self):
if self.selection:
return int(self.layer.selectedFeatureCount())
else:
return int(self.layer.featureCount())

return Features(layer)

def uniqueValues(layer, attribute):
Expand Down
2 changes: 1 addition & 1 deletion python/pyspatialite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ IF (APPLE)
ENDIF (APPLE)

SET_TARGET_PROPERTIES(pyspatialite PROPERTIES PREFIX "" OUTPUT_NAME _spatialite)

IF (WIN32)
SET_TARGET_PROPERTIES(pyspatialite PROPERTIES SUFFIX ".pyd")
ENDIF (WIN32)
Expand Down
8 changes: 4 additions & 4 deletions src/app/pluginmanager/qgspluginitemdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
checkBoxStyle.rect = option.rect;
if ( index.data( Qt::CheckStateRole ).toBool() )
{
checkBoxStyle.state = QStyle::State_On|QStyle::State_Enabled;
checkBoxStyle.state = QStyle::State_On | QStyle::State_Enabled;
}
else
{
checkBoxStyle.state = QStyle::State_Off|QStyle::State_Enabled;
checkBoxStyle.state = QStyle::State_Off | QStyle::State_Enabled;
}
style->drawControl( QStyle::CE_CheckBox, &checkBoxStyle, painter );
}
Expand Down Expand Up @@ -85,8 +85,8 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
}

if ( ! index.data( PLUGIN_ERROR_ROLE ).toString().isEmpty()
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "upgradeable" )
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "new" ) )
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "upgradeable" )
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "new" ) )
{
QFont font = painter->font();
font.setBold( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/pluginmanager/qgspluginitemdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class QgsPluginItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
Q_OBJECT
public:
QgsPluginItemDelegate( QObject * parent = 0 );
QSize sizeHint( const QStyleOptionViewItem & theOption, const QModelIndex & theIndex ) const;
Expand Down
6 changes: 3 additions & 3 deletions src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ bool QgsPluginSortFilterProxyModel::filterByPhrase( QModelIndex &index ) const
case 0:
// full search: name + description + tags + author
return sourceModel()->data( index, PLUGIN_DESCRIPTION_ROLE ).toString().contains( filterRegExp() )
|| sourceModel()->data( index, PLUGIN_AUTHOR_ROLE ).toString().contains( filterRegExp() )
|| sourceModel()->data( index, Qt::DisplayRole ).toString().contains( filterRegExp() )
|| sourceModel()->data( index, PLUGIN_TAGS_ROLE ).toString().contains( filterRegExp() );
|| sourceModel()->data( index, PLUGIN_AUTHOR_ROLE ).toString().contains( filterRegExp() )
|| sourceModel()->data( index, Qt::DisplayRole ).toString().contains( filterRegExp() )
|| sourceModel()->data( index, PLUGIN_TAGS_ROLE ).toString().contains( filterRegExp() );
break;
default:
// unknown filter mode, return nothing
Expand Down
36 changes: 18 additions & 18 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionRotateFeature->setIcon( QgsApplication::getThemeIcon( "/mActionRotateFeature.png" ) );
mActionReshapeFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionReshape.png" ) );
mActionSplitFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionSplitFeatures.svg" ) );
mActionSplitParts->setIcon( QgsApplication::getThemeIcon( "/mActionSplitParts.svg" ) );
mActionSplitParts->setIcon( QgsApplication::getThemeIcon( "/mActionSplitParts.svg" ) );
mActionDeleteSelected->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) );
mActionNodeTool->setIcon( QgsApplication::getThemeIcon( "/mActionNodeTool.png" ) );
mActionSimplifyFeature->setIcon( QgsApplication::getThemeIcon( "/mActionSimplify.png" ) );
Expand Down Expand Up @@ -8873,27 +8873,27 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
///////////////////////////////////////////////////////////////////

#ifdef ANDROID
void QgisApp::keyReleaseEvent(QKeyEvent *event)
void QgisApp::keyReleaseEvent( QKeyEvent *event )
{
static bool accepted=true;
if (event->key()==Qt::Key_Close)
static bool accepted = true;
if ( event->key() == Qt::Key_Close )
{
// do something useful here
int ret = QMessageBox::question( this, tr( "Exit QGIS" ),
tr( "Do you really want to quit QGIS?" ),
QMessageBox::Yes | QMessageBox::No );
switch ( ret )
{
// do something useful here
int ret = QMessageBox::question(this, tr("Exit QGIS"),
tr("Do you really want to quit QGIS?"),
QMessageBox::Yes | QMessageBox::No);
switch(ret)
{
case QMessageBox::Yes:
this->close();
break;
case QMessageBox::Yes:
this->close();
break;

case QMessageBox::No:
break;
}
event->setAccepted(accepted); // dont't close my Top Level Widget !
accepted=false;// close the app next time when the user press back button
case QMessageBox::No:
break;
}
event->setAccepted( accepted ); // dont't close my Top Level Widget !
accepted = false;// close the app next time when the user press back button
}
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerlegenditem.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class CORE_EXPORT QgsComposerLayerItem : public QgsComposerLegendItem
void setShowFeatureCount( bool show ) { mShowFeatureCount = show; }
bool showFeatureCount() const { return mShowFeatureCount; }

void setDefaultStyle( double scaleDenominator=-1 );
void setDefaultStyle( double scaleDenominator = -1 );

private:
QString mLayerID;
Expand Down
1 change: 1 addition & 0 deletions src/core/composer/qgscomposershape.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class CORE_EXPORT QgsComposerShape: public QgsComposerItem

/**Sets radius for rounded rectangle corners. Added in v2.1 */
void setCornerRadius( double radius );
/**Returns the radius for rounded rectangle corners*/
double cornerRadius() const { return mCornerRadius; };

public slots:
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgslegendmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel

/**Sets layer set and groups*/
void setLayerSetAndGroups( const QStringList& layerIds, const QList< GroupLayerInfo >& groupInfo );
void setLayerSet( const QStringList& layerIds, double scaleDenominator=-1 );
void setLayerSet( const QStringList& layerIds, double scaleDenominator = -1 );
/**Adds a group
@param text name of group (defaults to translation of "Group")
@param position insertion position (toplevel position (or -1 if it should be placed at the end of the legend).
Expand Down Expand Up @@ -97,14 +97,14 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel

public slots:
void removeLayer( const QString& layerId );
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator=-1 );
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1 );

signals:
void layersChanged();

private:
/**Adds classification items of vector layers using new symbology*/
int addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLayer* vlayer, double scaleDenominator=-1 );
int addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLayer* vlayer, double scaleDenominator = -1 );

/**Adds item of raster layer
@return 0 in case of success*/
Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ void QgsApplication::init( QString customConfigPath )
#if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32)
setPrefixPath( applicationDirPath(), true );
#elif defined(ANDROID)
// this is "/data/data/org.qgis.qgis" in android
QDir myDir( QDir::homePath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
// this is "/data/data/org.qgis.qgis" in android
QDir myDir( QDir::homePath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
#else
QDir myDir( applicationDirPath() );
myDir.cdUp();
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ class CORE_EXPORT QgsApplication: public QApplication

#ifdef ANDROID
//dummy method to workaround sip generation issue issue
bool x11EventFilter ( XEvent * event ){
return 0;
bool x11EventFilter( XEvent * event )
{
return 0;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3055,7 +3055,7 @@ int QgsGeometry::addPart( GEOSGeometry * newPart )
}

int nPartGeoms = GEOSGetNumGeometries( newPart );
for( int i = 0; i < nPartGeoms; ++i )
for ( int i = 0; i < nPartGeoms; ++i )
{
parts << GEOSGeom_clone( GEOSGetGeometryN( newPart, i ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ int QgsVectorLayerEditUtils::splitParts( const QList<QgsPoint>& splitLine, bool
qDeleteAll( newGeometries );
}

if ( numberOfSplittedParts == 0 && selectedIds.size() > 0 && returnCode == 0)
if ( numberOfSplittedParts == 0 && selectedIds.size() > 0 && returnCode == 0 )
{
//There is a selection but no feature has been split.
//Maybe user forgot that only the selected features are split
Expand Down
12 changes: 6 additions & 6 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::symbolForFeature( QgsFeature& featu
QVariant value;
if ( mAttrNum < 0 || mAttrNum >= attrs.count() )
{
value = mExpression->evaluate( &feature );
value = mExpression->evaluate( &feature );
}
else
{
value = attrs[mAttrNum];
value = attrs[mAttrNum];
}

// find the right symbol for the category
Expand Down Expand Up @@ -367,8 +367,8 @@ void QgsCategorizedSymbolRendererV2::startRender( QgsRenderContext& context, con
mAttrNum = vlayer ? vlayer->fieldNameIndex( mAttrName ) : -1;
if ( mAttrNum == -1 )
{
mExpression = new QgsExpression( mAttrName );
mExpression->prepare( vlayer->pendingFields() );
mExpression = new QgsExpression( mAttrName );
mExpression->prepare( vlayer->pendingFields() );
}

mRotationFieldIdx = ( mRotationField.isEmpty() ? -1 : vlayer->fieldNameIndex( mRotationField ) );
Expand Down Expand Up @@ -411,9 +411,9 @@ QList<QString> QgsCategorizedSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;
QgsExpression exp( mAttrName );
foreach (QString attr, exp.referencedColumns() )
foreach ( QString attr, exp.referencedColumns() )
{
attributes << attr;
attributes << attr;
}
if ( !mRotationField.isEmpty() )
{
Expand Down
38 changes: 19 additions & 19 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature
QVariant value;
if ( mAttrNum < 0 || mAttrNum >= attrs.count() )
{
value = mExpression->evaluate( &feature );
value = mExpression->evaluate( &feature );
}
else
{
value = attrs[mAttrNum];
value = attrs[mAttrNum];
}

// Null values should not be categorized
Expand Down Expand Up @@ -243,8 +243,8 @@ void QgsGraduatedSymbolRendererV2::startRender( QgsRenderContext& context, const

if ( mAttrNum == -1 )
{
mExpression = new QgsExpression( mAttrName );
mExpression->prepare( vlayer->pendingFields() );
mExpression = new QgsExpression( mAttrName );
mExpression->prepare( vlayer->pendingFields() );
}

mRotationFieldIdx = ( mRotationField.isEmpty() ? -1 : vlayer->fieldNameIndex( mRotationField ) );
Expand Down Expand Up @@ -290,9 +290,9 @@ QList<QString> QgsGraduatedSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;
QgsExpression exp( mAttrName );
foreach (QString attr, exp.referencedColumns() )
foreach ( QString attr, exp.referencedColumns() )
{
attributes << attr;
attributes << attr;
}
if ( !mRotationField.isEmpty() )
{
Expand Down Expand Up @@ -798,22 +798,22 @@ QgsGraduatedSymbolRendererV2* QgsGraduatedSymbolRendererV2::createRenderer(
double maximum;
if ( attrNum == -1 )
{
QList<double> values;
QgsFeatureIterator fit = vlayer->getFeatures();
QgsFeature feature;
QgsExpression expression( attrName );
while ( fit.nextFeature( feature ) )
{
values << expression.evaluate( feature ).toDouble();
}
qSort( values );
minimum = values.first();
maximum = values.last();
QList<double> values;
QgsFeatureIterator fit = vlayer->getFeatures();
QgsFeature feature;
QgsExpression expression( attrName );
while ( fit.nextFeature( feature ) )
{
values << expression.evaluate( feature ).toDouble();
}
qSort( values );
minimum = values.first();
maximum = values.last();
}
else
{
minimum = vlayer->minimumValue( attrNum ).toDouble();
maximum = vlayer->maximumValue( attrNum ).toDouble();
minimum = vlayer->minimumValue( attrNum ).toDouble();
maximum = vlayer->maximumValue( attrNum ).toDouble();
}

QgsDebugMsg( QString( "min %1 // max %2" ).arg( minimum ).arg( maximum ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class CORE_EXPORT QgsFeatureRendererV2
//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note: not available in python bindings
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator=-1 );
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1 );

//! set type and size of editing vertex markers for subsequent rendering
void setVertexMarkerAppearance( int type, int size );
Expand Down
75 changes: 38 additions & 37 deletions src/core/symbology-ng/qgsrulebasedrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@



QgsRuleBasedRendererV2::Rule::Rule(QgsSymbolV2* symbol, int scaleMinDenom, int scaleMaxDenom, QString filterExp, QString label, QString description , bool elseRule)
QgsRuleBasedRendererV2::Rule::Rule( QgsSymbolV2* symbol, int scaleMinDenom, int scaleMaxDenom, QString filterExp, QString label, QString description , bool elseRule )
: mParent( NULL ), mSymbol( symbol )
, mScaleMinDenom( scaleMinDenom ), mScaleMaxDenom( scaleMaxDenom )
, mFilterExp( filterExp ), mLabel( label ), mDescription( description )
Expand All @@ -48,10 +48,10 @@ QgsRuleBasedRendererV2::Rule::~Rule()

void QgsRuleBasedRendererV2::Rule::initFilter()
{
if ( mElseRule || mFilterExp.compare("ELSE", Qt::CaseInsensitive) == 0 )
if ( mElseRule || mFilterExp.compare( "ELSE", Qt::CaseInsensitive ) == 0 )
{
mElseRule = true;
mFilter = NULL;
mElseRule = true;
mFilter = NULL;
}
else if ( !mFilterExp.isEmpty() )
{
Expand All @@ -66,56 +66,56 @@ void QgsRuleBasedRendererV2::Rule::initFilter()

void QgsRuleBasedRendererV2::Rule::appendChild( Rule* rule )
{
mChildren.append( rule );
rule->mParent = this;
updateElseRules();
mChildren.append( rule );
rule->mParent = this;
updateElseRules();
}

void QgsRuleBasedRendererV2::Rule::insertChild( int i, Rule* rule )
{
mChildren.insert( i, rule );
rule->mParent = this;
updateElseRules();
mChildren.insert( i, rule );
rule->mParent = this;
updateElseRules();
}

void QgsRuleBasedRendererV2::Rule::removeChild( Rule* rule )
{
mChildren.removeAll( rule );
delete rule;
updateElseRules();
mChildren.removeAll( rule );
delete rule;
updateElseRules();
}

void QgsRuleBasedRendererV2::Rule::removeChildAt( int i )
{
Rule* rule = mChildren[i];
mChildren.removeAt( i );
delete rule;
updateElseRules();
Rule* rule = mChildren[i];
mChildren.removeAt( i );
delete rule;
updateElseRules();
}

void QgsRuleBasedRendererV2::Rule::takeChild( Rule* rule )
{
mChildren.removeAll( rule );
rule->mParent = NULL;
updateElseRules();
mChildren.removeAll( rule );
rule->mParent = NULL;
updateElseRules();
}

QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::takeChildAt( int i )
{
Rule* rule = mChildren.takeAt( i );
rule->mParent = NULL;
return rule;
updateElseRules();
Rule* rule = mChildren.takeAt( i );
rule->mParent = NULL;
return rule;
updateElseRules();
}

void QgsRuleBasedRendererV2::Rule::updateElseRules()
{
mElseRules.clear();
foreach (Rule* rule, mChildren )
{
if ( rule->isElse() )
mElseRules << rule;
}
mElseRules.clear();
foreach ( Rule* rule, mChildren )
{
if ( rule->isElse() )
mElseRules << rule;
}
}


Expand Down Expand Up @@ -185,8 +185,9 @@ QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems( double scal
{
Rule* rule = *it;
if ( scaleDenominator == -1 || (
( rule->mScaleMinDenom == -1 || rule->mScaleMinDenom < scaleDenominator ) &&
( rule->mScaleMaxDenom == -1 || scaleDenominator < rule->mScaleMaxDenom ) ) ) {
( rule->mScaleMinDenom == -1 || rule->mScaleMinDenom < scaleDenominator ) &&
( rule->mScaleMaxDenom == -1 || scaleDenominator < rule->mScaleMaxDenom ) ) )
{
lst << rule->legendSymbolItems( scaleDenominator );
}
}
Expand Down Expand Up @@ -443,7 +444,7 @@ bool QgsRuleBasedRendererV2::Rule::renderFeature( QgsRuleBasedRendererV2::Featur
for ( QList<Rule*>::iterator it = mActiveChildren.begin(); it != mActiveChildren.end(); ++it )
{
Rule* rule = *it;
if ( rule->isElse())
if ( rule->isElse() )
{
// Don't process else rules yet
continue;
Expand All @@ -455,10 +456,10 @@ bool QgsRuleBasedRendererV2::Rule::renderFeature( QgsRuleBasedRendererV2::Featur
// If none of the rules passed then we jump into the else rules and process them.
if ( !willrendersomething )
{
foreach(Rule* rule, mElseRules)
{
rendered |= rule->renderFeature( featToRender, context, renderQueue );
}
foreach ( Rule* rule, mElseRules )
{
rendered |= rule->renderFeature( featToRender, context, renderQueue );
}
}

return rendered;
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsrulebasedrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2
QSet<QString> usedAttributes();
QgsSymbolV2List symbols();
//! @note not available in python bindings
QgsLegendSymbolList legendSymbolItems( double scaleDenominator=-1 );
QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1 );
bool isFilterOK( QgsFeature& f ) const;
bool isScaleOK( double scale ) const;

Expand Down Expand Up @@ -226,7 +226,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2
//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator=-1 );
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1 );

//! for debugging
virtual QString dump() const;
Expand Down
48 changes: 24 additions & 24 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ void QgsCategorizedSymbolRendererV2Widget::updateUiFromRenderer()
int idx = cboCategorizedColumn->findText( attrName, Qt::MatchExactly );
if ( idx == -1 )
{
cboCategorizedColumn->addItem( attrName );
idx = cboCategorizedColumn->count() - 1;
cboCategorizedColumn->addItem( attrName );
idx = cboCategorizedColumn->count() - 1;
}
cboCategorizedColumn->setCurrentIndex( idx );
connect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
Expand Down Expand Up @@ -600,22 +600,22 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
QList<QVariant> unique_vals;
if ( idx == -1 )
{
// Lets assume it's an expression
QgsExpression* expression = new QgsExpression( attrName );
expression->prepare( mLayer->pendingFields() );
QgsFeatureIterator fit = mLayer->getFeatures();
QgsFeature feature;
while ( fit.nextFeature( feature ) )
{
QVariant value = expression->evaluate( feature ) ;
if ( unique_vals.contains( value ) )
continue;
unique_vals << value;
}
// Lets assume it's an expression
QgsExpression* expression = new QgsExpression( attrName );
expression->prepare( mLayer->pendingFields() );
QgsFeatureIterator fit = mLayer->getFeatures();
QgsFeature feature;
while ( fit.nextFeature( feature ) )
{
QVariant value = expression->evaluate( feature ) ;
if ( unique_vals.contains( value ) )
continue;
unique_vals << value;
}
}
else
{
mLayer->uniqueValues( idx, unique_vals );
mLayer->uniqueValues( idx, unique_vals );
}

// ask to abort if too many classes
Expand Down Expand Up @@ -761,17 +761,17 @@ void QgsCategorizedSymbolRendererV2Widget::deleteAllCategories()

void QgsCategorizedSymbolRendererV2Widget::setExpression()
{
QgsExpressionBuilderDialog dlg( mLayer, cboCategorizedColumn->currentText(), this );
dlg.setWindowTitle( "Set column expression" );
if ( dlg.exec() )
QgsExpressionBuilderDialog dlg( mLayer, cboCategorizedColumn->currentText(), this );
dlg.setWindowTitle( "Set column expression" );
if ( dlg.exec() )
{
QString expression = dlg.expressionText();
if ( !expression.isEmpty() )
{
QString expression = dlg.expressionText();
if ( !expression.isEmpty() )
{
cboCategorizedColumn->addItem( expression );
cboCategorizedColumn->setCurrentIndex( cboCategorizedColumn->count() - 1 );
}
cboCategorizedColumn->addItem( expression );
cboCategorizedColumn->setCurrentIndex( cboCategorizedColumn->count() - 1 );
}
}

}

Expand Down
22 changes: 11 additions & 11 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
int idx = cboGraduatedColumn->findText( attrName, Qt::MatchExactly );
if ( idx == -1 )
{
cboGraduatedColumn->addItem( attrName );
idx = cboGraduatedColumn->count() - 1;
cboGraduatedColumn->addItem( attrName );
idx = cboGraduatedColumn->count() - 1;
}
cboGraduatedColumn->setCurrentIndex( idx );
connect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
Expand Down Expand Up @@ -462,17 +462,17 @@ void QgsGraduatedSymbolRendererV2Widget::graduatedColumnChanged()

void QgsGraduatedSymbolRendererV2Widget::setExpression()
{
QgsExpressionBuilderDialog dlg( mLayer, cboGraduatedColumn->currentText(), this );
dlg.setWindowTitle( "Set column expression" );
if ( dlg.exec() )
QgsExpressionBuilderDialog dlg( mLayer, cboGraduatedColumn->currentText(), this );
dlg.setWindowTitle( "Set column expression" );
if ( dlg.exec() )
{
QString expression = dlg.expressionText();
if ( !expression.isEmpty() )
{
QString expression = dlg.expressionText();
if ( !expression.isEmpty() )
{
cboGraduatedColumn->addItem( expression );
cboGraduatedColumn->setCurrentIndex( cboGraduatedColumn->count() - 1 );
}
cboGraduatedColumn->addItem( expression );
cboGraduatedColumn->setCurrentIndex( cboGraduatedColumn->count() - 1 );
}
}

}

Expand Down
50 changes: 25 additions & 25 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
//new ModelTest( mModel, this ); // for model validity checking
viewRules->setModel( mModel );

mDeleteAction = new QAction( tr( "Remove Rule"), this );
mDeleteAction = new QAction( tr( "Remove Rule" ), this );
mDeleteAction->setShortcut( QKeySequence( QKeySequence::Delete ) );

viewRules->addAction( mDeleteAction );
Expand Down Expand Up @@ -415,26 +415,26 @@ void QgsRuleBasedRendererV2Widget::restoreSectionWidths()

void QgsRuleBasedRendererV2Widget::copy()
{
QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
QgsDebugMsg(QString("%1").arg(indexlist.count()));
QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
QgsDebugMsg( QString( "%1" ).arg( indexlist.count() ) );

if ( indexlist.isEmpty() )
return;
if ( indexlist.isEmpty() )
return;

QMimeData* mime = mModel->mimeData( indexlist );
QApplication::clipboard()->setMimeData(mime);
QMimeData* mime = mModel->mimeData( indexlist );
QApplication::clipboard()->setMimeData( mime );
}

void QgsRuleBasedRendererV2Widget::paste()
{
const QMimeData* mime = QApplication::clipboard()->mimeData();
QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
QModelIndex index;
if ( indexlist.isEmpty() )
index = mModel->index(mModel->rowCount(), 0);
else
index = indexlist.first();
mModel->dropMimeData( mime, Qt::CopyAction, index.row(), index.column(), index.parent() );
const QMimeData* mime = QApplication::clipboard()->mimeData();
QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
QModelIndex index;
if ( indexlist.isEmpty() )
index = mModel->index( mModel->rowCount(), 0 );
else
index = indexlist.first();
mModel->dropMimeData( mime, Qt::CopyAction, index.row(), index.column(), index.parent() );
}


Expand Down Expand Up @@ -674,11 +674,11 @@ QVariant QgsRuleBasedRendererV2Model::data( const QModelIndex &index, int role )
case 1:
if ( rule->isElse() )
{
return "ELSE";
return "ELSE";
}
else
{
return rule->filterExpression().isEmpty() ? tr( "(no filter)" ) : rule->filterExpression();
return rule->filterExpression().isEmpty() ? tr( "(no filter)" ) : rule->filterExpression();
}
case 2: return rule->dependsOnScale() ? _formatScale( rule->scaleMinDenom() ) : QVariant();
case 3: return rule->dependsOnScale() ? _formatScale( rule->scaleMaxDenom() ) : QVariant();
Expand Down Expand Up @@ -726,15 +726,15 @@ QVariant QgsRuleBasedRendererV2Model::data( const QModelIndex &index, int role )
{
return ( index.column() == 2 || index.column() == 3 ) ? Qt::AlignRight : Qt::AlignLeft;
}
else if (role == Qt::FontRole && index.column() == 1)
else if ( role == Qt::FontRole && index.column() == 1 )
{
if ( rule->isElse() )
{
QFont italicFont;
italicFont.setItalic(true);
return italicFont;
}
return QVariant();
if ( rule->isElse() )
{
QFont italicFont;
italicFont.setItalic( true );
return italicFont;
}
return QVariant();
}
else if ( role == Qt::EditRole )
{
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgshttprequesthandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void QgsHttpRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& info
QByteArray ba;
QgsDebugMsg( "Info format is:" + infoFormat );

if ( infoFormat == "text/xml" || infoFormat.startsWith("application/vnd.ogc.gml") )
if ( infoFormat == "text/xml" || infoFormat.startsWith( "application/vnd.ogc.gml" ) )
{
ba = infoDoc.toByteArray();
}
Expand Down
105 changes: 59 additions & 46 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ QDomDocument QgsWMSServer::getCapabilities( QString version, bool fullProjectInf

//wms:GetFeatureInfo
elem = doc.createElement( "GetFeatureInfo" );
appendFormats( doc, elem, QStringList() << "text/plain" << "text/html" << "text/xml" << "application/vnd.ogc.gml" << "application/vnd.ogc.gml/3.1.1");
appendFormats( doc, elem, QStringList() << "text/plain" << "text/html" << "text/xml" << "application/vnd.ogc.gml" << "application/vnd.ogc.gml/3.1.1" );
elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
requestElement.appendChild( elem );

Expand Down Expand Up @@ -811,19 +811,21 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
QMap<QString, QString> originalLayerFilters = applyRequestedLayerFilters( layersList );

QDomElement getFeatureInfoElement;
QString infoFormat = mParameterMap.value("INFO_FORMAT");
if (infoFormat.startsWith("application/vnd.ogc.gml")) {
getFeatureInfoElement = result.createElement("wfs:FeatureCollection");
getFeatureInfoElement.setAttribute("xmlns:wfs", "http://www.opengis.net/wfs");
getFeatureInfoElement.setAttribute("xmlns:ogc", "http://www.opengis.net/ogc");
getFeatureInfoElement.setAttribute("xmlns:gml", "http://www.opengis.net/gml");
getFeatureInfoElement.setAttribute("xmlns:ows", "http://www.opengis.net/ows");
getFeatureInfoElement.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
getFeatureInfoElement.setAttribute("xmlns:qgs", "http://www.qgis.org/gml");
getFeatureInfoElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
getFeatureInfoElement.setAttribute("xsi:schemaLocation", "http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.qgis.org/gml");
}
else {
QString infoFormat = mParameterMap.value( "INFO_FORMAT" );
if ( infoFormat.startsWith( "application/vnd.ogc.gml" ) )
{
getFeatureInfoElement = result.createElement( "wfs:FeatureCollection" );
getFeatureInfoElement.setAttribute( "xmlns:wfs", "http://www.opengis.net/wfs" );
getFeatureInfoElement.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
getFeatureInfoElement.setAttribute( "xmlns:gml", "http://www.opengis.net/gml" );
getFeatureInfoElement.setAttribute( "xmlns:ows", "http://www.opengis.net/ows" );
getFeatureInfoElement.setAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
getFeatureInfoElement.setAttribute( "xmlns:qgs", "http://www.qgis.org/gml" );
getFeatureInfoElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
getFeatureInfoElement.setAttribute( "xsi:schemaLocation", "http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.qgis.org/gml" );
}
else
{
QString featureInfoElemName = mConfigParser->featureInfoDocumentElement( "GetFeatureInfoResponse" );
QString featureInfoElemNS = mConfigParser->featureInfoDocumentElementNS();
if ( featureInfoElemNS.isEmpty() )
Expand Down Expand Up @@ -894,10 +896,12 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
QgsVectorLayer* vectorLayer = dynamic_cast<QgsVectorLayer*>( currentLayer );

QDomElement layerElement;
if (infoFormat.startsWith("application/vnd.ogc.gml")) {
if ( infoFormat.startsWith( "application/vnd.ogc.gml" ) )
{
layerElement = getFeatureInfoElement;
}
else {
else
{
layerElement = result.createElement( "Layer" );
QString layerName = currentLayer->name();

Expand Down Expand Up @@ -942,7 +946,8 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
}
else //raster layer
{
if (infoFormat.startsWith("application/vnd.ogc.gml")) {
if ( infoFormat.startsWith( "application/vnd.ogc.gml" ) )
{
layerElement = result.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
getFeatureInfoElement.appendChild( layerElement );
}
Expand Down Expand Up @@ -1376,7 +1381,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
}

// Creates the gml:featureMember only if we have at least one element
if ( infoFormat.startsWith("application/vnd.ogc.gml") && featureCounter == 1 )
if ( infoFormat.startsWith( "application/vnd.ogc.gml" ) && featureCounter == 1 )
{
QDomElement realLayerElement = infoDocument.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
layerElement.appendChild( realLayerElement );
Expand All @@ -1398,15 +1403,17 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
continue;
}

if (infoFormat == "application/vnd.ogc.gml") {
if ( infoFormat == "application/vnd.ogc.gml" )
{
QgsCoordinateReferenceSystem layerCrs = layer->crs();
bool withGeom = layer->wkbType() != QGis::WKBNoGeometry;
int version = infoFormat.startsWith("application/vnd.ogc.gml/3") ? 3 : 2;
QDomElement elem = createFeatureGML(&feature, infoDocument, layerCrs, layer->name(), withGeom, version);
layerElement.appendChild(elem);
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
QDomElement elem = createFeatureGML( &feature, infoDocument, layerCrs, layer->name(), withGeom, version );
layerElement.appendChild( elem );
continue;
}
else {
else
{
QDomElement featureElement = infoDocument.createElement( "Feature" );
featureElement.setAttribute( "id", FID_TO_STRING( feature.id() ) );
layerElement.appendChild( featureElement );
Expand All @@ -1420,16 +1427,16 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
{
continue;
}

//replace attribute name if there is an attribute alias?
QString attributeName = layer->attributeDisplayName( i );

QDomElement attributeElement = infoDocument.createElement( "Attribute" );
attributeElement.setAttribute( "name", attributeName );
attributeElement.setAttribute( "value", featureAttributes[i].toString() );
featureElement.appendChild( attributeElement );
}

//also append the wkt geometry as an attribute
QgsGeometry* geom = feature.geometry();
if ( addWktGeometry && geom )
Expand All @@ -1451,7 +1458,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
{
featureBBox->combineExtentWith( &box );
}

//append feature bounding box to feature info xml
QDomElement bBoxElem = infoDocument.createElement( "BoundingBox" );
bBoxElem.setAttribute( version == "1.1.1" ? "SRS" : "CRS", mapRender->destinationCrs().authid() );
Expand Down Expand Up @@ -1500,19 +1507,21 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue, mMapRenderer->extent(), mMapRenderer->outputSize().width(), mMapRenderer->outputSize().height() ).results();
}

if (infoFormat == "application/vnd.ogc.gml") {
if ( infoFormat == "application/vnd.ogc.gml" )
{
QgsFeature feature;
for (QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it)
for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
{
feature.setAttribute(layer->bandName(it.key()), QString::number(it.value().toDouble()));
feature.setAttribute( layer->bandName( it.key() ), QString::number( it.value().toDouble() ) );
}

QgsCoordinateReferenceSystem layerCrs = layer->crs();
int version = infoFormat.startsWith("application/vnd.ogc.gml/3") ? 3 : 2;
QDomElement elem = createFeatureGML(&feature, infoDocument, layerCrs, layer->name(), false, version);
layerElement.appendChild(elem);
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
QDomElement elem = createFeatureGML( &feature, infoDocument, layerCrs, layer->name(), false, version );
layerElement.appendChild( elem );
}
else {
else
{
for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
{
QDomElement attributeElement = infoDocument.createElement( "Attribute" );
Expand Down Expand Up @@ -2407,12 +2416,12 @@ void QgsWMSServer::convertFeatureInfoToSIA2045( QDomDocument& doc )
}

QDomElement QgsWMSServer::createFeatureGML(
QgsFeature* feat,
QDomDocument& doc,
QgsCoordinateReferenceSystem& crs,
QString typeName,
bool withGeom,
int version) const
QgsFeature* feat,
QDomDocument& doc,
QgsCoordinateReferenceSystem& crs,
QString typeName,
bool withGeom,
int version ) const
{
//qgs:%TYPENAME%
QDomElement typeNameElement = doc.createElement( "qgs:" + typeName /*qgs:%TYPENAME%*/ );
Expand All @@ -2425,22 +2434,26 @@ QDomElement QgsWMSServer::createFeatureGML(

QDomElement geomElem = doc.createElement( "qgs:geometry" );
QDomElement gmlElem;
if (version < 3) {
if ( version < 3 )
{
gmlElem = QgsOgcUtils::geometryToGML( geom, doc );
}
else {
else
{
gmlElem = QgsOgcUtils::geometryToGML( geom, doc, "GML3" );
}

if ( !gmlElem.isNull() )
{
QgsRectangle box = geom->boundingBox();
QDomElement bbElem = doc.createElement( "gml:boundedBy" );
QDomElement boxElem;
if (version < 3) {
if ( version < 3 )
{
boxElem = QgsOgcUtils::rectangleToGMLBox( &box, doc );
}
else {
else
{
boxElem = QgsOgcUtils::rectangleToGMLEnvelope( &box, doc );
}

Expand Down
30 changes: 15 additions & 15 deletions src/mapserver/qgswmsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,22 @@ class QgsWMSServer
@param featureBBox the bounding box of the selected features in output CRS
@return 0 in case of success*/
int featureInfoFromVectorLayer( QgsVectorLayer* layer,
const QgsPoint* infoPoint,
int nFeatures,
QDomDocument& infoDocument,
QDomElement& layerElement,
QgsMapRenderer* mapRender,
QgsRenderContext& renderContext,
QString version,
QString infoFormat,
QgsRectangle* featureBBox = 0 ) const;
const QgsPoint* infoPoint,
int nFeatures,
QDomDocument& infoDocument,
QDomElement& layerElement,
QgsMapRenderer* mapRender,
QgsRenderContext& renderContext,
QString version,
QString infoFormat,
QgsRectangle* featureBBox = 0 ) const;
/**Appends feature info xml for the layer to the layer element of the dom document*/
int featureInfoFromRasterLayer( QgsRasterLayer* layer,
const QgsPoint* infoPoint,
QDomDocument& infoDocument,
QDomElement& layerElement,
QString version,
QString infoFormat ) const;
const QgsPoint* infoPoint,
QDomDocument& infoDocument,
QDomElement& layerElement,
QString version,
QString infoFormat ) const;

/**Creates a layer set and returns a stringlist with layer ids that can be passed to a QgsMapRenderer. Usually used in conjunction with readLayersAndStyles
@param scaleDenominator Filter out layer if scale based visibility does not match (or use -1 if no scale restriction)*/
Expand Down Expand Up @@ -226,7 +226,7 @@ class QgsWMSServer
QgsCoordinateReferenceSystem& crs,
QString typeName,
bool withGeom,
int version) const;
int version ) const;
};

#endif
234 changes: 117 additions & 117 deletions src/providers/postgres/qgspostgresfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,123 +360,123 @@ bool QgsPostgresFeatureIterator::getFeature( QgsPostgresResult &queryResult, int
memset( featureGeom, 0, returnedLength + 1 );
memcpy( featureGeom, PQgetvalue( queryResult.result(), row, col ), returnedLength );

// modify 2.5D WKB types to make them compliant with OGR
unsigned int wkbType;
memcpy( &wkbType, featureGeom + 1, sizeof( wkbType) );

// convert unsupported types to supported ones
switch ( wkbType )
{
case 15:
// 2D polyhedral => multipolygon
wkbType = 6;
break;
case 1015:
// 3D polyhedral => multipolygon
wkbType = 1006;
break;
case 17:
// 2D triangle => polygon
wkbType = 3;
break;
case 1017:
// 3D triangle => polygon
wkbType = 1003;
break;
case 16:
// 2D TIN => multipolygon
wkbType = 6;
break;
case 1016:
// TIN => multipolygon
wkbType = 1006;
break;
}
// convert from postgis types to qgis types
if ( wkbType >= 1000 )
{
wkbType = wkbType - 1000 + QGis::WKBPoint25D - 1;
}
memcpy( featureGeom + 1, &wkbType, sizeof( wkbType) );

// change wkb type of inner geometries
if ( wkbType == QGis::WKBMultiPoint25D ||
wkbType == QGis::WKBMultiLineString25D ||
wkbType == QGis::WKBMultiPolygon25D )
{
unsigned int numGeoms = *(( int* )( featureGeom + 5 ));
unsigned char* wkb = featureGeom + 9;
for ( unsigned int i = 0; i < numGeoms; ++i )
{
unsigned int localType;
memcpy( &localType, wkb + 1, sizeof( localType) );
switch ( localType )
{
case 15:
// 2D polyhedral => multipolygon
localType = 6;
break;
case 1015:
// 3D polyhedral => multipolygon
localType = 1006;
break;
case 17:
// 2D triangle => polygon
localType = 3;
break;
case 1017:
// 3D triangle => polygon
localType = 1003;
break;
case 16:
// 2D TIN => multipolygon
localType = 6;
break;
case 1016:
// TIN => multipolygon
localType = 1006;
break;
}
if ( localType >= 1000 )
{
localType = localType - 1000 + QGis::WKBPoint25D - 1;
}
memcpy( wkb + 1, &localType, sizeof( localType) );

// skip endian and type info
wkb += sizeof( unsigned int ) + 1;

// skip coordinates
switch ( wkbType )
{
case QGis::WKBMultiPoint25D:
wkb += sizeof( double ) * 3;
break;
case QGis::WKBMultiLineString25D:
{
unsigned int nPoints = *(( int* ) wkb );
wkb += sizeof( nPoints );
wkb += sizeof( double ) * 3 * nPoints;
}
break;
default:
case QGis::WKBMultiPolygon25D:
{
unsigned int nRings = *(( int* ) wkb );
wkb += sizeof( nRings );
for ( unsigned int j = 0; j < nRings; ++j )
{
unsigned int nPoints = *(( int* ) wkb );
wkb += sizeof( nPoints );
wkb += sizeof( double ) * 3 * nPoints;
}
}
break;
}
}
}

feature.setGeometryAndOwnership( featureGeom, returnedLength + 1 );
// modify 2.5D WKB types to make them compliant with OGR
unsigned int wkbType;
memcpy( &wkbType, featureGeom + 1, sizeof( wkbType ) );

// convert unsupported types to supported ones
switch ( wkbType )
{
case 15:
// 2D polyhedral => multipolygon
wkbType = 6;
break;
case 1015:
// 3D polyhedral => multipolygon
wkbType = 1006;
break;
case 17:
// 2D triangle => polygon
wkbType = 3;
break;
case 1017:
// 3D triangle => polygon
wkbType = 1003;
break;
case 16:
// 2D TIN => multipolygon
wkbType = 6;
break;
case 1016:
// TIN => multipolygon
wkbType = 1006;
break;
}
// convert from postgis types to qgis types
if ( wkbType >= 1000 )
{
wkbType = wkbType - 1000 + QGis::WKBPoint25D - 1;
}
memcpy( featureGeom + 1, &wkbType, sizeof( wkbType ) );

// change wkb type of inner geometries
if ( wkbType == QGis::WKBMultiPoint25D ||
wkbType == QGis::WKBMultiLineString25D ||
wkbType == QGis::WKBMultiPolygon25D )
{
unsigned int numGeoms = *(( int* )( featureGeom + 5 ) );
unsigned char* wkb = featureGeom + 9;
for ( unsigned int i = 0; i < numGeoms; ++i )
{
unsigned int localType;
memcpy( &localType, wkb + 1, sizeof( localType ) );
switch ( localType )
{
case 15:
// 2D polyhedral => multipolygon
localType = 6;
break;
case 1015:
// 3D polyhedral => multipolygon
localType = 1006;
break;
case 17:
// 2D triangle => polygon
localType = 3;
break;
case 1017:
// 3D triangle => polygon
localType = 1003;
break;
case 16:
// 2D TIN => multipolygon
localType = 6;
break;
case 1016:
// TIN => multipolygon
localType = 1006;
break;
}
if ( localType >= 1000 )
{
localType = localType - 1000 + QGis::WKBPoint25D - 1;
}
memcpy( wkb + 1, &localType, sizeof( localType ) );

// skip endian and type info
wkb += sizeof( unsigned int ) + 1;

// skip coordinates
switch ( wkbType )
{
case QGis::WKBMultiPoint25D:
wkb += sizeof( double ) * 3;
break;
case QGis::WKBMultiLineString25D:
{
unsigned int nPoints = *(( int* ) wkb );
wkb += sizeof( nPoints );
wkb += sizeof( double ) * 3 * nPoints;
}
break;
default:
case QGis::WKBMultiPolygon25D:
{
unsigned int nRings = *(( int* ) wkb );
wkb += sizeof( nRings );
for ( unsigned int j = 0; j < nRings; ++j )
{
unsigned int nPoints = *(( int* ) wkb );
wkb += sizeof( nPoints );
wkb += sizeof( double ) * 3 * nPoints;
}
}
break;
}
}
}

feature.setGeometryAndOwnership( featureGeom, returnedLength + 1 );
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/python/qgspythonutilsimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
{
QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();
msg->setTitle( QObject::tr( "Python error" ) );
msg->setMessage( QString( QObject::tr("The extra plugin path '%1' does not exist !") ).arg(p), QgsMessageOutput::MessageText );
msg->setMessage( QString( QObject::tr( "The extra plugin path '%1' does not exist !" ) ).arg( p ), QgsMessageOutput::MessageText );
msg->showMessage();
}
// we store here paths in unicode strings
// the str constant will contain utf8 code (through runString)
// so we call '...'.decode('utf-8') to make a unicode string
// we store here paths in unicode strings
// the str constant will contain utf8 code (through runString)
// so we call '...'.decode('utf-8') to make a unicode string
pluginpaths << '"' + p + "\".decode('utf-8')";
}
pluginpaths << homePluginsPath();
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgscomposershapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ void TestQgsComposerShapes::initTestCase()
mComposition = new QgsComposition( 0 );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerShape = new QgsComposerShape( 20, 20, 150, 100, mComposition );
mComposerShape->setBackgroundColor( QColor::fromRgb( 255, 150, 0 ) );
mComposition->addComposerShape( mComposerShape );
mComposerShape->setBackgroundColor( QColor::fromRgb( 255, 150, 0 ) );
mComposition->addComposerShape( mComposerShape );
}

void TestQgsComposerShapes::cleanupTestCase()
Expand Down Expand Up @@ -101,7 +101,7 @@ void TestQgsComposerShapes::roundedRectangle()
{
mComposerShape->setShapeType( QgsComposerShape::Rectangle );
mComposerShape->setCornerRadius( 30 );

QgsCompositionChecker checker( "Composer shapes", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composershapes" + QDir::separator() + "composershape_roundedrectangle.png" ) );
QVERIFY( checker.testComposition() );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgscomposershapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def testRoundedRectangle(self):

self.mComposerShape.setCornerRadius(0)
assert myTestResult == True, myMessage

if __name__ == '__main__':
unittest.main()