#include <Distribution_Points.h>

Definition at line 45 of file Distribution_Points.h.
Public Member Functions | |
| Distribution_Points (const std::string &id, const Position2DVector &points, bool interpolating=false) throw () | |
| Constructor. | |
| SUMOReal | getAreaBegin (size_t index) const |
| SUMOReal | getAreaEnd (size_t index) const |
| size_t | getAreaNo () const |
| SUMOReal | getAreaPerc (size_t index) const |
| const std::string & | getID () const throw () |
| Returns the id. | |
| SUMOReal | getMax () const |
| Returns the maximum value of this distribution. | |
| virtual | ~Distribution_Points () throw () |
| Destructor. | |
Protected Attributes | |
| std::string | myID |
| The name of the object. | |
| bool | myInterpolateDist |
| Position2DVector | myPoints |
| The list of points that describe the distribution. | |
| std::vector< SUMOReal > | myProbabilities |
| bool | myProbabilitiesAreComputed |
| Distribution_Points::Distribution_Points | ( | const std::string & | id, | |
| const Position2DVector & | points, | |||
| bool | interpolating = false | |||
| ) | throw () |
Constructor.
Definition at line 44 of file Distribution_Points.cpp.
00047 : Distribution(id), myPoints(points), myProbabilitiesAreComputed(false), 00048 myInterpolateDist(interpolating) {}
| Distribution_Points::~Distribution_Points | ( | ) | throw () [virtual] |
| SUMOReal Distribution_Points::getAreaBegin | ( | size_t | index | ) | const |
Definition at line 69 of file Distribution_Points.cpp.
References myPoints.
Referenced by getAreaPerc().
00069 { 00070 return myPoints[(int) index].x(); 00071 }
| SUMOReal Distribution_Points::getAreaEnd | ( | size_t | index | ) | const |
Definition at line 75 of file Distribution_Points.cpp.
References myPoints.
Referenced by getAreaPerc().
00075 { 00076 return myPoints[(int) index+1].x(); 00077 }
| size_t Distribution_Points::getAreaNo | ( | ) | const |
Definition at line 63 of file Distribution_Points.cpp.
References myPoints, and Position2DVector::size().
| SUMOReal Distribution_Points::getAreaPerc | ( | size_t | index | ) | const |
Definition at line 81 of file Distribution_Points.cpp.
References getAreaBegin(), getAreaEnd(), MAX2(), MIN2(), myInterpolateDist, myPoints, myProbabilities, myProbabilitiesAreComputed, Position2DVector::size(), and SUMOReal.
00081 { 00082 if (!myProbabilitiesAreComputed) { 00083 SUMOReal sum = 0; 00084 size_t i; 00085 if (myInterpolateDist) { 00086 for (i=0; i<myPoints.size()-1; i++) { 00087 SUMOReal width = getAreaEnd(i) - getAreaBegin(i); 00088 SUMOReal minval = MIN2(myPoints[(int) i].y(), myPoints[(int) i].y()); 00089 SUMOReal maxval = MAX2(myPoints[(int) i].y(), myPoints[(int) i].y()); 00090 SUMOReal amount = minval * width + (maxval-minval) * width / (SUMOReal) 2.; 00091 myProbabilities.push_back(amount); 00092 sum += amount; 00093 } 00094 } else { 00095 for (i=0; i<myPoints.size()-1; i++) { 00096 myProbabilities.push_back(myPoints[(int) i].y()); 00097 sum += myPoints[(int) i].y(); 00098 } 00099 } 00100 // normalize 00101 if (myInterpolateDist) { 00102 for (i=0; i<myPoints.size()-1; i++) { 00103 myProbabilities[i] = myProbabilities[i] / sum; 00104 } 00105 } else { 00106 for (i=0; i<myPoints.size()-1; i++) { 00107 myProbabilities[i] = myProbabilities[i] / sum; 00108 } 00109 } 00110 myProbabilitiesAreComputed = true; 00111 } 00112 return myProbabilities[index]; 00113 }
| const std::string& Named::getID | ( | ) | const throw () [inline, inherited] |
Returns the id.
Definition at line 59 of file Named.h.
References Named::myID.
Referenced by RORouteDef_Alternatives::addAlternative(), MSRouteProbe::addRoute(), MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), MSCalibrator::MSCalibrator_FileTriggeredChild::buildAndScheduleFlowVehicle(), RORouteDef_Complete::buildCurrentRoute(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectLinks(), NBTrafficLightDefinition::compute(), GUIPointOfInterest::drawGL(), MSInductLoop::enterDetectorByMove(), MSVTypeProbe::execute(), MSNet::getBusStopID(), GUITriggeredRerouter::getMicrosimID(), GUIPointOfInterest::getMicrosimID(), GUILaneSpeedTrigger::getMicrosimID(), GUIInductLoop::MyWrapper::getMicrosimID(), GUIEmitter::getMicrosimID(), GUIBusStop::getMicrosimID(), GUI_E2_ZS_Collector::MyWrapper::getMicrosimID(), traci::TraCIServer::handlePoiDomain(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), MSTriggeredRerouter::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), MSCalibrator::MSCalibrator_FileTriggeredChild::myStartElement(), NBLoadedTLDef::SignalGroup::patchTYellow(), TraCIServerAPI_Vehicle::processGet(), MSVehicle::replaceRoute(), MSVehicle::saveState(), NBOwnTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), RORDLoader_SUMOBase::startRoute(), GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute(), NBTrafficLightLogic::writeXML(), MSRouteProbe::writeXMLOutput(), MSInductLoop::writeXMLOutput(), MSE2Collector::writeXMLOutput(), and MSVehicle::~MSVehicle().
00059 { 00060 return myID; 00061 }
| SUMOReal Distribution_Points::getMax | ( | ) | const [virtual] |
Returns the maximum value of this distribution.
Implements Distribution.
Definition at line 55 of file Distribution_Points.cpp.
References myPoints, and Position2DVector::size().
00055 { 00056 assert(myPoints.size()>0); 00057 const Position2D &p = myPoints[-1]; 00058 return p.x(); 00059 }
std::string Named::myID [protected, inherited] |
The name of the object.
Definition at line 66 of file Named.h.
Referenced by RORouteDef_OrigDest::buildCurrentRoute(), RORouteDef_Complete::buildCurrentRoute(), RORouteDef_Alternatives::buildCurrentRoute(), and Named::getID().
bool Distribution_Points::myInterpolateDist [protected] |
Position2DVector Distribution_Points::myPoints [protected] |
The list of points that describe the distribution.
Definition at line 66 of file Distribution_Points.h.
Referenced by getAreaBegin(), getAreaEnd(), getAreaNo(), getAreaPerc(), and getMax().
std::vector<SUMOReal> Distribution_Points::myProbabilities [mutable, protected] |
bool Distribution_Points::myProbabilitiesAreComputed [mutable, protected] |
1.5.6