SUMO - Simulation of Urban MObility
RORouteDef.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Base class for a vehicle's route definition
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <utils/common/TplConvert.h>
00034 #include <utils/common/ToString.h>
00035 #include <utils/common/Named.h>
00036 #include <utils/common/StringUtils.h>
00037 #include <utils/common/MsgHandler.h>
00038 #include <utils/options/OptionsCont.h>
00039 #include "ROEdge.h"
00040 #include "RORoute.h"
00041 #include <utils/common/SUMOAbstractRouter.h>
00042 #include "ReferencedItem.h"
00043 #include "RORouteDef.h"
00044 #include "ROVehicle.h"
00045 
00046 #ifdef CHECK_MEMORY_LEAKS
00047 #include <foreign/nvwa/debug_new.h>
00048 #endif // CHECK_MEMORY_LEAKS
00049 
00050 
00051 // ===========================================================================
00052 // method definitions
00053 // ===========================================================================
00054 RORouteDef::RORouteDef(const std::string& id, const RGBColor* const color) : 
00055     ReferencedItem(), 
00056     Named(StringUtils::convertUmlaute(id)),
00057     myColor(color),
00058     myPrecomputed(0)
00059 {}
00060 
00061 
00062 RORouteDef::~RORouteDef() {
00063     delete myColor;
00064 }
00065 
00066 
00067 const RGBColor*
00068 RORouteDef::copyColorIfGiven() const {
00069     if (myColor == 0) {
00070         return 0;
00071     }
00072     return new RGBColor(*myColor);
00073 }
00074 
00075 
00076 RORoute*
00077 RORouteDef::buildCurrentRoute(SUMOAbstractRouter<ROEdge, ROVehicle> &router,
00078                                        SUMOTime begin, const ROVehicle& veh) const {
00079     if (myPrecomputed == 0) {
00080         preComputeCurrentRoute(router, begin, veh);
00081     }
00082     return myPrecomputed;
00083 }
00084 
00085 /****************************************************************************/
00086 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines