28 setAlternatingRowColors(
true);
29 setColumnWidth(0, 150);
30 setColumnWidth(1, 75);
31 setColumnWidth(2, 75);
32 setColumnWidth(3, 75);
36 const QItemSelection& deselected)
39 if (!selected.isEmpty())
41 const QModelIndex idx = *(selected.indexes().begin());
43 static_cast<TreeModel*
>(this->model())->getItem(idx);
45 const auto* list_item =
47 if (list_item->getItem())
69 const QItemSelection& selected,
const QItemSelection& deselected)
71 QItemSelectionModel* selModel = this->selectionModel();
73 selModel->blockSignals(
true);
74 selModel->select(deselected, QItemSelectionModel::Deselect);
75 selModel->select(selected, QItemSelectionModel::Select);
76 selModel->blockSignals(
false);
78 return QTreeView::selectionChanged(selected, deselected);
83 QModelIndex index = this->selectionModel()->currentIndex();
84 auto* item =
static_cast<ModelTreeItem*
>(index.internalPointer());
93 if (item->childCount() > 0)
96 QAction* mapAction = menu.addAction(
"Map stations...");
97 QAction* exportAction = menu.addAction(
"Export to GMS...");
100 connect(mapAction, SIGNAL(triggered()),
this, SLOT(
mapStations()));
101 connect(exportAction, SIGNAL(triggered()),
this, SLOT(
exportList()));
102 menu.exec(event->globalPos());
110 QAction* setNameAction = menu.addAction(
"Set name...");
111 connect(setNameAction, SIGNAL(triggered()),
this,
117 QAction* stratAction = menu.addAction(
"Display Stratigraphy...");
118 QAction* exportAction = menu.addAction(
"Export to GMS...");
119 connect(stratAction, SIGNAL(triggered()),
this,
121 connect(exportAction, SIGNAL(triggered()),
this,
123 menu.exec(event->globalPos());
127 QAction* showDiagramAction = menu.addAction(
"View Diagram...");
128 connect(showDiagramAction, SIGNAL(triggered()),
this,
130 menu.exec(event->globalPos());
139 this->selectionModel()->currentIndex());
140 std::string
const stn_vec_name =
149 this->selectionModel()->currentIndex());
150 std::string
const& geo_name(item->
data(0).toString().toStdString());
156 QModelIndex index = this->selectionModel()->currentIndex();
161 this->selectionModel()->currentIndex(), temp_name);
163 std::map<std::string, DataHolderLib::Color> colorLookupTable =
166 temp_name.toStdString()))
173 stratView->setAttribute(
174 Qt::WA_DeleteOnClose);
185 QModelIndex index(this->selectionModel()->currentIndex());
186 if (!index.isValid())
194 QString listName = item->
data(0).toString();
195 QString fileName = QFileDialog::getSaveFileName(
196 this,
"Save station list",
198 if (!fileName.isEmpty())
214 this->selectionModel()->currentIndex());
215 QString listName = item->
data(0).toString();
216 QString fileName = QFileDialog::getSaveFileName(
217 this,
"Export Boreholes to GMS-Format",
219 if (!fileName.isEmpty())
223 fileName.toStdString());
229 QModelIndex index = this->selectionModel()->currentIndex();
231 QFileDialog::getSaveFileName(
this,
"Export Borehole to GMS-Format",
233 if (!fileName.isEmpty())
236 std::vector<GeoLib::Point*> stations;
241 fileName.toStdString());
248 QModelIndex index(this->selectionModel()->currentIndex());
249 if (!index.isValid())
259 if (this->selectionModel()->selectedIndexes().count() == 0)
269 QModelIndex index = this->selectionModel()->currentIndex();
275 std::map<std::string, DataHolderLib::Color> colorLookupTable =
278 listName.toStdString()))
280 std::vector<ModelTreeItem*> lists =
282 std::size_t nLists = lists.size();
283 for (std::size_t i = 0; i < nLists; i++)
285 if (listName.compare(lists[i]->data(0).toString()) != 0)
290 std::vector<GeoLib::Point*>
const& stations =
293 for (
auto station : stations)
298 stratView->setAttribute(Qt::WA_DeleteOnClose);
300 stratView->stationView->saveAsImage(
301 QString::fromStdString(
A BaseItem contains additional Information about a subtree in the StationTreeModel.
const std::vector< GeoLib::Point * > * getStations()
static void writeBoreholesToGMS(const std::vector< GeoLib::Point * > *stations, const std::string &filename)
A borehole as a geometric object.
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.
A TreeItem containing some additional information used in the StationModel.
static void box(const QString &e)
A model for the StationTreeView implementing a tree as a double-linked list.
vtkPolyDataAlgorithm * vtkSource(const std::string &name) const
void updateView()
Update the view to visualise changes made to the underlying data.
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 requestNameChangeDialog(const std::string &, std::size_t)
void openStationListFile(int)
void showDiagramPrefsDialog()
void stationListExportRequested(std::string listName, std::string fileName)
void geometryMappingRequested(const std::string &)
void geoItemSelected(const vtkPolyDataAlgorithm *, int)
void diagramRequested(QModelIndex &)
void enableRemoveButton(bool)
void contextMenuEvent(QContextMenuEvent *e) override
Actions to be taken after a right mouse click is performed in the station view.
void setNameForElement()
Calls a SetNameDialog.
void displayStratigraphy()
void stationListSaved(QString listName, QString fileName)
void removeGeoItemSelection()
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Instructions if the selection of items in the view has changed.
StationTreeView(QWidget *parent=nullptr)
Constructor.
void enableSaveButton(bool)
void writeStratigraphiesAsImages(QString listName)
Create image files from all stratigraphies in a borehole vector.
void stationListRemoved(std::string name)
Creates a window to visualise the stratigraphy of a borehole.
Objects nodes for the TreeModel.
TreeItem * parentItem() const
virtual QVariant data(int column) const
A hierarchical model for a tree implemented as a double-linked list.
VTK source object for the visualisation of station data (including boreholes)
const std::map< std::string, DataHolderLib::Color > & getColorLookupTable() const