Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-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 NIFrame.cpp
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @author Gregor Laemmel
19 : /// @date Tue, 20 Nov 2001
20 : ///
21 : // Sets and checks options for netimport
22 : /****************************************************************************/
23 : #include <config.h>
24 :
25 : #include <string>
26 : #include <iostream>
27 : #include <fstream>
28 : #include <utils/options/Option.h>
29 : #include <utils/options/OptionsCont.h>
30 : #include <utils/options/OptionsIO.h>
31 : #include <utils/common/MsgHandler.h>
32 : #include <utils/common/ToString.h>
33 : #include <utils/common/FileHelpers.h>
34 : #include <utils/common/UtilExceptions.h>
35 : #include <utils/common/RandHelper.h>
36 : #include <netbuild/NBNetBuilder.h>
37 : #include <netwrite/NWFrame.h>
38 : #include <utils/common/SystemFrame.h>
39 : #include "NIImporter_DlrNavteq.h"
40 : #include "NIFrame.h"
41 :
42 :
43 : // ===========================================================================
44 : // method definitions
45 : // ===========================================================================
46 :
47 : void
48 2033 : NIFrame::fillOptions(OptionsCont& oc, bool forNetedit) {
49 : // register input formats
50 2033 : oc.doRegister("sumo-net-file", 's', new Option_FileName());
51 4066 : oc.addSynonyme("sumo-net-file", "sumo-net", true);
52 4066 : oc.addSynonyme("sumo-net-file", "net-file");
53 4066 : oc.addDescription("sumo-net-file", "Input", TL("Read SUMO-net from FILE"));
54 4066 : oc.addXMLDefault("sumo-net-file", "net");
55 :
56 2033 : oc.doRegister("node-files", 'n', new Option_FileName());
57 4066 : oc.addSynonyme("node-files", "xml-node-files", true);
58 4066 : oc.addSynonyme("node-files", "xml-nodes", true);
59 4066 : oc.addSynonyme("node-files", "nodes");
60 4066 : oc.addDescription("node-files", "Input", TL("Read XML-node defs from FILE"));
61 :
62 2033 : oc.doRegister("edge-files", 'e', new Option_FileName());
63 4066 : oc.addSynonyme("edge-files", "xml-edge-files", true);
64 4066 : oc.addSynonyme("edge-files", "xml-edges", true);
65 4066 : oc.addSynonyme("edge-files", "edges");
66 4066 : oc.addDescription("edge-files", "Input", TL("Read XML-edge defs from FILE"));
67 :
68 2033 : oc.doRegister("connection-files", 'x', new Option_FileName());
69 4066 : oc.addSynonyme("connection-files", "xml-connection-files", true);
70 4066 : oc.addSynonyme("connection-files", "xml-connections", true);
71 4066 : oc.addSynonyme("connection-files", "connections");
72 4066 : oc.addDescription("connection-files", "Input", TL("Read XML-connection defs from FILE"));
73 :
74 2033 : oc.doRegister("tllogic-files", 'i', new Option_FileName());
75 4066 : oc.addDescription("tllogic-files", "Input", TL("Read XML-traffic light defs from FILE"));
76 :
77 2033 : oc.doRegister("type-files", 't', new Option_FileName());
78 4066 : oc.addSynonyme("type-files", "xml-type-files", true);
79 4066 : oc.addSynonyme("type-files", "xml-types", true);
80 4066 : oc.addSynonyme("type-files", "types");
81 4066 : oc.addDescription("type-files", "Input", TL("Read XML-type defs from FILE"));
82 :
83 2033 : if (!forNetedit) {
84 : // would cause confusion because netedit loads stops and shapes using option --additional-files
85 2033 : oc.doRegister("ptstop-files", new Option_FileName());
86 4066 : oc.addDescription("ptstop-files", "Input", TL("Reads public transport stops from FILE"));
87 2033 : oc.doRegister("ptline-files", new Option_FileName());
88 4066 : oc.addDescription("ptline-files", "Input", TL("Reads public transport lines from FILE"));
89 2033 : oc.doRegister("polygon-files", new Option_FileName());
90 4066 : oc.addDescription("polygon-files", "Input", TL("Reads polygons from FILE for embedding in network where applicable"));
91 : }
92 :
93 2033 : oc.doRegister("shapefile-prefix", new Option_FileName());
94 4066 : oc.addSynonyme("shapefile-prefix", "shapefile");
95 4066 : oc.addSynonyme("shapefile-prefix", "arcview", true);
96 4066 : oc.addSynonyme("shapefile-prefix", "tiger", true);
97 4066 : oc.addDescription("shapefile-prefix", "Input", TL("Read shapefiles (ArcView, Tiger, ...) from files starting with 'FILE'"));
98 :
99 2033 : oc.doRegister("dlr-navteq-prefix", new Option_FileName());
100 4066 : oc.addSynonyme("dlr-navteq-prefix", "dlr-navteq");
101 4066 : oc.addSynonyme("dlr-navteq-prefix", "elmar2", true);
102 4066 : oc.addDescription("dlr-navteq-prefix", "Input", TL("Read converted Navteq GDF data (unsplitted Elmar-network) from path 'FILE'"));
103 :
104 2033 : oc.doRegister("osm-files", new Option_FileName());
105 4066 : oc.addSynonyme("osm-files", "osm");
106 4066 : oc.addDescription("osm-files", "Input", TL("Read OSM-network from path 'FILE(s)'"));
107 :
108 2033 : oc.doRegister("opendrive-files", new Option_FileName());
109 4066 : oc.addSynonyme("opendrive-files", "opendrive");
110 4066 : oc.addDescription("opendrive-files", "Input", TL("Read OpenDRIVE-network from FILE"));
111 :
112 2033 : oc.doRegister("visum-file", new Option_FileName());
113 4066 : oc.addSynonyme("visum-file", "visum");
114 4066 : oc.addDescription("visum-file", "Input", TL("Read VISUM-net from FILE"));
115 :
116 2033 : oc.doRegister("vissim-file", new Option_FileName());
117 4066 : oc.addSynonyme("vissim-file", "vissim");
118 4066 : oc.addDescription("vissim-file", "Input", TL("Read VISSIM-net from FILE"));
119 :
120 2033 : oc.doRegister("robocup-dir", new Option_FileName());
121 4066 : oc.addSynonyme("robocup-dir", "robocup-net", true);
122 4066 : oc.addSynonyme("robocup-dir", "robocup");
123 4066 : oc.addDescription("robocup-dir", "Input", TL("Read RoboCup-net from DIR"));
124 :
125 2033 : oc.doRegister("matsim-files", new Option_FileName());
126 4066 : oc.addSynonyme("matsim-files", "matsim");
127 4066 : oc.addDescription("matsim-files", "Input", TL("Read MATSim-net from FILE"));
128 :
129 2033 : oc.doRegister("itsumo-files", new Option_FileName());
130 4066 : oc.addSynonyme("itsumo-files", "itsumo");
131 4066 : oc.addDescription("itsumo-files", "Input", TL("Read ITSUMO-net from FILE"));
132 :
133 2033 : oc.doRegister("heightmap.shapefiles", new Option_FileName());
134 4066 : oc.addDescription("heightmap.shapefiles", "Input", TL("Read heightmap from ArcGIS shapefile"));
135 :
136 2033 : oc.doRegister("heightmap.geotiff", new Option_FileName());
137 4066 : oc.addDescription("heightmap.geotiff", "Input", TL("Read heightmap from GeoTIFF"));
138 :
139 : // need to do this here to be able to check for network and route input options
140 2033 : SystemFrame::addReportOptions(oc);
141 :
142 : // register basic processing options
143 2033 : oc.doRegister("ignore-errors", new Option_Bool(false));
144 4066 : oc.addSynonyme("ignore-errors", "dismiss-loading-errors", true);
145 4066 : oc.addDescription("ignore-errors", "Report", TL("Continue on broken input"));
146 :
147 2033 : oc.doRegister("ignore-errors.connections", new Option_Bool(false));
148 4066 : oc.addDescription("ignore-errors.connections", "Report", TL("Continue on invalid connections"));
149 :
150 2033 : oc.doRegister("show-errors.connections-first-try", new Option_Bool(false));
151 4066 : oc.addDescription("show-errors.connections-first-try", "Report", TL("Show errors in connections at parsing"));
152 :
153 2033 : oc.doRegister("ignore-errors.edge-type", new Option_Bool(false));
154 4066 : oc.addDescription("ignore-errors.edge-type", "Report", TL("Continue on unknown edge types"));
155 :
156 2033 : oc.doRegister("speed-in-kmh", new Option_Bool(false));
157 4066 : oc.addDescription("speed-in-kmh", "Processing", TL("vmax is parsed as given in km/h"));
158 :
159 2033 : oc.doRegister("construction-date", new Option_String());
160 4066 : oc.addDescription("construction-date", "Processing", TL("Use YYYY-MM-DD date to determine the readiness of features under construction"));
161 :
162 2033 : oc.doRegister("flatten", new Option_Bool(false));
163 4066 : oc.addDescription("flatten", "Processing", TL("Remove all z-data"));
164 :
165 2033 : oc.doRegister("discard-params", new Option_StringVector());
166 4066 : oc.addDescription("discard-params", "Formats", TL("Remove the list of keys from all params"));
167 :
168 8132 : oc.doRegister("ignore-change-restrictions", new Option_StringVector(StringVector({"authority"})));
169 4066 : oc.addDescription("ignore-change-restrictions", "Formats", TL("List vehicle classes that may ignore lane changing restrictions ('all' discards all restrictions)"));
170 :
171 2033 : oc.doRegister("ignore-widths", new Option_Bool(false));
172 4066 : oc.addSynonyme("ignore-widths", "opendrive.ignore-widths", false);
173 4066 : oc.addDescription("ignore-widths", "Formats", TL("Whether lane widths shall be ignored."));
174 :
175 : // register xml options
176 2033 : oc.doRegister("plain.extend-edge-shape", new Option_Bool(false));
177 4066 : oc.addSynonyme("plain.extend-edge-shape", "xml.keep-shape", true);
178 4066 : oc.addDescription("plain.extend-edge-shape", "Processing", TL("If edge shapes do not end at the node positions, extend them"));
179 :
180 : // register osm options
181 2033 : oc.doRegister("osm.skip-duplicates-check", new Option_Bool(false));
182 4066 : oc.addDescription("osm.skip-duplicates-check", "Formats", TL("Skips the check for duplicate nodes and edges"));
183 :
184 2033 : oc.doRegister("osm.elevation", new Option_Bool(false));
185 4066 : oc.addDescription("osm.elevation", "Formats", TL("Imports elevation data"));
186 :
187 2033 : oc.doRegister("osm.layer-elevation", new Option_Float(0));
188 4066 : oc.addDescription("osm.layer-elevation", "Formats", TL("Reconstruct (relative) elevation based on layer data. Each layer is raised by FLOAT m"));
189 :
190 2033 : oc.doRegister("osm.layer-elevation.max-grade", new Option_Float(10));
191 4066 : oc.addDescription("osm.layer-elevation.max-grade", "Formats", TL("Maximum grade threshold in % at 50km/h when reconstructing elevation based on layer data. The value is scaled according to road speed."));
192 :
193 2033 : oc.doRegister("osm.oneway-spread-right", new Option_Bool(false));
194 4066 : oc.addDescription("osm.oneway-spread-right", "Formats", TL("Whether one-way roads should be spread to the side instead of centered"));
195 :
196 2033 : oc.doRegister("osm.lane-access", new Option_Bool(false));
197 4066 : oc.addDescription("osm.lane-access", "Formats", TL("Import lane-specific access restrictions"));
198 :
199 2033 : oc.doRegister("osm.bike-access", new Option_Bool(false));
200 4066 : oc.addSynonyme("osm.bike-access", "osm.bike-lanes");
201 4066 : oc.addDescription("osm.bike-access", "Formats", TL("Import bike lanes and fix directions and permissions on bike paths"));
202 :
203 2033 : oc.doRegister("osm.sidewalks", new Option_Bool(false));
204 4066 : oc.addDescription("osm.sidewalks", "Formats", TL("Import sidewalks"));
205 :
206 2033 : oc.doRegister("osm.oneway-reverse-sidewalk", new Option_Bool(false));
207 4066 : oc.addDescription("osm.oneway-reverse-sidewalk", "Formats", TL("Default to building two sidewalks on oneway streets (may affect divided roads)"));
208 :
209 2033 : oc.doRegister("osm.crossings", new Option_Bool(false));
210 4066 : oc.addDescription("osm.crossings", "Formats", TL("Import crossings"));
211 :
212 2033 : oc.doRegister("osm.turn-lanes", new Option_Bool(false));
213 4066 : oc.addDescription("osm.turn-lanes", "Formats", TL("Import turning arrows from OSM to help with connection building"));
214 :
215 2033 : oc.doRegister("osm.stop-output.length", new Option_Float(25));
216 4066 : oc.addDescription("osm.stop-output.length", "Formats", TL("The default length of a public transport stop in FLOAT m"));
217 2033 : oc.doRegister("osm.stop-output.length.bus", new Option_Float(15));
218 4066 : oc.addDescription("osm.stop-output.length.bus", "Formats", TL("The default length of a bus stop in FLOAT m"));
219 2033 : oc.doRegister("osm.stop-output.length.tram", new Option_Float(25));
220 4066 : oc.addDescription("osm.stop-output.length.tram", "Formats", TL("The default length of a tram stop in FLOAT m"));
221 2033 : oc.doRegister("osm.stop-output.length.train", new Option_Float(200));
222 4066 : oc.addDescription("osm.stop-output.length.train", "Formats", TL("The default length of a train stop in FLOAT m"));
223 :
224 8132 : oc.doRegister("osm.railsignals", new Option_StringVector(StringVector({ "DEFAULT"})));
225 4066 : oc.addDescription("osm.railsignals", "Formats", TL("Specify custom rules for importing railway signals"));
226 :
227 2033 : oc.doRegister("osm.all-attributes", new Option_Bool(false));
228 4066 : oc.addSynonyme("osm.all-attributes", "osm.all-tags");
229 4066 : oc.addDescription("osm.all-attributes", "Formats", TL("Whether additional attributes shall be imported"));
230 :
231 8132 : oc.doRegister("osm.extra-attributes", new Option_StringVector(StringVector({ "all" })));
232 4066 : oc.addSynonyme("osm.extra-attributes", "osm.extra-tags");
233 4066 : oc.addDescription("osm.extra-attributes", "Formats", TL("List of additional attributes that shall be imported from OSM via osm.all-attributes (set 'all' to import all)"));
234 :
235 2033 : oc.doRegister("osm.speedlimit-none", new Option_Float(39.4444));
236 4066 : oc.addDescription("osm.speedlimit-none", "Formats", TL("The speed limit to be set when there is no actual speed limit in reality"));
237 :
238 2033 : oc.doRegister("osm.annotate-defaults", new Option_Bool(false));
239 4066 : oc.addDescription("osm.annotate-defaults", "Formats", TL("Whether edges shoulds carry information on the usage of typemap defaults"));
240 :
241 : // register matsim options
242 2033 : oc.doRegister("matsim.keep-length", new Option_Bool(false));
243 4066 : oc.addDescription("matsim.keep-length", "Formats", TL("The edge lengths given in the MATSim-file will be kept"));
244 :
245 2033 : oc.doRegister("matsim.lanes-from-capacity", new Option_Bool(false));
246 4066 : oc.addDescription("matsim.lanes-from-capacity", "Formats", TL("The lane number will be computed from the capacity"));
247 :
248 :
249 : // register shapefile options
250 2033 : oc.doRegister("shapefile.street-id", new Option_String());
251 4066 : oc.addSynonyme("shapefile.street-id", "arcview.street-id", true);
252 4066 : oc.addDescription("shapefile.street-id", "Formats", TL("Read edge ids from column STR"));
253 :
254 2033 : oc.doRegister("shapefile.from-id", new Option_String());
255 4066 : oc.addSynonyme("shapefile.from-id", "arcview.from-id", true);
256 4066 : oc.addDescription("shapefile.from-id", "Formats", TL("Read from-node ids from column STR"));
257 :
258 2033 : oc.doRegister("shapefile.to-id", new Option_String());
259 4066 : oc.addSynonyme("shapefile.to-id", "arcview.to-id", true);
260 4066 : oc.addDescription("shapefile.to-id", "Formats", TL("Read to-node ids from column STR"));
261 :
262 2033 : oc.doRegister("shapefile.type-id", new Option_String());
263 4066 : oc.addSynonyme("shapefile.type-id", "arcview.type-id", true);
264 4066 : oc.addDescription("shapefile.type-id", "Formats", TL("Read type ids from column STR"));
265 :
266 2033 : oc.doRegister("shapefile.laneNumber", new Option_String());
267 4066 : oc.addDescription("shapefile.laneNumber", "Formats", TL("Read lane number from column STR"));
268 :
269 2033 : oc.doRegister("shapefile.speed", new Option_String());
270 4066 : oc.addDescription("shapefile.speed", "Formats", TL("Read speed from column STR"));
271 :
272 2033 : oc.doRegister("shapefile.length", new Option_String());
273 4066 : oc.addDescription("shapefile.length", "Formats", TL("Read custom edge length from column STR"));
274 :
275 2033 : oc.doRegister("shapefile.width", new Option_String());
276 4066 : oc.addDescription("shapefile.width", "Formats", TL("Read total edge width from column STR"));
277 :
278 2033 : oc.doRegister("shapefile.name", new Option_String());
279 4066 : oc.addDescription("shapefile.name", "Formats", TL("Read (non-unique) name from column STR"));
280 :
281 2033 : oc.doRegister("shapefile.node-join-dist", new Option_Float(0));
282 4066 : oc.addDescription("shapefile.node-join-dist", "Formats", TL("Distance threshold for determining whether distinct shapes are connected (used when from-id and to-id are not available)"));
283 :
284 2033 : oc.doRegister("shapefile.add-params", new Option_StringVector());
285 4066 : oc.addDescription("shapefile.add-params", "Formats", TL("Add the list of field names as edge params"));
286 :
287 2033 : oc.doRegister("shapefile.use-defaults-on-failure", new Option_Bool(false));
288 4066 : oc.addSynonyme("shapefile.use-defaults-on-failure", "arcview.use-defaults-on-failure", true);
289 4066 : oc.addDescription("shapefile.use-defaults-on-failure", "Formats", TL("Uses edge type defaults on problems"));
290 :
291 2033 : oc.doRegister("shapefile.all-bidirectional", new Option_Bool(false));
292 4066 : oc.addSynonyme("shapefile.all-bidirectional", "shapefile.all-bidi");
293 4066 : oc.addSynonyme("shapefile.all-bidirectional", "arcview.all-bidi", true);
294 4066 : oc.addDescription("shapefile.all-bidirectional", "Formats", TL("Insert edges in both directions"));
295 :
296 2033 : oc.doRegister("shapefile.guess-projection", new Option_Bool(false));
297 4066 : oc.addSynonyme("shapefile.guess-projection", "arcview.guess-projection", true);
298 4066 : oc.addDescription("shapefile.guess-projection", "Formats", TL("Guess the proper projection"));
299 :
300 2033 : oc.doRegister("shapefile.traditional-axis-mapping", new Option_Bool(false));
301 4066 : oc.addDescription("shapefile.traditional-axis-mapping", "Formats", TL("Use traditional axis order (lon, lat)"));
302 :
303 :
304 : // register dlr-navteq options
305 2033 : oc.doRegister("dlr-navteq.tolerant-permissions", new Option_Bool(false));
306 4066 : oc.addDescription("dlr-navteq.tolerant-permissions", "Formats", TL("Allow more vehicle classes by default"));
307 :
308 2033 : oc.doRegister("dlr-navteq.keep-length", new Option_Bool(false));
309 4066 : oc.addDescription("dlr-navteq.keep-length", "Formats", TL("The edge lengths given in the DLR Navteq-file will be kept"));
310 :
311 :
312 : // register vissim options
313 2033 : oc.doRegister("vissim.join-distance", new Option_Float(5.0f));
314 4066 : oc.addSynonyme("vissim.join-distance", "vissim.offset", true);
315 4066 : oc.addDescription("vissim.join-distance", "Formats", TL("Structure join offset"));
316 :
317 2033 : oc.doRegister("vissim.default-speed", new Option_Float(50.0f));
318 4066 : oc.addDescription("vissim.default-speed", "Formats", TL("Use FLOAT as default speed"));
319 :
320 2033 : oc.doRegister("vissim.speed-norm", new Option_Float(1.0f));
321 4066 : oc.addDescription("vissim.speed-norm", "Formats", TL("Factor for edge velocity"));
322 :
323 2033 : oc.doRegister("vissim.report-unset-speeds", new Option_Bool(false));
324 4066 : oc.addDescription("vissim.report-unset-speeds", "Formats", TL("Writes lanes without an explicit speed set"));
325 :
326 :
327 : // register visum options
328 2033 : oc.doRegister("visum.language-file", new Option_FileName());
329 4066 : oc.addDescription("visum.language-file", "Formats", TL("Load language mappings from FILE"));
330 :
331 2033 : oc.doRegister("visum.use-type-priority", new Option_Bool(false));
332 4066 : oc.addDescription("visum.use-type-priority", "Formats", TL("Uses priorities from types"));
333 :
334 2033 : oc.doRegister("visum.use-type-laneno", new Option_Bool(false));
335 4066 : oc.addDescription("visum.use-type-laneno", "Formats", TL("Uses lane numbers from types"));
336 :
337 2033 : oc.doRegister("visum.use-type-speed", new Option_Bool(false));
338 4066 : oc.addDescription("visum.use-type-speed", "Formats", TL("Uses speeds from types"));
339 :
340 2033 : oc.doRegister("visum.connector-speeds", new Option_Float(100.));
341 4066 : oc.addDescription("visum.connector-speeds", "Formats", TL("Sets connector speed"));
342 :
343 2033 : oc.doRegister("visum.connectors-lane-number", new Option_Integer(3));
344 4066 : oc.addSynonyme("visum.connectors-lane-number", "visum.connector-laneno", true);
345 4066 : oc.addDescription("visum.connectors-lane-number", "Formats", TL("Sets connector lane number"));
346 :
347 2033 : oc.doRegister("visum.no-connectors", new Option_Bool(true));
348 4066 : oc.addDescription("visum.no-connectors", "Formats", TL("Excludes connectors"));
349 :
350 2033 : oc.doRegister("visum.recompute-lane-number", new Option_Bool(false));
351 4066 : oc.addSynonyme("visum.recompute-lane-number", "visum.recompute-laneno", true);
352 4066 : oc.addDescription("visum.recompute-lane-number", "Formats", TL("Computes the number of lanes from the edges' capacities"));
353 :
354 2033 : oc.doRegister("visum.verbose-warnings", new Option_Bool(false));
355 4066 : oc.addDescription("visum.verbose-warnings", "Formats", TL("Prints all warnings, some of which are due to VISUM misbehaviour"));
356 :
357 2033 : oc.doRegister("visum.lanes-from-capacity.norm", new Option_Float(1800.));
358 4066 : oc.addSynonyme("visum.lanes-from-capacity.norm", "capacity-norm", true);
359 4066 : oc.addSynonyme("visum.lanes-from-capacity.norm", "lanes-from-capacity.norm");
360 4066 : oc.addDescription("visum.lanes-from-capacity.norm", "Formats", TL("The factor for flow to no. lanes conversion"));
361 :
362 :
363 : // register opendrive options
364 2033 : oc.doRegister("opendrive.import-all-lanes", new Option_Bool(false));
365 4066 : oc.addDescription("opendrive.import-all-lanes", "Formats", TL("Imports all lane types"));
366 2033 : oc.doRegister("opendrive.curve-resolution", new Option_Float(2.0));
367 4066 : oc.addDescription("opendrive.curve-resolution", "Formats", TL("The geometry resolution in m when importing curved geometries as line segments."));
368 2033 : oc.doRegister("opendrive.advance-stopline", new Option_Float(0.0));
369 4066 : oc.addDescription("opendrive.advance-stopline", "Formats", TL("Allow stop lines to be built beyond the start of the junction if the geometries allow so"));
370 2033 : oc.doRegister("opendrive.min-width", new Option_Float(1.8));
371 4066 : oc.addDescription("opendrive.min-width", "Formats", TL("The minimum lane width for determining start or end of variable-width lanes"));
372 2033 : oc.doRegister("opendrive.internal-shapes", new Option_Bool(false));
373 4066 : oc.addDescription("opendrive.internal-shapes", "Formats", TL("Import internal lane shapes"));
374 2033 : oc.doRegister("opendrive.position-ids", new Option_Bool(false));
375 4066 : oc.addDescription("opendrive.position-ids", "Formats", TL("Sets edge-id based on road-id and offset in m (legacy)"));
376 2033 : oc.doRegister("opendrive.lane-shapes", new Option_Bool(false));
377 4066 : oc.addDescription("opendrive.lane-shapes", "Formats", TL("Use custom lane shapes to compensate discarded lane types"));
378 2033 : oc.doRegister("opendrive.signal-groups", new Option_Bool(false));
379 4066 : oc.addDescription("opendrive.signal-groups", "Formats", TL("Use the OpenDRIVE controller information for the generated signal program"));
380 2033 : oc.doRegister("opendrive.ignore-misplaced-signals", new Option_Bool(false));
381 4066 : oc.addDescription("opendrive.ignore-misplaced-signals", "Formats", TL("Ignore traffic signals which do not control any driving lane"));
382 :
383 : // register some additional options
384 2033 : oc.doRegister("tls.discard-loaded", new Option_Bool(false));
385 4066 : oc.addDescription("tls.discard-loaded", "TLS Building", "Does not instantiate traffic lights loaded from other formats than plain-XML");
386 :
387 2033 : oc.doRegister("tls.discard-simple", new Option_Bool(false));
388 4066 : oc.addDescription("tls.discard-simple", "TLS Building", "Does not instantiate traffic lights at geometry-like nodes loaded from other formats than plain-XML");
389 :
390 : // register railway options
391 2033 : oc.doRegister("railway.signals.discard", new Option_Bool(false));
392 4066 : oc.addDescription("railway.signals.discard", "Railway", TL("Discard all railway signal information loaded from other formats than plain-xml"));
393 14231 : }
394 :
395 :
396 : bool
397 2017 : NIFrame::checkOptions(OptionsCont& oc) {
398 4034 : bool ok = oc.checkDependingSuboptions("shapefile", "shapefile.");
399 4034 : ok &= oc.checkDependingSuboptions("visum-file", "visum.");
400 4034 : ok &= oc.checkDependingSuboptions("vissim-file", "vissim.");
401 : #ifdef PROJ_API_FILE
402 4034 : int numProjections = oc.getBool("simple-projection") + oc.getBool("proj.utm") + oc.getBool("proj.dhdn") + (oc.getString("proj").length() > 1);
403 5636 : if ((oc.isSet("osm-files") || oc.isSet("dlr-navteq-prefix") || oc.isSet("shapefile-prefix")) && numProjections == 0) {
404 464 : if (oc.isDefault("proj")) {
405 464 : oc.set("proj.utm", "true");
406 : }
407 : }
408 2072 : if (oc.isSet("dlr-navteq-prefix") && oc.isDefault("proj.scale")) {
409 110 : oc.setDefault("proj.scale", NIImporter_DlrNavteq::GEO_SCALE);
410 : }
411 : #else
412 : if ((oc.isSet("osm-files") || oc.isSet("dlr-navteq-prefix") || oc.isSet("shapefile-prefix")) && !oc.getBool("simple-projection")) {
413 : WRITE_ERROR(TL("Cannot import network data without PROJ-Library. Please install package proj before building sumo"));
414 : ok = false;
415 : }
416 : #endif
417 4034 : if (oc.isSet("sumo-net-file")) {
418 1366 : if (oc.isWriteable("no-turnarounds")) {
419 : // changed default since turnarounds are loaded from the net file.
420 1288 : oc.set("no-turnarounds", "true");
421 : }
422 1366 : if (oc.isWriteable("offset.disable-normalization")) {
423 : // changed default since we wish to preserve the network as far as possible
424 1240 : oc.set("offset.disable-normalization", "true");
425 : }
426 1366 : if (oc.isWriteable("geometry.max-grade.fix")) {
427 : // changed default since we wish to preserve the network as far as possible
428 1366 : oc.set("geometry.max-grade.fix", "false");
429 : }
430 1366 : if (oc.isWriteable("geometry.min-radius.fix.railways")) {
431 : // changed default since we wish to preserve the network as far as possible
432 1366 : oc.set("geometry.min-radius.fix.railways", "false");
433 : }
434 1366 : if (oc.isWriteable("geometry.avoid-overlap")) {
435 : // changed default since we wish to preserve the network as far as possible
436 1290 : oc.set("geometry.avoid-overlap", "false");
437 : }
438 : }
439 4034 : if (!oc.isSet("type-files")) {
440 1939 : const char* sumoPath = std::getenv("SUMO_HOME");
441 1939 : if (sumoPath == nullptr) {
442 0 : WRITE_WARNING(TL("Environment variable SUMO_HOME is not set, using built in type maps."));
443 : } else {
444 1939 : const std::string path = sumoPath + std::string("/data/typemap/");
445 3878 : if (oc.isSet("osm-files")) {
446 292 : oc.setDefault("type-files", path + "osmNetconvert.typ.xml");
447 : }
448 3878 : if (oc.isSet("opendrive-files")) {
449 50 : oc.setDefault("type-files", path + "opendriveNetconvert.typ.xml");
450 : }
451 : }
452 : }
453 4034 : if (oc.isSet("opendrive-files")) {
454 52 : if (oc.isDefault("tls.left-green.time")) {
455 : // legacy behavior. see #2114
456 52 : oc.setDefault("tls.left-green.time", "0");
457 : }
458 52 : if (oc.isDefault("rectangular-lane-cut")) {
459 : // a better interpretation of imported geometries
460 52 : oc.setDefault("rectangular-lane-cut", "true");
461 : }
462 52 : if (oc.isDefault("geometry.max-grade.fix")) {
463 : // a better interpretation of imported geometries
464 52 : oc.setDefault("geometry.max-grade.fix", "false");
465 : }
466 45 : if (oc.isDefault("no-turnarounds") && oc.isDefault("no-turnarounds.except-deadend")) {
467 : // changed default since all connections (connecting roads) are loaded from the input.
468 38 : oc.set("no-turnarounds.except-deadend", "true");
469 : }
470 : }
471 2023 : if (!oc.isDefault("osm.extra-attributes") && oc.isDefault("osm.all-attributes")) {
472 10 : oc.setDefault("osm.all-attributes", "true");
473 : }
474 2019 : if (oc.getBool("osm.crossings") && !oc.getBool("osm.sidewalks")) {
475 0 : WRITE_WARNING(TL("It is recommended to use option osm.crossings with osm.sidewalks"));
476 : }
477 2021 : if (oc.isSet("shapefile-prefix") && !oc.isDefault("shapefile.name")) {
478 0 : oc.setDefault("output.street-names", "true");
479 : }
480 :
481 2017 : return ok;
482 : }
483 :
484 :
485 : /****************************************************************************/
|