32 setAlternatingRowColors(
true);
33 setColumnWidth(0, 150);
34 setColumnWidth(1, 75);
35 setColumnWidth(2, 75);
36 setColumnWidth(3, 75);
41 qDebug(
"%d, %d", idx.parent().row(), idx.row());
45 const QItemSelection& deselected)
48 if (!selected.isEmpty())
50 const QModelIndex idx = *(selected.indexes().begin());
52 static_cast<TreeModel*
>(this->model())->getItem(idx);
65 if (!idx.parent().isValid())
73 const auto* geo_type =
93 tree_item->
data(0).toInt());
109 tree_item->
data(0).toInt());
121 const QItemSelection& deselected)
123 QItemSelectionModel* selModel = this->selectionModel();
125 selModel->blockSignals(
true);
126 selModel->select(deselected, QItemSelectionModel::Deselect);
127 selModel->select(selected, QItemSelectionModel::Select);
128 selModel->blockSignals(
false);
130 QTreeView::selectionChanged(selected, deselected);
135 QModelIndex index = this->selectionModel()->currentIndex();
136 auto* item =
static_cast<TreeItem*
>(index.internalPointer());
146 auto const* convertToStationAction =
147 menu.addAction(
"Convert to Stations");
148 connect(convertToStationAction, SIGNAL(triggered()),
this,
153 auto const* connectPlyAction =
154 menu.addAction(
"Connect Polylines...");
155 connect(connectPlyAction, SIGNAL(triggered()),
this,
174 if (parent !=
nullptr)
176 QMenu* cond_menu =
new QMenu(
"Set FEM Condition");
178 QAction* addCondAction = cond_menu->addAction(
"On object...");
179 QAction* addCondPointAction =
180 cond_menu->addAction(
"On all points...");
181 QAction* addNameAction = menu.addAction(
"Set name...");
182 connect(addCondAction, SIGNAL(triggered()),
this,
184 connect(addNameAction, SIGNAL(triggered()),
this,
189 addCondPointAction->setEnabled(
false);
193 connect(addCondPointAction, SIGNAL(triggered()),
this,
198 else if (item->childCount() > 0)
200 if (item->child(0)->data(0).toString().compare(
"Points") ==
204 QAction* mapAction = menu.addAction(
"Map geometry...");
212 connect(mapAction, SIGNAL(triggered()),
this,
223 menu.exec(event->globalPos());
230 ->getItem(this->selectionModel()->currentIndex())
233 item->
data(0).toString().toStdString());
239 ->getItem(this->selectionModel()->currentIndex())
251 QModelIndex index(this->selectionModel()->currentIndex());
252 if (!index.isValid())
276 if (this->selectionModel()->selectedIndexes().count() == 0)
287 this->selectionModel()->currentIndex());
288 const std::size_t
id = item->
row();
291 const std::string geometry_name =
299 this->selectionModel()->currentIndex());
300 const std::size_t
id = item->
row();
303 const std::string geometry_name =
311 this->selectionModel()->currentIndex());
312 std::string geo_name(item->
data(0).toString().toStdString());
318 QModelIndex index(this->selectionModel()->currentIndex());
319 if (!index.isValid())
326 QString file_type(
"GeoSys geometry file (*.gml)");
328 file_type.append(
";;Legacy geometry file (*.gli)");
330 QString geoName = item->
data(0).toString();
331 QString fileName = QFileDialog::getSaveFileName(
332 nullptr,
"Save geometry as",
334 if (!fileName.isEmpty())
345 this->selectionModel()->currentIndex());
Definition of the GeoObjectListItem class.
Definition of the GeoTreeItem class.
Definition of the GeoTreeModel class.
Definition of the GeoTreeView class.
Definition of the ImportFileTypes enumeration.
Manages the last directory used for saving a file.
Definition of the OGSError class.
vtkPolyDataAlgorithm * vtkSource() const
Returns the Vtk polydata source object.
A model for the GeoTreeView implementing a tree as a double-linked list.
GeoTreeView(QWidget *parent=nullptr)
Constructor.
void enableSaveButton(bool)
Saves FEM Conditions associated with the given geometry.
void requestPointToStationConversion(std::string const &)
void setObjectAsCondition()
void on_Clicked(QModelIndex idx)
void setNameForElement()
Calls a SetNameDialog.
void listRemoved(std::string name, GeoLib::GEOTYPE)
void writeToFile() const
Saves a geometry in a file.
void selectionChangedFromOutside(const QItemSelection &selected, const QItemSelection &deselected)
Instructions if the selection of items in the view has changed by events outside the view (i....
void geoItemSelected(const vtkPolyDataAlgorithm *, int)
void enableRemoveButton(bool)
void requestNameChangeDialog(const std::string &, const GeoLib::GEOTYPE, const std::size_t)
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Instructions if the selection of items in the view has changed.
void saveToFileRequested(QString, QString) const
void setElementAsCondition(bool set_on_points=false)
Calls a FEMConditionSetupDialog.
void removeGeoItemSelection()
void connectPolylines()
Calls a LineEditDialog.
void convertPointsToStations()
void requestLineEditDialog(const std::string &)
void removeGeometry()
Removes a whole geometry or parts of it.
void openGeometryFile(int)
void contextMenuEvent(QContextMenuEvent *e) override
Actions to be taken after a right mouse click is performed in the station view.
void loadFEMCondFileRequested(std::string)
void geometryMappingRequested(const std::string &)
void loadFEMConditions()
Allows to add FEM Conditions to a process.
void updateView()
Update the view to visualise changes made to the underlying data.
void setObjectPointsAsCondition()
void requestCondSetupDialog(const std::string &, const GeoLib::GEOTYPE, const std::size_t, bool on_points)
static void setDir(const QString &path)
Sets the directory last used for saving a file.
static const QString getDir()
Returns the directory last used for saving a file.
static void box(const QString &e)
Objects nodes for the TreeModel.
TreeItem * parentItem() const
TreeItem * child(int row) const
virtual QVariant data(int column) const
A hierarchical model for a tree implemented as a double-linked list.