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>
115 geoTabWidget->treeView->setModel(
_geo_model->getGeoModel());
116 stationTabWidget->treeView->setModel(
_geo_model->getStationModel());
117 meshTabWidget->treeView->setModel(
_meshModel.get());
124 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
127 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(
int)),
this,
129 connect(stationTabWidget->treeView,
130 SIGNAL(stationListExportRequested(std::string, std::string)),
this,
132 std::string, std::string)));
133 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
135 SLOT(removeStationVec(
137 connect(stationTabWidget->treeView,
138 SIGNAL(stationListSaved(QString, QString)),
this,
145 connect(stationTabWidget->treeView,
146 SIGNAL(requestNameChangeDialog(
const std::string&, std::size_t)),
148 connect(stationTabWidget->treeView,
149 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
151 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
157 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(
int)),
this,
159 connect(geoTabWidget->treeView,
162 connect(geoTabWidget->treeView,
163 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
166 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
169 connect(geoTabWidget->treeView,
170 SIGNAL(requestPointToStationConversion(std::string
const&)),
this,
173 geoTabWidget->treeView,
174 SIGNAL(requestLineEditDialog(
const std::string&)),
this,
176 connect(geoTabWidget->treeView,
177 SIGNAL(requestNameChangeDialog(
const std::string&,
188 connect(geoTabWidget->treeView,
189 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
191 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
192 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
194 connect(stationTabWidget->treeView,
195 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
197 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
198 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
202 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(
int)),
this,
204 connect(meshTabWidget->treeView,
205 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_meshModel.get(),
206 SLOT(removeMesh(
const QModelIndex&)));
207 connect(meshTabWidget->treeView,
208 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_elementModel.get(),
211 meshTabWidget->treeView,
215 connect(meshTabWidget->treeView,
216 SIGNAL(requestMeshToGeometryConversion(
const MeshLib::Mesh*)),
this,
218 connect(meshTabWidget->treeView,
219 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
222 SLOT(highlightMeshComponent(
223 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
224 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
226 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
227 meshTabWidget->elementView, SLOT(updateView()));
229 meshTabWidget->treeView,
230 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
233 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
unsigned)));
234 connect(meshTabWidget->treeView,
235 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
237 meshTabWidget->elementView, SLOT(updateView()));
238 connect(meshTabWidget->treeView,
239 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
241 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
242 SLOT(removeHighlightActor()));
243 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
245 connect(meshTabWidget->elementView,
246 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
248 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
249 SLOT(removeHighlightActor()));
250 connect(meshTabWidget->elementView,
251 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
254 SLOT(highlightMeshComponent(
255 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
256 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
260 connect(modellingTabWidget->treeView,
261 SIGNAL(processVarRemoved(QString
const&)),
_processModel.get(),
262 SLOT(removeProcessVariable(QString
const&)));
263 connect(modellingTabWidget->treeView,
264 SIGNAL(conditionRemoved(QString
const&, QString
const&)),
266 SLOT(removeCondition(QString
const&, QString
const&)));
267 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
269 connect(modellingTabWidget->treeView,
273 connect(modellingTabWidget->treeView,
277 connect(modellingTabWidget->treeView,
279 modellingTabWidget->conditionView, SLOT(updateView()));
280 connect(modellingTabWidget->treeView,
282 modellingTabWidget->conditionView, SLOT(updateView()));
306 SLOT(addPipelineItem(
MeshModel*, QModelIndex)));
309 SLOT(removeSourceItem(
MeshModel*, QModelIndex)));
312 visualizationWidget->vtkWidget, SLOT(update()));
314 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
315 connect(
_vtkVisPipeline.get(), SIGNAL(itemSelected(
const QModelIndex&)),
316 vtkVisTabWidget->vtkVisPipelineView,
317 SLOT(selectItem(
const QModelIndex&)));
320 connect(vtkVisTabWidget->vtkVisPipelineView,
321 SIGNAL(requestRemovePipelineItem(QModelIndex)),
323 connect(vtkVisTabWidget->vtkVisPipelineView,
324 SIGNAL(requestAddPipelineFilterItem(QModelIndex)),
this,
326 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
329 connect(vtkVisTabWidget->vtkVisPipelineView,
330 SIGNAL(actorSelected(vtkProp3D*)),
331 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
332 SLOT(highlightActor(vtkProp3D*)));
334 visualizationWidget, SLOT(updateView()));
337 connect(vtkVisTabWidget->vtkVisPipelineView,
338 SIGNAL(dataObjectSelected(vtkDataObject*)),
339 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
340 SLOT(pickableDataObject(vtkDataObject*)));
341 connect(
reinterpret_cast<QObject*
>(visualizationWidget->vtkPickCallback()),
342 SIGNAL(actorPicked(vtkProp3D*)),
343 vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
344 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
345 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
348 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
350 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
351 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
353 meshTabWidget->elementView, SLOT(updateView()));
354 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
357 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
358 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
361 SLOT(removeHighlightedMeshComponent()));
363 connect(vtkVisTabWidget->vtkVisPipelineView,
368 tabifyDockWidget(geoDock, mshDock);
369 tabifyDockWidget(mshDock, modellingDock);
370 tabifyDockWidget(modellingDock, stationDock);
376 _vtkWidget.reset(visualizationWidget->vtkWidget);
377 for (
auto const& screen : QGuiApplication::screens())
384 menu_File->insertMenu(action_Exit, import_files_menu);
389 connect(
this, SIGNAL(
fileUsed(QString)), recentFiles,
390 SLOT(setCurrentFile(QString)));
391 menu_File->insertMenu(action_Exit, recentFiles->
menu());
394 QAction* showGeoDockAction = geoDock->toggleViewAction();
395 showGeoDockAction->setStatusTip(tr(
"Shows / hides the geometry view"));
396 connect(showGeoDockAction, SIGNAL(triggered(
bool)),
this,
398 menuWindows->addAction(showGeoDockAction);
400 QAction* showStationDockAction = stationDock->toggleViewAction();
401 showStationDockAction->setStatusTip(tr(
"Shows / hides the station view"));
402 connect(showStationDockAction, SIGNAL(triggered(
bool)),
this,
404 menuWindows->addAction(showStationDockAction);
406 QAction* showMshDockAction = mshDock->toggleViewAction();
407 showMshDockAction->setStatusTip(tr(
"Shows / hides the mesh view"));
408 connect(showMshDockAction, SIGNAL(triggered(
bool)),
this,
410 menuWindows->addAction(showMshDockAction);
412 QAction* showModellingDockAction = modellingDock->toggleViewAction();
413 showModellingDockAction->setStatusTip(tr(
"Shows / hides the Process view"));
414 connect(showModellingDockAction, SIGNAL(triggered(
bool)),
this,
416 menuWindows->addAction(showModellingDockAction);
418 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
419 showVisDockAction->setStatusTip(tr(
"Shows / hides the VTK Pipeline view"));
420 connect(showVisDockAction, SIGNAL(triggered(
bool)),
this,
422 menuWindows->addAction(showVisDockAction);
425 auto* presentationMenu =
new QMenu(
this);
426 presentationMenu->setTitle(
"Presentation on");
427 connect(presentationMenu, SIGNAL(aboutToShow()),
this,
429 menuWindows->insertMenu(showVisDockAction, presentationMenu);
432 *visualizationWidget);
438 QWidget::closeEvent(event);
481 modellingDock->show();
485 modellingDock->hide();
505 QString type_str = QString::fromStdString(
507 QString fileName = QFileDialog::getOpenFileName(
508 this,
"Select " + type_str +
" file to import",
509 settings.value(
"lastOpenedFileDirectory").toString(),
511 if (!fileName.isEmpty())
514 QDir dir = QDir(fileName);
515 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
521 auto* action = qobject_cast<QAction*>(sender());
530 QString fileName = QFileDialog::getSaveFileName(
534 "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
536 if (fileName.isEmpty())
542 QFileInfo fi(fileName);
545 if (fi.suffix().toLower() ==
"prj")
549 fileName.toStdString());
551 else if (fi.suffix().toLower() ==
"geo")
553 auto const selected_geometries =
557 const double point_density = 0;
558 const double station_density = point_density;
559 const int max_pnts_per_leaf = 0;
564 station_density, max_pnts_per_leaf, selected_geometries,
false,
571 OGSError::box(
" No geometry available\n to write to geo-file");
578 QFile file(fileName);
581 QMessageBox::warning(
this, tr(
"Application"),
582 tr(
"Cannot read file %1:\n%2.")
584 .arg(file.errorString()));
588 QApplication::setOverrideCursor(Qt::WaitCursor);
589 QFileInfo fi(fileName);
591 QDir dir = QDir(fileName);
593 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
598 if (fi.suffix().toLower() ==
"gli")
600 std::string unique_name;
601 std::vector<std::string> errors;
602 std::string
const gmsh_path =
603 settings.value(
"DataExplorerGmshPath").toString().toStdString();
606 unique_name, errors, gmsh_path))
608 for (
auto& error : errors)
614 else if (fi.suffix().toLower() ==
"prj")
625 "Failed to load project file.\n Please see console for "
629 else if (fi.suffix().toLower() ==
"gml")
637 "Failed to load geometry.\n Please see console for "
641 catch (std::runtime_error
const& err)
644 "Failed to read file `" + fileName +
"'");
648 else if (fi.suffix().toLower() ==
"stn")
654 "Failed to load station data.\n Please see console for "
659 else if (fi.suffix().toLower() ==
"msh" ||
660 fi.suffix().toLower() ==
"vtu" ||
661 fi.suffix().toLower() ==
"vtk")
664 QElapsedTimer myTimer;
667 std::unique_ptr<MeshLib::Mesh> mesh(
670 INFO(
"Mesh loading time: {:d} ms.", myTimer.restart());
681 INFO(
"Mesh model setup time: {:d} ms.", myTimer.elapsed());
685 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
690 if (fi.suffix().toLower() ==
"fem")
693 std::unique_ptr<MeshLib::Mesh> mesh(
707 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
711 if (fi.suffix().toLower() ==
"txt")
713 std::vector<GeoLib::Point*> boreholes;
714 std::string name = fi.baseName().toStdString();
717 fileName.toStdString()))
727 else if (fi.suffix().toLower() ==
"2dm" ||
728 fi.suffix().toLower() ==
"3dm")
730 std::string name = fileName.toStdString();
741 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
745 std::string msh_name(fileName.toStdString());
759 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
763 std::string file_name(fileName.toStdString());
764 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
767 for (
auto& mesh : meshes)
779 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
788 std::unique_ptr<MeshLib::Mesh> mesh(dlg.
getMesh());
795 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
810 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
817 double* origin = img->GetOutput()->GetOrigin();
819 img->GetOutput()->GetSpacing()[0]);
822 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
828 settings.value(
"DataExplorerGmshPath").toString().toStdString());
830 QDir dir = QDir(fileName);
831 settings.setValue(
"lastOpenedShapeFileDirectory", dir.absolutePath());
835 if (fi.suffix().toLower().compare(
"poly") == 0 ||
836 fi.suffix().toLower().compare(
"smesh") == 0)
844 settings.setValue(
"lastOpenedTetgenFileDirectory",
845 QFileInfo(fileName).absolutePath());
846 QString element_fname(fi.path() +
"/" + fi.completeBaseName() +
849 if (!fileName.isEmpty())
853 fileName.toStdString(), element_fname.toStdString()));
868 settings.setValue(
"lastOpenedVtkFileDirectory", dir.absolutePath());
871 QApplication::restoreOverrideCursor();
877 visualizationWidget->updateViewOnLoad();
878 geoTabWidget->treeView->updateView();
879 stationTabWidget->treeView->updateView();
880 meshTabWidget->treeView->updateView();
887 restoreGeometry(settings.value(
"windowGeometry").toByteArray());
888 restoreState(settings.value(
"windowState").toByteArray());
895 settings.setValue(
"windowGeometry", saveGeometry());
896 settings.setValue(
"windowState", saveState());
908 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
911 QString(
"Version: %1<br />")
915 QString(
"Git commit: <a "
916 "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
917 .arg(QString::fromStdString(
919 about.append(QString(
"Built date: %1<br />")
920 .arg(QDate::currentDate().toString(Qt::ISODate)));
922 QMessageBox::about(
this,
"About OpenGeoSys 6",
about);
927 QMenu* importFiles =
new QMenu(
"&Import Files",
this);
928 importFiles->addAction(
"&FEFLOW Files...",
930 importFiles->addAction(
"SMS/G&MS Files...",
932 importFiles->addAction(
"&GMSH Files...",
934 importFiles->addAction(
"&Gocad TSurface...",
937 importFiles->addAction(
"&NetCDF Files...",
940 importFiles->addAction(
"&Petrel Files...", [
this] {
loadPetrelFiles(); });
941 importFiles->addAction(
"&Raster Files...",
943 importFiles->addAction(
"&Shape Files...",
945 importFiles->addAction(
"&TetGen Files...",
947 importFiles->addAction(
"&VTK Files...",
955 QStringList sfc_file_names = QFileDialog::getOpenFileNames(
956 this,
"Select surface data file(s) to import",
"",
"Petrel files (*)");
957 QStringList well_path_file_names = QFileDialog::getOpenFileNames(
958 this,
"Select well path data file(s) to import",
"",
960 if (!sfc_file_names.empty() || !well_path_file_names.empty())
962 QStringList::const_iterator it = sfc_file_names.begin();
963 std::list<std::string> sfc_files;
964 while (it != sfc_file_names.end())
966 sfc_files.push_back((*it).toStdString());
970 it = well_path_file_names.begin();
971 std::list<std::string> well_path_files;
972 while (it != well_path_file_names.end())
974 well_path_files.push_back((*it).toStdString());
978 std::string unique_str(*(sfc_files.begin()));
983 QDir dir = QDir(sfc_file_names.at(0));
984 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
997 QFileInfo fi(fileName);
998 if (fi.suffix().toLower() ==
"gli")
1020 if (dlg.exec() != QDialog::Accepted)
1027 QString file_name(
"");
1030 QString file_type[2] = {
"OpenGeoSys mesh files (*.vtu *.msh)",
1031 "Raster files(*.asc *.grd *.xyz)"};
1033 file_name = QFileDialog::getOpenFileName(
1035 "Select file for mapping",
1036 settings.value(
"lastOpenedFileDirectory").toString(),
1038 if (file_name.isEmpty())
1042 QDir dir = QDir(file_name);
1043 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1047 QFileInfo fi(file_name);
1050 if (fi.suffix().toLower() ==
"asc" || fi.suffix().toLower() ==
"grd")
1052 std::unique_ptr<GeoLib::Raster> raster(
1054 file_name.toStdString()));
1057 geo_mapper.
mapOnDEM(std::move(raster));
1067 OGSError::box(
"The selected file is no supported raster file.");
1075 if (fi.suffix().toLower() ==
"vtu" || fi.suffix().toLower() ==
"vtk" ||
1076 fi.suffix().toLower() ==
"msh")
1082 OGSError::box(
"The selected file is no supported mesh file.");
1093 if (new_geo_name.empty())
1120 std::string fileName)
1122 const std::vector<GeoLib::Point*>* stations(
1128 unsigned param1,
double param2,
double param3,
1129 double param4,
bool delete_geo_file)
1131 if (!selectedGeometries.empty())
1133 INFO(
"Start meshing ...");
1135 QString fileName(
"");
1138 if (!delete_geo_file)
1140 fileName = QFileDialog::getSaveFileName(
1141 this,
"Save GMSH-file as",
1143 "GMSH geometry files (*.geo)");
1147 fileName =
"tmp_gmsh.geo";
1150 if (!fileName.isEmpty())
1159 param2, param3, param1, selectedGeometries,
false,
1162 fileName.toStdString());
1169 param4, param3, param1, selectedGeometries,
false,
1172 fileName.toStdString());
1175 if (system(
nullptr) != 0)
1178 std::string gmsh_path =
1179 settings.value(
"DataExplorerGmshPath")
1183 if (!gmsh_path.empty())
1185 std::string fname(fileName.toStdString());
1186 std::string gmsh_command =
1187 "\"" + gmsh_path +
"\" -2 -algo meshadapt " + fname;
1188 std::size_t pos(fname.rfind(
"."));
1189 if (pos != std::string::npos)
1191 fname = fname.substr(0, pos);
1193 gmsh_command +=
" -o " + fname +
".msh";
1198 gmsh_command +=
" -format msh22";
1199 auto const return_value =
1200 std::system(gmsh_command.c_str());
1201 if (return_value != 0)
1203 QString
const message =
1204 "Execution of gmsh command returned non-zero "
1206 QString::number(return_value);
1212 fileName.left(fileName.length() - 3)
1225 "Error executing command gmsh - no command processor "
1230 catch (std::runtime_error& error)
1233 QString(
"\n Please cleanup the input data."),
1236 if (delete_geo_file)
1243 INFO(
"No geometry information selected.");
1244 QApplication::restoreOverrideCursor();
1251 settings.value(
"DataExplorerGmshPath").toString().toStdString(),
this);
1252 dlg->setAttribute(Qt::WA_DeleteOnClose);
1261 _geo_model->getStationModel()->stationFromIndex(index, listName);
1265 OGSError::box(
"No time series data available for borehole.");
1270 prefs->setAttribute(Qt::WA_DeleteOnClose);
1278 QString fileName = QFileDialog::getOpenFileName(
1279 this,
"Select data file to open",
1280 settings.value(
"lastOpenedFileDirectory").toString(),
1281 "Text files (*.txt);;All files (* *.*)");
1282 if (!fileName.isEmpty())
1284 QDir dir = QDir(fileName);
1285 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1287 prefs->setAttribute(Qt::WA_DeleteOnClose);
1297 geometry_name, object_type,
id);
1300 if (dlg.exec() != QDialog::Accepted)
1305 _geo_model->addNameForElement(geometry_name, object_type,
id,
1307 static_cast<GeoTreeModel*
>(this->geoTabWidget->treeView->model())
1310 geometry_name, object_type,
id));
1316 std::vector<GeoLib::Point*>
const* stations =
1320 if (dlg.exec() != QDialog::Accepted)
1390 std::string stn_name = geo_name +
" Stations";
1405 SIGNAL(connectPolylines(
const std::string&, std::vector<std::size_t>,
1406 double, std::string,
bool,
bool)),
1408 SLOT(connectPolylineSegments(
const std::string&,
1409 std::vector<std::size_t>,
double,
1410 std::string,
bool,
bool)));
1418 SIGNAL(requestMeshing(std::vector<std::string>&,
unsigned,
double,
1419 double,
double,
bool)),
1421 SLOT(
callGMSH(std::vector<std::string>&,
unsigned,
double,
double,
1429 if (dlg.exec() != QDialog::Accepted)
1437 OGSError::box(
"Points are missing for\n at least one geometry.");
1444 if (mshSource ==
nullptr)
1450 if (dlg.exec() != QDialog::Accepted)
1491 QString ext = QFileInfo(fileName).suffix();
1492 if (ext ==
"msh" || ext ==
"vtu" || ext ==
"gli" || ext ==
"gml")
1503 QString
const filename = QFileDialog::getSaveFileName(
1505 "Export object to vtk-files",
1506 settings.value(
"lastExportedFileDirectory").toString(),
1507 "VTK files (*.vtp *.vtu)");
1508 if (!filename.isEmpty())
1510 QDir
const dir = QDir(filename);
1511 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1513 std::string
const basename =
1514 QFileInfo(filename).path().toStdString() +
"/" +
1515 QFileInfo(filename).baseName().toStdString();
1520 std::string
const name = basename + std::to_string(++count) +
"-" +
1521 (*it)->data(0).toString().toStdString();
1532 QString fileName = QFileDialog::getSaveFileName(
1533 this,
"Save scene to VRML file",
1534 settings.value(
"lastExportedFileDirectory").toString(),
1535 "VRML files (*.wrl);;");
1536 if (!fileName.isEmpty())
1538 QDir dir = QDir(fileName);
1539 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1541 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1542 exporter->SetFileName(fileName.toStdString().c_str());
1543 exporter->SetRenderWindow(
1544 visualizationWidget->vtkWidget->renderWindow());
1554 QString fileName = QFileDialog::getSaveFileName(
1555 this,
"Save scene to Wavefront OBJ files",
1556 settings.value(
"lastExportedFileDirectory").toString(),
";;");
1557 if (!fileName.isEmpty())
1559 QDir dir = QDir(fileName);
1560 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1562 vtkOBJExporter* exporter = vtkOBJExporter::New();
1563 exporter->SetFilePrefix(fileName.toStdString().c_str());
1564 exporter->SetRenderWindow(
1565 visualizationWidget->vtkWidget->renderWindow());
1573 auto* menu =
static_cast<QMenu*
>(QObject::sender());
1577 QAction* action =
new QAction(
"Quit presentation mode", menu);
1578 connect(action, SIGNAL(triggered()),
this,
1580 action->setShortcutContext(Qt::WidgetShortcut);
1581 action->setShortcut(QKeySequence(Qt::Key_Escape));
1582 menu->addAction(action);
1587 const int currentScreen =
1588 QApplication::desktop()->screenNumber(visualizationWidget);
1591 Q_UNUSED(screenGeo);
1593 new QAction(QString(
"On screen %1").arg(count), menu);
1594 connect(action, SIGNAL(triggered()),
this,
1596 if (count == currentScreen)
1598 action->setEnabled(
false);
1600 menu->addAction(action);
1612 QString actionText =
static_cast<QAction*
>(QObject::sender())->text();
1613 int screen = actionText.split(
" ").back().toInt();
1625 QAction* action =
new QAction(
"Quit presentation mode",
this);
1627 action->setShortcutContext(Qt::WidgetShortcut);
1628 action->setShortcut(QKeySequence(Qt::Key_Escape));
1632 QMainWindow::centralWidget()->hide();
1638 QAction* action =
_vtkWidget->actions().back();
1643 visualizationWidget->layout()->addWidget(
_vtkWidget.get());
1645 QMainWindow::centralWidget()->show();
1654 QString fileName(
"");
1655 QStringList files = settings.value(
"recentFileList").toStringList();
1658 return QFileInfo(files[0]).absolutePath();
1661 return QDir::homePath();
Definition of the AddFaultsToVoxelGridDialog class.
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.
void setNameForItem(const std::string &name, GeoLib::GEOTYPE type, std::size_t id, std::string item_name)
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 showAddFaultsToVoxelGridDialog()
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.
void setNameForItem(const std::string &stn_vec_name, std::size_t id, std::string const &item_name)
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
MeshLib::Mesh * readGMSHMesh(std::string const &fname, bool const is_created_with_gmsh2)
bool isGMSHMeshFile(const std::string &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, bool const compute_element_neighbors)
MeshQualityType
Describes a mesh quality metric.
Definition of readMeshFromFile function.