18#include <QStringListModel>
26 _geo_objects(geoObjects),
27 _allGeo(new QStringListModel),
28 _selGeo(new QStringListModel)
35 std::vector<std::string> geo_station_names;
44 std::size_t nGeoObjects(geoNames.size());
47 for (
unsigned i = 0; i < nGeoObjects; ++i)
49 list.append(QString::fromStdString(geoNames[i]));
54 this->selectGeoButton->setDisabled(
true);
55 this->deselectGeoButton->setDisabled(
true);
56 list.append(
"(No geometry available.)");
59 this->allGeoView->setModel(
_allGeo);
60 this->selectedGeoView->setModel(
_selGeo);
62 std::string new_geo_name(
"MergedGeometry");
64 this->newGeoNameEdit->setText(QString::fromStdString(new_geo_name));
75 QModelIndexList selected =
76 this->allGeoView->selectionModel()->selectedIndexes();
77 QStringList list =
_selGeo->stringList();
79 for (
auto& index : selected)
81 list.append(index.data().toString());
83 _allGeo->removeRow(index.row());
90 QModelIndexList selected =
91 this->selectedGeoView->selectionModel()->selectedIndexes();
92 QStringList list =
_allGeo->stringList();
94 for (
auto& index : selected)
96 list.append(index.data().toString());
98 _selGeo->removeRow(index.row());
105 if (
_selGeo->stringList().size() > 1)
107 this->done(QDialog::Accepted);
112 "At least two geometries need\n to be selected for merging.");
118 this->done(QDialog::Rejected);
123 std::vector<std::string> indexList;
124 QStringList
const& list(
_selGeo->stringList());
125 std::transform(list.begin(), list.end(), std::back_inserter(indexList),
126 [](
auto const& index) { return index.toStdString(); });
132 return this->newGeoNameEdit->text().toStdString();
Definition of the GEOObjects class.
Definition of the MergeGeometriesDialog class.
Definition of the OGSError class.
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
bool isUniquePointVecName(std::string &name) const
void getStationVectorNames(std::vector< std::string > &names) const
Returns the names of all station vectors.
MergeGeometriesDialog(GeoLib::GEOObjects &geoObjects, QDialog *parent=nullptr)
std::string getGeometryName() const
Returns the name of the new merged geometry.
std::vector< std::string > getSelectedGeometries() const
Returns a vector of selected geometries.
void accept() override
Instructions if the OK-Button has been pressed.
GeoLib::GEOObjects & _geo_objects
void reject() override
Instructions if the Cancel-Button has been pressed.
void on_deselectGeoButton_pressed()
~MergeGeometriesDialog() override
QStringListModel * _allGeo
void on_selectGeoButton_pressed()
QStringListModel * _selGeo
static void box(const QString &e)