115 geoTabWidget->treeView->setModel(
_geo_model->getGeoModel());
116 stationTabWidget->treeView->setModel(
_geo_model->getStationModel());
117 meshTabWidget->treeView->setModel(
_meshModel.get());
124 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
127 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(
int)),
this,
129 connect(stationTabWidget->treeView,
130 SIGNAL(stationListExportRequested(std::string, std::string)),
this,
132 std::string, std::string)));
133 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
135 SLOT(removeStationVec(
137 connect(stationTabWidget->treeView,
138 SIGNAL(stationListSaved(QString, QString)),
this,
145 connect(stationTabWidget->treeView,
146 SIGNAL(requestNameChangeDialog(
const std::string&, std::size_t)),
148 connect(stationTabWidget->treeView,
149 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
151 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
157 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(
int)),
this,
159 connect(geoTabWidget->treeView,
162 connect(geoTabWidget->treeView,
163 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
166 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
169 connect(geoTabWidget->treeView,
170 SIGNAL(requestPointToStationConversion(std::string
const&)),
this,
173 geoTabWidget->treeView,
174 SIGNAL(requestLineEditDialog(
const std::string&)),
this,
176 connect(geoTabWidget->treeView,
177 SIGNAL(requestNameChangeDialog(
const std::string&,
188 connect(geoTabWidget->treeView,
189 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
191 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
192 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
194 connect(stationTabWidget->treeView,
195 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
197 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
198 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
202 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(
int)),
this,
204 connect(meshTabWidget->treeView,
205 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_meshModel.get(),
206 SLOT(removeMesh(
const QModelIndex&)));
207 connect(meshTabWidget->treeView,
208 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_elementModel.get(),
211 meshTabWidget->treeView,
215 connect(meshTabWidget->treeView,
216 SIGNAL(requestMeshToGeometryConversion(
const MeshLib::Mesh*)),
this,
218 connect(meshTabWidget->treeView,
219 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
222 SLOT(highlightMeshComponent(
223 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
224 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
226 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
227 meshTabWidget->elementView, SLOT(updateView()));
229 meshTabWidget->treeView,
230 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
233 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
unsigned)));
234 connect(meshTabWidget->treeView,
235 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
237 meshTabWidget->elementView, SLOT(updateView()));
238 connect(meshTabWidget->treeView,
239 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
241 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
242 SLOT(removeHighlightActor()));
243 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
245 connect(meshTabWidget->elementView,
246 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
248 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
249 SLOT(removeHighlightActor()));
250 connect(meshTabWidget->elementView,
251 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
254 SLOT(highlightMeshComponent(
255 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
256 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
260 connect(modellingTabWidget->treeView,
261 SIGNAL(processVarRemoved(QString
const&)),
_processModel.get(),
262 SLOT(removeProcessVariable(QString
const&)));
263 connect(modellingTabWidget->treeView,
264 SIGNAL(conditionRemoved(QString
const&, QString
const&)),
266 SLOT(removeCondition(QString
const&, QString
const&)));
267 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
269 connect(modellingTabWidget->treeView,
273 connect(modellingTabWidget->treeView,
277 connect(modellingTabWidget->treeView,
279 modellingTabWidget->conditionView, SLOT(updateView()));
280 connect(modellingTabWidget->treeView,
282 modellingTabWidget->conditionView, SLOT(updateView()));
306 SLOT(addPipelineItem(
MeshModel*, QModelIndex)));
309 SLOT(removeSourceItem(
MeshModel*, QModelIndex)));
312 visualizationWidget->vtkWidget, SLOT(update()));
314 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
315 connect(
_vtkVisPipeline.get(), SIGNAL(itemSelected(
const QModelIndex&)),
316 vtkVisTabWidget->vtkVisPipelineView,
317 SLOT(selectItem(
const QModelIndex&)));
320 connect(vtkVisTabWidget->vtkVisPipelineView,
321 SIGNAL(requestRemovePipelineItem(QModelIndex)),
323 connect(vtkVisTabWidget->vtkVisPipelineView,
324 SIGNAL(requestAddPipelineFilterItem(QModelIndex)),
this,
326 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
329 connect(vtkVisTabWidget->vtkVisPipelineView,
330 SIGNAL(actorSelected(vtkProp3D*)),
331 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
332 SLOT(highlightActor(vtkProp3D*)));
334 visualizationWidget, SLOT(updateView()));
337 connect(vtkVisTabWidget->vtkVisPipelineView,
338 SIGNAL(dataObjectSelected(vtkDataObject*)),
339 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
340 SLOT(pickableDataObject(vtkDataObject*)));
341 connect(
reinterpret_cast<QObject*
>(visualizationWidget->vtkPickCallback()),
342 SIGNAL(actorPicked(vtkProp3D*)),
343 vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
344 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
345 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
348 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
350 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
351 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
353 meshTabWidget->elementView, SLOT(updateView()));
354 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
357 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
358 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
361 SLOT(removeHighlightedMeshComponent()));
363 connect(vtkVisTabWidget->vtkVisPipelineView,
368 tabifyDockWidget(geoDock, mshDock);
369 tabifyDockWidget(mshDock, modellingDock);
370 tabifyDockWidget(modellingDock, stationDock);
376 _vtkWidget.reset(visualizationWidget->vtkWidget);
377 for (
auto const& screen : QGuiApplication::screens())
384 menu_File->insertMenu(action_Exit, import_files_menu);
389 connect(
this, SIGNAL(
fileUsed(QString)), recentFiles,
390 SLOT(setCurrentFile(QString)));
391 menu_File->insertMenu(action_Exit, recentFiles->
menu());
394 QAction* showGeoDockAction = geoDock->toggleViewAction();
395 showGeoDockAction->setStatusTip(tr(
"Shows / hides the geometry view"));
396 connect(showGeoDockAction, SIGNAL(triggered(
bool)),
this,
398 menuWindows->addAction(showGeoDockAction);
400 QAction* showStationDockAction = stationDock->toggleViewAction();
401 showStationDockAction->setStatusTip(tr(
"Shows / hides the station view"));
402 connect(showStationDockAction, SIGNAL(triggered(
bool)),
this,
404 menuWindows->addAction(showStationDockAction);
406 QAction* showMshDockAction = mshDock->toggleViewAction();
407 showMshDockAction->setStatusTip(tr(
"Shows / hides the mesh view"));
408 connect(showMshDockAction, SIGNAL(triggered(
bool)),
this,
410 menuWindows->addAction(showMshDockAction);
412 QAction* showModellingDockAction = modellingDock->toggleViewAction();
413 showModellingDockAction->setStatusTip(tr(
"Shows / hides the Process view"));
414 connect(showModellingDockAction, SIGNAL(triggered(
bool)),
this,
416 menuWindows->addAction(showModellingDockAction);
418 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
419 showVisDockAction->setStatusTip(tr(
"Shows / hides the VTK Pipeline view"));
420 connect(showVisDockAction, SIGNAL(triggered(
bool)),
this,
422 menuWindows->addAction(showVisDockAction);
425 auto* presentationMenu =
new QMenu(
this);
426 presentationMenu->setTitle(
"Presentation on");
427 connect(presentationMenu, SIGNAL(aboutToShow()),
this,
429 menuWindows->insertMenu(showVisDockAction, presentationMenu);
432 *visualizationWidget);
578 QFile file(fileName);
581 QMessageBox::warning(
this, tr(
"Application"),
582 tr(
"Cannot read file %1:\n%2.")
584 .arg(file.errorString()));
588 QApplication::setOverrideCursor(Qt::WaitCursor);
589 QFileInfo fi(fileName);
591 QDir dir = QDir(fileName);
593 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
598 if (fi.suffix().toLower() ==
"gli")
600 std::string unique_name;
601 std::vector<std::string> errors;
602 std::string
const gmsh_path =
603 settings.value(
"DataExplorerGmshPath").toString().toStdString();
606 unique_name, errors, gmsh_path))
608 for (
auto& error : errors)
614 else if (fi.suffix().toLower() ==
"prj")
625 "Failed to load project file.\n Please see console for "
629 else if (fi.suffix().toLower() ==
"gml")
637 "Failed to load geometry.\n Please see console for "
641 catch (std::runtime_error
const& err)
644 "Failed to read file `" + fileName +
"'");
648 else if (fi.suffix().toLower() ==
"stn")
654 "Failed to load station data.\n Please see console for "
659 else if (fi.suffix().toLower() ==
"msh" ||
660 fi.suffix().toLower() ==
"vtu" ||
661 fi.suffix().toLower() ==
"vtk")
664 QElapsedTimer myTimer;
667 std::unique_ptr<MeshLib::Mesh> mesh(
670 INFO(
"Mesh loading time: {:d} ms.", myTimer.restart());
681 INFO(
"Mesh model setup time: {:d} ms.", myTimer.elapsed());
685 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
690 if (fi.suffix().toLower() ==
"fem")
693 std::unique_ptr<MeshLib::Mesh> mesh(
707 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
711 if (fi.suffix().toLower() ==
"txt")
713 std::vector<GeoLib::Point*> boreholes;
714 std::string name = fi.baseName().toStdString();
717 fileName.toStdString()))
727 else if (fi.suffix().toLower() ==
"2dm" ||
728 fi.suffix().toLower() ==
"3dm")
730 std::string name = fileName.toStdString();
741 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
745 std::string msh_name(fileName.toStdString());
759 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
763 std::string file_name(fileName.toStdString());
764 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
767 for (
auto& mesh : meshes)
779 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
788 std::unique_ptr<MeshLib::Mesh> mesh(dlg.
getMesh());
795 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
810 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
817 double* origin = img->GetOutput()->GetOrigin();
819 img->GetOutput()->GetSpacing()[0]);
822 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
828 settings.value(
"DataExplorerGmshPath").toString().toStdString());
830 QDir dir = QDir(fileName);
831 settings.setValue(
"lastOpenedShapeFileDirectory", dir.absolutePath());
835 if (fi.suffix().toLower().compare(
"poly") == 0 ||
836 fi.suffix().toLower().compare(
"smesh") == 0)
844 settings.setValue(
"lastOpenedTetgenFileDirectory",
845 QFileInfo(fileName).absolutePath());
846 QString element_fname(fi.path() +
"/" + fi.completeBaseName() +
849 if (!fileName.isEmpty())
853 fileName.toStdString(), element_fname.toStdString()));
868 settings.setValue(
"lastOpenedVtkFileDirectory", dir.absolutePath());
871 QApplication::restoreOverrideCursor();