[QGIS Commit] r15235 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 21 13:15:04 EST 2011


Author: mhugent
Date: 2011-02-21 10:15:04 -0800 (Mon, 21 Feb 2011)
New Revision: 15235

Modified:
   trunk/qgis/src/core/qgsmaplayer.cpp
   trunk/qgis/src/core/qgsmaplayer.h
   trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
Move reading/writing of label style to qgsvectorlayer. Change argument in readCustomProperties to const. Fixes problem with mixed label settings between qgis server projects

Modified: trunk/qgis/src/core/qgsmaplayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.cpp	2011-02-21 17:13:11 UTC (rev 15234)
+++ trunk/qgis/src/core/qgsmaplayer.cpp	2011-02-21 18:15:04 UTC (rev 15235)
@@ -626,9 +626,6 @@
     return myErrorMessage;
   }
 
-  //also restore custom properties (for labeling-ng)
-  readCustomProperties( myRoot, "labeling" );
-
   return "";
 }
 
@@ -668,9 +665,6 @@
     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 @@
   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...

Modified: trunk/qgis/src/core/qgsmaplayer.h
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.h	2011-02-21 17:13:11 UTC (rev 15234)
+++ trunk/qgis/src/core/qgsmaplayer.h	2011-02-21 18:15:04 UTC (rev 15235)
@@ -384,7 +384,7 @@
     /** 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;

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2011-02-21 17:13:11 UTC (rev 15234)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2011-02-21 18:15:04 UTC (rev 15235)
@@ -2914,6 +2914,9 @@
     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 @@
       }
     }
 
+    //save customproperties (for labeling ng)
+    writeCustomProperties( node, doc );
+
     // add the display field
     QDomElement dField  = doc.createElement( "displayfield" );
     QDomText dFieldText = doc.createTextNode( displayField() );



More information about the QGIS-commit mailing list