Fix rendering style

This commit is contained in:
Victor Shcherb 2014-06-19 22:39:45 +02:00
parent 51b83c5df9
commit 11280b62ba
3 changed files with 14 additions and 10 deletions

View file

@ -63,8 +63,12 @@ public class RenderingContext {
return val * density;
}
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, float defVal) {
return req.getFloatPropertyValue(prop, defVal) * density + req.getIntPropertyValue(prop, 0);
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, int defVal) {
return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, defVal);
}
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop) {
return req.getFloatPropertyValue(prop, 0) * density + req.getIntPropertyValue(prop, 0);
}
protected byte[] getIconRawData(String data) {

View file

@ -664,7 +664,7 @@ public class OsmandRenderer {
p.setColorFilter(null);
p.clearShadowLayer();
p.setStyle(Style.STROKE);
p.setStrokeWidth(rc.getComplexValue(req, rStrokeW, 0));
p.setStrokeWidth(rc.getComplexValue(req, rStrokeW));
String cap = req.getStringPropertyValue(rCap);
if(!Algorithms.isEmpty(cap)){
p.setStrokeCap(Cap.valueOf(cap.toUpperCase()));
@ -715,7 +715,7 @@ public class OsmandRenderer {
if(shadowColor == 0) {
shadowColor = rc.shadowRenderingColor;
}
int shadowRadius = (int) rc.getComplexValue(req, req.ALL.R_SHADOW_RADIUS, 0);
int shadowRadius = (int) rc.getComplexValue(req, req.ALL.R_SHADOW_RADIUS);
if (shadowColor == 0) {
shadowRadius = 0;
}
@ -869,7 +869,7 @@ public class OsmandRenderer {
if (path != null) {
if(drawOnlyShadow) {
int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
int shadowRadius = (int) rc.getComplexValue(render, render.ALL.R_SHADOW_RADIUS, 0);
int shadowRadius = (int) rc.getComplexValue(render, render.ALL.R_SHADOW_RADIUS);
if(shadowColor == 0) {
shadowColor = rc.shadowRenderingColor;
}

View file

@ -63,21 +63,21 @@ public class TextRenderer {
public void fillProperties(RenderingContext rc, RenderingRuleSearchRequest render, float centerX, float centerY) {
this.centerX = centerX;
// used only for draw on path where centerY doesn't play role
this.vOffset = (int) rc.getComplexValue(render, render.ALL.R_TEXT_DY, 0);
this.vOffset = (int) rc.getComplexValue(render, render.ALL.R_TEXT_DY);
this.centerY = centerY + this.vOffset;
textColor = render.getIntPropertyValue(render.ALL.R_TEXT_COLOR);
if (textColor == 0) {
textColor = Color.BLACK;
}
textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE, 0);
textShadow = (int) rc.getComplexValue(render, render.ALL.R_TEXT_HALO_RADIUS, 0);
textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE);
textShadow = (int) rc.getComplexValue(render, render.ALL.R_TEXT_HALO_RADIUS);
textShadowColor = render.getIntPropertyValue(render.ALL.R_TEXT_HALO_COLOR);
if(textShadowColor == 0) {
textShadowColor = Color.WHITE;
}
textWrap = (int) rc.getComplexValue(render, render.ALL.R_TEXT_WRAP_WIDTH, 0);
textWrap = (int) rc.getComplexValue(render, render.ALL.R_TEXT_WRAP_WIDTH);
bold = render.getIntPropertyValue(render.ALL.R_TEXT_BOLD, 0) > 0;
minDistance = rc.getComplexValue(render, render.ALL.R_TEXT_MIN_DISTANCE, 0);
minDistance = rc.getComplexValue(render, render.ALL.R_TEXT_MIN_DISTANCE);
if (render.isSpecified(render.ALL.R_TEXT_SHIELD)) {
shieldRes = render.getStringPropertyValue(render.ALL.R_TEXT_SHIELD);
}