Add rendering parser state
This commit is contained in:
parent
15141fa496
commit
20677dd757
1 changed files with 41 additions and 18 deletions
|
@ -2,6 +2,7 @@ package net.osmand.render;
|
||||||
|
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
@ -440,6 +441,10 @@ public class RenderingRulesStorage {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws XmlPullParserException, IOException {
|
public static void main(String[] args) throws XmlPullParserException, IOException {
|
||||||
|
InputStream is = RenderingRulesStorage.class.getResourceAsStream("default.render.xml");
|
||||||
|
if(args != null && args.length > 0) {
|
||||||
|
is = new FileInputStream(args[0]);
|
||||||
|
}
|
||||||
RenderingRulesStorage storage = new RenderingRulesStorage("test", null);
|
RenderingRulesStorage storage = new RenderingRulesStorage("test", null);
|
||||||
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
|
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -449,8 +454,13 @@ public class RenderingRulesStorage {
|
||||||
return depends;
|
return depends;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
storage.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream("default.render.xml"), resolver);
|
storage.parseRulesFromXmlInputStream(is, resolver);
|
||||||
storage.printDebug(TEXT_RULES, System.out);
|
|
||||||
|
printAllRules(storage);
|
||||||
|
// testSearch(storage);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void testSearch(RenderingRulesStorage storage) {
|
||||||
// long tm = System.nanoTime();
|
// long tm = System.nanoTime();
|
||||||
// int count = 100000;
|
// int count = 100000;
|
||||||
// for (int i = 0; i < count; i++) {
|
// for (int i = 0; i < count; i++) {
|
||||||
|
@ -470,6 +480,19 @@ public class RenderingRulesStorage {
|
||||||
// System.out.println((System.nanoTime()- tm)/ (1e6f * count) );
|
// System.out.println((System.nanoTime()- tm)/ (1e6f * count) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void printAllRules(RenderingRulesStorage storage) {
|
||||||
|
System.out.println("\n\n--------- POINTS ----- ");
|
||||||
|
storage.printDebug(POINT_RULES, System.out);
|
||||||
|
System.out.println("\n\n--------- POLYGON ----- ");
|
||||||
|
storage.printDebug(POLYGON_RULES, System.out);
|
||||||
|
System.out.println("\n\n--------- LINES ----- ");
|
||||||
|
storage.printDebug(LINE_RULES, System.out);
|
||||||
|
System.out.println("\n\n--------- ORDER ----- ");
|
||||||
|
storage.printDebug(ORDER_RULES, System.out);
|
||||||
|
System.out.println("\n\n--------- TEXT ----- ");
|
||||||
|
storage.printDebug(TEXT_RULES, System.out);
|
||||||
|
}
|
||||||
|
|
||||||
private static void printResult(RenderingRuleSearchRequest searchRequest, PrintStream out) {
|
private static void printResult(RenderingRuleSearchRequest searchRequest, PrintStream out) {
|
||||||
if(searchRequest.isFound()){
|
if(searchRequest.isFound()){
|
||||||
out.print(" Found : ");
|
out.print(" Found : ");
|
||||||
|
|
Loading…
Reference in a new issue