Fix native rendering
This commit is contained in:
parent
8b543181b2
commit
8d67b70a8e
7 changed files with 27 additions and 13 deletions
|
@ -61,7 +61,7 @@ public class RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, float defVal) {
|
public float getComplexValue(RenderingRuleSearchRequest req, RenderingRuleProperty prop, float defVal) {
|
||||||
return req.getFloatPropertyValue(prop, defVal) * density;
|
return req.getFloatPropertyValue(prop, defVal) * density + req.getIntPropertyValue(prop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] getIconRawData(String data) {
|
protected byte[] getIconRawData(String data) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class RenderingRule {
|
||||||
floatProperties = new float[attributes.size()];
|
floatProperties = new float[attributes.size()];
|
||||||
}
|
}
|
||||||
floatProperties[i] = property.parseFloatValue(e.getValue());
|
floatProperties[i] = property.parseFloatValue(e.getValue());
|
||||||
|
intProperties[i] = property.parseIntValue(e.getValue());
|
||||||
} else {
|
} else {
|
||||||
intProperties[i] = property.parseIntValue(e.getValue());
|
intProperties[i] = property.parseIntValue(e.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,18 @@ public class RenderingRuleProperty {
|
||||||
log.error("Rendering parse " + e.getMessage());
|
log.error("Rendering parse " + e.getMessage());
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if(type == FLOAT_TYPE){
|
||||||
|
// parse as complex value
|
||||||
|
try {
|
||||||
|
int colon = value.indexOf(':');
|
||||||
|
if(colon != -1) {
|
||||||
|
return Integer.parseInt(value.substring(colon + 1));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
log.error("Rendering parse " + value);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -170,12 +182,10 @@ public class RenderingRuleProperty {
|
||||||
try {
|
try {
|
||||||
int colon = value.indexOf(':');
|
int colon = value.indexOf(':');
|
||||||
if(colon != -1) {
|
if(colon != -1) {
|
||||||
float c = 0;
|
|
||||||
if(colon > 0) {
|
if(colon > 0) {
|
||||||
c += Float.parseFloat(value.substring(0, colon));
|
return Float.parseFloat(value.substring(0, colon));
|
||||||
}
|
}
|
||||||
c += Float.parseFloat(value.substring(colon + 1));
|
return 0;
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
return Float.parseFloat(value);
|
return Float.parseFloat(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class RenderingRuleSearchRequest {
|
||||||
values[p.getId()] = savedValues[p.getId()];
|
values[p.getId()] = savedValues[p.getId()];
|
||||||
} else {
|
} else {
|
||||||
fvalues[p.getId()] = savedFvalues[p.getId()];
|
fvalues[p.getId()] = savedFvalues[p.getId()];
|
||||||
|
values[p.getId()] = savedValues[p.getId()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +167,6 @@ public class RenderingRuleSearchRequest {
|
||||||
}
|
}
|
||||||
} else if(rp == storage.PROPS.R_DISABLE){
|
} else if(rp == storage.PROPS.R_DISABLE){
|
||||||
// quick disable return even without load output
|
// quick disable return even without load output
|
||||||
RenderingRuleProperty p = storage.PROPS.R_DISABLE;
|
|
||||||
values[rp.getId()] = rule.getIntProp(i);
|
values[rp.getId()] = rule.getIntProp(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,7 @@ public class RenderingRuleSearchRequest {
|
||||||
searchResult = true;
|
searchResult = true;
|
||||||
if (rp.isFloat()) {
|
if (rp.isFloat()) {
|
||||||
fvalues[rp.getId()] = rule.getFloatProp(i);
|
fvalues[rp.getId()] = rule.getFloatProp(i);
|
||||||
|
values[rp.getId()] = rule.getIntProp(i);
|
||||||
} else {
|
} else {
|
||||||
values[rp.getId()] = rule.getIntProp(i);
|
values[rp.getId()] = rule.getIntProp(i);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +203,7 @@ public class RenderingRuleSearchRequest {
|
||||||
|
|
||||||
public boolean isSpecified(RenderingRuleProperty property){
|
public boolean isSpecified(RenderingRuleProperty property){
|
||||||
if(property.isFloat()){
|
if(property.isFloat()){
|
||||||
return fvalues[property.getId()] != 0;
|
return fvalues[property.getId()] != 0 || values[property.getId()] != -1;
|
||||||
} else {
|
} else {
|
||||||
int val = values[property.getId()];
|
int val = values[property.getId()];
|
||||||
if(property.isColor()){
|
if(property.isColor()){
|
||||||
|
|
|
@ -439,7 +439,8 @@ public class MapRenderRepositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean checkIfMapIsEmpty(int leftX, int rightX, int topY, int bottomY, int zoom){
|
// only single thread to read !
|
||||||
|
public synchronized boolean checkIfMapIsEmpty(int leftX, int rightX, int topY, int bottomY, int zoom){
|
||||||
final boolean[] empty = new boolean[] {true};
|
final boolean[] empty = new boolean[] {true};
|
||||||
SearchRequest<BinaryMapDataObject> searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom,
|
SearchRequest<BinaryMapDataObject> searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom,
|
||||||
null, new ResultMatcher<BinaryMapDataObject>() {
|
null, new ResultMatcher<BinaryMapDataObject>() {
|
||||||
|
|
|
@ -564,6 +564,7 @@ public class OsmandRenderer {
|
||||||
if (shadowColor == 0) {
|
if (shadowColor == 0) {
|
||||||
shadowRadius = 0;
|
shadowRadius = 0;
|
||||||
}
|
}
|
||||||
|
System.out.println("Shadow radius " + shadowRadius);
|
||||||
p.setShadowLayer(shadowRadius, 0, 0, shadowColor);
|
p.setShadowLayer(shadowRadius, 0, 0, shadowColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,7 +714,7 @@ public class OsmandRenderer {
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
if(drawOnlyShadow) {
|
if(drawOnlyShadow) {
|
||||||
int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
|
int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
|
||||||
int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS);
|
int shadowRadius = (int) rc.getComplexValue(render, render.ALL.R_SHADOW_RADIUS, 0);
|
||||||
if(shadowColor == 0) {
|
if(shadowColor == 0) {
|
||||||
shadowColor = rc.shadowRenderingColor;
|
shadowColor = rc.shadowRenderingColor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class TextRenderer {
|
||||||
}
|
}
|
||||||
if (text.minDistance > 0) {
|
if (text.minDistance > 0) {
|
||||||
QuadRect boundsSearch = new QuadRect(text.bounds);
|
QuadRect boundsSearch = new QuadRect(text.bounds);
|
||||||
boundsSearch.inset(-rc.getDensityValue(Math.max(5.0f, text.minDistance)), -rc.getDensityValue(15));
|
boundsSearch.inset(-Math.max(rc.getDensityValue(5.0f), text.minDistance), -rc.getDensityValue(15));
|
||||||
boundIntersections.queryInBox(boundsSearch, tempSearch);
|
boundIntersections.queryInBox(boundsSearch, tempSearch);
|
||||||
// drawTestBox(cv, &boundsSearch, text.pathRotate, paintIcon, text.text, NULL/*paintText*/);
|
// drawTestBox(cv, &boundsSearch, text.pathRotate, paintIcon, text.text, NULL/*paintText*/);
|
||||||
for (int i = 0; i < tempSearch.size(); i++) {
|
for (int i = 0; i < tempSearch.size(); i++) {
|
||||||
|
@ -216,7 +216,7 @@ public class TextRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sest text size before finding intersection (it is used there)
|
// sest text size before finding intersection (it is used there)
|
||||||
float textSize = rc.getDensityValue(text.textSize);
|
float textSize = text.textSize;
|
||||||
paintText.setTextSize(textSize);
|
paintText.setTextSize(textSize);
|
||||||
paintText.setFakeBoldText(text.bold);
|
paintText.setFakeBoldText(text.bold);
|
||||||
paintText.setColor(text.textColor);
|
paintText.setColor(text.textColor);
|
||||||
|
@ -323,7 +323,7 @@ public class TextRenderer {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
paintText.setTextSize(rc.getDensityValue(text.textSize));
|
paintText.setTextSize(text.textSize);
|
||||||
Rect bs = new Rect();
|
Rect bs = new Rect();
|
||||||
paintText.getTextBounds(name, 0, name.length(), bs);
|
paintText.getTextBounds(name, 0, name.length(), bs);
|
||||||
text.bounds = new QuadRect(bs.left, bs.top, bs.right, bs.bottom);
|
text.bounds = new QuadRect(bs.left, bs.top, bs.right, bs.bottom);
|
||||||
|
|
Loading…
Reference in a new issue