swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: 654d90da5e30e62bfa68faf78492ebe221d62a95 authored by joergbuchwald on 01 October 2021, 13:28:26 UTC
Merge branch 'van_genuchten_exp' into 'master'
Tip revision: 654d90d
main.cpp
#include <QVTKOpenGLWidget.h>
#include <vtkSmartPointer.h>

#include <QApplication>
#include <QSurfaceFormat>
#include <memory>

#include "InfoLib/GitInfo.h"
#include "VtkVis/VtkConsoleOutputWindow.h"
#include "mainwindow.h"

// TODO: Replace this on VTK 9 upgrade, see
// https://discourse.vtk.org/t/vtk-use-file/3645/2
#if VTK_VIA_CPM
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingFreeType)
VTK_MODULE_INIT(vtkRenderingOpenGL2)
#endif

int main(int argc, char* argv[])
{
    // needed to ensure appropriate OpenGL context is created for VTK rendering.
    QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());

    auto myOutputWindow = vtkSmartPointer<VtkConsoleOutputWindow>::New();
    vtkOutputWindow::SetInstance(myOutputWindow);

    QApplication a(argc, argv);
    QApplication::setApplicationName("OpenGeoSys - Data Explorer");
    QApplication::setApplicationVersion(
        QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
    QApplication::setOrganizationName("OpenGeoSys Community");
    QApplication::setOrganizationDomain("opengeosys.org");
    setlocale(LC_NUMERIC, "C");
    QLocale::setDefault(QLocale::German);
    auto w = std::make_unique<MainWindow>();
    w->setWindowTitle(w->windowTitle() + " - " +
                      QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
    if (QCoreApplication::arguments().size() > 1)
    {
        w->loadFileOnStartUp(QCoreApplication::arguments().at(1));
    }
    w->show();
    int returncode = QApplication::exec();

    return returncode;
}
back to top