OGS
DataExplorer/main.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include <QVTKOpenGLNativeWidget.h>
5#include <vtkSmartPointer.h>
6
7#include <QApplication>
8#include <QSurfaceFormat>
9#include <memory>
10
11#include "InfoLib/GitInfo.h"
13#include "mainwindow.h"
14
15// TODO: Replace this on VTK 9 upgrade, see
16// https://discourse.vtk.org/t/vtk-use-file/3645/2
17#if VTK_VIA_CPM
18#include <vtkAutoInit.h>
19VTK_MODULE_INIT(vtkInteractionStyle)
20VTK_MODULE_INIT(vtkRenderingFreeType)
21VTK_MODULE_INIT(vtkRenderingOpenGL2)
22#endif
23
24int main(int argc, char* argv[])
25{
26#ifdef NDEBUG
28#else
30#endif
31
32 // needed to ensure appropriate OpenGL context is created for VTK rendering.
33 QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
34
35 auto myOutputWindow = vtkSmartPointer<VtkConsoleOutputWindow>::New();
36 vtkOutputWindow::SetInstance(myOutputWindow);
37
38 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
39 QApplication a(argc, argv);
40 QApplication::setApplicationName("OpenGeoSys - Data Explorer");
41 QApplication::setApplicationVersion(
42 QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
43 QApplication::setOrganizationName("OpenGeoSys Community");
44 QApplication::setOrganizationDomain("opengeosys.org");
45 setlocale(LC_NUMERIC, "C");
46 QLocale::setDefault(QLocale::German);
47 auto w = std::make_unique<MainWindow>();
48 w->setWindowTitle(w->windowTitle() + " - " +
49 QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
50 if (QCoreApplication::arguments().size() > 1)
51 {
52 w->loadFileOnStartUp(QCoreApplication::arguments().at(1));
53 }
54 w->show();
55 int returncode = QApplication::exec();
56
57 return returncode;
58}
int main(int argc, char *argv[])
void initOGSLogger(std::string const &log_level)
Definition Logging.cpp:56
GITINFOLIB_EXPORT const std::string ogs_version