本文整理汇总了C++中MESegment::addDetector方法的典型用法代码示例。如果您正苦于以下问题:C++ MESegment::addDetector方法的具体用法?C++ MESegment::addDetector怎么用?C++ MESegment::addDetector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESegment
的用法示例。
在下文中一共展示了MESegment::addDetector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessError
// ===========================================================================
// method definitions
// ===========================================================================
MSTriggeredRerouter::MSTriggeredRerouter(const std::string& id,
const std::vector<MSEdge*>& edges,
SUMOReal prob, const std::string& file, bool off) :
MSTrigger(id),
MSMoveReminder(id),
SUMOSAXHandler(file),
myProbability(prob), myUserProbability(prob), myAmInUserMode(false) {
// read in the trigger description
if (file != "" && !XMLSubSys::runParser(*this, file)) {
throw ProcessError();
}
// build actors
for (std::vector<MSEdge*>::const_iterator j = edges.begin(); j != edges.end(); ++j) {
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(**j);
s->addDetector(this);
continue;
}
#endif
const std::vector<MSLane*>& destLanes = (*j)->getLanes();
for (std::vector<MSLane*>::const_iterator i = destLanes.begin(); i != destLanes.end(); ++i) {
(*i)->addMoveReminder(this);
}
}
if (off) {
setUserMode(true);
setUserUsageProbability(0);
}
}
示例2: MSDetectorFileOutput
// ===========================================================================
// method definitions
// ===========================================================================
MSRouteProbe::MSRouteProbe(const std::string& id, const MSEdge* edge, const std::string& distID, const std::string& lastID) :
MSDetectorFileOutput(id), MSMoveReminder(id) {
myCurrentRouteDistribution = std::make_pair(distID, MSRoute::distDictionary(distID));
if (myCurrentRouteDistribution.second == 0) {
myCurrentRouteDistribution.second = new RandomDistributor<const MSRoute*>();
MSRoute::dictionary(distID, myCurrentRouteDistribution.second, false);
}
myLastRouteDistribution = std::make_pair(lastID, MSRoute::distDictionary(lastID));
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* seg = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
while (seg != 0) {
seg->addDetector(this);
seg = seg->getNextSegment();
}
return;
}
#endif
for (std::vector<MSLane*>::const_iterator it = edge->getLanes().begin(); it != edge->getLanes().end(); ++it) {
(*it)->addMoveReminder(this);
}
}
示例3: MSDetectorFileOutput
// ===========================================================================
// method definitions
// ===========================================================================
MSRouteProbe::MSRouteProbe(const std::string& id, const MSEdge* edge, SUMOTime begin)
: MSDetectorFileOutput(id), myCurrentRouteDistribution(0) {
const std::string distID = id + "_" + toString(begin);
myCurrentRouteDistribution = MSRoute::distDictionary(distID);
if (myCurrentRouteDistribution == 0) {
myCurrentRouteDistribution = new RandomDistributor<const MSRoute*>(MSRoute::getMaxRouteDistSize(), &MSRoute::releaseRoute);
MSRoute::dictionary(distID, myCurrentRouteDistribution);
}
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* seg = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
while (seg != 0) {
seg->addDetector(this);
seg = seg->getNextSegment();
}
return;
}
#endif
for (std::vector<MSLane*>::const_iterator it = edge->getLanes().begin(); it != edge->getLanes().end(); ++it) {
(*it)->addMoveReminder(this);
}
}