39 setAlternatingRowColors(
true);
40 setColumnWidth(0, 150);
41 setColumnWidth(1, 75);
42 setColumnWidth(2, 75);
43 setColumnWidth(3, 75);
47 const QItemSelection& deselected)
50 if (!selected.isEmpty())
52 const QModelIndex idx = *(selected.indexes().begin());
54 static_cast<TreeModel*
>(this->model())->getItem(idx);
56 const auto* list_item =
58 if (list_item->getItem())
80 const QItemSelection& selected,
const QItemSelection& deselected)
82 QItemSelectionModel* selModel = this->selectionModel();
84 selModel->blockSignals(
true);
85 selModel->select(deselected, QItemSelectionModel::Deselect);
86 selModel->select(selected, QItemSelectionModel::Select);
87 selModel->blockSignals(
false);
89 return QTreeView::selectionChanged(selected, deselected);
94 QModelIndex index = this->selectionModel()->currentIndex();
95 auto* item =
static_cast<ModelTreeItem*
>(index.internalPointer());
104 if (item->childCount() > 0)
107 QAction* mapAction = menu.addAction(
"Map stations...");
108 QAction* exportAction = menu.addAction(
"Export to GMS...");
111 connect(mapAction, SIGNAL(triggered()),
this, SLOT(
mapStations()));
112 connect(exportAction, SIGNAL(triggered()),
this, SLOT(
exportList()));
113 menu.exec(event->globalPos());
121 QAction* setNameAction = menu.addAction(
"Set name...");
122 connect(setNameAction, SIGNAL(triggered()),
this,
128 QAction* stratAction = menu.addAction(
"Display Stratigraphy...");
129 QAction* exportAction = menu.addAction(
"Export to GMS...");
130 connect(stratAction, SIGNAL(triggered()),
this,
132 connect(exportAction, SIGNAL(triggered()),
this,
134 menu.exec(event->globalPos());
138 QAction* showDiagramAction = menu.addAction(
"View Diagram...");
139 connect(showDiagramAction, SIGNAL(triggered()),
this,
141 menu.exec(event->globalPos());
150 this->selectionModel()->currentIndex());
151 std::string
const stn_vec_name =
160 this->selectionModel()->currentIndex());
161 std::string
const& geo_name(item->
data(0).toString().toStdString());
167 QModelIndex index = this->selectionModel()->currentIndex();
172 this->selectionModel()->currentIndex(), temp_name);
174 std::map<std::string, DataHolderLib::Color> colorLookupTable =
177 temp_name.toStdString()))
184 stratView->setAttribute(
185 Qt::WA_DeleteOnClose);
196 QModelIndex index(this->selectionModel()->currentIndex());
197 if (!index.isValid())
205 QString listName = item->
data(0).toString();
206 QString fileName = QFileDialog::getSaveFileName(
207 this,
"Save station list",
209 if (!fileName.isEmpty())
225 this->selectionModel()->currentIndex());
226 QString listName = item->
data(0).toString();
227 QString fileName = QFileDialog::getSaveFileName(
228 this,
"Export Boreholes to GMS-Format",
230 if (!fileName.isEmpty())
234 fileName.toStdString());
240 QModelIndex index = this->selectionModel()->currentIndex();
242 QFileDialog::getSaveFileName(
this,
"Export Borehole to GMS-Format",
244 if (!fileName.isEmpty())
247 std::vector<GeoLib::Point*> stations;
252 fileName.toStdString());
259 QModelIndex index(this->selectionModel()->currentIndex());
260 if (!index.isValid())
270 if (this->selectionModel()->selectedIndexes().count() == 0)
280 QModelIndex index = this->selectionModel()->currentIndex();
286 std::map<std::string, DataHolderLib::Color> colorLookupTable =
289 listName.toStdString()))
291 std::vector<ModelTreeItem*> lists =
293 std::size_t nLists = lists.size();
294 for (std::size_t i = 0; i < nLists; i++)
296 if (listName.compare(lists[i]->data(0).toString()) != 0)
301 std::vector<GeoLib::Point*>
const& stations =
302 *
dynamic_cast<BaseItem*
>(lists[i]->getItem())->getStations();
304 for (
auto station : stations)
309 stratView->setAttribute(Qt::WA_DeleteOnClose);
311 stratView->stationView->saveAsImage(
312 QString::fromStdString(
Definition of the DiagramPrefsDialog class.
Definition of the GMSInterface class.
Definition of the ImportFileTypes enumeration.
Manages the last directory used for saving a file.
Definition of the ModelTreeItem class.
Definition of the OGSError class.
Definition of the StationTreeModel class.
Definition of the StationTreeView class.
Definition of the Station class.
Definition of the StratWindow class.
A BaseItem contains additional Information about a subtree in the StationTreeModel.
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.
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