2013-04-18 23:35:02 +02:00
|
|
|
package net.osmand.router;
|
|
|
|
|
|
|
|
import net.osmand.PlatformUtil;
|
|
|
|
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
|
2014-02-02 14:06:09 +01:00
|
|
|
import net.osmand.router.GeneralRouter.RouteAttributeContext;
|
|
|
|
import net.osmand.router.GeneralRouter.RouteDataObjectAttribute;
|
2013-04-18 23:35:02 +02:00
|
|
|
import net.osmand.util.Algorithms;
|
|
|
|
|
|
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
|
|
|
2016-01-11 13:54:26 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
2020-02-18 13:12:40 +01:00
|
|
|
import java.util.HashSet;
|
2016-01-11 13:54:26 +01:00
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.Map;
|
2020-02-18 16:07:36 +01:00
|
|
|
import java.util.Set;
|
2016-01-11 13:54:26 +01:00
|
|
|
import java.util.Stack;
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
public class RoutingConfiguration {
|
2019-05-02 15:27:38 +02:00
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
public static final int DEFAULT_MEMORY_LIMIT = 30;
|
2014-02-01 02:06:36 +01:00
|
|
|
public final float DEVIATION_RADIUS = 3000;
|
2013-04-18 23:35:02 +02:00
|
|
|
public Map<String, String> attributes = new LinkedHashMap<String, String>();
|
|
|
|
|
|
|
|
// 1. parameters of routing and different tweaks
|
|
|
|
// Influence on A* : f(x) + heuristicCoefficient*g(X)
|
|
|
|
public float heuristicCoefficient = 1;
|
|
|
|
|
|
|
|
// 1.1 tile load parameters (should not affect routing)
|
|
|
|
public int ZOOM_TO_LOAD_TILES = 16;
|
2020-04-19 23:28:54 +02:00
|
|
|
public long memoryLimitation;
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
// 1.2 Build A* graph in backward/forward direction (can affect results)
|
|
|
|
// 0 - 2 ways, 1 - direct way, -1 - reverse way
|
|
|
|
public int planRoadDirection = 0;
|
|
|
|
|
|
|
|
// 1.3 Router specific coefficients and restrictions
|
2014-02-05 17:57:24 +01:00
|
|
|
// use GeneralRouter and not interface to simplify native access !
|
|
|
|
public GeneralRouter router = new GeneralRouter(GeneralRouterProfile.CAR, new LinkedHashMap<String, String>());
|
2013-04-18 23:35:02 +02:00
|
|
|
public String routerName = "";
|
|
|
|
|
|
|
|
// 1.4 Used to calculate route in movement
|
|
|
|
public Double initialDirection;
|
|
|
|
|
|
|
|
// 1.5 Recalculate distance help
|
2015-04-30 00:47:57 +02:00
|
|
|
public float recalculateDistance = 20000f;
|
2019-07-21 13:54:46 +02:00
|
|
|
|
2019-07-21 21:25:57 +02:00
|
|
|
// 1.6 Time to calculate all access restrictions based on conditions
|
|
|
|
public long routeCalculationTime = 0;
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
public static class Builder {
|
|
|
|
// Design time storage
|
2019-05-16 16:24:48 +02:00
|
|
|
private String defaultRouter = "";
|
|
|
|
private Map<String, GeneralRouter> routers = new LinkedHashMap<>();
|
|
|
|
private Map<String, String> attributes = new LinkedHashMap<>();
|
2020-02-18 16:07:36 +01:00
|
|
|
private Set<Long> impassableRoadLocations = new HashSet<>();
|
2020-02-17 10:43:08 +01:00
|
|
|
|
|
|
|
public Builder() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public Builder(Map<String, String> defaultAttributes) {
|
|
|
|
attributes.putAll(defaultAttributes);
|
|
|
|
}
|
2018-09-14 14:30:00 +02:00
|
|
|
|
2014-10-21 23:17:46 +02:00
|
|
|
// Example
|
|
|
|
// {
|
2016-01-11 13:54:26 +01:00
|
|
|
// impassableRoadLocations.add(23000069L);
|
2014-10-21 23:17:46 +02:00
|
|
|
// }
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
public RoutingConfiguration build(String router, int memoryLimitMB) {
|
2014-02-06 00:17:07 +01:00
|
|
|
return build(router, null, memoryLimitMB, null);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
2014-02-06 00:17:07 +01:00
|
|
|
public RoutingConfiguration build(String router, int memoryLimitMB, Map<String, String> params) {
|
|
|
|
return build(router, null, memoryLimitMB, params);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
2019-07-21 21:25:57 +02:00
|
|
|
|
2014-02-06 00:17:07 +01:00
|
|
|
public RoutingConfiguration build(String router, Double direction, int memoryLimitMB, Map<String, String> params) {
|
2013-04-18 23:35:02 +02:00
|
|
|
if (!routers.containsKey(router)) {
|
|
|
|
router = defaultRouter;
|
|
|
|
}
|
|
|
|
RoutingConfiguration i = new RoutingConfiguration();
|
|
|
|
if (routers.containsKey(router)) {
|
|
|
|
i.router = routers.get(router);
|
2014-02-06 00:17:07 +01:00
|
|
|
if (params != null) {
|
2014-02-02 14:06:09 +01:00
|
|
|
i.router = i.router.build(params);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
i.routerName = router;
|
|
|
|
}
|
|
|
|
attributes.put("routerName", router);
|
|
|
|
i.attributes.putAll(attributes);
|
|
|
|
i.initialDirection = direction;
|
|
|
|
i.recalculateDistance = parseSilentFloat(getAttribute(i.router, "recalculateDistanceHelp"), i.recalculateDistance) ;
|
|
|
|
i.heuristicCoefficient = parseSilentFloat(getAttribute(i.router, "heuristicCoefficient"), i.heuristicCoefficient);
|
2020-02-18 13:12:40 +01:00
|
|
|
i.router.addImpassableRoads(new HashSet<>(impassableRoadLocations));
|
2013-04-18 23:35:02 +02:00
|
|
|
i.ZOOM_TO_LOAD_TILES = parseSilentInt(getAttribute(i.router, "zoomToLoadTiles"), i.ZOOM_TO_LOAD_TILES);
|
|
|
|
int desirable = parseSilentInt(getAttribute(i.router, "memoryLimitInMB"), 0);
|
|
|
|
if(desirable != 0) {
|
2020-04-19 23:28:54 +02:00
|
|
|
i.memoryLimitation = desirable * (1l << 20);
|
2013-04-18 23:35:02 +02:00
|
|
|
} else {
|
|
|
|
if(memoryLimitMB == 0) {
|
|
|
|
memoryLimitMB = DEFAULT_MEMORY_LIMIT;
|
|
|
|
}
|
2020-04-19 23:28:54 +02:00
|
|
|
i.memoryLimitation = memoryLimitMB * (1l << 20);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
i.planRoadDirection = parseSilentInt(getAttribute(i.router, "planRoadDirection"), i.planRoadDirection);
|
2014-09-22 02:08:34 +02:00
|
|
|
// i.planRoadDirection = 1;
|
2013-04-18 23:35:02 +02:00
|
|
|
return i;
|
|
|
|
}
|
2020-02-18 16:07:36 +01:00
|
|
|
|
|
|
|
public Set<Long> getImpassableRoadLocations() {
|
2016-01-11 13:54:26 +01:00
|
|
|
return impassableRoadLocations;
|
2014-10-21 23:17:46 +02:00
|
|
|
}
|
|
|
|
|
2020-02-18 15:40:39 +01:00
|
|
|
public boolean addImpassableRoad(long routeId) {
|
2020-02-18 16:07:36 +01:00
|
|
|
return impassableRoadLocations.add(routeId);
|
2014-10-21 23:17:46 +02:00
|
|
|
}
|
2020-02-17 10:43:08 +01:00
|
|
|
|
|
|
|
public Map<String, String> getAttributes() {
|
|
|
|
return attributes;
|
|
|
|
}
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
private String getAttribute(VehicleRouter router, String propertyName) {
|
2014-02-02 14:06:09 +01:00
|
|
|
if (router.containsAttribute(propertyName)) {
|
|
|
|
return router.getAttribute(propertyName);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
return attributes.get(propertyName);
|
|
|
|
}
|
|
|
|
|
2014-02-26 20:23:29 +01:00
|
|
|
|
|
|
|
public String getDefaultRouter() {
|
|
|
|
return defaultRouter;
|
|
|
|
}
|
2019-05-16 16:24:48 +02:00
|
|
|
|
|
|
|
public GeneralRouter getRouter(String routingProfileName) {
|
|
|
|
return routers.get(routingProfileName);
|
2014-02-26 20:23:29 +01:00
|
|
|
|
|
|
|
}
|
2014-11-02 18:48:00 +01:00
|
|
|
|
2020-01-16 14:11:21 +01:00
|
|
|
public String getRoutingProfileKeyByFileName(String fileName) {
|
|
|
|
if (fileName != null && routers != null) {
|
|
|
|
for (Map.Entry<String, GeneralRouter> router : routers.entrySet()) {
|
|
|
|
if (fileName.equals(router.getValue().getFilename())) {
|
|
|
|
return router.getKey();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-05-22 15:21:10 +02:00
|
|
|
public Map<String, GeneralRouter> getAllRouters() {
|
2019-05-02 15:27:38 +02:00
|
|
|
return routers;
|
|
|
|
}
|
|
|
|
|
2020-02-18 13:12:40 +01:00
|
|
|
public void removeImpassableRoad(long routeId) {
|
|
|
|
impassableRoadLocations.remove(routeId);
|
2014-11-02 18:48:00 +01:00
|
|
|
}
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
2019-03-17 14:09:41 +01:00
|
|
|
public static int parseSilentInt(String t, int v) {
|
2013-04-18 23:35:02 +02:00
|
|
|
if (t == null || t.length() == 0) {
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
return Integer.parseInt(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-17 14:09:41 +01:00
|
|
|
public static float parseSilentFloat(String t, float v) {
|
2013-04-18 23:35:02 +02:00
|
|
|
if (t == null || t.length() == 0) {
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
return Float.parseFloat(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static RoutingConfiguration.Builder DEFAULT;
|
|
|
|
|
|
|
|
public static RoutingConfiguration.Builder getDefault() {
|
|
|
|
if (DEFAULT == null) {
|
|
|
|
try {
|
2019-05-13 09:37:43 +02:00
|
|
|
DEFAULT = parseFromInputStream(RoutingConfiguration.class.getResourceAsStream("routing.xml"));
|
2013-04-18 23:35:02 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
throw new IllegalStateException(e);
|
2014-02-02 14:06:09 +01:00
|
|
|
}
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
return DEFAULT;
|
|
|
|
}
|
2019-05-08 11:37:00 +02:00
|
|
|
|
2019-05-22 17:24:29 +02:00
|
|
|
public static RoutingConfiguration.Builder parseFromInputStream(InputStream is) throws IOException, XmlPullParserException {
|
2019-05-16 16:24:48 +02:00
|
|
|
return parseFromInputStream(is, null, new RoutingConfiguration.Builder());
|
2019-05-08 11:37:00 +02:00
|
|
|
}
|
|
|
|
|
2019-05-16 16:24:48 +02:00
|
|
|
public static RoutingConfiguration.Builder parseFromInputStream(InputStream is, String filename, RoutingConfiguration.Builder config) throws IOException, XmlPullParserException {
|
2013-04-18 23:35:02 +02:00
|
|
|
XmlPullParser parser = PlatformUtil.newXMLPullParser();
|
|
|
|
GeneralRouter currentRouter = null;
|
2014-02-02 14:06:09 +01:00
|
|
|
RouteDataObjectAttribute currentAttribute = null;
|
2014-04-07 00:55:53 +02:00
|
|
|
String preType = null;
|
2014-02-02 14:06:09 +01:00
|
|
|
Stack<RoutingRule> rulesStck = new Stack<RoutingConfiguration.RoutingRule>();
|
2013-04-18 23:35:02 +02:00
|
|
|
parser.setInput(is, "UTF-8");
|
2014-02-02 14:06:09 +01:00
|
|
|
int tok;
|
2013-04-18 23:35:02 +02:00
|
|
|
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
|
|
|
if (tok == XmlPullParser.START_TAG) {
|
|
|
|
String name = parser.getName();
|
|
|
|
if ("osmand_routing_config".equals(name)) {
|
2019-05-16 16:24:48 +02:00
|
|
|
config.defaultRouter = parser.getAttributeValue("", "defaultProfile");
|
2013-04-18 23:35:02 +02:00
|
|
|
} else if ("routingProfile".equals(name)) {
|
2019-05-13 09:37:43 +02:00
|
|
|
currentRouter = parseRoutingProfile(parser, config, filename);
|
2013-04-18 23:35:02 +02:00
|
|
|
} else if ("attribute".equals(name)) {
|
|
|
|
parseAttribute(parser, config, currentRouter);
|
2014-02-02 14:06:09 +01:00
|
|
|
} else if ("parameter".equals(name)) {
|
|
|
|
parseRoutingParameter(parser, currentRouter);
|
|
|
|
} else if ("point".equals(name) || "way".equals(name)) {
|
|
|
|
String attribute = parser.getAttributeValue("", "attribute");
|
|
|
|
currentAttribute = RouteDataObjectAttribute.getValueOf(attribute);
|
2014-04-07 00:55:53 +02:00
|
|
|
preType = parser.getAttributeValue("", "type");
|
2013-04-18 23:35:02 +02:00
|
|
|
} else {
|
2014-04-07 00:55:53 +02:00
|
|
|
parseRoutingRule(parser, currentRouter, currentAttribute, preType, rulesStck);
|
2014-02-02 14:06:09 +01:00
|
|
|
}
|
|
|
|
} else if (tok == XmlPullParser.END_TAG) {
|
|
|
|
String pname = parser.getName();
|
|
|
|
if (checkTag(pname)) {
|
|
|
|
rulesStck.pop();
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-03-08 15:50:07 +01:00
|
|
|
is.close();
|
2013-04-18 23:35:02 +02:00
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2014-02-02 14:06:09 +01:00
|
|
|
private static void parseRoutingParameter(XmlPullParser parser, GeneralRouter currentRouter) {
|
|
|
|
String description = parser.getAttributeValue("", "description");
|
2017-03-12 16:35:43 +01:00
|
|
|
String group = parser.getAttributeValue("", "group");
|
2014-02-02 14:06:09 +01:00
|
|
|
String name = parser.getAttributeValue("", "name");
|
|
|
|
String id = parser.getAttributeValue("", "id");
|
|
|
|
String type = parser.getAttributeValue("", "type");
|
2017-03-12 16:35:43 +01:00
|
|
|
boolean defaultValue = Boolean.parseBoolean(parser.getAttributeValue("", "default"));
|
2020-03-02 14:38:56 +01:00
|
|
|
if ("boolean".equalsIgnoreCase(type)) {
|
2017-03-12 16:35:43 +01:00
|
|
|
currentRouter.registerBooleanParameter(id, Algorithms.isEmpty(group) ? null : group, name, description, defaultValue);
|
2020-03-02 14:38:56 +01:00
|
|
|
} else if ("numeric".equalsIgnoreCase(type)) {
|
2014-02-02 14:06:09 +01:00
|
|
|
String values = parser.getAttributeValue("", "values");
|
|
|
|
String valueDescriptions = parser.getAttributeValue("", "valueDescriptions");
|
|
|
|
String[] strValues = values.split(",");
|
|
|
|
Double[] vls = new Double[strValues.length];
|
2019-03-17 14:09:41 +01:00
|
|
|
for (int i = 0; i < vls.length; i++) {
|
|
|
|
vls[i] = Double.parseDouble(strValues[i].trim());
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
2014-02-02 14:06:09 +01:00
|
|
|
currentRouter.registerNumericParameter(id, name, description, vls ,
|
|
|
|
valueDescriptions.split(","));
|
2013-04-18 23:35:02 +02:00
|
|
|
} else {
|
2014-02-02 14:06:09 +01:00
|
|
|
throw new UnsupportedOperationException("Unsupported routing parameter type - " + type);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
}
|
2014-02-02 14:06:09 +01:00
|
|
|
|
|
|
|
private static class RoutingRule {
|
|
|
|
String tagName;
|
|
|
|
String t;
|
|
|
|
String v;
|
|
|
|
String param;
|
|
|
|
String value1;
|
|
|
|
String value2;
|
|
|
|
String type;
|
|
|
|
}
|
2013-04-18 23:35:02 +02:00
|
|
|
|
2014-02-02 14:06:09 +01:00
|
|
|
private static void parseRoutingRule(XmlPullParser parser, GeneralRouter currentRouter, RouteDataObjectAttribute attr,
|
2014-04-07 00:55:53 +02:00
|
|
|
String parentType, Stack<RoutingRule> stack) {
|
2014-02-02 14:06:09 +01:00
|
|
|
String pname = parser.getName();
|
|
|
|
if (checkTag(pname)) {
|
|
|
|
if(attr == null){
|
|
|
|
throw new NullPointerException("Select tag filter outside road attribute < " + pname + " > : "+parser.getLineNumber());
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
2014-02-02 14:06:09 +01:00
|
|
|
RoutingRule rr = new RoutingRule();
|
|
|
|
rr.tagName = pname;
|
|
|
|
rr.t = parser.getAttributeValue("", "t");
|
|
|
|
rr.v = parser.getAttributeValue("", "v");
|
|
|
|
rr.param = parser.getAttributeValue("", "param");
|
|
|
|
rr.value1 = parser.getAttributeValue("", "value1");
|
|
|
|
rr.value2 = parser.getAttributeValue("", "value2");
|
|
|
|
rr.type = parser.getAttributeValue("", "type");
|
2014-04-07 00:55:53 +02:00
|
|
|
if((rr.type == null || rr.type.length() == 0) &&
|
|
|
|
parentType != null && parentType.length() > 0) {
|
|
|
|
rr.type = parentType;
|
|
|
|
}
|
2014-02-02 14:06:09 +01:00
|
|
|
|
|
|
|
RouteAttributeContext ctx = currentRouter.getObjContext(attr);
|
|
|
|
if("select".equals(rr.tagName)) {
|
|
|
|
String val = parser.getAttributeValue("", "value");
|
2014-04-07 00:55:53 +02:00
|
|
|
String type = rr.type;
|
2014-02-02 14:06:09 +01:00
|
|
|
ctx.registerNewRule(val, type);
|
|
|
|
addSubclause(rr, ctx);
|
|
|
|
for (int i = 0; i < stack.size(); i++) {
|
|
|
|
addSubclause(stack.get(i), ctx);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
2020-03-02 14:38:56 +01:00
|
|
|
} else if (stack.size() > 0 && "select".equals(stack.peek().tagName)) {
|
2014-02-02 14:06:09 +01:00
|
|
|
addSubclause(rr, ctx);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
2014-02-02 14:06:09 +01:00
|
|
|
stack.push(rr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static boolean checkTag(String pname) {
|
|
|
|
return "select".equals(pname) || "if".equals(pname) || "ifnot".equals(pname)
|
2016-11-10 17:41:06 +01:00
|
|
|
|| "gt".equals(pname) || "le".equals(pname) || "eq".equals(pname);
|
2014-02-02 14:06:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private static void addSubclause(RoutingRule rr, RouteAttributeContext ctx) {
|
|
|
|
boolean not = "ifnot".equals(rr.tagName);
|
|
|
|
if(!Algorithms.isEmpty(rr.param)) {
|
|
|
|
ctx.getLastRule().registerAndParamCondition(rr.param, not);
|
|
|
|
}
|
|
|
|
if (!Algorithms.isEmpty(rr.t)) {
|
|
|
|
ctx.getLastRule().registerAndTagValueCondition(rr.t, Algorithms.isEmpty(rr.v) ? null : rr.v, not);
|
|
|
|
}
|
2020-03-02 14:38:56 +01:00
|
|
|
if ("gt".equals(rr.tagName)) {
|
2014-02-02 14:06:09 +01:00
|
|
|
ctx.getLastRule().registerGreatCondition(rr.value1, rr.value2, rr.type);
|
2020-03-02 14:38:56 +01:00
|
|
|
} else if ("le".equals(rr.tagName)) {
|
2014-02-02 14:06:09 +01:00
|
|
|
ctx.getLastRule().registerLessCondition(rr.value1, rr.value2, rr.type);
|
2020-03-02 14:38:56 +01:00
|
|
|
} else if ("eq".equals(rr.tagName)) {
|
2016-11-10 17:41:06 +01:00
|
|
|
ctx.getLastRule().registerEqualCondition(rr.value1, rr.value2, rr.type);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-13 09:37:43 +02:00
|
|
|
private static GeneralRouter parseRoutingProfile(XmlPullParser parser, final RoutingConfiguration.Builder config, String filename) {
|
2019-05-16 16:24:48 +02:00
|
|
|
String currentSelectedRouterName = parser.getAttributeValue("", "name");
|
2013-04-18 23:35:02 +02:00
|
|
|
Map<String, String> attrs = new LinkedHashMap<String, String>();
|
|
|
|
for(int i=0; i< parser.getAttributeCount(); i++) {
|
|
|
|
attrs.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
|
|
|
}
|
|
|
|
GeneralRouterProfile c = Algorithms.parseEnumValue(GeneralRouterProfile.values(),
|
|
|
|
parser.getAttributeValue("", "baseProfile"), GeneralRouterProfile.CAR);
|
2014-02-02 14:06:09 +01:00
|
|
|
GeneralRouter currentRouter = new GeneralRouter(c, attrs);
|
2019-05-16 16:24:48 +02:00
|
|
|
currentRouter.setProfileName(currentSelectedRouterName);
|
2019-05-13 09:37:43 +02:00
|
|
|
if (filename != null) {
|
|
|
|
currentRouter.setFilename(filename);
|
2019-05-21 14:13:14 +02:00
|
|
|
currentSelectedRouterName = filename + "/" + currentSelectedRouterName;
|
2019-05-13 09:37:43 +02:00
|
|
|
}
|
2019-05-16 16:24:48 +02:00
|
|
|
|
|
|
|
config.routers.put(currentSelectedRouterName, currentRouter);
|
2013-04-18 23:35:02 +02:00
|
|
|
return currentRouter;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void parseAttribute(XmlPullParser parser, final RoutingConfiguration.Builder config, GeneralRouter currentRouter) {
|
|
|
|
if(currentRouter != null) {
|
|
|
|
currentRouter.addAttribute(parser.getAttributeValue("", "name"),
|
|
|
|
parser.getAttributeValue("", "value"));
|
|
|
|
} else {
|
2019-05-16 16:24:48 +02:00
|
|
|
config.attributes.put(parser.getAttributeValue("", "name"),
|
2013-04-18 23:35:02 +02:00
|
|
|
parser.getAttributeValue("", "value"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|