Skip to content

Commit

Permalink
Now connection attribute "uncontrolled" is saved. Refs #2956
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Feb 15, 2018
1 parent 35796e3 commit ce97bb0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/netbuild/NBEdge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const double NBEdge::UNSPECIFIED_SIGNAL_OFFSET = -1;
const double NBEdge::UNSPECIFIED_LOADED_LENGTH = -1;
const double NBEdge::ANGLE_LOOKAHEAD = 10.0;
const int NBEdge::UNSPECIFIED_INTERNAL_LANE_INDEX = -1;
const bool NBEdge::UNSPECIFIED_CONNECTION_UNCONTROLLED = false;

// ===========================================================================
// method definitions
Expand Down Expand Up @@ -946,7 +947,8 @@ NBEdge::addLane2LaneConnection(int from, NBEdge* dest,
double contPos,
double visibility,
double speed,
const PositionVector& customShape) {
const PositionVector& customShape,
bool uncontrolled) {
if (myStep == INIT_REJECT_CONNECTIONS) {
return true;
}
Expand All @@ -959,7 +961,7 @@ NBEdge::addLane2LaneConnection(int from, NBEdge* dest,
if (!addEdge2EdgeConnection(dest)) {
return false;
}
return setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape);
return setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, uncontrolled);
}


Expand Down Expand Up @@ -989,7 +991,8 @@ NBEdge::setConnection(int lane, NBEdge* destEdge,
double contPos,
double visibility,
double speed,
const PositionVector& customShape) {
const PositionVector& customShape,
bool uncontrolled) {
if (myStep == INIT_REJECT_CONNECTIONS) {
return false;
}
Expand Down Expand Up @@ -1029,6 +1032,7 @@ NBEdge::setConnection(int lane, NBEdge* destEdge,
myConnections.back().visibility = visibility;
myConnections.back().speed = speed;
myConnections.back().customShape = customShape;
myConnections.back().uncontrolled = uncontrolled;
if (type == L2L_USER) {
myStep = LANES2LANES_USER;
} else {
Expand Down Expand Up @@ -1360,8 +1364,8 @@ NBEdge::replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection
if (toUse == -1) {
toUse = 0;
}
setConnection(toUse, (*i).toEdge, (*i).toLane, L2L_COMPUTED, false, (*i).mayDefinitelyPass, (*i).keepClear,
(*i).contPos, (*i).visibility, (*i).speed, (*i).customShape);
setConnection(toUse, i->toEdge, i->toLane, L2L_COMPUTED, false, i->mayDefinitelyPass, i->keepClear,
i->contPos, i->visibility, i->speed, i->customShape, i->uncontrolled);
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/netbuild/NBEdge.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,13 @@ class NBEdge : public Named, public Parameterised {

/// @brief the distance at which to take the default angle
static const double ANGLE_LOOKAHEAD;

/// @brief internal lane computation not yet done
static const int UNSPECIFIED_INTERNAL_LANE_INDEX;

/// @brief TLS-controlled despite its node controlled not specified.
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED;

/// @brief junction priority values set by setJunctionPriority
enum JunctionPriority {
MINOR_ROAD = 0,
Expand Down Expand Up @@ -765,7 +769,8 @@ class NBEdge : public Named, public Parameterised {
double contPos = UNSPECIFIED_CONTPOS,
double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
double speed = UNSPECIFIED_SPEED,
const PositionVector& customShape = PositionVector::EMPTY);
const PositionVector& customShape = PositionVector::EMPTY,
const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);

/** @brief Builds no connections starting at the given lanes
*
Expand Down Expand Up @@ -808,7 +813,8 @@ class NBEdge : public Named, public Parameterised {
double contPos = UNSPECIFIED_CONTPOS,
double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
double speed = UNSPECIFIED_SPEED,
const PositionVector& customShape = PositionVector::EMPTY);
const PositionVector& customShape = PositionVector::EMPTY,
const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);

/// @brief insert a previously created NBEdge::connection
void insertConnection(NBEdge::Connection connection);
Expand Down
3 changes: 2 additions & 1 deletion src/netimport/NIImporter_SUMO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ NIImporter_SUMO::_loadNetwork(OptionsCont& oc) {
}
nbe->addLane2LaneConnection(
fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
true, c.mayDefinitelyPass, c.keepClear, c.contPos, c.visibility, c.speed, c.customShape);
true, c.mayDefinitelyPass, c.keepClear, c.contPos, c.visibility, c.speed, c.customShape, c.uncontrolled);

// maybe we have a tls-controlled connection
if (c.tlID != "" && myRailSignals.count(c.tlID) == 0) {
Expand Down Expand Up @@ -706,6 +706,7 @@ NIImporter_SUMO::addConnection(const SUMOSAXAttributes& attrs) {
conn.visibility = attrs.getOpt<double>(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE);
conn.speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, 0, ok, NBEdge::UNSPECIFIED_SPEED);
conn.customShape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, 0, ok, PositionVector::EMPTY);
conn.uncontrolled = attrs.getOpt<bool>(SUMO_ATTR_UNCONTROLLED, 0, ok, NBEdge::UNSPECIFIED_CONNECTION_UNCONTROLLED, false);
if (conn.tlID != "") {
conn.tlLinkNo = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, 0, ok);
}
Expand Down
2 changes: 2 additions & 0 deletions src/netimport/NIImporter_SUMO.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ class NIImporter_SUMO : public SUMOSAXHandler {
double speed;
/// @brief custom shape connection
PositionVector customShape;
/// @brief if set to true, This connection will not be TLS-controlled despite its node being controlled.
bool uncontrolled;
};


Expand Down
3 changes: 3 additions & 0 deletions src/netwrite/NWWriter_SUMO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ NWWriter_SUMO::writeConnection(OutputDevice& into, const NBEdge& from, const NBE
if (c.customShape.size() != 0 && style != TLL) {
into.writeAttr(SUMO_ATTR_SHAPE, c.customShape);
}
if (c.uncontrolled != false && style != TLL) {
into.writeAttr(SUMO_ATTR_UNCONTROLLED, c.uncontrolled);
}
if (style != PLAIN) {
if (includeInternal) {
into.writeAttr(SUMO_ATTR_VIA, c.getInternalLaneID());
Expand Down

0 comments on commit ce97bb0

Please sign in to comment.