本文整理汇总了C++中MESegment::getRelativeOccupancy方法的典型用法代码示例。如果您正苦于以下问题:C++ MESegment::getRelativeOccupancy方法的具体用法?C++ MESegment::getRelativeOccupancy怎么用?C++ MESegment::getRelativeOccupancy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESegment
的用法示例。
在下文中一共展示了MESegment::getRelativeOccupancy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool
GUIEdge::setMultiColor(const GUIColorer& c) const {
const int activeScheme = c.getActive();
mySegmentColors.clear();
switch (activeScheme) {
case 10: // alternating segments
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
}
//std::cout << getID() << " scheme=" << c.getScheme().getName() << " schemeCols=" << c.getScheme().getColors().size() << " thresh=" << toString(c.getScheme().getThresholds()) << " segmentColors=" << mySegmentColors.size() << " [0]=" << mySegmentColors[0] << " [1]=" << mySegmentColors[1] << "\n";
return true;
case 11: // by segment jammed state
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
}
return true;
case 12: // by segment occupancy
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
}
return true;
case 13: // by segment speed
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
}
return true;
case 14: // by segment flow
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
}
return true;
case 15: // by segment relative speed
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
}
return true;
default:
return false;
}
}