本文整理汇总了C++中NBNode::getShape方法的典型用法代码示例。如果您正苦于以下问题:C++ NBNode::getShape方法的具体用法?C++ NBNode::getShape怎么用?C++ NBNode::getShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBNode
的用法示例。
在下文中一共展示了NBNode::getShape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
NWWriter_SUMO::writeJunction(OutputDevice& into, const NBNode& n) {
// write the attributes
into.openTag(SUMO_TAG_JUNCTION).writeAttr(SUMO_ATTR_ID, n.getID());
into.writeAttr(SUMO_ATTR_TYPE, n.getType());
NWFrame::writePositionLong(n.getPosition(), into);
// write the incoming lanes
std::string incLanes;
const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
unsigned int noLanes = (*i)->getNumLanes();
for (unsigned int j = 0; j < noLanes; j++) {
incLanes += (*i)->getLaneID(j);
if (i != incoming.end() - 1 || j < noLanes - 1) {
incLanes += ' ';
}
}
}
into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
// write the internal lanes
std::string intLanes;
if (!OptionsCont::getOptions().getBool("no-internal-links")) {
unsigned int l = 0;
for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
if ((*k).toEdge == 0) {
continue;
}
if (l != 0) {
intLanes += ' ';
}
if (!(*k).haveVia) {
intLanes += (*k).id + "_0";
} else {
intLanes += (*k).viaID + "_0";
}
l++;
}
}
}
into.writeAttr(SUMO_ATTR_INTLANES, intLanes);
// close writing
into.writeAttr(SUMO_ATTR_SHAPE, n.getShape());
if (n.getType() == NODETYPE_DEAD_END) {
into.closeTag();
} else {
// write right-of-way logics
n.writeLogic(into);
into.closeTag();
}
}
示例2:
void
NWWriter_SUMO::writeJunction(OutputDevice& into, const NBNode& n, const bool checkLaneFoes) {
// write the attributes
into.openTag(SUMO_TAG_JUNCTION).writeAttr(SUMO_ATTR_ID, n.getID());
into.writeAttr(SUMO_ATTR_TYPE, n.getType());
NWFrame::writePositionLong(n.getPosition(), into);
// write the incoming lanes
std::string incLanes;
const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
unsigned int noLanes = (*i)->getNumLanes();
for (unsigned int j = 0; j < noLanes; j++) {
incLanes += (*i)->getLaneID(j);
if (i != incoming.end() - 1 || j < noLanes - 1) {
incLanes += ' ';
}
}
}
const std::vector<NBNode::Crossing>& crossings = n.getCrossings();
for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
incLanes += ' ' + (*it).prevWalkingArea + "_0";
}
into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
// write the internal lanes
std::string intLanes;
if (!OptionsCont::getOptions().getBool("no-internal-links")) {
unsigned int l = 0;
for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
if ((*k).toEdge == 0) {
continue;
}
if (l != 0) {
intLanes += ' ';
}
if (!(*k).haveVia) {
intLanes += (*k).getInternalLaneID();
} else {
intLanes += (*k).viaID + "_0";
}
l++;
}
}
}
if (n.getType() != NODETYPE_DEAD_END && n.getType() != NODETYPE_NOJUNCTION) {
for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
intLanes += ' ' + (*it).id + "_0";
}
}
into.writeAttr(SUMO_ATTR_INTLANES, intLanes);
// close writing
into.writeAttr(SUMO_ATTR_SHAPE, n.getShape());
// write optional radius
if (n.getRadius() != NBNode::UNSPECIFIED_RADIUS) {
into.writeAttr(SUMO_ATTR_RADIUS, n.getRadius());
}
// specify whether a custom shape was used
if (n.hasCustomShape()) {
into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true);
}
if (n.getType() == NODETYPE_DEAD_END) {
into.closeTag();
} else {
// write right-of-way logics
n.writeLogic(into, checkLaneFoes);
into.closeTag();
}
}