Skip to content
Snippets Groups Projects
Commit 12a0f16b authored by Karsten Rink's avatar Karsten Rink Committed by Tom Fischer
Browse files

adding T-Surface reader to data explorer

parent 585565a2
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ public:
FEFLOW,
GMS,
GMSH,
GOCAD_TSURF,
#ifdef OGS_USE_NETCDF
NETCDF,
#endif // OGS_USE_NETCDF
......@@ -50,6 +51,8 @@ public:
return "GMS";
if (t == ImportFileType::GMSH)
return "GMSH";
if (t == ImportFileType::GOCAD_TSURF)
return "Gocad TSurface";
#ifdef OGS_USE_NETCDF
if (t == ImportFileType::NETCDF)
return "NetCDF";
......@@ -84,6 +87,8 @@ public:
return "GMS files (*.txt *.3dm)";
if (t == ImportFileType::GMSH)
return "GMSH mesh files (*.msh)";
if (t == ImportFileType::GOCAD_TSURF)
return "Gocad TSurface files (*.ts)";
#ifdef OGS_USE_NETCDF
if (t == ImportFileType::NETCDF)
return "NetCDF files (*.nc)";
......
......@@ -39,6 +39,7 @@
#include "Applications/FileIO/GMSInterface.h"
#include "Applications/FileIO/Gmsh/GMSHInterface.h"
#include "Applications/FileIO/Gmsh/GmshReader.h"
#include "Applications/FileIO/GocadIO/GocadTSurfaceReader.h"
#include "Applications/FileIO/Legacy/OGSIOVer4.h"
#include "Applications/FileIO/PetrelInterface.h"
#include "Applications/FileIO/TetGenInterface.h"
......@@ -611,6 +612,26 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName)
}
settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
}
else if (t == ImportFileType::GOCAD_TSURF)
{
std::string file_name(fileName.toStdString());
FileIO::Gocad::GocadTSurfaceReader gcts (file_name);
if (gcts.readFile())
{
std::vector<MeshLib::Mesh*> meshes = gcts.getData();
for (MeshLib::Mesh* m : meshes)
{
std::unique_ptr<MeshLib::Mesh> mesh(m);
if (mesh != nullptr)
_meshModel->addMesh(std::move(mesh));
}
}
else
{
OGSError::box("Error reading file.");
}
settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
}
#ifdef OGS_USE_NETCDF
else if (t == ImportFileType::NETCDF) // CH 01.2012
{
......@@ -751,6 +772,9 @@ QMenu* MainWindow::createImportFilesMenu()
QAction* gmshFiles = importFiles->addAction("&GMSH Files...");
connect(gmshFiles, SIGNAL(triggered()), signal_mapper, SLOT(map()));
signal_mapper->setMapping(gmshFiles, ImportFileType::GMSH);
QAction* gocadTsFiles = importFiles->addAction("&Gocad TSurface...");
connect(gocadTsFiles, SIGNAL(triggered()), signal_mapper, SLOT(map()));
signal_mapper->setMapping(gocadTsFiles, ImportFileType::GOCAD_TSURF);
#ifdef OGS_USE_NETCDF
QAction* netcdfFiles = importFiles->addAction("&NetCDF Files...");
connect(netcdfFiles, SIGNAL(triggered()), signal_mapper, SLOT(map()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment