本文整理汇总了C++中NBEdge::getTypeID方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::getTypeID方法的具体用法?C++ NBEdge::getTypeID怎么用?C++ NBEdge::getTypeID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::getTypeID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeLane
void
NWWriter_SUMO::writeEdge(OutputDevice& into, const NBEdge& e, bool noNames, bool origNames) {
// write the edge's begin
into.openTag(SUMO_TAG_EDGE).writeAttr(SUMO_ATTR_ID, e.getID());
into.writeAttr(SUMO_ATTR_FROM, e.getFromNode()->getID());
into.writeAttr(SUMO_ATTR_TO, e.getToNode()->getID());
if (!noNames && e.getStreetName() != "") {
into.writeAttr(SUMO_ATTR_NAME, StringUtils::escapeXML(e.getStreetName()));
}
into.writeAttr(SUMO_ATTR_PRIORITY, e.getPriority());
if (e.getTypeID() != "") {
into.writeAttr(SUMO_ATTR_TYPE, e.getTypeID());
}
if (e.isMacroscopicConnector()) {
into.writeAttr(SUMO_ATTR_FUNCTION, EDGEFUNC_CONNECTOR);
}
// write the spread type if not default ("right")
if (e.getLaneSpreadFunction() != LANESPREAD_RIGHT) {
into.writeAttr(SUMO_ATTR_SPREADTYPE, e.getLaneSpreadFunction());
}
if (e.hasLoadedLength()) {
into.writeAttr(SUMO_ATTR_LENGTH, e.getLoadedLength());
}
if (!e.hasDefaultGeometry()) {
into.writeAttr(SUMO_ATTR_SHAPE, e.getGeometry());
}
// write the lanes
const std::vector<NBEdge::Lane>& lanes = e.getLanes();
SUMOReal length = e.getLoadedLength();
if (OptionsCont::getOptions().getBool("no-internal-links") && !e.hasLoadedLength()) {
// use length to junction center even if a modified geometry was given
PositionVector geom = e.cutAtIntersection(e.getGeometry());
geom.push_back_noDoublePos(e.getToNode()->getCenter());
geom.push_front_noDoublePos(e.getFromNode()->getCenter());
length = geom.length();
}
if (length <= 0) {
length = POSITION_EPS;
}
for (unsigned int i = 0; i < (unsigned int) lanes.size(); i++) {
const NBEdge::Lane& l = lanes[i];
writeLane(into, e.getID(), e.getLaneID(i), l.speed,
l.permissions, l.preferred, l.endOffset, l.width, l.shape, l.origID,
length, i, origNames);
}
// close the edge
into.closeTag();
}
示例2: toString
void
NWWriter_XML::writeEdgesAndConnections(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec) {
const GeoConvHelper& gch = GeoConvHelper::getFinal();
bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo");
const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection();
OutputDevice& edevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".edg.xml");
edevice.writeXMLHeader("edges", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/edges_file.xsd\"");
OutputDevice& cdevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".con.xml");
cdevice.writeXMLHeader("connections", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/connections_file.xsd\"");
bool noNames = !oc.getBool("output.street-names");
for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
// write the edge itself to the edges-files
NBEdge* e = (*i).second;
edevice.openTag(SUMO_TAG_EDGE);
edevice.writeAttr(SUMO_ATTR_ID, e->getID());
edevice.writeAttr(SUMO_ATTR_FROM, e->getFromNode()->getID());
edevice.writeAttr(SUMO_ATTR_TO, e->getToNode()->getID());
if (!noNames && e->getStreetName() != "") {
edevice.writeAttr(SUMO_ATTR_NAME, StringUtils::escapeXML(e->getStreetName()));
}
edevice.writeAttr(SUMO_ATTR_PRIORITY, e->getPriority());
// write the type if given
if (e->getTypeID() != "") {
edevice.writeAttr(SUMO_ATTR_TYPE, e->getTypeID());
}
edevice.writeAttr(SUMO_ATTR_NUMLANES, e->getNumLanes());
if (!e->hasLaneSpecificSpeed()) {
edevice.writeAttr(SUMO_ATTR_SPEED, e->getSpeed());
}
// write non-default geometry
if (!e->hasDefaultGeometry()) {
PositionVector geom = e->getGeometry();
if (useGeo) {
for (int i = 0; i < (int) geom.size(); i++) {
gch.cartesian2geo(geom[i]);
}
}
if (geoAccuracy) {
edevice.setPrecision(GEO_OUTPUT_ACCURACY);
}
edevice.writeAttr(SUMO_ATTR_SHAPE, geom);
if (geoAccuracy) {
edevice.setPrecision();
}
}
// write the spread type if not default ("right")
if (e->getLaneSpreadFunction() != LANESPREAD_RIGHT) {
edevice.writeAttr(SUMO_ATTR_SPREADTYPE, toString(e->getLaneSpreadFunction()));
}
// write the length if it was specified
if (e->hasLoadedLength()) {
edevice.writeAttr(SUMO_ATTR_LENGTH, e->getLoadedLength());
}
// some attributes can be set by edge default or per lane. Write as default if possible (efficiency)
if (e->getLaneWidth() != NBEdge::UNSPECIFIED_WIDTH && !e->hasLaneSpecificWidth()) {
edevice.writeAttr(SUMO_ATTR_WIDTH, e->getLaneWidth());
}
if (e->getOffset() != NBEdge::UNSPECIFIED_OFFSET && !e->hasLaneSpecificOffset()) {
edevice.writeAttr(SUMO_ATTR_OFFSET, e->getOffset());
}
if (!e->needsLaneSpecificOutput()) {
edevice.closeTag();
} else {
for (unsigned int i = 0; i < e->getLanes().size(); ++i) {
const NBEdge::Lane& lane = e->getLanes()[i];
edevice.openTag(SUMO_TAG_LANE);
edevice.writeAttr(SUMO_ATTR_INDEX, i);
// write allowed lanes
NWWriter_SUMO::writePermissions(edevice, lane.permissions);
NWWriter_SUMO::writePreferences(edevice, lane.preferred);
// write other attributes
if (lane.width != NBEdge::UNSPECIFIED_WIDTH && e->hasLaneSpecificWidth()) {
edevice.writeAttr(SUMO_ATTR_WIDTH, lane.width);
}
if (lane.offset != NBEdge::UNSPECIFIED_OFFSET && e->hasLaneSpecificOffset()) {
edevice.writeAttr(SUMO_ATTR_OFFSET, lane.offset);
}
if (e->hasLaneSpecificSpeed()) {
edevice.writeAttr(SUMO_ATTR_SPEED, lane.speed);
}
edevice.closeTag();
}
edevice.closeTag();
}
// write this edge's connections to the connections-files
e->sortOutgoingConnectionsByIndex();
const std::vector<NBEdge::Connection> connections = e->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
NWWriter_SUMO::writeConnection(cdevice, *e, *c, false, NWWriter_SUMO::PLAIN);
}
if (connections.size() > 0) {
cdevice << "\n";
}
}
// write loaded prohibitions to the connections-file
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NWWriter_SUMO::writeProhibitions(cdevice, i->second->getProhibitions());
}
//.........这里部分代码省略.........