VTM map scaling improvements, fix #401
This commit is contained in:
@@ -59,11 +59,6 @@ public abstract class CanvasAdapter {
|
||||
*/
|
||||
public static Platform platform = Platform.UNKNOWN;
|
||||
|
||||
/**
|
||||
* The scale.
|
||||
*/
|
||||
public static float scale = 1;
|
||||
|
||||
/**
|
||||
* The text scale.
|
||||
*/
|
||||
|
||||
@@ -169,8 +169,8 @@ public class XmlMapsforgeThemeBuilder extends DefaultHandler {
|
||||
public XmlMapsforgeThemeBuilder(ThemeFile theme, ThemeCallback themeCallback) {
|
||||
mTheme = theme;
|
||||
mThemeCallback = themeCallback;
|
||||
mScale = CanvasAdapter.scale + (CanvasAdapter.getScale() - 1);
|
||||
mScale2 = CanvasAdapter.scale + (CanvasAdapter.getScale() - 1) * 0.5f;
|
||||
mScale = CanvasAdapter.getScale();
|
||||
mScale2 = CanvasAdapter.getScale() * 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -704,7 +704,7 @@ public class XmlMapsforgeThemeBuilder extends DefaultHandler {
|
||||
else if ("stroke-width".equals(name)) {
|
||||
float strokeWidth = Float.parseFloat(value);
|
||||
validateNonNegative("stroke-width", strokeWidth);
|
||||
b.strokeWidth = strokeWidth * mScale2;
|
||||
b.strokeWidth = strokeWidth * mScale;
|
||||
|
||||
} else if ("fade".equals(name))
|
||||
b.fadeScale = Integer.parseInt(value);
|
||||
@@ -977,7 +977,7 @@ public class XmlMapsforgeThemeBuilder extends DefaultHandler {
|
||||
b.strokeColor = Color.parseColor(value);
|
||||
|
||||
else if ("stroke-width".equals(name))
|
||||
b.strokeWidth = Float.parseFloat(value) * mScale2;
|
||||
b.strokeWidth = Float.parseFloat(value) * mScale;
|
||||
|
||||
else if ("caption".equals(name))
|
||||
b.caption = Boolean.parseBoolean(value);
|
||||
@@ -1055,7 +1055,7 @@ public class XmlMapsforgeThemeBuilder extends DefaultHandler {
|
||||
String value = attributes.getValue(i);
|
||||
|
||||
if ("r".equals(name) || "radius".equals(name))
|
||||
b.radius(Float.parseFloat(value) * mScale2);
|
||||
b.radius(Float.parseFloat(value) * mScale);
|
||||
|
||||
else if ("cat".equals(name))
|
||||
b.cat(value);
|
||||
@@ -1070,7 +1070,7 @@ public class XmlMapsforgeThemeBuilder extends DefaultHandler {
|
||||
b.strokeColor(Color.parseColor(value));
|
||||
|
||||
else if ("stroke-width".equals(name))
|
||||
b.strokeWidth(Float.parseFloat(value) * mScale2);
|
||||
b.strokeWidth(Float.parseFloat(value) * mScale);
|
||||
|
||||
else
|
||||
logUnknownAttribute(elementName, name, value, i);
|
||||
|
||||
@@ -169,8 +169,8 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
public XmlThemeBuilder(ThemeFile theme, ThemeCallback themeCallback) {
|
||||
mTheme = theme;
|
||||
mThemeCallback = themeCallback;
|
||||
mScale = CanvasAdapter.scale + (CanvasAdapter.getScale() - 1);
|
||||
mScale2 = CanvasAdapter.scale + (CanvasAdapter.getScale() - 1) * 0.5f;
|
||||
mScale = CanvasAdapter.getScale();
|
||||
mScale2 = CanvasAdapter.getScale() * 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -702,7 +702,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
else if ("stroke-width".equals(name)) {
|
||||
float strokeWidth = Float.parseFloat(value);
|
||||
validateNonNegative("stroke-width", strokeWidth);
|
||||
b.strokeWidth = strokeWidth * mScale2;
|
||||
b.strokeWidth = strokeWidth * mScale;
|
||||
|
||||
} else if ("fade".equals(name))
|
||||
b.fadeScale = Integer.parseInt(value);
|
||||
@@ -975,7 +975,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
b.strokeColor = Color.parseColor(value);
|
||||
|
||||
else if ("stroke-width".equals(name))
|
||||
b.strokeWidth = Float.parseFloat(value) * mScale2;
|
||||
b.strokeWidth = Float.parseFloat(value) * mScale;
|
||||
|
||||
else if ("caption".equals(name))
|
||||
b.caption = Boolean.parseBoolean(value);
|
||||
@@ -1045,7 +1045,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
String value = attributes.getValue(i);
|
||||
|
||||
if ("r".equals(name) || "radius".equals(name))
|
||||
b.radius(Float.parseFloat(value) * mScale2);
|
||||
b.radius(Float.parseFloat(value) * mScale);
|
||||
|
||||
else if ("cat".equals(name))
|
||||
b.cat(value);
|
||||
@@ -1060,7 +1060,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
b.strokeColor(Color.parseColor(value));
|
||||
|
||||
else if ("stroke-width".equals(name))
|
||||
b.strokeWidth(Float.parseFloat(value) * mScale2);
|
||||
b.strokeWidth(Float.parseFloat(value) * mScale);
|
||||
|
||||
else
|
||||
logUnknownAttribute(elementName, name, value, i);
|
||||
|
||||
Reference in New Issue
Block a user