本文整理汇总了C++中geolib::GEOObjects::getStationVectorNames方法的典型用法代码示例。如果您正苦于以下问题:C++ GEOObjects::getStationVectorNames方法的具体用法?C++ GEOObjects::getStationVectorNames怎么用?C++ GEOObjects::getStationVectorNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geolib::GEOObjects
的用法示例。
在下文中一共展示了GEOObjects::getStationVectorNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: max_number_of_points_in_quadtree_leaf_validator
GMSHPrefsDialog::GMSHPrefsDialog(GeoLib::GEOObjects const& geoObjects, QDialog* parent)
: QDialog(parent), _allGeo(new QStringListModel), _selGeo(new QStringListModel)
{
setupUi(this);
// default parameters
this->param1->setText("2");
this->param2->setText("0.3");
this->param3->setText("0.05");
this->param4->setText("0");
// object will be deleted by Qt
auto* max_number_of_points_in_quadtree_leaf_validator(
new StrictIntValidator(1, 1000, this->param1));
param1->setValidator (max_number_of_points_in_quadtree_leaf_validator);
// object will be deleted by Qt
auto* mesh_density_scaling_pnts_validator(
new StrictDoubleValidator(0, 1, 5, this->param2));
param2->setValidator (mesh_density_scaling_pnts_validator);
// object will be deleted by Qt#
auto* mesh_density_scaling_stations_validator(
new StrictDoubleValidator(0, 1, 5, this->param3));
param3->setValidator (mesh_density_scaling_stations_validator);
std::vector<std::string> geoNames;
geoObjects.getGeometryNames(geoNames);
// get station names
std::vector<std::string> geo_station_names;
geoObjects.getStationVectorNames(geo_station_names);
for (auto& geo_station_name : geo_station_names)
geoNames.push_back(geo_station_name);
std::size_t nGeoObjects(geoNames.size());
QStringList list;
for (unsigned i = 0; i < nGeoObjects; ++i)
list.append(QString::fromStdString(geoNames[i]));
if (list.empty())
{
this->selectGeoButton->setDisabled(true);
this->deselectGeoButton->setDisabled(true);
list.append("[No geometry available.]");
}
_allGeo->setStringList(list);
this->allGeoView->setModel(_allGeo);
this->selectedGeoView->setModel(_selGeo);
this->radioAdaptive->toggle(); // default is adaptive meshing
this->on_radioAdaptive_toggled(true);
}
示例2: write
bool XmlGspInterface::write()
{
GeoLib::GEOObjects* geoObjects = _project.getGEOObjects();
QFileInfo fi(QString::fromStdString(_filename));
std::string path((fi.absolutePath()).toStdString() + "/");
_out << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // xml definition
_out << "<?xml-stylesheet type=\"text/xsl\" href=\"OpenGeoSysProject.xsl\"?>\n\n"; // stylefile definition
QDomDocument doc("OGS-PROJECT-DOM");
QDomElement root = doc.createElement("OpenGeoSysProject");
root.setAttribute( "xmlns:ogs", "http://www.opengeosys.org" );
root.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
root.setAttribute( "xsi:noNamespaceSchemaLocation",
"http://www.opengeosys.org/images/xsd/OpenGeoSysProject.xsd" );
doc.appendChild(root);
// GML
std::vector<std::string> geoNames;
geoObjects->getGeometryNames(geoNames);
for (std::vector<std::string>::const_iterator it(geoNames.begin()); it != geoNames.end(); ++it)
{
// write GLI file
XmlGmlInterface gml(*geoObjects);
std::string name(*it);
gml.setNameForExport(name);
if (gml.writeToFile(std::string(path + name + ".gml")))
{
// write entry in project file
QDomElement geoTag = doc.createElement("geo");
root.appendChild(geoTag);
QDomElement fileNameTag = doc.createElement("file");
geoTag.appendChild(fileNameTag);
QDomText fileNameText =
doc.createTextNode(QString::fromStdString(name + ".gml"));
fileNameTag.appendChild(fileNameText);
}
}
// MSH
const std::vector<MeshLib::Mesh*> msh_vec = _project.getMeshObjects();
for (std::vector<MeshLib::Mesh*>::const_iterator it(msh_vec.begin()); it != msh_vec.end(); ++it)
{
// write mesh file
Legacy::MeshIO meshIO;
meshIO.setMesh(*it);
std::string fileName(path + (*it)->getName());
meshIO.writeToFile(fileName);
// write entry in project file
QDomElement mshTag = doc.createElement("msh");
root.appendChild(mshTag);
QDomElement fileNameTag = doc.createElement("file");
mshTag.appendChild(fileNameTag);
QDomText fileNameText = doc.createTextNode(QString::fromStdString((*it)->getName()));
fileNameTag.appendChild(fileNameText);
}
// STN
std::vector<std::string> stnNames;
geoObjects->getStationVectorNames(stnNames);
for (std::vector<std::string>::const_iterator it(stnNames.begin()); it != stnNames.end(); ++it)
{
// write STN file
XmlStnInterface stn(*geoObjects);
std::string name(*it);
stn.setNameForExport(name);
if (stn.writeToFile(path + name + ".stn"))
{
// write entry in project file
QDomElement geoTag = doc.createElement("stn");
root.appendChild(geoTag);
QDomElement fileNameTag = doc.createElement("file");
geoTag.appendChild(fileNameTag);
QDomText fileNameText =
doc.createTextNode(QString::fromStdString(name + ".stn"));
fileNameTag.appendChild(fileNameText);
}
else
ERR("XmlGspInterface::writeFile(): Error writing stn-file \"%s\".", name.c_str());
}
std::string xml = doc.toString().toStdString();
_out << xml;
return true;
}