21#include <QDesktopWidget>
27#include <QSignalMapper>
29#include <QElapsedTimer>
33#include <vtkImageAlgorithm.h>
34#include <vtkImageData.h>
35#include <vtkOBJExporter.h>
36#include <vtkRenderer.h>
37#include <vtkVRMLExporter.h>
114 geoTabWidget->treeView->setModel(
_geo_model->getGeoModel());
115 stationTabWidget->treeView->setModel(
_geo_model->getStationModel());
116 meshTabWidget->treeView->setModel(
_meshModel.get());
123 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
126 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(
int)),
this,
128 connect(stationTabWidget->treeView,
129 SIGNAL(stationListExportRequested(std::string, std::string)),
this,
131 std::string, std::string)));
132 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
134 SLOT(removeStationVec(
136 connect(stationTabWidget->treeView,
137 SIGNAL(stationListSaved(QString, QString)),
this,
144 connect(stationTabWidget->treeView,
145 SIGNAL(requestNameChangeDialog(
const std::string&, std::size_t)),
147 connect(stationTabWidget->treeView,
148 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
150 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
156 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(
int)),
this,
158 connect(geoTabWidget->treeView,
161 connect(geoTabWidget->treeView,
162 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
165 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
168 connect(geoTabWidget->treeView,
169 SIGNAL(requestPointToStationConversion(std::string
const&)),
this,
172 geoTabWidget->treeView,
173 SIGNAL(requestLineEditDialog(
const std::string&)),
this,
175 connect(geoTabWidget->treeView,
176 SIGNAL(requestNameChangeDialog(
const std::string&,
187 connect(geoTabWidget->treeView,
188 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
190 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
191 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
193 connect(stationTabWidget->treeView,
194 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
196 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
197 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
201 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(
int)),
this,
203 connect(meshTabWidget->treeView,
204 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_meshModel.get(),
205 SLOT(removeMesh(
const QModelIndex&)));
206 connect(meshTabWidget->treeView,
207 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_elementModel.get(),
210 meshTabWidget->treeView,
214 connect(meshTabWidget->treeView,
215 SIGNAL(requestMeshToGeometryConversion(
const MeshLib::Mesh*)),
this,
217 connect(meshTabWidget->treeView,
218 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
221 SLOT(highlightMeshComponent(
222 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
223 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
225 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
226 meshTabWidget->elementView, SLOT(updateView()));
228 meshTabWidget->treeView,
229 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
232 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
unsigned)));
233 connect(meshTabWidget->treeView,
234 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
236 meshTabWidget->elementView, SLOT(updateView()));
237 connect(meshTabWidget->treeView,
238 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
240 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
241 SLOT(removeHighlightActor()));
242 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
244 connect(meshTabWidget->elementView,
245 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
247 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
248 SLOT(removeHighlightActor()));
249 connect(meshTabWidget->elementView,
250 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
253 SLOT(highlightMeshComponent(
254 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
255 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
259 connect(modellingTabWidget->treeView,
260 SIGNAL(processVarRemoved(QString
const&)),
_processModel.get(),
261 SLOT(removeProcessVariable(QString
const&)));
262 connect(modellingTabWidget->treeView,
263 SIGNAL(conditionRemoved(QString
const&, QString
const&)),
265 SLOT(removeCondition(QString
const&, QString
const&)));
266 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
268 connect(modellingTabWidget->treeView,
272 connect(modellingTabWidget->treeView,
276 connect(modellingTabWidget->treeView,
278 modellingTabWidget->conditionView, SLOT(updateView()));
279 connect(modellingTabWidget->treeView,
281 modellingTabWidget->conditionView, SLOT(updateView()));
305 SLOT(addPipelineItem(
MeshModel*, QModelIndex)));
308 SLOT(removeSourceItem(
MeshModel*, QModelIndex)));
311 visualizationWidget->vtkWidget, SLOT(update()));
313 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
314 connect(
_vtkVisPipeline.get(), SIGNAL(itemSelected(
const QModelIndex&)),
315 vtkVisTabWidget->vtkVisPipelineView,
316 SLOT(selectItem(
const QModelIndex&)));
319 connect(vtkVisTabWidget->vtkVisPipelineView,
320 SIGNAL(requestRemovePipelineItem(QModelIndex)),
322 connect(vtkVisTabWidget->vtkVisPipelineView,
323 SIGNAL(requestAddPipelineFilterItem(QModelIndex)),
this,
325 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
328 connect(vtkVisTabWidget->vtkVisPipelineView,
329 SIGNAL(actorSelected(vtkProp3D*)),
330 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
331 SLOT(highlightActor(vtkProp3D*)));
333 visualizationWidget, SLOT(updateView()));
336 connect(vtkVisTabWidget->vtkVisPipelineView,
337 SIGNAL(dataObjectSelected(vtkDataObject*)),
338 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
339 SLOT(pickableDataObject(vtkDataObject*)));
340 connect(
reinterpret_cast<QObject*
>(visualizationWidget->vtkPickCallback()),
341 SIGNAL(actorPicked(vtkProp3D*)),
342 vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
343 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
344 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
347 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
349 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
350 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
352 meshTabWidget->elementView, SLOT(updateView()));
353 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
356 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
357 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
360 SLOT(removeHighlightedMeshComponent()));
362 connect(vtkVisTabWidget->vtkVisPipelineView,
367 tabifyDockWidget(geoDock, mshDock);
368 tabifyDockWidget(mshDock, modellingDock);
369 tabifyDockWidget(modellingDock, stationDock);
375 _vtkWidget.reset(visualizationWidget->vtkWidget);
376 for (
auto const& screen : QGuiApplication::screens())
383 menu_File->insertMenu(action_Exit, import_files_menu);
388 connect(
this, SIGNAL(
fileUsed(QString)), recentFiles,
389 SLOT(setCurrentFile(QString)));
390 menu_File->insertMenu(action_Exit, recentFiles->
menu());
393 QAction* showGeoDockAction = geoDock->toggleViewAction();
394 showGeoDockAction->setStatusTip(tr(
"Shows / hides the geometry view"));
395 connect(showGeoDockAction, SIGNAL(triggered(
bool)),
this,
397 menuWindows->addAction(showGeoDockAction);
399 QAction* showStationDockAction = stationDock->toggleViewAction();
400 showStationDockAction->setStatusTip(tr(
"Shows / hides the station view"));
401 connect(showStationDockAction, SIGNAL(triggered(
bool)),
this,
403 menuWindows->addAction(showStationDockAction);
405 QAction* showMshDockAction = mshDock->toggleViewAction();
406 showMshDockAction->setStatusTip(tr(
"Shows / hides the mesh view"));
407 connect(showMshDockAction, SIGNAL(triggered(
bool)),
this,
409 menuWindows->addAction(showMshDockAction);
411 QAction* showModellingDockAction = modellingDock->toggleViewAction();
412 showModellingDockAction->setStatusTip(tr(
"Shows / hides the Process view"));
413 connect(showModellingDockAction, SIGNAL(triggered(
bool)),
this,
415 menuWindows->addAction(showModellingDockAction);
417 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
418 showVisDockAction->setStatusTip(tr(
"Shows / hides the VTK Pipeline view"));
419 connect(showVisDockAction, SIGNAL(triggered(
bool)),
this,
421 menuWindows->addAction(showVisDockAction);
424 auto* presentationMenu =
new QMenu(
this);
425 presentationMenu->setTitle(
"Presentation on");
426 connect(presentationMenu, SIGNAL(aboutToShow()),
this,
428 menuWindows->insertMenu(showVisDockAction, presentationMenu);
431 *visualizationWidget);
437 QWidget::closeEvent(event);
480 modellingDock->show();
484 modellingDock->hide();
504 QString type_str = QString::fromStdString(
506 QString fileName = QFileDialog::getOpenFileName(
507 this,
"Select " + type_str +
" file to import",
508 settings.value(
"lastOpenedFileDirectory").toString(),
510 if (!fileName.isEmpty())
513 QDir dir = QDir(fileName);
514 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
520 auto* action = qobject_cast<QAction*>(sender());
529 QString fileName = QFileDialog::getSaveFileName(
533 "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
535 if (fileName.isEmpty())
541 QFileInfo fi(fileName);
544 if (fi.suffix().toLower() ==
"prj")
548 fileName.toStdString());
550 else if (fi.suffix().toLower() ==
"geo")
552 auto const selected_geometries =
556 const double point_density = 0;
557 const double station_density = point_density;
558 const int max_pnts_per_leaf = 0;
563 station_density, max_pnts_per_leaf, selected_geometries,
false,
570 OGSError::box(
" No geometry available\n to write to geo-file");
577 QFile file(fileName);
580 QMessageBox::warning(
this, tr(
"Application"),
581 tr(
"Cannot read file %1:\n%2.")
583 .arg(file.errorString()));
587 QApplication::setOverrideCursor(Qt::WaitCursor);
588 QFileInfo fi(fileName);
590 QDir dir = QDir(fileName);
592 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
597 if (fi.suffix().toLower() ==
"gli")
599 std::string unique_name;
600 std::vector<std::string> errors;
601 std::string
const gmsh_path =
602 settings.value(
"DataExplorerGmshPath").toString().toStdString();
605 unique_name, errors, gmsh_path))
607 for (
auto& error : errors)
613 else if (fi.suffix().toLower() ==
"prj")
624 "Failed to load project file.\n Please see console for "
628 else if (fi.suffix().toLower() ==
"gml")
636 "Failed to load geometry.\n Please see console for "
640 catch (std::runtime_error
const& err)
643 "Failed to read file `" + fileName +
"'");
647 else if (fi.suffix().toLower() ==
"stn")
653 "Failed to load station data.\n Please see console for "
658 else if (fi.suffix().toLower() ==
"msh" ||
659 fi.suffix().toLower() ==
"vtu" ||
660 fi.suffix().toLower() ==
"vtk")
663 QElapsedTimer myTimer;
666 std::unique_ptr<MeshLib::Mesh> mesh(
669 INFO(
"Mesh loading time: {:d} ms.", myTimer.restart());
680 INFO(
"Mesh model setup time: {:d} ms.", myTimer.elapsed());
684 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
689 if (fi.suffix().toLower() ==
"fem")
692 std::unique_ptr<MeshLib::Mesh> mesh(
706 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
710 if (fi.suffix().toLower() ==
"txt")
712 std::vector<GeoLib::Point*> boreholes;
713 std::string name = fi.baseName().toStdString();
716 fileName.toStdString()))
726 else if (fi.suffix().toLower() ==
"2dm" ||
727 fi.suffix().toLower() ==
"3dm")
729 std::string name = fileName.toStdString();
740 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
744 std::string msh_name(fileName.toStdString());
747 std::unique_ptr<MeshLib::Mesh> mesh(
758 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
762 std::string file_name(fileName.toStdString());
763 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
766 for (
auto& mesh : meshes)
778 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
787 std::unique_ptr<MeshLib::Mesh> mesh(dlg.
getMesh());
794 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
809 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
816 double* origin = img->GetOutput()->GetOrigin();
818 img->GetOutput()->GetSpacing()[0]);
821 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
827 settings.value(
"DataExplorerGmshPath").toString().toStdString());
829 QDir dir = QDir(fileName);
830 settings.setValue(
"lastOpenedShapeFileDirectory", dir.absolutePath());
834 if (fi.suffix().toLower().compare(
"poly") == 0 ||
835 fi.suffix().toLower().compare(
"smesh") == 0)
843 settings.setValue(
"lastOpenedTetgenFileDirectory",
844 QFileInfo(fileName).absolutePath());
845 QString element_fname(fi.path() +
"/" + fi.completeBaseName() +
848 if (!fileName.isEmpty())
852 fileName.toStdString(), element_fname.toStdString()));
867 settings.setValue(
"lastOpenedVtkFileDirectory", dir.absolutePath());
870 QApplication::restoreOverrideCursor();
876 visualizationWidget->updateViewOnLoad();
877 geoTabWidget->treeView->updateView();
878 stationTabWidget->treeView->updateView();
879 meshTabWidget->treeView->updateView();
886 restoreGeometry(settings.value(
"windowGeometry").toByteArray());
887 restoreState(settings.value(
"windowState").toByteArray());
894 settings.setValue(
"windowGeometry", saveGeometry());
895 settings.setValue(
"windowState", saveState());
907 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
910 QString(
"Version: %1<br />")
914 QString(
"Git commit: <a "
915 "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
916 .arg(QString::fromStdString(
918 about.append(QString(
"Built date: %1<br />")
919 .arg(QDate::currentDate().toString(Qt::ISODate)));
921 QMessageBox::about(
this,
"About OpenGeoSys 6",
about);
926 QMenu* importFiles =
new QMenu(
"&Import Files",
this);
927 importFiles->addAction(
"&FEFLOW Files...",
929 importFiles->addAction(
"SMS/G&MS Files...",
931 importFiles->addAction(
"&GMSH Files...",
933 importFiles->addAction(
"&Gocad TSurface...",
936 importFiles->addAction(
"&NetCDF Files...",
939 importFiles->addAction(
"&Petrel Files...", [
this] {
loadPetrelFiles(); });
940 importFiles->addAction(
"&Raster Files...",
942 importFiles->addAction(
"&Shape Files...",
944 importFiles->addAction(
"&TetGen Files...",
946 importFiles->addAction(
"&VTK Files...",
954 QStringList sfc_file_names = QFileDialog::getOpenFileNames(
955 this,
"Select surface data file(s) to import",
"",
"Petrel files (*)");
956 QStringList well_path_file_names = QFileDialog::getOpenFileNames(
957 this,
"Select well path data file(s) to import",
"",
959 if (!sfc_file_names.empty() || !well_path_file_names.empty())
961 QStringList::const_iterator it = sfc_file_names.begin();
962 std::list<std::string> sfc_files;
963 while (it != sfc_file_names.end())
965 sfc_files.push_back((*it).toStdString());
969 it = well_path_file_names.begin();
970 std::list<std::string> well_path_files;
971 while (it != well_path_file_names.end())
973 well_path_files.push_back((*it).toStdString());
977 std::string unique_str(*(sfc_files.begin()));
982 QDir dir = QDir(sfc_file_names.at(0));
983 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
996 QFileInfo fi(fileName);
997 if (fi.suffix().toLower() ==
"gli")
1019 if (dlg.exec() != QDialog::Accepted)
1026 QString file_name(
"");
1029 QString file_type[2] = {
"OpenGeoSys mesh files (*.vtu *.msh)",
1030 "Raster files(*.asc *.grd *.xyz)"};
1032 file_name = QFileDialog::getOpenFileName(
1034 "Select file for mapping",
1035 settings.value(
"lastOpenedFileDirectory").toString(),
1037 if (file_name.isEmpty())
1041 QDir dir = QDir(file_name);
1042 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1046 QFileInfo fi(file_name);
1049 if (fi.suffix().toLower() ==
"asc" || fi.suffix().toLower() ==
"grd")
1051 std::unique_ptr<GeoLib::Raster> raster(
1053 file_name.toStdString()));
1056 geo_mapper.
mapOnDEM(std::move(raster));
1066 OGSError::box(
"The selected file is no supported raster file.");
1074 if (fi.suffix().toLower() ==
"vtu" || fi.suffix().toLower() ==
"vtk" ||
1075 fi.suffix().toLower() ==
"msh")
1081 OGSError::box(
"The selected file is no supported mesh file.");
1092 if (new_geo_name.empty())
1119 std::string fileName)
1121 const std::vector<GeoLib::Point*>* stations(
1127 unsigned param1,
double param2,
double param3,
1128 double param4,
bool delete_geo_file)
1130 if (!selectedGeometries.empty())
1132 INFO(
"Start meshing ...");
1134 QString fileName(
"");
1137 if (!delete_geo_file)
1139 fileName = QFileDialog::getSaveFileName(
1140 this,
"Save GMSH-file as",
1142 "GMSH geometry files (*.geo)");
1146 fileName =
"tmp_gmsh.geo";
1149 if (!fileName.isEmpty())
1158 param2, param3, param1, selectedGeometries,
false,
1161 fileName.toStdString());
1168 param4, param3, param1, selectedGeometries,
false,
1171 fileName.toStdString());
1174 if (system(
nullptr) != 0)
1177 std::string gmsh_path =
1178 settings.value(
"DataExplorerGmshPath")
1182 if (!gmsh_path.empty())
1184 std::string fname(fileName.toStdString());
1185 std::string gmsh_command =
1186 "\"" + gmsh_path +
"\" -2 -algo meshadapt " + fname;
1187 std::size_t pos(fname.rfind(
"."));
1188 if (pos != std::string::npos)
1190 fname = fname.substr(0, pos);
1192 gmsh_command +=
" -o " + fname +
".msh";
1197 gmsh_command +=
" -format msh22";
1198 auto const return_value =
1199 std::system(gmsh_command.c_str());
1200 if (return_value != 0)
1202 QString
const message =
1203 "Execution of gmsh command returned non-zero "
1205 QString::number(return_value);
1211 fileName.left(fileName.length() - 3)
1224 "Error executing command gmsh - no command processor "
1229 catch (std::runtime_error& error)
1232 QString(
"\n Please cleanup the input data."),
1235 if (delete_geo_file)
1242 INFO(
"No geometry information selected.");
1243 QApplication::restoreOverrideCursor();
1250 settings.value(
"DataExplorerGmshPath").toString().toStdString(),
this);
1251 dlg->setAttribute(Qt::WA_DeleteOnClose);
1260 _geo_model->getStationModel()->stationFromIndex(index, listName);
1264 OGSError::box(
"No time series data available for borehole.");
1269 prefs->setAttribute(Qt::WA_DeleteOnClose);
1277 QString fileName = QFileDialog::getOpenFileName(
1278 this,
"Select data file to open",
1279 settings.value(
"lastOpenedFileDirectory").toString(),
1280 "Text files (*.txt);;All files (* *.*)");
1281 if (!fileName.isEmpty())
1283 QDir dir = QDir(fileName);
1284 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1286 prefs->setAttribute(Qt::WA_DeleteOnClose);
1296 geometry_name, object_type,
id);
1299 if (dlg.exec() != QDialog::Accepted)
1304 _geo_model->addNameForElement(geometry_name, object_type,
id,
1306 static_cast<GeoTreeModel*
>(this->geoTabWidget->treeView->model())
1307 ->setNameForItem(geometry_name, object_type,
id,
1309 geometry_name, object_type,
id));
1315 std::vector<GeoLib::Point*>
const* stations =
1319 if (dlg.exec() != QDialog::Accepted)
1326 ->setNameForItem(stn_vec_name,
id, stn->getName());
1380 std::string stn_name = geo_name +
" Stations";
1395 SIGNAL(connectPolylines(
const std::string&, std::vector<std::size_t>,
1396 double, std::string,
bool,
bool)),
1398 SLOT(connectPolylineSegments(
const std::string&,
1399 std::vector<std::size_t>,
double,
1400 std::string,
bool,
bool)));
1408 SIGNAL(requestMeshing(std::vector<std::string>&,
unsigned,
double,
1409 double,
double,
bool)),
1411 SLOT(
callGMSH(std::vector<std::string>&,
unsigned,
double,
double,
1419 if (dlg.exec() != QDialog::Accepted)
1427 OGSError::box(
"Points are missing for\n at least one geometry.");
1434 if (mshSource ==
nullptr)
1440 if (dlg.exec() != QDialog::Accepted)
1481 QString ext = QFileInfo(fileName).suffix();
1482 if (ext ==
"msh" || ext ==
"vtu" || ext ==
"gli" || ext ==
"gml")
1493 QString
const filename = QFileDialog::getSaveFileName(
1495 "Export object to vtk-files",
1496 settings.value(
"lastExportedFileDirectory").toString(),
1497 "VTK files (*.vtp *.vtu)");
1498 if (!filename.isEmpty())
1500 QDir
const dir = QDir(filename);
1501 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1503 std::string
const basename =
1504 QFileInfo(filename).path().toStdString() +
"/" +
1505 QFileInfo(filename).baseName().toStdString();
1510 std::string
const name = basename + std::to_string(++count) +
"-" +
1511 (*it)->data(0).toString().toStdString();
1522 QString fileName = QFileDialog::getSaveFileName(
1523 this,
"Save scene to VRML file",
1524 settings.value(
"lastExportedFileDirectory").toString(),
1525 "VRML files (*.wrl);;");
1526 if (!fileName.isEmpty())
1528 QDir dir = QDir(fileName);
1529 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1531 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1532 exporter->SetFileName(fileName.toStdString().c_str());
1533 exporter->SetRenderWindow(
1534 visualizationWidget->vtkWidget->renderWindow());
1544 QString fileName = QFileDialog::getSaveFileName(
1545 this,
"Save scene to Wavefront OBJ files",
1546 settings.value(
"lastExportedFileDirectory").toString(),
";;");
1547 if (!fileName.isEmpty())
1549 QDir dir = QDir(fileName);
1550 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1552 vtkOBJExporter* exporter = vtkOBJExporter::New();
1553 exporter->SetFilePrefix(fileName.toStdString().c_str());
1554 exporter->SetRenderWindow(
1555 visualizationWidget->vtkWidget->renderWindow());
1563 auto* menu =
static_cast<QMenu*
>(QObject::sender());
1567 QAction* action =
new QAction(
"Quit presentation mode", menu);
1568 connect(action, SIGNAL(triggered()),
this,
1570 action->setShortcutContext(Qt::WidgetShortcut);
1571 action->setShortcut(QKeySequence(Qt::Key_Escape));
1572 menu->addAction(action);
1577 const int currentScreen =
1578 QApplication::desktop()->screenNumber(visualizationWidget);
1581 Q_UNUSED(screenGeo);
1583 new QAction(QString(
"On screen %1").arg(count), menu);
1584 connect(action, SIGNAL(triggered()),
this,
1586 if (count == currentScreen)
1588 action->setEnabled(
false);
1590 menu->addAction(action);
1602 QString actionText =
static_cast<QAction*
>(QObject::sender())->text();
1603 int screen = actionText.split(
" ").back().toInt();
1615 QAction* action =
new QAction(
"Quit presentation mode",
this);
1617 action->setShortcutContext(Qt::WidgetShortcut);
1618 action->setShortcut(QKeySequence(Qt::Key_Escape));
1622 QMainWindow::centralWidget()->hide();
1628 QAction* action =
_vtkWidget->actions().back();
1633 visualizationWidget->layout()->addWidget(
_vtkWidget.get());
1635 QMainWindow::centralWidget()->show();
1644 QString fileName(
"");
1645 QStringList files = settings.value(
"recentFileList").toStringList();
1648 return QFileInfo(files[0]).absolutePath();
1651 return QDir::homePath();
Definition of the AsciiRasterInterface class.
Definition of the CreateStructuredGridDialog class.
Definition of the DataExplorerSettingsDialog class.
Definition of the DiagramPrefsDialog class.
Definition of the ElementQualityInterface class.
Definition of the Element class.
Definition of the GMSHPrefsDialog class.
Definition of the GMSInterface class.
Definition of the GeoMapper class.
Definition of the GeoOnMeshMappingDialog class.
Definition of the GeoTreeModel class.
Implementation of Histogram class.
Manages the last directory used for saving a file.
Definition of the Layers2GridDialog class.
Definition of the LicenseDialog class.
Definition of the LineEditDialog class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the MergeGeometriesDialog class.
Definition of the MeshAnalysisDialog class.
Definition of the MeshElementRemovalDialog class.
Definition of the MeshIO class.
Definition of the MshQualitySelectionDialog class.
Definition of the Mesh class.
Definition of the Node class.
Definition of the OGSError class.
Definition of OGSFileConverter class.
Definition of the OGSIOVer4 class.
Definition of the PetrelInterface class.
Definition of the GeoLib::Raster class.
Definition of the RecentFiles class.
Definition of the SHPImportDialog class.
Definition of the StationTreeModel class.
Definition of the TetGenInterface class.
Definition of the TranslateDataDialog class.
Definition of the TreeModelIterator class.
Definition of the VtkAddFilterDialog class.
Definition of the VtkBGImageSource class.
Definition of the VtkGeoImageSource class.
VtkMappedMeshSource is a source class to transform OGS meshes into complete vtkUnstructuredGrids....
Definition of the VtkRaster class.
Definition of the VtkVisPipelineItem class.
Definition of the Vtu2GridDialog class.
Definition of the XmlGmlInterface class.
Definition of the XmlStnInterface class.
std::string writeToString()
Writes the object to a string.
A dialog window for managing general Data Explorer settings.
A dialog window for managing general Data Explorer settings.
Base class for boundary conditions, initial conditions and source terms.
const std::vector< std::unique_ptr< MeshLib::Mesh > > & getMeshObjects() const
Returns all the meshes with their respective names.
GeoLib::GEOObjects & getGEOObjects()
Returns the GEOObjects containing all points, polylines and surfaces.
A dialog that allows for setting preferences for a requested diagram.
static GeoLib::Raster * getRasterFromASCFile(std::string const &fname)
Reads an ArcGis ASC raster file.
void readFEFLOWFile(const std::string &filename, GeoLib::GEOObjects &geo_objects)
MeshLib::Mesh * readFEFLOWFile(const std::string &filename)
Reads and writes GMSH-files to and from OGS data structures.
static int readBoreholesFromGMS(std::vector< GeoLib::Point * > &boreholes, const std::string &filename)
Imports borehole data from a file in GMS-format.
static MeshLib::Mesh * readMesh(const std::string &filename)
Reads a GMS *.3dm file and converts it to an CFEMesh.
static void writeBoreholesToGMS(const std::vector< GeoLib::Point * > *stations, const std::string &filename)
MeshLib::Mesh * readTetGenMesh(std::string const &nodes_fname, std::string const &ele_fname)
bool readTetGenGeometry(std::string const &geo_fname, GeoLib::GEOObjects &geo_objects)
int readFile(const QString &fileName) override
Reads an xml-file containing a project.
A dialog window for setting preferences for GMSH.
std::string const & getFinalizedOutputName() const
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
void addStationVec(std::vector< Point * > &&stations, std::string &name)
Adds a vector of stations with the given name and colour to GEOObjects.
const PolylineVec * getPolylineVecObj(const std::string &name) const
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
const std::vector< GeoLib::Point * > * getStationVec(const std::string &name) const
Returns the station vector with the given name.
std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
Reads and writes GeoObjects to and from XML files.
int readFile(const QString &fileName) override
Reads an xml-file containing geometric object definitions into the GEOObjects used in the constructor...
Reads and writes Observation Sites to and from XML files.
int readFile(const QString &fileName) override
Reads an xml-file containing station object definitions into the GEOObjects used in the constructor (...
A borehole as a geometric object.
A Station (observation site) is basically a Point with some additional information.
const SensorData * getSensorData() const
Returns all the sensor data for this observation site.
A dialog window for creating DIRECT boundary conditions from raster files.
int getDataSetChoice() const
std::string const & getNewGeoName() const
A model for the GeoTreeView implementing a tree as a double-linked list.
static std::string getFileSuffixString(ImportFileType::type t)
static std::string convertImportFileTypeToString(ImportFileType::type t)
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 dialog window displaying the OGS license information.
A dialog window for manipulation of polylines. Currently included functionality is the concatenation ...
void showConditionDockWidget(bool show)
void closeEvent(QCloseEvent *event) override
std::unique_ptr< MeshModel > _meshModel
void callGMSH(std::vector< std::string > &selectedGeometries, unsigned param1, double param2, double param3, double param4, bool delete_geo_file)
Function calls for generating GMSH files from the GUI.
void open(int file_type=0)
Function calls for opening files.
void FEMTestStart()
Testing functionality for connection to FEM lib.
QMenu * createImportFilesMenu()
void showGMSHPrefsDialog()
void quitPresentationMode()
void loadFile(ImportFileType::type t, const QString &fileName)
void on_actionExportObj_triggered(bool checked=false)
void showFileConverter()
Calls the OGSFileConverter as an external tool.
std::unique_ptr< ElementTreeModel > _elementModel
void showStationNameDialog(const std::string &stn_vec_name, std::size_t id)
Allows setting the name for a station.
void save()
Function calls for saving files.
void writeStationListToFile(QString listName, QString fileName)
void loadFileOnStartUp(const QString &fileName)
void showGeoDockWidget(bool show)
void showLayers2GridDialog()
void showGeoNameDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id)
Allows setting the name for a geometric object.
void showLineEditDialog(const std::string &geoName)
void showStationDockWidget(bool show)
std::unique_ptr< VisPrefsDialog > _visPrefsDialog
void convertMeshToGeometry(const MeshLib::Mesh *mesh)
void showDiagramPrefsDialog()
Calls the diagram prefs dialog from the Tools menu.
void showMshDockWidget(bool show)
void showMeshAnalysisDialog()
void showAddPipelineFilterItemDialog(QModelIndex parentIndex)
void showCreateStructuredGridDialog()
Creates a structured grid with user-specified parameters.
void showMergeGeometriesDialog()
void showVisDockWidget(bool show)
void showMeshElementRemovalDialog()
Removal of mesh elements based on a number of criteria.
std::unique_ptr< ProcessModel > _processModel
void showTranslateDataDialog()
void on_actionExportVRML2_triggered(bool checked=false)
void createPresentationMenu()
DataHolderLib::Project _project
void writeGeometryToFile(QString gliName, QString fileName)
MainWindow(QWidget *parent=nullptr)
std::unique_ptr< GEOModels > _geo_model
void startPresentationMode()
std::unique_ptr< VtkVisPipeline > _vtkVisPipeline
void on_actionExportVTK_triggered(bool checked=false)
void showVisalizationPrefsDialog()
std::unique_ptr< QWidget > _vtkWidget
void showVtu2GridDialog()
void mapGeometry(const std::string &geo_name)
void showMeshQualitySelectionDialog(MeshLib::VtkMappedMeshSource *mshSource)
QList< QRect > _screenGeometries
void fileUsed(QString filename)
std::unique_ptr< FemConditionModel > _conditionModel
void showDataExplorerSettingsDialog()
void convertPointsToStations(std::string const &geo_name)
void exportBoreholesToGMS(std::string listName, std::string fileName)
Function calls for GMS export.
A dialog window for setting preferences for GMSH.
std::string getGeometryName() const
Returns the name of the new merged geometry.
std::vector< std::string > getSelectedGeometries() const
Returns a vector of selected geometries.
A dialog window for calling mesh analysis methods.
A dialog window for settung up a database connection.
const MeshLib::Mesh * GetMesh() const
Returns the mesh.
A dialog for selecting a mesh quality metric.
std::string getHistogramPath() const
Returns selected path for histogram (or empty string if no histogram is required)
bool getHistogram() const
Returns true if a histogram needs to be calculated.
MeshLib::MeshQualityType getSelectedMetric() const
Returns selected metric.
static void box(const QString &e)
QMenu * menu()
Returns the created menu. Add this menu to your QMainWindow menu.
Dialog for selecting which information should be loaded from a shape file.
A model for the StationTreeView implementing a tree as a double-linked list.
A dialog window for calling translation methods.
TreeModelIterator provides a way to iterate over TreeItems in a TreeModel. Usage:
Dialog for selecting a filter to be applied to a VtkPipelineItem. The dialog lets you select filters ...
void SetName(QString name)
Sets the name.
Uses an image source to create a plane in the 3D with the given image texture mapped on it.
void SetRaster(vtkImageAlgorithm *img, double x0, double y0, double scalingFactor)
Sets the raster/image to be used as a texture map.
static VtkBGImageSource * New()
Create new objects with New() because of VTKs object reference counting.
The VtkVisPipeline source object of a geo-referenced image (file).
static VtkGeoImageSource * New()
Create new objects with New() because of VTKs reference counting.
bool readImage(const QString &filename)
Reads an image from file.
static vtkImageAlgorithm * loadImage(const std::string &fileName)
Loads an image- or raster-file into an vtkImageAlgorithm-Object.
An item in the VtkVisPipeline containing a graphic object to be visualized.
int writeToFile(const std::string &filename) const
Writes this algorithm's vtkDataSet (i.e. vtkPolyData or vtkUnstructuredGrid) to a vtk-file.
Definition of mesh to geometry conversion.
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)
void removeFile(std::string const &filename)
@ AdaptiveMeshDensity
computing the mesh density employing a QuadTree
@ FixedMeshDensity
set the parameter with a fixed value
bool isGMSHMeshFile(const std::string &fname)
MeshLib::Mesh * readGMSHMesh(std::string const &fname)
bool readFile(std::string const &file_name, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes, DataType const export_type)
Reads the specified file and writes data into internal mesh vector.
bool readGLIFileV4(const std::string &fname, GeoLib::GEOObjects &geo, std::string &unique_name, std::vector< std::string > &errors, std::string const &gmsh_path)
void writeAllDataToGLIFileV4(const std::string &fname, const GeoLib::GEOObjects &geo)
std::string convertGeoTypeToString(GEOTYPE geo_type)
int geoPointsToStations(GEOObjects &geo_objects, std::string const &geo_name, std::string &stn_name, bool const only_unused_pnts)
Constructs a station-vector based on the points of a given geometry.
GITINFOLIB_EXPORT const std::string git_version_sha1_short
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
MeshQualityType
Describes a mesh quality metric.
Definition of readMeshFromFile function.