[QGIS-Developer] Parse project grid LineSymbol properties

Tom Chadwin tom.chadwin at nnpa.org.uk
Thu Nov 16 00:51:07 PST 2017


I'm retrieving the project grid line symbol properties in Python:

stroke = project.readEntry("Grid", "/LineSymbol", "")[0]

This gives me what I presume is a string of serialized XML:

<symbol alpha="1" clip_to_extent="1" type="line" name="line symbol">
 <layer pass="0" class="SimpleLine" locked="0">
  <prop k="capstyle" v="square"/>
  <prop k="customdash" v="5;2"/>
  <prop k="customdash_map_unit_scale" v="0,0,0,0,0,0"/>
  <prop k="customdash_unit" v="MM"/>
  <prop k="draw_inside_polygon" v="0"/>
  <prop k="joinstyle" v="bevel"/>
  <prop k="line_color" v="0,0,0,255"/>
  <prop k="line_style" v="solid"/>
  <prop k="line_width" v="0.26"/>
  <prop k="line_width_unit" v="MM"/>
  <prop k="offset" v="0"/>
  <prop k="offset_map_unit_scale" v="0,0,0,0,0,0"/>
  <prop k="offset_unit" v="MM"/>
  <prop k="use_custom_dash" v="0"/>
  <prop k="width_map_unit_scale" v="0,0,0,0,0,0"/>
 </layer>
</symbol>

I already have a function which reads through the properties of a line
symbol, but it works with properties retrieved via
QgsSymbolLayer.properties().

How do I convert the XML into whatever format QgsSymbolLayer.properties()
returns (a QgsStringMap, whatever that might be)?

Thanks

Tom




-----
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html


More information about the QGIS-Developer mailing list