本文整理汇总了C++中StarLink::getNodeFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ StarLink::getNodeFrom方法的具体用法?C++ StarLink::getNodeFrom怎么用?C++ StarLink::getNodeFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StarLink
的用法示例。
在下文中一共展示了StarLink::getNodeFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createKML
void KMLNetOutput::createKML(const std::string& fileWithNodes, const std::string& kmlFileName){
std::cout << "KML will be written to: " << kmlFileName << std::endl;
int nbNodes = net_->getNbNodes();
std::vector<FPType> xCoord(nbNodes, 0);
std::vector<FPType> yCoord(nbNodes, 0);
std::vector<int> nodeID(nbNodes, 0);
readCoord(fileWithNodes, xCoord, yCoord, nodeID);
FileWriter writeKml(kmlFileName);
writeKml.writeLine(createKmlHeader());
for (StarLink* link = net_->beginOnlyLink(); link != NULL; link = net_->getNextOnlyLink()) {
if (shouldCreatePlacemark(link)) {
int tail = link->getNodeFromIndex();
int head = link->getNodeToIndex();
FPType x1 = xCoord[tail];
FPType y1 = yCoord[tail];
FPType x2 = xCoord[head];
FPType y2 = yCoord[head];
if (x1 == 0 && y1 == 0) std::cout << "Missing node coordinate: " << link->getNodeFrom() <<
" link: " << link->toString() << std::endl;
if (x2 == 0 && y2 == 0) std::cout << "Missing node coordinate: " << link->getNodeTo() <<
" link: " << link->toString() << std::endl;
if (x1 != 0 && y1 != 0 && x2 != 0 && y2 != 0)
writeKml.writeLine(createPlacemark(x1, y1, x2, y2, link));
}
}
writeKml.writeLine(createKmlFooter());
};
示例2: findLinkIndex
int findLinkIndex(int tail, int head, StarNetwork* net, int guessIndex){
StarLink* link = net->getLink(guessIndex);
assert(link != NULL);
if (link->getNodeFrom() == tail && link->getNodeTo() == head) {
return link->getIndex();
}
return -1;
};