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
MSFCDExport.cpp
Go to the documentation of this file.
1
/****************************************************************************/
7
// Realises dumping Floating Car Data (FCD) Data
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11
/****************************************************************************/
12
//
13
// This file is part of SUMO.
14
// SUMO is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
/****************************************************************************/
20
21
22
// ===========================================================================
23
// included modules
24
// ===========================================================================
25
#ifdef _MSC_VER
26
#include <
windows_config.h
>
27
#else
28
#include <
config.h
>
29
#endif
30
31
#include <
utils/iodevices/OutputDevice.h
>
32
#include <
utils/options/OptionsCont.h
>
33
#include <
utils/geom/GeoConvHelper.h
>
34
#include <
microsim/MSEdgeControl.h
>
35
#include <
microsim/MSEdge.h
>
36
#include <
microsim/MSLane.h
>
37
#include <
microsim/MSGlobals.h
>
38
#include "
MSFCDExport.h
"
39
#include <
microsim/MSNet.h
>
40
#include <
microsim/MSVehicle.h
>
41
42
#ifdef HAVE_MESOSIM
43
#include <mesosim/MELoop.h>
44
#include <mesosim/MESegment.h>
45
#endif
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
MSFCDExport::write
(
OutputDevice
& of,
SUMOTime
timestep) {
57
const
bool
useGeo =
OptionsCont::getOptions
().
getBool
(
"fcd-output.geo"
);
58
const
bool
signals =
OptionsCont::getOptions
().
getBool
(
"fcd-output.signals"
);
59
MSVehicleControl
& vc =
MSNet::getInstance
()->
getVehicleControl
();
60
MSVehicleControl::constVehIt
it = vc.
loadedVehBegin
();
61
MSVehicleControl::constVehIt
end = vc.
loadedVehEnd
();
62
63
of.
openTag
(
"timestep"
).
writeAttr
(
SUMO_ATTR_TIME
,
time2string
(timestep));
64
for
(; it != end; ++it) {
65
const
MSVehicle
* veh =
static_cast<
const
MSVehicle
*
>
((*it).second);
66
if
(veh->
isOnRoad
()) {
67
Position
pos = veh->
getPosition
();
68
MSLane
* lane = veh->
getLane
();
69
if
(useGeo) {
70
of.
setPrecision
(
GEO_OUTPUT_ACCURACY
);
71
GeoConvHelper::getFinal
().
cartesian2geo
(pos);
72
}
73
of.
openTag
(
"vehicle"
);
74
of.
writeAttr
(
SUMO_ATTR_ID
, veh->
getID
());
75
of.
writeAttr
(
SUMO_ATTR_X
, pos.
x
());
76
of.
writeAttr
(
SUMO_ATTR_Y
, pos.
y
());
77
of.
writeAttr
(
SUMO_ATTR_ANGLE
, veh->
getAngle
());
78
of.
writeAttr
(
SUMO_ATTR_TYPE
, veh->
getVehicleType
().
getID
());
79
of.
writeAttr
(
SUMO_ATTR_SPEED
, veh->
getSpeed
());
80
of.
writeAttr
(
SUMO_ATTR_POSITION
, veh->
getPositionOnLane
());
81
of.
writeAttr
(
SUMO_ATTR_LANE
, lane->
getID
());
82
of.
writeAttr
(
SUMO_ATTR_SLOPE
, lane->
getShape
().
slopeDegreeAtOffset
(veh->
getPositionOnLane
()));
83
if
(signals) {
84
of.
writeAttr
(
"signals"
,
toString
(veh->
getSignals
()));
85
}
86
of.
closeTag
();
87
}
88
}
89
of.
closeTag
();
90
}
91
92
/****************************************************************************/
home
delphi
sumo
src
microsim
output
MSFCDExport.cpp
Generated by
1.8.2