diff --git a/docs/Changelog.md b/docs/Changelog.md index 7ad5da3b..2e1beb63 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -10,6 +10,7 @@ - SVG resources scaling in themes [#214](https://github.com/mapsforge/vtm/issues/214) - Circle map style [#122](https://github.com/mapsforge/vtm/issues/122) - Oneway arrows in themes [#275](https://github.com/mapsforge/vtm/issues/275) +- Texture atlas from bitmaps [#283](https://github.com/mapsforge/vtm/pull/283) - PathLayer (vtm) fix disappearing segments [#108](https://github.com/mapsforge/vtm/issues/108) - House numbers (nodes) fix visibility [#168](https://github.com/mapsforge/vtm/issues/168) - Android fix quick scale vs long press [#250](https://github.com/mapsforge/vtm/issues/250) @@ -21,7 +22,7 @@ - Internal render themes new SVG resources [#251](https://github.com/mapsforge/vtm/issues/251) - Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41) - Many other minor improvements and bug fixes -- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.7.0) +- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0) ## Version 0.6.0 (2016-10-28) -- VTM revive @@ -58,4 +59,4 @@ - LWJGL desktop libGDX backend [#129](https://github.com/mapsforge/vtm/issues/129) - SNAPSHOT builds publish to Sonatype OSSRH [#165](https://github.com/mapsforge/vtm/issues/165) - Many other minor improvements and bug fixes -- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.6.0) +- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0) diff --git a/vtm/src/org/oscim/utils/TextureAtlasUtils.java b/vtm/src/org/oscim/utils/TextureAtlasUtils.java index 88b9bf92..f7ad7a9f 100644 --- a/vtm/src/org/oscim/utils/TextureAtlasUtils.java +++ b/vtm/src/org/oscim/utils/TextureAtlasUtils.java @@ -20,11 +20,14 @@ import org.oscim.backend.canvas.Canvas; import org.oscim.renderer.atlas.TextureAtlas; import org.oscim.renderer.atlas.TextureRegion; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; -/** - * Created by Longri on 26.01.2017. - */ public class TextureAtlasUtils { private final static int MAX_ATLAS_SIZE = 1024; @@ -36,18 +39,19 @@ public class TextureAtlasUtils { * The List contains the generated TextureAtlas object, for disposing if no longer needed!
* With tha param disposeBitmap, all Bitmaps will released!
* With parameter flipY, the Atlas TextureItem will flipped over Y. (Is needed by iOS)
- * @param inputMap Map input Map with all Bitmaps, from which the regions are to be created - * @param outputMap Map contains all generated TextureRegions - * @param atlasList List contains all created TextureAtlases + * + * @param inputMap Map input Map with all Bitmaps, from which the regions are to be created + * @param outputMap Map contains all generated TextureRegions + * @param atlasList List contains all created TextureAtlases * @param disposeBitmaps boolean (will recycle all Bitmap's) - * @param flipY boolean (set True with iOS) + * @param flipY boolean (set True with iOS) */ public static void createTextureRegions(final Map inputMap, Map outputMap, List atlasList, boolean disposeBitmaps, boolean flipY) { // step 1: sort inputMap by Bitmap size List> list = - new LinkedList>(inputMap.entrySet()); + new LinkedList<>(inputMap.entrySet()); Collections.sort(list, new Comparator>() { public int compare(Map.Entry o1, Map.Entry o2) { @@ -59,7 +63,7 @@ public class TextureAtlasUtils { } }); - Map sortedByValues = new LinkedHashMap(); + Map sortedByValues = new LinkedHashMap<>(); for (Map.Entry entry : list) { sortedByValues.put(entry.getKey(), entry.getValue()); } @@ -88,7 +92,7 @@ public class TextureAtlasUtils { //step 4: calculate Regions(rectangles) and split to atlases - List atlases = new ArrayList(); + List atlases = new ArrayList<>(); atlases.add(new AtlasElement()); int atlasIndex = 0; int maxLineHeight = PAD; @@ -171,6 +175,6 @@ public class TextureAtlasUtils { private static class AtlasElement { int width = 0, height = 0; - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); } }