Fill out section distance in database during routing
This commit is contained in:
parent
06ad1415fb
commit
dd4ce8879b
1 changed files with 11 additions and 5 deletions
|
|
@ -219,7 +219,7 @@ public class RoutingService {
|
|||
routeSection.setPostRun(section.getType().equals(TemporaryRateObject.TemporaryRateObjectType.POST_RUN));
|
||||
routeSection.setPreRun(false);
|
||||
|
||||
routeSection.setDistance(section.getApproxDistance());
|
||||
routeSection.setDistance(section.getApproxDistance() == 0.0 ? null : section.getApproxDistance());
|
||||
|
||||
return routeSection;
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ public class RoutingService {
|
|||
}
|
||||
|
||||
if (connectionType == SourceConnectionType.FINAL_SECTION_WITH_NEAR_BY_NODE || connectionType == SourceConnectionType.CHAIN_END_IS_NEAR_BY_NODE) {
|
||||
duplicate.routeOverNearBy(source, nearByNode);
|
||||
duplicate.routeOverNearBy(source, nearByNode, distanceService.getDistanceForNode(source, nearByNode));
|
||||
}
|
||||
|
||||
routes.add(duplicate);
|
||||
|
|
@ -565,7 +565,6 @@ public class RoutingService {
|
|||
* - check if chain is routable
|
||||
* - add post run and main run
|
||||
*/
|
||||
var mainruns = container.getMainRuns();
|
||||
|
||||
for (var mainRun : container.getMainRuns()) {
|
||||
|
||||
|
|
@ -631,6 +630,10 @@ public class RoutingService {
|
|||
if (routable) {
|
||||
qualityRoutable = true;
|
||||
routeObj.setQuality(quality);
|
||||
|
||||
mainRunObj.setApproxDistance(distanceService.getDistanceForNode(mainRunStartNode, mainRunEndNode));
|
||||
postRunObj.setApproxDistance(distanceService.getDistanceForNode(mainRunEndNode, postRunEndNode));
|
||||
|
||||
routeObj.addPostRunSection(postRunObj);
|
||||
routeObj.addMainRunSection(mainRunObj);
|
||||
container.addRoute(routeObj);
|
||||
|
|
@ -694,6 +697,7 @@ public class RoutingService {
|
|||
|
||||
if (containerRate.isPresent()) {
|
||||
containerRateObj.setRate(containerRate.get());
|
||||
containerRateObj.setApproxDistance(distanceService.getDistanceForNode(startNode, endNode));
|
||||
container.getRates().add(containerRateObj);
|
||||
return containerRateObj;
|
||||
} else {
|
||||
|
|
@ -891,8 +895,10 @@ public class RoutingService {
|
|||
return clone;
|
||||
}
|
||||
|
||||
public void routeOverNearBy(Node source, Node nearByNode) {
|
||||
this.sections.add(new TemporaryRateObject(source, nearByNode, TemporaryRateObject.TemporaryRateObjectType.NEAR_BY));
|
||||
public void routeOverNearBy(Node source, Node nearByNode, double distance) {
|
||||
var rate = new TemporaryRateObject(source, nearByNode, TemporaryRateObject.TemporaryRateObjectType.NEAR_BY);
|
||||
rate.setApproxDistance(distance);
|
||||
this.sections.add(rate);
|
||||
this.nearBy = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue