SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ROJTRFrame.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Sets and checks options for jtr-routing
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <iostream>
34
#include <fstream>
35
#include <ctime>
36
#include <
utils/options/OptionsCont.h
>
37
#include <
utils/options/Option.h
>
38
#include <
utils/common/MsgHandler.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
#include <
utils/common/ToString.h
>
41
#include "
ROJTRFrame.h
"
42
#include <
router/ROFrame.h
>
43
#include <
utils/common/RandHelper.h
>
44
#include <
utils/common/SystemFrame.h
>
45
#include <
utils/common/SUMOVehicleParameter.h
>
46
47
#ifdef CHECK_MEMORY_LEAKS
48
#include <
foreign/nvwa/debug_new.h
>
49
#endif // CHECK_MEMORY_LEAKS
50
51
52
// ===========================================================================
53
// method definitions
54
// ===========================================================================
55
void
56
ROJTRFrame::fillOptions
() {
57
OptionsCont
& oc =
OptionsCont::getOptions
();
58
oc.
addCallExample
(
"-c <CONFIGURATION>"
,
"run with routing options defined in file"
);
59
60
// insert options sub-topics
61
SystemFrame::addConfigurationOptions
(oc);
62
oc.
addOptionSubTopic
(
"Input"
);
63
oc.
addOptionSubTopic
(
"Output"
);
64
oc.
addOptionSubTopic
(
"Processing"
);
65
oc.
addOptionSubTopic
(
"Defaults"
);
66
oc.
addOptionSubTopic
(
"Time"
);
67
SystemFrame::addReportOptions
(oc);
// fill this subtopic, too
68
69
ROFrame::fillOptions
(oc,
false
);
70
71
oc.
doRegister
(
"turn-ratio-files"
,
't'
,
new
Option_FileName
());
72
oc.
addSynonyme
(
"turn-ratio-files"
,
"turns"
);
73
oc.
addDescription
(
"turn-ratio-files"
,
"Input"
,
"Read turning ratios from FILE(s)"
);
74
75
oc.
doRegister
(
"exit-times"
,
new
Option_Bool
(
false
));
76
oc.
addDescription
(
"exit-times"
,
"Output"
,
"Write exit times (weights) for each edge"
);
77
78
oc.
doRegister
(
"max-edges-factor"
,
new
Option_Float
(2.0));
79
oc.
addDescription
(
"max-edges-factor"
,
"Processing"
,
""
);
80
81
oc.
doRegister
(
"turn-defaults"
,
'T'
,
new
Option_String
(
"30,50,20"
));
82
oc.
addDescription
(
"turn-defaults"
,
"Processing"
,
"Use STR as default turn definition"
);
83
84
oc.
doRegister
(
"sink-edges"
,
's'
,
new
Option_String
());
85
oc.
addSynonyme
(
"sink-edges"
,
"sinks"
);
86
oc.
addDescription
(
"sink-edges"
,
"Processing"
,
"Use STR as list of sink edges"
);
87
88
oc.
doRegister
(
"accept-all-destinations"
,
'A'
,
new
Option_Bool
(
false
));
89
oc.
addDescription
(
"accept-all-destinations"
,
"Processing"
,
"Whether all edges are allowed as sink edges"
);
90
91
oc.
doRegister
(
"ignore-vclasses"
,
'i'
,
new
Option_Bool
(
false
));
92
oc.
addDescription
(
"ignore-vclasses"
,
"Processing"
,
"Ignore road restrictions based on vehicle class"
);
93
94
oc.
doRegister
(
"allow-loops"
,
new
Option_Bool
(
false
));
95
oc.
addDescription
(
"allow-loops"
,
"Processing"
,
"Allow to re-use a road"
);
96
97
// add rand options
98
RandHelper::insertRandOptions
();
99
}
100
101
102
bool
103
ROJTRFrame::checkOptions
() {
104
OptionsCont
& oc =
OptionsCont::getOptions
();
105
bool
ok =
ROFrame::checkOptions
(oc);
106
107
SUMOVehicleParameter
p;
108
std::string error;
109
if
(oc.
isSet
(
"departlane"
) && !
SUMOVehicleParameter::parseDepartLane
(oc.
getString
(
"departlane"
),
"option"
,
"departlane"
, p.
departLane
, p.
departLaneProcedure
, error)) {
110
WRITE_ERROR
(error);
111
ok =
false
;
112
}
113
if
(oc.
isSet
(
"departpos"
) && !
SUMOVehicleParameter::parseDepartPos
(oc.
getString
(
"departpos"
),
"option"
,
"departpos"
, p.
departPos
, p.
departPosProcedure
, error)) {
114
WRITE_ERROR
(error);
115
ok =
false
;
116
}
117
if
(oc.
isSet
(
"departspeed"
) && !
SUMOVehicleParameter::parseDepartSpeed
(oc.
getString
(
"departspeed"
),
"option"
,
"departspeed"
, p.
departSpeed
, p.
departSpeedProcedure
, error)) {
118
WRITE_ERROR
(error);
119
ok =
false
;
120
}
121
if
(oc.
isSet
(
"arrivallane"
) && !
SUMOVehicleParameter::parseArrivalLane
(oc.
getString
(
"arrivallane"
),
"option"
,
"arrivallane"
, p.
arrivalLane
, p.
arrivalLaneProcedure
, error)) {
122
WRITE_ERROR
(error);
123
ok =
false
;
124
}
125
if
(oc.
isSet
(
"arrivalpos"
) && !
SUMOVehicleParameter::parseArrivalPos
(oc.
getString
(
"arrivalpos"
),
"option"
,
"arrivalpos"
, p.
arrivalPos
, p.
arrivalPosProcedure
, error)) {
126
WRITE_ERROR
(error);
127
ok =
false
;
128
}
129
if
(oc.
isSet
(
"arrivalspeed"
) && !
SUMOVehicleParameter::parseArrivalSpeed
(oc.
getString
(
"arrivalspeed"
),
"option"
,
"arrivalspeed"
, p.
arrivalSpeed
, p.
arrivalSpeedProcedure
, error)) {
130
WRITE_ERROR
(error);
131
ok =
false
;
132
}
133
return
ok;
134
}
135
136
137
138
/****************************************************************************/
139
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
jtrrouter
ROJTRFrame.cpp
Generated on Sun Jun 16 2013 07:08:27 for SUMO - Simulation of Urban MObility by
1.8.1.2