traci._route
1# -*- coding: utf-8 -*- 2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3# Copyright (C) 2008-2026 German Aerospace Center (DLR) and others. 4# This program and the accompanying materials are made available under the 5# terms of the Eclipse Public License 2.0 which is available at 6# https://www.eclipse.org/legal/epl-2.0/ 7# This Source Code may also be made available under the following Secondary 8# Licenses when the conditions for such availability set forth in the Eclipse 9# Public License 2.0 are satisfied: GNU General Public License, version 2 10# or later which is available at 11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html 12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later 13 14# @file _route.py 15# @author Michael Behrisch 16# @author Lena Kalleske 17# @date 2008-10-09 18 19from __future__ import absolute_import 20from . import constants as tc 21from .domain import Domain 22 23 24class RouteDomain(Domain): 25 26 def __init__(self): 27 Domain.__init__(self, "route", tc.CMD_GET_ROUTE_VARIABLE, tc.CMD_SET_ROUTE_VARIABLE, 28 tc.CMD_SUBSCRIBE_ROUTE_VARIABLE, tc.RESPONSE_SUBSCRIBE_ROUTE_VARIABLE, 29 tc.CMD_SUBSCRIBE_ROUTE_CONTEXT, tc.RESPONSE_SUBSCRIBE_ROUTE_CONTEXT) 30 31 def getEdges(self, routeID): 32 """getEdges(string) -> tuple(string) 33 34 Returns a tuple of all edges in the route. 35 """ 36 return self._getUniversal(tc.VAR_EDGES, routeID) 37 38 def add(self, routeID, edges): 39 """add(string, list(string)) -> None 40 41 Adds a new route with the given id consisting of the given list of edge IDs. 42 """ 43 self._setCmd(tc.ADD, routeID, "l", edges) 44 45 def remove(self, routeID): 46 """remove(string) -> None 47 48 Removes the given route. 49 """ 50 self._setCmd(tc.REMOVE, routeID)
class
RouteDomain(traci.domain.Domain):
25class RouteDomain(Domain): 26 27 def __init__(self): 28 Domain.__init__(self, "route", tc.CMD_GET_ROUTE_VARIABLE, tc.CMD_SET_ROUTE_VARIABLE, 29 tc.CMD_SUBSCRIBE_ROUTE_VARIABLE, tc.RESPONSE_SUBSCRIBE_ROUTE_VARIABLE, 30 tc.CMD_SUBSCRIBE_ROUTE_CONTEXT, tc.RESPONSE_SUBSCRIBE_ROUTE_CONTEXT) 31 32 def getEdges(self, routeID): 33 """getEdges(string) -> tuple(string) 34 35 Returns a tuple of all edges in the route. 36 """ 37 return self._getUniversal(tc.VAR_EDGES, routeID) 38 39 def add(self, routeID, edges): 40 """add(string, list(string)) -> None 41 42 Adds a new route with the given id consisting of the given list of edge IDs. 43 """ 44 self._setCmd(tc.ADD, routeID, "l", edges) 45 46 def remove(self, routeID): 47 """remove(string) -> None 48 49 Removes the given route. 50 """ 51 self._setCmd(tc.REMOVE, routeID)
def
getEdges(self, routeID):
32 def getEdges(self, routeID): 33 """getEdges(string) -> tuple(string) 34 35 Returns a tuple of all edges in the route. 36 """ 37 return self._getUniversal(tc.VAR_EDGES, routeID)
getEdges(string) -> tuple(string)
Returns a tuple of all edges in the route.
def
add(self, routeID, edges):
39 def add(self, routeID, edges): 40 """add(string, list(string)) -> None 41 42 Adds a new route with the given id consisting of the given list of edge IDs. 43 """ 44 self._setCmd(tc.ADD, routeID, "l", edges)
add(string, list(string)) -> None
Adds a new route with the given id consisting of the given list of edge IDs.