Skip to content

Commit

Permalink
Merge pull request #7961 from tudorbarascu/fix_sld
Browse files Browse the repository at this point in the history
fix stroke Width sld import
  • Loading branch information
pblottiere authored Sep 21, 2018
2 parents 2869681 + 1955ebb commit 2807c2f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/symbology/qgsmarkersymbollayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ QgsSymbolLayer *QgsSimpleMarkerSymbolLayer::createFromSld( QDomElement &element
m->setAngle( angle );
m->setOffset( offset );
m->setStrokeStyle( strokeStyle );
m->setStrokeWidth( strokeWidth );
return m;
}

Expand Down
52 changes: 52 additions & 0 deletions tests/src/python/test_qgsserver_wms_getmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,58 @@ def test_wms_getmap_highlight(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Highlight")

def test_wms_getmap_highlight_point(self):
# checks SLD stroke-width works for Points See issue 19795 comments
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country_Labels",
"HIGHLIGHT_GEOM": "POINT(-6250000 8055310)",
"HIGHLIGHT_SYMBOL": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><StyledLayerDescriptor xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.1.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xsi:schemaLocation=\"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd\" xmlns:se=\"http://www.opengis.net/se\"><UserStyle><se:FeatureTypeStyle><se:Rule><se:PointSymbolizer><se:Graphic><se:Mark><se:WellKnownName>circle</se:WellKnownName><se:Stroke><se:SvgParameter name=\"stroke\">%23ff0000</se:SvgParameter><se:SvgParameter name=\"stroke-opacity\">1</se:SvgParameter><se:SvgParameter name=\"stroke-width\">7.5</se:SvgParameter></se:Stroke><se:Fill><se:SvgParameter name=\"fill\">%237bdcb5</se:SvgParameter><se:SvgParameter name=\"fill-opacity\">1</se:SvgParameter></se:Fill></se:Mark><se:Size>28.4</se:Size></se:Graphic></se:PointSymbolizer></se:Rule></se:FeatureTypeStyle></UserStyle></StyledLayerDescriptor>",
"HIGHLIGHT_LABELSTRING": "Highlight Point :)",
"HIGHLIGHT_LABELSIZE": "16",
"HIGHLIGHT_LABELCOLOR": "%2300FF0000",
"HIGHLIGHT_LABELBUFFERCOLOR": "%232300FF00",
"HIGHLIGHT_LABELBUFFERSIZE": "1.2",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Highlight_Point")

# TODO make Server Getmap work with SLD Highlight feature and enable test
@unittest.expectedFailure
def test_wms_getmap_highlight_line(self):
# checks SLD stroke-width works for Lines See issue 19795 comments
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "Country_Labels",
"HIGHLIGHT_GEOM": "LINESTRING(-15000000 8055310, 2500000 8055310)",
"HIGHLIGHT_SYMBOL": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><StyledLayerDescriptor xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.1.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xsi:schemaLocation=\"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd\" xmlns:se=\"http://www.opengis.net/se\"><UserStyle><se:FeatureTypeStyle><se:Rule><se:LineSymbolizer><se:Stroke><se:SvgParameter name=\"stroke\">%23ff0000</se:SvgParameter><se:SvgParameter name=\"stroke-opacity\">1</se:SvgParameter><se:SvgParameter name=\"stroke-width\">17.3</se:SvgParameter><se:SvgParameter name=\"stroke-linejoin\">bevel</se:SvgParameter></se:Stroke></se:LineSymbolizer></se:Rule></se:FeatureTypeStyle></UserStyle></StyledLayerDescriptor>",
"HIGHLIGHT_LABELSTRING": "",
"HIGHLIGHT_LABELSIZE": "10",
"HIGHLIGHT_LABELCOLOR": "black",
"HIGHLIGHT_LABELBUFFERCOLOR": "white",
"HIGHLIGHT_LABELBUFFERSIZE": "1",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Highlight_Line")

def test_wms_getmap_annotations(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectAnnotationPath),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2807c2f

Please sign in to comment.