Skip to content

Commit

Permalink
Merge pull request MapServer#7175 from rouault/RulePolygonSymbolizeRu…
Browse files Browse the repository at this point in the history
…leTextSymbolizer

SLD: fix having a TextSymbolizer rule after a PolygonSymbolizer one
  • Loading branch information
rouault authored Oct 18, 2024
2 parents e6a3c9e + 12dfa91 commit 8537ff4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion msautotest/sld/label.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# --- <Label> with <PropertyName>
#
# RUN_PARMS: sld_label_property.png [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3&REQUEST=GetMap&CRS=EPSG:4326&BBOX=42,-5,52,9&FORMAT=image/png&WIDTH=800&HEIGHT=800&LAYERS=main&SLD_BODY=<StyledLayerDescriptor version=%221.1.0%22><NamedLayer><se:Name>main</se:Name><UserStyle><se:FeatureTypeStyle><se:Rule><se:Name>green</se:Name><se:PolygonSymbolizer><se:Fill><se:SvgParameter name=%22fill%22>#00ff00</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name=%22stroke%22>#ffff00</se:SvgParameter><se:SvgParameter name=%22stroke-width%22>5.00</se:SvgParameter></se:Stroke></se:PolygonSymbolizer><TextSymbolizer><Label><PropertyName>NAME</PropertyName></Label><Font><SvgParameter name=%22font-family%22>vera</SvgParameter><SvgParameter name=%22font-weight%22>bold</SvgParameter><SvgParameter name=%22font-size%22>10</SvgParameter></Font><Fill><SvgParameter name=%22fill%22>#FFFFFF</SvgParameter></Fill><Halo><Radius>2</Radius><Fill><SvgParameter name=%22fill%22>#000000</SvgParameter></Fill></Halo></TextSymbolizer></se:Rule></se:FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>" > [RESULT_DEMIME]
# RUN_PARMS: sld_label_property.png [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3&REQUEST=GetMap&CRS=EPSG:4326&BBOX=42,-5,52,9&FORMAT=image/png&WIDTH=800&HEIGHT=800&LAYERS=main&SLD_BODY=<StyledLayerDescriptor version=%221.1.0%22><NamedLayer><se:Name>main</se:Name><UserStyle><se:FeatureTypeStyle><se:Rule><se:Name>green</se:Name><se:PolygonSymbolizer><se:Fill><se:SvgParameter name=%22fill%22>#00ff00</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name=%22stroke%22>#ffff00</se:SvgParameter><se:SvgParameter name=%22stroke-width%22>5.00</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><TextSymbolizer><Label><PropertyName>NAME</PropertyName></Label><Font><SvgParameter name=%22font-family%22>vera</SvgParameter><SvgParameter name=%22font-weight%22>bold</SvgParameter><SvgParameter name=%22font-size%22>10</SvgParameter></Font><Fill><SvgParameter name=%22fill%22>#FFFFFF</SvgParameter></Fill><Halo><Radius>2</Radius><Fill><SvgParameter name=%22fill%22>#000000</SvgParameter></Fill></Halo></TextSymbolizer></se:Rule></se:FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>" > [RESULT_DEMIME]
#
# --- <Label> with raw text
#
Expand Down
2 changes: 2 additions & 0 deletions src/mapogcsld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,8 @@ int msSLDParseRule(CPLXMLNode *psRoot, layerObj *psLayer,
/* - If there are no other symbolizers, a new class will be */
/* created to contain the label object. */
/* ==================================================================== */
if (psLayer->type == MS_LAYER_LINE || psLayer->type == MS_LAYER_POLYGON)
nSymbolizer++;
LOOP_ON_CHILD_ELEMENT(psRoot, psTextSymbolizer, "TextSymbolizer") {
if (nSymbolizer == 0)
psLayer->type = MS_LAYER_POINT;
Expand Down

0 comments on commit 8537ff4

Please sign in to comment.