SUMO - Simulation of Urban MObility
 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-2013 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 
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
55  const bool useGeo = OptionsCont::getOptions().getBool("fcd-output.geo");
59 
60  of.openTag("timestep").writeAttr(SUMO_ATTR_TIME, time2string(timestep));
61  for (; it != end; ++it) {
62  const MSVehicle* veh = static_cast<const MSVehicle*>((*it).second);
63  if (veh->isOnRoad()) {
64  MSLane* lane = veh->getLane();
65  SUMOReal lp = veh->getPositionOnLane();
67  Position pos = lane->getShape().positionAtOffset(gp);
68  if (useGeo) {
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());
80  of.writeAttr(SUMO_ATTR_LANE, lane->getID());
82  of.closeTag();
83  }
84  }
85  of.closeTag();
86 }
87 
88 /****************************************************************************/