Skip to content
Permalink
Browse files

Move reading/writing of label style to qgsvectorlayer. Change argumen…

…t in readCustomProperties to const. Fixes problem with mixed label settings between qgis server projects

git-svn-id: http://svn.osgeo.org/qgis/trunk@15235 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Feb 21, 2011
1 parent 4919e80 commit 42cca5c4b36f0f32a293081609ff54613d22ad73
Showing with 8 additions and 8 deletions.
  1. +1 −7 src/core/qgsmaplayer.cpp
  2. +1 −1 src/core/qgsmaplayer.h
  3. +6 −0 src/core/qgsvectorlayer.cpp
@@ -626,9 +626,6 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
return myErrorMessage;
}

//also restore custom properties (for labeling-ng)
readCustomProperties( myRoot, "labeling" );

return "";
}

@@ -668,9 +665,6 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
return tr( "Could not save symbology because:\n%1" ).arg( errorMsg );
}

//save customproperties (for labeling ng)
writeCustomProperties( myRootNode, myDocument );

// check if the uri is a file or ends with .qml,
// which indicates that it should become one
// everything else goes to the database
@@ -827,7 +821,7 @@ void QgsMapLayer::removeCustomProperty( const QString& key )
mCustomProperties.remove( key );
}

void QgsMapLayer::readCustomProperties( QDomNode & layerNode, const QString& keyStartsWith )
void QgsMapLayer::readCustomProperties( const QDomNode& layerNode, const QString& keyStartsWith )
{
QDomNode propsNode = layerNode.namedItem( "customproperties" );
if ( propsNode.isNull() ) // no properties stored...
@@ -384,7 +384,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
/** Read custom properties from project file. Added in v1.4
@param layerNode note to read from
@param keyStartsWith reads only properties starting with the specified string (or all if the string is empty)*/
void readCustomProperties( QDomNode & layerNode, const QString& keyStartsWith = "" );
void readCustomProperties( const QDomNode& layerNode, const QString& keyStartsWith = "" );

/** Write custom properties to project file. Added in v1.4 */
void writeCustomProperties( QDomNode & layerNode, QDomDocument & doc ) const;
@@ -2914,6 +2914,9 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
mLabel->setMinScale( e.attribute( "minLabelScale", "1" ).toFloat() );
mLabel->setMaxScale( e.attribute( "maxLabelScale", "100000000" ).toFloat() );

//also restore custom properties (for labeling-ng)
readCustomProperties( node, "labeling" );

// Test if labeling is on or off
QDomNode labelnode = node.namedItem( "label" );
QDomElement element = labelnode.toElement();
@@ -3069,6 +3072,9 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
}
}

//save customproperties (for labeling ng)
writeCustomProperties( node, doc );

// add the display field
QDomElement dField = doc.createElement( "displayfield" );
QDomText dFieldText = doc.createTextNode( displayField() );

0 comments on commit 42cca5c

Please sign in to comment.
You can’t perform that action at this time.