Skip to content

Commit

Permalink
feat: update QGISStyleParser to output 3.28 style
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Default output will now be the new qml style (QGIS
>v3.28). Pass version to GeoStylerQgisParser to get the previous format.

- read both 3.28 style QML, and earlier style QML
- update test data in qmls/ to be 3.28 style QML
  • Loading branch information
olsen232 authored and KaiVolland committed Dec 12, 2024
1 parent 43b1524 commit 57acf11
Show file tree
Hide file tree
Showing 10 changed files with 393 additions and 316 deletions.
20 changes: 11 additions & 9 deletions data/qmls/line_simple.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
<symbols>
<symbol type="line" name="0">
<layer class="SimpleLine">
<prop k="line_color" v="255,0,255,255"/>
<prop k="offset" v="2"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="Pixel"/>
<prop k="joinstyle" v="round"/>
<prop k="capstyle" v="square"/>
<prop k="line_width" v="3"/>
<prop k="line_width_unit" v="Pixel"/>
<prop k="customdash" v="12;12"/>
<Option type="Map">
<Option name="line_color" value="255,0,255,255" type="QString"/>
<Option name="offset" value="2" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="Pixel" type="QString"/>
<Option name="joinstyle" value="round" type="QString"/>
<Option name="capstyle" value="square" type="QString"/>
<Option name="line_width" value="3" type="QString"/>
<Option name="line_width_unit" value="Pixel" type="QString"/>
<Option name="customdash" value="12;12" type="QString"/>
</Option>
</layer>
</symbol>
</symbols>
Expand Down
192 changes: 101 additions & 91 deletions data/qmls/point_categories.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis simplifyMaxScale="1" simplifyDrawingTol="1" hasScaleBasedVisibilityFlag="0" styleCategories="AllStyleCategories" simplifyDrawingHints="0" simplifyLocal="1" simplifyAlgorithm="0" version="3.4.3-Madeira" maxScale="0" minScale="1e+8" labelsEnabled="0" readOnly="0">
<qgis simplifyMaxScale="1" simplifyDrawingTol="1" hasScaleBasedVisibilityFlag="0" styleCategories="AllStyleCategories" simplifyDrawingHints="0" simplifyLocal="1" simplifyAlgorithm="0" version="3.28.0-Firenze" maxScale="0" minScale="1e+8" labelsEnabled="0" readOnly="0">
<renderer-v2 forceraster="0" type="categorizedSymbol" attr="Bildpositi" symbollevels="0" enableorderby="0">
<categories>
<category value="1" symbol="0" label="1" render="true"/>
Expand All @@ -10,24 +10,26 @@
<symbols>
<symbol type="marker" alpha="1" force_rhr="0" name="0" clip_to_extent="1">
<layer locked="0" class="SimpleMarker" enabled="1" pass="0">
<prop k="angle" v="0"/>
<prop k="color" v="138,220,56,255"/>
<prop k="horizontal_anchor_point" v="1"/>
<prop k="joinstyle" v="bevel"/>
<prop k="name" v="circle"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="scale_method" v="diameter"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="MM"/>
<prop k="vertical_anchor_point" v="1"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="138,220,56,255" type="QString"/>
<Option name="horizontal_anchor_point" value="1" type="QString"/>
<Option name="joinstyle" value="bevel" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="offset" value="0,0" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="MM" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="MM" type="QString"/>
<Option name="scale_method" value="diameter" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="MM" type="QString"/>
<Option name="vertical_anchor_point" value="1" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" type="QString" name="name"/>
Expand All @@ -39,24 +41,26 @@
</symbol>
<symbol type="marker" alpha="1" force_rhr="0" name="1" clip_to_extent="1">
<layer locked="0" class="SimpleMarker" enabled="1" pass="0">
<prop k="angle" v="0"/>
<prop k="color" v="234,93,93,255"/>
<prop k="horizontal_anchor_point" v="1"/>
<prop k="joinstyle" v="bevel"/>
<prop k="name" v="circle"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="scale_method" v="diameter"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="MM"/>
<prop k="vertical_anchor_point" v="1"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="234,93,93,255" type="QString"/>
<Option name="horizontal_anchor_point" value="1" type="QString"/>
<Option name="joinstyle" value="bevel" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="offset" value="0,0" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="MM" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="MM" type="QString"/>
<Option name="scale_method" value="diameter" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="MM" type="QString"/>
<Option name="vertical_anchor_point" value="1" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" type="QString" name="name"/>
Expand All @@ -68,24 +72,26 @@
</symbol>
<symbol type="marker" alpha="1" force_rhr="0" name="2" clip_to_extent="1">
<layer locked="0" class="SimpleMarker" enabled="1" pass="0">
<prop k="angle" v="0"/>
<prop k="color" v="105,219,219,255"/>
<prop k="horizontal_anchor_point" v="1"/>
<prop k="joinstyle" v="bevel"/>
<prop k="name" v="circle"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="scale_method" v="diameter"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="MM"/>
<prop k="vertical_anchor_point" v="1"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="105,219,219,255" type="QString"/>
<Option name="horizontal_anchor_point" value="1" type="QString"/>
<Option name="joinstyle" value="bevel" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="offset" value="0,0" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="MM" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="MM" type="QString"/>
<Option name="scale_method" value="diameter" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="MM" type="QString"/>
<Option name="vertical_anchor_point" value="1" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" type="QString" name="name"/>
Expand All @@ -97,24 +103,26 @@
</symbol>
<symbol type="marker" alpha="1" force_rhr="0" name="3" clip_to_extent="1">
<layer locked="0" class="SimpleMarker" enabled="1" pass="0">
<prop k="angle" v="0"/>
<prop k="color" v="158,110,205,255"/>
<prop k="horizontal_anchor_point" v="1"/>
<prop k="joinstyle" v="bevel"/>
<prop k="name" v="circle"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="scale_method" v="diameter"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="MM"/>
<prop k="vertical_anchor_point" v="1"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="158,110,205,255" type="QString"/>
<Option name="horizontal_anchor_point" value="1" type="QString"/>
<Option name="joinstyle" value="bevel" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="offset" value="0,0" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="MM" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="MM" type="QString"/>
<Option name="scale_method" value="diameter" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="MM" type="QString"/>
<Option name="vertical_anchor_point" value="1" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" type="QString" name="name"/>
Expand All @@ -128,24 +136,26 @@
<source-symbol>
<symbol type="marker" alpha="1" force_rhr="0" name="0" clip_to_extent="1">
<layer locked="0" class="SimpleMarker" enabled="1" pass="0">
<prop k="angle" v="0"/>
<prop k="color" v="190,178,151,255"/>
<prop k="horizontal_anchor_point" v="1"/>
<prop k="joinstyle" v="bevel"/>
<prop k="name" v="circle"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="scale_method" v="diameter"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="MM"/>
<prop k="vertical_anchor_point" v="1"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="190,178,151,255" type="QString"/>
<Option name="horizontal_anchor_point" value="1" type="QString"/>
<Option name="joinstyle" value="bevel" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="offset" value="0,0" type="QString"/>
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="offset_unit" value="MM" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="MM" type="QString"/>
<Option name="scale_method" value="diameter" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="MM" type="QString"/>
<Option name="vertical_anchor_point" value="1" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" type="QString" name="name"/>
Expand Down
14 changes: 8 additions & 6 deletions data/qmls/point_external_graphic.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
<symbols>
<symbol type="marker" name="0">
<layer class="SvgMarker">
<prop k="angle" v="0"/>
<prop k="color" v="125,139,143,255"/>
<prop k="name" v="https://upload.wikimedia.org/wikipedia/commons/6/67/OpenLayers_logo.svg"/>
<prop k="size" v="69"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="Pixel"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="125,139,143,255" type="QString"/>
<Option name="name" value="https://upload.wikimedia.org/wikipedia/commons/6/67/OpenLayers_logo.svg" type="QString"/>
<Option name="size" value="69" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="Pixel" type="QString"/>
</Option>
</layer>
</symbol>
</symbols>
Expand Down
48 changes: 26 additions & 22 deletions data/qmls/point_multiple_symbols.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,34 @@
<symbols>
<symbol type="marker" name="0">
<layer class="SimpleMarker">
<prop k="angle" v="0"/>
<prop k="color" v="75,255,126,255"/>
<prop k="name" v="square"/>
<prop k="outline_color" v="0,0,0,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="1"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="Pixel"/>
<prop k="size" v="24"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="Pixel"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="75,255,126,255" type="QString"/>
<Option name="name" value="square" type="QString"/>
<Option name="outline_color" value="0,0,0,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="1" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="Pixel" type="QString"/>
<Option name="size" value="24" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="Pixel" type="QString"/>
</Option>
</layer>
<layer class="SimpleMarker">
<prop k="angle" v="0"/>
<prop k="color" v="255,0,0,255"/>
<prop k="name" v="circle"/>
<prop k="outline_color" v="35,35,35,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0"/>
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="outline_width_unit" v="Pixel"/>
<prop k="size" v="4"/>
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="size_unit" v="Pixel"/>
<Option type="Map">
<Option name="angle" value="0" type="QString"/>
<Option name="color" value="255,0,0,255" type="QString"/>
<Option name="name" value="circle" type="QString"/>
<Option name="outline_color" value="35,35,35,255" type="QString"/>
<Option name="outline_style" value="solid" type="QString"/>
<Option name="outline_width" value="0" type="QString"/>
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="outline_width_unit" value="Pixel" type="QString"/>
<Option name="size" value="4" type="QString"/>
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
<Option name="size_unit" value="Pixel" type="QString"/>
</Option>
</layer>
</symbol>
</symbols>
Expand Down
Loading

0 comments on commit 57acf11

Please sign in to comment.