18#include <QStringListModel>
25 _allPly(new QStringListModel),
26 _selPly(new QStringListModel),
31 this->proximityEdit->setValidator(
new QDoubleValidator(0, 100, 8,
this));
33 std::size_t nPly(ply_vec.
size());
35 for (std::size_t i = 0; i < nPly; i++)
39 list.append(
"Line " + QString::number(i) +
" " +
40 QString::fromStdString(ply_name));
44 this->allPlyView->setModel(
_allPly);
45 this->selectedPlyView->setModel(
_selPly);
56 QModelIndexList selected =
57 this->allPlyView->selectionModel()->selectedIndexes();
58 QStringList list =
_selPly->stringList();
60 for (
auto& index : selected)
62 list.append(index.data().toString());
64 _allPly->removeRow(index.row());
71 QModelIndexList selected =
72 this->selectedPlyView->selectionModel()->selectedIndexes();
73 QStringList list =
_allPly->stringList();
75 for (
auto& index : selected)
77 list.append(index.data().toString());
79 _selPly->removeRow(index.row());
86 std::vector<std::size_t> selectedIndeces =
89 if (!selectedIndeces.empty())
91 std::string prox_string = this->proximityEdit->text().toStdString();
93 (prox_string.empty()) ? 0.0 : strtod(prox_string.c_str(),
nullptr);
94 std::string ply_name = (plyNameEdit->text().toStdString().empty())
96 : plyNameEdit->text().toStdString();
101 this->closePlyCheckBox->isChecked(),
102 this->createSfcCheckBox->isChecked());
103 this->done(QDialog::Accepted);
113 this->done(QDialog::Rejected);
118 std::vector<std::size_t> indexList;
119 for (
auto& index : list)
121 QString s = index.mid(5, index.indexOf(
" ") - 5);
122 indexList.push_back(s.toInt());
Definition of the LineEditDialog class.
Definition of the OGSError class.
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
bool getNameOfElementByID(std::size_t id, std::string &element_name) const
void on_deselectPlyButton_pressed()
Instructions when polylines are deselected.
QStringListModel * _selPly
void on_selectPlyButton_pressed()
Instructions when polylines are selected.
LineEditDialog(const GeoLib::PolylineVec &ply_vec, QDialog *parent=nullptr)
~LineEditDialog() override
void accept() override
Instructions if the OK-Button has been pressed.
void reject() override
Instructions if the Cancel-Button has been pressed.
QStringListModel * _allPly
void connectPolylines(const std::string &, std::vector< std::size_t >, double, std::string, bool, bool)
std::vector< std::size_t > getSelectedIndeces(QStringList list)
static void box(const QString &e)