183 lines
5.5 KiB
C++
Executable File
183 lines
5.5 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* main
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#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 <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
|
|
|
|
|
#include <QtCore/QDir>
|
|
#include <QtCore/QPointer>
|
|
#include <QtCore/QStandardPaths>
|
|
|
|
#include <QtGui/QSurface>
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
#include <QtWidgets/QDesktopWidget>
|
|
#include <QtWidgets/QDialog>
|
|
#include <QtWidgets/QHBoxLayout>
|
|
#include <QtWidgets/QMessageBox>
|
|
#include <QtWidgets/QLabel>
|
|
|
|
#include <iostream>
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
int main (int argc, char* argv[])
|
|
{
|
|
// ESRI :
|
|
#ifdef Q_OS_WIN
|
|
// Force usage of OpenGL ES through ANGLE on Windows
|
|
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
|
#endif
|
|
// : ESRI
|
|
|
|
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") );
|
|
|
|
|
|
// .. to keep some compatibility to old resource structure TODO: rm !
|
|
QDir::setSearchPaths( QLatin1String( "icon" ), QStringList( QLatin1String( ":/style/icons/" ) ) );
|
|
QDir::setSearchPaths( QLatin1String( "icon" ), QStringList( QLatin1String( ":/style/" ) ) ); // FIXME: does qt check for recursion ??
|
|
|
|
|
|
|
|
#ifdef BUILD_STATIC_LIBRARIES
|
|
// For static linking under windows:
|
|
Q_INIT_RESOURCE(lts_resources);
|
|
#endif
|
|
|
|
#define USE_QDIALOG
|
|
//#define USE_LTSFRAMELESS
|
|
//#define CHECK_ERROR
|
|
|
|
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 ); // test static_assert
|
|
#endif
|
|
|
|
unsigned int counter = 1;
|
|
|
|
auto doReadFile = [dialog,&counter]( int /*selectedFileId*/ )
|
|
{
|
|
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 );
|
|
|
|
//QDialog * dialog = new QDialog();
|
|
|
|
//QVBoxLayout * layout = new QVBoxLayout(dialog);
|
|
|
|
//PlanOverlaysPlugin::PlanOverlayModel * planOverlayModel = new PlanOverlaysPlugin::PlanOverlayModel(nullptr);
|
|
//PlanOverlaysPlugin::PlanOverlayView * planOverlayView = new PlanOverlaysPlugin::PlanOverlayView( planOverlayModel, dialog );
|
|
//
|
|
//PlanOverlaysPlugin::PlanOverlayModel::PlanItem planItem = planOverlayModel->planItem(1);
|
|
//
|
|
//planItem.m_folderId = 6;
|
|
//planItem.m_fileId = 42;
|
|
//planItem.m_dirPath = QStringLiteral("");
|
|
//planItem.m_fileName = QStringLiteral("Hugo");
|
|
//planItem.m_planName = QStringLiteral("Hugo");
|
|
//planItem.m_minScale = 250000;
|
|
//planItem.m_maxScale = 12000;
|
|
//planItem.m_opacity = 1;
|
|
//planItem.m_visibilty = true;
|
|
|
|
//planOverlayModel->updatePlanItem( planItem );
|
|
|
|
//planItem.m_id = 2;
|
|
//planItem.m_fileId = 43;
|
|
//planItem.m_fileName = QStringLiteral("Soda");
|
|
//planItem.m_planName = QStringLiteral("Soda");
|
|
|
|
//planOverlayModel->updatePlanItem( planItem );
|
|
|
|
//planItem.m_id = 3;
|
|
//planItem.m_fileId = 44;
|
|
//planItem.m_fileName = QStringLiteral("0815");
|
|
//planItem.m_planName = QStringLiteral("0815");
|
|
|
|
//planOverlayModel->updatePlanItem( planItem );
|
|
|
|
|
|
//layout->addWidget(planOverlayView);
|
|
|
|
dialog->show();
|
|
|
|
app.setQuitOnLastWindowClosed(true);
|
|
|
|
int retval = app.exec();
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return retval;
|
|
}
|