177 lines
3.8 KiB
C++
Executable File
177 lines
3.8 KiB
C++
Executable File
|
|
|
|
|
|
#include <nglapplication/nglapplication.h>
|
|
#include <NGLLogger/INGLLogger.h>
|
|
|
|
#include "../plan_overlay_dialog.h"
|
|
|
|
#include "../plan_overlay_model.h"
|
|
#include "../plan_overlay_view.h"
|
|
|
|
#include <LtsWidgets/lts_base_layout_widget.h>
|
|
#include <LtsPluginManager/lts_plugin_loader.h>
|
|
#include <PluginInterfaces/style_plugin_interface.h>
|
|
#include <PluginInterfaces/project_plugin_interface.h>
|
|
|
|
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
|
|
|
|
|
#include <QtCore/QDir>
|
|
#include <QtCore/QPointer>
|
|
#include <QtCore/QStandardPaths>
|
|
|
|
#include <QtGui/QSurface>
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
#include <QtWidgets/QDialog>
|
|
#include <QtWidgets/QHBoxLayout>
|
|
#include <QtWidgets/QMessageBox>
|
|
#include <QtWidgets/QLabel>
|
|
|
|
#include <iostream>
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char* argv[])
|
|
{
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
|
#endif
|
|
|
|
|
|
NGLApplication app ( argc, argv );
|
|
|
|
|
|
app.createLogger("planOverlayTest", "log4cxx_planOverlayTest.props");
|
|
TRACE_LOG(app.baseLogger()) << LOGFUNCTION << " START";
|
|
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
app.setOrganizationName(QLatin1String("RME"));
|
|
app.setApplicationName(QLatin1String("Plan Overlay Test Application"));
|
|
|
|
|
|
LtsPluginManager::LtsPluginLoader *pluginLoader = LtsPluginManager::LtsPluginLoader::getInstance();
|
|
|
|
pluginLoader->loadPlugins( LtsPluginManager::PluginType::STYLE , nullptr, QStringList() << QStringLiteral("rme.light") );
|
|
pluginLoader->loadPlugins( LtsPluginManager::PluginType::PROJECT, nullptr, QStringList() << QStringLiteral("legatus") );
|
|
|
|
|
|
|
|
QDir::setSearchPaths( QLatin1String( "icon" ), QStringList( QLatin1String( ":/style/icons/" ) ) );
|
|
QDir::setSearchPaths( QLatin1String( "icon" ), QStringList( QLatin1String( ":/style/" ) ) );
|
|
|
|
|
|
|
|
#ifdef BUILD_STATIC_LIBRARIES
|
|
|
|
Q_INIT_RESOURCE(lts_resources);
|
|
#endif
|
|
|
|
#define USE_QDIALOG
|
|
|
|
|
|
|
|
PlanOverlaysPlugin::PlanOverlayModel * planOverlayModel = new PlanOverlaysPlugin::PlanOverlayModel();
|
|
|
|
#ifdef USE_QDIALOG
|
|
PlanOverlaysPlugin::PlanOverlayDialog<QDialog> * dialog = new PlanOverlaysPlugin::PlanOverlayDialog<QDialog>( nullptr, planOverlayModel, nullptr, nullptr );
|
|
#endif
|
|
|
|
#ifdef USE_LTSFRAMELESS
|
|
PlanOverlaysPlugin::PlanOverlayDialog<LtsWidgets::LtsFramelessDialog> * dialog = new PlanOverlaysPlugin::PlanOverlayDialog<LtsWidgets::LtsFramelessDialog>( nullptr, planOverlayModel, nullptr );
|
|
#endif
|
|
|
|
#ifdef CHECK_ERROR
|
|
PlanOverlaysPlugin::PlanOverlayDialog<QWidget> * dialog = new PlanOverlaysPlugin::PlanOverlayDialog<QWidget>( nullptr, planOverlayModel, nullptr );
|
|
#endif
|
|
|
|
unsigned int counter = 1;
|
|
|
|
auto doReadFile = [dialog,&counter]( int )
|
|
{
|
|
PlanOverlaysPlugin::PlanOverlayModel::PlanItem planItem = dialog->dialogWidget()->planOverlayModel()->planItem(counter++);
|
|
|
|
planItem.m_folderId = 6;
|
|
planItem.m_fileId = 42;
|
|
planItem.m_dirPath = QString();
|
|
planItem.m_fileName = QStringLiteral("Hugo_%1").arg(planItem.m_fileId);
|
|
planItem.m_minScale = 250000;
|
|
planItem.m_maxScale = 12000;
|
|
planItem.m_opacity = 1;
|
|
planItem.m_visibility = true;
|
|
|
|
dialog->dialogWidget()->planOverlayModel()->updatePlanItem( planItem );
|
|
};
|
|
|
|
auto doReloadPlan = [](unsigned int planId)
|
|
{
|
|
Q_UNUSED(planId);
|
|
QMessageBox::information(nullptr,QObject::tr("Reload Plan"),QObject::tr("doReloadPlan has been called"),QMessageBox::StandardButton::Ok);
|
|
};
|
|
|
|
auto doUnloadPlan = [dialog](unsigned int planId)
|
|
{
|
|
dialog->dialogWidget()->planOverlayModel()->removeOverlay(planId);
|
|
};
|
|
|
|
|
|
dialog->dialogWidget()->initFileManagement( nullptr, nullptr, nullptr, doReadFile, doReloadPlan, doUnloadPlan );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialog->show();
|
|
|
|
app.setQuitOnLastWindowClosed(true);
|
|
|
|
int retval = app.exec();
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return retval;
|
|
}
|