Skip to content
Permalink
Browse files
indentation update and a few unused parameter warnings fixes
  • Loading branch information
jef-n committed Mar 22, 2012
1 parent 8968496 commit f770aea4f44c88f6e007ac41fc5e008a1a8afbb9
@@ -149,7 +149,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
if ( featList.size() == 0 )
return false;

foreach ( QgsFeature feat, featList )
foreach( QgsFeature feat, featList )
{
int actionIdx = layer->actions()->defaultAction();

@@ -951,7 +951,7 @@ void QgsVectorLayerProperties::on_pbnLoadStyle_clicked()
QSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( "style/lastStyleDir", "." ).toString();
QString myFileName = QFileDialog::getOpenFileName( this, tr( "Load layer properties from style file" ), myLastUsedDir,
tr( "QGIS Layer Style File" ) + " (*.qml);;" + tr( "SLD File" ) + " (*.sld)" );
tr( "QGIS Layer Style File" ) + " (*.qml);;" + tr( "SLD File" ) + " (*.sld)" );
if ( myFileName.isNull() )
{
return;
@@ -963,7 +963,7 @@ void QgsVectorLayerProperties::on_pbnLoadStyle_clicked()
if ( myFileName.endsWith( ".sld", Qt::CaseInsensitive ) )
{
// load from SLD
myMessage = layer->loadSldStyle( myFileName, defaultLoadedFlag );
myMessage = layer->loadSldStyle( myFileName, defaultLoadedFlag );
}
else
{
@@ -991,7 +991,7 @@ void QgsVectorLayerProperties::on_pbnSaveStyleAs_clicked()
QSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( "style/lastStyleDir", "." ).toString();
QString myOutputFileName = QFileDialog::getSaveFileName( this, tr( "Save layer properties as style file" ), myLastUsedDir,
tr( "QGIS Layer Style File" ) + " (*.qml);;" + tr( "SLD File" ) + " (*.sld)" );
tr( "QGIS Layer Style File" ) + " (*.qml);;" + tr( "SLD File" ) + " (*.sld)" );
if ( myOutputFileName.isNull() ) //dialog canceled
{
return;
@@ -1006,7 +1006,7 @@ void QgsVectorLayerProperties::on_pbnSaveStyleAs_clicked()
if ( myOutputFileName.endsWith( ".sld", Qt::CaseInsensitive ) )
{
// convert to SLD
myMessage = layer->saveSldStyle( myOutputFileName, defaultLoadedFlag );
myMessage = layer->saveSldStyle( myOutputFileName, defaultLoadedFlag );
}
else
{
@@ -300,8 +300,8 @@ bool QgsCoordinateReferenceSystem::axisInverted() const
OGRAxisOrientation orientation;
const char *axis0 = OSRGetAxis( mCRS, mGeoFlag ? "GEOGCS" : "PROJCS", 0, &orientation );
mAxisInverted = mGeoFlag
? (orientation == OAO_East || orientation == OAO_West || orientation == OAO_Other )
: (orientation == OAO_North || orientation == OAO_South );
? ( orientation == OAO_East || orientation == OAO_West || orientation == OAO_Other )
: ( orientation == OAO_North || orientation == OAO_South );
QgsDebugMsg( QString( "srid:%1 axis0:%2 orientation:%3 inverted:%4" ).arg( mSRID ).arg( axis0 ).arg( OSRAxisEnumToName( orientation ) ).arg( mAxisInverted ) );
}

@@ -664,11 +664,11 @@ QgsExpression::Node* QgsExpression::Node::createFromOgcFilter( QDomElement &elem
{
return QgsExpression::NodeLiteral::createFromOgcFilter( element, errorMessage );
}
else if ( element.localName() == "Function")
else if ( element.localName() == "Function" )
{
return QgsExpression::NodeFunction::createFromOgcFilter( element, errorMessage );
}
else if ( element.localName() == "PropertyName")
else if ( element.localName() == "PropertyName" )
{
return QgsExpression::NodeColumnRef::createFromOgcFilter( element, errorMessage );
}
@@ -826,11 +826,11 @@ QgsExpression::Node* QgsExpression::NodeUnaryOperator::createFromOgcFilter( QDom
if ( !operand )
{
if ( errorMessage.isEmpty() )
errorMessage = QString( "invalid operand for '%1' unary operator" ).arg( ogcOperatorName );
errorMessage = QString( "invalid operand for '%1' unary operator" ).arg( ogcOperatorName );
return NULL;
}

return new QgsExpression::NodeUnaryOperator( ( UnaryOperator ) i, operand );
return new QgsExpression::NodeUnaryOperator(( UnaryOperator ) i, operand );
}

errorMessage = QString( "%1 unary operator not supported." ).arg( element.tagName() );
@@ -975,10 +975,10 @@ QVariant QgsExpression::NodeBinaryOperator::eval( QgsExpression* parent, QgsFeat
matches = QRegExp( regexp ).indexIn( str ) != -1;
}

if( mOp == boNotLike || mOp == boNotILike )
{
matches = !matches;
}
if ( mOp == boNotLike || mOp == boNotILike )
{
matches = !matches;
}

return matches ? TVL_True : TVL_False;
}
@@ -1085,8 +1085,8 @@ void QgsExpression::NodeBinaryOperator::toOgcFilter( QDomDocument &doc, QDomElem

element.appendChild( eqElem );
}
else if ( ( opLeftLiteral && opLeftLiteral->value().isNull() ) ||
( opRightLiteral && opRightLiteral->value().isNull() ) )
else if (( opLeftLiteral && opLeftLiteral->value().isNull() ) ||
( opRightLiteral && opRightLiteral->value().isNull() ) )
{
// at least one operand is NULL, use <ogc:PropertyIsNull> element
QDomElement isNullElem = doc.createElement( "ogc:PropertyIsNull" );
@@ -1186,7 +1186,7 @@ QgsExpression::Node* QgsExpression::NodeBinaryOperator::createFromOgcFilter( QDo
if ( !opLeft )
{
if ( errorMessage.isEmpty() )
errorMessage = QString( "invalid left operand for '%1' binary operator" ).arg( ogcOperatorName );
errorMessage = QString( "invalid left operand for '%1' binary operator" ).arg( ogcOperatorName );
break;
}

@@ -1195,11 +1195,11 @@ QgsExpression::Node* QgsExpression::NodeBinaryOperator::createFromOgcFilter( QDo
if ( !opRight )
{
if ( errorMessage.isEmpty() )
errorMessage = QString( "invalid right operand for '%1' binary operator" ).arg( ogcOperatorName );
errorMessage = QString( "invalid right operand for '%1' binary operator" ).arg( ogcOperatorName );
break;
}

return new QgsExpression::NodeBinaryOperator( ( BinaryOperator ) i, opLeft, opRight );
return new QgsExpression::NodeBinaryOperator(( BinaryOperator ) i, opLeft, opRight );
}

if ( !opLeft && !opRight )
@@ -65,7 +65,7 @@ bool QgsColorRampShader::discreteColor( double theValue, int* theReturnRedValue,
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex );
myTinyDiff = qAbs( theValue - myColorRampItem.value );
//If the previous entry is less, then search closer to the top of the list (assumes mColorRampItemList is sorted)
if ( mCurrentColorRampItemIndex != 0 &&
if ( mCurrentColorRampItemIndex != 0 &&
theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value )
{
mCurrentColorRampItemIndex--;
@@ -121,8 +121,8 @@ bool QgsColorRampShader::exactColor( double theValue, int* theReturnRedValue, in
}
//pixel value sits between ramp entries so bail
else if ( mCurrentColorRampItemIndex != myColorRampItemCount - 1 &&
theValue > myColorRampItem.value && theValue < mColorRampItemList.at(
mCurrentColorRampItemIndex + 1 ).value )
theValue > myColorRampItem.value && theValue < mColorRampItemList.at(
mCurrentColorRampItemIndex + 1 ).value )
{
return false;
}
@@ -280,8 +280,8 @@ bool QgsColorRampShader::shade( double theValue, int* theReturnRedValue, int* th
}

bool QgsColorRampShader::shade( double theRedValue, double theGreenValue,
double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int*
theReturnBlueValue )
double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int*
theReturnBlueValue )
{
Q_UNUSED( theRedValue );
Q_UNUSED( theGreenValue );
@@ -90,8 +90,8 @@ void QgsRendererCategoryV2::toSld( QDomDocument &doc, QDomElement &element, QgsS
// create the ogc:Filter for the range
QDomElement filterElem = doc.createElement( "ogc:Filter" );
QString filterFunc = QString( "%1 = '%2'" )
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mValue.toString().replace( "'", "''" ) );
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mValue.toString().replace( "'", "''" ) );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );
ruleElem.appendChild( filterElem );

@@ -191,7 +191,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::clone() const
return QgsEllipseSymbolLayerV2::create( properties() );
}

void QgsEllipseSymbolLayerV2::toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
void QgsEllipseSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
QDomElement symbolizerElem = doc.createElement( "se:PointSymbolizer" );
if ( !props.value( "uom", "" ).isEmpty() )
@@ -256,7 +256,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element )
QgsDebugMsg( "Entered." );

QDomElement graphicElem = element.firstChildElement( "Graphic" );
if( graphicElem.isNull() )
if ( graphicElem.isNull() )
return NULL;

QString name = "circle";
@@ -440,7 +440,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::clone() const
return clonedLayer;
}

void QgsSVGFillSymbolLayer::toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
void QgsSVGFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
QDomElement symbolizerElem = doc.createElement( "se:PolygonSymbolizer" );
if ( !props.value( "uom", "" ).isEmpty() )
@@ -507,15 +507,15 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::createFromSld( QDomElement &element )
double size, borderWidth;

QDomElement fillElem = element.firstChildElement( "Fill" );
if( fillElem.isNull() )
if ( fillElem.isNull() )
return NULL;

QDomElement graphicFillElem = fillElem.firstChildElement( "GraphicFill" );
if( graphicFillElem.isNull() )
if ( graphicFillElem.isNull() )
return NULL;

QDomElement graphicElem = graphicFillElem.firstChildElement( "Graphic" );
if( graphicElem.isNull() )
if ( graphicElem.isNull() )
return NULL;

if ( !QgsSymbolLayerV2Utils::externalGraphicFromSld( graphicElem, path, mimeType, fillColor, size ) )
@@ -807,7 +807,7 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::clone() const
return clonedLayer;
}

void QgsLinePatternFillSymbolLayer::toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
void QgsLinePatternFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
QDomElement symbolizerElem = doc.createElement( "se:PolygonSymbolizer" );
if ( !props.value( "uom", "" ).isEmpty() )
@@ -120,8 +120,8 @@ void QgsRendererRangeV2::toSld( QDomDocument &doc, QDomElement &element, QgsStri
// create the ogc:Filter for the range
QDomElement filterElem = doc.createElement( "ogc:Filter" );
QString filterFunc = QString( "%1 > %2 AND %1 <= %3" )
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mLowerValue ).arg( mUpperValue );
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mLowerValue ).arg( mUpperValue );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );

mSymbol->toSld( doc, ruleElem, props );
@@ -197,9 +197,9 @@ QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2::createFromSld( QDomElement &elemen
QVector<qreal> customDashVector;

if ( !QgsSymbolLayerV2Utils::lineFromSld( strokeElem, penStyle,
color, width,
&penJoinStyle, &penCapStyle,
&customDashVector ) )
color, width,
&penJoinStyle, &penCapStyle,
&customDashVector ) )
return NULL;

double offset = 0.0;
@@ -661,7 +661,7 @@ void QgsMarkerLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
QgsSymbolLayerV2Utils::createGeometryElement( doc, symbolizerElem, props.value( "geom", "" ) );

QString gap;
switch( mPlacement )
switch ( mPlacement )
{
case FirstVertex:
symbolizerElem.appendChild( QgsSymbolLayerV2Utils::createVendorOptionElement( doc, "placement", "firstPoint" ) );
@@ -681,7 +681,7 @@ void QgsMarkerLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
break;
}

if( !mRotateMarker )
if ( !mRotateMarker )
{
// markers in LineSymbolizer must be drawn following the line orientation,
// use a VendorOption when no marker rotation
@@ -461,7 +461,7 @@ QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::createFromSld( QDomElement &elem
QgsDebugMsg( "Entered." );

QDomElement graphicElem = element.firstChildElement( "Graphic" );
if( graphicElem.isNull() )
if ( graphicElem.isNull() )
return NULL;

QString name = "square";
@@ -723,7 +723,7 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::createFromSld( QDomElement &element
QgsDebugMsg( "Entered." );

QDomElement graphicElem = element.firstChildElement( "Graphic" );
if( graphicElem.isNull() )
if ( graphicElem.isNull() )
return NULL;

QString path, mimeType;
@@ -994,7 +994,7 @@ QgsSymbolLayerV2* QgsFontMarkerSymbolLayerV2::createFromSld( QDomElement &elemen
QgsDebugMsg( "Entered." );

QDomElement graphicElem = element.firstChildElement( "Graphic" );
if( graphicElem.isNull() )
if ( graphicElem.isNull() )
return NULL;

QString name, format;
@@ -402,7 +402,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis:
int ruleCount = 0;

QDomElement ruleElem = featTypeStyleElem.firstChildElement( "Rule" );
while( !ruleElem.isNull() )
while ( !ruleElem.isNull() )
{
ruleCount++;

@@ -415,7 +415,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis:
}

QDomElement ruleChildElem = ruleElem.firstChildElement();
while( !ruleChildElem.isNull() )
while ( !ruleChildElem.isNull() )
{
// rule has filter or min/max scale denominator, use the RuleRenderer
if ( ruleChildElem.localName() == "Filter" ||
@@ -69,17 +69,23 @@ class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetadata
QgsRendererV2CreateFunc pfCreate,
QIcon icon = QIcon(),
QgsRendererV2WidgetFunc pfWidget = NULL )
: QgsRendererV2AbstractMetadata( name, visibleName, icon ),
mCreateFunc( pfCreate ), mWidgetFunc( pfWidget ), mCreateFromSldFunc( NULL ) {}
: QgsRendererV2AbstractMetadata( name, visibleName, icon )
, mCreateFunc( pfCreate )
, mWidgetFunc( pfWidget )
, mCreateFromSldFunc( NULL )
{}

QgsRendererV2Metadata( QString name,
QString visibleName,
QgsRendererV2CreateFunc pfCreate,
QgsRendererV2CreateFromSldFunc pfCreateFromSld,
QIcon icon = QIcon(),
QgsRendererV2WidgetFunc pfWidget = NULL )
: QgsRendererV2AbstractMetadata( name, visibleName, icon ),
mCreateFunc( pfCreate ), mWidgetFunc( pfWidget ), mCreateFromSldFunc( pfCreateFromSld ) {}
: QgsRendererV2AbstractMetadata( name, visibleName, icon )
, mCreateFunc( pfCreate )
, mWidgetFunc( pfWidget )
, mCreateFromSldFunc( pfCreateFromSld )
{}

virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) { return mCreateFunc ? mCreateFunc( elem ) : NULL; }
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer )
@@ -473,7 +473,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::createFromSld( QDomE

// retrieve the Rule element child nodes
QDomElement childElem = ruleElem.firstChildElement();
while( !childElem.isNull() )
while ( !childElem.isNull() )
{
if ( childElem.localName() == "Name" )
{
@@ -548,7 +548,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::createFromSld( QDomE
QgsSymbolV2 *symbol = 0;
if ( layers.size() > 0 )
{
switch( geomType )
switch ( geomType )
{
case QGis::Line:
symbol = new QgsLineSymbolV2( layers );
@@ -242,7 +242,7 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::createFromSld( QDomElement& ele

// retrieve the Rule element child nodes
QDomElement childElem = ruleElem.firstChildElement();
while( !childElem.isNull() )
while ( !childElem.isNull() )
{
if ( childElem.localName() == "Name" )
{
@@ -265,7 +265,7 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::createFromSld( QDomElement& ele
QgsSymbolV2 *symbol = 0;
if ( layers.size() > 0 )
{
switch( geomType )
switch ( geomType )
{
case QGis::Line:
symbol = new QgsLineSymbolV2( layers );

0 comments on commit f770aea

Please sign in to comment.