Skip to content
Permalink
Browse files
Fix rendering bug when both RENDERMODE=ALL_MATCHING_CLASSES and GEOMT…
…RANSFORM "centroid" are used
  • Loading branch information
jbo-ads authored and jmckenna committed Mar 27, 2020
1 parent b006672 commit f9f13d8bfefd19c56306503e41585d4a7c27c9d6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 76 deletions.
@@ -1190,6 +1190,7 @@ int msDrawVectorLayer(mapObj *map, layerObj *layer, imageObj *image)
// Coordinates stored in the shape must keep their original values for
// the shape to be drawn multiple times.
// Here the original shape is restored.
msInitShape(&shape);
msCopyShape(&savedShape, &shape);
msFreeShape(&savedShape);
}
@@ -0,0 +1,32 @@
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION data/set.json
STATUS ON
SIZEUNITS pixels
CLASS
NAME all_green
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 255 0
END
END
CLASS
NAME red_3_5
EXPRESSION ([N_EDGES] >= 3 and [N_EDGES] <= 5)
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 255 0 0
END
END
CLASS
NAME blue_quadrilateral
EXPRESSION ([N_EDGES] == 4)
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 0 255
END
END

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,10 +1,20 @@
#
# REQUIRES: INPUT=GDAL OUTPUT=PNG SUPPORTS=WMS
#
# --- Mapfile: all polygons are green
#
# RUN_PARMS: map_painter_reference.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=multipolygon" > [RESULT_DEMIME]
#
# --- Mapfile with SLD-like rendering: polygons are green, red, blue
#
# RUN_PARMS: map_sldlike_painter_reference.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=sldlike_multipolygon" > [RESULT_DEMIME]
#
# --- Mapfile with SLD-like rendering and centroid geomtransform: polygons are green, red, blue, with a white dot at center
#
# RUN_PARMS: map_sldlikedot_painter_reference.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=sldlike_multipolygon_withdot" > [RESULT_DEMIME]
#
# --- SLD: polygons are green, red, blue
#
# RUN_PARMS: sld_painter_reference.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=multipolygon&SLD_BODY=<StyledLayerDescriptor version=%221.1.0%22><NamedLayer><se:Name>multipolygon</se:Name><UserStyle><se:FeatureTypeStyle><se:Rule><se:Name>all_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><se:Name>red_3_5</se:Name><ogc:Filter><ogc:And><ogc:PropertyIsLessThanOrEqualTo><ogc:PropertyName>N_EDGES</ogc:PropertyName><ogc:Literal>5</ogc:Literal></ogc:PropertyIsLessThanOrEqualTo><ogc:PropertyIsGreaterThanOrEqualTo><ogc:PropertyName>N_EDGES</ogc:PropertyName><ogc:Literal>3</ogc:Literal></ogc:PropertyIsGreaterThanOrEqualTo></ogc:And></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name=%22fill%22>#ff0000</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><se:Name>blue_quadrilateral</se:Name><ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>N_EDGES</ogc:PropertyName><ogc:Literal>4</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name=%22fill%22>#0000ff</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:FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>" > [RESULT_DEMIME]
#

@@ -14,92 +24,33 @@


MAP
NAME PAINTER
SIZE 300 300
IMAGECOLOR 100 100 100
PROJECTION
"init=epsg:4326"
END
WEB
IMAGEPATH "/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wms_title" "Test SLD"
"wms_onlineresource" "http://localhost/path/to/wms_simple?"
"wms_srs" "EPSG:4326"
"ows_schemas_location" "http://ogc.dmsolutions.ca"
"ows_enable_request" "*"
"ows_sld_enabled" "true"
END
END

INCLUDE "data/general.map.include"
INCLUDE "data/symbols.map.include"

LAYER
TYPE POLYGON
NAME multipolygon
CONNECTIONTYPE OGR
CONNECTION data/set.json
STATUS ON
SIZEUNITS pixels
CLASS
NAME all_green
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 255 0
END
END
CLASS
NAME red_3_5
EXPRESSION ([N_EDGES] >= 3 and [N_EDGES] <= 5)
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 255 0 0
END
END
CLASS
NAME blue_quadrilateral
EXPRESSION ([N_EDGES] == 4)
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 0 255
END
END
INCLUDE "data/multipolygon.map.include"
END

LAYER
TYPE POLYGON
NAME sldlike_multipolygon
PROCESSING "RENDERMODE=ALL_MATCHING_CLASSES"
CONNECTIONTYPE OGR
CONNECTION data/set.json
STATUS ON
SIZEUNITS pixels
CLASS
NAME all_green
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 255 0
END
END
CLASS
NAME red_3_5
EXPRESSION ([N_EDGES] >= 3 and [N_EDGES] <= 5)
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 255 0 0
END
END
INCLUDE "data/multipolygon.map.include"
END

LAYER
NAME sldlike_multipolygon_withdot
PROCESSING "RENDERMODE=ALL_MATCHING_CLASSES"
INCLUDE "data/multipolygon.map.include"
CLASS
NAME blue_quadrilateral
EXPRESSION ([N_EDGES] == 4)
NAME white_dot
STYLE
WIDTH 5
OUTLINECOLOR 255 255 0
COLOR 0 0 255
SYMBOL "circle"
GEOMTRANSFORM "centroid"
COLOR 255 255 255
OUTLINECOLOR 0 0 0
SIZE 20
END
END
END

0 comments on commit f9f13d8

Please sign in to comment.