Tag 'classificationattribute' in project file for maplayer export

git-svn-id: http://svn.osgeo.org/qgis/trunk@4866 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2006-02-16 13:39:40 +00:00
parent 6e5c780a8b
commit 935e6b5e65
2 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,7 @@
-- General Map Layer Properties
-- (apply to both vector and raster)
-->
<!ELEMENT maplayer (layername, datasource, (singlesymbol|singlemarker|graduatedsymbol|continuoussymbol|graduatedmarker|rasterproperties) >
<!ELEMENT maplayer (layername, datasource, classificationattribute*, (singlesymbol|singlemarker|graduatedsymbol|continuoussymbol|graduatedmarker|rasterproperties) >
<!ELEMENT layername (#PCDATA) >
<!ELEMENT datasource (#PCDATA) >
<!-- Attribute Lists -->

View File

@ -2442,6 +2442,17 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
encoding.appendChild( encodingText );
layer_node.appendChild( encoding );
//classification field(s)
std::list<int> attributes=m_renderer->classificationAttributes();
const std::vector<QgsField> providerFields = dataProvider->fields();
for(std::list<int>::const_iterator it = attributes.begin(); it != attributes.end(); ++it)
{
QDomElement classificationElement = document.createElement("classificationattribute");
QDomText classificationText = document.createTextNode(providerFields[*it].name());
classificationElement.appendChild(classificationText);
layer_node.appendChild(classificationElement);
}
// add the display field
QDomElement dField = document.createElement( "displayfield" );