Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNELoadThread.cpp
Go to the documentation of this file.
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/****************************************************************************/
18// The thread that performs the loading of a Netedit-net (adapted from
19// GUILoadThread)
20/****************************************************************************/
21
22#include <netbuild/NBFrame.h>
24#include <netimport/NIFrame.h>
25#include <netimport/NILoader.h>
26#include <netwrite/NWFrame.h>
32#include <utils/xml/XMLSubSys.h>
33
35#include "GNELoadThread.h"
36#include "GNENet.h"
37
38// ===========================================================================
39// member method definitions
40// ===========================================================================
53
54
62
63
64FXint
66 auto& neteditOptions = OptionsCont::getOptions();
67 // register message callbacks
71 // type of loading
73 // declare loaded file
74 std::string loadedFile;
75 // check conditions
76 if (neteditOptions.getBool("new")) {
77 // create new network
79 } else if (neteditOptions.getString("osm-files").size() > 0) {
80 // load an osm file
82 } else if (neteditOptions.getString("sumo-net-file").size() > 0) {
83 // load a network file
85 } else if (neteditOptions.getString("netecfg-file").size() > 0) {
86 // load a sumo config file
88 // set sumo config as loaded file
89 loadedFile = neteditOptions.getString("netecfg-file");
90 } else if (neteditOptions.getString("sumocfg-file").size() > 0) {
91 // load a sumo config file
93 // set sumo config as loaded file
94 loadedFile = neteditOptions.getString("sumocfg-file");
95 } else if (neteditOptions.getString("netccfg-file").size() > 0) {
96 // load a netconvert config file
98 // set netconvert config file as loaded file
99 loadedFile = neteditOptions.getString("netccfg-file");
100 } else if (neteditOptions.getString("configuration-file").size() > 0) {
101 // get configuration
102 loadedFile = neteditOptions.getString("configuration-file");
103 // check the extension to determine what we're loading
104 if (StringUtils::endsWith(loadedFile, ".netccfg")) {
105 // load a netconvert config file
107 } else if (StringUtils::endsWith(loadedFile, ".sumocfg")) {
108 // load a sumo config file
110 } else if (StringUtils::endsWith(loadedFile, ".netecfg")) {
111 // load a netedit config file
113 } else {
114 // invalid config
116 // stop loading
117 return submitEndAndCleanup(type, nullptr, loadedFile);
118 }
119 } else if (loadConsoleOptions()) {
120 // load information through console
122 }
123 // run handlers
125 // declare parser for sumo config file
127 // if there is an error loading sumo config, stop
128 if (!confighandler.loadSumoConfig()) {
129 return submitEndAndCleanup(type, nullptr, loadedFile);
130 }
131 } else if (type == GNEEvent_FileLoaded::Type::NETCCFG) {
132 // declare parser for netedit config file
134 // if there is an error loading sumo config, stop
135 if (!confighandler.loadNetconvertConfig()) {
136 return submitEndAndCleanup(type, nullptr, loadedFile);
137 }
138 } else if (type == GNEEvent_FileLoaded::Type::NETECFG) {
139 // declare parser for netedit config file
141 // if there is an error loading sumo config, stop
142 if (!confighandler.loadNeteditConfig()) {
143 return submitEndAndCleanup(type, nullptr, loadedFile);
144 }
145 }
146 // check input
148 return submitEndAndCleanup(type, nullptr, loadedFile);
149 }
150 // update aggregate warnings
151 if (neteditOptions.isDefault("aggregate-warnings")) {
152 neteditOptions.setDefault("aggregate-warnings", "5");
153 }
154 // init output options
156 // if there is an error checking options, stop
157 if (!(NIFrame::checkOptions(neteditOptions) && NBFrame::checkOptions(neteditOptions) &&
158 NWFrame::checkOptions(neteditOptions) && SystemFrame::checkOptions(neteditOptions))) {
159 // options are not valid
161 }
162 // clear message instances
166 // init global random seed
168 // check if geo projection can be initialized
169 if (!GeoConvHelper::init(neteditOptions)) {
171 }
172 // set validation
173 XMLSubSys::setValidation(neteditOptions.getString("xml-validation"), neteditOptions.getString("xml-validation.net"), neteditOptions.getString("xml-validation.routes"));
174 // check if Debug has to be enabled
175 MsgHandler::enableDebugMessages(neteditOptions.getBool("gui-testing-debug"));
176 // check if GL Debug has to be enabled
177 MsgHandler::enableDebugGLMessages(neteditOptions.getBool("gui-testing-debug-gl"));
178 // create netBuilder (will be destroyed in GNENet destructor)
179 NBNetBuilder* netBuilder = new NBNetBuilder();
180 // apply netedit options in netBuilder. In this options we have all information for building network
181 netBuilder->applyOptions(neteditOptions);
182 // declare network
183 GNENet* net = nullptr;
184 // check if create a new net
185 if (neteditOptions.getBool("new")) {
186 // create new network
187 net = new GNENet(myApplicationWindow, netBuilder);
188 } else {
189 // declare net loader
190 NILoader nl(*netBuilder);
191 try {
192 // try to load network using netedit options
193 nl.load(neteditOptions);
194 if (true) { // CHECK
195 // make coordinate conversion usable before first netBuilder->compute()
197 } else {
198 WRITE_MESSAGE(TL("Performing initial computation ..."));
199 // perform one-time processing (i.e. edge removal)
200 netBuilder->compute(neteditOptions);
201 // @todo remove one-time processing options!
202 }
203 // check if ignore errors
204 if (neteditOptions.getBool("ignore-errors")) {
206 }
207 // check whether any errors occurred
208 if (MsgHandler::getErrorInstance()->wasInformed()) {
209 throw ProcessError();
210 } else {
211 // now create net with al information loaded in net builder
212 net = new GNENet(myApplicationWindow, netBuilder);
213 // check if change traffic direction
214 if (neteditOptions.getBool("lefthand")) {
215 // force initial geometry computation without volatile options because the net will look strange otherwise
216 net->computeAndUpdate(neteditOptions, false);
217 }
218 // check if add prefixes
219 if (neteditOptions.getString("prefix").size() > 0) {
220 // change prefixes in attributeCarriers
221 net->getAttributeCarriers()->addPrefixToEdges(neteditOptions.getString("prefix"));
222 net->getAttributeCarriers()->addPrefixToJunctions(neteditOptions.getString("prefix"));
223 // change prefix in containers
224 net->getNetBuilder()->getNodeCont().addPrefix(neteditOptions.getString("prefix"));
225 net->getNetBuilder()->getEdgeCont().addPrefix(neteditOptions.getString("prefix"));
226 }
227 }
228 } catch (ProcessError& e) {
229 if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
230 WRITE_ERROR(e.what());
231 }
232 WRITE_ERROR(TL("Failed to build network."));
233 // check if delete network
234 if (net != nullptr) {
235 delete net;
236 net = nullptr;
237 } else {
238 // GNENet not created, then delete netBuilder
239 delete netBuilder;
240 }
241 } catch (std::exception& e) {
242 WRITE_ERROR(e.what());
243 // check if delete network
244 if (net != nullptr) {
245 delete net;
246 net = nullptr;
247 } else {
248 // GNENet not created, then delete netBuilder
249 delete netBuilder;
250 }
251 }
252 }
253 // only a single setting file is supported
254 return submitEndAndCleanup(type, net, loadedFile, neteditOptions.getString("gui-settings-file"),
255 neteditOptions.getBool("registry-viewport"));
256}
257
258
259FXint
261 const std::string& guiSettingsFile, const bool viewportFromRegistry) {
262 // remove message callbacks
266 // inform parent about the process
267 myEventQueue.push_back(new GNEEvent_FileLoaded(type, net, loadedFile, guiSettingsFile, viewportFromRegistry));
269 return 0;
270}
271
272
273void
275 neteditOptions.clear();
276 neteditOptions.addCallExample("--new", TL("Start plain GUI with empty net"));
277 neteditOptions.addCallExample("-s <SUMO_NET>", TL("Open a SUMO network"));
278 neteditOptions.addCallExample("-c <CONFIGURATION>", TL("Open a configuration file (netedit or netconvert config)"));
279 neteditOptions.addCallExample("-sumocfg-file <CONFIGURATION>", TL("Open a SUMO config file"));
280
281 SystemFrame::addConfigurationOptions(neteditOptions); // this subtopic is filled here, too
282 neteditOptions.addOptionSubTopic("Input");
283 neteditOptions.addOptionSubTopic("Output");
285 neteditOptions.addOptionSubTopic("Processing");
286 neteditOptions.addOptionSubTopic("Building Defaults");
287 neteditOptions.addOptionSubTopic("TLS Building");
288 neteditOptions.addOptionSubTopic("Ramp Guessing");
289 neteditOptions.addOptionSubTopic("Edge Removal");
290 neteditOptions.addOptionSubTopic("Unregulated Nodes");
291 neteditOptions.addOptionSubTopic("Junctions");
292 neteditOptions.addOptionSubTopic("Pedestrian");
293 neteditOptions.addOptionSubTopic("Bicycle");
294 neteditOptions.addOptionSubTopic("Railway");
295 neteditOptions.addOptionSubTopic("Formats");
296 neteditOptions.addOptionSubTopic("Netedit");
297 neteditOptions.addOptionSubTopic("Visualisation");
298 neteditOptions.addOptionSubTopic("Time");
299
300 // TOPIC: Input
301 neteditOptions.doRegister("netecfg-file", new Option_FileName());
302 neteditOptions.addSynonyme("netecfg-file", "netecfg");
303 neteditOptions.addDescription("netecfg-file", "Input", TL("Load netedit config"));
304 neteditOptions.addXMLDefault("netecfg-file", "neteditConfiguration");
305 neteditOptions.setOptionEditable("netecfg-file", false);
306
307 neteditOptions.doRegister("sumocfg-file", new Option_FileName());
308 neteditOptions.addSynonyme("sumocfg-file", "sumocfg");
309 neteditOptions.addDescription("sumocfg-file", "Input", TL("Load sumo config"));
310 neteditOptions.addXMLDefault("sumocfg-file", "sumoConfiguration");
311 neteditOptions.setOptionEditable("sumocfg-file", false);
312
313 neteditOptions.doRegister("netccfg-file", new Option_FileName());
314 neteditOptions.addSynonyme("netccfg-file", "netccfg");
315 neteditOptions.addDescription("netccfg-file", "Input", TL("Load netconvert config"));
316 neteditOptions.addXMLDefault("netccfg-file", "netconvertConfiguration");
317 neteditOptions.setOptionEditable("netccfg-file", false);
318
319 neteditOptions.doRegister("additional-files", 'a', new Option_FileName());
320 neteditOptions.addSynonyme("additional-files", "additional");
321 neteditOptions.addDescription("additional-files", "Input", TL("Load additional and shapes descriptions from FILE(s)"));
322 neteditOptions.setOptionEditable("additional-files", false);
323
324 neteditOptions.doRegister("route-files", 'r', new Option_FileName());
325 neteditOptions.addSynonyme("route-files", "routes");
326 neteditOptions.addDescription("route-files", "Input", TL("Load demand elements descriptions from FILE(s)"));
327 neteditOptions.setOptionEditable("route-files", false);
328
329 neteditOptions.doRegister("data-files", 'd', new Option_FileName());
330 neteditOptions.addSynonyme("data-files", "data");
331 neteditOptions.addDescription("data-files", "Input", TL("Load data elements descriptions from FILE(s)"));
332 neteditOptions.setOptionEditable("data-files", false);
333
334 neteditOptions.doRegister("meandata-files", 'm', new Option_FileName());
335 neteditOptions.addSynonyme("meandata-files", "meandata");
336 neteditOptions.addDescription("meandata-files", "Input", TL("Load meanData descriptions from FILE(s)"));
337 neteditOptions.setOptionEditable("meandata-files", false);
338
339 neteditOptions.doRegister("ignore-missing-inputs", new Option_Bool(false));
340 neteditOptions.addDescription("ignore-missing-inputs", "Input", TL("Reset path values (additional, route, data...) after loading netedit config"));
341
342 neteditOptions.doRegister("autosave-netconvert-file", new Option_Bool(false));
343 neteditOptions.addDescription("autosave-netconvert-file", "Input", TL("If enabled, automatically save a netconvert configuration after saving a netedit config"));
344
345 neteditOptions.doRegister("selection-file", new Option_FileName());
346 neteditOptions.addDescription("selection-file", "Input", TL("Load element selection"));
347
348 neteditOptions.doRegister("test-file", new Option_FileName());
349 neteditOptions.addDescription("test-file", "Input", TL("Test file"));
350
351 // TOPIC: Output
352
353 neteditOptions.doRegister("tls-file", new Option_FileName());
354 neteditOptions.addDescription("tls-file", "Output", TL("File in which TLS Programs must be saved"));
355 neteditOptions.setOptionEditable("tls-file", false);
356
357 neteditOptions.doRegister("edgetypes-file", new Option_FileName());
358 neteditOptions.addDescription("edgetypes-file", "Output", TL("File in which edgeTypes must be saved"));
359 neteditOptions.setOptionEditable("edgetypes-file", false);
360
361 // TOPIC: Netedit
362
363 neteditOptions.doRegister("new-network", new Option_Bool(false));
364 neteditOptions.addSynonyme("new-network", "new");
365 neteditOptions.addDescription("new-network", "Netedit", TL("Start netedit with a new network"));
366
367 neteditOptions.doRegister("attribute-help-output", new Option_FileName());
368 neteditOptions.addDescription("attribute-help-output", "Netedit", TL("Write attribute help to file"));
369
370 neteditOptions.doRegister("ignore-supermode-question", new Option_Bool(false));
371 neteditOptions.addDescription("ignore-supermode-question", "Netedit", TL("Ignore question dialog during changing between supermodes in undo-redo"));
372
373 neteditOptions.doRegister("ignore.additionalelements", new Option_Bool(false));
374 neteditOptions.addDescription("ignore.additionalelements", "Netedit", TL("Ignore additional elements during loading of sumo-configs"));
375
376 neteditOptions.doRegister("ignore.routeelements", new Option_Bool(false));
377 neteditOptions.addDescription("ignore.routeelements", "Netedit", TL("Ignore route elements during loading of sumo-configs"));
378
379 neteditOptions.doRegister("e2.friendlyPos.automatic", new Option_Bool(true));
380 neteditOptions.addDescription("e2.friendlyPos.automatic", "Netedit", TL("If the lane is shorter than the additional, automatically enable friendlyPos"));
381
382 neteditOptions.doRegister("force-saving", new Option_Bool(false));
383 neteditOptions.addDescription("force-saving", "Netedit", TL("If enabled, loaded elements will be saved regardless of whether they have been edited or not (usually used in netedit test)"));
384
385 // network prefixes
386
387 neteditOptions.doRegister("node-prefix", new Option_String("J"));
388 neteditOptions.addDescription("node-prefix", "Netedit", TL("Prefix for node naming"));
389
390 neteditOptions.doRegister("edge-prefix", new Option_String("E"));
391 neteditOptions.addDescription("edge-prefix", "Netedit", TL("Prefix for edge naming"));
392
393 neteditOptions.doRegister("edge-infix", new Option_String(""));
394 neteditOptions.addDescription("edge-infix", "Netedit", TL("Enable edge-infix (<fromNodeID><infix><toNodeID>)"));
395
396 // additional prefixes
397
398 neteditOptions.doRegister("busStop-prefix", new Option_String("bs"));
399 neteditOptions.addDescription("busStop-prefix", "Netedit", TL("Prefix for busStop naming"));
400
401 neteditOptions.doRegister("trainStop-prefix", new Option_String("ts"));
402 neteditOptions.addDescription("trainStop-prefix", "Netedit", TL("Prefix for trainStop naming"));
403
404 neteditOptions.doRegister("containerStop-prefix", new Option_String("ct"));
405 neteditOptions.addDescription("containerStop-prefix", "Netedit", TL("Prefix for containerStop naming"));
406
407 neteditOptions.doRegister("chargingStation-prefix", new Option_String("cs"));
408 neteditOptions.addDescription("chargingStation-prefix", "Netedit", TL("Prefix for chargingStation naming"));
409
410 neteditOptions.doRegister("parkingArea-prefix", new Option_String("pa"));
411 neteditOptions.addDescription("parkingArea-prefix", "Netedit", TL("Prefix for parkingArea naming"));
412
413 neteditOptions.doRegister("e1Detector-prefix", new Option_String("e1"));
414 neteditOptions.addDescription("e1Detector-prefix", "Netedit", TL("Prefix for e1Detector naming"));
415
416 neteditOptions.doRegister("e2Detector-prefix", new Option_String("e2"));
417 neteditOptions.addDescription("e2Detector-prefix", "Netedit", TL("Prefix for e2Detector naming"));
418
419 neteditOptions.doRegister("e3Detector-prefix", new Option_String("e3"));
420 neteditOptions.addDescription("e3Detector-prefix", "Netedit", TL("Prefix for e3Detector naming"));
421
422 neteditOptions.doRegister("e1InstantDetector-prefix", new Option_String("e1i"));
423 neteditOptions.addDescription("e1InstantDetector-prefix", "Netedit", TL("Prefix for e1InstantDetector naming"));
424
425 neteditOptions.doRegister("rerouter-prefix", new Option_String("rr"));
426 neteditOptions.addDescription("rerouter-prefix", "Netedit", TL("Prefix for rerouter naming"));
427
428 neteditOptions.doRegister("calibrator-prefix", new Option_String("ca"));
429 neteditOptions.addDescription("calibrator-prefix", "Netedit", TL("Prefix for calibrator naming"));
430
431 neteditOptions.doRegister("routeProbe-prefix", new Option_String("rp"));
432 neteditOptions.addDescription("routeProbe-prefix", "Netedit", TL("Prefix for routeProbe naming"));
433
434 neteditOptions.doRegister("vss-prefix", new Option_String("vs"));
435 neteditOptions.addDescription("vss-prefix", "Netedit", TL("Prefix for variable speed sign naming"));
436
437 neteditOptions.doRegister("tractionSubstation-prefix", new Option_String("tr"));
438 neteditOptions.addDescription("tractionSubstation-prefix", "Netedit", TL("Prefix for traction substation naming"));
439
440 neteditOptions.doRegister("overheadWire-prefix", new Option_String("ow"));
441 neteditOptions.addDescription("overheadWire-prefix", "Netedit", TL("Prefix for overhead wire naming"));
442
443 neteditOptions.doRegister("polygon-prefix", new Option_String("po"));
444 neteditOptions.addDescription("polygon-prefix", "Netedit", TL("Prefix for polygon naming"));
445
446 neteditOptions.doRegister("poi-prefix", new Option_String("poi"));
447 neteditOptions.addDescription("poi-prefix", "Netedit", TL("Prefix for poi naming"));
448
449 neteditOptions.doRegister("jps.walkableArea-prefix", new Option_String("jps.walkable_area"));
450 neteditOptions.addDescription("jps.walkableArea-prefix", "Netedit", TL("Prefix for jps walkable area naming"));
451
452 neteditOptions.doRegister("jps.obstacle-prefix", new Option_String("jps.obstacle"));
453 neteditOptions.addDescription("jps.obstacle-prefix", "Netedit", TL("Prefix for jps obstacle naming"));
454
455 // demand prefixes
456
457 neteditOptions.doRegister("route-prefix", new Option_String("r"));
458 neteditOptions.addDescription("route-prefix", "Netedit", TL("Prefix for route naming"));
459
460 neteditOptions.doRegister("routeDistribution-prefix", new Option_String("rd"));
461 neteditOptions.addDescription("routeDistribution-prefix", "Netedit", TL("Prefix for route distribution naming"));
462
463 neteditOptions.doRegister("vType-prefix", new Option_String("t"));
464 neteditOptions.addDescription("vType-prefix", "Netedit", TL("Prefix for type naming"));
465
466 neteditOptions.doRegister("vTypeDistribution-prefix", new Option_String("td"));
467 neteditOptions.addDescription("vTypeDistribution-prefix", "Netedit", TL("Prefix for type distribution naming"));
468
469 neteditOptions.doRegister("vehicle-prefix", new Option_String("v"));
470 neteditOptions.addDescription("vehicle-prefix", "Netedit", TL("Prefix for vehicle naming"));
471
472 neteditOptions.doRegister("trip-prefix", new Option_String("t"));
473 neteditOptions.addDescription("trip-prefix", "Netedit", TL("Prefix for trip naming"));
474
475 neteditOptions.doRegister("flow-prefix", new Option_String("f"));
476 neteditOptions.addDescription("flow-prefix", "Netedit", TL("Prefix for flow naming"));
477
478 neteditOptions.doRegister("person-prefix", new Option_String("p"));
479 neteditOptions.addDescription("person-prefix", "Netedit", TL("Prefix for person naming"));
480
481 neteditOptions.doRegister("personflow-prefix", new Option_String("pf"));
482 neteditOptions.addDescription("personflow-prefix", "Netedit", TL("Prefix for personFlow naming"));
483
484 neteditOptions.doRegister("container-prefix", new Option_String("c"));
485 neteditOptions.addDescription("container-prefix", "Netedit", TL("Prefix for container naming"));
486
487 neteditOptions.doRegister("containerflow-prefix", new Option_String("cf"));
488 neteditOptions.addDescription("containerflow-prefix", "Netedit", TL("Prefix for containerFlow naming"));
489
490 // data prefixes
491
492 neteditOptions.doRegister("dataSet-prefix", new Option_String("ds"));
493 neteditOptions.addDescription("dataSet-prefix", "Netedit", TL("Prefix for dataSet naming"));
494
495 // mean data prefixes
496
497 neteditOptions.doRegister("meanDataEdge-prefix", new Option_String("ed"));
498 neteditOptions.addDescription("meanDataEdge-prefix", "Netedit", TL("Prefix for meanDataEdge naming"));
499
500 neteditOptions.doRegister("meanDataLane-prefix", new Option_String("ld"));
501 neteditOptions.addDescription("meanDataLane-prefix", "Netedit", TL("Prefix for meanDataLane naming"));
502
503 // TOPIC: Visualisation
504
505 // textures
506
507 neteditOptions.doRegister("disable-laneIcons", new Option_Bool(false));
508 neteditOptions.addDescription("disable-laneIcons", "Visualisation", TL("Disable icons of special lanes"));
509
510 neteditOptions.doRegister("disable-textures", 'T', new Option_Bool(false)); // !!!
511 neteditOptions.addDescription("disable-textures", "Visualisation", TL("Disable textures"));
512
513 neteditOptions.doRegister("gui-settings-file", 'g', new Option_FileName());
514 neteditOptions.addDescription("gui-settings-file", "Visualisation", TL("Load visualisation settings from FILE"));
515
516 // windows position
517
518 neteditOptions.doRegister("registry-viewport", new Option_Bool(false));
519 neteditOptions.addDescription("registry-viewport", "Visualisation", TL("Load current viewport from registry"));
520
521 neteditOptions.doRegister("window-size", new Option_StringVector());
522 neteditOptions.addDescription("window-size", "Visualisation", TL("Create initial window with the given x,y size"));
523
524 neteditOptions.doRegister("window-pos", new Option_StringVector());
525 neteditOptions.addDescription("window-pos", "Visualisation", TL("Create initial window at the given x,y position"));
526
527 // testing
528
529 neteditOptions.doRegister("gui-testing", new Option_Bool(false));
530 neteditOptions.addDescription("gui-testing", "Visualisation", TL("Enable overlay for screen recognition"));
531
532 neteditOptions.doRegister("gui-testing-debug", new Option_Bool(false));
533 neteditOptions.addDescription("gui-testing-debug", "Visualisation", TL("Enable output messages during GUI-Testing"));
534
535 neteditOptions.doRegister("gui-testing-debug-gl", new Option_Bool(false));
536 neteditOptions.addDescription("gui-testing-debug-gl", "Visualisation", TL("Enable output messages during GUI-Testing specific of gl functions"));
537
538 neteditOptions.doRegister("gui-testing.setting-output", new Option_FileName());
539 neteditOptions.addDescription("gui-testing.setting-output", "Visualisation", TL("Save gui settings in the given settings-output file"));
540
541 // TOPIC: Time
542
543 // register the simulation settings (needed for GNERouteHandler)
544
545 neteditOptions.doRegister("begin", new Option_String("0", "TIME"));
546 neteditOptions.addDescription("begin", "Time", TL("Defines the begin time in seconds; The simulation starts at this time"));
547
548 neteditOptions.doRegister("end", new Option_String("-1", "TIME"));
549 neteditOptions.addDescription("end", "Time", TL("Defines the end time in seconds; The simulation ends at this time"));
550
551 neteditOptions.doRegister("default.action-step-length", new Option_Float(0.0));
552 neteditOptions.addDescription("default.action-step-length", "Processing", TL("Length of the default interval length between action points for the car-following and lane-change models (in seconds). If not specified, the simulation step-length is used per default. Vehicle- or VType-specific settings override the default. Must be a multiple of the simulation step-length."));
553
554 neteditOptions.doRegister("default.speeddev", new Option_Float(-1));
555 neteditOptions.addDescription("default.speeddev", "Processing", TL("Select default speed deviation. A negative value implies vClass specific defaults (0.1 for the default passenger class)"));
556
557 // fill rest of options
558
559 NIFrame::fillOptions(neteditOptions, true);
560 NBFrame::fillOptions(neteditOptions, false);
561 NWFrame::fillOptions(neteditOptions, false);
562 RandHelper::insertRandOptions(neteditOptions);
563
564 // don't edit net and config file
565 neteditOptions.setOptionEditable("sumo-net-file", false);
566 neteditOptions.setOptionEditable("configuration-file", false);
567}
568
569
570void
572 neteditOptions.resetWritable();
573 neteditOptions.set("offset.disable-normalization", "true"); // preserve the given network as far as possible
574 neteditOptions.set("no-turnarounds", "true"); // otherwise it is impossible to manually removed turn-arounds
575}
576
577
578bool
580 // only loaded once
582 // get netedit options
583 auto& neteditOptions = OptionsCont::getOptions();
584 // fill (reset) all options
585 fillOptions(neteditOptions);
586 // set default options defined in GNELoadThread::setDefaultOptions(...)
587 setDefaultOptions(neteditOptions);
588 try {
589 // set all values writable, because certain attributes already setted can be updated through console
591 // load options from console
593 return true;
594 } catch (ProcessError& e) {
595 if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) {
596 WRITE_ERROR(e.what());
597 }
598 WRITE_ERROR(TL("Failed to reset options."));
599 return false;
600 }
601 } else {
602 return false;
603 }
604}
605
606
607void
609 auto& neteditOptions = OptionsCont::getOptions();
610 // reset netedit options
611 fillOptions(neteditOptions);
612 setDefaultOptions(neteditOptions);
613 // enable option "new"
614 neteditOptions.resetWritable();
615 neteditOptions.set("new", "true");
616 // start thread
617 start();
618}
619
620
621void
623 // start thread
624 start();
625}
626
627
628void
629GNELoadThread::retrieveMessage(const MsgHandler::MsgType type, const std::string& msg) {
632}
633
634/****************************************************************************/
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:288
#define WRITE_ERROR(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:304
bool consoleOptionsLoaded()
check if console options was already loaded
Type
type of loaded element
MFXSynchQue< GUIEvent * > & myEventQueue
event Queue
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations Needed to be deleted from the handler later on.
void retrieveMessage(const MsgHandler::MsgType type, const std::string &msg)
Retrieves messages from the loading module.
FXint submitEndAndCleanup(GNEEvent_FileLoaded::Type type, GNENet *net, const std::string &loadedFile, const std::string &guiSettingsFile="", const bool viewportFromRegistry=false)
Closes the loading process.
void newNetwork()
begins the creation of an empty network
static void fillOptions(OptionsCont &neteditOptions)
clears and initializes the OptionsCont
void loadNetworkOrConfig()
begins the loading of an existent network or config
OutputDevice * myWarningRetriever
GNEApplicationWindow * myApplicationWindow
netedit application windows
bool loadConsoleOptions()
load options through console
OutputDevice * myMessageRetriever
static void setDefaultOptions(OptionsCont &neteditOptions)
sets required options for proper functioning
virtual ~GNELoadThread()
destructor
OutputDevice * myGLDebugRetriever
OutputDevice * myDebugRetriever
FXEX::MFXThreadEvent & myEventThrow
event throw
FXint run()
starts the thread. The thread ends after the net has been loaded
GNELoadThread(GNEApplicationWindow *applicationWindow, MFXSynchQue< GUIEvent * > &eq, FXEX::MFXThreadEvent &ev)
constructor
void addPrefixToJunctions(const std::string &prefix)
add prefix to all junctions
void addPrefixToEdges(const std::string &prefix)
add prefix to all edges
void computeAndUpdate(OptionsCont &neteditOptions, bool volatileOptions)
recompute the network and update lane geometries
Definition GNENet.cpp:2979
NBNetBuilder * getNetBuilder() const
get net builder
Definition GNENet.cpp:168
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
static void addProjectionOptions(OptionsCont &oc)
Adds projection options to the given container.
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data,...
void push_back(T what)
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void enableDebugGLMessages(bool enable)
enable/disable gl-debug messages
static void initOutputOptions()
init output options
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
static void enableDebugMessages(bool enable)
enable/disable debug messages
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
@ MT_GLDEBUG
The message is GL debug output.
@ MT_DEBUG
The message is debug output.
@ MT_MESSAGE
The message is only something to show.
@ MT_ERROR
The message is an error.
@ MT_WARNING
The message is a warning.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Encapsulates an object's method for using it as a message retriever.
void addPrefix(const std::string &prefix)
add prefix to all edges
static void fillOptions(OptionsCont &oc, bool forNetgen)
Inserts options used by the network converter.
Definition NBFrame.cpp:48
static bool checkOptions(OptionsCont &oc)
Checks set options from the OptionsCont-singleton for being valid.
Definition NBFrame.cpp:764
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
void addPrefix(const std::string &prefix)
add prefix to all nodes
static bool checkOptions(OptionsCont &oc)
Checks set options for being valid.
Definition NIFrame.cpp:397
static void fillOptions(OptionsCont &oc, bool forNetedit=false)
Inserts options used by the network importer and network building modules.
Definition NIFrame.cpp:48
Perfoms network import.
Definition NILoader.h:48
void load(OptionsCont &oc)
Definition NILoader.cpp:70
static void fillOptions(OptionsCont &oc, bool forNetgen)
Inserts options used by the network writer.
Definition NWFrame.cpp:49
static bool checkOptions(OptionsCont &oc)
Checks set options for being valid.
Definition NWFrame.cpp:148
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 setOptionEditable(const std::string &name, const bool value)
set option editable
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
void clear()
Removes all information from the container.
bool set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
void resetWritable()
Resets all options to be writeable.
void addXMLDefault(const std::string &name, const std::string &xmlRoot="")
Adds an XML root element to handle by default. The special root "" denotes the default handler.
static OptionsCont & getOptions()
Retrieves the options.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition OptionsIO.cpp:74
static void insertRandOptions(OptionsCont &oc)
Initialises the given options container with random number options.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
Definition XMLSubSys.cpp:83
void fillOptions()