Skip to content
Permalink
Browse files
automatic indentation update (r9365-r9447)
git-svn-id: http://svn.osgeo.org/qgis/trunk@9448 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 6, 2008
1 parent 107a21b commit 9038cdeaed9e337520687d52e10f30598a42cb5e
@@ -168,7 +168,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
mDefaultSnapModeComboBox->insertItem( 0, tr( "to vertex" ), "to vertex" );
mDefaultSnapModeComboBox->insertItem( 1, tr( "to segment" ), "to segment" );
mDefaultSnapModeComboBox->insertItem( 2, tr( "to vertex and segment" ), "to vertex and segment" );
QString defaultSnapString = settings.value( "/qgis/digitizing/default_snap_mode", "to vertex").toString();
QString defaultSnapString = settings.value( "/qgis/digitizing/default_snap_mode", "to vertex" ).toString();
mDefaultSnapModeComboBox->setCurrentIndex( mDefaultSnapModeComboBox->findData( defaultSnapString ) );
mDefaultSnappingToleranceSpinBox->setValue( settings.value( "/qgis/digitizing/default_snapping_tolerance", 0 ).toDouble() );
mSearchRadiusVertexEditSpinBox->setValue( settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble() );
@@ -434,10 +434,10 @@ QStandardItem* QgsLegendModel::itemFromSymbol( QgsSymbol* s )
label = s->label();

//Take the label as item text if it is there
if(!label.isEmpty())
{
itemText = label;
}
if ( !label.isEmpty() )
{
itemText = label;
}
//take single value
else if ( lowerValue == upperValue || upperValue.isEmpty() )
{
@@ -45,16 +45,16 @@ CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation = NULL;

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem()
: mMapUnits( QGis::UNKNOWN ),
mIsValidFlag( 0 ),
mValidationHint ( 0 )
mIsValidFlag( 0 ),
mValidationHint( 0 )
{
mCRS = OSRNewSpatialReference( NULL );
}

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theWkt )
: mMapUnits( QGis::UNKNOWN ),
mIsValidFlag( 0 ),
mValidationHint ( 0 )
mIsValidFlag( 0 ),
mValidationHint( 0 )
{
mCRS = OSRNewSpatialReference( NULL );
createFromWkt( theWkt );
@@ -63,8 +63,8 @@ QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theWkt )

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, CRS_TYPE theType )
: mMapUnits( QGis::UNKNOWN ),
mIsValidFlag( 0 ),
mValidationHint ( 0 )
mIsValidFlag( 0 ),
mValidationHint( 0 )
{
mCRS = OSRNewSpatialReference( NULL );
createFromId( theId, theType );
@@ -536,14 +536,14 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
}

QString errorMsg;
theResultFlag = readSymbology(myRoot, errorMsg);
if(!theResultFlag)
{
myErrorMessage = QObject::tr( "Loading style file " ) + theURI + QObject::tr(" failed because:") + "\n" + errorMsg;
return myErrorMessage;
}
theResultFlag = readSymbology( myRoot, errorMsg );
if ( !theResultFlag )
{
myErrorMessage = QObject::tr( "Loading style file " ) + theURI + QObject::tr( " failed because:" ) + "\n" + errorMsg;
return myErrorMessage;
}

return "";
return "";
}

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

QString errorMsg;
if(!writeSymbology(myRootNode, myDocument, errorMsg))
{
return QObject::tr("Could not save symbology because:") + "\n" + errorMsg;
}
if ( !writeSymbology( myRootNode, myDocument, errorMsg ) )
{
return QObject::tr( "Could not save symbology because:" ) + "\n" + errorMsg;
}

// check if the uri is a file or ends with .qml,
// which indicates that it should become one
@@ -244,20 +244,20 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
virtual QString saveNamedStyle( const QString theURI, bool & theResultFlag );

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

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

public slots:

@@ -38,7 +38,7 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] =
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transform091to0100},
{PFV( 0, 9, 2 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transform0100to0110},
{PFV( 0, 11, 0 ), PFV( 1, 0, 0), &QgsProjectFileTransform::transform0110to1000}
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000}
};

bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )
@@ -287,62 +287,62 @@ void QgsProjectFileTransform::transform0110to1000()
{
if ( ! mDom.isNull() )
{
QDomNodeList layerList = mDom.elementsByTagName("maplayer");
for(int i = 0; i < layerList.size(); ++i)
QDomNodeList layerList = mDom.elementsByTagName( "maplayer" );
for ( int i = 0; i < layerList.size(); ++i )
{
QDomElement layerElem = layerList.at( i ).toElement();
QString typeString = layerElem.attribute( "type" );
if ( typeString != "vector" )
{
continue;
}

//datasource
QDomNode dataSourceNode = layerElem.namedItem( "datasource" );
if ( dataSourceNode.isNull() )
{
return;
}
QString dataSource = dataSourceNode.toElement().text();

//provider key
QDomNode providerNode = layerElem.namedItem( "provider" );
if ( providerNode.isNull() )
{
return;
}
QString providerKey = providerNode.toElement().text();

//create the layer to get the provider for int->fieldName conversion
QgsVectorLayer* theLayer = new QgsVectorLayer( dataSource, "", providerKey, false );
if ( !theLayer->isValid() )
{
QDomElement layerElem = layerList.at(i).toElement();
QString typeString = layerElem.attribute("type");
if(typeString != "vector")
{
continue;
}

//datasource
QDomNode dataSourceNode = layerElem.namedItem("datasource");
if(dataSourceNode.isNull())
{
return;
}
QString dataSource = dataSourceNode.toElement().text();

//provider key
QDomNode providerNode = layerElem.namedItem("provider");
if(providerNode.isNull())
{
return;
}
QString providerKey = providerNode.toElement().text();

//create the layer to get the provider for int->fieldName conversion
QgsVectorLayer* theLayer = new QgsVectorLayer(dataSource, "", providerKey, false);
if(!theLayer->isValid())
{
delete theLayer;
return;
}

QgsVectorDataProvider* theProvider = theLayer->dataProvider();
if(!theProvider)
{
return;
}
QgsFieldMap theFieldMap = theProvider->fields();

//read classificationfield
QDomNodeList classificationFieldList = layerElem.elementsByTagName("classificationfield");
for(int j = 0; j < classificationFieldList.size(); ++j)
{
QDomElement classificationFieldElem = classificationFieldList.at(j).toElement();
int fieldNumber = classificationFieldElem.text().toInt();
QgsFieldMap::const_iterator field_it = theFieldMap.find(fieldNumber);
if(field_it != theFieldMap.constEnd())
{
QDomText fieldName = mDom.createTextNode(field_it.value().name());
QDomNode nameNode = classificationFieldElem.firstChild();
classificationFieldElem.replaceChild(fieldName, nameNode);
}
}

delete theLayer;
return;
}

QgsVectorDataProvider* theProvider = theLayer->dataProvider();
if ( !theProvider )
{
return;
}
QgsFieldMap theFieldMap = theProvider->fields();

//read classificationfield
QDomNodeList classificationFieldList = layerElem.elementsByTagName( "classificationfield" );
for ( int j = 0; j < classificationFieldList.size(); ++j )
{
QDomElement classificationFieldElem = classificationFieldList.at( j ).toElement();
int fieldNumber = classificationFieldElem.text().toInt();
QgsFieldMap::const_iterator field_it = theFieldMap.find( fieldNumber );
if ( field_it != theFieldMap.constEnd() )
{
QDomText fieldName = mDom.createTextNode( field_it.value().name() );
QDomNode nameNode = classificationFieldElem.firstChild();
classificationFieldElem.replaceChild( fieldName, nameNode );
}
}

}
}
}
@@ -238,10 +238,10 @@ QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const

const QgsFieldMap& theFields = fields();
QgsFieldMap::const_iterator field_it = theFields.constBegin();
for(; field_it != theFields.constEnd(); ++field_it)
{
resultMap.insert(field_it.value().name(), field_it.key());
}
for ( ; field_it != theFields.constEnd(); ++field_it )
{
resultMap.insert( field_it.value().name(), field_it.key() );
}

return resultMap;
}
@@ -2085,10 +2085,10 @@ bool QgsVectorLayer::readXml( QDomNode & layer_node )
}

QString errorMsg;
if(!readSymbology(layer_node, errorMsg))
{
return false;
}
if ( !readSymbology( layer_node, errorMsg ) )
{
return false;
}

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

QString errorMsg;
if(!writeSymbology( layer_node, document, errorMsg ))
{
return false;
}
if ( !writeSymbology( layer_node, document, errorMsg ) )
{
return false;
}

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

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

bool QgsVectorLayer::readSymbology(const QDomNode& node, QString& errorMessage)
bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage )
{
// create and bind a renderer to this layer

@@ -2428,34 +2428,34 @@ bool QgsVectorLayer::readSymbology(const QDomNode& node, QString& errorMessage)
renderer = new QgsUniqueValueRenderer( vectorType() );
returnCode = renderer->readXML( uniquevaluenode, *this );
}

if(!renderer)
{
return false;
}

if(returnCode == 1)
{
errorMessage = tr("No renderer object"); delete renderer; return false;
}
else if(returnCode == 2)
{
errorMessage = tr("Classification field not found"); delete renderer; return false;
}
if ( !renderer )
{
return false;
}

if ( returnCode == 1 )
{
errorMessage = tr( "No renderer object" ); delete renderer; return false;
}
else if ( returnCode == 2 )
{
errorMessage = tr( "Classification field not found" ); delete renderer; return false;
}

mRenderer = renderer;
return true;
}

bool QgsVectorLayer::writeSymbology(QDomNode& node, QDomDocument& doc, QString& errorMessage) const
bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const
{
const QgsRenderer * myRenderer = renderer();
if ( myRenderer )
{
if(!myRenderer->writeXML( node, doc, *this ))
{
return false;
}
if ( !myRenderer->writeXML( node, doc, *this ) )
{
return false;
}
}
else
{
@@ -173,20 +173,20 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );

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

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


/**
Loading

0 comments on commit 9038cde

Please sign in to comment.