Fix compilation errors
This commit is contained in:
parent
282101588b
commit
041ba66d05
6 changed files with 60 additions and 21 deletions
|
@ -12,17 +12,15 @@ public class ToDoConstants {
|
|||
|
||||
// Map QuadTree (skip small areas!!!)
|
||||
// POI index exclude building hno from categories!!!
|
||||
// Routing index
|
||||
// Routing index !!
|
||||
// Identify coastline areas and pure ocean areas !!!
|
||||
|
||||
// Polish UI with new builiding style
|
||||
|
||||
|
||||
// Polish UI with new builiding address search ...(Better completely new address search)
|
||||
// Test images in the map
|
||||
|
||||
|
||||
// TODO
|
||||
// Ref and other names are not provided as additional types (on level < 15)!
|
||||
|
||||
|
||||
// == Osmand application (TODO 127) ==
|
||||
// TODO prepare C++ version of routing algorithm
|
||||
|
||||
|
|
|
@ -26,9 +26,20 @@ public class BinaryMapDataObject {
|
|||
|
||||
public String getName(){
|
||||
if(objectNames == null){
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
return objectNames.get(mapIndex.nameEncodingType);
|
||||
String name = objectNames.get(mapIndex.nameEncodingType);
|
||||
if(name == null){
|
||||
return "";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRef(){
|
||||
if(mapIndex.refEncodingType != -1 && objectNames != null) {
|
||||
return objectNames.get(mapIndex.refEncodingType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TIntObjectHashMap<String> getObjectNames() {
|
||||
|
|
|
@ -566,6 +566,10 @@ public class BinaryMapIndexReader {
|
|||
index.encodingRules.get(tag).put(val, id);
|
||||
if("name".equals(tag)){
|
||||
index.nameEncodingType = id;
|
||||
} else if("natural".equals(tag) && "coastline".equals(val)){
|
||||
index.coastlineEncodingType = id;
|
||||
} else if("ref".equals(tag)){
|
||||
index.refEncodingType = id;
|
||||
}
|
||||
if(!index.decodingRules.containsKey(id)){
|
||||
index.decodingRules.put(id, new TagValuePair(tag, val, type));
|
||||
|
@ -1316,6 +1320,8 @@ public class BinaryMapIndexReader {
|
|||
Map<String, Map<String, Integer>> encodingRules = new LinkedHashMap<String, Map<String, Integer>>();
|
||||
TIntObjectMap<TagValuePair> decodingRules = new TIntObjectHashMap<TagValuePair>();
|
||||
int nameEncodingType = 0;
|
||||
int refEncodingType = -1;
|
||||
int coastlineEncodingType = 0;
|
||||
|
||||
public List<MapRoot> getRoots() {
|
||||
return roots;
|
||||
|
|
|
@ -440,6 +440,7 @@ public class BinaryRoutePlanner {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private RouteSegment processIntersectionsWithWays(RoutingContext ctx, PriorityQueue<RouteSegment> graphSegments,
|
||||
|
@ -487,25 +488,25 @@ public class BinaryRoutePlanner {
|
|||
if ((!alreadyVisited && processRoad) || oppositeConnectionFound) {
|
||||
int type = -1;
|
||||
if (!reverseWay) {
|
||||
for (int i = 0; i < road.getRestrictionCount(); i++) {
|
||||
if (road.getRestriction(i) == next.road.getId()) {
|
||||
type = road.getRestrictionType(i);
|
||||
for (int i = 0; i < getRestrictionCount(road); i++) {
|
||||
if (getRestriction(road, i) == next.road.getId()) {
|
||||
type = getRestrictionType(road, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < next.road.getRestrictionCount(); i++) {
|
||||
if (next.road.getRestriction(i) == road.getId()) {
|
||||
type = next.road.getRestrictionType(i);
|
||||
for (int i = 0; i < getRestrictionCount(next.road); i++) {
|
||||
if (getRestriction(next.road, i) == road.getId()) {
|
||||
type = getRestrictionType(next.road, i);
|
||||
break;
|
||||
}
|
||||
// Check if there is restriction only to the current road
|
||||
if (next.road.getRestrictionType(i) == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN
|
||||
|| next.road.getRestrictionType(i) == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN
|
||||
|| next.road.getRestrictionType(i) == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) {
|
||||
if (getRestrictionType(next.road, i) == MapRenderingTypes.RESTRICTION_ONLY_RIGHT_TURN
|
||||
|| getRestrictionType(next.road, i) == MapRenderingTypes.RESTRICTION_ONLY_LEFT_TURN
|
||||
|| getRestrictionType(next.road, i) == MapRenderingTypes.RESTRICTION_ONLY_STRAIGHT_ON) {
|
||||
// check if that restriction applies to considered junk
|
||||
RouteSegment foundNext = inputNext;
|
||||
while(foundNext != null && foundNext.getRoad().getId() != next.road.getRestriction(i)){
|
||||
while(foundNext != null && foundNext.getRoad().getId() != getRestriction(next.road, i)){
|
||||
foundNext = foundNext.next;
|
||||
}
|
||||
if(foundNext != null) {
|
||||
|
@ -618,6 +619,21 @@ public class BinaryRoutePlanner {
|
|||
|
||||
|
||||
|
||||
private int getRestrictionType(BinaryMapDataObject road, int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
private long getRestriction(BinaryMapDataObject road, int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
private int getRestrictionCount(BinaryMapDataObject road) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
private List<RouteSegmentResult> prepareResult(RoutingContext ctx, RouteSegment start, RouteSegment end, long startNanoTime,
|
||||
RouteSegment finalDirectRoute, RouteSegment finalReverseRoute) {
|
||||
List<RouteSegmentResult> result = new ArrayList<RouteSegmentResult>();
|
||||
|
@ -681,9 +697,13 @@ public class BinaryRoutePlanner {
|
|||
" start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\">",
|
||||
startLat+"", startLon+"", endLat+"", endLon+""));
|
||||
for (RouteSegmentResult res : result) {
|
||||
String name = res.object.getName();
|
||||
if(res.object.getRef() != null) {
|
||||
name += " " + res.object.getRef();
|
||||
}
|
||||
// (res.object.getId() >> 1)
|
||||
System.out.println(MessageFormat.format("\t<segment id=\"{0}\" start=\"{1}\" end=\"{2}\" name=\"{3}\"/>",
|
||||
(res.object.getId() >> 1)+"", res.startPointIndex, res.endPointIndex, (res.object.getName()+"").replace(MapRenderingTypes.REF_CHAR, ' ')));
|
||||
(res.object.getId() >> 1)+"", res.startPointIndex, res.endPointIndex, name));
|
||||
}
|
||||
System.out.println("</test>");
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class CarRouter extends VehicleRouter {
|
|||
@Override
|
||||
public double defineSpeed(BinaryMapDataObject road) {
|
||||
TagValuePair pair = road.getTagValue(0);
|
||||
double speed = MapRenderingTypes.getMaxSpeedIfDefined(road.getHighwayAttributes()) / 3.6d;
|
||||
double speed = MapRenderingTypes.getMaxSpeedIfDefined(getHighwayAttributes(road)) / 3.6d;
|
||||
boolean highway = "highway".equals(pair.tag);
|
||||
double priority = highway && autoPriorityValues.containsKey(pair.value) ? autoPriorityValues.get(pair.value) : 0.5d;
|
||||
if (speed == 0 && highway) {
|
||||
|
|
|
@ -24,8 +24,12 @@ public abstract class VehicleRouter {
|
|||
public abstract boolean acceptPoint(TagValuePair pair);
|
||||
|
||||
|
||||
public int getHighwayAttributes(BinaryMapDataObject road){
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean isOneWay(BinaryMapDataObject road) {
|
||||
int attributes = road.getHighwayAttributes();
|
||||
int attributes = getHighwayAttributes(road);
|
||||
return MapRenderingTypes.isOneWayWay(attributes) || MapRenderingTypes.isRoundabout(attributes);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue