-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add implementation of WellKnownName type
svgpath://
reusing existin…
…g batik dependency includes documentation and unit test
- Loading branch information
Showing
7 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
.../test/resources/org/deegree/rendering/r2d/similaritytests/point_wellknownname_svgpath.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<gml:FeatureCollection id="FC_1" | ||
xmlns:gml="http://www.opengis.net/gml/3.2" | ||
xmlns="http://deegree.org/app" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.opengis.net/gml/3.2 https://schemas.opengis.net/gml/3.2.1/gml.xsd"> | ||
<gml:boundedBy> | ||
<gml:Envelope srsName="EPSG:25832"> | ||
<gml:lowerCorner>0.0 0.0</gml:lowerCorner> | ||
<gml:upperCorner>100.0 100.0</gml:upperCorner> | ||
</gml:Envelope> | ||
</gml:boundedBy> | ||
<gml:featureMember> | ||
<Object gml:id="FEATURE_1"> | ||
<id>1</id> | ||
<name>dummy</name> | ||
<geom> | ||
<gml:Point xmlns:gml="http://www.opengis.net/gml/3.2" gml:id="GML_1"> | ||
<gml:pos>50.000000 50.000000</gml:pos> | ||
</gml:Point> | ||
</geom> | ||
</Object> | ||
</gml:featureMember> | ||
</gml:FeatureCollection> |
Binary file added
BIN
+506 Bytes
...urces/org/deegree/rendering/r2d/similaritytests/point_wellknownname_svgpath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
.../test/resources/org/deegree/rendering/r2d/similaritytests/point_wellknownname_svgpath.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<FeatureTypeStyle xmlns="http://www.opengis.net/se" | ||
xmlns:ogc="http://www.opengis.net/ogc" | ||
xmlns:app="http://www.deegree.org/app" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"> | ||
|
||
<Rule> | ||
<PointSymbolizer><Graphic><Mark><WellKnownName>svgpath://m 8,14 0,-6 h -4.5 c 0,0 0,-7.5 6.6,-7.5 6,0 6.5,7.5 6.6,7.5 l -4.5,0 0,6 z m -4,0 v -2 h 2 v 2 z</WellKnownName><Fill><SvgParameter name="fill">#FF0000</SvgParameter><SvgParameter name="fill-opacity">0.4</SvgParameter></Fill><Stroke><SvgParameter name="stroke">#000000</SvgParameter><SvgParameter name="stroke-width">1</SvgParameter></Stroke></Mark><Size>40</Size> | ||
<Displacement><DisplacementX>0</DisplacementX><DisplacementY>0</DisplacementY></Displacement></Graphic></PointSymbolizer> | ||
</Rule> | ||
</FeatureTypeStyle> |
78 changes: 78 additions & 0 deletions
78
...ee-core/deegree-core-style/src/main/java/org/deegree/style/styling/wkn/SvgPathLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/*---------------------------------------------------------------------------- | ||
This file is part of deegree, http://deegree.org/ | ||
Copyright (C) 2022 by: | ||
- grit graphische Informationstechnik Beratungsgesellschaft mbH - | ||
This library is free software; you can redistribute it and/or modify it under | ||
the terms of the GNU Lesser General Public License as published by the Free | ||
Software Foundation; either version 2.1 of the License, or (at your option) | ||
any later version. | ||
This library is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this library; if not, write to the Free Software Foundation, Inc., | ||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
Contact information: | ||
grit graphische Informationstechnik Beratungsgesellschaft mbH | ||
Landwehrstr. 143, 59368 Werne | ||
Germany | ||
http://www.grit.de/ | ||
lat/lon GmbH | ||
Aennchenstr. 19, 53177 Bonn | ||
Germany | ||
http://lat-lon.de/ | ||
Department of Geography, University of Bonn | ||
Prof. Dr. Klaus Greve | ||
Postfach 1147, 53001 Bonn | ||
Germany | ||
http://www.geographie.uni-bonn.de/deegree/ | ||
e-mail: info@deegree.org | ||
----------------------------------------------------------------------------*/ | ||
package org.deegree.style.styling.wkn; | ||
|
||
import java.awt.Shape; | ||
import java.net.URL; | ||
import java.util.function.Function; | ||
|
||
import org.apache.batik.parser.AWTPathProducer; | ||
import org.apache.batik.parser.ParseException; | ||
import org.apache.batik.parser.PathParser; | ||
import org.deegree.style.styling.mark.WellKnownNameLoader; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class SvgPathLoader implements WellKnownNameLoader { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger( SvgPathLoader.class ); | ||
|
||
public static final String PREFIX = "svgpath://"; | ||
|
||
@Override | ||
public Shape parse( String wellKnownName, Function<String, URL> resolver ) { | ||
if ( wellKnownName == null || !wellKnownName.startsWith( PREFIX ) ) | ||
return null; | ||
|
||
String wkn = wellKnownName.substring( PREFIX.length() ); | ||
|
||
Shape s = null; | ||
AWTPathProducer pathProducer = new AWTPathProducer(); | ||
PathParser pp = new PathParser(); | ||
pp.setPathHandler( pathProducer ); | ||
try { | ||
pp.parse( wkn ); | ||
s = pathProducer.getShape(); | ||
} catch ( ParseException ex ) { | ||
LOG.warn( "Could not Parse SVGPath {}: {}", wkn, ex.getMessage() ); | ||
LOG.trace( "Exception", ex ); | ||
} | ||
|
||
return s; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+679 Bytes
...ebservices-handbook/src/main/asciidoc/images/se_wkn_example/svgpath_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters