本文整理汇总了C++中NBEdge::setLaneSpreadFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::setLaneSpreadFunction方法的具体用法?C++ NBEdge::setLaneSpreadFunction怎么用?C++ NBEdge::setLaneSpreadFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::setLaneSpreadFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
NIImporter_ArcView::checkSpread(NBEdge* e) {
NBEdge* ret = e->getToNode()->getConnectionTo(e->getFromNode());
if (ret != 0) {
e->setLaneSpreadFunction(LANESPREAD_RIGHT);
ret->setLaneSpreadFunction(LANESPREAD_RIGHT);
}
}
示例2: getNamedNode
void
NIImporter_VISUM::parse_Edges() {
if (myLineParser.know("VSYSSET") && myLineParser.get("VSYSSET") == "") {
// no vehicle allowed; don't add
return;
}
// get the id
myCurrentID = NBHelpers::normalIDRepresentation(myLineParser.get("Nr"));
// get the from- & to-node and validate them
NBNode* from = getNamedNode("VonKnot", "VonKnotNr");
NBNode* to = getNamedNode("NachKnot", "NachKnotNr");
if (!checkNodes(from, to)) {
return;
}
// get the type
std::string type = myLineParser.know("Typ") ? myLineParser.get("Typ") : myLineParser.get("TypNr");
// get the speed
SUMOReal speed = myNetBuilder.getTypeCont().getSpeed(type);
if (!OptionsCont::getOptions().getBool("visum.use-type-speed")) {
try {
std::string speedS = myLineParser.know("v0-IV") ? myLineParser.get("v0-IV") : myLineParser.get("V0IV");
if (speedS.find("km/h") != std::string::npos) {
speedS = speedS.substr(0, speedS.find("km/h"));
}
speed = TplConvert::_2SUMORealSec(speedS.c_str(), -1);
speed = speed / (SUMOReal) 3.6;
} catch (OutOfBoundsException) {}
}
if (speed <= 0) {
speed = myNetBuilder.getTypeCont().getSpeed(type);
}
// get the information whether the edge is a one-way
bool oneway = myLineParser.know("Einbahn")
? TplConvert::_2bool(myLineParser.get("Einbahn").c_str())
: true;
// get the number of lanes
int nolanes = myNetBuilder.getTypeCont().getNumLanes(type);
if (!OptionsCont::getOptions().getBool("visum.recompute-lane-number")) {
try {
if (!OptionsCont::getOptions().getBool("visum.use-type-laneno")) {
nolanes = myLineParser.know("Fahrstreifen")
? TplConvert::_2intSec(myLineParser.get("Fahrstreifen").c_str(), 0)
: TplConvert::_2intSec(myLineParser.get("ANZFAHRSTREIFEN").c_str(), 0);
}
} catch (UnknownElement) {
}
} else {
SUMOReal cap = myLineParser.know("KAPIV")
? TplConvert::_2SUMORealSec(myLineParser.get("KAPIV").c_str(), -1)
: TplConvert::_2SUMORealSec(myLineParser.get("KAP-IV").c_str(), -1);
nolanes = myCapacity2Lanes.get(cap);
}
// check whether the id is already used
// (should be the opposite direction)
bool oneway_checked = oneway;
NBEdge* previous = myNetBuilder.getEdgeCont().retrieve(myCurrentID);
if (previous != 0) {
myCurrentID = '-' + myCurrentID;
previous->setLaneSpreadFunction(LANESPREAD_RIGHT);
oneway_checked = false;
}
if (find(myTouchedEdges.begin(), myTouchedEdges.end(), myCurrentID) != myTouchedEdges.end()) {
oneway_checked = false;
}
std::string tmpid = '-' + myCurrentID;
if (find(myTouchedEdges.begin(), myTouchedEdges.end(), tmpid) != myTouchedEdges.end()) {
previous = myNetBuilder.getEdgeCont().retrieve(tmpid);
if (previous != 0) {
previous->setLaneSpreadFunction(LANESPREAD_RIGHT);
}
oneway_checked = false;
}
// add the edge
int prio = myUseVisumPrio ? myNetBuilder.getTypeCont().getPriority(type) : -1;
if (nolanes != 0 && speed != 0) {
LaneSpreadFunction lsf = oneway_checked ? LANESPREAD_CENTER : LANESPREAD_RIGHT;
// @todo parse name from visum files
NBEdge* e = new NBEdge(myCurrentID, from, to, type, speed, nolanes, prio,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, "", lsf);
if (!myNetBuilder.getEdgeCont().insert(e)) {
delete e;
WRITE_ERROR("Duplicate edge occured ('" + myCurrentID + "').");
}
}
myTouchedEdges.push_back(myCurrentID);
// nothing more to do, when the edge is a one-way street
if (oneway) {
return;
}
// add the opposite edge
myCurrentID = '-' + myCurrentID;
if (nolanes != 0 && speed != 0) {
LaneSpreadFunction lsf = oneway_checked ? LANESPREAD_CENTER : LANESPREAD_RIGHT;
// @todo parse name from visum files
NBEdge* e = new NBEdge(myCurrentID, from, to, type, speed, nolanes, prio,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, "", lsf);
if (!myNetBuilder.getEdgeCont().insert(e)) {
delete e;
WRITE_ERROR("Duplicate edge occured ('" + myCurrentID + "').");
//.........这里部分代码省略.........