21 #include <QDesktopWidget>
22 #include <QFileDialog>
23 #include <QMessageBox>
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>
111 geoTabWidget->treeView->setModel(
_geo_model->getGeoModel());
112 stationTabWidget->treeView->setModel(
_geo_model->getStationModel());
113 meshTabWidget->treeView->setModel(
_meshModel.get());
120 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
123 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(
int)),
this,
125 connect(stationTabWidget->treeView,
126 SIGNAL(stationListExportRequested(std::string, std::string)),
this,
128 std::string, std::string)));
129 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
131 SLOT(removeStationVec(
133 connect(stationTabWidget->treeView,
134 SIGNAL(stationListSaved(QString, QString)),
this,
141 connect(stationTabWidget->treeView,
142 SIGNAL(requestNameChangeDialog(
const std::string&, std::size_t)),
144 connect(stationTabWidget->treeView,
145 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
147 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
153 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(
int)),
this,
155 connect(geoTabWidget->treeView,
158 connect(geoTabWidget->treeView,
159 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
162 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
165 connect(geoTabWidget->treeView,
166 SIGNAL(requestPointToStationConversion(std::string
const&)),
this,
169 geoTabWidget->treeView,
170 SIGNAL(requestLineEditDialog(
const std::string&)),
this,
172 connect(geoTabWidget->treeView,
173 SIGNAL(requestNameChangeDialog(
const std::string&,
184 connect(geoTabWidget->treeView,
185 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
187 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
188 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
190 connect(stationTabWidget->treeView,
191 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
193 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
194 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
198 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(
int)),
this,
200 connect(meshTabWidget->treeView,
201 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_meshModel.get(),
202 SLOT(removeMesh(
const QModelIndex&)));
203 connect(meshTabWidget->treeView,
204 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_elementModel.get(),
207 meshTabWidget->treeView,
211 connect(meshTabWidget->treeView,
212 SIGNAL(requestMeshToGeometryConversion(
const MeshLib::Mesh*)),
this,
214 connect(meshTabWidget->treeView,
215 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
218 SLOT(highlightMeshComponent(
219 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
220 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
222 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
223 meshTabWidget->elementView, SLOT(updateView()));
225 meshTabWidget->treeView,
226 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
229 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
unsigned)));
230 connect(meshTabWidget->treeView,
231 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
233 meshTabWidget->elementView, SLOT(updateView()));
234 connect(meshTabWidget->treeView,
235 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
237 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
238 SLOT(removeHighlightActor()));
239 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
241 connect(meshTabWidget->elementView,
242 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
244 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
245 SLOT(removeHighlightActor()));
246 connect(meshTabWidget->elementView,
247 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
250 SLOT(highlightMeshComponent(
251 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
252 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
256 connect(modellingTabWidget->treeView,
257 SIGNAL(processVarRemoved(QString
const&)),
_processModel.get(),
258 SLOT(removeProcessVariable(QString
const&)));
259 connect(modellingTabWidget->treeView,
260 SIGNAL(conditionRemoved(QString
const&, QString
const&)),
262 SLOT(removeCondition(QString
const&, QString
const&)));
263 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
265 connect(modellingTabWidget->treeView,
269 connect(modellingTabWidget->treeView,
273 connect(modellingTabWidget->treeView,
275 modellingTabWidget->conditionView, SLOT(updateView()));
276 connect(modellingTabWidget->treeView,
278 modellingTabWidget->conditionView, SLOT(updateView()));
302 SLOT(addPipelineItem(
MeshModel*, QModelIndex)));
305 SLOT(removeSourceItem(
MeshModel*, QModelIndex)));
308 visualizationWidget->vtkWidget, SLOT(update()));
310 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
311 connect(
_vtkVisPipeline.get(), SIGNAL(itemSelected(
const QModelIndex&)),
312 vtkVisTabWidget->vtkVisPipelineView,
313 SLOT(selectItem(
const QModelIndex&)));
316 connect(vtkVisTabWidget->vtkVisPipelineView,
317 SIGNAL(requestRemovePipelineItem(QModelIndex)),
319 connect(vtkVisTabWidget->vtkVisPipelineView,
320 SIGNAL(requestAddPipelineFilterItem(QModelIndex)),
this,
322 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
325 connect(vtkVisTabWidget->vtkVisPipelineView,
326 SIGNAL(actorSelected(vtkProp3D*)),
327 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
328 SLOT(highlightActor(vtkProp3D*)));
330 visualizationWidget, SLOT(updateView()));
333 connect(vtkVisTabWidget->vtkVisPipelineView,
334 SIGNAL(dataObjectSelected(vtkDataObject*)),
335 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
336 SLOT(pickableDataObject(vtkDataObject*)));
337 connect(
reinterpret_cast<QObject*
>(visualizationWidget->vtkPickCallback()),
338 SIGNAL(actorPicked(vtkProp3D*)),
339 vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
340 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
341 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
344 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
346 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
347 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
349 meshTabWidget->elementView, SLOT(updateView()));
350 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
353 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
354 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
357 SLOT(removeHighlightedMeshComponent()));
359 connect(vtkVisTabWidget->vtkVisPipelineView,
364 tabifyDockWidget(geoDock, mshDock);
365 tabifyDockWidget(mshDock, modellingDock);
366 tabifyDockWidget(modellingDock, stationDock);
372 _vtkWidget.reset(visualizationWidget->vtkWidget);
373 for (
auto const& screen : QGuiApplication::screens())
380 menu_File->insertMenu(action_Exit, import_files_menu);
385 connect(
this, SIGNAL(
fileUsed(QString)), recentFiles,
386 SLOT(setCurrentFile(QString)));
387 menu_File->insertMenu(action_Exit, recentFiles->
menu());
390 QAction* showGeoDockAction = geoDock->toggleViewAction();
391 showGeoDockAction->setStatusTip(tr(
"Shows / hides the geometry view"));
392 connect(showGeoDockAction, SIGNAL(triggered(
bool)),
this,
394 menuWindows->addAction(showGeoDockAction);
396 QAction* showStationDockAction = stationDock->toggleViewAction();
397 showStationDockAction->setStatusTip(tr(
"Shows / hides the station view"));
398 connect(showStationDockAction, SIGNAL(triggered(
bool)),
this,
400 menuWindows->addAction(showStationDockAction);
402 QAction* showMshDockAction = mshDock->toggleViewAction();
403 showMshDockAction->setStatusTip(tr(
"Shows / hides the mesh view"));
404 connect(showMshDockAction, SIGNAL(triggered(
bool)),
this,
406 menuWindows->addAction(showMshDockAction);
408 QAction* showModellingDockAction = modellingDock->toggleViewAction();
409 showModellingDockAction->setStatusTip(tr(
"Shows / hides the Process view"));
410 connect(showModellingDockAction, SIGNAL(triggered(
bool)),
this,
412 menuWindows->addAction(showModellingDockAction);
414 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
415 showVisDockAction->setStatusTip(tr(
"Shows / hides the VTK Pipeline view"));
416 connect(showVisDockAction, SIGNAL(triggered(
bool)),
this,
418 menuWindows->addAction(showVisDockAction);
421 auto* presentationMenu =
new QMenu(
this);
422 presentationMenu->setTitle(
"Presentation on");
423 connect(presentationMenu, SIGNAL(aboutToShow()),
this,
425 menuWindows->insertMenu(showVisDockAction, presentationMenu);
428 *visualizationWidget);
434 QWidget::closeEvent(event);
477 modellingDock->show();
481 modellingDock->hide();
501 QString type_str = QString::fromStdString(
503 QString fileName = QFileDialog::getOpenFileName(
504 this,
"Select " + type_str +
" file to import",
505 settings.value(
"lastOpenedFileDirectory").toString(),
507 if (!fileName.isEmpty())
510 QDir dir = QDir(fileName);
511 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
517 auto* action = qobject_cast<QAction*>(sender());
526 QString fileName = QFileDialog::getSaveFileName(
530 "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
532 if (fileName.isEmpty())
538 QFileInfo fi(fileName);
541 if (fi.suffix().toLower() ==
"prj")
545 fileName.toStdString());
547 else if (fi.suffix().toLower() ==
"geo")
549 auto const selected_geometries =
553 const double point_density = 0;
554 const double station_density = point_density;
555 const int max_pnts_per_leaf = 0;
560 station_density, max_pnts_per_leaf, selected_geometries,
false,
567 OGSError::box(
" No geometry available\n to write to geo-file");
574 QFile file(fileName);
577 QMessageBox::warning(
this, tr(
"Application"),
578 tr(
"Cannot read file %1:\n%2.")
580 .arg(file.errorString()));
584 QApplication::setOverrideCursor(Qt::WaitCursor);
585 QFileInfo fi(fileName);
587 QDir dir = QDir(fileName);
589 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
594 if (fi.suffix().toLower() ==
"gli")
596 std::string unique_name;
597 std::vector<std::string> errors;
598 std::string
const gmsh_path =
599 settings.value(
"DataExplorerGmshPath").toString().toStdString();
602 unique_name, errors, gmsh_path))
604 for (
auto& error : errors)
610 else if (fi.suffix().toLower() ==
"prj")
621 "Failed to load project file.\n Please see console for "
625 else if (fi.suffix().toLower() ==
"gml")
633 "Failed to load geometry.\n Please see console for "
637 catch (std::runtime_error
const& err)
640 "Failed to read file `" + fileName +
"'");
644 else if (fi.suffix().toLower() ==
"stn")
650 "Failed to load station data.\n Please see console for "
655 else if (fi.suffix().toLower() ==
"msh" ||
656 fi.suffix().toLower() ==
"vtu" ||
657 fi.suffix().toLower() ==
"vtk")
660 QElapsedTimer myTimer;
663 std::unique_ptr<MeshLib::Mesh> mesh(
666 INFO(
"Mesh loading time: {:d} ms.", myTimer.restart());
677 INFO(
"Mesh model setup time: {:d} ms.", myTimer.elapsed());
681 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
686 if (fi.suffix().toLower() ==
"fem")
689 std::unique_ptr<MeshLib::Mesh> mesh(
703 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
707 if (fi.suffix().toLower() ==
"txt")
709 auto boreholes = std::make_unique<std::vector<GeoLib::Point*>>();
710 std::string
name = fi.baseName().toStdString();
712 if (GMSInterface::readBoreholesFromGMS(boreholes.get(),
713 fileName.toStdString()))
723 else if (fi.suffix().toLower() ==
"3dm")
725 std::string
name = fileName.toStdString();
726 std::unique_ptr<MeshLib::Mesh> mesh(
727 GMSInterface::readGMS3DMMesh(
name));
737 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
741 std::string msh_name(fileName.toStdString());
744 std::unique_ptr<MeshLib::Mesh> mesh(
755 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
759 std::string file_name(fileName.toStdString());
760 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
763 for (
auto& mesh : meshes)
775 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
777 #ifdef OGS_USE_NETCDF
784 std::unique_ptr<MeshLib::Mesh> mesh(dlg.
getMesh());
791 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
806 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
813 double* origin = img->GetOutput()->GetOrigin();
815 img->GetOutput()->GetSpacing()[0]);
818 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
824 settings.value(
"DataExplorerGmshPath").toString().toStdString());
826 QDir dir = QDir(fileName);
827 settings.setValue(
"lastOpenedShapeFileDirectory", dir.absolutePath());
831 if (fi.suffix().toLower().compare(
"poly") == 0 ||
832 fi.suffix().toLower().compare(
"smesh") == 0)
840 settings.setValue(
"lastOpenedTetgenFileDirectory",
841 QFileInfo(fileName).absolutePath());
842 QString element_fname(fi.path() +
"/" + fi.completeBaseName() +
845 if (!fileName.isEmpty())
849 fileName.toStdString(), element_fname.toStdString()));
864 settings.setValue(
"lastOpenedVtkFileDirectory", dir.absolutePath());
867 QApplication::restoreOverrideCursor();
873 visualizationWidget->updateViewOnLoad();
874 geoTabWidget->treeView->updateView();
875 stationTabWidget->treeView->updateView();
876 meshTabWidget->treeView->updateView();
883 restoreGeometry(settings.value(
"windowGeometry").toByteArray());
884 restoreState(settings.value(
"windowState").toByteArray());
891 settings.setValue(
"windowGeometry", saveGeometry());
892 settings.setValue(
"windowState", saveState());
904 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
907 QString(
"Version: %1<br />")
911 QString(
"Git commit: <a "
912 "href='https://github.com/ufz/ogs/commit/%1'>%1</a><br />")
913 .arg(QString::fromStdString(
915 about.append(QString(
"Built date: %1<br />")
916 .arg(QDate::currentDate().
toString(Qt::ISODate)));
918 QMessageBox::about(
this,
"About OpenGeoSys 6",
about);
923 QMenu* importFiles =
new QMenu(
"&Import Files",
this);
924 importFiles->addAction(
"&FEFLOW Files...",
926 importFiles->addAction(
"G&MS Files...",
928 importFiles->addAction(
"&GMSH Files...",
930 importFiles->addAction(
"&Gocad TSurface...",
932 #ifdef OGS_USE_NETCDF
933 importFiles->addAction(
"&NetCDF Files...",
936 importFiles->addAction(
"&Petrel Files...", [
this] {
loadPetrelFiles(); });
937 importFiles->addAction(
"&Raster Files...",
939 importFiles->addAction(
"&Shape Files...",
941 importFiles->addAction(
"&TetGen Files...",
943 importFiles->addAction(
"&VTK Files...",
951 QStringList sfc_file_names = QFileDialog::getOpenFileNames(
952 this,
"Select surface data file(s) to import",
"",
"Petrel files (*)");
953 QStringList well_path_file_names = QFileDialog::getOpenFileNames(
954 this,
"Select well path data file(s) to import",
"",
956 if (!sfc_file_names.empty() || !well_path_file_names.empty())
958 QStringList::const_iterator it = sfc_file_names.begin();
959 std::list<std::string> sfc_files;
960 while (it != sfc_file_names.end())
962 sfc_files.push_back((*it).toStdString());
966 it = well_path_file_names.begin();
967 std::list<std::string> well_path_files;
968 while (it != well_path_file_names.end())
970 well_path_files.push_back((*it).toStdString());
974 std::string unique_str(*(sfc_files.begin()));
979 QDir dir = QDir(sfc_file_names.at(0));
980 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
993 QFileInfo fi(fileName);
994 if (fi.suffix().toLower() ==
"gli")
1016 if (dlg.exec() != QDialog::Accepted)
1023 QString file_name(
"");
1026 QString file_type[2] = {
"OpenGeoSys mesh files (*.vtu *.msh)",
1027 "Raster files(*.asc *.grd)"};
1029 file_name = QFileDialog::getOpenFileName(
1031 "Select file for mapping",
1032 settings.value(
"lastOpenedFileDirectory").toString(),
1034 if (file_name.isEmpty())
1038 QDir dir = QDir(file_name);
1039 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1043 QFileInfo fi(file_name);
1046 if (fi.suffix().toLower() ==
"asc" || fi.suffix().toLower() ==
"grd")
1048 std::unique_ptr<GeoLib::Raster> raster(
1050 file_name.toStdString()));
1053 geo_mapper.
mapOnDEM(std::move(raster));
1063 OGSError::box(
"The selected file is no supported raster file.");
1071 if (fi.suffix().toLower() ==
"vtu" || fi.suffix().toLower() ==
"vtk" ||
1072 fi.suffix().toLower() ==
"msh")
1078 OGSError::box(
"The selected file is no supported mesh file.");
1089 if (new_geo_name.empty())
1116 std::string fileName)
1118 const std::vector<GeoLib::Point*>* stations(
1120 GMSInterface::writeBoreholesToGMS(stations, fileName);
1124 unsigned param1,
double param2,
double param3,
1125 double param4,
bool delete_geo_file)
1127 if (!selectedGeometries.empty())
1129 INFO(
"Start meshing ...");
1131 QString fileName(
"");
1134 if (!delete_geo_file)
1136 fileName = QFileDialog::getSaveFileName(
1137 this,
"Save GMSH-file as",
1139 "GMSH geometry files (*.geo)");
1143 fileName =
"tmp_gmsh.geo";
1146 if (!fileName.isEmpty())
1153 param2, param3, param1, selectedGeometries,
false,
false);
1155 fileName.toStdString());
1162 param4, param3, param1, selectedGeometries,
false,
false);
1164 fileName.toStdString());
1167 if (system(
nullptr) != 0)
1170 std::string gmsh_path = settings.value(
"DataExplorerGmshPath")
1174 if (!gmsh_path.empty())
1176 std::string fname(fileName.toStdString());
1177 std::string gmsh_command =
1178 "\"" + gmsh_path +
"\" -2 -algo meshadapt " + fname;
1179 std::size_t pos(fname.rfind(
"."));
1180 if (pos != std::string::npos)
1182 fname = fname.substr(0, pos);
1184 gmsh_command +=
" -o " + fname +
".msh";
1188 gmsh_command +=
" -format msh22";
1189 auto const return_value = std::system(gmsh_command.c_str());
1190 if (return_value != 0)
1192 QString
const message =
1193 "Execution of gmsh command returned non-zero "
1195 QString::number(return_value);
1202 fileName.left(fileName.length() - 3).append(
"msh"));
1213 "Error executing command gmsh - no command processor "
1218 if (delete_geo_file)
1225 INFO(
"No geometry information selected.");
1226 QApplication::restoreOverrideCursor();
1233 settings.value(
"DataExplorerGmshPath").toString().toStdString(),
this);
1234 dlg->setAttribute(Qt::WA_DeleteOnClose);
1243 _geo_model->getStationModel()->stationFromIndex(index, listName);
1247 OGSError::box(
"No time series data available for borehole.");
1252 prefs->setAttribute(Qt::WA_DeleteOnClose);
1260 QString fileName = QFileDialog::getOpenFileName(
1261 this,
"Select data file to open",
1262 settings.value(
"lastOpenedFileDirectory").toString(),
1263 "Text files (*.txt);;All files (* *.*)");
1264 if (!fileName.isEmpty())
1266 QDir dir = QDir(fileName);
1267 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
1269 prefs->setAttribute(Qt::WA_DeleteOnClose);
1279 geometry_name, object_type,
id);
1282 if (dlg.exec() != QDialog::Accepted)
1287 _geo_model->addNameForElement(geometry_name, object_type,
id,
1289 static_cast<GeoTreeModel*
>(this->geoTabWidget->treeView->model())
1290 ->setNameForItem(geometry_name, object_type,
id,
1292 geometry_name, object_type,
id));
1298 std::vector<GeoLib::Point*>
const* stations =
1302 if (dlg.exec() != QDialog::Accepted)
1309 ->setNameForItem(stn_vec_name,
id, stn->getName());
1336 std::string stn_name = geo_name +
" Stations";
1351 SIGNAL(connectPolylines(
const std::string&, std::vector<std::size_t>,
1352 double, std::string,
bool,
bool)),
1354 SLOT(connectPolylineSegments(
const std::string&,
1355 std::vector<std::size_t>,
double,
1356 std::string,
bool,
bool)));
1364 SIGNAL(requestMeshing(std::vector<std::string>&,
unsigned,
double,
1365 double,
double,
bool)),
1367 SLOT(
callGMSH(std::vector<std::string>&,
unsigned,
double,
double,
1375 if (dlg.exec() != QDialog::Accepted)
1383 OGSError::box(
"Points are missing for\n at least one geometry.");
1390 if (mshSource ==
nullptr)
1396 if (dlg.exec() != QDialog::Accepted)
1437 QString ext = QFileInfo(fileName).suffix();
1438 if (ext ==
"msh" || ext ==
"vtu" || ext ==
"gli" || ext ==
"gml")
1449 QString
const filename = QFileDialog::getSaveFileName(
1451 "Export object to vtk-files",
1452 settings.value(
"lastExportedFileDirectory").toString(),
1453 "VTK files (*.vtp *.vtu)");
1454 if (!filename.isEmpty())
1456 QDir
const dir = QDir(filename);
1457 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1459 std::string
const basename =
1460 QFileInfo(filename).path().toStdString() +
"/" +
1461 QFileInfo(filename).baseName().toStdString();
1466 std::string
const name = basename + std::to_string(++count) +
"-" +
1467 (*it)->data(0).toString().toStdString();
1478 QString fileName = QFileDialog::getSaveFileName(
1479 this,
"Save scene to VRML file",
1480 settings.value(
"lastExportedFileDirectory").toString(),
1481 "VRML files (*.wrl);;");
1482 if (!fileName.isEmpty())
1484 QDir dir = QDir(fileName);
1485 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1487 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1488 exporter->SetFileName(fileName.toStdString().c_str());
1489 exporter->SetRenderWindow(
1490 visualizationWidget->vtkWidget->GetRenderWindow());
1500 QString fileName = QFileDialog::getSaveFileName(
1501 this,
"Save scene to Wavefront OBJ files",
1502 settings.value(
"lastExportedFileDirectory").toString(),
";;");
1503 if (!fileName.isEmpty())
1505 QDir dir = QDir(fileName);
1506 settings.setValue(
"lastExportedFileDirectory", dir.absolutePath());
1508 vtkOBJExporter* exporter = vtkOBJExporter::New();
1509 exporter->SetFilePrefix(fileName.toStdString().c_str());
1510 exporter->SetRenderWindow(
1511 visualizationWidget->vtkWidget->GetRenderWindow());
1519 auto* menu =
static_cast<QMenu*
>(QObject::sender());
1523 QAction* action =
new QAction(
"Quit presentation mode", menu);
1524 connect(action, SIGNAL(triggered()),
this,
1526 action->setShortcutContext(Qt::WidgetShortcut);
1527 action->setShortcut(QKeySequence(Qt::Key_Escape));
1528 menu->addAction(action);
1533 const int currentScreen =
1534 QApplication::desktop()->screenNumber(visualizationWidget);
1537 Q_UNUSED(screenGeo);
1539 new QAction(QString(
"On screen %1").arg(count), menu);
1540 connect(action, SIGNAL(triggered()),
this,
1542 if (count == currentScreen)
1544 action->setEnabled(
false);
1546 menu->addAction(action);
1558 QString actionText =
static_cast<QAction*
>(QObject::sender())->text();
1559 int screen = actionText.split(
" ").back().toInt();
1571 QAction* action =
new QAction(
"Quit presentation mode",
this);
1573 action->setShortcutContext(Qt::WidgetShortcut);
1574 action->setShortcut(QKeySequence(Qt::Key_Escape));
1578 QMainWindow::centralWidget()->hide();
1584 QAction* action =
_vtkWidget->actions().back();
1589 visualizationWidget->layout()->addWidget(
_vtkWidget.get());
1591 QMainWindow::centralWidget()->show();
1600 QString fileName(
"");
1601 QStringList files = settings.value(
"recentFileList").toStringList();
1604 return QFileInfo(files[0]).absolutePath();
1607 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 LicenseDialog class.
Definition of the LineEditDialog class.
void INFO(char const *fmt, Args const &... 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 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 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.
GeoLib::GEOObjects & getGEOObjects()
Returns the GEOObjects containing all points, polylines and surfaces.
const std::vector< std::unique_ptr< MeshLib::Mesh > > & getMeshObjects() const
Returns all the meshes with their respective names.
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.
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::unique_ptr< 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 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 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 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.
int writeHistogram(std::string const &file_name, std::size_t n_bins=0) const
Writes a histogram of the quality vector to a specified file.
std::vector< double > const getQualityVector() const
Returns the vector containing a quality measure for each element.
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.
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 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
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)
Converts MGIS kinematic to a string representation.
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)
bool convertMeshToGeo(const MeshLib::Mesh &mesh, GeoLib::GEOObjects &geo_objects, double const eps)
MeshQualityType
Describes a mesh quality metric.
Definition of readMeshFromFile function.