Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/devel/debug2sel.py
169673 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2010-2025 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 debug2sel.py
15
# @author Jakob Erdmann
16
# @date 2021-03-11
17
18
19
"""build (edge) selection file from cmdline id list of edges or lanes
20
"""
21
from __future__ import print_function
22
import sys
23
24
outfile = sys.argv[1]
25
ids = sys.argv[2].split()
26
objectType = sys.argv[3] if len(sys.argv) > 3 else "edge"
27
28
if objectType == "lane2edge":
29
objectType = "edge"
30
ids = ['_'.join(id.split('_')[:-1]) for id in ids]
31
32
with open(outfile, 'w') as outf:
33
for id in ids:
34
outf.write("%s:%s\n" % (objectType, id))
35
print("wrote %s %s to '%s'" % (len(ids), objectType, outfile))
36
37