21 setAlternatingRowColors(
true);
22 setColumnWidth(0, 150);
23 setColumnWidth(1, 75);
24 setColumnWidth(2, 75);
25 setColumnWidth(3, 75);
30 qDebug(
"%d, %d", idx.parent().row(), idx.row());
34 const QItemSelection& deselected)
37 if (!selected.isEmpty())
39 const QModelIndex idx = *(selected.indexes().begin());
41 static_cast<TreeModel*
>(this->model())->getItem(idx);
54 if (!idx.parent().isValid())
62 const auto* geo_type =
82 tree_item->
data(0).toInt());
87 tree_item->
parentItem()->parentItem()->parentItem());
98 tree_item->
data(0).toInt());
110 const QItemSelection& deselected)
112 QItemSelectionModel* selModel = this->selectionModel();
114 selModel->blockSignals(
true);
115 selModel->select(deselected, QItemSelectionModel::Deselect);
116 selModel->select(selected, QItemSelectionModel::Select);
117 selModel->blockSignals(
false);
119 QTreeView::selectionChanged(selected, deselected);
124 QModelIndex index = this->selectionModel()->currentIndex();
125 auto* item =
static_cast<TreeItem*
>(index.internalPointer());
135 auto const* convertToStationAction =
136 menu.addAction(
"Convert to Stations");
137 connect(convertToStationAction, SIGNAL(triggered()),
this,
142 auto const* connectPlyAction =
143 menu.addAction(
"Connect Polylines...");
144 connect(connectPlyAction, SIGNAL(triggered()),
this,
163 if (parent !=
nullptr)
165 QMenu* cond_menu =
new QMenu(
"Set FEM Condition");
167 QAction* addCondAction = cond_menu->addAction(
"On object...");
168 QAction* addCondPointAction =
169 cond_menu->addAction(
"On all points...");
170 QAction* addNameAction = menu.addAction(
"Set name...");
171 connect(addCondAction, SIGNAL(triggered()),
this,
173 connect(addNameAction, SIGNAL(triggered()),
this,
178 addCondPointAction->setEnabled(
false);
182 connect(addCondPointAction, SIGNAL(triggered()),
this,
187 else if (item->childCount() > 0)
189 if (item->child(0)->data(0).toString().compare(
"Points") ==
193 QAction* mapAction = menu.addAction(
"Map geometry...");
201 connect(mapAction, SIGNAL(triggered()),
this,
212 menu.exec(event->globalPos());
219 ->getItem(this->selectionModel()->currentIndex())
222 item->
data(0).toString().toStdString());
228 ->getItem(this->selectionModel()->currentIndex())
240 QModelIndex index(this->selectionModel()->currentIndex());
241 if (!index.isValid())
265 if (this->selectionModel()->selectedIndexes().count() == 0)
276 this->selectionModel()->currentIndex());
277 const std::size_t
id = item->
row();
280 const std::string geometry_name =
288 this->selectionModel()->currentIndex());
289 const std::size_t
id = item->
row();
292 const std::string geometry_name =
300 this->selectionModel()->currentIndex());
301 std::string geo_name(item->
data(0).toString().toStdString());
307 QModelIndex index(this->selectionModel()->currentIndex());
308 if (!index.isValid())
315 QString file_type(
"GeoSys geometry file (*.gml)");
317 file_type.append(
";;Legacy geometry file (*.gli)");
319 QString geoName = item->
data(0).toString();
320 QString fileName = QFileDialog::getSaveFileName(
321 nullptr,
"Save geometry as",
323 if (!fileName.isEmpty())
334 this->selectionModel()->currentIndex());
vtkPolyDataAlgorithm * vtkSource() const
Returns the Vtk polydata source object.
GeoLib::GEOTYPE getType()
Returns the type of geo-objects contained in the subtree of this item.
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.