本文整理汇总了C++中geolib::GEOObjects::getStationVec方法的典型用法代码示例。如果您正苦于以下问题:C++ GEOObjects::getStationVec方法的具体用法?C++ GEOObjects::getStationVec怎么用?C++ GEOObjects::getStationVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geolib::GEOObjects
的用法示例。
在下文中一共展示了GEOObjects::getStationVec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
int XmlStnInterface::write(std::ostream& stream)
{
if (this->_exportName.empty())
{
std::cout << "Error in XmlStnInterface::write() - No station list specified..." << "\n";
return 0;
}
GEOLIB::GEOObjects* geoObjects = _project->getGEOObjects();
stream << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
stream << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysSTN.xsl\"?>\n\n"; // stylefile definition
QDomDocument doc("OGS-STN-DOM");
QDomElement root = doc.createElement("OpenGeoSysSTN");
root.setAttribute( "xmlns:ogs", "http://www.opengeosys.net" );
root.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
root.setAttribute( "xsi:noNamespaceSchemaLocation", "http://141.65.34.25/OpenGeoSysSTN.xsd" );
const std::vector<GEOLIB::Point*>* stations (geoObjects->getStationVec(_exportName));
bool isBorehole =
(static_cast<GEOLIB::Station*>((*stations)[0])->type() ==
GEOLIB::Station::BOREHOLE) ? true : false;
doc.appendChild(root);
QDomElement stationListTag = doc.createElement("stationlist");
root.appendChild(stationListTag);
QDomElement listNameTag = doc.createElement("name");
stationListTag.appendChild(listNameTag);
QDomText stationListNameText = doc.createTextNode(QString::fromStdString(_exportName));
listNameTag.appendChild(stationListNameText);
QString listType = (isBorehole) ? "boreholes" : "stations";
QDomElement stationsTag = doc.createElement(listType);
stationListTag.appendChild(stationsTag);
bool useStationValue(false);
double sValue=static_cast<GEOLIB::Station*>((*stations)[0])->getStationValue();
size_t nStations(stations->size());
for (size_t i = 1; i < nStations; i++)
if ((static_cast<GEOLIB::Station*>((*stations)[i])->getStationValue() - sValue) < std::numeric_limits<double>::min())
{
useStationValue = true;
break;
}
for (size_t i = 0; i < nStations; i++)
{
QString stationType = (isBorehole) ? "borehole" : "station";
QDomElement stationTag = doc.createElement(stationType);
stationTag.setAttribute( "id", QString::number(i) );
stationTag.setAttribute( "x", QString::number((*(*stations)[i])[0], 'f') );
stationTag.setAttribute( "y", QString::number((*(*stations)[i])[1], 'f') );
stationTag.setAttribute( "z", QString::number((*(*stations)[i])[2], 'f') );
stationsTag.appendChild(stationTag);
QDomElement stationNameTag = doc.createElement("name");
stationTag.appendChild(stationNameTag);
QDomText stationNameText =
doc.createTextNode(QString::fromStdString(static_cast<GEOLIB::Station*>((*stations)[i])->getName()));
stationNameTag.appendChild(stationNameText);
if (useStationValue)
{
QDomElement stationValueTag = doc.createElement("value");
stationTag.appendChild(stationValueTag);
QDomText stationValueText =
doc.createTextNode(QString::number(static_cast<GEOLIB::Station*>((*stations)[i])->getStationValue()));
stationValueTag.appendChild(stationValueText);
}
if (isBorehole)
writeBoreholeData(doc, stationTag,
static_cast<GEOLIB::StationBorehole*>((*stations)[i]));
}
std::string xml = doc.toString().toStdString();
stream << xml;
return 1;
}