45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
62 const bool isPermanent,
const RGBColor*
const c,
63 const std::vector<SUMOVehicleParameter::Stop>& stops)
64 :
Named(id), myEdges(edges), myAmPermanent(isPermanent),
65 myReferenceCounter(isPermanent ? 1 : 0),
66 myColor(c), myStops(stops) {}
88 return (
unsigned)
myEdges.size();
128 myDistDict[id] = std::make_pair(routeDist, permanent);
137 RouteDict::iterator it =
myDict.find(
id);
139 RouteDistDict::iterator it2 =
myDistDict.find(
id);
140 if (it2 ==
myDistDict.end() || it2->second.first->getOverallProb() == 0) {
143 return it2->second.first->get();
151 RouteDistDict::iterator it2 =
myDistDict.find(
id);
155 return it2->second.first;
162 delete i->second.first;
165 for (RouteDict::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
174 RouteDistDict::iterator it =
myDistDict.find(
id);
175 if (it !=
myDistDict.end() && !it->second.second) {
176 const std::vector<const MSRoute*>& routes = it->second.first->getVals();
177 for (std::vector<const MSRoute*>::const_iterator i = routes.begin(); i != routes.end(); ++i) {
180 delete it->second.first;
189 for (RouteDict::const_iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
190 into.push_back((*i).first);
193 into.push_back((*i).first);
201 MSEdgeVector::const_iterator i =
myEdges.begin();
205 for (; i !=
myEdges.end(); ++i) {
211 if (upTo || i !=
myEdges.end() - 1) {
221 std::vector<MSEdge*>::const_iterator i = edgelist.begin();
222 for (; i != edgelist.end(); ++i) {
239 for (RouteDict::iterator it =
myDict.begin(); it !=
myDict.end(); ++it) {
257 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
258 ret += (*i)->getLength();
266 bool isFirstIteration =
true;
268 MSEdgeVector::const_iterator it = std::find(
myEdges.begin(),
myEdges.end(), fromEdge);
274 if (fromEdge == toEdge) {
276 if (fromPos <= toPos) {
277 return toPos - fromPos;
278 }
else if (std::find(it + 1,
myEdges.end(), toEdge) ==
myEdges.end()) {
283 for (; it !=
end(); ++it) {
284 if ((*it) == toEdge && !isFirstIteration) {
288 const std::vector<MSLane*>& lanes = (*it)->getLanes();
289 distance += lanes[0]->getLength();
290 #ifdef HAVE_INTERNAL_LANES
292 for (std::vector<MSLane*>::const_iterator laneIt = lanes.begin(); laneIt != lanes.end(); ++laneIt) {
293 const MSLinkCont& links = (*laneIt)->getLinkCont();
294 for (MSLinkCont::const_iterator linkIt = links.begin(); linkIt != links.end(); ++linkIt) {
295 if ((*linkIt) == 0 || (*linkIt)->getLane() == 0) {
298 std::string succLaneId = (*(it + 1))->getLanes()[0]->getID();
299 if ((*linkIt)->getLane()->getID().compare(succLaneId) == 0) {
300 distance += (*linkIt)->getLength();
306 isFirstIteration =
false;
321 const std::vector<SUMOVehicleParameter::Stop>&