-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rendering of dashed polygons #1194
Closed
dstenger
wants to merge
2
commits into
deegree:main
from
lat-lon:bugfix/rendering-fixes-dee-351-197-7692
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
111 changes: 111 additions & 0 deletions
111
...ree-core/deegree-core-style/src/main/java/org/deegree/style/utils/SvgImageTranscoder.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,111 @@ | ||
/*---------------------------------------------------------------------------- | ||
This file is part of deegree, http://deegree.org/ | ||
Copyright (C) 2001-2010 by: | ||
- Department of Geography, University of Bonn - | ||
and | ||
- lat/lon GmbH - | ||
and | ||
- 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: [email protected] | ||
----------------------------------------------------------------------------*/ | ||
package org.deegree.style.utils; | ||
|
||
import java.awt.image.BufferedImage; | ||
import java.io.InputStream; | ||
|
||
import org.apache.batik.transcoder.TranscoderException; | ||
import org.apache.batik.transcoder.TranscoderOutput; | ||
import org.apache.batik.transcoder.XMLAbstractTranscoder; | ||
import org.apache.batik.transcoder.image.ImageTranscoder; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class SvgImageTranscoder extends ImageTranscoder { | ||
|
||
public class SvgImageOutput extends TranscoderOutput { | ||
|
||
private BufferedImage image; | ||
|
||
public SvgImageOutput() { | ||
} | ||
|
||
public BufferedImage getBufferedImage() { | ||
return this.image; | ||
} | ||
|
||
public void setImage( BufferedImage image ) { | ||
this.image = image; | ||
} | ||
} | ||
|
||
static final Logger LOG = LoggerFactory.getLogger( SvgImageTranscoder.class ); | ||
|
||
public SvgImageTranscoder() { | ||
super(); | ||
} | ||
|
||
public void setXmlParserClass( String clsName ) { | ||
addTranscodingHint( XMLAbstractTranscoder.KEY_XML_PARSER_CLASSNAME, clsName ); | ||
} | ||
|
||
@Override | ||
public BufferedImage createImage( int w, int h ) { | ||
return new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB ); | ||
} | ||
|
||
@Override | ||
public void writeImage( BufferedImage image, TranscoderOutput output ) | ||
throws TranscoderException { | ||
if ( !( output instanceof SvgImageOutput ) ) { | ||
throw new TranscoderException( "TranscoderOutput has to be of type BuffferedImageOutput" ); | ||
} | ||
|
||
( (SvgImageOutput) output ).setImage( image ); | ||
} | ||
|
||
public void transcode( InputStream input, String fileName, SvgImageOutput output ) | ||
throws TranscoderException { | ||
long ts, te; | ||
ts = System.currentTimeMillis(); | ||
|
||
super.transcode( new org.apache.batik.transcoder.TranscoderInput( input ), output ); | ||
|
||
te = System.currentTimeMillis(); | ||
LOG.info( "Loaded svg '{}' in {} ms", fileName, ( te - ts ) ); | ||
} | ||
|
||
public SvgImageOutput createOutput() { | ||
return new SvgImageOutput(); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xerces has been removed from some modules from the compile time dependencies with PR #999. The direct import should be avoided. If possible any use of Xerces should be avoided.