本文整理汇总了C++中geolib::GEOObjects::addStationVec方法的典型用法代码示例。如果您正苦于以下问题:C++ GEOObjects::addStationVec方法的具体用法?C++ GEOObjects::addStationVec怎么用?C++ GEOObjects::addStationVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geolib::GEOObjects
的用法示例。
在下文中一共展示了GEOObjects::addStationVec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFile
int XmlStnInterface::readFile(const QString &fileName)
{
GEOLIB::GEOObjects* geoObjects = _project->getGEOObjects();
QFile* file = new QFile(fileName);
if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
{
std::cout << "XmlStnInterface::readFile() - Can't open xml-file." << "\n";
delete file;
return 0;
}
if (!checkHash(fileName))
{
delete file;
return 0;
}
QDomDocument doc("OGS-STN-DOM");
doc.setContent(file);
QDomElement docElement = doc.documentElement(); //root element, used for identifying file-type
if (docElement.nodeName().compare("OpenGeoSysSTN"))
{
std::cout << "XmlStnInterface::readFile() - Unexpected XML root." << "\n";
delete file;
return 0;
}
QDomNodeList lists = docElement.childNodes();
for (int i = 0; i < lists.count(); i++)
{
// read all the station lists
QDomNodeList stationList = lists.at(i).childNodes();
std::vector<GEOLIB::Point*>* stations = new std::vector<GEOLIB::Point*>;
std::string stnName("[NN]");
for (int j = 0; j < stationList.count(); j++)
{
const QDomNode station_node(stationList.at(j));
const QString station_type(station_node.nodeName());
if (station_type.compare("name") == 0)
stnName = station_node.toElement().text().toStdString();
else if (station_type.compare("stations") == 0)
this->readStations(station_node, stations, fileName.toStdString());
else if (station_type.compare("boreholes") == 0)
this->readStations(station_node, stations, fileName.toStdString());
}
if (!stations->empty())
geoObjects->addStationVec(stations, stnName);
else
delete stations;
}
delete file;
return 1;
}