Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5abee1c575
5 changed files with 36647 additions and 10 deletions
36360
OsmAnd-java/src/net/osmand/render/DefaultRenderingRulesStorage.java
Normal file
36360
OsmAnd-java/src/net/osmand/render/DefaultRenderingRulesStorage.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,7 @@ public class RenderingRuleProperty {
|
||||||
protected String[] possibleValues;
|
protected String[] possibleValues;
|
||||||
protected String category;
|
protected String category;
|
||||||
|
|
||||||
private RenderingRuleProperty(String attrName, int type, boolean input){
|
protected RenderingRuleProperty(String attrName, int type, boolean input){
|
||||||
this.attrName = attrName;
|
this.attrName = attrName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||||
public class RenderingRulesStorage {
|
public class RenderingRulesStorage {
|
||||||
|
|
||||||
private final static Log log = PlatformUtil.getLog(RenderingRulesStorage.class);
|
private final static Log log = PlatformUtil.getLog(RenderingRulesStorage.class);
|
||||||
|
static boolean STORE_ATTTRIBUTES = false;
|
||||||
|
|
||||||
// keep sync !
|
// keep sync !
|
||||||
// keep sync ! not change values
|
// keep sync ! not change values
|
||||||
|
@ -34,7 +35,7 @@ public class RenderingRulesStorage {
|
||||||
public final static int POLYGON_RULES = 3;
|
public final static int POLYGON_RULES = 3;
|
||||||
public final static int TEXT_RULES = 4;
|
public final static int TEXT_RULES = 4;
|
||||||
public final static int ORDER_RULES = 5;
|
public final static int ORDER_RULES = 5;
|
||||||
private final static int LENGTH_RULES = 6;
|
public final static int LENGTH_RULES = 6;
|
||||||
|
|
||||||
private final static int SHIFT_TAG_VAL = 16;
|
private final static int SHIFT_TAG_VAL = 16;
|
||||||
|
|
||||||
|
@ -50,8 +51,8 @@ public class RenderingRulesStorage {
|
||||||
protected Map<String, RenderingRule> renderingAttributes = new LinkedHashMap<String, RenderingRule>();
|
protected Map<String, RenderingRule> renderingAttributes = new LinkedHashMap<String, RenderingRule>();
|
||||||
protected Map<String, String> renderingConstants = new LinkedHashMap<String, String>();
|
protected Map<String, String> renderingConstants = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
private String renderingName;
|
protected String renderingName;
|
||||||
private String internalRenderingName;
|
protected String internalRenderingName;
|
||||||
|
|
||||||
|
|
||||||
public static interface RenderingRulesStorageResolver {
|
public static interface RenderingRulesStorageResolver {
|
||||||
|
@ -233,7 +234,7 @@ public class RenderingRulesStorage {
|
||||||
boolean top = stack.size() == 0 || isTopCase();
|
boolean top = stack.size() == 0 || isTopCase();
|
||||||
parseAttributes(attrsMap);
|
parseAttributes(attrsMap);
|
||||||
RenderingRule renderingRule = new RenderingRule(attrsMap, isSwitch, RenderingRulesStorage.this);
|
RenderingRule renderingRule = new RenderingRule(attrsMap, isSwitch, RenderingRulesStorage.this);
|
||||||
if(top){
|
if(top || STORE_ATTTRIBUTES){
|
||||||
renderingRule.storeAttributes(attrsMap);
|
renderingRule.storeAttributes(attrsMap);
|
||||||
}
|
}
|
||||||
if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
|
if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
|
||||||
|
@ -245,6 +246,9 @@ public class RenderingRulesStorage {
|
||||||
attrsMap.clear();
|
attrsMap.clear();
|
||||||
parseAttributes(attrsMap);
|
parseAttributes(attrsMap);
|
||||||
RenderingRule renderingRule = new RenderingRule(attrsMap, false, RenderingRulesStorage.this);
|
RenderingRule renderingRule = new RenderingRule(attrsMap, false, RenderingRulesStorage.this);
|
||||||
|
if(STORE_ATTTRIBUTES) {
|
||||||
|
renderingRule.storeAttributes(attrsMap);
|
||||||
|
}
|
||||||
if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
|
if (stack.size() > 0 && stack.peek() instanceof RenderingRule) {
|
||||||
((RenderingRule) stack.peek()).addIfChildren(renderingRule);
|
((RenderingRule) stack.peek()).addIfChildren(renderingRule);
|
||||||
} else {
|
} else {
|
||||||
|
@ -460,6 +464,7 @@ public class RenderingRulesStorage {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws XmlPullParserException, IOException {
|
public static void main(String[] args) throws XmlPullParserException, IOException {
|
||||||
|
STORE_ATTTRIBUTES = true;
|
||||||
// InputStream is = RenderingRulesStorage.class.getResourceAsStream("default.render.xml");
|
// InputStream is = RenderingRulesStorage.class.getResourceAsStream("default.render.xml");
|
||||||
String file = "/Users/victorshcherb/osmand/repos/resources/rendering_styles/default.render.xml";
|
String file = "/Users/victorshcherb/osmand/repos/resources/rendering_styles/default.render.xml";
|
||||||
Map<String, String> renderingConstants = new LinkedHashMap<String, String>();
|
Map<String, String> renderingConstants = new LinkedHashMap<String, String>();
|
||||||
|
@ -495,12 +500,19 @@ public class RenderingRulesStorage {
|
||||||
return depends;
|
return depends;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
storage.parseRulesFromXmlInputStream(is, resolver);
|
// storage.parseRulesFromXmlInputStream(is, resolver);
|
||||||
|
|
||||||
printAllRules(storage);
|
storage = new RenderingRulesStorage("", null);
|
||||||
|
new DefaultRenderingRulesStorage().createStyle(storage);
|
||||||
|
|
||||||
|
|
||||||
|
// printAllRules(storage);
|
||||||
testSearch(storage);
|
testSearch(storage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected static void testSearch(RenderingRulesStorage storage) {
|
protected static void testSearch(RenderingRulesStorage storage) {
|
||||||
// long tm = System.nanoTime();
|
// long tm = System.nanoTime();
|
||||||
// int count = 100000;
|
// int count = 100000;
|
||||||
|
@ -520,7 +532,7 @@ public class RenderingRulesStorage {
|
||||||
// searchRequest.setStringFilter(customProp, "");
|
// searchRequest.setStringFilter(customProp, "");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
searchRequest.setBooleanFilter(storage.PROPS.get("noPolygons"), true);
|
// searchRequest.setBooleanFilter(storage.PROPS.get("noPolygons"), true);
|
||||||
boolean res = searchRequest.search(LINE_RULES);
|
boolean res = searchRequest.search(LINE_RULES);
|
||||||
System.out.println("Result " + res);
|
System.out.println("Result " + res);
|
||||||
printResult(searchRequest, System.out);
|
printResult(searchRequest, System.out);
|
||||||
|
|
|
@ -0,0 +1,255 @@
|
||||||
|
package net.osmand.render;
|
||||||
|
|
||||||
|
import gnu.trove.iterator.TIntObjectIterator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.render.RenderingRulesStorage.RenderingRulesStorageResolver;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
public class RenderingRulesStoragePrinter {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws XmlPullParserException, IOException {
|
||||||
|
RenderingRulesStorage.STORE_ATTTRIBUTES = true;
|
||||||
|
// InputStream is = RenderingRulesStorage.class.getResourceAsStream("default.render.xml");
|
||||||
|
String file = "/Users/victorshcherb/osmand/repos/resources/rendering_styles/default.render.xml";
|
||||||
|
Map<String, String> renderingConstants = new LinkedHashMap<String, String>();
|
||||||
|
InputStream is = new FileInputStream(file);
|
||||||
|
if(args != null && args.length > 0) {
|
||||||
|
is = new FileInputStream(args[0]);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
XmlPullParser parser = PlatformUtil.newXMLPullParser();
|
||||||
|
parser.setInput(is, "UTF-8");
|
||||||
|
int tok;
|
||||||
|
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
||||||
|
if (tok == XmlPullParser.START_TAG) {
|
||||||
|
String tagName = parser.getName();
|
||||||
|
if (tagName.equals("renderingConstant")) {
|
||||||
|
if (!renderingConstants.containsKey(parser.getAttributeValue("", "name"))) {
|
||||||
|
renderingConstants.put(parser.getAttributeValue("", "name"),
|
||||||
|
parser.getAttributeValue("", "value"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
is = new FileInputStream(file);
|
||||||
|
RenderingRulesStorage storage = new RenderingRulesStorage("default", renderingConstants);
|
||||||
|
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
|
||||||
|
@Override
|
||||||
|
public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws XmlPullParserException, IOException {
|
||||||
|
RenderingRulesStorage depends = new RenderingRulesStorage(name, null);
|
||||||
|
depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name + ".render.xml"), ref);
|
||||||
|
return depends;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
storage.parseRulesFromXmlInputStream(is, resolver);
|
||||||
|
new RenderingRulesStoragePrinter().printJavaFile(storage);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void printJavaFile(RenderingRulesStorage storage) throws IOException {
|
||||||
|
PrintStream out = System.out;
|
||||||
|
out = new PrintStream(
|
||||||
|
new File(
|
||||||
|
"/Users/victorshcherb/osmand/repos/android/OsmAnd-java/src/net/osmand/render/DefaultRenderingRulesStorage.java"));
|
||||||
|
out.println("\n\npackage net.osmand.render;\n\npublic class DefaultRenderingRulesStorage {");
|
||||||
|
String defindent = "\t";
|
||||||
|
String indent = defindent;
|
||||||
|
out.println(""+indent + defindent +"RenderingRulesStorage storage;");
|
||||||
|
|
||||||
|
out.println(
|
||||||
|
"\tprivate java.util.Map<String, String> createMap(int... attrs) {\n" +
|
||||||
|
"\t java.util.Map<String, String> mp = new java.util.HashMap<String, String>();\n" +
|
||||||
|
"\t for(int i = 0; i< attrs.length; i+=2) {\n" +
|
||||||
|
"\t mp.put(storage.getStringValue(attrs[i]), storage.getStringValue(attrs[i+1]));\n" +
|
||||||
|
"\t }\n"+
|
||||||
|
"\t return mp;\n"+
|
||||||
|
"\t}");
|
||||||
|
|
||||||
|
out.println(
|
||||||
|
"\tprivate java.util.Map<String, String> createMap(String... attrs) {\n" +
|
||||||
|
"\t java.util.Map<String, String> mp = new java.util.HashMap<String, String>();\n" +
|
||||||
|
"\t for(int i = 0; i< attrs.length; i+=2) {\n" +
|
||||||
|
"\t mp.put(attrs[i], attrs[i+1]);\n" +
|
||||||
|
"\t }\n"+
|
||||||
|
"\t return mp;\n"+
|
||||||
|
"\t}");
|
||||||
|
|
||||||
|
out.println("\n" + indent + "public void createStyle(RenderingRulesStorage storage) {");
|
||||||
|
out.println(""+indent + defindent +"this.storage=storage;");
|
||||||
|
out.println(""+indent + defindent +"storage.renderingName="+javaString(storage.renderingName)+";");
|
||||||
|
out.println(""+indent + defindent +"storage.internalRenderingName="+javaString(storage.internalRenderingName)+";");
|
||||||
|
// init dictionary must be first here
|
||||||
|
out.println(""+indent + defindent +"initDictionary();");
|
||||||
|
out.println(""+indent + defindent +"initProperties();");
|
||||||
|
out.println(""+indent + defindent +"initConstants();");
|
||||||
|
out.println(""+indent + defindent +"initAttributes();");
|
||||||
|
out.println(""+indent + defindent +"initRules();");
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
printJavaInitConstants(storage, out, indent, defindent);
|
||||||
|
printJavaInitProperties(storage, out, indent, defindent);
|
||||||
|
printJavaInitRules(storage, out, indent, defindent);
|
||||||
|
printJavaInitAttributes(storage, out, indent, defindent);
|
||||||
|
// PRINT last one in order to initialize storage properly
|
||||||
|
printJavaInitDictionary(storage, out, indent, defindent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
out.println("\n\n}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String javaString(String s) {
|
||||||
|
return "\""+s+"\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printJavaInitDictionary(RenderingRulesStorage storage, PrintStream out, String indent, String ti) {
|
||||||
|
out.println("\n" + indent + "public void initDictionary() {");
|
||||||
|
int i = 0;
|
||||||
|
for(String s : storage.dictionary) {
|
||||||
|
out.println(""+indent + ti +"storage.getDictionaryValue("+ javaString(s) + "); // " + i++);
|
||||||
|
}
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printJavaInitProperties(RenderingRulesStorage storage, PrintStream out, String indent, String ti) {
|
||||||
|
out.println("\n" + indent + "public void initProperties() {");
|
||||||
|
out.println("" + indent + ti + "RenderingRuleProperty prop = null;");
|
||||||
|
for(RenderingRuleProperty p : storage.PROPS.customRules) {
|
||||||
|
out.println("" + indent + ti + "prop = new RenderingRuleProperty("+javaString(p.attrName)+
|
||||||
|
"," +p.type+", "+p.input+");");
|
||||||
|
out.println("" + indent + ti + "prop.setDescription("+javaString(p.description)+");");
|
||||||
|
out.println("" + indent + ti + "prop.setCategory("+javaString(p.category)+");");
|
||||||
|
out.println("" + indent + ti + "prop.setName("+javaString(p.name)+");");
|
||||||
|
if(p.possibleValues != null && !p.isBoolean()) {
|
||||||
|
String mp = "";
|
||||||
|
for (String s : p.possibleValues) {
|
||||||
|
if (mp.length() > 0) {
|
||||||
|
mp += ", ";
|
||||||
|
}
|
||||||
|
mp += javaString(s);
|
||||||
|
}
|
||||||
|
out.println("" + indent + ti + "prop.setPossibleValues(new String[]{"+mp+"});");
|
||||||
|
}
|
||||||
|
out.println("" + indent + ti + "storage.PROPS.registerRule(prop);");
|
||||||
|
}
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printJavaInitAttributes(RenderingRulesStorage storage, PrintStream out, String indent, String ti) {
|
||||||
|
out.println("\n" + indent + "public void initAttributes() {");
|
||||||
|
for (int i = 0; i < 15; i++) {
|
||||||
|
out.println("" + indent + ti + "RenderingRule rule" + i + " = null;");
|
||||||
|
}
|
||||||
|
for (String s : storage.renderingAttributes.keySet()) {
|
||||||
|
generateRenderingRule(storage, out, indent + ti, "rule", 0, storage.renderingAttributes.get(s));
|
||||||
|
out.println("" + indent + ti + "storage.renderingAttributes.put(" + javaString(s) + ", rule0);");
|
||||||
|
}
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void printJavaInitRules(RenderingRulesStorage storage, PrintStream out, String indent, String ti) {
|
||||||
|
int javaFunctions = 0;
|
||||||
|
boolean initNewSection = true;
|
||||||
|
for (int rulesSection = 0; rulesSection < RenderingRulesStorage.LENGTH_RULES; rulesSection++) {
|
||||||
|
initNewSection = true;
|
||||||
|
if(storage.tagValueGlobalRules[rulesSection] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
TIntObjectIterator<RenderingRule> iterator = storage.tagValueGlobalRules[rulesSection].iterator();
|
||||||
|
int rulesInSection = 0;
|
||||||
|
while(iterator.hasNext()) {
|
||||||
|
iterator.advance();
|
||||||
|
if (initNewSection) {
|
||||||
|
if (javaFunctions > 0) {
|
||||||
|
out.println("" + indent + "}\n");
|
||||||
|
}
|
||||||
|
out.println("\n" + indent + "public void initRules"+javaFunctions+"() {");
|
||||||
|
for (int k = 0; k < 15; k++) {
|
||||||
|
out.println("" + indent + ti + "RenderingRule rule" + k + " = null;");
|
||||||
|
}
|
||||||
|
initNewSection = false;
|
||||||
|
javaFunctions++;
|
||||||
|
}
|
||||||
|
if(rulesInSection > 50) {
|
||||||
|
rulesInSection = 0;
|
||||||
|
initNewSection = true;
|
||||||
|
}
|
||||||
|
rulesInSection += generateRenderingRule(storage, out, indent + ti, "rule", 0, iterator.value());
|
||||||
|
out.println("" + indent + ti + "storage.tagValueGlobalRules["+rulesSection+"].put("+iterator.key()+", rule0);");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (javaFunctions > 0) {
|
||||||
|
out.println("" + indent + "}\n");
|
||||||
|
}
|
||||||
|
out.println("\n" + indent + "public void initRules() {");
|
||||||
|
for (int k = 0; k < RenderingRulesStorage.LENGTH_RULES; k++) {
|
||||||
|
if(storage.tagValueGlobalRules[k] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out.println("" + indent + ti + "storage.tagValueGlobalRules["+k+"] = new gnu.trove.map.hash.TIntObjectHashMap();");
|
||||||
|
}
|
||||||
|
for(int i = 0; i < javaFunctions; i++) {
|
||||||
|
out.println("" + indent + ti + "initRules"+i+"();");
|
||||||
|
}
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private int generateRenderingRule(RenderingRulesStorage storage, PrintStream out, String indent, String name, int ind, RenderingRule key) {
|
||||||
|
int cnt = 1;
|
||||||
|
String mp = "";
|
||||||
|
Iterator<Entry<String, String>> it = key.getAttributes().entrySet().iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> e = it.next();
|
||||||
|
// mp += javaString(e.getKey()) + ", " + javaString(e.getValue());
|
||||||
|
int kk = storage.getDictionaryValue(e.getKey());
|
||||||
|
int vv = storage.getDictionaryValue(e.getValue());
|
||||||
|
mp += kk +", " +vv;
|
||||||
|
if(it.hasNext()) {
|
||||||
|
mp+=", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mp.equals("")) {
|
||||||
|
mp = "java.util.Collections.EMPTY_MAP";
|
||||||
|
} else {
|
||||||
|
mp = "createMap(" +mp +")";
|
||||||
|
}
|
||||||
|
out.println("" + indent + name + ind +" = new RenderingRule("+mp +", "+ key.isGroup() + ", storage);");
|
||||||
|
for (RenderingRule k : key.getIfChildren()) {
|
||||||
|
generateRenderingRule(storage, out, indent + "\t", name, ind + 1, k);
|
||||||
|
out.println("" + indent + name + ind + ".addIfChildren(" + name + (ind + 1) + ");");
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
for (RenderingRule k : key.getIfElseChildren()) {
|
||||||
|
generateRenderingRule(storage, out, indent + "\t", name, ind + 1, k);
|
||||||
|
out.println("" + indent + name + ind + ".addIfElseChildren(" + name + (ind + 1) + ");");
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printJavaInitConstants(RenderingRulesStorage storage, PrintStream out, String indent, String ti) {
|
||||||
|
out.println("\n" + indent + "public void initConstants() {");
|
||||||
|
for (String s : storage.renderingConstants.keySet()) {
|
||||||
|
out.println("" + indent + ti + "storage.renderingConstants.put(" + javaString(s) + ", "
|
||||||
|
+ javaString(storage.renderingConstants.get(s)) + ");");
|
||||||
|
}
|
||||||
|
out.println(""+indent +"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ import net.osmand.IProgress;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.render.DefaultRenderingRulesStorage;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.render.RenderingRulesStorage.RenderingRulesStorageResolver;
|
import net.osmand.render.RenderingRulesStorage.RenderingRulesStorageResolver;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -29,6 +30,7 @@ public class RendererRegistry {
|
||||||
private final static Log log = PlatformUtil.getLog(RendererRegistry.class);
|
private final static Log log = PlatformUtil.getLog(RendererRegistry.class);
|
||||||
|
|
||||||
public final static String DEFAULT_RENDER = "OsmAnd"; //$NON-NLS-1$
|
public final static String DEFAULT_RENDER = "OsmAnd"; //$NON-NLS-1$
|
||||||
|
public final static String DEFAULT_RENDER_FILE_PATH = "default.render.xml";
|
||||||
public final static String TOURING_VIEW = "Touring view (contrast and details)"; //$NON-NLS-1$
|
public final static String TOURING_VIEW = "Touring view (contrast and details)"; //$NON-NLS-1$
|
||||||
public final static String WINTER_SKI_RENDER = "Winter and ski"; //$NON-NLS-1$
|
public final static String WINTER_SKI_RENDER = "Winter and ski"; //$NON-NLS-1$
|
||||||
public final static String NAUTICAL_RENDER = "Nautical"; //$NON-NLS-1$
|
public final static String NAUTICAL_RENDER = "Nautical"; //$NON-NLS-1$
|
||||||
|
@ -51,7 +53,7 @@ public class RendererRegistry {
|
||||||
|
|
||||||
public RendererRegistry(OsmandApplication app){
|
public RendererRegistry(OsmandApplication app){
|
||||||
this.app = app;
|
this.app = app;
|
||||||
internalRenderers.put(DEFAULT_RENDER, "default.render.xml");
|
internalRenderers.put(DEFAULT_RENDER, DEFAULT_RENDER_FILE_PATH);
|
||||||
internalRenderers.put(TOURING_VIEW, "Touring-view_(more-contrast-and-details)" +".render.xml");
|
internalRenderers.put(TOURING_VIEW, "Touring-view_(more-contrast-and-details)" +".render.xml");
|
||||||
internalRenderers.put("UniRS", "UniRS" + ".render.xml");
|
internalRenderers.put("UniRS", "UniRS" + ".render.xml");
|
||||||
internalRenderers.put("LightRS", "LightRS" + ".render.xml");
|
internalRenderers.put("LightRS", "LightRS" + ".render.xml");
|
||||||
|
@ -74,7 +76,9 @@ public class RendererRegistry {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
log.info("INIT start loading style");
|
||||||
RenderingRulesStorage r = loadRenderer(name, new LinkedHashMap<String, RenderingRulesStorage>(), new LinkedHashMap<String, String>());
|
RenderingRulesStorage r = loadRenderer(name, new LinkedHashMap<String, RenderingRulesStorage>(), new LinkedHashMap<String, String>());
|
||||||
|
log.info("INIT finish loading style");
|
||||||
renderers.put(name, r);
|
renderers.put(name, r);
|
||||||
return r;
|
return r;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -91,6 +95,12 @@ public class RendererRegistry {
|
||||||
|
|
||||||
private RenderingRulesStorage loadRenderer(String name, final Map<String, RenderingRulesStorage> loadedRenderers,
|
private RenderingRulesStorage loadRenderer(String name, final Map<String, RenderingRulesStorage> loadedRenderers,
|
||||||
final Map<String, String> renderingConstants) throws IOException, XmlPullParserException {
|
final Map<String, String> renderingConstants) throws IOException, XmlPullParserException {
|
||||||
|
// if (name.equals(DEFAULT_RENDER) || name.equalsIgnoreCase("default")) {
|
||||||
|
// RenderingRulesStorage rrs = new RenderingRulesStorage("", null);
|
||||||
|
// new DefaultRenderingRulesStorage().createStyle(rrs);
|
||||||
|
// log.info("INIT rendering from class");
|
||||||
|
// return rrs;
|
||||||
|
// }
|
||||||
InputStream is = getInputStream(name);
|
InputStream is = getInputStream(name);
|
||||||
if(is == null) {
|
if(is == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue