Skip to content

Commit

Permalink
fix #4143
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Jun 6, 2018
1 parent e99930d commit 8b43cf1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/netbuild/NBNetBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,9 @@ NBNetBuilder::compute(OptionsCont& oc, const std::set<std::string>& explicitTurn
before = SysUtils::getCurrentMillis();
PROGRESS_BEGIN_MESSAGE("Find accesses for pt rail stops");
double maxRadius = oc.getFloat("osm.stop-output.footway-access-distance");
double accessFactor = oc.getFloat("osm.stop-output.footway-access-factor");
int maxCount = oc.getInt("osm.stop-output.footway-max-accesses");
myPTStopCont.findAccessEdgesForRailStops(myEdgeCont, maxRadius, maxCount);
myPTStopCont.findAccessEdgesForRailStops(myEdgeCont, maxRadius, maxCount, accessFactor);
PROGRESS_TIME_MESSAGE(before);
}

Expand Down
5 changes: 3 additions & 2 deletions src/netbuild/NBPTStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ NBPTStop::write(OutputDevice& device) {
device.openTag(SUMO_TAG_ACCESS);
device.writeAttr(SUMO_ATTR_LANE, std::get<0>(tuple));
device.writeAttr(SUMO_ATTR_POSITION, std::get<1>(tuple));
device.writeAttr(SUMO_ATTR_LENGTH, std::get<2>(tuple));
device.writeAttr(SUMO_ATTR_FRIENDLY_POS, true);
device.closeTag();
}
Expand Down Expand Up @@ -223,8 +224,8 @@ NBPTStop::setMyPTStopId(std::string id) {


void
NBPTStop::addAccess(std::string laneID, double offset) {
myAccesses.push_back(std::make_tuple(laneID, offset));
NBPTStop::addAccess(std::string laneID, double offset, double length) {
myAccesses.push_back(std::make_tuple(laneID, offset, length));
}


Expand Down
5 changes: 3 additions & 2 deletions src/netbuild/NBPTStop.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class NBPTStop {
bool findLaneAndComputeBusStopExtend(NBEdgeCont& ec);

void setMyPTStopId(std::string id);
void addAccess(std::string laneID, double offset);
void addAccess(std::string laneID, double offset, double length);

/// @brief register line that services this stop (for displaying)
void addLine(const std::string& line);
Expand All @@ -100,7 +100,8 @@ class NBPTStop {
double myStartPos;
double myEndPos;

std::vector<std::tuple<std::string, double>> myAccesses;
/// @brief laneId, lanePos, accessLength
std::vector<std::tuple<std::string, double, double>> myAccesses;

/// @brief list of public transport lines (for displaying)
std::vector<std::string> myLines;
Expand Down
6 changes: 4 additions & 2 deletions src/netbuild/NBPTStopCont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ NBPTStopCont::alignIdSigns() {


void
NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount) {
NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor) {
NamedRTree r;
for (auto edge : cont) {
const Boundary& bound = edge.second->getGeometry().getBoxBoundary();
Expand All @@ -314,6 +314,7 @@ NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, in
const std::string& stopEdgeID = ptStop.second->getEdgeId();
NBEdge* stopEdge = cont.getByID(stopEdgeID);
//std::cout << "findAccessEdgesForRailStops edge=" << stopEdgeID << " exists=" << (stopEdge != 0) << "\n";
//if (stopEdge != 0 && (stopEdge->getPermissions() & SVC_PEDESTRIAN) == 0) {
if (stopEdge != 0 && isRailway(stopEdge->getPermissions())) {
std::set<std::string> ids;
Named::StoringVisitor visitor(ids);
Expand All @@ -337,7 +338,8 @@ NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, in
double offset = lane.shape.nearest_offset_to_point2D(pos, false);
double finalLength = edge->getFinalLength();
double laneLength = lane.shape.length();
ptStop.second->addAccess(edge->getLaneID(laneIdx), offset * finalLength / laneLength);
double accessLength = pos.distanceTo2D(lane.shape.positionAtOffset2D(offset)) * accessFactor;
ptStop.second->addAccess(edge->getLaneID(laneIdx), offset * finalLength / laneLength, accessLength);
cnt++;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/netbuild/NBPTStopCont.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class NBPTStopCont {

void localizePTStops(NBEdgeCont& cont);

void findAccessEdgesForRailStops(NBEdgeCont& cont, double d, int i);
void findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor);

void postprocess(std::set<std::string>& usedStops);

Expand Down
3 changes: 3 additions & 0 deletions src/netwrite/NWFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ NWFrame::fillOptions(bool forNetgen) {

oc.doRegister("osm.stop-output.footway-max-accesses", new Option_Integer(5));
oc.addDescription("osm.stop-output.footway-max-accesses", "Output", "The maximum roud accesses registered per rail stops");

oc.doRegister("osm.stop-output.footway-access-factor", new Option_Float(1.5));
oc.addDescription("osm.stop-output.footway-access-factor", "Output", "The walking length of the access is computed as air-line distance multiplied by FLOAT");
}

// register opendrive options
Expand Down

0 comments on commit 8b43cf1

Please sign in to comment.