diff --git a/resources/rendertheme.xsd b/resources/rendertheme.xsd index a388561f..0bf0aac9 100644 --- a/resources/rendertheme.xsd +++ b/resources/rendertheme.xsd @@ -237,9 +237,11 @@ + + diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java index 0d96f4dd..2097253e 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java @@ -1,6 +1,6 @@ /* * Copyright 2013 Hannes Janetzek - * Copyright 2016 devemux86 + * Copyright 2016-2019 devemux86 * Copyright 2018 Gustl22 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). @@ -522,7 +522,8 @@ public class LabelPlacement { s.texRegion = ti.texRegion; s.x = x; s.y = y; - s.billboard = true; + s.billboard = ti.billboard; + s.rotation = ti.rotation; sl.addSymbol(s); } } diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java b/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java index 4a3e4862..f6bf1f2e 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java @@ -1,7 +1,7 @@ /* * Copyright 2010, 2011, 2012, 2013 mapsforge.org * Copyright 2013 Hannes Janetzek - * Copyright 2018 devemux86 + * Copyright 2018-2019 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -63,20 +63,19 @@ public final class WayDecorator { previousX += diffX * segmentSkipPercentage; previousY += diffY * segmentSkipPercentage; - // TODO - /*if (rotate) { + if (symbol.rotate) { // if we do not rotate theta will be 0, which is correct - theta = (float) Math.atan2(currentY - previousY, currentX - previousX); - }*/ + theta = (float) Math.toDegrees(Math.atan2(currentY - previousY, currentX - previousX)); + } float x = previousX; float y = previousY; if (x >= 0 && x <= Tile.SIZE && y >= 0 && y <= Tile.SIZE) { SymbolItem s = SymbolItem.pool.get(); if (symbol.bitmap != null) - s.set(x, y, symbol.bitmap, 0, true); + s.set(x, y, symbol.bitmap, theta, symbol.billboard); else - s.set(x, y, symbol.texture, 0, true); + s.set(x, y, symbol.texture, theta, symbol.billboard); ld.symbols.push(s); } diff --git a/vtm/src/org/oscim/theme/XmlThemeBuilder.java b/vtm/src/org/oscim/theme/XmlThemeBuilder.java index c410c203..2adf60c8 100644 --- a/vtm/src/org/oscim/theme/XmlThemeBuilder.java +++ b/vtm/src/org/oscim/theme/XmlThemeBuilder.java @@ -1163,6 +1163,9 @@ public class XmlThemeBuilder extends DefaultHandler { else if ("symbol-scaling".equals(name)) ; // no-op + else if ("billboard".equals(name)) + b.billboard(Boolean.parseBoolean(value)); + else if ("repeat".equals(name)) b.repeat(Boolean.parseBoolean(value)); @@ -1172,6 +1175,9 @@ public class XmlThemeBuilder extends DefaultHandler { else if ("repeat-gap".equals(name)) b.repeatGap = Float.parseFloat(value) * mScale; + else if ("rotate".equals(name)) + b.rotate(Boolean.parseBoolean(value)); + else logUnknownAttribute(elementName, name, value, i); } diff --git a/vtm/src/org/oscim/theme/styles/SymbolStyle.java b/vtm/src/org/oscim/theme/styles/SymbolStyle.java index 807ba87f..53192009 100644 --- a/vtm/src/org/oscim/theme/styles/SymbolStyle.java +++ b/vtm/src/org/oscim/theme/styles/SymbolStyle.java @@ -1,7 +1,7 @@ /* * Copyright 2010, 2011, 2012 mapsforge.org * Copyright 2013 Hannes Janetzek - * Copyright 2016-2018 devemux86 + * Copyright 2016-2019 devemux86 * Copyright 2017 Longri * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). @@ -38,9 +38,11 @@ public final class SymbolStyle extends RenderStyle { public final int symbolHeight; public final int symbolPercent; + public final boolean billboard; public final boolean repeat; public final float repeatStart; public final float repeatGap; + public final boolean rotate; public SymbolStyle(Bitmap bitmap) { this(bitmap, null, 0); @@ -63,9 +65,11 @@ public final class SymbolStyle extends RenderStyle { this.symbolHeight = 0; this.symbolPercent = 100; + this.billboard = false; this.repeat = false; this.repeatStart = REPEAT_START_DEFAULT; this.repeatGap = REPEAT_GAP_DEFAULT; + this.rotate = true; } public SymbolStyle(SymbolBuilder b) { @@ -79,9 +83,11 @@ public final class SymbolStyle extends RenderStyle { this.symbolHeight = b.symbolHeight; this.symbolPercent = b.symbolPercent; + this.billboard = b.billboard; this.repeat = b.repeat; this.repeatStart = b.repeatStart; this.repeatGap = b.repeatGap; + this.rotate = b.rotate; } @Override @@ -115,9 +121,11 @@ public final class SymbolStyle extends RenderStyle { public int symbolHeight; public int symbolPercent; + public boolean billboard; public boolean repeat; public float repeatStart; public float repeatGap; + public boolean rotate; public SymbolBuilder() { } @@ -136,9 +144,11 @@ public final class SymbolStyle extends RenderStyle { this.symbolHeight = symbol.symbolHeight; this.symbolPercent = symbol.symbolPercent; + this.billboard = symbol.billboard; this.repeat = symbol.repeat; this.repeatStart = symbol.repeatStart; this.repeatGap = symbol.repeatGap; + this.rotate = symbol.rotate; return self(); } @@ -173,6 +183,11 @@ public final class SymbolStyle extends RenderStyle { return self(); } + public T billboard(boolean billboard) { + this.billboard = billboard; + return self(); + } + public T repeat(boolean repeat) { this.repeat = repeat; return self(); @@ -188,6 +203,11 @@ public final class SymbolStyle extends RenderStyle { return self(); } + public T rotate(boolean rotate) { + this.rotate = rotate; + return self(); + } + public T reset() { cat = null; @@ -199,9 +219,11 @@ public final class SymbolStyle extends RenderStyle { symbolHeight = 0; symbolPercent = 100; + billboard = false; repeat = false; repeatStart = REPEAT_START_DEFAULT; repeatGap = REPEAT_GAP_DEFAULT; + rotate = true; return self(); }