Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Jörg Turla, SPDG, 2017-04-24
#
ADD_SUBDIRECTORY(Gui)
#
# Gui Plugin Interface
#
ADD_INTERFACE_LIBRARY(PlanEditorGuiPluginInterface
${CMAKE_CURRENT_SOURCE_DIR}/plan_editor_gui_plugin_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/..
GuiPluginInterface
)
+36
View File
@@ -0,0 +1,36 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Jörg Turla, SPDG, 2017-04-24
#
SET (PlanEditorGuiPlugin_SRCS
list_chooser.cpp
list_chooser.h
plan_editor_gui_plugin.cpp
plan_editor_gui_plugin.h
)
SOURCE_GROUP(PlanEditorPlugin FILES ${PlanEditorGuiPlugin_SRCS})
NGL_ADD_LIBRARY(WS PlanEditorGuiPlugin MODULE ${PlanEditorGuiPlugin_SRCS})
NGL_TARGET_LINK_LIBRARIES( PlanEditorGuiPlugin
LtsSession
LtsSessionData
PlanEditorGuiPluginInterface
planEditor
svcPedDummy
situationMap
situationMapObjects
GuiPluginInterface
FlmDataPluginInterface
OpmDataPluginInterface
PpmDataPluginInterface
LtsUtilsGuiDds
LtsWidgets
NGLLogger
Qt5::Widgets
)
NGL_INSTALL_TARGET(PlanEditorGuiPlugin)
@@ -0,0 +1,180 @@
/**
**
** @RDE_HEADER@
** plan_chooser.cpp
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.7. ArcGIS 100
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 09.05.2017, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#include "list_chooser.h"
#include <QtCore/QEventLoop>
#include <QtCore/QSortFilterProxyModel>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QStringListModel>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QListView>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QVBoxLayout>
namespace PlanEditorPlugin
{
class ListChooserModel : public QStringListModel
{
Q_OBJECT
public:
explicit ListChooserModel( QObject * parent ) : QStringListModel(parent) {;}
~ListChooserModel() = default;
QVariant headerData( int section, Qt::Orientation, int ) const override
{
if (1 != section) return QVariant();
return tr("Name of Plan");
} // QVariant headerData( int section, Qt::Orientation, int ) const override
void setChooseList(const QStringList & list) { setStringList(list); }
}; // ListChooserModel
ListChooser::ListChooser(QObject *parent) : QObject(parent)
{
setObjectName( QLatin1String( "PlanEditorPlugin::ListChooser" ) );
} // ListChooser::ListChooser( QWidget * parent )
QString ListChooser::chooseFromList( const QString & title, const QStringList & list, const QString & currentChoose, bool existingOnly )
{
m_dialog = new LtsWidgets::LtsFramelessDialog( static_cast<QWidget*>(parent()), LtsWidgets::Behaviour::Modal );
m_dialog -> setWindowTitle( title );
m_dialog -> setAttribute(Qt::WidgetAttribute::WA_DeleteOnClose);
QVBoxLayout * layout = new QVBoxLayout( m_dialog.data() );
QHBoxLayout * layoutFilter = new QHBoxLayout();
QHBoxLayout * layoutCtrl = new QHBoxLayout();
QLineEdit * filter = new QLineEdit( m_dialog.data() );
QPushButton * pbFilter = new QPushButton( QIcon(QStringLiteral("icon:search.svg")), QString(), m_dialog );
layoutFilter->addSpacing(5);
layoutFilter->addWidget( new QLabel(tr("Filter:"),m_dialog.data()), 0 );
layoutFilter->addSpacing(5);
layoutFilter->addWidget( filter , 2 );
layoutFilter->addSpacing(5);
layoutFilter->addWidget( pbFilter, 0 );
layoutFilter->addSpacing(5);
ListChooserModel * listModel = new ListChooserModel(m_dialog.data());
listModel -> setChooseList(list);
QSortFilterProxyModel * filterProxy = new QSortFilterProxyModel( m_dialog.data() );
filterProxy -> setSourceModel( listModel );
filterProxy -> setFilterWildcard( QStringLiteral("*") );
connect( pbFilter, &QPushButton::clicked , this, [filter,filterProxy](bool) { filterProxy->setFilterWildcard(filter->text()); } );
connect( filter , &QLineEdit::returnPressed, this, [filter,filterProxy]() { filterProxy->setFilterWildcard(filter->text()); } );
QListView * listView = new QListView(m_dialog.data());
listView -> setModel( filterProxy );
listView -> setAlternatingRowColors( true );
listView -> setDragEnabled( false );
listView -> setFlow( QListView::Flow::TopToBottom );
listView -> setSelectionMode( QAbstractItemView::SelectionMode::SingleSelection );
listView -> setSelectionBehavior( QAbstractItemView::SelectionBehavior::SelectItems );
listView -> setSelectionMode( existingOnly ? QAbstractItemView::SelectionMode::SingleSelection : QAbstractItemView::SelectionMode::NoSelection );
QLineEdit * currentSelection = new QLineEdit( m_dialog.data() );
connect( listView->selectionModel(), &QItemSelectionModel::currentRowChanged, currentSelection, [listModel,currentSelection]( const QModelIndex & idx, const QModelIndex & )
{
currentSelection->setText( listModel->data(idx,Qt::DisplayRole).toString() );
} );
connect( currentSelection, &QLineEdit::textChanged, this, [this]( const QString & txt) { m_choosenString = txt; } );
currentSelection -> setReadOnly( existingOnly );
currentSelection -> setText( (existingOnly || list.contains(currentChoose)) ? currentChoose : QString() );
QLabel * laTitel = new QLabel(title,m_dialog.data());
laTitel->setAlignment( Qt::AlignHCenter );
layout->addWidget( laTitel );
layout->addSpacing(10);
layout->addLayout( layoutFilter, 0 );
layout->addSpacing(10);
layout->addWidget( listView, 2 );
layout->addSpacing(10);
layout->addWidget( new QLabel(tr("Choosed:"),m_dialog.data()), 0 );
layout->addWidget( currentSelection, 0 );
layout->addSpacing(10);
layout->addLayout( layoutCtrl, 0 );
layout->setAlignment( Qt::AlignHCenter );
QPushButton * pbCancel = new QPushButton( QIcon(QStringLiteral(":/style/dialog-close.svg")), tr("Cancel"), m_dialog.data() );
QPushButton * pbChoose = new QPushButton( QIcon(QStringLiteral(":/style/document_edit.svg")), tr("Choose"),m_dialog.data() );
layoutCtrl->addStretch(2);
layoutCtrl->addSpacing(5);
layoutCtrl->addWidget( pbChoose );
layoutCtrl->addSpacing(10);
layoutCtrl->addWidget( pbCancel );
layoutCtrl->addSpacing(5);
connect( pbCancel, &QPushButton::clicked, m_dialog.data(), [this](bool)
{
m_choosenString.clear();
m_dialog->reject();
});
connect( pbChoose, &QPushButton::clicked, m_dialog.data(), &LtsWidgets::LtsFramelessDialog::accept );
connect( m_dialog.data(), &LtsWidgets::LtsFramelessDialog::accepted, this, &ListChooser::selectionIsFinished );
connect( m_dialog.data(), &LtsWidgets::LtsFramelessDialog::rejected, this, &ListChooser::selectionIsFinished );
QEventLoop eventLoop;
connect( this, &ListChooser::selectionIsFinished, &eventLoop, &QEventLoop::quit, Qt::QueuedConnection );
m_dialog->show();
eventLoop.exec();
return m_choosenString;
} // QString ListChooser::chooseFromList( const QStringList & planList )
} // namespace PlanEditorPlugin
#include "list_chooser.moc"
+78
View File
@@ -0,0 +1,78 @@
/**
**
** @RDE_HEADER@
** plan_chooser.h
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.7. ArcGIS 100
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 09.05.2017, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <LtsWidgets/lts_frameless_dialog.h>
#include <QtCore/QPointer>
class QAbstractItemModel;
class QSortFilterProxyModel;
class QLineEdit;
class QListView;
class QPushButton;
namespace PlanEditorPlugin
{
/**
@class ListChooser
@brief Shows a list of strings and let the user choose one of them.
Shows a dialog to let the user choose one single string of a string list. The string list will be displayed
in a sorted alpha numerical order. The user can define a filter pattern to reduce the nummer of displayed strings.
*/
class ListChooser : public QObject
{
Q_OBJECT
public:
explicit ListChooser(QObject *parent);
~ListChooser() = default;
QString chooseFromList( const QString & title, const QStringList & list, const QString & currentChoose, bool existingOnly = true );
QString choosenString() const { return m_choosenString; }
private:
QPointer<LtsWidgets::LtsFramelessDialog> m_dialog;
QString m_choosenString;
signals:
void selectionIsFinished();
}; // ListChooser
} // namespace PlanEditorPlugin
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,351 @@
/**
**
** @RDE_HEADER@
** plan_editor.h
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.7. ArcGIS 100
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 24.04.2017, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include <Plugins/PlanEditor/PlanEditorPlugin/plan_editor_gui_plugin_interface.h>
#include <Plugins/FileManagement/flm_data_plugin_interface.h>
#include <QtCore/QObject>
namespace Core
{
class FunctionReplyObject;
}
namespace ParticipantManagement
{
class Participant;
}
namespace PlanEditorPlugin
{
/**
@class PlanEditorGuiPlugin
Implementation of plugin base to create interface instance. To use the plugin it has to be configured
in apps.json configuration file. The Type and IID has to be set to:
- "Type": "gui"
- "IID": "planeditor"
The PlanEditorGuiPlugin uses the file manager data plugin to read and store data with file manager service.
Following a code snippet is from apps.json and shows the configuration of PlanEditorGuiPlugin
@code
{
"Active": true,
"AppName": "PlanEditor",
"Plugins":
[
{
"Type": "gui",
"IID": "planeditor",
"Flags":
[
"actions",
"main"
]
},
{
"Type": "gui",
"IID": "asb.flmsymbolproxy"
},
{
"Type": "gui",
"IID": "exm",
"Flags":
[
"payload"
]
},
{
"Type": "gui",
"IID": "flm.combobox"
},
{
"Type": "gui",
"IID": "flm.explorer"
},
{
"Type": "gui",
"IID" : "planoverlays",
"Flags":
[
"actions"
]
},
{
"Type": "gui",
"IID": "sitmap",
"Flags":
[
"payload",
"actions"
]
},
{
"Type": "data",
"IID": "aes"
},
{
"Type": "data",
"IID": "asb"
},
{
"Type": "data",
"IID": "asm"
},
{
"Type": "data",
"IID": "exm"
},
{
"Type": "data",
"IID": "flm"
},
{
"Type": "data",
"IID": "ism"
},
{
"Type": "data",
"IID": "opm"
},
{
"Type": "data",
"IID": "pdm"
},
{
"Type": "data",
"IID": "ppm"
},
{
"Type": "data",
"IID": "srm"
},
{
"Type": "data",
"IID": "srp"
}
]
},
@endcode
@see InterfaceImpl, PlanEditor
*/
class PlanEditorGuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:planeditor")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit PlanEditorGuiPlugin() = default;
virtual ~PlanEditorGuiPlugin() = default;
QString pluginName() override { return QLatin1String("PlanEditorGuiPlugin"); }
/**
Provides an instance of PlanEditorGuiPlugin interface.
@see InterfaceImpl
*/
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession * session) override;
bool availableInPartition(IDL::PartitionType partition) const override
{
return (partition == IDL::PartitionType::Global ||
partition == IDL::PartitionType::Exercise ||
partition == IDL::PartitionType::Replay
);
}
}; // PlanEditorGuiPlugin
/**
@class InterfaceImpl
Implementation of PlanEditorGuiPlugin interface to create and modify geometry models for plans
@see PlanEditorGuiPlugin, PlanEditor
*/
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignGuiInterface
{
Q_OBJECT
struct InternalData;
InternalData * m_internal;
public:
explicit InterfaceImpl( LtsSession::LtsSession * session );
virtual ~InterfaceImpl();
/**
Override to initialize plugin.
@{
*/
QVector<LtsWidgets::PluginData> getActions() override; /**< returns vector of actions to create */
QString menuGroup() const override;
bool fetchInterfaces() override; /**< Initialize data plugins */
void clearInterfaces() override;
/** @}*/
void setPlanToEdit(const QByteArray & planXMLContent) override;
void addSaveSnapshotAction( const QIcon & btnIcon, const QString & btnText, const std::function<bool(const QByteArray & planXMLContent)> &saveContent ) override;
bool event(QEvent *e) override;
private:
/**
Creates an new plan with file management servive.
@param clearGeometryModel Resets the geometry model to an empty plan if \c clearGeometryModel is true;
*/
bool fmsCreatePlan( bool clearGeometryModel = true );
/**
Reads a new plan with file management servive.
*/
void fmsReadPlan();
/**
Reads and import a plan with file management servive.
*/
void fmsImportPlan();
/**
Stores an already existing plan with file management servive.
*/
bool fmsWritePlan( bool saveAs );
/**
Stores an already existing plan with file management servive.
*/
// void fmsWritePlanAndWait();
/**
Modifies existing plan with file management service
*/
bool fmsModifyPlan( int fileId, bool saveAs = false );
/**
Delete plan from file managment service. The file will not really be deleted. Only the removed flag will be set, so that
it can be restore by system admin
*/
void fmsDeletePlan();
/**
Read all symbol favourite settingsand let teh user choose one to install.
*/
void readAllSymbolFavourites();
/**
Let the user choose a name to store symbol favourites settings to and stores it.
*/
void storeAllSymbolFavourites();
/**
Request to read symbol favourite setting from file management service.
@param favName Name of symbol favourites to read.
@param favXMLContent Settings of favourites will be return here.
@param showErrorMessage Display error message if reading favourites failed.
*/
void readSymbolFavouritesRequest( const QString & favName, QString & favXMLContent, bool showErrorMessage = true );
/**
Request to store symbol favourite setting with file management service.
@param favName Name of plan to store.
@param favXMLContent Content of symbol favouite setting as XML structure.
*/
void storeSymbolFavouritesRequest( const QString & favName, const QString & favXMLContent );
/**
Launch plan editor
*/
LtsWidgets::LtsDialog * startupPlanEditor( QWidget * parent, const QString & widgetName );
/**
Provides a name of default symbol favourite settings buildup from user name and user id.
*/
static QString buildFavDefaultName();
private slots:
/**
Read a single scope of symbol favourite settings from file management service.
@param favXMLContent Content of symbol favouite setting as XML structure.
@see PlanEditor
*/
void onfileServiceReadSymbolFavourites( QString & favXMLContent );
/**
Store a single scope of symbol favourite settings with file management service.
@param favXMLContent Content of symbol favouite setting as XML structure.
qsee PlanEditor
*/
void onfileServiceStoreSymbolFavourites( const QString & favXMLContent );
/**
Reads default symbol favourite settings from file management service.
*/
void onReadUserDefaultSymbolFavourites();
/**
Stores default symbol favourite settings with file management service.
*/
void onStoreUserDefaultSymbolFavourites();
/**
Slot to check changed of loaded plans in file managemenent
*/
void onPlanContentChanged( const FileManagement::FileContent &data, DataModification modType );
/**
run a loop over all participants to get a list of used Sidc's
*/
void onIterateParticipantsSidc();
//signals:
//void saveHasFinished();
}; // InterfaceImpl
} // namespace PlanEditorPlugin
@@ -0,0 +1,51 @@
/**
**
** @RDE_HEADER@
** plan_editor.h
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.7. ArcGIS 100
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 24.04.2017, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <functional>
class QByteArray;
class QIcon;
class QString;
namespace PlanEditorPlugin
{
class ForeignGuiInterface
{
public:
ForeignGuiInterface() = default;
virtual ~ForeignGuiInterface() = default;
virtual void setPlanToEdit(const QByteArray &planXMLContent) = 0;
virtual void addSaveSnapshotAction(const QIcon & btnIcon, const QString &btnText, const std::function<bool(const QByteArray & lanXMLContent)> &saveContent) = 0;
}; // ForeignGuiInterface
} // namespace PlanEditorPlugin