Skip to content

Commit e2dc145

Browse files
committed
Add rendering of <Mark> and <ExternalGraphic> in <LineSymbolizer>
1 parent be60036 commit e2dc145

7 files changed

Lines changed: 136 additions & 3 deletions

File tree

mapogcsld.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,16 +1789,25 @@ int msSLDParseGraphicFillOrStroke(CPLXMLNode *psRoot,
17891789
strcasecmp(psName, "stroke") == 0) {
17901790
if(psCssParam->psChild && psCssParam->psChild->psNext)
17911791
{
1792-
msSLDParseOgcExpression(psCssParam->psChild->psNext,
1793-
psStyle, MS_STYLE_BINDING_OUTLINECOLOR, MS_OBJ_STYLE);
1792+
if (bFilled) {
1793+
msSLDParseOgcExpression(psCssParam->psChild->psNext,
1794+
psStyle, MS_STYLE_BINDING_OUTLINECOLOR, MS_OBJ_STYLE);
1795+
} else {
1796+
msSLDParseOgcExpression(psCssParam->psChild->psNext,
1797+
psStyle, MS_STYLE_BINDING_COLOR, MS_OBJ_STYLE);
1798+
}
17941799
}
17951800
} else if (psName &&
17961801
strcasecmp(psName, "stroke-opacity") == 0) {
17971802
if(psCssParam->psChild && psCssParam->psChild->psNext)
17981803
{
17991804
psValue = psCssParam->psChild->psNext->pszValue;
18001805
if (psValue) {
1801-
psStyle->outlinecolor.alpha = (int)(atof(psValue)*255);
1806+
if (bFilled) {
1807+
psStyle->outlinecolor.alpha = (int)(atof(psValue)*255);
1808+
} else {
1809+
psStyle->color.alpha = (int)(atof(psValue)*255);
1810+
}
18021811
}
18031812
}
18041813
} else if (psName &&

msautotest/sld/data/bg.tif

23.9 KB
Binary file not shown.

msautotest/sld/data/danube.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ "type":"FeatureCollection",
2+
"features":[{
3+
"type":"Feature",
4+
"properties":{},
5+
"geometry":{
6+
"type":"LineString",
7+
"coordinates":[[8.52,47.95],[8.82,47.98],[9.22,48.09],[9.70,48.23],
8+
[10.00,48.39],[10.50,48.57],[10.79,48.71],[11.04,48.73],
9+
[11.41,48.75],[11.80,48.89],[12.07,49.03],[12.37,48.97],
10+
[12.77,48.84],[13.08,48.72],[13.47,48.57],[13.92,48.45],
11+
[14.31,48.32],[14.71,48.17],[15.34,48.24],[16.01,48.34],
12+
[16.53,48.15],[17.14,48.11],[17.81,47.74],[18.35,47.74],
13+
[19.07,47.81],[19.06,47.46],[18.95,46.96],[18.93,46.19],
14+
[18.93,45.54],[19.42,45.23],[19.91,45.25],[20.44,44.84],
15+
[21.36,44.82],[22.07,44.50],[22.69,44.52],[22.96,44.00],
16+
[23.70,43.80],[24.80,43.71],[25.57,43.64],[26.35,44.03],
17+
[27.27,44.12],[28.04,44.37],[27.90,45.03],[28.09,45.44],
18+
[28.74,45.23],[29.60,45.06]]}}]}

msautotest/sld/data/ship.svg

Lines changed: 10 additions & 0 deletions
Loading
47.3 KB
Loading
47.3 KB
Loading

msautotest/sld/linemark.map

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#
2+
# Test LINEMARK
3+
#
4+
# REQUIRES: INPUT=GDAL OUTPUT=PNG SUPPORTS=WMS
5+
#
6+
#
7+
# --- Reference output rendered with MapFile only
8+
#
9+
# 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]
10+
#
11+
#
12+
# --- Reference output rendered with SLD
13+
#
14+
# 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]
15+
#
16+
17+
18+
19+
MAP
20+
21+
NAME LINEMARK
22+
SIZE 720 300
23+
IMAGECOLOR 100 100 100
24+
FONTSET "data/fonts.lst"
25+
PROJECTION
26+
"init=epsg:4326"
27+
END
28+
WEB
29+
IMAGEPATH "/tmp/ms_tmp/"
30+
IMAGEURL "/ms_tmp/"
31+
METADATA
32+
"wms_title" "Test SLD"
33+
"wms_onlineresource" "http://localhost/path/to/wms_simple?"
34+
"wms_srs" "EPSG:4326"
35+
"ows_schemas_location" "http://ogc.dmsolutions.ca"
36+
"ows_enable_request" "*"
37+
"ows_sld_enabled" "true"
38+
END
39+
VALIDATION
40+
"sld_external_graphic" "^.*/sld/data/.*"
41+
END
42+
END
43+
44+
LAYER
45+
NAME "bg"
46+
DATA "data/bg.tif"
47+
TYPE RASTER
48+
STATUS ON
49+
END
50+
51+
LAYER
52+
NAME "danube"
53+
CONNECTIONTYPE OGR
54+
CONNECTION "data/danube.json"
55+
STATUS ON
56+
TYPE LINE
57+
SIZEUNITS pixels
58+
CLASS
59+
STYLE
60+
WIDTH 5
61+
COLOR 0 0 255
62+
END
63+
STYLE
64+
SYMBOL "circle"
65+
COLOR 255 255 0
66+
SIZE 10
67+
WIDTH 2
68+
GAP 80
69+
INITIALGAP 40
70+
END
71+
STYLE
72+
SYMBOL "ship"
73+
SIZE 30
74+
GAP 80
75+
INITIALGAP 0
76+
END
77+
END
78+
END
79+
80+
SYMBOL
81+
NAME "ship"
82+
TYPE svg
83+
IMAGE "data/ship.svg"
84+
END
85+
86+
SYMBOL
87+
NAME "circle"
88+
TYPE ellipse
89+
FILLED false
90+
POINTS
91+
1 1
92+
END
93+
END
94+
95+
96+
END

0 commit comments

Comments
 (0)