当前位置: 首页>>代码示例>>C++>>正文


C++ GEOObjects::getGeometryNames方法代码示例

本文整理汇总了C++中geolib::GEOObjects::getGeometryNames方法的典型用法代码示例。如果您正苦于以下问题:C++ GEOObjects::getGeometryNames方法的具体用法?C++ GEOObjects::getGeometryNames怎么用?C++ GEOObjects::getGeometryNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geolib::GEOObjects的用法示例。


在下文中一共展示了GEOObjects::getGeometryNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:TomFischer,项目名称:ogs,代码行数:52,代码来源:GMSHPrefsDialog.cpp

示例2: main

int main (int argc, char* argv[])
{
    ApplicationsLib::LogogSetup logog_setup;

    TCLAP::CmdLine cmd("Maps geometric objects to the surface of a given mesh."
        "The documentation is available at https://docs.opengeosys.org/docs/tools/model-preparation/map-geometric-object-to-the-surface-of-a-mesh",
        ' ',
        "0.1");
    TCLAP::ValueArg<std::string> mesh_in("m", "mesh-file",
        "the name of the file containing the mesh", true,
        "", "file name");
    cmd.add(mesh_in);
    TCLAP::ValueArg<std::string> input_geometry_fname("i", "input-geometry",
        "the name of the file containing the input geometry", true,
        "", "file name");
    cmd.add(input_geometry_fname);
    TCLAP::ValueArg<bool> additional_insert_mapping("a", "additional-insert-mapping",
        "if true advanced mapping algorithm will be applied, i.e. a new "
        "geometry will be created and possibly new points will be inserted.", false,
        true, "boolean value");
    cmd.add(additional_insert_mapping);
    TCLAP::ValueArg<std::string> output_geometry_fname("o", "output-geometry",
        "the name of the file containing the input geometry", true,
        "", "file name");
    cmd.add(output_geometry_fname);
    cmd.parse(argc, argv);

    // *** read geometry
    GeoLib::GEOObjects geometries;
    {
        GeoLib::IO::BoostXmlGmlInterface xml_io(geometries);
        if (xml_io.readFile(input_geometry_fname.getValue())) {
            INFO("Read geometry from file \"%s\".",
                input_geometry_fname.getValue().c_str());
        } else {
            return EXIT_FAILURE;
        }
    }

    std::string geo_name;
    {
        std::vector<std::string> geo_names;
        geometries.getGeometryNames(geo_names);
        geo_name = geo_names[0];
    }

    MeshGeoToolsLib::GeoMapper geo_mapper(geometries, geo_name);

    // *** read mesh
    std::unique_ptr<MeshLib::Mesh> mesh(
        MeshLib::IO::readMeshFromFile(mesh_in.getValue()));

    if (additional_insert_mapping.getValue()) {
        geo_mapper.advancedMapOnMesh(*mesh);
    } else {
        geo_mapper.mapOnMesh(mesh.get());
    }

    {
        GeoLib::IO::BoostXmlGmlInterface xml_io(geometries);
        xml_io.setNameForExport(geo_name);
        xml_io.writeToFile(output_geometry_fname.getValue());
    }
    return EXIT_SUCCESS;
}
开发者ID:Yonghui56,项目名称:ogs,代码行数:65,代码来源:MapGeometryToMeshSurface.cpp

示例3: main

int main (int argc, char* argv[])
{
	ApplicationsLib::LogogSetup logog_setup;

	TCLAP::CmdLine cmd(
		"Creates boundary conditions for mesh nodes along polylines."
		"The documentation is available at https://docs.opengeosys.org/docs/tools/model-preparation/create-boundary-conditions-along-a-polyline",
		' ',
		"0.1");
	TCLAP::ValueArg<bool> gml_arg("", "gml",
		"if switched on write found nodes to file in gml format", false, 0, "bool");
	cmd.add(gml_arg);

	TCLAP::ValueArg<std::string> output_base_fname("o", "output-base-file-name",
		"the base name of the file the output (geometry (gli) and boundary"\
		"condition (bc)) will be written to", true,
		"", "file name");
	cmd.add(output_base_fname);

	TCLAP::ValueArg<std::string> bc_type("t", "type",
		"the process type the boundary condition will be written for "\
		"currently LIQUID_FLOW (primary variable PRESSURE1) and "\
		"GROUNDWATER_FLOW (primary variable HEAD, default) are supported", true,
		"",
		"process type as string (LIQUID_FLOW or GROUNDWATER_FLOW (default))");
	cmd.add(bc_type);

	TCLAP::ValueArg<double> search_length_arg("s", "search-length",
		"The size of the search length. The default value is "
		"std::numeric_limits<double>::epsilon()", false,
		std::numeric_limits<double>::epsilon(), "floating point number");
	cmd.add(search_length_arg);

	TCLAP::ValueArg<std::string> geometry_fname("i", "input-geometry",
		"the name of the file containing the input geometry", true,
		"", "file name");
	cmd.add(geometry_fname);

	TCLAP::ValueArg<std::string> mesh_arg("m", "mesh-file",
		"the name of the file containing the mesh", true,
		"", "file name");
	cmd.add(mesh_arg);

	cmd.parse(argc, argv);

	// *** read mesh
	INFO("Reading mesh \"%s\" ... ", mesh_arg.getValue().c_str());
	MeshLib::Mesh * subsurface_mesh(FileIO::readMeshFromFile(mesh_arg.getValue()));
	INFO("done.");
	INFO("Extracting top surface of mesh \"%s\" ... ",
		mesh_arg.getValue().c_str());
	const MathLib::Vector3 dir(0,0,-1);
	double const angle(90);
	std::unique_ptr<MeshLib::Mesh> surface_mesh(
	    MeshLib::MeshSurfaceExtraction::getMeshSurface(*subsurface_mesh, dir,
	                                                   angle));
	INFO("done.");
	delete subsurface_mesh;
	subsurface_mesh = nullptr;

	// *** read geometry
	GeoLib::GEOObjects geometries;
	FileIO::readGeometryFromFile(geometry_fname.getValue(), geometries);

	std::string geo_name;
	{
		std::vector<std::string> geo_names;
		geometries.getGeometryNames(geo_names);
		geo_name = geo_names[0];
	}

	// *** check if the data is usable
	// *** get vector of polylines
	std::vector<GeoLib::Polyline*> const* plys(geometries.getPolylineVec(geo_name));
	if (!plys) {
		ERR("Could not get vector of polylines out of geometry \"%s\".",
			geo_name.c_str());
		return -1;
	}

	MeshGeoToolsLib::SearchLength search_length_strategy;
	if (search_length_arg.isSet()) {
		search_length_strategy =
			MeshGeoToolsLib::SearchLength(search_length_arg.getValue());
	}

	GeoLib::GEOObjects geometry_sets;
	MeshGeoToolsLib::MeshNodeSearcher mesh_searcher(*surface_mesh,
		search_length_strategy);
	for(std::size_t k(0); k<plys->size(); k++) {
		std::vector<std::size_t> ids
			(mesh_searcher.getMeshNodeIDsAlongPolyline(*((*plys)[k])));
		if (ids.empty())
			continue;
		std::string geo_name("Polyline-"+std::to_string(k));
		convertMeshNodesToGeometry(surface_mesh->getNodes(), ids, geo_name,
			geometry_sets);
	}

	// merge all together
//.........这里部分代码省略.........
开发者ID:Yonghuizz,项目名称:ogs,代码行数:101,代码来源:CreateBoundaryConditionsAlongPolylines.cpp

示例4: 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;
}
开发者ID:Yonghuizz,项目名称:ogs,代码行数:88,代码来源:XmlGspInterface.cpp


注:本文中的geolib::GEOObjects::getGeometryNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。