Beispiel #1
0
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);
}
Beispiel #2
0
MergeGeometriesDialog::MergeGeometriesDialog(GeoLib::GEOObjects* geoObjects, QDialog* parent)
	: QDialog(parent), _geo_objects(geoObjects), _allGeo(new QStringListModel), _selGeo(new QStringListModel)
{
	setupUi(this);

	std::vector<std::string> geoNames;
	_geo_objects->getGeometryNames(geoNames);

	// get station names
	std::vector<std::string> geo_station_names;
	_geo_objects->getStationVectorNames(geo_station_names);

	// merge method does currently not merge stations, converter function needed first
	//geoNames.reserve(geo_station_names.size());
	//std::copy(geo_station_names.begin(), geo_station_names.end(), std::back_inserter(geoNames));

	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);

	std::string new_geo_name("MergedGeometry");
	_geo_objects->isUniquePointVecName(new_geo_name);
	this->newGeoNameEdit->setText(QString::fromStdString(new_geo_name));
}