Skip to content

Commit

Permalink
SVG Salamander (JitPack), fix #1078
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Aug 12, 2018
1 parent 24060bb commit 9ba4cef
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ subprojects {
google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://jitpack.io' }
}

tasks.withType(JavaCompile) {
Expand Down
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- MapViewPosition interface [#1044](https://github.com/mapsforge/mapsforge/pull/1044)
- Android 9 compatibility [#1066](https://github.com/mapsforge/mapsforge/issues/1066)
- JTS (LocationTech) [#1027](https://github.com/mapsforge/mapsforge/issues/1027)
- SVG Salamander (JitPack) [#1078](https://github.com/mapsforge/mapsforge/issues/1078)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/mapsforge/issues?q=is%3Aclosed+milestone%3A0.10.0)

Expand Down
2 changes: 1 addition & 1 deletion docs/Getting-Started-Developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Extra Java components:

- mapsforge-map-awt: a Java-only library to display mapsforge maps.
- mapsforge-poi-awt: java specific poi elements.
- [svg-salamander](https://svgsalamander.java.net/): SVG library for displaying SVG files as icons. Improved jar can be found at the site.
- [svg-salamander](https://github.com/blackears/svgSalamander): SVG library for displaying SVG files as icons.
- [xerial/sqlite-jdbc](https://github.com/xerial/sqlite-jdbc): SQLite JDBC library.

### Branches
Expand Down
6 changes: 5 additions & 1 deletion docs/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ implementation 'com.caverock:androidsvg:1.3-SNAPSHOT'

#### Desktop
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
implementation 'org.mapsforge:mapsforge-map-awt:[CURRENT-VERSION]'
implementation 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
implementation 'com.github.blackears:svgSalamander:v1.1.1'
```

### POI
Expand Down
2 changes: 1 addition & 1 deletion docs/Rendertheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ The display directive has been added whereever priorities can be used. The follo

## SVG Symbols

Symbols can be either defined in the raster PNG format or as vector graphics in SVG format. Mapsforge uses libraries (https://github.com/BigBadaboom/androidsvg on Android) and (https://svgsalamander.java.net on Java) that support a large subset of the Tiny SVG specification (see http://www.w3.org/TR/SVGTiny12/index.html).
Symbols can be either defined in the raster PNG format or as vector graphics in SVG format. Mapsforge uses libraries for [Android](https://github.com/BigBadaboom/androidsvg) and [Java](https://github.com/blackears/svgSalamander) that support a large subset of the [Tiny SVG](http://www.w3.org/TR/SVGTiny12/index.html) specification.

To speed up map rendering, SVG symbols are now only rendered at the point where they are needed and on Android are then written to disk in the PNG format. Subsequent uses will retrieve the file just like another raster image source. The file cache where these files are stored can be cleared through a static call.

Expand Down
2 changes: 1 addition & 1 deletion mapsforge-map-awt/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api project(":mapsforge-map-reader")
api 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
api 'com.github.blackears:svgSalamander:v1.1.1'
testImplementation project(":mapsforge-themes")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 devemux86
* Copyright 2015-2018 devemux86
*
* This program 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
Expand Down Expand Up @@ -63,8 +63,8 @@ public static BufferedImage getResourceBitmap(InputStream inputStream, String na

SVGIcon icon = new SVGIcon();
icon.setAntiAlias(true);
icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH);
icon.setPreferredSize(new Dimension((int) bitmapWidth, (int) bitmapHeight));
icon.setScaleToFit(true);
icon.setSvgURI(uri);
BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(null, bufferedImage.createGraphics(), 0, 0);
Expand Down

0 comments on commit 9ba4cef

Please sign in to comment.