本文整理汇总了C++中NBNode::invalidateOutgoingConnections方法的典型用法代码示例。如果您正苦于以下问题:C++ NBNode::invalidateOutgoingConnections方法的具体用法?C++ NBNode::invalidateOutgoingConnections怎么用?C++ NBNode::invalidateOutgoingConnections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBNode
的用法示例。
在下文中一共展示了NBNode::invalidateOutgoingConnections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NBEdge
void
NIVissimDistrictConnection::dict_BuildDistricts(NBDistrictCont& dc,
NBEdgeCont& ec,
NBNodeCont& nc/*,
NBDistribution &distc*/) {
// add the sources and sinks
// their normalised probability is computed within NBDistrict
// to avoid SUMOReal code writing and more securty within the converter
// go through the district table
for (std::map<int, std::vector<int> >::iterator k = myDistrictsConnections.begin(); k != myDistrictsConnections.end(); k++) {
// get the connections
const std::vector<int>& connections = (*k).second;
// retrieve the current district
NBDistrict* district =
dc.retrieve(toString<int>((*k).first));
NBNode* districtNode = nc.retrieve("District" + district->getID());
assert(district != 0 && districtNode != 0);
for (std::vector<int>::const_iterator l = connections.begin(); l != connections.end(); l++) {
NIVissimDistrictConnection* c = dictionary(*l);
// get the edge to connect the parking place to
NBEdge* e = ec.retrieve(toString<int>(c->myEdgeID));
if (e == 0) {
e = ec.retrievePossiblySplit(toString<int>(c->myEdgeID), c->myPosition);
}
if (e == 0) {
WRITE_WARNING("Could not build district '" + toString<int>((*k).first) + "' - edge '" + toString<int>(c->myEdgeID) + "' is missing.");
continue;
}
std::string id = "ParkingPlace" + toString<int>(*l);
NBNode* parkingPlace = nc.retrieve(id);
if (parkingPlace == 0) {
SUMOReal pos = c->getPosition();
if (pos < e->getLength() - pos) {
parkingPlace = e->getFromNode();
parkingPlace->invalidateIncomingConnections();
} else {
parkingPlace = e->getToNode();
parkingPlace->invalidateOutgoingConnections();
}
}
assert(
e->getToNode() == parkingPlace
||
e->getFromNode() == parkingPlace);
// build the connection to the source
if (e->getFromNode() == parkingPlace) {
id = "VissimFromParkingplace" + toString<int>((*k).first) + "-" + toString<int>(c->myID);
NBEdge* source =
new NBEdge(id, districtNode, parkingPlace,
"Connection", c->getMeanSpeed(/*distc*/) / (SUMOReal) 3.6, 3, -1,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET);
if (!ec.insert(source)) { // !!! in den Konstruktor
throw 1; // !!!
}
SUMOReal percNormed =
c->myPercentages[(*k).first];
if (!district->addSource(source, percNormed)) {
throw 1;
}
}
// build the connection to the destination
if (e->getToNode() == parkingPlace) {
id = "VissimToParkingplace" + toString<int>((*k).first) + "-" + toString<int>(c->myID);
NBEdge* destination =
new NBEdge(id, parkingPlace, districtNode,
"Connection", (SUMOReal) 100 / (SUMOReal) 3.6, 2, -1,
NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET);
if (!ec.insert(destination)) { // !!! (in den Konstruktor)
throw 1; // !!!
}
SUMOReal percNormed2 =
c->myPercentages[(*k).first];
if (!district->addSink(destination, percNormed2)) {
throw 1; // !!!
}
}
/*
if(e->getToNode()==districtNode) {
SUMOReal percNormed =
c->myPercentages[(*k).first];
district->addSink(e, percNormed);
}
if(e->getFromNode()==districtNode) {
SUMOReal percNormed =
c->myPercentages[(*k).first];
district->addSource(e, percNormed);
}
*/
}
/*
// add them as sources and sinks to the current district
for(std::vector<int>::const_iterator l=connections.begin(); l!=connections.end(); l++) {
// get the current connections
NIVissimDistrictConnection *c = dictionary(*l);
// get the edge to connect the parking place to
//.........这里部分代码省略.........