traci._parkingarea

 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    _parkingarea.py
15# @author  Jakob Erdmann
16# @author  Mirko Barthauer
17# @date    2020-06-02
18
19from __future__ import absolute_import
20from . import constants as tc
21from .domain import Domain
22
23
24class ParkingAreaDomain(Domain):
25
26    def __init__(self):
27        Domain.__init__(self, "parkingarea", tc.CMD_GET_PARKINGAREA_VARIABLE, tc.CMD_SET_PARKINGAREA_VARIABLE,
28                        tc.CMD_SUBSCRIBE_PARKINGAREA_VARIABLE, tc.RESPONSE_SUBSCRIBE_PARKINGAREA_VARIABLE,
29                        tc.CMD_SUBSCRIBE_PARKINGAREA_CONTEXT, tc.RESPONSE_SUBSCRIBE_PARKINGAREA_CONTEXT)
30
31    def getLaneID(self, stopID):
32        """getLaneID(string) -> string
33        Returns the lane of this calibrator (if it applies to a single lane)
34        """
35        return self._getUniversal(tc.VAR_LANE_ID, stopID)
36
37    def getStartPos(self, stopID):
38        """getStartPos(string) -> double
39
40        The starting position of the stop along the lane measured in m.
41        """
42        return self._getUniversal(tc.VAR_POSITION, stopID)
43
44    def getEndPos(self, stopID):
45        """getEndPos(string) -> double
46
47        The end position of the stop along the lane measured in m.
48        """
49        return self._getUniversal(tc.VAR_LANEPOSITION, stopID)
50
51    def getName(self, stopID):
52        """getName(string) -> string
53
54        Returns the name of this stop
55        """
56        return self._getUniversal(tc.VAR_NAME, stopID)
57
58    def getVehicleCount(self, stopID):
59        """getVehicleCount(string) -> integer
60        Get the total number of vehicles stopped at the named parking area.
61        """
62        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
63
64    def getVehicleIDs(self, stopID):
65        """getVehicleIDs(string) -> tuple(string)
66        Get the IDs of vehicles stopped at the named parking area.
67        """
68        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
69
70    def getAcceptedBadges(self, stopID):
71        """getAcceptedBadges(string) -> tuple(string)
72        Get the badge keywords which allow access to the parking area.
73        """
74        return self._getUniversal(tc.VAR_ACCESS_BADGE, stopID)
75
76    def setAcceptedBadges(self, stopID, badges):
77        """
78        setAcceptedBadges(string, list) ->  None
79        Set the badge keywords which allow access to the parking area.
80        """
81        if isinstance(badges, str):
82            badges = [badges]
83        self._setCmd(tc.VAR_ACCESS_BADGE, stopID, "l", badges)
class ParkingAreaDomain(traci.domain.Domain):
25class ParkingAreaDomain(Domain):
26
27    def __init__(self):
28        Domain.__init__(self, "parkingarea", tc.CMD_GET_PARKINGAREA_VARIABLE, tc.CMD_SET_PARKINGAREA_VARIABLE,
29                        tc.CMD_SUBSCRIBE_PARKINGAREA_VARIABLE, tc.RESPONSE_SUBSCRIBE_PARKINGAREA_VARIABLE,
30                        tc.CMD_SUBSCRIBE_PARKINGAREA_CONTEXT, tc.RESPONSE_SUBSCRIBE_PARKINGAREA_CONTEXT)
31
32    def getLaneID(self, stopID):
33        """getLaneID(string) -> string
34        Returns the lane of this calibrator (if it applies to a single lane)
35        """
36        return self._getUniversal(tc.VAR_LANE_ID, stopID)
37
38    def getStartPos(self, stopID):
39        """getStartPos(string) -> double
40
41        The starting position of the stop along the lane measured in m.
42        """
43        return self._getUniversal(tc.VAR_POSITION, stopID)
44
45    def getEndPos(self, stopID):
46        """getEndPos(string) -> double
47
48        The end position of the stop along the lane measured in m.
49        """
50        return self._getUniversal(tc.VAR_LANEPOSITION, stopID)
51
52    def getName(self, stopID):
53        """getName(string) -> string
54
55        Returns the name of this stop
56        """
57        return self._getUniversal(tc.VAR_NAME, stopID)
58
59    def getVehicleCount(self, stopID):
60        """getVehicleCount(string) -> integer
61        Get the total number of vehicles stopped at the named parking area.
62        """
63        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
64
65    def getVehicleIDs(self, stopID):
66        """getVehicleIDs(string) -> tuple(string)
67        Get the IDs of vehicles stopped at the named parking area.
68        """
69        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
70
71    def getAcceptedBadges(self, stopID):
72        """getAcceptedBadges(string) -> tuple(string)
73        Get the badge keywords which allow access to the parking area.
74        """
75        return self._getUniversal(tc.VAR_ACCESS_BADGE, stopID)
76
77    def setAcceptedBadges(self, stopID, badges):
78        """
79        setAcceptedBadges(string, list) ->  None
80        Set the badge keywords which allow access to the parking area.
81        """
82        if isinstance(badges, str):
83            badges = [badges]
84        self._setCmd(tc.VAR_ACCESS_BADGE, stopID, "l", badges)
def getLaneID(self, stopID):
32    def getLaneID(self, stopID):
33        """getLaneID(string) -> string
34        Returns the lane of this calibrator (if it applies to a single lane)
35        """
36        return self._getUniversal(tc.VAR_LANE_ID, stopID)

getLaneID(string) -> string Returns the lane of this calibrator (if it applies to a single lane)

def getStartPos(self, stopID):
38    def getStartPos(self, stopID):
39        """getStartPos(string) -> double
40
41        The starting position of the stop along the lane measured in m.
42        """
43        return self._getUniversal(tc.VAR_POSITION, stopID)

getStartPos(string) -> double

The starting position of the stop along the lane measured in m.

def getEndPos(self, stopID):
45    def getEndPos(self, stopID):
46        """getEndPos(string) -> double
47
48        The end position of the stop along the lane measured in m.
49        """
50        return self._getUniversal(tc.VAR_LANEPOSITION, stopID)

getEndPos(string) -> double

The end position of the stop along the lane measured in m.

def getName(self, stopID):
52    def getName(self, stopID):
53        """getName(string) -> string
54
55        Returns the name of this stop
56        """
57        return self._getUniversal(tc.VAR_NAME, stopID)

getName(string) -> string

Returns the name of this stop

def getVehicleCount(self, stopID):
59    def getVehicleCount(self, stopID):
60        """getVehicleCount(string) -> integer
61        Get the total number of vehicles stopped at the named parking area.
62        """
63        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)

getVehicleCount(string) -> integer Get the total number of vehicles stopped at the named parking area.

def getVehicleIDs(self, stopID):
65    def getVehicleIDs(self, stopID):
66        """getVehicleIDs(string) -> tuple(string)
67        Get the IDs of vehicles stopped at the named parking area.
68        """
69        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)

getVehicleIDs(string) -> tuple(string) Get the IDs of vehicles stopped at the named parking area.

def getAcceptedBadges(self, stopID):
71    def getAcceptedBadges(self, stopID):
72        """getAcceptedBadges(string) -> tuple(string)
73        Get the badge keywords which allow access to the parking area.
74        """
75        return self._getUniversal(tc.VAR_ACCESS_BADGE, stopID)

getAcceptedBadges(string) -> tuple(string) Get the badge keywords which allow access to the parking area.

def setAcceptedBadges(self, stopID, badges):
77    def setAcceptedBadges(self, stopID, badges):
78        """
79        setAcceptedBadges(string, list) ->  None
80        Set the badge keywords which allow access to the parking area.
81        """
82        if isinstance(badges, str):
83            badges = [badges]
84        self._setCmd(tc.VAR_ACCESS_BADGE, stopID, "l", badges)

setAcceptedBadges(string, list) -> None Set the badge keywords which allow access to the parking area.