transforming tags WIP
This commit is contained in:
parent
7f9392c610
commit
78880e11b1
4 changed files with 60 additions and 4 deletions
|
@ -73,6 +73,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
private float floatValue;
|
||||
private int type;
|
||||
private List<RouteTypeCondition> conditions = null;
|
||||
private TIntObjectHashMap<Integer> directions = null;
|
||||
private int forward;
|
||||
|
||||
public RouteTypeRule() {
|
||||
|
@ -165,6 +166,10 @@ public class BinaryMapRouteReaderAdapter {
|
|||
return conditions != null;
|
||||
}
|
||||
|
||||
public boolean directional() {
|
||||
return directions != null;
|
||||
}
|
||||
|
||||
public String getNonConditionalTag() {
|
||||
String tag = getTag();
|
||||
if(tag != null && tag.endsWith(":conditional")) {
|
||||
|
@ -173,6 +178,11 @@ public class BinaryMapRouteReaderAdapter {
|
|||
return tag;
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
public String getNonDirectionalTag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int onewayDirection(){
|
||||
if(type == ONEWAY){
|
||||
return intValue;
|
||||
|
@ -286,7 +296,12 @@ public class BinaryMapRouteReaderAdapter {
|
|||
if (i > 0) {
|
||||
intValue = Integer.parseInt(v.substring(0, i));
|
||||
}
|
||||
} else if (t.endsWith("direction") && v!=null) {
|
||||
type = TRAFFIC_SIGNALS;
|
||||
directions = new TIntObjectHashMap<Integer>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,6 +359,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
while (routeEncodingRules.size() <= id) {
|
||||
routeEncodingRules.add(null);
|
||||
}
|
||||
/**TODO delete*/ System.out.println(String.format("initRouteIncodingRule=> id: %d, tag: %s, val: %s", id, tags, val));
|
||||
routeEncodingRules.set(id, new RouteTypeRule(tags, val));
|
||||
if (tags.equals("name")) {
|
||||
nameTypeRule = id;
|
||||
|
|
|
@ -541,6 +541,44 @@ public class RouteDataObject {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO implement
|
||||
public void processDirectionalTags() {
|
||||
if (pointTypes != null) {
|
||||
for (int i = 0; i < pointTypes.length; i++) {
|
||||
if (pointTypes[i] != null) {
|
||||
int[] pTypes = pointTypes[i];
|
||||
int pSz = pTypes.length;
|
||||
if (pSz > 0) {
|
||||
for (int j = 0; j < pSz; j++) {
|
||||
RouteTypeRule r = region.quickGetEncodingRule(pTypes[j]);
|
||||
if (r != null && r.directional()) {
|
||||
// int vl = r.conditionalValue(conditionalTime);
|
||||
// if (vl != 0) {
|
||||
// RouteTypeRule rtr = region.quickGetEncodingRule(vl);
|
||||
// String nonCondTag = rtr.getTag();
|
||||
// int ks;
|
||||
// for (ks = 0; ks < pointTypes[i].length; ks++) {
|
||||
// RouteTypeRule toReplace = region.quickGetEncodingRule(pointTypes[i][j]);
|
||||
// if (toReplace != null && toReplace.getTag().contentEquals(nonCondTag)) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (ks == pTypes.length) {
|
||||
// int[] ntypes = new int[pTypes.length + 1];
|
||||
// System.arraycopy(pTypes, 0, ntypes, 0, pTypes.length);
|
||||
// pTypes = ntypes;
|
||||
// }
|
||||
// pTypes[ks] = vl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
pointTypes[i] = pTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getMaximumSpeed(boolean direction) {
|
||||
int sz = types.length;
|
||||
float maxSpeed = 0;
|
||||
|
@ -1054,6 +1092,4 @@ public class RouteDataObject {
|
|||
}
|
||||
restrictionsVia[k] = viaWay;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class RoutingConfiguration {
|
|||
public float recalculateDistance = 20000f;
|
||||
|
||||
// 1.6 Time to calculate all access restrictions based on conditions
|
||||
public long routeCalculationTime = 0;
|
||||
public long routeCalculationTime = 1592317409;//0;
|
||||
|
||||
public static class Builder {
|
||||
// Design time storage
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.apache.commons.logging.Log;
|
|||
import gnu.trove.iterator.TIntObjectIterator;
|
||||
import gnu.trove.iterator.TLongIterator;
|
||||
import gnu.trove.map.TLongObjectMap;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||
import gnu.trove.set.hash.TLongHashSet;
|
||||
import net.osmand.NativeLibrary;
|
||||
|
@ -308,6 +309,7 @@ public class RoutingContext {
|
|||
}
|
||||
ts.excludedIds.add(ro.getId());
|
||||
}
|
||||
ro.processDirectionalTags();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -607,6 +609,8 @@ public class RoutingContext {
|
|||
public TLongObjectMap<RouteSegment> getRoutes() {
|
||||
return routes;
|
||||
}
|
||||
private TIntObjectHashMap<Integer> forwardTags;
|
||||
private TIntObjectHashMap<Integer> backwardTags;
|
||||
|
||||
public void loadAllObjects(final List<RouteDataObject> toFillIn, RoutingContext ctx, TLongObjectHashMap<RouteDataObject> excludeDuplications) {
|
||||
if(routes != null) {
|
||||
|
|
Loading…
Reference in a new issue