/** * @RDE_HEADER@ * main * $Id$ * $HeadURL$ * $Author$ */ #include #include #include "../plan_overlay_dialog.h" #include "../plan_overlay_model.h" #include "../plan_overlay_view.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ------------------------------------------------------------------- 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 * dialog = new PlanOverlaysPlugin::PlanOverlayDialog( nullptr, planOverlayModel, nullptr, nullptr ); #endif #ifdef USE_LTSFRAMELESS PlanOverlaysPlugin::PlanOverlayDialog * dialog = new PlanOverlaysPlugin::PlanOverlayDialog( nullptr, planOverlayModel, nullptr ); #endif #ifdef CHECK_ERROR PlanOverlaysPlugin::PlanOverlayDialog * dialog = new PlanOverlaysPlugin::PlanOverlayDialog( 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; }