Skip to content

Commit

Permalink
adapting python api refs #14490
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 9, 2024
1 parent c519b3a commit e189189
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
Expand Up @@ -13,7 +13,7 @@
/****************************************************************************/
/// @file Constants.java
/// @author generated by "rebuildConstants.py"
/// @date 2023-11-05 15:36:27.935352
/// @date 2024-04-09 11:14:09.616128
///
// This script contains TraCI constant definitions from <SUMO_HOME>/src/libsumo/TraCIConstants.h.
/****************************************************************************/
Expand Down Expand Up @@ -700,6 +700,18 @@ public class Constants {
// last step vehicle halting number (get: e2, e3, lanes, edges)
public static final int LAST_STEP_VEHICLE_HALTING_NUMBER = 0x14;

// upstream junction (edges)
public static final int FROM_JUNCTION = 0x7b;

// downstream junction (edges)
public static final int TO_JUNCTION = 0x7c;

// incoming edges (junction)
public static final int INCOMING_EDGES = 0x7b;

// outgoing edges (junction)
public static final int OUTGOING_EDGES = 0x7c;

// last step mean vehicle length (get: induction loops, lanes, edges)
public static final int LAST_STEP_LENGTH = 0x15;

Expand Down
14 changes: 14 additions & 0 deletions tools/traci/_edge.py
Expand Up @@ -202,6 +202,20 @@ def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
"""
return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)

def getFromJunction(self, edgeID):
"""getFromJunction(string) -> string
Returns the id of the junction at the start of this edge
"""
return self._getUniversal(tc.FROM_JUNCTION, edgeID)

def getToJunction(self, edgeID):
"""getToJunction(string) -> string
Returns the id of the junction at the end of this edge
"""
return self._getUniversal(tc.TO_JUNCTION, edgeID)

def adaptTraveltime(self, edgeID, time, begin=None, end=None):
"""adaptTraveltime(string, double, double, double) -> None
Expand Down
14 changes: 14 additions & 0 deletions tools/traci/_junction.py
Expand Up @@ -42,3 +42,17 @@ def getShape(self, junctionID):
List of 2D positions (cartesian) describing the geometry.
"""
return self._getUniversal(tc.VAR_SHAPE, junctionID)

def getIncomingEdges(self, junctionID):
"""getIncomingEdges(string) -> list(string)
Returns the ids of the edges that end at this junction
"""
return self._getUniversal(tc.INCOMING_EDGES, junctionID)

def getOutgoingEdges(self, junctionID):
"""getOutgoingEdges(string) -> list(string)
Returns the ids of the edges that start at this junction
"""
return self._getUniversal(tc.OUTGOING_EDGES, junctionID)
14 changes: 13 additions & 1 deletion tools/traci/constants.py
Expand Up @@ -12,7 +12,7 @@

# @file constants.py
# @author generated by "rebuildConstants.py"
# @date 2023-11-05 15:36:27.935352
# @date 2024-04-09 11:14:09.616128

"""
This script contains TraCI constant definitions from <SUMO_HOME>/src/libsumo/TraCIConstants.h.
Expand Down Expand Up @@ -700,6 +700,18 @@
# last step vehicle halting number (get: e2, e3, lanes, edges)
LAST_STEP_VEHICLE_HALTING_NUMBER = 0x14

# upstream junction (edges)
FROM_JUNCTION = 0x7b

# downstream junction (edges)
TO_JUNCTION = 0x7c

# incoming edges (junction)
INCOMING_EDGES = 0x7b

# outgoing edges (junction)
OUTGOING_EDGES = 0x7c

# last step mean vehicle length (get: induction loops, lanes, edges)
LAST_STEP_LENGTH = 0x15

Expand Down

0 comments on commit e189189

Please sign in to comment.