本文整理汇总了C++中NBEdge::getPermissions方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::getPermissions方法的具体用法?C++ NBEdge::getPermissions怎么用?C++ NBEdge::getPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::getPermissions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeHeader
void
NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec) {
OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
writeHeader(device, oc);
// write format specifier
device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\tFUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\tNAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\tAREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION\n";
// write edges
for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
NBEdge* e = (*i).second;
const int kph = speedInKph(e->getSpeed());
const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? e->getID() : UNDEFINED;
device << e->getID() << "\t"
<< e->getFromNode()->getID() << "\t"
<< e->getToNode()->getID() << "\t"
<< betweenNodeID << "\t"
<< getGraphLength(e) << "\t"
<< getAllowedTypes(e->getPermissions()) << "\t"
<< "3\t" // Speed Category 1-8 XXX refine this
<< UNDEFINED << "\t" // no special brunnel type (we don't know yet)
<< getRoadClass(e) << "\t"
<< getSpeedCategory(kph) << "\t"
<< getNavteqLaneCode(e->getNumLanes()) << "\t"
<< getSpeedCategoryUpperBound(kph) << "\t"
<< kph << "\t"
<< UNDEFINED << "\t" // NAME_ID1_REGIONAL XXX
<< UNDEFINED << "\t" // NAME_ID2_LOCAL XXX
<< UNDEFINED << "\t" // housenumbers_right
<< UNDEFINED << "\t" // housenumbers_left
<< UNDEFINED << "\t" // ZIP_CODE
<< UNDEFINED << "\t" // AREA_ID
<< UNDEFINED << "\t" // SUBAREA_ID
<< "1\t" // through_traffic (allowed)
<< UNDEFINED << "\t" // special_restrictions
<< UNDEFINED << "\t" // extended_number_of_lanes
<< UNDEFINED << "\t" // isRamp
<< "0\t" // connection (between nodes always in order)
<< "\n";
}
}
示例2: ProcessError
//.........这里部分代码省略.........
int priority;
try {
priority = -StringUtils::toInt(getColumn(st, FUNCTIONAL_ROAD_CLASS));
// lower priority using form_of_way
if (form_of_way == 11) {
priority -= 1; // frontage road, very often with lowered curb
} else if (form_of_way > 11) {
priority -= 2; // parking/service access assume lowered curb
}
} catch (NumberFormatException&) {
throw ProcessError("Non-numerical value for street_type of link '" + id + "').");
}
// street name
std::string streetName = getStreetNameFromIDs(
getColumn(st, NAME_ID1_REGIONAL),
getColumn(st, NAME_ID2_LOCAL));
// try to get the nodes
const std::string fromID = getColumn(st, NODE_ID_FROM);
const std::string toID = getColumn(st, NODE_ID_TO);
NBNode* from = myNodeCont.retrieve(fromID);
NBNode* to = myNodeCont.retrieve(toID);
if (from == nullptr) {
throw ProcessError("The from-node '" + fromID + "' of link '" + id + "' could not be found");
}
if (to == nullptr) {
throw ProcessError("The to-node '" + toID + "' of link '" + id + "' could not be found");
}
// speed
double speed;
try {
speed = StringUtils::toInt(getColumn(st, SPEED_RESTRICTION, "-1")) / 3.6;
} catch (NumberFormatException&) {
throw ProcessError("Non-numerical value for the SPEED_RESTRICTION of link '" + id + "'.");
}
if (speed < 0) {
// speed category as fallback
speed = NINavTeqHelper::getSpeed(id, getColumn(st, SPEED_CATEGORY));
}
// number of lanes
int numLanes;
try {
// EXTENDED_NUMBER_OF_LANES is prefered but may not be defined
numLanes = StringUtils::toInt(getColumn(st, EXTENDED_NUMBER_OF_LANES, "-1"));
if (numLanes == -1) {
numLanes = NINavTeqHelper::getLaneNumber(id, getColumn(st, NUMBER_OF_LANES), speed);
}
} catch (NumberFormatException&) {
throw ProcessError("Non-numerical value for the number of lanes of link '" + id + "'.");
}
const std::string navTeqTypeId = getColumn(st, VEHICLE_TYPE) + "_" + getColumn(st, FORM_OF_WAY);
// build the edge
NBEdge* e = nullptr;
const std::string interID = getColumn(st, BETWEEN_NODE_ID);
if (interID == "-1") {
e = new NBEdge(id, from, to, myTypeCont.knows(navTeqTypeId) ? navTeqTypeId : "", speed, numLanes, priority,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, streetName);
} else {
PositionVector geoms = myGeoms[interID];
if (getColumn(st, CONNECTION, "0") == "1") {
geoms = geoms.reverse();
}
geoms.insert(geoms.begin(), from->getPosition());
geoms.push_back(to->getPosition());
const std::string origID = OptionsCont::getOptions().getBool("output.original-names") ? id : "";
e = new NBEdge(id, from, to, myTypeCont.knows(navTeqTypeId) ? navTeqTypeId : "", speed, numLanes, priority,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, geoms, streetName, origID, LANESPREAD_CENTER);
}
// NavTeq imports can be done with a typemap (if supplied), if not, the old defaults are used
if (myTypeCont.knows(navTeqTypeId)) {
e->setPermissions(myTypeCont.getPermissions(navTeqTypeId));
} else {
// add vehicle type information to the edge
if (myVersion < 6.0) {
NINavTeqHelper::addVehicleClasses(*e, getColumn(st, VEHICLE_TYPE));
} else {
NINavTeqHelper::addVehicleClassesV6(*e, getColumn(st, VEHICLE_TYPE));
}
if (e->getPermissions() == SVCAll) {
e->setPermissions(myTypeCont.getPermissions(""));
}
// permission modifications based on form_of_way
if (form_of_way == 14) { // pedestrian area (fussgaengerzone)
// unfortunately, the veh_type string is misleading in this case
e->disallowVehicleClass(-1, SVC_PASSENGER);
}
// permission modifications based on brunnel_type
if (brunnel_type == 10) { // ferry
e->setPermissions(SVC_SHIP, -1);
}
}
// insert the edge to the network
if (!myEdgeCont.insert(e)) {
delete e;
throw ProcessError("Could not add edge '" + id + "'.");
}
return true;
}
示例3: ProcessError
void
NBTrafficLightDefinition::collectAllLinks() {
myControlledLinks.clear();
int tlIndex = 0;
// build the list of links which are controled by the traffic light
for (EdgeVector::iterator i = myIncomingEdges.begin(); i != myIncomingEdges.end(); i++) {
NBEdge* incoming = *i;
unsigned int noLanes = incoming->getNumLanes();
for (unsigned int j = 0; j < noLanes; j++) {
std::vector<NBEdge::Connection> connected = incoming->getConnectionsFromLane(j);
for (std::vector<NBEdge::Connection>::iterator k = connected.begin(); k != connected.end(); k++) {
const NBEdge::Connection& el = *k;
if (incoming->mayBeTLSControlled(el.fromLane, el.toEdge, el.toLane)) {
if (el.toEdge != 0 && el.toLane >= (int) el.toEdge->getNumLanes()) {
throw ProcessError("Connection '" + incoming->getID() + "_" + toString(j) + "->" + el.toEdge->getID() + "_" + toString(el.toLane) + "' yields in a not existing lane.");
}
if (incoming->getToNode()->getType() != NODETYPE_RAIL_CROSSING || !isRailway(incoming->getPermissions())) {
myControlledLinks.push_back(NBConnection(incoming, el.fromLane, el.toEdge, el.toLane, tlIndex++));
} else {
myControlledLinks.push_back(NBConnection(incoming, el.fromLane, el.toEdge, el.toLane, -1));
}
}
}
}
}
}
示例4: writeHeader
void
NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec, std::map<NBEdge*, std::string>& internalNodes) {
std::map<const std::string, std::string> nameIDs;
OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
writeHeader(device, oc);
// write format specifier
device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\tFUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\tNAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\tAREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION\n";
// write edges
for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
NBEdge* e = (*i).second;
const int kph = speedInKph(e->getSpeed());
const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? internalNodes[e] : UNDEFINED;
std::string nameID = UNDEFINED;
if (oc.getBool("output.street-names")) {
const std::string& name = i->second->getStreetName();
if (name != "") {
if (nameIDs.count(name) == 0) {
nameIDs[name] = toString(nameIDs.size());
}
nameID = nameIDs[name];
}
}
device << e->getID() << "\t"
<< e->getFromNode()->getID() << "\t"
<< e->getToNode()->getID() << "\t"
<< betweenNodeID << "\t"
<< getGraphLength(e) << "\t"
<< getAllowedTypes(e->getPermissions()) << "\t"
<< getFormOfWay(e) << "\t"
<< getBrunnelType(e) << "\t"
<< getRoadClass(e) << "\t"
<< getSpeedCategory(kph) << "\t"
<< getNavteqLaneCode(e->getNumLanes()) << "\t"
<< getSpeedCategoryUpperBound(kph) << "\t"
<< kph << "\t"
<< UNDEFINED << "\t" // NAME_ID1_REGIONAL XXX
<< nameID << "\t" // NAME_ID2_LOCAL
<< UNDEFINED << "\t" // housenumbers_right
<< UNDEFINED << "\t" // housenumbers_left
<< getSinglePostalCode(e->getParameter("postal_code", UNDEFINED), e->getID()) << "\t" // ZIP_CODE
<< UNDEFINED << "\t" // AREA_ID
<< UNDEFINED << "\t" // SUBAREA_ID
<< "1\t" // through_traffic (allowed)
<< UNDEFINED << "\t" // special_restrictions
<< UNDEFINED << "\t" // extended_number_of_lanes
<< UNDEFINED << "\t" // isRamp
<< "0\t" // connection (between nodes always in order)
<< "\n";
}
if (oc.getBool("output.street-names")) {
OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt");
writeHeader(namesDevice, oc);
// write format specifier
namesDevice << "# NAME_ID\tPERMANENT_ID_INFO\tName\n";
namesDevice << "# [elements] " << nameIDs.size() << "\n";
for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
namesDevice
<< i->second << "\t"
<< 0 << "\t"
<< i->first << "\n";
}
namesDevice.close();
}
device.close();
}