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
AGActivityTripWriter.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Class for writing Trip objects in a SUMO-route file.
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13
// activitygen module
14
// Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
15
/****************************************************************************/
16
//
17
// This file is part of SUMO.
18
// SUMO is free software: you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation, either version 3 of the License, or
21
// (at your option) any later version.
22
//
23
/****************************************************************************/
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#include "
city/AGStreet.h
"
36
#include "
AGActivityTripWriter.h
"
37
38
39
// ===========================================================================
40
// method definitions
41
// ===========================================================================
42
void
43
AGActivityTripWriter::initialize
() {
44
vtypes
();
45
}
46
47
void
48
AGActivityTripWriter::vtypes
() {
49
routes
<<
" <vType id=\"default\" accel=\"4.0\" decel=\"8.0\" sigma=\"0.0\" length=\"5\" minGap=\"2.5\" maxSpeed=\"90\"/>\n"
;
50
routes
<<
" <vType id=\"random\" accel=\"4.0\" decel=\"8.0\" sigma=\"0.0\" length=\"5\" minGap=\"2.5\" maxSpeed=\"90\"/>\n"
;
51
routes
<<
" <vType id=\"bus\" accel=\"2.0\" decel=\"4.0\" sigma=\"0.0\" length=\"10\" minGap=\"3\" maxSpeed=\"70\"/>\n\n"
;
52
53
colors
[
"default"
] =
"1,0,0"
;
54
colors
[
"bus"
] =
"0,1,0"
;
55
colors
[
"random"
] =
"0,0,1"
;
56
}
57
58
void
59
AGActivityTripWriter::addTrip
(
AGTrip
trip) {
60
std::list<AGPosition>::iterator it;
61
int
time = (trip.
getDay
() - 1) * 86400 + trip.
getTime
();
62
63
//the vehicle:
64
routes
<<
" <vehicle"
65
<<
" id=\""
<< trip.
getVehicleName
()
66
<<
"\" type=\""
<< trip.
getType
()
67
<<
"\" depart=\""
<< time
68
<<
"\" departPos=\""
<< trip.
getDep
().
getPosition
()
69
<<
"\" arrivalPos=\""
<< trip.
getArr
().
getPosition
()
70
<<
"\" departSpeed=\""
<< 0
71
<<
"\" arrivalSpeed=\""
<< 0
72
<<
"\" color=\""
<<
colors
[trip.
getType
()]
73
<<
"\">\n"
;
74
75
//the route
76
routes
<<
" <route edges=\""
<< trip.
getDep
().
getStreet
().
getName
();
77
for
(it = trip.
getPassed
()->begin(); it != trip.
getPassed
()->end(); ++it) {
78
routes
<<
" "
<< it->getStreet().getName();
79
}
80
routes
<<
" "
<< trip.
getArr
().
getStreet
().
getName
();
81
routes
<<
"\"/>\n"
;
82
83
routes
<<
" </vehicle>\n"
;
84
}
85
86
87
/****************************************************************************/
tmp
buildd
sumo-0.21.0+dfsg
src
activitygen
AGActivityTripWriter.cpp
Generated on Thu Nov 20 2014 19:49:52 for SUMO - Simulation of Urban MObility by
1.8.1.2