Fix rendering rule dependency bug
This commit is contained in:
parent
1ae719984b
commit
38047b3ee4
3 changed files with 41 additions and 25 deletions
|
@ -48,8 +48,7 @@ public class BinaryInspector {
|
|||
// test cases show info
|
||||
|
||||
|
||||
inspector(new String[]{"-vaddress", "/home/victor/projects/OsmAnd/data/osm-gen/Map.obf"});
|
||||
// inspector(new String[]{"-vaddress", "-bbox=18.05,48.33,18.12,48.28", "/home/victor/projects/OsmAnd/temp/Slovakia_europe.obf"});
|
||||
// inspector(new String[]{"-vaddress", "-bbox=-121.785,37.35,-121.744,37.33", ""});
|
||||
// test case extract parts
|
||||
// test case
|
||||
}
|
||||
|
|
|
@ -129,4 +129,35 @@ public class RenderingRule {
|
|||
ifElseChildren.add(rr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder bls = new StringBuilder();
|
||||
toString("", bls);
|
||||
return bls.toString();
|
||||
}
|
||||
|
||||
public StringBuilder toString(String indent, StringBuilder bls ) {
|
||||
bls.append("RenderingRule [");
|
||||
for(RenderingRuleProperty p : getProperties()){
|
||||
bls.append(" " + p.getAttrName() + "= ");
|
||||
if(p.isString()){
|
||||
bls.append("\"" + getStringPropertyValue(p.getAttrName()) + "\"");
|
||||
} else if(p.isFloat()){
|
||||
bls.append(getFloatPropertyValue(p.getAttrName()));
|
||||
} else if(p.isColor()){
|
||||
bls.append(getColorPropertyValue(p.getAttrName()));
|
||||
} else if(p.isIntParse()){
|
||||
bls.append(getIntPropertyValue(p.getAttrName()));
|
||||
}
|
||||
}
|
||||
bls.append("]");
|
||||
indent += " ";
|
||||
for(RenderingRule rc : getIfElseChildren()){
|
||||
bls.append("\n"+indent);
|
||||
rc.toString(indent, bls);
|
||||
}
|
||||
|
||||
return bls;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,10 +124,12 @@ public class RenderingRulesStorage {
|
|||
if (rule != null) {
|
||||
RenderingRule toInsert = createTagValueRootWrapperRule(keys[j], rule);
|
||||
toInsert.addIfElseChildren(dependsRule);
|
||||
}
|
||||
tagValueGlobalRules[i].put(keys[j], toInsert);
|
||||
} else {
|
||||
tagValueGlobalRules[i].put(keys[j], dependsRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tagValueGlobalRules[i] = depends.tagValueGlobalRules[i];
|
||||
}
|
||||
|
@ -405,23 +407,7 @@ public class RenderingRulesStorage {
|
|||
}
|
||||
|
||||
private static void printRenderingRule(String indent, RenderingRule rr, PrintStream out){
|
||||
indent += " ";
|
||||
out.print("\n"+indent);
|
||||
for(RenderingRuleProperty p : rr.getProperties()){
|
||||
out.print(" " + p.getAttrName() + "= ");
|
||||
if(p.isString()){
|
||||
out.print("\"" + rr.getStringPropertyValue(p.getAttrName()) + "\"");
|
||||
} else if(p.isFloat()){
|
||||
out.print(rr.getFloatPropertyValue(p.getAttrName()));
|
||||
} else if(p.isColor()){
|
||||
out.print(rr.getColorPropertyValue(p.getAttrName()));
|
||||
} else if(p.isIntParse()){
|
||||
out.print(rr.getIntPropertyValue(p.getAttrName()));
|
||||
}
|
||||
}
|
||||
for(RenderingRule rc : rr.getIfElseChildren()){
|
||||
printRenderingRule(indent, rc, out);
|
||||
}
|
||||
out.print(rr.toString(indent, new StringBuilder()).toString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,21 +426,21 @@ public class RenderingRulesStorage {
|
|||
return depends;
|
||||
}
|
||||
};
|
||||
storage.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream("test_depends.render.xml"), resolver);
|
||||
storage.printDebug(TEXT_RULES, System.out);
|
||||
storage.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream("winter+ski.render.xml"), resolver);
|
||||
// storage.printDebug(TEXT_RULES, System.out);
|
||||
// long tm = System.nanoTime();
|
||||
// int count = 100000;
|
||||
// for (int i = 0; i < count; i++) {
|
||||
RenderingRuleSearchRequest searchRequest = new RenderingRuleSearchRequest(storage);
|
||||
searchRequest.setStringFilter(storage.PROPS.R_TAG, "highway");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_VALUE, "motorway");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_TAG, "landuse");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_VALUE, "wood");
|
||||
searchRequest.setIntFilter(storage.PROPS.R_LAYER, 1);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MINZOOM, 15);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MAXZOOM, 15);
|
||||
// searchRequest.setBooleanFilter(storage.PROPS.R_NIGHT_MODE, true);
|
||||
// searchRequest.setBooleanFilter(storage.PROPS.get("hmRendered"), true);
|
||||
|
||||
boolean res = searchRequest.search(LINE_RULES);
|
||||
boolean res = searchRequest.search(POLYGON_RULES);
|
||||
System.out.println("Result " + res);
|
||||
printResult(searchRequest, System.out);
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue