Skip to content

Commit

Permalink
Tag 'classificationattribute' in project file for maplayer export
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@4866 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 16, 2006
1 parent 6e5c780 commit 935e6b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qgis.dtd
Expand Up @@ -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 -->
Expand Down
11 changes: 11 additions & 0 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -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" );
Expand Down

0 comments on commit 935e6b5

Please sign in to comment.