Simplify tags
This commit is contained in:
parent
918495b2ad
commit
5b9e711e2a
2 changed files with 10 additions and 9 deletions
|
@ -42,6 +42,7 @@ public class BinaryMapRouteReaderAdapter {
|
||||||
String condition = "";
|
String condition = "";
|
||||||
OpeningHoursParser.OpeningHours hours = null;
|
OpeningHoursParser.OpeningHours hours = null;
|
||||||
String value;
|
String value;
|
||||||
|
int routeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RouteTypeRule {
|
public static class RouteTypeRule {
|
||||||
|
@ -117,17 +118,17 @@ public class BinaryMapRouteReaderAdapter {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String conditionalValue(long time) {
|
public int conditionalValue(long time) {
|
||||||
if (conditional()) {
|
if (conditional()) {
|
||||||
Calendar i = Calendar.getInstance();
|
Calendar i = Calendar.getInstance();
|
||||||
i.setTimeInMillis(time);
|
i.setTimeInMillis(time);
|
||||||
for (RouteTypeCondition c : conditions) {
|
for (RouteTypeCondition c : conditions) {
|
||||||
if (c.hours != null && c.hours.isOpenedForTime(i)) {
|
if (c.hours != null && c.hours.isOpenedForTime(i)) {
|
||||||
return c.value;
|
return c.routeType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float maxSpeed(){
|
public float maxSpeed(){
|
||||||
|
@ -293,7 +294,7 @@ public class BinaryMapRouteReaderAdapter {
|
||||||
String tag = rtr.getNonConditionalTag();
|
String tag = rtr.getNonConditionalTag();
|
||||||
for(RouteTypeCondition c : rtr.conditions ) {
|
for(RouteTypeCondition c : rtr.conditions ) {
|
||||||
if(tag != null && c.value != null) {
|
if(tag != null && c.value != null) {
|
||||||
findOrCreateRouteType(tag, c.value);
|
c.routeType = findOrCreateRouteType(tag, c.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -492,14 +492,14 @@ public class RouteDataObject {
|
||||||
for (int i = 0; i < sz; i++) {
|
for (int i = 0; i < sz; i++) {
|
||||||
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
|
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
|
||||||
if (r != null && r.conditional()) {
|
if (r != null && r.conditional()) {
|
||||||
String vl = r.conditionalValue(conditionalTime);
|
int vl = r.conditionalValue(conditionalTime);
|
||||||
if(vl != null) {
|
if(vl != 0) {
|
||||||
String nonCondTag = r.getNonConditionalTag();
|
RouteTypeRule rtr = region.quickGetEncodingRule(vl);
|
||||||
int tp = region.findOrCreateRouteType(nonCondTag, vl);
|
String nonCondTag = rtr.getTag();
|
||||||
for(int ks = 0; ks < types.length; ks++) {
|
for(int ks = 0; ks < types.length; ks++) {
|
||||||
RouteTypeRule toReplace = region.quickGetEncodingRule(types[ks]);
|
RouteTypeRule toReplace = region.quickGetEncodingRule(types[ks]);
|
||||||
if(toReplace != null && toReplace.getTag().equals(nonCondTag)) {
|
if(toReplace != null && toReplace.getTag().equals(nonCondTag)) {
|
||||||
types[ks] = tp;
|
types[ks] = vl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue