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
/****************************************************************************/
5
// Realises dumping Floating Car Data (FCD) Data
6
/****************************************************************************/
7
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
8
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
9
/****************************************************************************/
10
//
11
// This file is part of SUMO.
12
// SUMO is free software: you can redistribute it and/or modify
13
// it under the terms of the GNU General Public License as published by
14
// the Free Software Foundation, either version 3 of the License, or
15
// (at your option) any later version.
16
//
17
/****************************************************************************/
18
19
20
// ===========================================================================
21
// included modules
22
// ===========================================================================
23
#ifdef _MSC_VER
24
#include <
windows_config.h
>
25
#else
26
#include <
config.h
>
27
#endif
28
29
#include <
utils/iodevices/OutputDevice.h
>
30
#include <
utils/options/OptionsCont.h
>
31
#include <
utils/geom/GeoConvHelper.h
>
32
#include <
microsim/MSEdgeControl.h
>
33
#include <
microsim/MSEdge.h
>
34
#include <
microsim/MSLane.h
>
35
#include <
microsim/MSGlobals.h
>
36
#include "
MSFCDExport.h
"
37
#include <
microsim/MSNet.h
>
38
#include <
microsim/MSVehicle.h
>
39
40
#ifdef HAVE_MESOSIM
41
#include <mesosim/MELoop.h>
42
#include <mesosim/MESegment.h>
43
#endif
44
45
#ifdef CHECK_MEMORY_LEAKS
46
#include <
foreign/nvwa/debug_new.h
>
47
#endif // CHECK_MEMORY_LEAKS
48
49
50
// ===========================================================================
51
// method definitions
52
// ===========================================================================
53
void
54
MSFCDExport::write
(
OutputDevice
& of,
SUMOTime
timestep) {
55
const
bool
useGeo =
OptionsCont::getOptions
().
getBool
(
"fcd-output.geo"
);
56
MSVehicleControl
& vc =
MSNet::getInstance
()->
getVehicleControl
();
57
MSVehicleControl::constVehIt
it = vc.
loadedVehBegin
();
58
MSVehicleControl::constVehIt
end = vc.
loadedVehEnd
();
59
60
of.
openTag
(
"timestep"
) <<
" time=\""
<<
time2string
(timestep) <<
"\">\n"
;
61
for
(; it != end; ++it) {
62
const
MSVehicle
* veh =
static_cast<
const
MSVehicle
*
>
((*it).second);
63
if
(veh->
isOnRoad
()) {
64
std::string fclass = veh->
getVehicleType
().
getID
();
65
fclass = fclass.substr(0, fclass.find_first_of(
"@"
));
66
Position
pos = veh->
getLane
()->
getShape
().
positionAtLengthPosition
(
67
veh->
getLane
()->
interpolateLanePosToGeometryPos
(veh->
getPositionOnLane
()));
68
if
(useGeo) {
69
of.
setPrecision
(
GEO_OUTPUT_ACCURACY
);
70
GeoConvHelper::getFinal
().
cartesian2geo
(pos);
71
}
72
of.
openTag
(
"vehicle"
);
73
of.
writeAttr
(
SUMO_ATTR_ID
, veh->
getID
());
74
of.
writeAttr
(
SUMO_ATTR_X
, pos.
x
());
75
of.
writeAttr
(
SUMO_ATTR_Y
, pos.
y
());
76
of.
writeAttr
(
SUMO_ATTR_ANGLE
, veh->
getAngle
());
77
of.
writeAttr
(
SUMO_ATTR_TYPE
, fclass);
78
of.
writeAttr
(
SUMO_ATTR_SPEED
, veh->
getSpeed
());
79
of.
closeTag
(
true
);
80
}
81
}
82
of.
closeTag
();
83
}
84
85
/****************************************************************************/
build
buildd
sumo-0.16.0~dfsg
src
microsim
output
MSFCDExport.cpp
Generated on Tue Apr 16 2013 01:32:17 for SUMO - Simulation of Urban MObility by
1.8.3.1