MCPcopy Create free account
hub / github.com/PJLab-ADG/OASim / processEdge

Method processEdge

limsim/simModel/common/networkBuild.py:125–211  ·  view source on GitHub ↗
(self, eid: str, child: ET.Element)

Source from the content-addressed store, hash-verified

123 return floatShape
124
125 def processEdge(self, eid: str, child: ET.Element):
126 if eid[0] == ':':
127 for gchild in child:
128 if 'disallow' in gchild.attrib:
129 disallow = gchild.attrib['disallow']
130 if disallow == "all":
131 continue
132 ilid = gchild.attrib['id']
133 try:
134 ilspeed = float(gchild.attrib['speed'])
135 except:
136 ilspeed = 13.89
137 try:
138 ilwidth = float(gchild.attrib['width'])
139 except KeyError:
140 ilwidth = 3.2
141 ilLength = float(gchild.attrib['length'])
142 self.junctionLanes[ilid] = JunctionLane(
143 id=ilid, width=ilwidth, speed_limit=ilspeed,
144 sumo_length=ilLength,
145 )
146 self.dataQue.put((
147 'junctionLaneINFO', (
148 ilid, ilwidth, ilspeed, ilLength,
149 None, 0
150 ), 'INSERT'
151 ))
152 else:
153 fromNode = child.attrib['from']
154 toNode = child.attrib['to']
155 edge = Edge(id=eid, from_junction=fromNode, to_junction=toNode)
156 laneNumber = 0
157 for gchild in child:
158 if gchild.tag == 'lane':
159 # 去除人行道
160 if 'allow' in gchild.attrib: # 有allow属性是人行道
161 # allow = gchild.attrib['allow']
162 continue
163 if 'disallow' in gchild.attrib: # disallow=all是隔离带
164 disallow = gchild.attrib['disallow']
165 if disallow == "all":
166 continue
167 lid = gchild.attrib['id']
168 try:
169 lwidth = float(gchild.attrib['width'])
170 except KeyError:
171 lwidth = 3.2
172 lspeed = float(gchild.attrib['speed'])
173 rawShape = gchild.attrib['shape']
174 lshape = self.processRawShape(rawShape)
175 llength = float(gchild.attrib['length'])
176 lane = NormalLane(id=lid, width=lwidth, speed_limit=lspeed,
177 sumo_length=llength, affiliated_edge=edge)
178 self.dataQue.put((
179 'laneINFO', (
180 lid, rawShape, lwidth, lspeed, eid, llength
181 ), 'INSERT'
182 ))

Callers 1

getDataMethod · 0.95

Calls 8

processRawShapeMethod · 0.95
affGridIDsMethod · 0.95
JunctionLaneClass · 0.90
EdgeClass · 0.90
NormalLaneClass · 0.90
Spline2DClass · 0.90
geoHashClass · 0.85
getPlotElemMethod · 0.80

Tested by

no test coverage detected