Skip to content

Commit

Permalink
now loading crossing params from .net.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 18, 2024
1 parent 497d025 commit 4628ba6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/netbuild/NBNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3657,8 +3657,11 @@ NBNode::isRoundabout() const {

NBNode::Crossing*
NBNode::addCrossing(EdgeVector edges, double width, bool priority, int tlIndex, int tlIndex2,
const PositionVector& customShape, bool fromSumoNet) {
const PositionVector& customShape, bool fromSumoNet, const Parameterised* params) {
Crossing* c = new Crossing(this, edges, width, priority, tlIndex, tlIndex2, customShape);
if (params != nullptr) {
c->updateParameters(params->getParametersMap());
}
myCrossings.push_back(std::unique_ptr<Crossing>(c));
if (fromSumoNet) {
myCrossingsLoadedFromSumoNet += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/netbuild/NBNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ class NBNode : public Named, public Parameterised {

/// @brief add a pedestrian crossing to this node
NBNode::Crossing* addCrossing(EdgeVector edges, double width, bool priority, int tlIndex = -1, int tlIndex2 = -1,
const PositionVector& customShape = PositionVector::EMPTY, bool fromSumoNet = false);
const PositionVector& customShape = PositionVector::EMPTY, bool fromSumoNet = false, const Parameterised* params = nullptr);

/// @brief add custom shape for walkingArea
void addWalkingAreaShape(EdgeVector edges, const PositionVector& shape, double width);
Expand Down
4 changes: 3 additions & 1 deletion src/netimport/NIImporter_SUMO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ NIImporter_SUMO::_loadNetwork(OptionsCont& oc) {
}
if (!edges.empty()) {
node->addCrossing(edges, crossing.width, crossing.priority,
crossing.customTLIndex, crossing.customTLIndex2, crossing.customShape, true);
crossing.customTLIndex, crossing.customTLIndex2, crossing.customShape, true, &crossing);
}
}
}
Expand Down Expand Up @@ -654,6 +654,8 @@ NIImporter_SUMO::addLane(const SUMOSAXAttributes& attrs) {
std::vector<Crossing>& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(myCurrentEdge->id)];
assert(crossings.size() > 0);
crossings.back().width = attrs.get<double>(SUMO_ATTR_WIDTH, id.c_str(), ok);
myLastParameterised.pop_back();
myLastParameterised.push_back(&crossings.back());
if (myCurrentLane->customShape) {
crossings.back().customShape = myCurrentLane->shape;
NBNetBuilder::transformCoordinates(crossings.back().customShape, true, myLocation);
Expand Down
2 changes: 1 addition & 1 deletion src/netimport/NIImporter_SUMO.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class NIImporter_SUMO : public SUMOSAXHandler {
/** @struct Crossing
* @brief Describes a pedestrian crossing
*/
struct Crossing {
struct Crossing : public Parameterised {
Crossing(const std::string& _edgeID) :
edgeID(_edgeID), customTLIndex(-1), customTLIndex2(-1) {}

Expand Down

1 comment on commit 4628ba6

@namdre
Copy link
Contributor Author

@namdre namdre commented on 4628ba6 Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref #14531

Please sign in to comment.