本文整理汇总了C++中Road::isTwoWay方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::isTwoWay方法的具体用法?C++ Road::isTwoWay怎么用?C++ Road::isTwoWay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::isTwoWay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readSubRoadsFile
void RoadMap::readSubRoadsFile(const std::string& fsubroads){
std::ifstream subroads;
int i = 0;
subroads.open(fsubroads.c_str());
if(!subroads.is_open()){
std::cout << "subroads file does not exist\n";
return;
}
while(!subroads.eof()){
string str;
stringstream ss;
uint id_road, id_node1, id_node2;
char lixo;
ss.clear();
getline(subroads, str, '\n');
ss << str;
ss >> id_road >> lixo >> id_node1 >> lixo >> id_node2;
//TODO Falta conferir se os id est�o em crossroads/roads.
Crossroad* c1 = &crossRoads.find(id_node1)->second;
Crossroad* c2 = &crossRoads.find(id_node2)->second;
Road* r = &roads.find(id_road)->second;
r->addCrossroad(c1);
r->addCrossroad(c2);
uint dist = c1->getDist(*c2);
if(!this->addEdge(*c1, *c2, dist))
cerr << "Edge ups..." << id_node1 << " " << id_node2 << endl;
if(r->isTwoWay()){
if(!this->addEdge(*c2, *c1, dist))
cerr << "Edge ups..." << id_node2 << " " << id_node1 << endl;
i++;
}
i++;
}
subroads.close();
cout << i;
}