parent
c36d62e0d1
commit
fd092aa4dd
@ -562,7 +562,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
b.fixed = parseBoolean(value);
|
||||
|
||||
else if ("stipple".equals(name))
|
||||
b.stipple = Math.round(parseInt(value) * mScale * mStrokeScale);
|
||||
b.stipple = (int) (parseInt(value) * mScale * mStrokeScale);
|
||||
|
||||
else if ("stipple-stroke".equals(name))
|
||||
b.stippleColor(value);
|
||||
@ -615,12 +615,16 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
if (b.dashArray.length == 1) {
|
||||
b.randomOffset = false;
|
||||
b.stipple = b.dashArray[0] < 1 ? 1 : (int) b.dashArray[0];
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
b.stipple *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
b.stippleWidth = 1;
|
||||
b.stippleColor = Color.TRANSPARENT;
|
||||
b.dashArray = null;
|
||||
} else {
|
||||
// Min dash is 1
|
||||
float factor = 1;
|
||||
for (float f : b.dashArray) {
|
||||
if (0 < f && f < 1)
|
||||
factor = Math.max(factor, 1 / f);
|
||||
}
|
||||
// Odd number of entries is duplicated
|
||||
if (b.dashArray.length % 2 != 0) {
|
||||
float[] newDashArray = new float[b.dashArray.length * 2];
|
||||
@ -631,10 +635,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
int width = 0;
|
||||
int height = b.strokeWidth < 1 ? 1 : (int) b.strokeWidth;
|
||||
for (float f : b.dashArray) {
|
||||
if (f < 1)
|
||||
f = 1;
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
f *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
f *= factor;
|
||||
width += f;
|
||||
}
|
||||
Bitmap bitmap = CanvasAdapter.newBitmap(width, height, 0);
|
||||
@ -643,10 +644,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
int x = 0;
|
||||
boolean transparent = false;
|
||||
for (float f : b.dashArray) {
|
||||
if (f < 1)
|
||||
f = 1;
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
f *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
f *= factor;
|
||||
canvas.fillRectangle(x, 0, f, height, transparent ? Color.TRANSPARENT : Color.WHITE);
|
||||
x += f;
|
||||
transparent = !transparent;
|
||||
|
@ -398,20 +398,8 @@ public final class LineTexBucket extends LineBucket {
|
||||
GLUtils.setColor(shader.uColor, line.stippleColor, 1);
|
||||
GLUtils.setColor(shader.uBgColor, line.color, 1);
|
||||
|
||||
float pScale;
|
||||
if (s >= 1) {
|
||||
pScale = line.stipple * s;
|
||||
float cnt = pScale / line.stipple;
|
||||
pScale = line.stipple / (cnt + 1);
|
||||
} else {
|
||||
pScale = line.stipple / s;
|
||||
float cnt = pScale / line.stipple;
|
||||
pScale = line.stipple * cnt;
|
||||
}
|
||||
|
||||
//log.debug("pScale {} {}", pScale, s);
|
||||
|
||||
gl.uniform1f(shader.uPatternScale, COORD_SCALE * pScale);
|
||||
/* keep line stipple fixed */
|
||||
gl.uniform1f(shader.uPatternScale, (lb.scale * line.stipple) / (s + 1) * COORD_SCALE);
|
||||
|
||||
gl.uniform1f(shader.uPatternWidth, line.stippleWidth);
|
||||
|
||||
|
@ -582,7 +582,7 @@ public class XmlThemeBuilder {
|
||||
b.fixed = Boolean.parseBoolean(value);
|
||||
|
||||
else if ("stipple".equals(name))
|
||||
b.stipple = Math.round(Integer.parseInt(value) * mScale * mStrokeScale);
|
||||
b.stipple = (int) (Integer.parseInt(value) * mScale * mStrokeScale);
|
||||
|
||||
else if ("stipple-stroke".equals(name))
|
||||
b.stippleColor(value);
|
||||
@ -635,12 +635,16 @@ public class XmlThemeBuilder {
|
||||
if (b.dashArray.length == 1) {
|
||||
b.randomOffset = false;
|
||||
b.stipple = b.dashArray[0] < 1 ? 1 : (int) b.dashArray[0];
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
b.stipple *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
b.stippleWidth = 1;
|
||||
b.stippleColor = Color.TRANSPARENT;
|
||||
b.dashArray = null;
|
||||
} else {
|
||||
// Min dash is 1
|
||||
float factor = 1;
|
||||
for (float f : b.dashArray) {
|
||||
if (0 < f && f < 1)
|
||||
factor = Math.max(factor, 1 / f);
|
||||
}
|
||||
// Odd number of entries is duplicated
|
||||
if (b.dashArray.length % 2 != 0) {
|
||||
float[] newDashArray = new float[b.dashArray.length * 2];
|
||||
@ -651,10 +655,7 @@ public class XmlThemeBuilder {
|
||||
int width = 0;
|
||||
int height = b.strokeWidth < 1 ? 1 : (int) b.strokeWidth;
|
||||
for (float f : b.dashArray) {
|
||||
if (f < 1)
|
||||
f = 1;
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
f *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
f *= factor;
|
||||
width += f;
|
||||
}
|
||||
Bitmap bitmap = CanvasAdapter.newBitmap(width, height, 0);
|
||||
@ -663,10 +664,7 @@ public class XmlThemeBuilder {
|
||||
int x = 0;
|
||||
boolean transparent = false;
|
||||
for (float f : b.dashArray) {
|
||||
if (f < 1)
|
||||
f = 1;
|
||||
if (mTheme.isMapsforgeTheme())
|
||||
f *= Parameters.MAPSFORGE_DASH_FACTOR;
|
||||
f *= factor;
|
||||
canvas.fillRectangle(x, 0, f, height, transparent ? Color.TRANSPARENT : Color.WHITE);
|
||||
x += f;
|
||||
transparent = !transparent;
|
||||
|
@ -48,11 +48,6 @@ public final class Parameters {
|
||||
*/
|
||||
public static boolean MAP_EVENT_LAYER2 = false;
|
||||
|
||||
/**
|
||||
* Dash factor for Mapsforge themes.
|
||||
*/
|
||||
public static float MAPSFORGE_DASH_FACTOR = 1;
|
||||
|
||||
/**
|
||||
* If true the markers are sorted in y-axis.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user