Skip to content

Commit 7c0aa7c

Browse files
author
jef
committedOct 6, 2008

19 files changed

+199
-199
lines changed
 

‎src/app/qgsoptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
168168
mDefaultSnapModeComboBox->insertItem( 0, tr( "to vertex" ), "to vertex" );
169169
mDefaultSnapModeComboBox->insertItem( 1, tr( "to segment" ), "to segment" );
170170
mDefaultSnapModeComboBox->insertItem( 2, tr( "to vertex and segment" ), "to vertex and segment" );
171-
QString defaultSnapString = settings.value( "/qgis/digitizing/default_snap_mode", "to vertex").toString();
171+
QString defaultSnapString = settings.value( "/qgis/digitizing/default_snap_mode", "to vertex" ).toString();
172172
mDefaultSnapModeComboBox->setCurrentIndex( mDefaultSnapModeComboBox->findData( defaultSnapString ) );
173173
mDefaultSnappingToleranceSpinBox->setValue( settings.value( "/qgis/digitizing/default_snapping_tolerance", 0 ).toDouble() );
174174
mSearchRadiusVertexEditSpinBox->setValue( settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble() );

‎src/core/composer/qgslegendmodel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ QStandardItem* QgsLegendModel::itemFromSymbol( QgsSymbol* s )
434434
label = s->label();
435435

436436
//Take the label as item text if it is there
437-
if(!label.isEmpty())
438-
{
439-
itemText = label;
440-
}
437+
if ( !label.isEmpty() )
438+
{
439+
itemText = label;
440+
}
441441
//take single value
442442
else if ( lowerValue == upperValue || upperValue.isEmpty() )
443443
{

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation = NULL;
4545

4646
QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem()
4747
: mMapUnits( QGis::UNKNOWN ),
48-
mIsValidFlag( 0 ),
49-
mValidationHint ( 0 )
48+
mIsValidFlag( 0 ),
49+
mValidationHint( 0 )
5050
{
5151
mCRS = OSRNewSpatialReference( NULL );
5252
}
5353

5454
QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theWkt )
5555
: mMapUnits( QGis::UNKNOWN ),
56-
mIsValidFlag( 0 ),
57-
mValidationHint ( 0 )
56+
mIsValidFlag( 0 ),
57+
mValidationHint( 0 )
5858
{
5959
mCRS = OSRNewSpatialReference( NULL );
6060
createFromWkt( theWkt );
@@ -63,8 +63,8 @@ QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theWkt )
6363

6464
QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, CRS_TYPE theType )
6565
: mMapUnits( QGis::UNKNOWN ),
66-
mIsValidFlag( 0 ),
67-
mValidationHint ( 0 )
66+
mIsValidFlag( 0 ),
67+
mValidationHint( 0 )
6868
{
6969
mCRS = OSRNewSpatialReference( NULL );
7070
createFromId( theId, theType );

‎src/core/qgsmaplayer.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -536,14 +536,14 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
536536
}
537537

538538
QString errorMsg;
539-
theResultFlag = readSymbology(myRoot, errorMsg);
540-
if(!theResultFlag)
541-
{
542-
myErrorMessage = QObject::tr( "Loading style file " ) + theURI + QObject::tr(" failed because:") + "\n" + errorMsg;
543-
return myErrorMessage;
544-
}
539+
theResultFlag = readSymbology( myRoot, errorMsg );
540+
if ( !theResultFlag )
541+
{
542+
myErrorMessage = QObject::tr( "Loading style file " ) + theURI + QObject::tr( " failed because:" ) + "\n" + errorMsg;
543+
return myErrorMessage;
544+
}
545545

546-
return "";
546+
return "";
547547
}
548548

549549
QString QgsMapLayer::saveDefaultStyle( bool & theResultFlag )
@@ -565,10 +565,10 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
565565
myDocument.appendChild( myRootNode );
566566

567567
QString errorMsg;
568-
if(!writeSymbology(myRootNode, myDocument, errorMsg))
569-
{
570-
return QObject::tr("Could not save symbology because:") + "\n" + errorMsg;
571-
}
568+
if ( !writeSymbology( myRootNode, myDocument, errorMsg ) )
569+
{
570+
return QObject::tr( "Could not save symbology because:" ) + "\n" + errorMsg;
571+
}
572572

573573
// check if the uri is a file or ends with .qml,
574574
// which indicates that it should become one

‎src/core/qgsmaplayer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,20 @@ class CORE_EXPORT QgsMapLayer : public QObject
244244
*/
245245
virtual QString saveNamedStyle( const QString theURI, bool & theResultFlag );
246246

247-
/** Read the symbology for the current layer from the Dom node supplied.
247+
/** Read the symbology for the current layer from the Dom node supplied.
248248
* @param QDomNode node that will contain the symbology definition for this layer.
249249
* @param errorMessage reference to string that will be updated with any error messages
250250
* @return true in case of success.
251251
*/
252-
virtual bool readSymbology(const QDomNode& node, QString& errorMessage) = 0;
252+
virtual bool readSymbology( const QDomNode& node, QString& errorMessage ) = 0;
253253

254254
/** Write the symbology for the layer into the docment provided.
255255
* @param QDomNode the node that will have the style element added to it.
256256
* @param QDomDocument the document that will have the QDomNode added.
257257
* @param errorMessage reference to string that will be updated with any error messages
258258
* @return true in case of success.
259259
*/
260-
virtual bool writeSymbology(QDomNode&, QDomDocument& doc, QString& errorMessage) const = 0;
260+
virtual bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage ) const = 0;
261261

262262
public slots:
263263

‎src/core/qgsprojectfiletransform.cpp

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] =
3838
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transform091to0100},
3939
{PFV( 0, 9, 2 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transformNull},
4040
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transform0100to0110},
41-
{PFV( 0, 11, 0 ), PFV( 1, 0, 0), &QgsProjectFileTransform::transform0110to1000}
41+
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000}
4242
};
4343

4444
bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )
@@ -287,62 +287,62 @@ void QgsProjectFileTransform::transform0110to1000()
287287
{
288288
if ( ! mDom.isNull() )
289289
{
290-
QDomNodeList layerList = mDom.elementsByTagName("maplayer");
291-
for(int i = 0; i < layerList.size(); ++i)
290+
QDomNodeList layerList = mDom.elementsByTagName( "maplayer" );
291+
for ( int i = 0; i < layerList.size(); ++i )
292+
{
293+
QDomElement layerElem = layerList.at( i ).toElement();
294+
QString typeString = layerElem.attribute( "type" );
295+
if ( typeString != "vector" )
296+
{
297+
continue;
298+
}
299+
300+
//datasource
301+
QDomNode dataSourceNode = layerElem.namedItem( "datasource" );
302+
if ( dataSourceNode.isNull() )
303+
{
304+
return;
305+
}
306+
QString dataSource = dataSourceNode.toElement().text();
307+
308+
//provider key
309+
QDomNode providerNode = layerElem.namedItem( "provider" );
310+
if ( providerNode.isNull() )
311+
{
312+
return;
313+
}
314+
QString providerKey = providerNode.toElement().text();
315+
316+
//create the layer to get the provider for int->fieldName conversion
317+
QgsVectorLayer* theLayer = new QgsVectorLayer( dataSource, "", providerKey, false );
318+
if ( !theLayer->isValid() )
292319
{
293-
QDomElement layerElem = layerList.at(i).toElement();
294-
QString typeString = layerElem.attribute("type");
295-
if(typeString != "vector")
296-
{
297-
continue;
298-
}
299-
300-
//datasource
301-
QDomNode dataSourceNode = layerElem.namedItem("datasource");
302-
if(dataSourceNode.isNull())
303-
{
304-
return;
305-
}
306-
QString dataSource = dataSourceNode.toElement().text();
307-
308-
//provider key
309-
QDomNode providerNode = layerElem.namedItem("provider");
310-
if(providerNode.isNull())
311-
{
312-
return;
313-
}
314-
QString providerKey = providerNode.toElement().text();
315-
316-
//create the layer to get the provider for int->fieldName conversion
317-
QgsVectorLayer* theLayer = new QgsVectorLayer(dataSource, "", providerKey, false);
318-
if(!theLayer->isValid())
319-
{
320-
delete theLayer;
321-
return;
322-
}
323-
324-
QgsVectorDataProvider* theProvider = theLayer->dataProvider();
325-
if(!theProvider)
326-
{
327-
return;
328-
}
329-
QgsFieldMap theFieldMap = theProvider->fields();
330-
331-
//read classificationfield
332-
QDomNodeList classificationFieldList = layerElem.elementsByTagName("classificationfield");
333-
for(int j = 0; j < classificationFieldList.size(); ++j)
334-
{
335-
QDomElement classificationFieldElem = classificationFieldList.at(j).toElement();
336-
int fieldNumber = classificationFieldElem.text().toInt();
337-
QgsFieldMap::const_iterator field_it = theFieldMap.find(fieldNumber);
338-
if(field_it != theFieldMap.constEnd())
339-
{
340-
QDomText fieldName = mDom.createTextNode(field_it.value().name());
341-
QDomNode nameNode = classificationFieldElem.firstChild();
342-
classificationFieldElem.replaceChild(fieldName, nameNode);
343-
}
344-
}
345-
320+
delete theLayer;
321+
return;
346322
}
323+
324+
QgsVectorDataProvider* theProvider = theLayer->dataProvider();
325+
if ( !theProvider )
326+
{
327+
return;
328+
}
329+
QgsFieldMap theFieldMap = theProvider->fields();
330+
331+
//read classificationfield
332+
QDomNodeList classificationFieldList = layerElem.elementsByTagName( "classificationfield" );
333+
for ( int j = 0; j < classificationFieldList.size(); ++j )
334+
{
335+
QDomElement classificationFieldElem = classificationFieldList.at( j ).toElement();
336+
int fieldNumber = classificationFieldElem.text().toInt();
337+
QgsFieldMap::const_iterator field_it = theFieldMap.find( fieldNumber );
338+
if ( field_it != theFieldMap.constEnd() )
339+
{
340+
QDomText fieldName = mDom.createTextNode( field_it.value().name() );
341+
QDomNode nameNode = classificationFieldElem.firstChild();
342+
classificationFieldElem.replaceChild( fieldName, nameNode );
343+
}
344+
}
345+
346+
}
347347
}
348348
}

‎src/core/qgsvectordataprovider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const
238238

239239
const QgsFieldMap& theFields = fields();
240240
QgsFieldMap::const_iterator field_it = theFields.constBegin();
241-
for(; field_it != theFields.constEnd(); ++field_it)
242-
{
243-
resultMap.insert(field_it.value().name(), field_it.key());
244-
}
241+
for ( ; field_it != theFields.constEnd(); ++field_it )
242+
{
243+
resultMap.insert( field_it.value().name(), field_it.key() );
244+
}
245245

246246
return resultMap;
247247
}

‎src/core/qgsvectorlayer.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,10 +2085,10 @@ bool QgsVectorLayer::readXml( QDomNode & layer_node )
20852085
}
20862086

20872087
QString errorMsg;
2088-
if(!readSymbology(layer_node, errorMsg))
2089-
{
2090-
return false;
2091-
}
2088+
if ( !readSymbology( layer_node, errorMsg ) )
2089+
{
2090+
return false;
2091+
}
20922092

20932093
// Test if labeling is on or off
20942094
QDomNode labelnode = layer_node.namedItem( "label" );
@@ -2319,10 +2319,10 @@ bool QgsVectorLayer::writeXml( QDomNode & layer_node,
23192319
// renderer specific settings
23202320

23212321
QString errorMsg;
2322-
if(!writeSymbology( layer_node, document, errorMsg ))
2323-
{
2324-
return false;
2325-
}
2322+
if ( !writeSymbology( layer_node, document, errorMsg ) )
2323+
{
2324+
return false;
2325+
}
23262326

23272327
// Now we get to do all that all over again for QgsLabel
23282328

@@ -2396,7 +2396,7 @@ bool QgsVectorLayer::writeXml( QDomNode & layer_node,
23962396
return true;
23972397
} // bool QgsVectorLayer::writeXml
23982398

2399-
bool QgsVectorLayer::readSymbology(const QDomNode& node, QString& errorMessage)
2399+
bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage )
24002400
{
24012401
// create and bind a renderer to this layer
24022402

@@ -2428,34 +2428,34 @@ bool QgsVectorLayer::readSymbology(const QDomNode& node, QString& errorMessage)
24282428
renderer = new QgsUniqueValueRenderer( vectorType() );
24292429
returnCode = renderer->readXML( uniquevaluenode, *this );
24302430
}
2431-
2432-
if(!renderer)
2433-
{
2434-
return false;
2435-
}
24362431

2437-
if(returnCode == 1)
2438-
{
2439-
errorMessage = tr("No renderer object"); delete renderer; return false;
2440-
}
2441-
else if(returnCode == 2)
2442-
{
2443-
errorMessage = tr("Classification field not found"); delete renderer; return false;
2444-
}
2432+
if ( !renderer )
2433+
{
2434+
return false;
2435+
}
2436+
2437+
if ( returnCode == 1 )
2438+
{
2439+
errorMessage = tr( "No renderer object" ); delete renderer; return false;
2440+
}
2441+
else if ( returnCode == 2 )
2442+
{
2443+
errorMessage = tr( "Classification field not found" ); delete renderer; return false;
2444+
}
24452445

24462446
mRenderer = renderer;
24472447
return true;
24482448
}
24492449

2450-
bool QgsVectorLayer::writeSymbology(QDomNode& node, QDomDocument& doc, QString& errorMessage) const
2450+
bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const
24512451
{
24522452
const QgsRenderer * myRenderer = renderer();
24532453
if ( myRenderer )
24542454
{
2455-
if(!myRenderer->writeXML( node, doc, *this ))
2456-
{
2457-
return false;
2458-
}
2455+
if ( !myRenderer->writeXML( node, doc, *this ) )
2456+
{
2457+
return false;
2458+
}
24592459
}
24602460
else
24612461
{

‎src/core/qgsvectorlayer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,20 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
173173
*/
174174
virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );
175175

176-
/** Read the symbology for the current layer from the Dom node supplied.
177-
* @param QDomNode node that will contain the symbology definition for this layer.
178-
* @param errorMessage reference to string that will be updated with any error messages
179-
* @return true in case of success.
176+
/** Read the symbology for the current layer from the Dom node supplied.
177+
* @param QDomNode node that will contain the symbology definition for this layer.
178+
* @param errorMessage reference to string that will be updated with any error messages
179+
* @return true in case of success.
180180
*/
181-
bool readSymbology(const QDomNode& node, QString& errorMessage);
181+
bool readSymbology( const QDomNode& node, QString& errorMessage );
182182

183183
/** Write the symbology for the layer into the docment provided.
184184
* @param QDomNode the node that will have the style element added to it.
185185
* @param QDomDocument the document that will have the QDomNode added.
186186
* @param errorMessage reference to string that will be updated with any error messages
187187
* @return true in case of success.
188188
*/
189-
bool writeSymbology(QDomNode&, QDomDocument& doc, QString& errorMessage) const;
189+
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage ) const;
190190

191191

192192
/**

0 commit comments

Comments
 (0)
Please sign in to comment.