OGS
MainWindow Class Reference

Detailed Description

Main program window for the graphical user interface of OpenGeoSys.

Definition at line 40 of file mainwindow.h.

#include <mainwindow.h>

Inheritance diagram for MainWindow:
[legend]
Collaboration diagram for MainWindow:
[legend]

Signals

void fileUsed (QString filename)
 
void fileOpenRequested (int)
 

Public Member Functions

 MainWindow (QWidget *parent=nullptr)
 
void ShowWindow ()
 
void HideWindow ()
 
void loadFileOnStartUp (const QString &fileName)
 

Protected Slots

void showGeoDockWidget (bool show)
 
void showStationDockWidget (bool show)
 
void showMshDockWidget (bool show)
 
void showConditionDockWidget (bool show)
 
void showVisDockWidget (bool show)
 
void open (int file_type=0)
 Function calls for opening files. More...
 
void save ()
 Function calls for saving files. More...
 
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. More...
 
void exportBoreholesToGMS (std::string listName, std::string fileName)
 Function calls for GMS export. More...
 
void FEMTestStart ()
 Testing functionality for connection to FEM lib. More...
 
void loadPetrelFiles ()
 
void mapGeometry (const std::string &geo_name)
 
void convertMeshToGeometry (const MeshLib::Mesh *mesh)
 
void convertPointsToStations (std::string const &geo_name)
 
void openRecentFile ()
 
void about ()
 
void showAddPipelineFilterItemDialog (QModelIndex parentIndex)
 
void showDataExplorerSettingsDialog ()
 
void showGeoNameDialog (const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id)
 Allows setting the name for a geometric object. More...
 
void showStationNameDialog (const std::string &stn_vec_name, std::size_t id)
 Allows setting the name for a station. More...
 
void showCreateStructuredGridDialog ()
 Creates a structured grid with user-specified parameters. More...
 
void showMeshElementRemovalDialog ()
 Removal of mesh elements based on a number of criteria. More...
 
void showDiagramPrefsDialog ()
 Calls the diagram prefs dialog from the Tools menu. More...
 
void showDiagramPrefsDialog (QModelIndex &index)
 Calls the diagram prefs dialog from the station list (i.e. for a specific station). More...
 
void showFileConverter ()
 Calls the OGSFileConverter as an external tool. More...
 
void showLicense ()
 
void showLineEditDialog (const std::string &geoName)
 
void showGMSHPrefsDialog ()
 
void showMergeGeometriesDialog ()
 
void showMeshAnalysisDialog ()
 
void showMeshQualitySelectionDialog (MeshLib::VtkMappedMeshSource *mshSource)
 
void showVisalizationPrefsDialog ()
 
void updateDataViews ()
 
void writeGeometryToFile (QString gliName, QString fileName)
 
void writeStationListToFile (QString listName, QString fileName)
 
void on_actionExportVTK_triggered (bool checked=false)
 
void on_actionExportVRML2_triggered (bool checked=false)
 
void on_actionExportObj_triggered (bool checked=false)
 
void createPresentationMenu ()
 
void startPresentationMode ()
 
void quitPresentationMode ()
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 

Private Member Functions

QMenu * createImportFilesMenu ()
 
void loadFile (ImportFileType::type t, const QString &fileName)
 
void loadFEMConditionsFromFile (const QString &fileName, std::string geoName="")
 
void readSettings ()
 
void writeSettings ()
 
QString getLastUsedDir ()
 

Private Attributes

DataHolderLib::Project _project
 
std::unique_ptr< MeshModel_meshModel
 
std::unique_ptr< ElementTreeModel_elementModel
 
std::unique_ptr< ProcessModel_processModel
 
std::unique_ptr< FemConditionModel_conditionModel
 
std::unique_ptr< VtkVisPipeline_vtkVisPipeline
 
QList< QRect > _screenGeometries
 
std::unique_ptr< QWidget > _vtkWidget
 
QByteArray _windowState
 
std::unique_ptr< VisPrefsDialog_visPrefsDialog
 
std::unique_ptr< GEOModels_geo_model
 

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( QWidget *  parent = nullptr)
explicit

Definition at line 100 of file mainwindow.cpp.

100 : QMainWindow(parent)
101{
102 setupUi(this);
103
104 // Setup various models
105 _geo_model = std::make_unique<GEOModels>(_project.getGEOObjects());
106 _meshModel = std::make_unique<MeshModel>(_project);
107 _elementModel = std::make_unique<ElementTreeModel>();
108 _processModel = std::make_unique<ProcessModel>(_project);
109 _conditionModel = std::make_unique<FemConditionModel>();
110
111 geoTabWidget->treeView->setModel(_geo_model->getGeoModel());
112 stationTabWidget->treeView->setModel(_geo_model->getStationModel());
113 meshTabWidget->treeView->setModel(_meshModel.get());
114 meshTabWidget->elementView->setModel(_elementModel.get());
115 modellingTabWidget->treeView->setModel(_processModel.get());
116 modellingTabWidget->conditionView->setModel(_conditionModel.get());
117
118 // vtk visualization pipeline
120 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
121
122 // station model connects
123 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(int)), this,
124 SLOT(open(int)));
125 connect(stationTabWidget->treeView,
126 SIGNAL(stationListExportRequested(std::string, std::string)), this,
128 std::string, std::string))); // export Stationlist to GMS
129 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
130 _geo_model.get(),
131 SLOT(removeStationVec(
132 std::string))); // update model when stations are removed
133 connect(stationTabWidget->treeView,
134 SIGNAL(stationListSaved(QString, QString)), this,
135 SLOT(writeStationListToFile(QString,
136 QString))); // save Stationlist to File
137 connect(
138 _geo_model.get(),
139 SIGNAL(stationVectorRemoved(StationTreeModel*, std::string)), this,
140 SLOT(updateDataViews())); // update data view when stations are removed
141 connect(stationTabWidget->treeView,
142 SIGNAL(requestNameChangeDialog(const std::string&, std::size_t)),
143 this, SLOT(showStationNameDialog(const std::string&, std::size_t)));
144 connect(stationTabWidget->treeView,
145 SIGNAL(geometryMappingRequested(const std::string&)), this,
146 SLOT(mapGeometry(const std::string&)));
147 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
148 this,
150 QModelIndex&))); // connect treeview to diagramview
151
152 // geo model connects
153 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(int)), this,
154 SLOT(open(int)));
155 connect(geoTabWidget->treeView,
156 SIGNAL(listRemoved(std::string, GeoLib::GEOTYPE)), _geo_model.get(),
157 SLOT(removeGeometry(std::string, GeoLib::GEOTYPE)));
158 connect(geoTabWidget->treeView,
159 SIGNAL(geometryMappingRequested(const std::string&)), this,
160 SLOT(mapGeometry(const std::string&)));
161 connect(
162 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
163 this,
164 SLOT(writeGeometryToFile(QString, QString))); // save geometry to file
165 connect(geoTabWidget->treeView,
166 SIGNAL(requestPointToStationConversion(std::string const&)), this,
167 SLOT(convertPointsToStations(std::string const&)));
168 connect(
169 geoTabWidget->treeView,
170 SIGNAL(requestLineEditDialog(const std::string&)), this,
171 SLOT(showLineEditDialog(const std::string&))); // open line edit dialog
172 connect(geoTabWidget->treeView,
173 SIGNAL(requestNameChangeDialog(const std::string&,
174 const GeoLib::GEOTYPE, std::size_t)),
175 this,
176 SLOT(showGeoNameDialog(const std::string&, const GeoLib::GEOTYPE,
177 std::size_t)));
178 connect(_geo_model.get(),
179 SIGNAL(geoDataAdded(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
180 this, SLOT(updateDataViews()));
181 connect(_geo_model.get(),
182 SIGNAL(geoDataRemoved(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
183 this, SLOT(updateDataViews()));
184 connect(geoTabWidget->treeView,
185 SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)),
186 _vtkVisPipeline.get(),
187 SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int)));
188 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
189 _vtkVisPipeline.get(), SLOT(removeHighlightedGeoObject()));
190 connect(stationTabWidget->treeView,
191 SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)),
192 _vtkVisPipeline.get(),
193 SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int)));
194 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
195 _vtkVisPipeline.get(), SLOT(removeHighlightedGeoObject()));
196
197 // Setup connections for mesh models to GUI
198 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(int)), this,
199 SLOT(open(int)));
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(),
205 SLOT(clearView()));
206 connect(
207 meshTabWidget->treeView,
208 SIGNAL(qualityCheckRequested(MeshLib::VtkMappedMeshSource*)),
209 this,
211 connect(meshTabWidget->treeView,
212 SIGNAL(requestMeshToGeometryConversion(const MeshLib::Mesh*)), this,
214 connect(meshTabWidget->treeView,
215 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
216 unsigned, bool)),
217 _vtkVisPipeline.get(),
218 SLOT(highlightMeshComponent(
219 vtkUnstructuredGridAlgorithm const* const, unsigned, bool)));
220 connect(meshTabWidget->treeView, SIGNAL(meshSelected(MeshLib::Mesh const&)),
221 this->_elementModel.get(), SLOT(setMesh(MeshLib::Mesh const&)));
222 connect(meshTabWidget->treeView, SIGNAL(meshSelected(MeshLib::Mesh const&)),
223 meshTabWidget->elementView, SLOT(updateView()));
224 connect(
225 meshTabWidget->treeView,
226 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
227 unsigned, bool)),
228 this->_elementModel.get(),
229 SLOT(setElement(vtkUnstructuredGridAlgorithm const* const, unsigned)));
230 connect(meshTabWidget->treeView,
231 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
232 unsigned, bool)),
233 meshTabWidget->elementView, SLOT(updateView()));
234 connect(meshTabWidget->treeView,
235 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const,
236 unsigned, bool)),
237 reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
238 SLOT(removeHighlightActor()));
239 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
240 _vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent()));
241 connect(meshTabWidget->elementView,
242 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const* const,
243 unsigned, bool)),
244 reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
245 SLOT(removeHighlightActor()));
246 connect(meshTabWidget->elementView,
247 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const* const,
248 unsigned, bool)),
249 _vtkVisPipeline.get(),
250 SLOT(highlightMeshComponent(
251 vtkUnstructuredGridAlgorithm const* const, unsigned, bool)));
252 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
253 _vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent()));
254
255 // Connection for process model to GUI
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&)),
261 _processModel.get(),
262 SLOT(removeCondition(QString const&, QString const&)));
263 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
264 _conditionModel.get(), SLOT(clearView()));
265 connect(modellingTabWidget->treeView,
266 SIGNAL(processVarSelected(DataHolderLib::FemCondition*)),
267 _conditionModel.get(),
268 SLOT(setProcessVariable(DataHolderLib::FemCondition*)));
269 connect(modellingTabWidget->treeView,
270 SIGNAL(conditionSelected(DataHolderLib::FemCondition*)),
271 _conditionModel.get(),
272 SLOT(setFemCondition(DataHolderLib::FemCondition*)));
273 connect(modellingTabWidget->treeView,
274 SIGNAL(processVarSelected(DataHolderLib::FemCondition*)),
275 modellingTabWidget->conditionView, SLOT(updateView()));
276 connect(modellingTabWidget->treeView,
277 SIGNAL(conditionSelected(DataHolderLib::FemCondition*)),
278 modellingTabWidget->conditionView, SLOT(updateView()));
279
280 // VisPipeline Connects
281 connect(_geo_model.get(),
282 SIGNAL(geoDataAdded(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
283 _vtkVisPipeline.get(),
284 SLOT(addPipelineItem(GeoTreeModel*, std::string, GeoLib::GEOTYPE)));
285 connect(
286 _geo_model.get(),
287 SIGNAL(geoDataRemoved(GeoTreeModel*, std::string, GeoLib::GEOTYPE)),
288 _vtkVisPipeline.get(),
289 SLOT(removeSourceItem(GeoTreeModel*, std::string, GeoLib::GEOTYPE)));
290
291 connect(_geo_model.get(),
292 SIGNAL(stationVectorAdded(StationTreeModel*, std::string)),
293 _vtkVisPipeline.get(),
294 SLOT(addPipelineItem(StationTreeModel*, std::string)));
295 connect(_geo_model.get(),
296 SIGNAL(stationVectorRemoved(StationTreeModel*, std::string)),
297 _vtkVisPipeline.get(),
298 SLOT(removeSourceItem(StationTreeModel*, std::string)));
299
300 connect(_meshModel.get(), SIGNAL(meshAdded(MeshModel*, QModelIndex)),
301 _vtkVisPipeline.get(),
302 SLOT(addPipelineItem(MeshModel*, QModelIndex)));
303 connect(_meshModel.get(), SIGNAL(meshRemoved(MeshModel*, QModelIndex)),
304 _vtkVisPipeline.get(),
305 SLOT(removeSourceItem(MeshModel*, QModelIndex)));
306
307 connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
308 visualizationWidget->vtkWidget, SLOT(update()));
309 connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
310 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
311 connect(_vtkVisPipeline.get(), SIGNAL(itemSelected(const QModelIndex&)),
312 vtkVisTabWidget->vtkVisPipelineView,
313 SLOT(selectItem(const QModelIndex&)));
314
315 vtkVisTabWidget->vtkVisPipelineView->setModel(_vtkVisPipeline.get());
316 connect(vtkVisTabWidget->vtkVisPipelineView,
317 SIGNAL(requestRemovePipelineItem(QModelIndex)),
318 _vtkVisPipeline.get(), SLOT(removePipelineItem(QModelIndex)));
319 connect(vtkVisTabWidget->vtkVisPipelineView,
320 SIGNAL(requestAddPipelineFilterItem(QModelIndex)), this,
321 SLOT(showAddPipelineFilterItemDialog(QModelIndex)));
322 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
323 SLOT(updateView()));
324
325 connect(vtkVisTabWidget->vtkVisPipelineView,
326 SIGNAL(actorSelected(vtkProp3D*)),
327 reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
328 SLOT(highlightActor(vtkProp3D*)));
329 connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()),
330 visualizationWidget, SLOT(updateView()));
331
332 // Propagates selected vtk object in the pipeline to the pick interactor
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,
342 const unsigned)),
343 this->_elementModel.get(),
344 SLOT(setElement(vtkUnstructuredGridAlgorithm const* const,
345 const unsigned)));
346 connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
347 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const,
348 const unsigned)),
349 meshTabWidget->elementView, SLOT(updateView()));
350 connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
351 SIGNAL(clearElementView()), this->_elementModel.get(),
352 SLOT(clearView()));
353 connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()),
354 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const,
355 const unsigned)),
356 this->_vtkVisPipeline.get(),
357 SLOT(removeHighlightedMeshComponent()));
358
359 connect(vtkVisTabWidget->vtkVisPipelineView,
360 SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
361 SLOT(addMesh(MeshLib::Mesh*)));
362
363 // Stack the data dock widgets together
364 tabifyDockWidget(geoDock, mshDock);
365 tabifyDockWidget(mshDock, modellingDock);
366 tabifyDockWidget(modellingDock, stationDock);
367
368 // Restore window geometry
369 readSettings();
370
371 // Get info on screens geometry(ies)
372 _vtkWidget.reset(visualizationWidget->vtkWidget);
373 for (auto const& screen : QGuiApplication::screens())
374 {
375 _screenGeometries.push_back(screen->availableGeometry());
376 }
377
378 // Setup import files menu
379 QMenu* import_files_menu = createImportFilesMenu(); // owned by MainWindow
380 menu_File->insertMenu(action_Exit, import_files_menu);
381
382 // Setup recent files menu
383 RecentFiles* recentFiles =
384 new RecentFiles(this, SLOT(openRecentFile()), "recentFileList");
385 connect(this, SIGNAL(fileUsed(QString)), recentFiles,
386 SLOT(setCurrentFile(QString)));
387 menu_File->insertMenu(action_Exit, recentFiles->menu());
388
389 // Setup Windows menu
390 QAction* showGeoDockAction = geoDock->toggleViewAction();
391 showGeoDockAction->setStatusTip(tr("Shows / hides the geometry view"));
392 connect(showGeoDockAction, SIGNAL(triggered(bool)), this,
393 SLOT(showGeoDockWidget(bool)));
394 menuWindows->addAction(showGeoDockAction);
395
396 QAction* showStationDockAction = stationDock->toggleViewAction();
397 showStationDockAction->setStatusTip(tr("Shows / hides the station view"));
398 connect(showStationDockAction, SIGNAL(triggered(bool)), this,
399 SLOT(showStationDockWidget(bool)));
400 menuWindows->addAction(showStationDockAction);
401
402 QAction* showMshDockAction = mshDock->toggleViewAction();
403 showMshDockAction->setStatusTip(tr("Shows / hides the mesh view"));
404 connect(showMshDockAction, SIGNAL(triggered(bool)), this,
405 SLOT(showMshDockWidget(bool)));
406 menuWindows->addAction(showMshDockAction);
407
408 QAction* showModellingDockAction = modellingDock->toggleViewAction();
409 showModellingDockAction->setStatusTip(tr("Shows / hides the Process view"));
410 connect(showModellingDockAction, SIGNAL(triggered(bool)), this,
411 SLOT(showConditionDockWidget(bool)));
412 menuWindows->addAction(showModellingDockAction);
413
414 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
415 showVisDockAction->setStatusTip(tr("Shows / hides the VTK Pipeline view"));
416 connect(showVisDockAction, SIGNAL(triggered(bool)), this,
417 SLOT(showVisDockWidget(bool)));
418 menuWindows->addAction(showVisDockAction);
419
420 // Presentation mode
421 auto* presentationMenu = new QMenu(this);
422 presentationMenu->setTitle("Presentation on");
423 connect(presentationMenu, SIGNAL(aboutToShow()), this,
424 SLOT(createPresentationMenu()));
425 menuWindows->insertMenu(showVisDockAction, presentationMenu);
426
427 _visPrefsDialog = std::make_unique<VisPrefsDialog>(*_vtkVisPipeline,
428 *visualizationWidget);
429}
Base class for boundary conditions, initial conditions and source terms.
Definition: FemCondition.h:40
GeoLib::GEOObjects & getGEOObjects()
Returns the GEOObjects containing all points, polylines and surfaces.
Definition: Project.h:46
A model for the GeoTreeView implementing a tree as a double-linked list.
Definition: GeoTreeModel.h:41
void showConditionDockWidget(bool show)
Definition: mainwindow.cpp:473
void readSettings()
Definition: mainwindow.cpp:879
std::unique_ptr< MeshModel > _meshModel
Definition: mainwindow.h:127
void open(int file_type=0)
Function calls for opening files.
Definition: mainwindow.cpp:497
QMenu * createImportFilesMenu()
Definition: mainwindow.cpp:921
std::unique_ptr< ElementTreeModel > _elementModel
Definition: mainwindow.h:128
void showStationNameDialog(const std::string &stn_vec_name, std::size_t id)
Allows setting the name for a station.
void writeStationListToFile(QString listName, QString fileName)
void showGeoDockWidget(bool show)
Definition: mainwindow.cpp:437
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)
Definition: mainwindow.cpp:449
std::unique_ptr< VisPrefsDialog > _visPrefsDialog
Definition: mainwindow.h:136
void convertMeshToGeometry(const MeshLib::Mesh *mesh)
void showDiagramPrefsDialog()
Calls the diagram prefs dialog from the Tools menu.
void showMshDockWidget(bool show)
Definition: mainwindow.cpp:461
void showAddPipelineFilterItemDialog(QModelIndex parentIndex)
Definition: mainwindow.cpp:984
void showVisDockWidget(bool show)
Definition: mainwindow.cpp:485
std::unique_ptr< ProcessModel > _processModel
Definition: mainwindow.h:129
void createPresentationMenu()
void openRecentFile()
Definition: mainwindow.cpp:515
DataHolderLib::Project _project
Definition: mainwindow.h:126
void writeGeometryToFile(QString gliName, QString fileName)
Definition: mainwindow.cpp:990
std::unique_ptr< GEOModels > _geo_model
Definition: mainwindow.h:138
std::unique_ptr< VtkVisPipeline > _vtkVisPipeline
Definition: mainwindow.h:131
std::unique_ptr< QWidget > _vtkWidget
Definition: mainwindow.h:133
void mapGeometry(const std::string &geo_name)
void showMeshQualitySelectionDialog(MeshLib::VtkMappedMeshSource *mshSource)
QList< QRect > _screenGeometries
Definition: mainwindow.h:132
void fileUsed(QString filename)
std::unique_ptr< FemConditionModel > _conditionModel
Definition: mainwindow.h:130
void updateDataViews()
Definition: mainwindow.cpp:871
void convertPointsToStations(std::string const &geo_name)
void exportBoreholesToGMS(std::string listName, std::string fileName)
Function calls for GMS export.
QMenu * menu()
Returns the created menu. Add this menu to your QMainWindow menu.
Definition: RecentFiles.cpp:42
A model for the StationTreeView implementing a tree as a double-linked list.
GEOTYPE
Definition: GeoType.h:25

References _conditionModel, _elementModel, _geo_model, _meshModel, _processModel, _project, _screenGeometries, _visPrefsDialog, _vtkVisPipeline, _vtkWidget, convertMeshToGeometry(), convertPointsToStations(), createImportFilesMenu(), createPresentationMenu(), exportBoreholesToGMS(), fileUsed(), DataHolderLib::Project::getGEOObjects(), mapGeometry(), RecentFiles::menu(), open(), openRecentFile(), readSettings(), showAddPipelineFilterItemDialog(), showConditionDockWidget(), showDiagramPrefsDialog(), showGeoDockWidget(), showGeoNameDialog(), showLineEditDialog(), showMeshQualitySelectionDialog(), showMshDockWidget(), showStationDockWidget(), showStationNameDialog(), showVisDockWidget(), updateDataViews(), writeGeometryToFile(), and writeStationListToFile().

Member Function Documentation

◆ about

void MainWindow::about ( )
protectedslot

Definition at line 901 of file mainwindow.cpp.

902{
903 QString about(
904 "<a href='https://www.opengeosys.org'>www.opengeosys.org</a><br /><br "
905 "/>");
906 about.append(
907 QString("Version: %1<br />")
908 .arg(QString::fromStdString(GitInfoLib::GitInfo::ogs_version)));
909
910 about.append(
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)));
917
918 QMessageBox::about(this, "About OpenGeoSys 6", about);
919}
void about()
Definition: mainwindow.cpp:901
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.
Definition: MFront.cpp:103

References about(), GitInfoLib::GitInfo::git_version_sha1_short, GitInfoLib::GitInfo::ogs_version, and MaterialLib::Solids::MFront::toString().

Referenced by about().

◆ callGMSH

void MainWindow::callGMSH ( std::vector< std::string > &  selectedGeometries,
unsigned  param1,
double  param2,
double  param3,
double  param4,
bool  delete_geo_file 
)
protectedslot

Function calls for generating GMSH files from the GUI.

Definition at line 1123 of file mainwindow.cpp.

1126{
1127 if (!selectedGeometries.empty())
1128 {
1129 INFO("Start meshing ...");
1130
1131 QString fileName("");
1132 QString dir_str = this->getLastUsedDir();
1133
1134 if (!delete_geo_file)
1135 {
1136 fileName = QFileDialog::getSaveFileName(
1137 this, "Save GMSH-file as",
1138 LastSavedFileDirectory::getDir() + "tmp_gmsh.geo",
1139 "GMSH geometry files (*.geo)");
1140 }
1141 else
1142 {
1143 fileName = "tmp_gmsh.geo";
1144 }
1145
1146 if (!fileName.isEmpty())
1147 {
1148 try
1149 {
1150 if (param4 == -1)
1151 { // adaptive meshing selected
1153 _project.getGEOObjects(), true,
1155 param2, param3, param1, selectedGeometries, false,
1156 false);
1157 BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1158 fileName.toStdString());
1159 }
1160 else
1161 { // homogeneous meshing selected
1163 _project.getGEOObjects(), true,
1165 param4, param3, param1, selectedGeometries, false,
1166 false);
1167 BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
1168 fileName.toStdString());
1169 }
1170
1171 if (system(nullptr) != 0) // command processor available
1172 {
1173 QSettings settings;
1174 std::string gmsh_path =
1175 settings.value("DataExplorerGmshPath")
1176 .toString()
1177 .toStdString();
1178
1179 if (!gmsh_path.empty())
1180 {
1181 std::string fname(fileName.toStdString());
1182 std::string gmsh_command =
1183 "\"" + gmsh_path + "\" -2 -algo meshadapt " + fname;
1184 std::size_t pos(fname.rfind("."));
1185 if (pos != std::string::npos)
1186 {
1187 fname = fname.substr(0, pos);
1188 }
1189 gmsh_command += " -o " + fname + ".msh";
1190 // Newer gmsh versions write a newer file format for
1191 // meshes per default. At the moment we can't read this
1192 // new format. This is a switch for gmsh to write the
1193 // 'old' file format.
1194 gmsh_command += " -format msh22";
1195 auto const return_value =
1196 std::system(gmsh_command.c_str());
1197 if (return_value != 0)
1198 {
1199 QString const message =
1200 "Execution of gmsh command returned non-zero "
1201 "status, " +
1202 QString::number(return_value);
1203 OGSError::box(message, "Error");
1204 }
1205 else
1206 {
1208 fileName.left(fileName.length() - 3)
1209 .append("msh"));
1210 }
1211 }
1212 else
1213 {
1214 OGSError::box("Location of GMSH not specified.",
1215 "Error");
1216 }
1217 }
1218 else
1219 {
1221 "Error executing command gmsh - no command processor "
1222 "available",
1223 "Error");
1224 }
1225 }
1226 catch (std::runtime_error& error)
1227 {
1228 OGSError::box(QString(error.what()) +
1229 QString("\n Please cleanup the input data."),
1230 "ERROR");
1231 }
1232 if (delete_geo_file)
1233 {
1234 BaseLib::removeFile(fileName.toStdString());
1235 }
1236 }
1237 }
1238 else
1239 INFO("No geometry information selected.");
1240 QApplication::restoreOverrideCursor();
1241}
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:34
Reads and writes GMSH-files to and from OGS data structures.
Definition: GMSHInterface.h:46
static const QString getDir()
Returns the directory last used for saving a file.
void loadFile(ImportFileType::type t, const QString &fileName)
Definition: mainwindow.cpp:572
QString getLastUsedDir()
static void box(const QString &e)
Definition: OGSError.cpp:23
int writeStringToFile(std::string content, std::filesystem::path const &file_path)
Definition: Writer.cpp:45
void removeFile(std::string const &filename)
Definition: FileTools.cpp:237
@ AdaptiveMeshDensity
computing the mesh density employing a QuadTree
@ FixedMeshDensity
set the parameter with a fixed value

References _project, FileIO::GMSH::AdaptiveMeshDensity, OGSError::box(), FileIO::GMSH::FixedMeshDensity, LastSavedFileDirectory::getDir(), DataHolderLib::Project::getGEOObjects(), getLastUsedDir(), ImportFileType::GMSH, INFO(), loadFile(), BaseLib::removeFile(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by showGMSHPrefsDialog().

◆ closeEvent()

void MainWindow::closeEvent ( QCloseEvent *  event)
overrideprotected

Definition at line 431 of file mainwindow.cpp.

432{
434 QWidget::closeEvent(event);
435}
void writeSettings()
Definition: mainwindow.cpp:887

References writeSettings().

◆ convertMeshToGeometry

void MainWindow::convertMeshToGeometry ( const MeshLib::Mesh mesh)
protectedslot

Definition at line 1110 of file mainwindow.cpp.

1111{
1113}
bool convertMeshToGeo(const MeshLib::Mesh &mesh, GeoLib::GEOObjects &geo_objects, double const eps)

References _project, MeshLib::convertMeshToGeo(), and DataHolderLib::Project::getGEOObjects().

Referenced by MainWindow().

◆ convertPointsToStations

void MainWindow::convertPointsToStations ( std::string const &  geo_name)
protectedslot

Definition at line 1348 of file mainwindow.cpp.

1349{
1350 std::string stn_name = geo_name + " Stations";
1352 stn_name);
1353 if (ret == 1)
1354 {
1355 OGSError::box("No points found to convert.");
1356 }
1357}
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.
Definition: GEOObjects.cpp:615

References _project, OGSError::box(), GeoLib::geoPointsToStations(), and DataHolderLib::Project::getGEOObjects().

Referenced by MainWindow().

◆ createImportFilesMenu()

QMenu * MainWindow::createImportFilesMenu ( )
private

Definition at line 921 of file mainwindow.cpp.

922{
923 QMenu* importFiles = new QMenu("&Import Files", this);
924 importFiles->addAction("&FEFLOW Files...",
925 [this] { open(ImportFileType::FEFLOW); });
926 importFiles->addAction("G&MS Files...",
927 [this] { open(ImportFileType::GMS); });
928 importFiles->addAction("&GMSH Files...",
929 [this] { open(ImportFileType::GMSH); });
930 importFiles->addAction("&Gocad TSurface...",
931 [this] { open(ImportFileType::GOCAD_TSURF); });
932#ifdef OGS_USE_NETCDF
933 importFiles->addAction("&NetCDF Files...",
934 [this] { open(ImportFileType::NETCDF); });
935#endif // OGS_USE_NETCDF
936 importFiles->addAction("&Petrel Files...", [this] { loadPetrelFiles(); });
937 importFiles->addAction("&Raster Files...",
938 [this] { open(ImportFileType::RASTER); });
939 importFiles->addAction("&Shape Files...",
940 [this] { open(ImportFileType::SHAPE); });
941 importFiles->addAction("&TetGen Files...",
942 [this] { open(ImportFileType::TETGEN); });
943 importFiles->addAction("&VTK Files...",
944 [this] { open(ImportFileType::VTK); });
945 return importFiles;
946}
void loadPetrelFiles()
Definition: mainwindow.cpp:948

References ImportFileType::FEFLOW, ImportFileType::GMS, ImportFileType::GMSH, ImportFileType::GOCAD_TSURF, loadPetrelFiles(), ImportFileType::NETCDF, open(), ImportFileType::RASTER, ImportFileType::SHAPE, ImportFileType::TETGEN, and ImportFileType::VTK.

Referenced by MainWindow().

◆ createPresentationMenu

void MainWindow::createPresentationMenu ( )
protectedslot

Definition at line 1531 of file mainwindow.cpp.

1532{
1533 auto* menu = static_cast<QMenu*>(QObject::sender());
1534 menu->clear();
1535 if (!_vtkWidget->parent())
1536 {
1537 QAction* action = new QAction("Quit presentation mode", menu);
1538 connect(action, SIGNAL(triggered()), this,
1539 SLOT(quitPresentationMode()));
1540 action->setShortcutContext(Qt::WidgetShortcut);
1541 action->setShortcut(QKeySequence(Qt::Key_Escape));
1542 menu->addAction(action);
1543 }
1544 else
1545 {
1546 int count = 0;
1547 const int currentScreen =
1548 QApplication::desktop()->screenNumber(visualizationWidget);
1549 foreach (QRect screenGeo, _screenGeometries)
1550 {
1551 Q_UNUSED(screenGeo);
1552 QAction* action =
1553 new QAction(QString("On screen %1").arg(count), menu);
1554 connect(action, SIGNAL(triggered()), this,
1555 SLOT(startPresentationMode()));
1556 if (count == currentScreen)
1557 {
1558 action->setEnabled(false);
1559 }
1560 menu->addAction(action);
1561 ++count;
1562 }
1563 }
1564}
void quitPresentationMode()
void startPresentationMode()

References _screenGeometries, _vtkWidget, quitPresentationMode(), and startPresentationMode().

Referenced by MainWindow().

◆ exportBoreholesToGMS

void MainWindow::exportBoreholesToGMS ( std::string  listName,
std::string  fileName 
)
protectedslot

Function calls for GMS export.

Definition at line 1115 of file mainwindow.cpp.

1117{
1118 const std::vector<GeoLib::Point*>* stations(
1120 GMSInterface::writeBoreholesToGMS(stations, fileName);
1121}
const std::vector< GeoLib::Point * > * getStationVec(const std::string &name) const
Returns the station vector with the given name.
Definition: GEOObjects.cpp:133

References _project, DataHolderLib::Project::getGEOObjects(), and GeoLib::GEOObjects::getStationVec().

Referenced by MainWindow().

◆ FEMTestStart

void MainWindow::FEMTestStart ( )
protectedslot

Testing functionality for connection to FEM lib.

Definition at line 1437 of file mainwindow.cpp.

1437{}

◆ fileOpenRequested

void MainWindow::fileOpenRequested ( int  )
signal

◆ fileUsed

void MainWindow::fileUsed ( QString  filename)
signal

Referenced by MainWindow(), and loadFile().

◆ getLastUsedDir()

QString MainWindow::getLastUsedDir ( )
private

Definition at line 1611 of file mainwindow.cpp.

1612{
1613 QSettings settings;
1614 QString fileName("");
1615 QStringList files = settings.value("recentFileList").toStringList();
1616 if (!files.empty())
1617 {
1618 return QFileInfo(files[0]).absolutePath();
1619 }
1620
1621 return QDir::homePath();
1622}

Referenced by callGMSH().

◆ HideWindow()

void MainWindow::HideWindow ( )

Definition at line 1444 of file mainwindow.cpp.

1445{
1446 this->hide();
1447}

◆ loadFEMConditionsFromFile()

void MainWindow::loadFEMConditionsFromFile ( const QString &  fileName,
std::string  geoName = "" 
)
private

◆ loadFile()

void MainWindow::loadFile ( ImportFileType::type  t,
const QString &  fileName 
)
private

Definition at line 572 of file mainwindow.cpp.

573{
574 QFile file(fileName);
575 if (!file.exists())
576 {
577 QMessageBox::warning(this, tr("Application"),
578 tr("Cannot read file %1:\n%2.")
579 .arg(fileName)
580 .arg(file.errorString()));
581 return;
582 }
583
584 QApplication::setOverrideCursor(Qt::WaitCursor);
585 QFileInfo fi(fileName);
586 QSettings settings;
587 QDir dir = QDir(fileName);
588 std::string base =
589 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
590
593 {
594 if (fi.suffix().toLower() == "gli")
595 {
596 std::string unique_name;
597 std::vector<std::string> errors;
598 std::string const gmsh_path =
599 settings.value("DataExplorerGmshPath").toString().toStdString();
600 if (!FileIO::Legacy::readGLIFileV4(fileName.toStdString(),
602 unique_name, errors, gmsh_path))
603 {
604 for (auto& error : errors)
605 {
606 OGSError::box(QString::fromStdString(error));
607 }
608 }
609 }
610 else if (fi.suffix().toLower() == "prj")
611 {
613 if (xml.readFile(fileName))
614 {
615 _meshModel->updateModel();
616 _processModel->updateModel();
617 }
618 else
619 {
621 "Failed to load project file.\n Please see console for "
622 "details.");
623 }
624 }
625 else if (fi.suffix().toLower() == "gml")
626 {
628 try
629 {
630 if (!xml.readFile(fileName))
631 {
633 "Failed to load geometry.\n Please see console for "
634 "details.");
635 }
636 }
637 catch (std::runtime_error const& err)
638 {
639 OGSError::box(err.what(),
640 "Failed to read file `" + fileName + "'");
641 }
642 }
643 // OpenGeoSys observation station files (incl. boreholes)
644 else if (fi.suffix().toLower() == "stn")
645 {
647 if (!xml.readFile(fileName))
648 {
650 "Failed to load station data.\n Please see console for "
651 "details.");
652 }
653 }
654 // OpenGeoSys mesh files
655 else if (fi.suffix().toLower() == "msh" ||
656 fi.suffix().toLower() == "vtu" ||
657 fi.suffix().toLower() == "vtk")
658 {
659#ifndef NDEBUG
660 QElapsedTimer myTimer;
661 myTimer.start();
662#endif
663 std::unique_ptr<MeshLib::Mesh> mesh(
664 MeshLib::IO::readMeshFromFile(fileName.toStdString()));
665#ifndef NDEBUG
666 INFO("Mesh loading time: {:d} ms.", myTimer.restart());
667#endif
668 if (mesh)
669 {
670 _meshModel->addMesh(std::move(mesh));
671 }
672 else
673 {
674 OGSError::box("Failed to load mesh file.");
675 }
676#ifndef NDEBUG
677 INFO("Mesh model setup time: {:d} ms.", myTimer.elapsed());
678#endif
679 }
680
681 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
682 emit fileUsed(fileName);
683 }
684 else if (t == ImportFileType::FEFLOW)
685 {
686 if (fi.suffix().toLower() == "fem") // FEFLOW model files
687 {
688 FileIO::FEFLOWMeshInterface feflowMeshIO;
689 std::unique_ptr<MeshLib::Mesh> mesh(
690 feflowMeshIO.readFEFLOWFile(fileName.toStdString()));
691 if (mesh)
692 {
693 _meshModel->addMesh(std::move(mesh));
694 }
695 else
696 {
697 OGSError::box("Failed to load a FEFLOW mesh.");
698 }
699 FileIO::FEFLOWGeoInterface feflowGeoIO;
700 feflowGeoIO.readFEFLOWFile(fileName.toStdString(),
702 }
703 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
704 }
705 else if (t == ImportFileType::GMS)
706 {
707 if (fi.suffix().toLower() == "txt") // GMS borehole files
708 {
709 std::vector<GeoLib::Point*> boreholes;
710 std::string name = fi.baseName().toStdString();
711
712 if (GMSInterface::readBoreholesFromGMS(boreholes,
713 fileName.toStdString()))
714 {
715 _project.getGEOObjects().addStationVec(std::move(boreholes),
716 name);
717 }
718 else
719 {
720 OGSError::box("Error reading GMS file.");
721 }
722 }
723 else if (fi.suffix().toLower() == "3dm") // GMS mesh files
724 {
725 std::string name = fileName.toStdString();
726 std::unique_ptr<MeshLib::Mesh> mesh(
727 GMSInterface::readGMS3DMMesh(name));
728 if (mesh)
729 {
730 _meshModel->addMesh(std::move(mesh));
731 }
732 else
733 {
734 OGSError::box("Failed to load a GMS mesh.");
735 }
736 }
737 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
738 }
739 else if (t == ImportFileType::GMSH)
740 {
741 std::string msh_name(fileName.toStdString());
742 if (FileIO::GMSH::isGMSHMeshFile(msh_name))
743 {
744 std::unique_ptr<MeshLib::Mesh> mesh(
746 if (mesh)
747 {
748 _meshModel->addMesh(std::move(mesh));
749 }
750 else
751 {
752 OGSError::box("Failed to load a GMSH mesh.");
753 }
754 }
755 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
756 }
757 else if (t == ImportFileType::GOCAD_TSURF)
758 {
759 std::string file_name(fileName.toStdString());
760 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
761 if (FileIO::Gocad::GocadAsciiReader::readFile(file_name, meshes))
762 {
763 for (auto& mesh : meshes)
764 {
765 if (mesh != nullptr)
766 {
767 _meshModel->addMesh(std::move(mesh));
768 }
769 }
770 }
771 else
772 {
773 OGSError::box("Error reading file.");
774 }
775 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
776 }
777#ifdef OGS_USE_NETCDF
778 else if (t == ImportFileType::NETCDF) // CH 01.2012
779 {
780 NetCdfConfigureDialog dlg(fileName.toStdString());
781 dlg.exec();
782 if (dlg.getMesh())
783 {
784 std::unique_ptr<MeshLib::Mesh> mesh(dlg.getMesh());
785 mesh->setName(dlg.getName());
786 _meshModel->addMesh(std::move(mesh));
787 }
788 if (dlg.getRaster())
789 _vtkVisPipeline->addPipelineItem(dlg.getRaster());
790
791 settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
792 }
793#endif // OGS_USE_NETCDF
794 else if (t == ImportFileType::RASTER)
795 {
797 if (geoImage->readImage(fileName))
798 {
799 _vtkVisPipeline->addPipelineItem(geoImage);
800 }
801 else
802 {
803 geoImage->Delete();
804 OGSError::box("Error reading raster.");
805 }
806 settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
807 }
808 else if (t == ImportFileType::POLYRASTER)
809 {
810 QImage raster;
811 vtkImageAlgorithm* img = VtkRaster::loadImage(fileName.toStdString());
813 double* origin = img->GetOutput()->GetOrigin();
814 bg->SetRaster(img, origin[0], origin[1],
815 img->GetOutput()->GetSpacing()[0]);
816 bg->SetName(fileName);
817 _vtkVisPipeline->addPipelineItem(bg);
818 settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
819 }
820 else if (t == ImportFileType::SHAPE)
821 {
822 SHPImportDialog dlg(
823 fileName.toStdString(), _project.getGEOObjects(),
824 settings.value("DataExplorerGmshPath").toString().toStdString());
825 dlg.exec();
826 QDir dir = QDir(fileName);
827 settings.setValue("lastOpenedShapeFileDirectory", dir.absolutePath());
828 }
829 else if (t == ImportFileType::TETGEN)
830 {
831 if (fi.suffix().toLower().compare("poly") == 0 ||
832 fi.suffix().toLower().compare("smesh") == 0)
833 {
835 tetgen.readTetGenGeometry(fileName.toStdString(),
837 }
838 else
839 {
840 settings.setValue("lastOpenedTetgenFileDirectory",
841 QFileInfo(fileName).absolutePath());
842 QString element_fname(fi.path() + "/" + fi.completeBaseName() +
843 ".ele");
844
845 if (!fileName.isEmpty())
846 {
848 std::unique_ptr<MeshLib::Mesh> mesh(tetgen.readTetGenMesh(
849 fileName.toStdString(), element_fname.toStdString()));
850 if (mesh)
851 {
852 _meshModel->addMesh(std::move(mesh));
853 }
854 else
855 {
856 OGSError::box("Failed to load a TetGen mesh.");
857 }
858 }
859 }
860 }
861 else if (t == ImportFileType::VTK)
862 {
863 _vtkVisPipeline->loadFromFile(fileName);
864 settings.setValue("lastOpenedVtkFileDirectory", dir.absolutePath());
865 }
866
867 QApplication::restoreOverrideCursor();
869}
void readFEFLOWFile(const std::string &filename, GeoLib::GEOObjects &geo_objects)
MeshLib::Mesh * readFEFLOWFile(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)
void addStationVec(std::vector< Point * > &&stations, std::string &name)
Adds a vector of stations with the given name and colour to GEOObjects.
Definition: GEOObjects.cpp:123
Reads and writes GeoObjects to and from XML files.
Reads and writes Observation Sites to and from XML files.
The dialog for converting data from NetCDF-files into OGS data structures. While NetCDF files can inc...
Dialog for selecting which information should be loaded from a shape file.
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.
Definition: VtkRaster.cpp:43
bool isGMSHMeshFile(const std::string &fname)
Definition: GmshReader.cpp:36
MeshLib::Mesh * readGMSHMesh(std::string const &fname)
Definition: GmshReader.cpp:270
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)
Definition: OGSIOVer4.cpp:518
static const double t
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)

References _meshModel, _processModel, _project, _vtkVisPipeline, GeoLib::GEOObjects::addStationVec(), OGSError::box(), ImportFileType::FEFLOW, fileUsed(), DataHolderLib::Project::getGEOObjects(), NetCdfConfigureDialog::getMesh(), NetCdfConfigureDialog::getName(), NetCdfConfigureDialog::getRaster(), ImportFileType::GMS, ImportFileType::GMSH, ImportFileType::GOCAD_TSURF, INFO(), FileIO::GMSH::isGMSHMeshFile(), VtkRaster::loadImage(), MaterialPropertyLib::name, ImportFileType::NETCDF, VtkBGImageSource::New(), VtkGeoImageSource::New(), ImportFileType::OGS, ImportFileType::OGS_GEO, ImportFileType::OGS_MSH, ImportFileType::OGS_STN, ImportFileType::POLYRASTER, ImportFileType::RASTER, FileIO::FEFLOWMeshInterface::readFEFLOWFile(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), FileIO::XmlPrjInterface::readFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::XmlStnInterface::readFile(), FileIO::Gocad::GocadAsciiReader::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::GMSH::readGMSHMesh(), VtkGeoImageSource::readImage(), MeshLib::IO::readMeshFromFile(), FileIO::TetGenInterface::readTetGenGeometry(), FileIO::TetGenInterface::readTetGenMesh(), VtkAlgorithmProperties::SetName(), VtkBGImageSource::SetRaster(), ImportFileType::SHAPE, MathLib::t, ImportFileType::TETGEN, updateDataViews(), and ImportFileType::VTK.

Referenced by callGMSH(), loadFileOnStartUp(), open(), and openRecentFile().

◆ loadFileOnStartUp()

void MainWindow::loadFileOnStartUp ( const QString &  fileName)

Definition at line 1449 of file mainwindow.cpp.

1450{
1451 QString ext = QFileInfo(fileName).suffix();
1452 if (ext == "msh" || ext == "vtu" || ext == "gli" || ext == "gml")
1453 {
1454 this->loadFile(ImportFileType::OGS, fileName);
1455 }
1456}

References loadFile(), and ImportFileType::OGS.

◆ loadPetrelFiles

void MainWindow::loadPetrelFiles ( )
protectedslot

Definition at line 948 of file mainwindow.cpp.

949{
950 QSettings settings;
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", "",
955 "Petrel files (*)");
956 if (!sfc_file_names.empty() || !well_path_file_names.empty())
957 {
958 QStringList::const_iterator it = sfc_file_names.begin();
959 std::list<std::string> sfc_files;
960 while (it != sfc_file_names.end())
961 {
962 sfc_files.push_back((*it).toStdString());
963 ++it;
964 }
965
966 it = well_path_file_names.begin();
967 std::list<std::string> well_path_files;
968 while (it != well_path_file_names.end())
969 {
970 well_path_files.push_back((*it).toStdString());
971 ++it;
972 }
973
974 std::string unique_str(*(sfc_files.begin()));
975
976 PetrelInterface(sfc_files, well_path_files, unique_str,
978
979 QDir dir = QDir(sfc_file_names.at(0));
980 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
981 }
982}

References _project, and DataHolderLib::Project::getGEOObjects().

Referenced by createImportFilesMenu().

◆ mapGeometry

void MainWindow::mapGeometry ( const std::string &  geo_name)
protectedslot

Definition at line 1013 of file mainwindow.cpp.

1014{
1016 if (dlg.exec() != QDialog::Accepted)
1017 {
1018 return;
1019 }
1020
1021 int choice(dlg.getDataSetChoice());
1022
1023 QString file_name("");
1024 if (choice < 2) // load something from a file
1025 {
1026 QString file_type[2] = {"OpenGeoSys mesh files (*.vtu *.msh)",
1027 "Raster files(*.asc *.grd)"};
1028 QSettings settings;
1029 file_name = QFileDialog::getOpenFileName(
1030 this,
1031 "Select file for mapping",
1032 settings.value("lastOpenedFileDirectory").toString(),
1033 file_type[choice]);
1034 if (file_name.isEmpty())
1035 {
1036 return;
1037 }
1038 QDir dir = QDir(file_name);
1039 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1040 }
1041
1042 MeshGeoToolsLib::GeoMapper geo_mapper(_project.getGEOObjects(), geo_name);
1043 QFileInfo fi(file_name);
1044 if (choice == 1) // load raster from file
1045 {
1046 if (fi.suffix().toLower() == "asc" || fi.suffix().toLower() == "grd")
1047 {
1048 std::unique_ptr<GeoLib::Raster> raster(
1050 file_name.toStdString()));
1051 if (raster)
1052 {
1053 geo_mapper.mapOnDEM(std::move(raster));
1054 }
1055 else
1056 {
1057 OGSError::box("Error reading raster file.");
1058 }
1059 _geo_model->updateGeometry(geo_name);
1060 }
1061 else
1062 {
1063 OGSError::box("The selected file is no supported raster file.");
1064 }
1065 return;
1066 }
1067
1068 MeshLib::Mesh* mesh(nullptr);
1069 if (choice == 0) // load mesh from file
1070 {
1071 if (fi.suffix().toLower() == "vtu" || fi.suffix().toLower() == "vtk" ||
1072 fi.suffix().toLower() == "msh")
1073 {
1074 mesh = MeshLib::IO::readMeshFromFile(file_name.toStdString());
1075 }
1076 else
1077 {
1078 OGSError::box("The selected file is no supported mesh file.");
1079 return;
1080 }
1081 }
1082 else
1083 { // use mesh from ProjectData
1084 mesh = _project.getMeshObjects()[choice - 2].get();
1085 }
1086
1087 std::string new_geo_name = dlg.getNewGeoName();
1088
1089 if (new_geo_name.empty())
1090 {
1091 geo_mapper.mapOnMesh(mesh);
1092 _geo_model->updateGeometry(geo_name);
1093 }
1094 else
1095 {
1097 new_geo_name);
1098 new_geo_name = dup.getFinalizedOutputName();
1100 new_geo_name);
1101 mapper.advancedMapOnMesh(*mesh);
1102 _geo_model->updateGeometry(new_geo_name);
1103 }
1104 if (choice == 0)
1105 {
1106 delete mesh;
1107 }
1108}
const std::vector< std::unique_ptr< MeshLib::Mesh > > & getMeshObjects() const
Returns all the meshes with their respective names.
Definition: Project.h:57
static GeoLib::Raster * getRasterFromASCFile(std::string const &fname)
Reads an ArcGis ASC raster file.
A dialog window for creating DIRECT boundary conditions from raster files.
A set of tools for mapping the elevation of geometric objects.
Definition: GeoMapper.h:40

References _geo_model, _project, MeshGeoToolsLib::GeoMapper::advancedMapOnMesh(), OGSError::box(), GeoOnMeshMappingDialog::getDataSetChoice(), GeoLib::DuplicateGeometry::getFinalizedOutputName(), DataHolderLib::Project::getGEOObjects(), DataHolderLib::Project::getMeshObjects(), GeoOnMeshMappingDialog::getNewGeoName(), FileIO::AsciiRasterInterface::getRasterFromASCFile(), MeshGeoToolsLib::GeoMapper::mapOnDEM(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), and MeshLib::IO::readMeshFromFile().

Referenced by MainWindow().

◆ on_actionExportObj_triggered

void MainWindow::on_actionExportObj_triggered ( bool  checked = false)
protectedslot

Definition at line 1510 of file mainwindow.cpp.

1511{
1512 Q_UNUSED(checked)
1513 QSettings settings;
1514 QString fileName = QFileDialog::getSaveFileName(
1515 this, "Save scene to Wavefront OBJ files",
1516 settings.value("lastExportedFileDirectory").toString(), ";;");
1517 if (!fileName.isEmpty())
1518 {
1519 QDir dir = QDir(fileName);
1520 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1521
1522 vtkOBJExporter* exporter = vtkOBJExporter::New();
1523 exporter->SetFilePrefix(fileName.toStdString().c_str());
1524 exporter->SetRenderWindow(
1525 visualizationWidget->vtkWidget->GetRenderWindow());
1526 exporter->Write();
1527 exporter->Delete();
1528 }
1529}

◆ on_actionExportVRML2_triggered

void MainWindow::on_actionExportVRML2_triggered ( bool  checked = false)
protectedslot

Definition at line 1488 of file mainwindow.cpp.

1489{
1490 Q_UNUSED(checked)
1491 QSettings settings;
1492 QString fileName = QFileDialog::getSaveFileName(
1493 this, "Save scene to VRML file",
1494 settings.value("lastExportedFileDirectory").toString(),
1495 "VRML files (*.wrl);;");
1496 if (!fileName.isEmpty())
1497 {
1498 QDir dir = QDir(fileName);
1499 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1500
1501 vtkVRMLExporter* exporter = vtkVRMLExporter::New();
1502 exporter->SetFileName(fileName.toStdString().c_str());
1503 exporter->SetRenderWindow(
1504 visualizationWidget->vtkWidget->GetRenderWindow());
1505 exporter->Write();
1506 exporter->Delete();
1507 }
1508}

◆ on_actionExportVTK_triggered

void MainWindow::on_actionExportVTK_triggered ( bool  checked = false)
protectedslot

Definition at line 1458 of file mainwindow.cpp.

1459{
1460 Q_UNUSED(checked)
1461 QSettings settings;
1462 int count = 0;
1463 QString const filename = QFileDialog::getSaveFileName(
1464 this,
1465 "Export object to vtk-files",
1466 settings.value("lastExportedFileDirectory").toString(),
1467 "VTK files (*.vtp *.vtu)");
1468 if (!filename.isEmpty())
1469 {
1470 QDir const dir = QDir(filename);
1471 settings.setValue("lastExportedFileDirectory", dir.absolutePath());
1472
1473 std::string const basename =
1474 QFileInfo(filename).path().toStdString() + "/" +
1475 QFileInfo(filename).baseName().toStdString();
1477 ++it;
1478 while (*it)
1479 {
1480 std::string const name = basename + std::to_string(++count) + "-" +
1481 (*it)->data(0).toString().toStdString();
1482 static_cast<VtkVisPipelineItem*>(*it)->writeToFile(name);
1483 ++it;
1484 }
1485 }
1486}
TreeModelIterator provides a way to iterate over TreeItems in a TreeModel. Usage:
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.

References _vtkVisPipeline, MaterialPropertyLib::name, and VtkVisPipelineItem::writeToFile().

◆ open

void MainWindow::open ( int  file_type = 0)
protectedslot

Function calls for opening files.

Definition at line 497 of file mainwindow.cpp.

498{
499 QSettings settings;
500 auto t = static_cast<ImportFileType::type>(file_type);
501 QString type_str = QString::fromStdString(
503 QString fileName = QFileDialog::getOpenFileName(
504 this, "Select " + type_str + " file to import",
505 settings.value("lastOpenedFileDirectory").toString(),
506 QString::fromStdString(ImportFileType::getFileSuffixString(t)));
507 if (!fileName.isEmpty())
508 {
509 loadFile(t, fileName);
510 QDir dir = QDir(fileName);
511 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
512 }
513}
static std::string getFileSuffixString(ImportFileType::type t)
static std::string convertImportFileTypeToString(ImportFileType::type t)

References ImportFileType::convertImportFileTypeToString(), ImportFileType::getFileSuffixString(), loadFile(), and MathLib::t.

Referenced by MainWindow(), and createImportFilesMenu().

◆ openRecentFile

void MainWindow::openRecentFile ( )
protectedslot

Definition at line 515 of file mainwindow.cpp.

516{
517 auto* action = qobject_cast<QAction*>(sender());
518 if (action)
519 {
520 loadFile(ImportFileType::OGS, action->data().toString());
521 }
522}

References loadFile(), and ImportFileType::OGS.

Referenced by MainWindow().

◆ quitPresentationMode

void MainWindow::quitPresentationMode ( )
protectedslot

Definition at line 1595 of file mainwindow.cpp.

1596{
1597 // Remove the quit action
1598 QAction* action = _vtkWidget->actions().back();
1599 _vtkWidget->removeAction(action);
1600 delete action;
1601
1602 // Add the widget back to visualization widget
1603 visualizationWidget->layout()->addWidget(_vtkWidget.get());
1604
1605 QMainWindow::centralWidget()->show();
1606
1607 // Restore the previously saved QMainWindow state
1608 this->restoreState(_windowState);
1609}
QByteArray _windowState
Definition: mainwindow.h:134

References _vtkWidget, and _windowState.

Referenced by createPresentationMenu(), and startPresentationMode().

◆ readSettings()

void MainWindow::readSettings ( )
private

Definition at line 879 of file mainwindow.cpp.

880{
881 QSettings settings;
882
883 restoreGeometry(settings.value("windowGeometry").toByteArray());
884 restoreState(settings.value("windowState").toByteArray());
885}

Referenced by MainWindow().

◆ save

void MainWindow::save ( )
protectedslot

Function calls for saving files.

Definition at line 524 of file mainwindow.cpp.

525{
526 QString fileName = QFileDialog::getSaveFileName(
527 this,
528 "Save data as",
530 "GeoSys project (*.prj);;GMSH geometry files (*.geo)");
531
532 if (fileName.isEmpty())
533 {
534 OGSError::box("No filename specified.");
535 return;
536 }
537
538 QFileInfo fi(fileName);
540
541 if (fi.suffix().toLower() == "prj")
542 {
544 BaseLib::IO::writeStringToFile(xml.writeToString(),
545 fileName.toStdString());
546 }
547 else if (fi.suffix().toLower() == "geo")
548 {
549 auto const selected_geometries =
551
552 // values necessary also for the adaptive meshing
553 const double point_density = 0;
554 const double station_density = point_density;
555 const int max_pnts_per_leaf = 0;
556
558 _project.getGEOObjects(), true,
560 station_density, max_pnts_per_leaf, selected_geometries, false,
561 false);
562 bool const success = BaseLib::IO::writeStringToFile(
563 gmsh_io.writeToString(), fileName.toStdString());
564
565 if (!success)
566 {
567 OGSError::box(" No geometry available\n to write to geo-file");
568 }
569 }
570}
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
Definition: GEOObjects.cpp:342
static void setDir(const QString &path)
Sets the directory last used for saving a file.

References _project, OGSError::box(), FileIO::GMSH::FixedMeshDensity, LastSavedFileDirectory::getDir(), GeoLib::GEOObjects::getGeometryNames(), DataHolderLib::Project::getGEOObjects(), LastSavedFileDirectory::setDir(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

◆ showAddPipelineFilterItemDialog

void MainWindow::showAddPipelineFilterItemDialog ( QModelIndex  parentIndex)
protectedslot

Definition at line 984 of file mainwindow.cpp.

985{
986 VtkAddFilterDialog dlg(*_vtkVisPipeline, parentIndex);
987 dlg.exec();
988}
Dialog for selecting a filter to be applied to a VtkPipelineItem. The dialog lets you select filters ...

References _vtkVisPipeline.

Referenced by MainWindow().

◆ showConditionDockWidget

void MainWindow::showConditionDockWidget ( bool  show)
protectedslot

Definition at line 473 of file mainwindow.cpp.

474{
475 if (show)
476 {
477 modellingDock->show();
478 }
479 else
480 {
481 modellingDock->hide();
482 }
483}

Referenced by MainWindow().

◆ showCreateStructuredGridDialog

void MainWindow::showCreateStructuredGridDialog ( )
protectedslot

Creates a structured grid with user-specified parameters.

Definition at line 1326 of file mainwindow.cpp.

1327{
1329 connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1330 SLOT(addMesh(MeshLib::Mesh*)));
1331 dlg.exec();
1332}
A dialog window for managing general Data Explorer settings.

References _meshModel.

◆ showDataExplorerSettingsDialog

void MainWindow::showDataExplorerSettingsDialog ( )
protectedslot

Definition at line 1431 of file mainwindow.cpp.

1432{
1434 dlg.exec();
1435}
A dialog window for managing general Data Explorer settings.

◆ showDiagramPrefsDialog [1/2]

void MainWindow::showDiagramPrefsDialog ( )
protectedslot

Calls the diagram prefs dialog from the Tools menu.

Definition at line 1271 of file mainwindow.cpp.

1272{
1273 QSettings settings;
1274 QString fileName = QFileDialog::getOpenFileName(
1275 this, "Select data file to open",
1276 settings.value("lastOpenedFileDirectory").toString(),
1277 "Text files (*.txt);;All files (* *.*)");
1278 if (!fileName.isEmpty())
1279 {
1280 QDir dir = QDir(fileName);
1281 settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
1282 auto* prefs = new DiagramPrefsDialog(fileName);
1283 prefs->setAttribute(Qt::WA_DeleteOnClose);
1284 prefs->show();
1285 }
1286}
A dialog that allows for setting preferences for a requested diagram.

Referenced by MainWindow().

◆ showDiagramPrefsDialog [2/2]

void MainWindow::showDiagramPrefsDialog ( QModelIndex &  index)
protectedslot

Calls the diagram prefs dialog from the station list (i.e. for a specific station).

Definition at line 1253 of file mainwindow.cpp.

1254{
1255 QString listName;
1256 GeoLib::Station* stn =
1257 _geo_model->getStationModel()->stationFromIndex(index, listName);
1258
1259 if (dynamic_cast<GeoLib::StationBorehole*>(stn))
1260 {
1261 OGSError::box("No time series data available for borehole.");
1262 }
1263 else if (dynamic_cast<GeoLib::Station*>(stn) && stn->getSensorData())
1264 {
1265 auto* prefs(new DiagramPrefsDialog(stn));
1266 prefs->setAttribute(Qt::WA_DeleteOnClose);
1267 prefs->show();
1268 }
1269}
A borehole as a geometric object.
A Station (observation site) is basically a Point with some additional information.
Definition: Station.h:37
const SensorData * getSensorData() const
Returns all the sensor data for this observation site.
Definition: Station.h:83

References _geo_model, OGSError::box(), and GeoLib::Station::getSensorData().

◆ showFileConverter

void MainWindow::showFileConverter ( )
protectedslot

Calls the OGSFileConverter as an external tool.

Definition at line 1243 of file mainwindow.cpp.

1244{
1245 QSettings settings;
1246 auto* dlg = new OGSFileConverter(
1247 settings.value("DataExplorerGmshPath").toString().toStdString(), this);
1248 dlg->setAttribute(Qt::WA_DeleteOnClose);
1249 dlg->show();
1250 dlg->raise();
1251}

◆ showGeoDockWidget

void MainWindow::showGeoDockWidget ( bool  show)
protectedslot

Definition at line 437 of file mainwindow.cpp.

438{
439 if (show)
440 {
441 geoDock->show();
442 }
443 else
444 {
445 geoDock->hide();
446 }
447}

Referenced by MainWindow().

◆ showGeoNameDialog

void MainWindow::showGeoNameDialog ( const std::string &  geometry_name,
const GeoLib::GEOTYPE  object_type,
std::size_t  id 
)
protectedslot

Allows setting the name for a geometric object.

Definition at line 1288 of file mainwindow.cpp.

1291{
1292 std::string old_name = _project.getGEOObjects().getElementNameByID(
1293 geometry_name, object_type, id);
1294 SetNameDialog dlg(GeoLib::convertGeoTypeToString(object_type), id,
1295 old_name);
1296 if (dlg.exec() != QDialog::Accepted)
1297 {
1298 return;
1299 }
1300
1301 _geo_model->addNameForElement(geometry_name, object_type, id,
1302 dlg.getNewName());
1303 static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())
1304 ->setNameForItem(geometry_name, object_type, id,
1306 geometry_name, object_type, id));
1307}
std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
Definition: GEOObjects.cpp:355
Small dialog for setting a name for an object.
Definition: SetNameDialog.h:29
std::string convertGeoTypeToString(GEOTYPE geo_type)
Definition: GeoType.cpp:23

References _geo_model, _project, GeoLib::convertGeoTypeToString(), GeoLib::GEOObjects::getElementNameByID(), DataHolderLib::Project::getGEOObjects(), and SetNameDialog::getNewName().

Referenced by MainWindow().

◆ showGMSHPrefsDialog

void MainWindow::showGMSHPrefsDialog ( )
protectedslot

Definition at line 1374 of file mainwindow.cpp.

1375{
1377 connect(&dlg,
1378 SIGNAL(requestMeshing(std::vector<std::string>&, unsigned, double,
1379 double, double, bool)),
1380 this,
1381 SLOT(callGMSH(std::vector<std::string>&, unsigned, double, double,
1382 double, bool)));
1383 dlg.exec();
1384}
A dialog window for setting preferences for GMSH.
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.

References _project, callGMSH(), and DataHolderLib::Project::getGEOObjects().

◆ showLicense

void MainWindow::showLicense ( )
protectedslot

Definition at line 895 of file mainwindow.cpp.

896{
897 LicenseDialog dlg;
898 dlg.exec();
899}
A dialog window displaying the OGS license information.
Definition: LicenseDialog.h:24

◆ showLineEditDialog

void MainWindow::showLineEditDialog ( const std::string &  geoName)
protectedslot

Definition at line 1359 of file mainwindow.cpp.

1360{
1361 LineEditDialog lineEdit(
1363 connect(
1364 &lineEdit,
1365 SIGNAL(connectPolylines(const std::string&, std::vector<std::size_t>,
1366 double, std::string, bool, bool)),
1367 _geo_model.get(),
1368 SLOT(connectPolylineSegments(const std::string&,
1369 std::vector<std::size_t>, double,
1370 std::string, bool, bool)));
1371 lineEdit.exec();
1372}
const PolylineVec * getPolylineVecObj(const std::string &name) const
Definition: GEOObjects.cpp:206
A dialog window for manipulation of polylines. Currently included functionality is the concatenation ...

References _geo_model, _project, DataHolderLib::Project::getGEOObjects(), and GeoLib::GEOObjects::getPolylineVecObj().

Referenced by MainWindow().

◆ showMergeGeometriesDialog

void MainWindow::showMergeGeometriesDialog ( )
protectedslot

Definition at line 1386 of file mainwindow.cpp.

1387{
1389 if (dlg.exec() != QDialog::Accepted)
1390 {
1391 return;
1392 }
1393 std::string name(dlg.getGeometryName());
1394 if (_project.getGEOObjects().mergeGeometries(dlg.getSelectedGeometries(),
1395 name) < 0)
1396 {
1397 OGSError::box("Points are missing for\n at least one geometry.");
1398 }
1399}
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
Definition: GEOObjects.cpp:376
A dialog window for setting preferences for GMSH.

References _project, OGSError::box(), MergeGeometriesDialog::getGeometryName(), DataHolderLib::Project::getGEOObjects(), MergeGeometriesDialog::getSelectedGeometries(), GeoLib::GEOObjects::mergeGeometries(), and MaterialPropertyLib::name.

◆ showMeshAnalysisDialog

void MainWindow::showMeshAnalysisDialog ( )
protectedslot

Definition at line 1342 of file mainwindow.cpp.

1343{
1344 auto* dlg = new MeshAnalysisDialog(this->_project.getMeshObjects());
1345 dlg->exec();
1346}
A dialog window for calling mesh analysis methods.

References _project, and DataHolderLib::Project::getMeshObjects().

◆ showMeshElementRemovalDialog

void MainWindow::showMeshElementRemovalDialog ( )
protectedslot

Removal of mesh elements based on a number of criteria.

Definition at line 1334 of file mainwindow.cpp.

1335{
1337 connect(&dlg, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(),
1338 SLOT(addMesh(MeshLib::Mesh*)));
1339 dlg.exec();
1340}
A dialog window for settung up a database connection.

References _meshModel, and _project.

◆ showMeshQualitySelectionDialog

void MainWindow::showMeshQualitySelectionDialog ( MeshLib::VtkMappedMeshSource mshSource)
protectedslot

Definition at line 1401 of file mainwindow.cpp.

1403{
1404 if (mshSource == nullptr)
1405 {
1406 return;
1407 }
1408
1410 if (dlg.exec() != QDialog::Accepted)
1411 {
1412 return;
1413 }
1415 MeshLib::ElementQualityInterface quality_interface(*mshSource->GetMesh(),
1416 type);
1417 _vtkVisPipeline->showMeshElementQuality(
1418 mshSource, type, quality_interface.getQualityVector());
1419
1420 if (dlg.getHistogram())
1421 {
1422 quality_interface.writeHistogram(dlg.getHistogramPath());
1423 }
1424}
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.
MeshQualityType
Describes a mesh quality metric.
Definition: MeshEnums.h:70

References _vtkVisPipeline, MeshQualitySelectionDialog::getHistogram(), MeshQualitySelectionDialog::getHistogramPath(), MeshLib::VtkMappedMeshSource::GetMesh(), MeshLib::ElementQualityInterface::getQualityVector(), MeshQualitySelectionDialog::getSelectedMetric(), and MeshLib::ElementQualityInterface::writeHistogram().

Referenced by MainWindow().

◆ showMshDockWidget

void MainWindow::showMshDockWidget ( bool  show)
protectedslot

Definition at line 461 of file mainwindow.cpp.

462{
463 if (show)
464 {
465 mshDock->show();
466 }
467 else
468 {
469 mshDock->hide();
470 }
471}

Referenced by MainWindow().

◆ showStationDockWidget

void MainWindow::showStationDockWidget ( bool  show)
protectedslot

Definition at line 449 of file mainwindow.cpp.

450{
451 if (show)
452 {
453 stationDock->show();
454 }
455 else
456 {
457 stationDock->hide();
458 }
459}

Referenced by MainWindow().

◆ showStationNameDialog

void MainWindow::showStationNameDialog ( const std::string &  stn_vec_name,
std::size_t  id 
)
protectedslot

Allows setting the name for a station.

Definition at line 1309 of file mainwindow.cpp.

1311{
1312 std::vector<GeoLib::Point*> const* stations =
1313 _project.getGEOObjects().getStationVec(stn_vec_name);
1314 auto* const stn = static_cast<GeoLib::Station*>((*stations)[id]);
1315 SetNameDialog dlg("Station", id, stn->getName());
1316 if (dlg.exec() != QDialog::Accepted)
1317 {
1318 return;
1319 }
1320
1321 stn->setName(dlg.getNewName());
1322 static_cast<StationTreeModel*>(this->stationTabWidget->treeView->model())
1323 ->setNameForItem(stn_vec_name, id, stn->getName());
1324}

References _project, DataHolderLib::Project::getGEOObjects(), SetNameDialog::getNewName(), and GeoLib::GEOObjects::getStationVec().

Referenced by MainWindow().

◆ showVisalizationPrefsDialog

void MainWindow::showVisalizationPrefsDialog ( )
protectedslot

Definition at line 1426 of file mainwindow.cpp.

1427{
1428 _visPrefsDialog->show();
1429}

References _visPrefsDialog.

◆ showVisDockWidget

void MainWindow::showVisDockWidget ( bool  show)
protectedslot

Definition at line 485 of file mainwindow.cpp.

486{
487 if (show)
488 {
489 vtkVisDock->show();
490 }
491 else
492 {
493 vtkVisDock->hide();
494 }
495}

Referenced by MainWindow().

◆ ShowWindow()

void MainWindow::ShowWindow ( )

Definition at line 1439 of file mainwindow.cpp.

1440{
1441 this->show();
1442}

◆ startPresentationMode

void MainWindow::startPresentationMode ( )
protectedslot

Definition at line 1566 of file mainwindow.cpp.

1567{
1568 // Save the QMainWindow state to restore when quitting presentation mode
1569 _windowState = this->saveState();
1570
1571 // Get the screen number from the QAction which sent the signal
1572 QString actionText = static_cast<QAction*>(QObject::sender())->text();
1573 int screen = actionText.split(" ").back().toInt();
1574
1575 // Move the widget to the screen and maximize it
1576 // Real fullscreen hides the menu
1577 _vtkWidget->setParent(nullptr, Qt::Window);
1578 _vtkWidget->move(
1579 QPoint(_screenGeometries[screen].x(), _screenGeometries[screen].y()));
1580 //_vtkWidget->showFullScreen();
1581 _vtkWidget->showMaximized();
1582
1583 // Create an action which quits the presentation mode when pressing
1584 // ESCAPE when the the window has focus
1585 QAction* action = new QAction("Quit presentation mode", this);
1586 connect(action, SIGNAL(triggered()), this, SLOT(quitPresentationMode()));
1587 action->setShortcutContext(Qt::WidgetShortcut);
1588 action->setShortcut(QKeySequence(Qt::Key_Escape));
1589 _vtkWidget->addAction(action);
1590
1591 // Hide the central widget to maximize the dock widgets
1592 QMainWindow::centralWidget()->hide();
1593}

References _screenGeometries, _vtkWidget, _windowState, and quitPresentationMode().

Referenced by createPresentationMenu().

◆ updateDataViews

void MainWindow::updateDataViews ( )
protectedslot

Definition at line 871 of file mainwindow.cpp.

872{
873 visualizationWidget->updateViewOnLoad();
874 geoTabWidget->treeView->updateView();
875 stationTabWidget->treeView->updateView();
876 meshTabWidget->treeView->updateView();
877}

Referenced by MainWindow(), and loadFile().

◆ writeGeometryToFile

void MainWindow::writeGeometryToFile ( QString  gliName,
QString  fileName 
)
protectedslot

Definition at line 990 of file mainwindow.cpp.

991{
992#ifndef NDEBUG
993 QFileInfo fi(fileName);
994 if (fi.suffix().toLower() == "gli")
995 {
996 FileIO::Legacy::writeAllDataToGLIFileV4(fileName.toStdString(),
998 return;
999 }
1000#endif
1002 xml.export_name = gliName.toStdString();
1003 BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
1004}
void writeAllDataToGLIFileV4(const std::string &fname, const GeoLib::GEOObjects &geo)
Definition: OGSIOVer4.cpp:721

References _project, BaseLib::IO::XMLInterface::export_name, DataHolderLib::Project::getGEOObjects(), FileIO::Legacy::writeAllDataToGLIFileV4(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by MainWindow().

◆ writeSettings()

void MainWindow::writeSettings ( )
private

Definition at line 887 of file mainwindow.cpp.

888{
889 QSettings settings;
890
891 settings.setValue("windowGeometry", saveGeometry());
892 settings.setValue("windowState", saveState());
893}

Referenced by closeEvent().

◆ writeStationListToFile

void MainWindow::writeStationListToFile ( QString  listName,
QString  fileName 
)
protectedslot

Definition at line 1006 of file mainwindow.cpp.

1007{
1009 xml.export_name = listName.toStdString();
1010 BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
1011}

References _project, BaseLib::IO::XMLInterface::export_name, DataHolderLib::Project::getGEOObjects(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().

Referenced by MainWindow().

Member Data Documentation

◆ _conditionModel

std::unique_ptr<FemConditionModel> MainWindow::_conditionModel
private

Definition at line 130 of file mainwindow.h.

Referenced by MainWindow().

◆ _elementModel

std::unique_ptr<ElementTreeModel> MainWindow::_elementModel
private

Definition at line 128 of file mainwindow.h.

Referenced by MainWindow().

◆ _geo_model

std::unique_ptr<GEOModels> MainWindow::_geo_model
private

◆ _meshModel

std::unique_ptr<MeshModel> MainWindow::_meshModel
private

◆ _processModel

std::unique_ptr<ProcessModel> MainWindow::_processModel
private

Definition at line 129 of file mainwindow.h.

Referenced by MainWindow(), and loadFile().

◆ _project

◆ _screenGeometries

QList<QRect> MainWindow::_screenGeometries
private

Definition at line 132 of file mainwindow.h.

Referenced by MainWindow(), createPresentationMenu(), and startPresentationMode().

◆ _visPrefsDialog

std::unique_ptr<VisPrefsDialog> MainWindow::_visPrefsDialog
private

Definition at line 136 of file mainwindow.h.

Referenced by MainWindow(), and showVisalizationPrefsDialog().

◆ _vtkVisPipeline

std::unique_ptr<VtkVisPipeline> MainWindow::_vtkVisPipeline
private

◆ _vtkWidget

std::unique_ptr<QWidget> MainWindow::_vtkWidget
private

◆ _windowState

QByteArray MainWindow::_windowState
private

Definition at line 134 of file mainwindow.h.

Referenced by quitPresentationMode(), and startPresentationMode().


The documentation for this class was generated from the following files: