Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0d55cd5421
2 changed files with 13 additions and 1 deletions
|
@ -57,6 +57,7 @@ public class GeneralRouter implements VehicleRouter {
|
|||
private float maxDefaultSpeed = 10;
|
||||
|
||||
private TLongHashSet impassableRoads;
|
||||
private GeneralRouterProfile profile;
|
||||
|
||||
|
||||
public enum RouteDataObjectAttribute {
|
||||
|
@ -97,6 +98,7 @@ public class GeneralRouter implements VehicleRouter {
|
|||
}
|
||||
|
||||
public GeneralRouter(GeneralRouterProfile profile, Map<String, String> attributes) {
|
||||
this.profile = profile;
|
||||
this.attributes = new LinkedHashMap<String, String>();
|
||||
Iterator<Entry<String, String>> e = attributes.entrySet().iterator();
|
||||
while(e.hasNext()){
|
||||
|
@ -115,6 +117,7 @@ public class GeneralRouter implements VehicleRouter {
|
|||
}
|
||||
|
||||
public GeneralRouter(GeneralRouter parent, Map<String, String> params) {
|
||||
this.profile = parent.profile;
|
||||
this.attributes = new LinkedHashMap<String, String>();
|
||||
Iterator<Entry<String, String>> e = parent.attributes.entrySet().iterator();
|
||||
while (e.hasNext()) {
|
||||
|
@ -141,6 +144,11 @@ public class GeneralRouter implements VehicleRouter {
|
|||
|
||||
}
|
||||
|
||||
public GeneralRouterProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, RoutingParameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,10 @@ public class RoutePlannerFrontEnd {
|
|||
boolean res = false;
|
||||
GeneralRouter router = (GeneralRouter) ctx.getRouter();
|
||||
if (router != null && !router.isAllowPrivate()) {
|
||||
ctx.setRouter(new GeneralRouter(GeneralRouterProfile.CAR, new LinkedHashMap<String, String>()));
|
||||
ctx.unloadAllData();
|
||||
LinkedHashMap<String, String> mp = new LinkedHashMap<String, String>();
|
||||
mp.put(GeneralRouter.ALLOW_PRIVATE, "true");
|
||||
ctx.setRouter(new GeneralRouter(router.getProfile(), mp));
|
||||
for (LatLon latLon : points) {
|
||||
RouteSegmentPoint rp = findRouteSegment(latLon.getLatitude(), latLon.getLongitude(), ctx, null);
|
||||
if (rp != null && rp.road != null) {
|
||||
|
@ -125,6 +128,7 @@ public class RoutePlannerFrontEnd {
|
|||
}
|
||||
}
|
||||
}
|
||||
ctx.unloadAllData();
|
||||
ctx.setRouter(router);
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue