diff --git a/Applications/DataExplorer/DataView/GEOModels.cpp b/Applications/DataExplorer/DataView/GEOModels.cpp index 952f62457638cb69cc8315f27e9f66adb6494105..c0753f3087662f8a33ce60d65b68dcb8857ce8a4 100644 --- a/Applications/DataExplorer/DataView/GEOModels.cpp +++ b/Applications/DataExplorer/DataView/GEOModels.cpp @@ -39,18 +39,26 @@ GEOModels::~GEOModels() void GEOModels::updateGeometry(const std::string& geo_name) { - GeoLib::PointVec* points(_geo_objects.getPointVecObj(geo_name)); - GeoLib::PolylineVec* lines(_geo_objects.getPolylineVecObj(geo_name)); - GeoLib::SurfaceVec* surfaces(_geo_objects.getSurfaceVecObj(geo_name)); + if (auto const stations = _geo_objects.getStationVec(geo_name); + stations != nullptr) + { + emit stationVectorRemoved(_stationModel, geo_name); + _stationModel->removeStationList(geo_name); + _stationModel->addStationList(QString::fromStdString(geo_name), stations); + emit stationVectorAdded(_stationModel, geo_name); + return; + } - if (points) + if (auto const points = _geo_objects.getPointVecObj(geo_name); + points != nullptr) { emit geoDataRemoved(_geoModel, geo_name, GeoLib::GEOTYPE::POINT); this->_geoModel->removeGeoList(geo_name, GeoLib::GEOTYPE::POINT); _geoModel->addPointList(QString::fromStdString(geo_name), *points); emit geoDataAdded(_geoModel, geo_name, GeoLib::GEOTYPE::POINT); - if (lines) + if (auto const lines = _geo_objects.getPolylineVecObj(geo_name); + lines != nullptr) { emit geoDataRemoved(_geoModel, geo_name, GeoLib::GEOTYPE::POLYLINE); this->_geoModel->removeGeoList(geo_name, GeoLib::GEOTYPE::POLYLINE); @@ -59,7 +67,8 @@ void GEOModels::updateGeometry(const std::string& geo_name) emit geoDataAdded(_geoModel, geo_name, GeoLib::GEOTYPE::POLYLINE); } - if (surfaces) + if (auto const surfaces = _geo_objects.getSurfaceVecObj(geo_name); + surfaces != nullptr) { emit geoDataRemoved(_geoModel, geo_name, GeoLib::GEOTYPE::SURFACE); this->_geoModel->removeGeoList(geo_name, GeoLib::GEOTYPE::SURFACE); diff --git a/Applications/DataExplorer/DataView/StationTreeView.cpp b/Applications/DataExplorer/DataView/StationTreeView.cpp index 3949001ffdf830e3eeb83b1f7d6036a1ba5c0853..67751b585cf2edbd3c8099a303d82b15eb6c4e6d 100644 --- a/Applications/DataExplorer/DataView/StationTreeView.cpp +++ b/Applications/DataExplorer/DataView/StationTreeView.cpp @@ -104,9 +104,11 @@ void StationTreeView::contextMenuEvent(QContextMenuEvent* event) if (item->childCount() > 0) { QMenu menu; + QAction* mapAction = menu.addAction("Map stations..."); QAction* exportAction = menu.addAction("Export to GMS..."); menu.addSeparator(); + connect(mapAction, SIGNAL(triggered()), this, SLOT(mapStations())); connect(exportAction, SIGNAL(triggered()), this, SLOT(exportList())); menu.exec(event->globalPos()); } @@ -151,6 +153,15 @@ void StationTreeView::setNameForElement() emit requestNameChangeDialog(stn_vec_name, item->row()); } +void StationTreeView::mapStations() +{ + TreeItem const* const item = + static_cast<StationTreeModel*>(model())->getItem( + this->selectionModel()->currentIndex()); + std::string const& geo_name(item->data(0).toString().toStdString()); + emit geometryMappingRequested(geo_name); +} + void StationTreeView::displayStratigraphy() { QModelIndex index = this->selectionModel()->currentIndex(); diff --git a/Applications/DataExplorer/DataView/StationTreeView.h b/Applications/DataExplorer/DataView/StationTreeView.h index 154d74678debc8071b9590d54211cc0e381d41b7..f9ea977edc600270be56e07f0a4d432cf077bfc8 100644 --- a/Applications/DataExplorer/DataView/StationTreeView.h +++ b/Applications/DataExplorer/DataView/StationTreeView.h @@ -59,6 +59,7 @@ private slots: void displayStratigraphy(); void exportList(); void exportStation(); + void mapStations(); void removeStationList(); /// Calls a SetNameDialog. void setNameForElement(); @@ -69,6 +70,7 @@ signals: void enableSaveButton(bool); void enableRemoveButton(bool); void geoItemSelected(const vtkPolyDataAlgorithm*, int); + void geometryMappingRequested(const std::string&); void removeGeoItemSelection(); void itemSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index f5d42b5196f3f7236d4a79f27e5d3d4db7bb7a92..6c148d1dd0298130e25c657c28b148e87c6cf49c 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -141,6 +141,9 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) : QMainWindow(parent) connect(stationTabWidget->treeView, SIGNAL(requestNameChangeDialog(const std::string&, std::size_t)), this, SLOT(showStationNameDialog(const std::string&, std::size_t))); + connect(stationTabWidget->treeView, + SIGNAL(geometryMappingRequested(const std::string&)), this, + SLOT(mapGeometry(const std::string&))); connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)), this, SLOT(showDiagramPrefsDialog( diff --git a/MeshGeoToolsLib/GeoMapper.cpp b/MeshGeoToolsLib/GeoMapper.cpp index 1cef01614cfa2b9f175b7a96e1bda88f4e65ce92..1785814235579f30e3d767ade724fb5ba9b9ddc7 100644 --- a/MeshGeoToolsLib/GeoMapper.cpp +++ b/MeshGeoToolsLib/GeoMapper.cpp @@ -156,6 +156,7 @@ void GeoMapper::mapStationData(std::vector<GeoLib::Point*> const& points) if (!GeoLib::isBorehole(pnt)) { + (*pnt)[2] = offset; continue; } auto const& layers =