104 geoTabWidget->treeView->setModel(
_geo_model->getGeoModel());
105 stationTabWidget->treeView->setModel(
_geo_model->getStationModel());
106 meshTabWidget->treeView->setModel(
_meshModel.get());
113 std::make_unique<VtkVisPipeline>(visualizationWidget->renderer());
116 connect(stationTabWidget->treeView, SIGNAL(openStationListFile(
int)),
this,
118 connect(stationTabWidget->treeView,
119 SIGNAL(stationListExportRequested(std::string, std::string)),
this,
121 std::string, std::string)));
122 connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)),
124 SLOT(removeStationVec(
126 connect(stationTabWidget->treeView,
127 SIGNAL(stationListSaved(QString, QString)),
this,
134 connect(stationTabWidget->treeView,
135 SIGNAL(requestNameChangeDialog(
const std::string&, std::size_t)),
137 connect(stationTabWidget->treeView,
138 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
140 connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex&)),
146 connect(geoTabWidget->treeView, SIGNAL(openGeometryFile(
int)),
this,
148 connect(geoTabWidget->treeView,
151 connect(geoTabWidget->treeView,
152 SIGNAL(geometryMappingRequested(
const std::string&)),
this,
155 geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)),
158 connect(geoTabWidget->treeView,
159 SIGNAL(requestPointToStationConversion(std::string
const&)),
this,
162 geoTabWidget->treeView,
163 SIGNAL(requestLineEditDialog(
const std::string&)),
this,
165 connect(geoTabWidget->treeView,
166 SIGNAL(requestNameChangeDialog(
const std::string&,
177 connect(geoTabWidget->treeView,
178 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
180 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
181 connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
183 connect(stationTabWidget->treeView,
184 SIGNAL(geoItemSelected(
const vtkPolyDataAlgorithm*,
int)),
186 SLOT(highlightGeoObject(
const vtkPolyDataAlgorithm*,
int)));
187 connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()),
191 connect(meshTabWidget->treeView, SIGNAL(openMeshFile(
int)),
this,
193 connect(meshTabWidget->treeView,
194 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_meshModel.get(),
195 SLOT(removeMesh(
const QModelIndex&)));
196 connect(meshTabWidget->treeView,
197 SIGNAL(requestMeshRemoval(
const QModelIndex&)),
_elementModel.get(),
200 meshTabWidget->treeView,
204 connect(meshTabWidget->treeView,
205 SIGNAL(requestMeshToGeometryConversion(
const MeshLib::Mesh*)),
this,
207 connect(meshTabWidget->treeView,
208 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
211 SLOT(highlightMeshComponent(
212 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
213 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
215 connect(meshTabWidget->treeView, SIGNAL(meshSelected(
MeshLib::Mesh const&)),
216 meshTabWidget->elementView, SLOT(updateView()));
218 meshTabWidget->treeView,
219 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
222 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
unsigned)));
223 connect(meshTabWidget->treeView,
224 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
226 meshTabWidget->elementView, SLOT(updateView()));
227 connect(meshTabWidget->treeView,
228 SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm
const*
const,
230 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
231 SLOT(removeHighlightActor()));
232 connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()),
234 connect(meshTabWidget->elementView,
235 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
237 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
238 SLOT(removeHighlightActor()));
239 connect(meshTabWidget->elementView,
240 SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm
const*
const,
243 SLOT(highlightMeshComponent(
244 vtkUnstructuredGridAlgorithm
const*
const,
unsigned,
bool)));
245 connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()),
249 connect(modellingTabWidget->treeView,
250 SIGNAL(processVarRemoved(QString
const&)),
_processModel.get(),
251 SLOT(removeProcessVariable(QString
const&)));
252 connect(modellingTabWidget->treeView,
253 SIGNAL(conditionRemoved(QString
const&, QString
const&)),
255 SLOT(removeCondition(QString
const&, QString
const&)));
256 connect(modellingTabWidget->treeView, SIGNAL(clearConditionView()),
258 connect(modellingTabWidget->treeView,
262 connect(modellingTabWidget->treeView,
266 connect(modellingTabWidget->treeView,
268 modellingTabWidget->conditionView, SLOT(updateView()));
269 connect(modellingTabWidget->treeView,
271 modellingTabWidget->conditionView, SLOT(updateView()));
295 SLOT(addPipelineItem(
MeshModel*, QModelIndex)));
298 SLOT(removeSourceItem(
MeshModel*, QModelIndex)));
301 visualizationWidget->vtkWidget, SLOT(update()));
303 vtkVisTabWidget->vtkVisPipelineView, SLOT(expandAll()));
304 connect(
_vtkVisPipeline.get(), SIGNAL(itemSelected(
const QModelIndex&)),
305 vtkVisTabWidget->vtkVisPipelineView,
306 SLOT(selectItem(
const QModelIndex&)));
309 connect(vtkVisTabWidget->vtkVisPipelineView,
310 SIGNAL(requestRemovePipelineItem(QModelIndex)),
312 connect(vtkVisTabWidget->vtkVisPipelineView,
313 SIGNAL(requestAddPipelineFilterItem(QModelIndex)),
this,
315 connect(vtkVisTabWidget, SIGNAL(requestViewUpdate()), visualizationWidget,
318 connect(vtkVisTabWidget->vtkVisPipelineView,
319 SIGNAL(actorSelected(vtkProp3D*)),
320 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
321 SLOT(highlightActor(vtkProp3D*)));
323 visualizationWidget, SLOT(updateView()));
326 connect(vtkVisTabWidget->vtkVisPipelineView,
327 SIGNAL(dataObjectSelected(vtkDataObject*)),
328 reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
329 SLOT(pickableDataObject(vtkDataObject*)));
330 connect(
reinterpret_cast<QObject*
>(visualizationWidget->vtkPickCallback()),
331 SIGNAL(actorPicked(vtkProp3D*)),
332 vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*)));
333 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
334 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
337 SLOT(setElement(vtkUnstructuredGridAlgorithm
const*
const,
339 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
340 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
342 meshTabWidget->elementView, SLOT(updateView()));
343 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
346 connect(
reinterpret_cast<QObject*
>(visualizationWidget->interactorStyle()),
347 SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm
const*
const,
350 SLOT(removeHighlightedMeshComponent()));
352 connect(vtkVisTabWidget->vtkVisPipelineView,
357 tabifyDockWidget(geoDock, mshDock);
358 tabifyDockWidget(mshDock, modellingDock);
359 tabifyDockWidget(modellingDock, stationDock);
365 _vtkWidget.reset(visualizationWidget->vtkWidget);
366 for (
auto const& screen : QGuiApplication::screens())
373 menu_File->insertMenu(action_Exit, import_files_menu);
378 connect(
this, SIGNAL(
fileUsed(QString)), recentFiles,
379 SLOT(setCurrentFile(QString)));
380 menu_File->insertMenu(action_Exit, recentFiles->
menu());
383 QAction* showGeoDockAction = geoDock->toggleViewAction();
384 showGeoDockAction->setStatusTip(tr(
"Shows / hides the geometry view"));
385 connect(showGeoDockAction, SIGNAL(triggered(
bool)),
this,
387 menuWindows->addAction(showGeoDockAction);
389 QAction* showStationDockAction = stationDock->toggleViewAction();
390 showStationDockAction->setStatusTip(tr(
"Shows / hides the station view"));
391 connect(showStationDockAction, SIGNAL(triggered(
bool)),
this,
393 menuWindows->addAction(showStationDockAction);
395 QAction* showMshDockAction = mshDock->toggleViewAction();
396 showMshDockAction->setStatusTip(tr(
"Shows / hides the mesh view"));
397 connect(showMshDockAction, SIGNAL(triggered(
bool)),
this,
399 menuWindows->addAction(showMshDockAction);
401 QAction* showModellingDockAction = modellingDock->toggleViewAction();
402 showModellingDockAction->setStatusTip(tr(
"Shows / hides the Process view"));
403 connect(showModellingDockAction, SIGNAL(triggered(
bool)),
this,
405 menuWindows->addAction(showModellingDockAction);
407 QAction* showVisDockAction = vtkVisDock->toggleViewAction();
408 showVisDockAction->setStatusTip(tr(
"Shows / hides the VTK Pipeline view"));
409 connect(showVisDockAction, SIGNAL(triggered(
bool)),
this,
411 menuWindows->addAction(showVisDockAction);
414 auto* presentationMenu =
new QMenu(
this);
415 presentationMenu->setTitle(
"Presentation on");
416 connect(presentationMenu, SIGNAL(aboutToShow()),
this,
418 menuWindows->insertMenu(showVisDockAction, presentationMenu);
421 *visualizationWidget);
567 QFile file(fileName);
570 QMessageBox::warning(
this, tr(
"Application"),
571 tr(
"Cannot read file %1:\n%2.")
573 .arg(file.errorString()));
577 QApplication::setOverrideCursor(Qt::WaitCursor);
578 QFileInfo fi(fileName);
580 QDir dir = QDir(fileName);
582 fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString();
587 if (fi.suffix().toLower() ==
"gli")
589 std::string unique_name;
590 std::vector<std::string> errors;
591 std::string
const gmsh_path =
592 settings.value(
"DataExplorerGmshPath").toString().toStdString();
595 unique_name, errors, gmsh_path))
597 for (
auto& error : errors)
603 else if (fi.suffix().toLower() ==
"prj")
614 "Failed to load project file.\n Please see console for "
618 else if (fi.suffix().toLower() ==
"gml")
626 "Failed to load geometry.\n Please see console for "
630 catch (std::runtime_error
const& err)
633 "Failed to read file `" + fileName +
"'");
637 else if (fi.suffix().toLower() ==
"stn")
643 "Failed to load station data.\n Please see console for "
648 else if (fi.suffix().toLower() ==
"msh" ||
649 fi.suffix().toLower() ==
"vtu" ||
650 fi.suffix().toLower() ==
"vtk")
653 QElapsedTimer myTimer;
656 std::unique_ptr<MeshLib::Mesh> mesh(
659 INFO(
"Mesh loading time: {:d} ms.", myTimer.restart());
670 INFO(
"Mesh model setup time: {:d} ms.", myTimer.elapsed());
674 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
679 if (fi.suffix().toLower() ==
"fem")
682 std::unique_ptr<MeshLib::Mesh> mesh(
696 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
700 if (fi.suffix().toLower() ==
"txt")
702 std::vector<GeoLib::Point*> boreholes;
703 std::string name = fi.baseName().toStdString();
706 fileName.toStdString()))
708 _project.getGEOObjects().addStationVec(std::move(boreholes),
716 else if (fi.suffix().toLower() ==
"2dm" ||
717 fi.suffix().toLower() ==
"3dm")
719 std::string name = fileName.toStdString();
730 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
734 std::string msh_name(fileName.toStdString());
748 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
752 std::string file_name(fileName.toStdString());
753 std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
756 for (
auto& mesh : meshes)
768 settings.setValue(
"lastOpenedFileDirectory", dir.absolutePath());
777 std::unique_ptr<MeshLib::Mesh> mesh(dlg.
getMesh());
784 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
799 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
806 double* origin = img->GetOutput()->GetOrigin();
808 img->GetOutput()->GetSpacing()[0]);
811 settings.setValue(
"lastOpenedRasterFileDirectory", dir.absolutePath());
816 fileName.toStdString(),
_project.getGEOObjects(),
817 settings.value(
"DataExplorerGmshPath").toString().toStdString());
819 QDir dir = QDir(fileName);
820 settings.setValue(
"lastOpenedShapeFileDirectory", dir.absolutePath());
824 if (fi.suffix().toLower().compare(
"poly") == 0 ||
825 fi.suffix().toLower().compare(
"smesh") == 0)
833 settings.setValue(
"lastOpenedTetgenFileDirectory",
834 QFileInfo(fileName).absolutePath());
835 QString element_fname(fi.path() +
"/" + fi.completeBaseName() +
838 if (!fileName.isEmpty())
842 fileName.toStdString(), element_fname.toStdString()));
857 settings.setValue(
"lastOpenedVtkFileDirectory", dir.absolutePath());
860 QApplication::restoreOverrideCursor();