Skip to content

Commit

Permalink
Add rendering of <Mark> and <ExternalGraphic> in <LineSymbolizer>
Browse files Browse the repository at this point in the history
  • Loading branch information
jbo-ads committed Feb 26, 2020
1 parent be60036 commit e2dc145
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mapogcsld.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,16 +1789,25 @@ int msSLDParseGraphicFillOrStroke(CPLXMLNode *psRoot,
strcasecmp(psName, "stroke") == 0) {
if(psCssParam->psChild && psCssParam->psChild->psNext)
{
msSLDParseOgcExpression(psCssParam->psChild->psNext,
psStyle, MS_STYLE_BINDING_OUTLINECOLOR, MS_OBJ_STYLE);
if (bFilled) {
msSLDParseOgcExpression(psCssParam->psChild->psNext,
psStyle, MS_STYLE_BINDING_OUTLINECOLOR, MS_OBJ_STYLE);
} else {
msSLDParseOgcExpression(psCssParam->psChild->psNext,
psStyle, MS_STYLE_BINDING_COLOR, MS_OBJ_STYLE);
}
}
} else if (psName &&
strcasecmp(psName, "stroke-opacity") == 0) {
if(psCssParam->psChild && psCssParam->psChild->psNext)
{
psValue = psCssParam->psChild->psNext->pszValue;
if (psValue) {
psStyle->outlinecolor.alpha = (int)(atof(psValue)*255);
if (bFilled) {
psStyle->outlinecolor.alpha = (int)(atof(psValue)*255);
} else {
psStyle->color.alpha = (int)(atof(psValue)*255);
}
}
}
} else if (psName &&
Expand Down
Binary file added msautotest/sld/data/bg.tif
Binary file not shown.
18 changes: 18 additions & 0 deletions msautotest/sld/data/danube.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ "type":"FeatureCollection",
"features":[{
"type":"Feature",
"properties":{},
"geometry":{
"type":"LineString",
"coordinates":[[8.52,47.95],[8.82,47.98],[9.22,48.09],[9.70,48.23],
[10.00,48.39],[10.50,48.57],[10.79,48.71],[11.04,48.73],
[11.41,48.75],[11.80,48.89],[12.07,49.03],[12.37,48.97],
[12.77,48.84],[13.08,48.72],[13.47,48.57],[13.92,48.45],
[14.31,48.32],[14.71,48.17],[15.34,48.24],[16.01,48.34],
[16.53,48.15],[17.14,48.11],[17.81,47.74],[18.35,47.74],
[19.07,47.81],[19.06,47.46],[18.95,46.96],[18.93,46.19],
[18.93,45.54],[19.42,45.23],[19.91,45.25],[20.44,44.84],
[21.36,44.82],[22.07,44.50],[22.69,44.52],[22.96,44.00],
[23.70,43.80],[24.80,43.71],[25.57,43.64],[26.35,44.03],
[27.27,44.12],[28.04,44.37],[27.90,45.03],[28.09,45.44],
[28.74,45.23],[29.60,45.06]]}}]}
10 changes: 10 additions & 0 deletions msautotest/sld/data/ship.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added msautotest/sld/expected/map_linemark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added msautotest/sld/expected/sld_linemark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions msautotest/sld/linemark.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#
# Test LINEMARK
#
# REQUIRES: INPUT=GDAL OUTPUT=PNG SUPPORTS=WMS
#
#
# --- Reference output rendered with MapFile only
#
# RUN_PARMS: map_linemark.png [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3&REQUEST=GetMap&CRS=EPSG:4326&BBOX=40,7,50,31&FORMAT=image/png&WIDTH=720&HEIGHT=300&LAYERS=bg,danube" > [RESULT_DEMIME]
#
#
# --- Reference output rendered with SLD
#
# RUN_PARMS: sld_linemark.png [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WMS&VERSION=1.3&REQUEST=GetMap&CRS=EPSG:4326&BBOX=40,7,50,31&FORMAT=image/png&WIDTH=720&HEIGHT=300&LAYERS=bg,danube&SLD_BODY=<StyledLayerDescriptor version=%221.1.0%22><NamedLayer><Name>danube</Name><UserStyle><FeatureTypeStyle><Rule><LineSymbolizer><Stroke><SvgParameter name=%22stroke-width%22>5</SvgParameter><SvgParameter name=%22stroke%22>#0000FF</SvgParameter></Stroke></LineSymbolizer><LineSymbolizer><Stroke><GraphicStroke><Graphic><Size>10</Size><Mark><WellKnownName>circle</WellKnownName><Stroke><SvgParameter name=%22stroke%22>#FFFF00</SvgParameter><SvgParameter name=%22stroke-width%22>2</SvgParameter></Stroke></Mark></Graphic><Gap>80</Gap><InitialGap>40</InitialGap></GraphicStroke></Stroke></LineSymbolizer><LineSymbolizer><Stroke><GraphicStroke><Graphic><Size>30</Size><ExternalGraphic><OnlineResource xlink:type=%22simple%22 xlink:href=%22http://localhost:8000/sld/data/ship.svg%22 /><Format>image/svg%2Bxml</Format></ExternalGraphic></Graphic><Gap>80</Gap><InitialGap>0</InitialGap></GraphicStroke></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>" > [RESULT_DEMIME]
#



MAP

NAME LINEMARK
SIZE 720 300
IMAGECOLOR 100 100 100
FONTSET "data/fonts.lst"
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
VALIDATION
"sld_external_graphic" "^.*/sld/data/.*"
END
END

LAYER
NAME "bg"
DATA "data/bg.tif"
TYPE RASTER
STATUS ON
END

LAYER
NAME "danube"
CONNECTIONTYPE OGR
CONNECTION "data/danube.json"
STATUS ON
TYPE LINE
SIZEUNITS pixels
CLASS
STYLE
WIDTH 5
COLOR 0 0 255
END
STYLE
SYMBOL "circle"
COLOR 255 255 0
SIZE 10
WIDTH 2
GAP 80
INITIALGAP 40
END
STYLE
SYMBOL "ship"
SIZE 30
GAP 80
INITIALGAP 0
END
END
END

SYMBOL
NAME "ship"
TYPE svg
IMAGE "data/ship.svg"
END

SYMBOL
NAME "circle"
TYPE ellipse
FILLED false
POINTS
1 1
END
END


END

0 comments on commit e2dc145

Please sign in to comment.