Eclipse SUMO - Simulation of Urban MObility
NBFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
20 // Sets and checks options for netbuild
21 /****************************************************************************/
22 #include <config.h>
23 
24 #include <string>
25 #include <fstream>
26 #include "NBFrame.h"
27 #include "NBNodeCont.h"
28 #include "NBEdgeCont.h"
30 #include "NBDistrictCont.h"
31 #include "NBRequest.h"
32 #include "NBTypeCont.h"
37 #include <utils/common/ToString.h>
41 
42 
43 // ===========================================================================
44 // method definitions
45 // ===========================================================================
46 void
47 NBFrame::fillOptions(bool forNetgen) {
49  // register building defaults
50  oc.doRegister("default.lanenumber", 'L', new Option_Integer(1));
51  oc.addSynonyme("default.lanenumber", "lanenumber", true);
52  oc.addDescription("default.lanenumber", "Building Defaults", "The default number of lanes in an edge");
53 
54  oc.doRegister("default.lanewidth", new Option_Float(NBEdge::UNSPECIFIED_WIDTH));
55  oc.addSynonyme("default.lanewidth", "lanewidth", true);
56  oc.addDescription("default.lanewidth", "Building Defaults", "The default width of lanes");
57 
58  oc.doRegister("default.spreadtype", new Option_String("right"));
59  oc.addDescription("default.spreadtype", "Building Defaults", "The default method for computing lane shapes from edge shapes");
60 
61  oc.doRegister("default.speed", 'S', new Option_Float((double) 13.89));
62  oc.addSynonyme("default.speed", "speed", true);
63  oc.addDescription("default.speed", "Building Defaults", "The default speed on an edge (in m/s)");
64 
65  oc.doRegister("default.priority", 'P', new Option_Integer(-1));
66  oc.addSynonyme("default.priority", "priority", true);
67  oc.addDescription("default.priority", "Building Defaults", "The default priority of an edge");
68 
69  oc.doRegister("default.type", new Option_String());
70  oc.addDescription("default.type", "Building Defaults", "The default edge type");
71 
72  oc.doRegister("default.sidewalk-width", new Option_Float((double) 2.0));
73  oc.addDescription("default.sidewalk-width", "Building Defaults", "The default width of added sidewalks");
74 
75  oc.doRegister("default.bikelane-width", new Option_Float((double) 1.0));
76  oc.addDescription("default.bikelane-width", "Building Defaults", "The default width of added bike lanes");
77 
78  oc.doRegister("default.crossing-width", new Option_Float((double) 4.0));
79  oc.addDescription("default.crossing-width", "Building Defaults", "The default width of a pedestrian crossing");
80 
81  oc.doRegister("default.allow", new Option_String());
82  oc.addDescription("default.allow", "Building Defaults", "The default for allowed vehicle classes");
83 
84  oc.doRegister("default.disallow", new Option_String());
85  oc.addDescription("default.disallow", "Building Defaults", "The default for disallowed vehicle classes");
86 
87  oc.doRegister("default.junctions.keep-clear", new Option_Bool(true));
88  oc.addDescription("default.junctions.keep-clear", "Building Defaults", "Whether junctions should be kept clear by default");
89 
90  oc.doRegister("default.junctions.radius", new Option_Float(4));
91  oc.addDescription("default.junctions.radius", "Building Defaults", "The default turning radius of intersections");
92 
93  oc.doRegister("default.connection-length", new Option_Float((double) NBEdge::UNSPECIFIED_LOADED_LENGTH));
94  oc.addDescription("default.connection-length", "Building Defaults", "The default length when overriding connection lengths");
95 
96  oc.doRegister("default.right-of-way", new Option_String("default"));
97  oc.addDescription("default.right-of-way", "Building Defaults", "The default algorithm for computing right of way rules ('default', 'edgePriority')");
98 
99  oc.doRegister("junctions.right-before-left.speed-threshold", new Option_Float(49 / 3.6));
100  oc.addDescription("junctions.right-before-left.speed-threshold", "Junctions", "Allow building right-before-left junctions when the incoming edge speeds are below FLOAT (m/s)");
101 
102  // register the data processing options
103  oc.doRegister("no-internal-links", new Option_Bool(false)); // !!! not described
104  oc.addDescription("no-internal-links", "Junctions", "Omits internal links");
105 
106  oc.doRegister("numerical-ids", new Option_Bool(false));
107  oc.addDescription("numerical-ids", "Processing", "Remaps alphanumerical IDs of nodes and edges to ensure that all IDs are integers");
108 
109  oc.doRegister("numerical-ids.node-start", new Option_Integer(std::numeric_limits<int>::max()));
110  oc.addDescription("numerical-ids.node-start", "Processing", "Remaps IDs of nodes to integers starting at INT");
111 
112  oc.doRegister("numerical-ids.edge-start", new Option_Integer(std::numeric_limits<int>::max()));
113  oc.addDescription("numerical-ids.edge-start", "Processing", "Remaps IDs of edges to integers starting at INT");
114 
116  oc.doRegister("reserved-ids", new Option_FileName());
117  oc.addDescription("reserved-ids", "Processing", "Ensures that generated ids do not included any of the typed IDs from FILE (sumo-gui selection file format)");
118 
119  if (!forNetgen) {
120  oc.doRegister("dismiss-vclasses", new Option_Bool(false));
121  oc.addDescription("dismiss-vclasses", "Processing", "Removes vehicle class restrictions from imported edges");
122  }
123 
124  oc.doRegister("no-turnarounds", new Option_Bool(false));
125  oc.addDescription("no-turnarounds", "Junctions", "Disables building turnarounds");
126 
127  oc.doRegister("no-turnarounds.tls", new Option_Bool(false));
128  oc.addSynonyme("no-turnarounds.tls", "no-tls-turnarounds", true);
129  oc.addDescription("no-turnarounds.tls", "Junctions", "Disables building turnarounds at tls-controlled junctions");
130 
131  oc.doRegister("no-turnarounds.geometry", new Option_Bool(true));
132  oc.addDescription("no-turnarounds.geometry", "Junctions", "Disables building turnarounds at geometry-like junctions");
133 
134  oc.doRegister("no-turnarounds.except-deadend", new Option_Bool(false));
135  oc.addDescription("no-turnarounds.except-deadend", "Junctions", "Disables building turnarounds except at dead end junctions");
136 
137  oc.doRegister("no-turnarounds.except-turnlane", new Option_Bool(false));
138  oc.addDescription("no-turnarounds.except-turnlane", "Junctions", "Disables building turnarounds except at at junctions with a dedicated turning lane");
139 
140  oc.doRegister("no-turnarounds.fringe", new Option_Bool(false));
141  oc.addDescription("no-turnarounds.fringe", "Junctions", "Disables building turnarounds at fringe junctions");
142 
143  oc.doRegister("no-left-connections", new Option_Bool(false));
144  oc.addDescription("no-left-connections", "Junctions", "Disables building connections to left");
145 
146  if (!forNetgen) {
147  oc.doRegister("geometry.split", new Option_Bool(false)); // !!!not described
148  oc.addSynonyme("geometry.split", "split-geometry", true);
149  oc.addDescription("geometry.split", "Processing", "Splits edges across geometry nodes");
150 
151  oc.doRegister("geometry.remove", 'R', new Option_Bool(false));
152  oc.addSynonyme("geometry.remove", "remove-geometry", true);
153  oc.addDescription("geometry.remove", "Processing", "Replace nodes which only define edge geometry by geometry points (joins edges)");
154 
155  oc.doRegister("geometry.remove.keep-edges.explicit", new Option_StringVector());
156  oc.addDescription("geometry.remove.keep-edges.explicit", "Processing", "Ensure that the given list of edges is not modified");
157 
158  oc.doRegister("geometry.remove.keep-edges.input-file", new Option_FileName());
159  oc.addDescription("geometry.remove.keep-edges.input-file", "Processing",
160  "Ensure that the edges in FILE are not modified (Each id on a single line. Selection files from sumo-gui are also supported)");
161 
162  oc.doRegister("geometry.remove.keep-ptstops", new Option_Bool(false));
163  oc.addDescription("geometry.remove.keep-ptstops", "Processing", "Ensure that edges with public transport stops are not modified");
164 
165  oc.doRegister("geometry.remove.min-length", new Option_Float(0));
166  oc.addDescription("geometry.remove.min-length", "Processing",
167  "Allow merging edges with differing attributes when their length is below min-length");
168 
169  oc.doRegister("geometry.remove.width-tolerance", new Option_Float(0));
170  oc.addDescription("geometry.remove.width-tolerance", "Processing",
171  "Allow merging edges with differing lane widths if the difference is below FLOAT");
172 
173  oc.doRegister("geometry.max-segment-length", new Option_Float(0));
174  oc.addDescription("geometry.max-segment-length", "Processing", "splits geometry to restrict segment length");
175 
176  oc.doRegister("geometry.min-dist", new Option_Float(-1));
177  oc.addDescription("geometry.min-dist", "Processing", "reduces too similar geometry points");
178 
179  oc.doRegister("geometry.max-angle", new Option_Float(99));
180  oc.addDescription("geometry.max-angle", "Processing", "Warn about edge geometries with an angle above DEGREES in successive segments");
181 
182  oc.doRegister("geometry.min-radius", new Option_Float(9));
183  oc.addDescription("geometry.min-radius", "Processing", "Warn about edge geometries with a turning radius less than METERS at the start or end");
184 
185  oc.doRegister("geometry.min-radius.fix", new Option_Bool(false));
186  oc.addDescription("geometry.min-radius.fix", "Processing", "Straighten edge geometries to avoid turning radii less than geometry.min-radius");
187 
188  oc.doRegister("geometry.min-radius.fix.railways", new Option_Bool(true));
189  oc.addDescription("geometry.min-radius.fix.railways", "Processing", "Straighten edge geometries to avoid turning radii less than geometry.min-radius (only railways)");
190 
191  oc.doRegister("geometry.junction-mismatch-threshold", new Option_Float(20));
192  oc.addDescription("geometry.junction-mismatch-threshold", "Processing", "Warn if the junction shape is to far away from the original node position");
193 
194  oc.doRegister("geometry.check-overlap", new Option_Float(0));
195  oc.addDescription("geometry.check-overlap", "Processing", "Warn if edges overlap by more than the given threshold value");
196 
197  oc.doRegister("geometry.check-overlap.vertical-threshold", new Option_Float(4));
198  oc.addDescription("geometry.check-overlap.vertical-threshold", "Processing", "Ignore overlapping edges if they are separated vertically by the given threshold.");
199 
200  oc.doRegister("geometry.avoid-overlap", new Option_Bool(true));
201  oc.addDescription("geometry.avoid-overlap", "Processing", "Modify edge geometries to avoid overlap at junctions");
202 
203  oc.doRegister("join-lanes", new Option_Bool(false));
204  oc.addDescription("join-lanes", "Processing", "join adjacent lanes that have the same permissions and which do not admit lane-changing (sidewalks and disallowed lanes)");
205 
206  oc.doRegister("ptline.match-dist", new Option_Float(100));
207  oc.addDescription("ptline.match-dist", "Processing", "Matches stops outside the road network to the referencing pt line when below the given distance");
208  // railway processing options
209 
210  oc.doRegister("railway.topology.repair", new Option_Bool(false));
211  oc.addDescription("railway.topology.repair", "Railway", "Repair topology of the railway network");
212 
213  oc.doRegister("railway.topology.repair.minimal", new Option_Bool(false));
214  oc.addDescription("railway.topology.repair.minimal", "Railway", "Repair topology of the railway network just enough to let loaded public transport lines to work");
215 
216  oc.doRegister("railway.topology.repair.connect-straight", new Option_Bool(false));
217  oc.addDescription("railway.topology.repair.connect-straight", "Railway", "Allow bidirectional rail use wherever rails with opposite directions meet at a straight angle");
218 
219  oc.doRegister("railway.topology.repair.stop-turn", new Option_Bool(false));
220  oc.addDescription("railway.topology.repair.stop-turn", "Railway", "Add turn-around connections at all loaded stops.");
221 
222  oc.doRegister("railway.topology.all-bidi", new Option_Bool(false));
223  oc.addDescription("railway.topology.all-bidi", "Railway", "Make all rails usable in both direction");
224 
225  oc.doRegister("railway.topology.all-bidi.input-file", new Option_FileName());
226  oc.addDescription("railway.topology.all-bidi.input-file", "Railway", "Make all rails edge ids from FILE usable in both direction");
227 
228  oc.doRegister("railway.topology.direction-priority", new Option_Bool(false));
229  oc.addDescription("railway.topology.direction-priority", "Railway", "Set edge priority values based on estimated main direction");
230 
231  oc.doRegister("railway.topology.extend-priority", new Option_Bool(false));
232  oc.addDescription("railway.topology.extend-priority", "Railway", "Extend loaded edge priority values based on estimated main direction");
233 
234  oc.doRegister("railway.access-distance", new Option_Float(150.f));
235  oc.addDescription("railway.access-distance", "Railway", "The search radius for finding suitable road accesses for rail stops");
236  oc.addSynonyme("railway.access-distance", "osm.stop-output.footway-access-distance", true);
237 
238  oc.doRegister("railway.max-accesses", new Option_Integer(5));
239  oc.addDescription("railway.max-accesses", "Railway", "The maximum roud accesses registered per rail stops");
240  oc.addSynonyme("railway.max-accesses", "osm.stop-output.footway-max-accesses", true);
241 
242  oc.doRegister("railway.access-factor", new Option_Float(1.5));
243  oc.addDescription("railway.access-factor", "Railway", "The walking length of the access is computed as air-line distance multiplied by FLOAT");
244  oc.addSynonyme("railway.access-factor", "osm.stop-output.footway-access-factor", true);
245 
246  oc.doRegister("ptstop-output.no-bidi", new Option_Bool(false));
247  oc.addDescription("ptstop-output.no-bidi", "Processing", "Skips automatic generation of stops on the bidi-edge of a loaded stop");
248  }
249 
250  oc.doRegister("geometry.max-grade", new Option_Float(10));
251  oc.addDescription("geometry.max-grade", "Processing", "Warn about edge geometries with a grade in % above FLOAT.");
252 
253  oc.doRegister("geometry.max-grade.fix", new Option_Bool(true));
254  oc.addDescription("geometry.max-grade.fix", "Processing", "Smooth edge edge geometries with a grade in above the warning threshold.");
255 
256  oc.doRegister("offset.disable-normalization", new Option_Bool(false));
257  oc.addSynonyme("offset.disable-normalization", "disable-normalize-node-positions", true);
258  oc.addDescription("offset.disable-normalization", "Processing", "Turn off normalizing node positions");
259 
260  oc.doRegister("offset.x", new Option_Float(0));
261  oc.addSynonyme("offset.x", "x-offset-to-apply", true);
262  oc.addDescription("offset.x", "Processing", "Adds FLOAT to net x-positions");
263 
264  oc.doRegister("offset.y", new Option_Float(0));
265  oc.addSynonyme("offset.y", "y-offset-to-apply", true);
266  oc.addDescription("offset.y", "Processing", "Adds FLOAT to net y-positions");
267 
268  oc.doRegister("offset.z", new Option_Float(0));
269  oc.addDescription("offset.z", "Processing", "Adds FLOAT to net z-positions");
270 
271  oc.doRegister("flip-y-axis", new Option_Bool(false));
272  oc.addSynonyme("flip-y-axis", "flip-y");
273  oc.addDescription("flip-y-axis", "Processing", "Flips the y-coordinate along zero");
274 
275  oc.doRegister("roundabouts.guess", new Option_Bool(true));
276  oc.addSynonyme("roundabouts.guess", "guess-roundabouts", true);
277  oc.addDescription("roundabouts.guess", "Processing", "Enable roundabout-guessing");
278 
279  oc.doRegister("roundabouts.visibility-distance", new Option_Float(9));
280  oc.addDescription("roundabouts.visibility-distance", "Processing", "Default visibility when approaching a roundabout");
281 
282  oc.doRegister("opposites.guess", new Option_Bool(false));
283  oc.addDescription("opposites.guess", "Processing", "Enable guessing of opposite direction lanes usable for overtaking");
284 
285  oc.doRegister("opposites.guess.fix-lengths", new Option_Bool(false));
286  oc.addDescription("opposites.guess.fix-lengths", "Processing", "Ensure that opposite edges have the same length");
287 
288  oc.doRegister("fringe.guess", new Option_Bool(false));
289  oc.addDescription("fringe.guess", "Processing", "Enable guessing of network fringe nodes");
290 
291  oc.doRegister("lefthand", new Option_Bool(false));
292  oc.addDescription("lefthand", "Processing", "Assumes left-hand traffic on the network");
293 
294  oc.doRegister("edges.join", new Option_Bool(false));
295  oc.addDescription("edges.join", "Processing",
296  "Merges edges which connect the same nodes and are close to each other (recommended for VISSIM import)");
297 
298  oc.doRegister("junctions.join", new Option_Bool(false));
299  oc.addDescription("junctions.join", "Junctions",
300  "Joins junctions that are close to each other (recommended for OSM import)");
301 
302  oc.doRegister("junctions.join-dist", new Option_Float(10));
303  oc.addDescription("junctions.join-dist", "Junctions",
304  "Determines the maximal distance for joining junctions (defaults to 10)");
305 
306  if (!forNetgen) {
307  oc.doRegister("junctions.join-exclude", new Option_StringVector());
308  oc.addDescription("junctions.join-exclude", "Junctions", "Interprets STR[] as list of junctions to exclude from joining");
309 
310  oc.doRegister("junctions.join-same", new Option_Bool(false));
311  oc.addDescription("junctions.join-same", "Junctions",
312  "Joins junctions that have the same coordinates even if not connected");
313 
314  oc.doRegister("speed.offset", new Option_Float(0));
315  oc.addDescription("speed.offset", "Processing", "Modifies all edge speeds by adding FLOAT");
316 
317  oc.doRegister("speed.factor", new Option_Float(1));
318  oc.addDescription("speed.factor", "Processing", "Modifies all edge speeds by multiplying by FLOAT");
319 
320  oc.doRegister("speed.minimum", new Option_Float(0));
321  oc.addDescription("speed.minimum", "Processing", "Modifies all edge speeds to at least FLOAT");
322 
323  oc.doRegister("edges.join-tram-dist", new Option_Float(-1));
324  oc.addDescription("edges.join-tram-dist", "Processing",
325  "Joins tram edges into road lanes with similar geometry (within FLOAT distance)");
326  }
327 
328  oc.doRegister("junctions.corner-detail", new Option_Integer(5));
329  oc.addDescription("junctions.corner-detail", "Junctions", "Generate INT intermediate points to smooth out intersection corners");
330 
331  oc.doRegister("junctions.internal-link-detail", new Option_Integer(5));
332  oc.addDescription("junctions.internal-link-detail", "Junctions", "Generate INT intermediate points to smooth out lanes within the intersection");
333 
334  oc.doRegister("junctions.scurve-stretch", new Option_Float(0));
335  oc.addDescription("junctions.scurve-stretch", "Junctions", "Generate longer intersections to allow for smooth s-curves when the number of lanes changes");
336 
337  oc.doRegister("junctions.join-turns", new Option_Bool(false));
338  oc.addDescription("junctions.join-turns", "Junctions",
339  "Builds common edges for turning connections with common from- and to-edge. This causes discrepancies between geometrical length and assigned length due to averaging but enables lane-changing while turning");
340 
341  oc.doRegister("junctions.limit-turn-speed", new Option_Float(5.5));
342  oc.addDescription("junctions.limit-turn-speed", "Junctions",
343  "Limits speed on junctions to an average lateral acceleration of at most FLOAT m/s^2)");
344 
345  oc.doRegister("junctions.limit-turn-speed.min-angle", new Option_Float(15));
346  oc.addDescription("junctions.limit-turn-speed.min-angle", "Junctions",
347  "Do not limit turn speed for angular changes below FLOAT (degrees). The value is subtracted from the geometric angle before computing the turning radius.");
348 
349  oc.doRegister("junctions.limit-turn-speed.min-angle.railway", new Option_Float(35));
350  oc.addDescription("junctions.limit-turn-speed.min-angle.railway", "Junctions",
351  "Do not limit turn speed for angular changes below FLOAT (degrees) on railway edges. The value is subtracted from the geometric angle before computing the turning radius.");
352 
353  oc.doRegister("junctions.limit-turn-speed.warn.straight", new Option_Float(5));
354  oc.addDescription("junctions.limit-turn-speed.warn.straight", "Junctions",
355  "Warn about turn speed limits that reduce the speed of straight connections by more than FLOAT");
356 
357  oc.doRegister("junctions.limit-turn-speed.warn.turn", new Option_Float(22));
358  oc.addDescription("junctions.limit-turn-speed.warn.turn", "Junctions",
359  "Warn about turn speed limits that reduce the speed of turning connections (no u-turns) by more than FLOAT");
360 
361 
362  oc.doRegister("junctions.small-radius", new Option_Float(1.5));
363  oc.addDescription("junctions.small-radius", "Junctions",
364  "Default radius for junctions that do not require wide vehicle turns");
365 
366  oc.doRegister("junctions.higher-speed", new Option_Bool(false));
367  oc.addDescription("junctions.higher-speed", "Junctions",
368  "Use maximum value of incoming and outgoing edge speed on junction instead of average");
369 
370  oc.doRegister("internal-junctions.vehicle-width", new Option_Float(1.8));
371  oc.addDescription("internal-junctions.vehicle-width", "Junctions",
372  "Assumed vehicle width for computing internal junction positions");
373 
374  oc.doRegister("rectangular-lane-cut", new Option_Bool(false));
375  oc.addDescription("rectangular-lane-cut", "Junctions", "Forces rectangular cuts between lanes and intersections");
376 
377  oc.doRegister("check-lane-foes.roundabout", new Option_Bool(true));
378  oc.addDescription("check-lane-foes.roundabout", "Junctions",
379  "Allow driving onto a multi-lane road if there are foes on other lanes (at roundabouts)");
380 
381  oc.doRegister("check-lane-foes.all", new Option_Bool(false));
382  oc.addDescription("check-lane-foes.all", "Junctions",
383  "Allow driving onto a multi-lane road if there are foes on other lanes (everywhere)");
384 
385  oc.doRegister("sidewalks.guess", new Option_Bool(false));
386  oc.addDescription("sidewalks.guess", "Pedestrian",
387  "Guess pedestrian sidewalks based on edge speed");
388 
389  oc.doRegister("sidewalks.guess.max-speed", new Option_Float((double) 13.89));
390  oc.addDescription("sidewalks.guess.max-speed", "Pedestrian",
391  "Add sidewalks for edges with a speed equal or below the given limit");
392 
393  oc.doRegister("sidewalks.guess.min-speed", new Option_Float((double) 5.8));
394  oc.addDescription("sidewalks.guess.min-speed", "Pedestrian",
395  "Add sidewalks for edges with a speed above the given limit");
396 
397  oc.doRegister("sidewalks.guess.from-permissions", new Option_Bool(false));
398  oc.addDescription("sidewalks.guess.from-permissions", "Pedestrian",
399  "Add sidewalks for edges that allow pedestrians on any of their lanes regardless of speed");
400 
401  oc.doRegister("sidewalks.guess.exclude", new Option_StringVector());
402  oc.addDescription("sidewalks.guess.exclude", "Pedestrian",
403  "Do not guess sidewalks for the given list of edges");
404 
405  oc.doRegister("bikelanes.guess", new Option_Bool(false));
406  oc.addDescription("bikelanes.guess", "Bicycle",
407  "Guess bike lanes based on edge speed");
408 
409  oc.doRegister("bikelanes.guess.max-speed", new Option_Float((double) 22.22));
410  oc.addDescription("bikelanes.guess.max-speed", "Bicycle",
411  "Add bike lanes for edges with a speed equal or below the given limit");
412 
413  oc.doRegister("bikelanes.guess.min-speed", new Option_Float((double) 5.8));
414  oc.addDescription("bikelanes.guess.min-speed", "Bicycle",
415  "Add bike lanes for edges with a speed above the given limit");
416 
417  oc.doRegister("bikelanes.guess.from-permissions", new Option_Bool(false));
418  oc.addDescription("bikelanes.guess.from-permissions", "Bicycle",
419  "Add bike lanes for edges that allow bicycles on any of their lanes regardless of speed");
420 
421  oc.doRegister("bikelanes.guess.exclude", new Option_StringVector());
422  oc.addDescription("bikelanes.guess.exclude", "Bicycle",
423  "Do not guess bikelanes for the given list of edges");
424 
425  oc.doRegister("crossings.guess", new Option_Bool(false));
426  oc.addDescription("crossings.guess", "Pedestrian",
427  "Guess pedestrian crossings based on the presence of sidewalks");
428 
429  oc.doRegister("crossings.guess.speed-threshold", new Option_Float(13.89));
430  oc.addDescription("crossings.guess.speed-threshold", "Pedestrian",
431  "At uncontrolled nodes, do not build crossings across edges with a speed above the threshold");
432 
433  oc.doRegister("walkingareas", new Option_Bool(false));
434  oc.addDescription("walkingareas", "Pedestrian", "Always build walking areas even if there are no crossings");
435 
436  oc.doRegister("walkingareas.join-dist", new Option_Float(15));
437  oc.addDescription("walkingareas.join-dist", "Pedestrian", "Do not create a walkingarea between sidewalks that are connected by a pedestrian junction within FLOAT");
438 
439  // tls setting options
440  // explicit tls
441  oc.doRegister("tls.set", new Option_StringVector());
442  oc.addSynonyme("tls.set", "explicite-tls", true);
443  oc.addDescription("tls.set", "TLS Building", "Interprets STR[] as list of junctions to be controlled by TLS");
444 
445  oc.doRegister("tls.unset", new Option_StringVector());
446  oc.addSynonyme("tls.unset", "explicite-no-tls", true);
447  oc.addDescription("tls.unset", "TLS Building", "Interprets STR[] as list of junctions to be not controlled by TLS");
448 
449  // tls-guessing
450  oc.doRegister("tls.guess", new Option_Bool(false));
451  oc.addSynonyme("tls.guess", "guess-tls", true);
452  oc.addDescription("tls.guess", "TLS Building", "Turns on TLS guessing");
453 
454  oc.doRegister("tls.guess.threshold", new Option_Float(250 / 3.6));
455  oc.addDescription("tls.guess.threshold", "TLS Building", "Sets minimum value for the sum of all incoming lane speeds when guessing TLS");
456 
457  if (!forNetgen) {
458  oc.doRegister("tls.taz-nodes", new Option_Bool(false));
459  oc.addSynonyme("tls.taz-nodes", "tls-guess.district-nodes", true);
460  oc.addDescription("tls.taz-nodes", "TLS Building", "Sets district nodes as tls-controlled"); // !!! describe
461  }
462 
463  oc.doRegister("tls.guess.joining", new Option_Bool(false));
464  oc.addSynonyme("tls.guess.joining", "tls-guess.joining", true);
465  oc.addDescription("tls.guess.joining", "TLS Building", "Includes node clusters into guess"); // !!! describe
466 
467  oc.doRegister("tls.join", new Option_Bool(false));
468  oc.addSynonyme("tls.join", "try-join-tls", true);
469  oc.addDescription("tls.join", "TLS Building", "Tries to cluster tls-controlled nodes"); // !!! describe
470 
471  oc.doRegister("tls.join-dist", new Option_Float(20));
472  oc.addDescription("tls.join-dist", "TLS Building",
473  "Determines the maximal distance for joining traffic lights (defaults to 20)");
474 
475  oc.doRegister("tls.uncontrolled-within", new Option_Bool(false));
476  oc.addDescription("tls.uncontrolled-within", "TLS Building",
477  "Do not control edges that lie fully within a joined traffic light. This may cause collisions but allows old traffic light plans to be used");
478 
479  oc.doRegister("tls.ignore-internal-junction-jam", new Option_Bool(false));
480  oc.addDescription("tls.ignore-internal-junction-jam", "TLS Building",
481  "Do not build mutually conflicting response matrix, potentially ignoring vehicles that are stuck at an internal junction when their phase has ended");
482 
483  if (!forNetgen) {
484  oc.doRegister("tls.guess-signals", new Option_Bool(false));
485  oc.addDescription("tls.guess-signals", "TLS Building", "Interprets tls nodes surrounding an intersection as signal positions for a larger TLS. This is typical pattern for OSM-derived networks");
486 
487  oc.doRegister("tls.guess-signals.dist", new Option_Float(25));
488  oc.addDescription("tls.guess-signals.dist", "TLS Building", "Distance for interpreting nodes as signal locations");
489  }
490 
491 
492  // computational
493  oc.doRegister("tls.cycle.time", new Option_Integer(90));
494  oc.addDescription("tls.cycle.time", "TLS Building", "Use INT as cycle duration");
495 
496  oc.doRegister("tls.green.time", new Option_Integer(31));
497  oc.addSynonyme("tls.green.time", "traffic-light-green", true);
498  oc.addDescription("tls.green.time", "TLS Building", "Use INT as green phase duration");
499 
500  oc.doRegister("tls.yellow.min-decel", 'D', new Option_Float(3.0));
501  oc.addSynonyme("tls.yellow.min-decel", "min-decel", true);
502  oc.addDescription("tls.yellow.min-decel", "TLS Building", "Defines smallest vehicle deceleration");
503 
504  oc.doRegister("tls.yellow.patch-small", new Option_Bool(false));
505  oc.addSynonyme("tls.yellow.patch-small", "patch-small-tyellow", true);
506  oc.addDescription("tls.yellow.patch-small", "TLS Building", "Given yellow times are patched even if being too short");
507 
508  oc.doRegister("tls.yellow.time", new Option_Integer(-1));
509  oc.addSynonyme("tls.yellow.time", "traffic-light-yellow", true);
510  oc.addDescription("tls.yellow.time", "TLS Building", "Set INT as fixed time for yellow phase durations");
511 
512  oc.doRegister("tls.red.time", new Option_Integer(5));
513  oc.addDescription("tls.red.time", "TLS Building", "Set INT as fixed time for red phase duration at traffic lights that do not have a conflicting flow");
514 
515  oc.doRegister("tls.allred.time", new Option_Integer(0));
516  oc.addDescription("tls.allred.time", "TLS Building", "Set INT as fixed time for intermediate red phase after every switch");
517 
518  oc.doRegister("tls.minor-left.max-speed", new Option_Float(19.44)); // 70km/h
519  oc.addDescription("tls.minor-left.max-speed", "TLS Building", "Use FLOAT as threshold for allowing left-turning vehicles to move in the same phase as oncoming straight-going vehicles");
520 
521  oc.doRegister("tls.left-green.time", new Option_Integer(6));
522  oc.addDescription("tls.left-green.time", "TLS Building", "Use INT as green phase duration for left turns (s). Setting this value to 0 disables additional left-turning phases");
523 
524  oc.doRegister("tls.crossing-min.time", new Option_Integer(4));
525  oc.addDescription("tls.crossing-min.time", "TLS Building", "Use INT as minimum green duration for pedestrian crossings (s).");
526 
527  oc.doRegister("tls.crossing-clearance.time", new Option_Integer(5));
528  oc.addDescription("tls.crossing-clearance.time", "TLS Building", "Use INT as clearance time for pedestrian crossings (s).");
529 
530  oc.doRegister("tls.scramble.time", new Option_Integer(5));
531  oc.addDescription("tls.scramble.time", "TLS Building", "Use INT as green phase duration for pedestrian scramble phase (s).");
532 
533  // tls-shifts
534  oc.doRegister("tls.half-offset", new Option_StringVector());
535  oc.addSynonyme("tls.half-offset", "tl-logics.half-offset", true);
536  oc.addDescription("tls.half-offset", "TLS Building", "TLSs in STR[] will be shifted by half-phase");
537 
538  oc.doRegister("tls.quarter-offset", new Option_StringVector());
539  oc.addSynonyme("tls.quarter-offset", "tl-logics.quarter-offset", true);
540  oc.addDescription("tls.quarter-offset", "TLS Building", "TLSs in STR[] will be shifted by quarter-phase");
541 
542  // tls type
543  oc.doRegister("tls.default-type", new Option_String("static"));
544  oc.addDescription("tls.default-type", "TLS Building", "TLSs with unspecified type will use STR as their algorithm");
545 
546  oc.doRegister("tls.layout", new Option_String("opposites"));
547  oc.addDescription("tls.layout", "TLS Building", "Set phase layout four grouping opposite directions or grouping all movements for one incoming edge ['opposites', 'incoming']");
548 
549  oc.doRegister("tls.no-mixed", new Option_Bool(false));
550  oc.addDescription("tls.no-mixed", "TLS Building", "Avoid phases with green and red signals for different connections from the same lane");
551 
552  oc.doRegister("tls.min-dur", new Option_Integer(5));
553  oc.addDescription("tls.min-dur", "TLS Building", "Default minimum phase duration for traffic lights with variable phase length");
554 
555  oc.doRegister("tls.max-dur", new Option_Integer(50));
556  oc.addDescription("tls.max-dur", "TLS Building", "Default maximum phase duration for traffic lights with variable phase length");
557 
558  oc.doRegister("tls.group-signals", new Option_Bool(false));
559  oc.addDescription("tls.group-signals", "TLS Building", "Assign the same tls link index to connections that share the same states");
560 
561  oc.doRegister("tls.ungroup-signals", new Option_Bool(false));
562  oc.addDescription("tls.ungroup-signals", "TLS Building", "Assign a distinct tls link index to every connection");
563 
564  // edge pruning
565  oc.doRegister("keep-edges.min-speed", new Option_Float(-1));
566  oc.addSynonyme("keep-edges.min-speed", "edges-min-speed", true);
567  oc.addDescription("keep-edges.min-speed", "Edge Removal", "Only keep edges with speed in meters/second > FLOAT");
568 
569  oc.doRegister("remove-edges.explicit", new Option_StringVector());
570  oc.addSynonyme("remove-edges.explicit", "remove-edges");
571  oc.addDescription("remove-edges.explicit", "Edge Removal", "Remove edges in STR[]");
572 
573  oc.doRegister("keep-edges.explicit", new Option_StringVector());
574  oc.addSynonyme("keep-edges.explicit", "keep-edges");
575  oc.addDescription("keep-edges.explicit", "Edge Removal", "Only keep edges in STR[] or those which are kept due to other keep-edges or remove-edges options");
576 
577  oc.doRegister("keep-edges.input-file", new Option_FileName());
578  oc.addDescription("keep-edges.input-file", "Edge Removal", "Only keep edges in FILE (Each id on a single line. Selection files from sumo-gui are also supported) or those which are kept due to other keep-edges or remove-edges options");
579 
580  oc.doRegister("remove-edges.input-file", new Option_FileName());
581  oc.addDescription("remove-edges.input-file", "Edge Removal", "Remove edges in FILE. (Each id on a single line. Selection files from sumo-gui are also supported)");
582 
583  if (!forNetgen) {
584  oc.doRegister("keep-edges.postload", new Option_Bool(false));
585  oc.addDescription("keep-edges.postload", "Edge Removal", "Remove edges after joining");
586  }
587 
588  oc.doRegister("keep-edges.in-boundary", new Option_StringVector());
589  oc.addDescription("keep-edges.in-boundary", "Edge Removal", "Only keep edges which are located within the given boundary (given either as CARTESIAN corner coordinates <xmin,ymin,xmax,ymax> or as polygon <x0,y0,x1,y1,...>)");
590 
591  oc.doRegister("keep-edges.in-geo-boundary", new Option_StringVector());
592  oc.addDescription("keep-edges.in-geo-boundary", "Edge Removal", "Only keep edges which are located within the given boundary (given either as GEODETIC corner coordinates <lon-min,lat-min,lon-max,lat-max> or as polygon <lon0,lat0,lon1,lat1,...>)");
593 
594  if (!forNetgen) {
595  oc.doRegister("keep-edges.by-vclass", new Option_StringVector());
596  oc.addDescription("keep-edges.by-vclass", "Edge Removal", "Only keep edges which allow one of the vclasses in STR[]");
597 
598  oc.doRegister("remove-edges.by-vclass", new Option_StringVector());
599  oc.addDescription("remove-edges.by-vclass", "Edge Removal", "Remove edges which allow only vclasses from STR[]");
600 
601  oc.doRegister("keep-edges.by-type", new Option_StringVector());
602  oc.addDescription("keep-edges.by-type", "Edge Removal", "Only keep edges where type is in STR[]");
603 
604  oc.doRegister("keep-edges.components", new Option_Integer(0));
605  oc.addDescription("keep-edges.components", "Edge Removal", "Only keep the INT largest weakly connected components");
606 
607  oc.doRegister("remove-edges.by-type", new Option_StringVector());
608  oc.addDescription("remove-edges.by-type", "Edge Removal", "Remove edges where type is in STR[]");
609 
610  oc.doRegister("remove-edges.isolated", new Option_Bool(false));
611  oc.addSynonyme("remove-edges.isolated", "remove-isolated", true);
612  oc.addDescription("remove-edges.isolated", "Edge Removal", "Removes isolated edges");
613  }
614 
615 
616  // unregulated nodes options
617  oc.doRegister("keep-nodes-unregulated", new Option_Bool(false));
618  oc.addSynonyme("keep-nodes-unregulated", "keep-unregulated");
619  oc.addDescription("keep-nodes-unregulated", "Unregulated Nodes", "All nodes will be unregulated");
620 
621  oc.doRegister("keep-nodes-unregulated.explicit", new Option_StringVector());
622  oc.addSynonyme("keep-nodes-unregulated.explicit", "keep-unregulated.explicit");
623  oc.addSynonyme("keep-nodes-unregulated.explicit", "keep-unregulated.nodes", true);
624  oc.addDescription("keep-nodes-unregulated.explicit", "Unregulated Nodes", "Do not regulate nodes in STR[]");
625 
626  oc.doRegister("keep-nodes-unregulated.district-nodes", new Option_Bool(false));
627  oc.addSynonyme("keep-nodes-unregulated.district-nodes", "keep-unregulated.district-nodes");
628  oc.addDescription("keep-nodes-unregulated.district-nodes", "Unregulated Nodes", "Do not regulate district nodes");
629 
630  // ramp guessing options
631  if (!forNetgen) {
632  oc.doRegister("ramps.guess", new Option_Bool(false));
633  oc.addSynonyme("ramps.guess", "guess-ramps", true);
634  oc.addDescription("ramps.guess", "Ramp Guessing", "Enable ramp-guessing");
635 
636  oc.doRegister("ramps.guess-acceleration-lanes", new Option_Bool(true));
637  oc.addDescription("ramps.guess-acceleration-lanes", "Ramp Guessing", "Guess on-ramps and mark acceleration lanes if they exist but do not add new lanes");
638 
639  oc.doRegister("ramps.max-ramp-speed", new Option_Float(-1));
640  oc.addSynonyme("ramps.max-ramp-speed", "ramp-guess.max-ramp-speed", true);
641  oc.addDescription("ramps.max-ramp-speed", "Ramp Guessing", "Treat edges with speed > FLOAT as no ramps");
642 
643  oc.doRegister("ramps.min-highway-speed", new Option_Float((double)(79 / 3.6)));
644  oc.addSynonyme("ramps.min-highway-speed", "ramp-guess.min-highway-speed", true);
645  oc.addDescription("ramps.min-highway-speed", "Ramp Guessing", "Treat edges with speed < FLOAT as no highways");
646 
647  oc.doRegister("ramps.ramp-length", new Option_Float(100));
648  oc.addSynonyme("ramps.ramp-length", "ramp-guess.ramp-length", true);
649  oc.addDescription("ramps.ramp-length", "Ramp Guessing", "Use FLOAT as ramp-length");
650 
651  //The Weaving Length Limit for Short Free Onramps, Chiu Liu, Zhongren WangPhD even suggest 70m
652  oc.doRegister("ramps.min-weave-length", new Option_Float(50));
653  oc.addDescription("ramps.min-weave-length", "Ramp Guessing", "Use FLOAT as minimum ramp-length");
654 
655  oc.doRegister("ramps.set", new Option_StringVector());
656  oc.addSynonyme("ramps.set", "ramp-guess.explicite", true);
657  oc.addDescription("ramps.set", "Ramp Guessing", "Tries to handle the given edges as ramps");
658 
659  oc.doRegister("ramps.unset", new Option_StringVector());
660  oc.addDescription("ramps.unset", "Ramp Guessing", "Do not consider the given edges as ramps");
661 
662  oc.doRegister("ramps.no-split", new Option_Bool(false));
663  oc.addSynonyme("ramps.no-split", "ramp-guess.no-split", true);
664  oc.addDescription("ramps.no-split", "Ramp Guessing", "Avoids edge splitting");
665  }
666 }
667 
668 
669 bool
672  bool ok = true;
673  //
674  if (!SUMOXMLDefinitions::TrafficLightTypes.hasString(oc.getString("tls.default-type"))) {
675  WRITE_ERROR("unsupported value '" + oc.getString("tls.default-type") + "' for option '--tls.default-type'");
676  ok = false;
677  }
678  if (oc.isSet("keep-edges.in-boundary") && oc.isSet("keep-edges.in-geo-boundary")) {
679  WRITE_ERROR("only one of the options 'keep-edges.in-boundary' or 'keep-edges.in-geo-boundary' may be given");
680  ok = false;
681  }
682  if (oc.getBool("no-internal-links") && oc.getBool("crossings.guess")) {
683  WRITE_ERROR("only one of the options 'no-internal-links' or 'crossings.guess' may be given");
684  ok = false;
685  }
686  if (oc.getBool("no-internal-links") && oc.getBool("walkingareas")) {
687  WRITE_ERROR("only one of the options 'no-internal-links' or 'walkareas' may be given");
688  ok = false;
689  }
690  if (!oc.isDefault("tls.green.time") && !oc.isDefault("tls.cycle.time")) {
691  WRITE_ERROR("only one of the options 'tls.green.time' or 'tls.cycle.time' may be given");
692  ok = false;
693  }
694  if (oc.getInt("default.lanenumber") < 1) {
695  WRITE_ERROR("default.lanenumber must be at least 1");
696  ok = false;
697  }
698  if (!oc.isDefault("default.lanewidth") && oc.getFloat("default.lanewidth") < POSITION_EPS) {
699  WRITE_ERROR("default.lanewidth must be at least " + toString(POSITION_EPS));
700  ok = false;
701  }
702  if (!oc.isDefault("default.disallow") && !oc.isDefault("default.allow")) {
703  WRITE_ERROR("only one of the options 'default.disallow' or 'default.allow' may be given");
704  ok = false;
705  }
706  if (oc.getInt("junctions.internal-link-detail") < 2) {
707  WRITE_ERROR("junctions.internal-link-detail must >= 2");
708  ok = false;
709  }
710  if (oc.getFloat("junctions.scurve-stretch") > 0) {
711  if (oc.getBool("no-internal-links")) {
712  WRITE_WARNING("option 'junctions.scurve-stretch' requires internal lanes to work. Option '--no-internal-links' was disabled.");
713  }
714  // make sure the option is set so heuristics cannot ignore it
715  oc.set("no-internal-links", "false");
716  }
717  if (oc.getFloat("junctions.small-radius") > oc.getFloat("default.junctions.radius") && oc.getFloat("default.junctions.radius") >= 0) {
718  if (!oc.isDefault("junctions.small-radius")) {
719  WRITE_WARNING("option 'default.junctions.radius' is smaller than option 'junctions.small-radius'");
720  } else {
721  oc.set("junctions.small-radius", oc.getValueString("default.junctions.radius"));
722  }
723  }
724  if (oc.getString("tls.layout") != "opposites"
725  && oc.getString("tls.layout") != "incoming"
726  && oc.getString("tls.layout") != "alternateOneWay") {
727  WRITE_ERROR("tls.layout must be 'opposites', 'incoming' or 'alternateOneWay'");
728  ok = false;
729  }
730  if (!oc.isDefault("default.right-of-way") &&
731  !SUMOXMLDefinitions::RightOfWayValues.hasString(oc.getString("default.right-of-way"))) {
732  WRITE_ERROR("default.right-of-way must be one of '" + toString(SUMOXMLDefinitions::RightOfWayValues.getStrings()) + "'");
733  ok = false;
734  }
735  if (oc.getFloat("roundabouts.visibility-distance") < 0 && oc.getFloat("roundabouts.visibility-distance") != NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE) {
736  WRITE_ERROR("roundabouts.visibility-distance must be positive or -1");
737  ok = false;
738  }
739  if (oc.isDefault("railway.topology.repair") && oc.getBool("railway.topology.repair.connect-straight")) {
740  oc.set("railway.topology.repair", "true");
741  }
742  if (oc.isDefault("railway.topology.repair") && oc.getBool("railway.topology.repair.minimal")) {
743  oc.set("railway.topology.repair", "true");
744  }
745  if (oc.isDefault("railway.topology.all-bidi") && !oc.isDefault("railway.topology.all-bidi.input-file")) {
746  oc.set("railway.topology.all-bidi", "true");
747  }
748  if (oc.isDefault("railway.topology.repair.stop-turn") && !oc.isDefault("railway.topology.repair")) {
749  oc.set("railway.topology.repair.stop-turn", "true");
750  }
751  if (!SUMOXMLDefinitions::LaneSpreadFunctions.hasString(oc.getString("default.spreadtype"))) {
752  WRITE_ERROR("Unknown value for default.spreadtype '" + oc.getString("default.spreadtype") + "'.");
753  ok = false;
754  }
755  return ok;
756 }
757 
758 
759 /****************************************************************************/
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:364
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:361
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:349
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
Definition: NBFrame.cpp:670
static void fillOptions(bool forNetgen)
Inserts options used by the network converter.
Definition: NBFrame.cpp:47
An integer-option.
Definition: Option.h:329
A storage for options typed value containers)
Definition: OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:75
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
Definition: OptionsCont.cpp:96
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
bool hasString(const std::string &str) const