Add icon2 .. icon5 rendering
This commit is contained in:
parent
ff3fb4b834
commit
4f37694d41
2 changed files with 36 additions and 4 deletions
|
@ -139,6 +139,10 @@ public class RenderingRuleStorageProperties {
|
||||||
public RenderingRuleProperty R_TEXT_MIN_DISTANCE;
|
public RenderingRuleProperty R_TEXT_MIN_DISTANCE;
|
||||||
public RenderingRuleProperty R_TEXT_ON_PATH;
|
public RenderingRuleProperty R_TEXT_ON_PATH;
|
||||||
public RenderingRuleProperty R_ICON;
|
public RenderingRuleProperty R_ICON;
|
||||||
|
public RenderingRuleProperty R_ICON_2;
|
||||||
|
public RenderingRuleProperty R_ICON_3;
|
||||||
|
public RenderingRuleProperty R_ICON_4;
|
||||||
|
public RenderingRuleProperty R_ICON_5;
|
||||||
public RenderingRuleProperty R_ICON_VISIBLE_SIZE;
|
public RenderingRuleProperty R_ICON_VISIBLE_SIZE;
|
||||||
public RenderingRuleProperty R_LAYER;
|
public RenderingRuleProperty R_LAYER;
|
||||||
public RenderingRuleProperty R_ORDER;
|
public RenderingRuleProperty R_ORDER;
|
||||||
|
@ -228,6 +232,10 @@ public class RenderingRuleStorageProperties {
|
||||||
|
|
||||||
// point
|
// point
|
||||||
R_ICON = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(ICON));
|
R_ICON = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(ICON));
|
||||||
|
R_ICON_2 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_2"));
|
||||||
|
R_ICON_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_3"));
|
||||||
|
R_ICON_4 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_4"));
|
||||||
|
R_ICON_5 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_5"));
|
||||||
R_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHIELD));
|
R_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHIELD));
|
||||||
|
|
||||||
// polygon/way
|
// polygon/way
|
||||||
|
|
|
@ -84,6 +84,10 @@ public class OsmandRenderer {
|
||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
String resId;
|
String resId;
|
||||||
|
String resId2;
|
||||||
|
String resId3;
|
||||||
|
String resId4;
|
||||||
|
String resId5;
|
||||||
String shieldId;
|
String shieldId;
|
||||||
int iconOrder;
|
int iconOrder;
|
||||||
float iconSize;
|
float iconSize;
|
||||||
|
@ -340,16 +344,24 @@ public class OsmandRenderer {
|
||||||
RectF shieldRf = calculateRect(rc, icon, shield.getWidth(), shield.getHeight());
|
RectF shieldRf = calculateRect(rc, icon, shield.getWidth(), shield.getHeight());
|
||||||
if (coeff != 1f) {
|
if (coeff != 1f) {
|
||||||
Rect src = new Rect(0, 0, shield.getWidth(), shield.getHeight());
|
Rect src = new Rect(0, 0, shield.getWidth(), shield.getHeight());
|
||||||
cv.drawBitmap(shield, src, shieldRf, paintIcon);
|
drawBitmap(cv, shield, shieldRf, src);
|
||||||
} else {
|
} else {
|
||||||
cv.drawBitmap(shield, shieldRf.left, shieldRf.top, paintIcon);
|
drawBitmap(cv, shield, shieldRf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (coeff != 1f) {
|
if (coeff != 1f) {
|
||||||
Rect src = new Rect(0, 0, ico.getWidth(), ico.getHeight());
|
Rect src = new Rect(0, 0, ico.getWidth(), ico.getHeight());
|
||||||
cv.drawBitmap(ico, src, rf, paintIcon);
|
drawBitmap(cv, ico, rf, src);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId2), rf, src);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId3), rf, src);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId4), rf, src);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId5), rf, src);
|
||||||
} else {
|
} else {
|
||||||
cv.drawBitmap(ico, rf.left, rf.top, paintIcon);
|
drawBitmap(cv, ico, rf);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId2), rf);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId3), rf);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId4), rf);
|
||||||
|
drawBitmap(cv, RenderingIcons.getIcon(context, icon.resId5), rf);
|
||||||
}
|
}
|
||||||
if(visibleRect != null) {
|
if(visibleRect != null) {
|
||||||
visibleRect.inset(-visibleRect.width() / 4, -visibleRect.height() / 4);
|
visibleRect.inset(-visibleRect.width() / 4, -visibleRect.height() / 4);
|
||||||
|
@ -366,6 +378,14 @@ public class OsmandRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void drawBitmap(Canvas cv, Bitmap ico, RectF rf) {
|
||||||
|
cv.drawBitmap(ico, rf.left, rf.top, paintIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawBitmap(Canvas cv, Bitmap ico, RectF rf, Rect src) {
|
||||||
|
cv.drawBitmap(ico, src, rf, paintIcon);
|
||||||
|
}
|
||||||
|
|
||||||
private RectF calculateRect(RenderingContext rc, IconDrawInfo icon, int visbleWidth, int visbleHeight) {
|
private RectF calculateRect(RenderingContext rc, IconDrawInfo icon, int visbleWidth, int visbleHeight) {
|
||||||
RectF rf;
|
RectF rf;
|
||||||
float coeff = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
float coeff = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
||||||
|
@ -789,6 +809,10 @@ public class OsmandRenderer {
|
||||||
ico.iconSize = rc.getComplexValue(render, render.ALL.R_ICON_VISIBLE_SIZE, -1);
|
ico.iconSize = rc.getComplexValue(render, render.ALL.R_ICON_VISIBLE_SIZE, -1);
|
||||||
ico.shieldId = render.getStringPropertyValue(render.ALL.R_SHIELD);
|
ico.shieldId = render.getStringPropertyValue(render.ALL.R_SHIELD);
|
||||||
ico.resId = resId;
|
ico.resId = resId;
|
||||||
|
ico.resId2 = render.getStringPropertyValue(render.ALL.R_ICON_2);
|
||||||
|
ico.resId3 = render.getStringPropertyValue(render.ALL.R_ICON_3);
|
||||||
|
ico.resId4 = render.getStringPropertyValue(render.ALL.R_ICON_4);
|
||||||
|
ico.resId5 = render.getStringPropertyValue(render.ALL.R_ICON_5);
|
||||||
rc.iconsToDraw.add(ico);
|
rc.iconsToDraw.add(ico);
|
||||||
}
|
}
|
||||||
if (renderText) {
|
if (renderText) {
|
||||||
|
|
Loading…
Reference in a new issue