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
RORouteDef_OrigDest.cpp
Go to the documentation of this file.
1
/****************************************************************************/
8
// A route where only the origin and the destination edges are known
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
22
23
// ===========================================================================
24
// included modules
25
// ===========================================================================
26
#ifdef _MSC_VER
27
#include <
windows_config.h
>
28
#else
29
#include <
config.h
>
30
#endif
31
32
#include <string>
33
#include <iostream>
34
#include <cassert>
35
#include "
ROEdge.h
"
36
#include "
RORouteDef.h
"
37
#include "
RORoute.h
"
38
#include "
RORouteDef_OrigDest.h
"
39
#include <
utils/common/SUMOAbstractRouter.h
>
40
#include "
ROVehicle.h
"
41
#include "
ROHelper.h
"
42
#include <
utils/common/MsgHandler.h
>
43
#include <
utils/iodevices/OutputDevice.h
>
44
45
#ifdef CHECK_MEMORY_LEAKS
46
#include <
foreign/nvwa/debug_new.h
>
47
#endif // CHECK_MEMORY_LEAKS
48
49
50
// ===========================================================================
51
// member method definitions
52
// ===========================================================================
53
RORouteDef_OrigDest::RORouteDef_OrigDest
(
const
std::string&
id
,
54
const
RGBColor
*
const
color,
55
const
ROEdge
* from,
56
const
ROEdge
* to,
57
bool
removeFirst)
58
:
RORouteDef
(id, color), myFrom(from), myTo(to), myCurrent(0),
59
myRemoveFirst(removeFirst) {}
60
61
62
RORouteDef_OrigDest::~RORouteDef_OrigDest
() {
63
delete
myCurrent
;
64
}
65
66
67
void
68
RORouteDef_OrigDest::preComputeCurrentRoute
(
SUMOAbstractRouter<ROEdge, ROVehicle>
&router,
69
SUMOTime
begin,
const
ROVehicle
& veh)
const
{
70
std::vector<const ROEdge*> edges;
71
router.
compute
(
myFrom
,
myTo
, &veh, begin, edges);
72
if
(
myRemoveFirst
&& edges.size() > 2) {
73
edges.erase(edges.begin());
74
edges.erase(edges.end() - 1);
75
}
76
myPrecomputed
=
new
RORoute
(
myID
, 0, 1, edges,
copyColorIfGiven
());
77
}
78
79
80
void
81
RORouteDef_OrigDest::addAlternative
(
SUMOAbstractRouter<ROEdge, ROVehicle>
&router,
82
const
ROVehicle
*
const
veh,
RORoute
* current,
SUMOTime
begin) {
83
myCurrent
= current;
84
myStartTime
= begin;
85
current->
setCosts
(router.
recomputeCosts
(current->
getEdgeVector
(), veh, begin));
86
}
87
88
89
RORouteDef
*
90
RORouteDef_OrigDest::copy
(
const
std::string&
id
)
const
{
91
return
new
RORouteDef_OrigDest
(
id
,
copyColorIfGiven
(),
myFrom
,
myTo
,
92
myRemoveFirst
);
93
}
94
95
96
OutputDevice
&
97
RORouteDef_OrigDest::writeXMLDefinition
(
SUMOAbstractRouter<ROEdge, ROVehicle>
&router,
98
OutputDevice
& dev,
const
ROVehicle
*
const
veh,
bool
asAlternatives,
bool
withExitTimes)
const
{
99
return
myCurrent
->
writeXMLDefinition
(router, dev, veh, asAlternatives, withExitTimes);
100
}
101
102
103
const
ROEdge
*
104
RORouteDef_OrigDest::getDestination
()
const
{
105
return
myTo
;
106
}
107
108
109
/****************************************************************************/
110
var
build
temp
tmp.znCyBrHNjL
4.0-0-0
sumo
sumo-0.15.0~dfsg
src
router
RORouteDef_OrigDest.cpp
Generated on Mon Mar 24 2014 09:53:14 for SUMO - Simulation of Urban MObility by
1.8.1.2