Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-02-11
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(TlnViewGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tln_view_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(TlnEventTimelineGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tln_event_timeline_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
# need top be shared due to signals/slots
|
||||
NGL_ADD_LIBRARY(WS TlnDataPluginInterface SHARED tln_data_plugin_interface.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(TlnDataPluginInterface
|
||||
Qt5::Core
|
||||
svcEemCommon
|
||||
DataPluginInterface
|
||||
)
|
||||
NGL_INSTALL_TARGET(TlnDataPluginInterface)
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-03-27
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY(WS TlnDataPlugin MODULE tln_data_plugin.cpp tln_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(TlnDataPlugin
|
||||
Qt5::Core
|
||||
Qt5::WebSockets
|
||||
LtsSessionDataDds
|
||||
NGLLogger
|
||||
nglsettings
|
||||
svcEemClient
|
||||
TlnDataPluginInterface
|
||||
)
|
||||
NGL_INSTALL_TARGET(TlnDataPlugin)
|
||||
+352
@@ -0,0 +1,352 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for The Timeline - DDS => GUI
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-27
|
||||
*/
|
||||
|
||||
#include "tln_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <nglsettings/nglsettings_connections.h>
|
||||
#include <ExerciseEventManagement/eem_db_structs.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QTimer>
|
||||
#include <QUrlQuery>
|
||||
#include <QWebSocket>
|
||||
|
||||
namespace TimeLineManagement
|
||||
{
|
||||
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
return std::make_shared<DataInterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(LtsSession::LtsSessionDataDds *session)
|
||||
: DataInterface()
|
||||
, m_foreign(std::make_shared<ForeignInterfaceImpl>(session))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Timeline.Data"))
|
||||
{}
|
||||
|
||||
ForeignInterfaceImpl::ForeignInterfaceImpl(LtsSession::LtsSessionDataDds *session)
|
||||
: m_session(session)
|
||||
, m_webSocketScm(nullptr)
|
||||
, m_webSocketEem(nullptr)
|
||||
, m_liveHistoryBufferTimer(new QTimer(this))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Timeline.Data"))
|
||||
{
|
||||
connect(m_liveHistoryBufferTimer, &QTimer::timeout, this, &ForeignInterfaceImpl::onClearHistoryBuffer);
|
||||
m_liveHistoryBufferTimer->setInterval(5000);
|
||||
m_liveHistoryBufferTimer->start();
|
||||
// open ws socket to exercise event management
|
||||
QTimer::singleShot(0, this, &ForeignInterfaceImpl::connectToScm);
|
||||
}
|
||||
|
||||
ForeignInterfaceImpl::~ForeignInterfaceImpl()
|
||||
{
|
||||
m_pendingRequests.clear();
|
||||
m_liveHistoryBuffer.clear();
|
||||
|
||||
cleanupSocket(m_webSocketScm);
|
||||
cleanupSocket(m_webSocketEem);
|
||||
}
|
||||
|
||||
static ExerciseEventManagement::Event db2dds(const ExerciseEventManagement::Database::EemEvent &evDb)
|
||||
{
|
||||
ExerciseEventManagement::Event ev;
|
||||
ev.id(evDb.id & 0xffffffff);
|
||||
ev.sampleTime(evDb.sampleTime);
|
||||
ev.eventTypeId(evDb.eventTypeId);
|
||||
ev.participantId(evDb.participantId);
|
||||
ev.partyId(evDb.partyId);
|
||||
ev.equipmentNumber(evDb.equipmentNumber);
|
||||
ev.properties(evDb.properties.toUtf8().data());
|
||||
// Add Originator to Hit Building
|
||||
if ( ev.eventTypeId() == ProjectDataManagement::EventType_def::HitBuilding)
|
||||
{
|
||||
QJsonObject properties = QJsonDocument::fromJson(QString::fromStdString(ev.properties()).toUtf8()).object();
|
||||
|
||||
if ( properties.contains(QStringLiteral("AesName")))
|
||||
{
|
||||
properties.insert(QStringLiteral("Originator"), properties.value(QStringLiteral("AesName")).toString());
|
||||
} else if ( properties.contains(QStringLiteral("OriginatorEquipmentNumber")))
|
||||
{
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(ev.properties()), &parseError);
|
||||
|
||||
long originatorEquipmentNumber = properties.value(QStringLiteral("OriginatorEquipmentNumber")).toInt();
|
||||
QString originatorEquipmentNumberStr = QString::number(originatorEquipmentNumber);
|
||||
properties.insert(QStringLiteral("Originator"),originatorEquipmentNumberStr);
|
||||
}
|
||||
QJsonDocument doc(properties);
|
||||
//QString strJson(QStringLiteral( doc.toJson(QJsonDocument::Compact)));
|
||||
std::string propertiesStd = QJsonDocument(properties).toJson(QJsonDocument::Compact).toStdString();
|
||||
ev.properties(propertiesStd);
|
||||
}
|
||||
ev.position(Core::GeoPosition(evDb.position.x(), evDb.position.y(), evDb.position.z()));
|
||||
|
||||
return ev;
|
||||
}
|
||||
|
||||
TimelineDataProvider::TimelineDataProvider(int requestId, const QUrl &url,
|
||||
qint64 from, qint64 to,
|
||||
const QVector<int> &eventTypeIds,
|
||||
const QJsonObject &filter)
|
||||
: m_webSocketEem(new QWebSocket)
|
||||
, m_requestId(requestId)
|
||||
, m_bFinshed(false)
|
||||
, m_requestMin(from)
|
||||
, m_requestMax(to)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Timeline.Data"))
|
||||
{
|
||||
connect(m_webSocketEem, &QWebSocket::disconnected,
|
||||
this, &TimelineDataProvider::disconnectedFromEem);
|
||||
connect(m_webSocketEem, &QWebSocket::textMessageReceived,
|
||||
this, &TimelineDataProvider::textMessageFromEem);
|
||||
|
||||
|
||||
if (from > to)
|
||||
std::swap(from, to);
|
||||
|
||||
QUrl realUrl(url);
|
||||
realUrl.setPath(QStringLiteral("/request"));
|
||||
QUrlQuery query;
|
||||
query.addQueryItem(QStringLiteral("from"), QString::number(from));
|
||||
query.addQueryItem(QStringLiteral("to"), QString::number(to));
|
||||
query.addQueryItem(QStringLiteral("requestId"), QString::number(requestId));
|
||||
if (!eventTypeIds.isEmpty())
|
||||
{
|
||||
QStringList sl;
|
||||
sl.reserve(eventTypeIds.size());
|
||||
for (int id : eventTypeIds)
|
||||
sl += QString::number(id);
|
||||
query.addQueryItem(QStringLiteral("eventTypeId"), sl.join(QLatin1Char(',')));
|
||||
}
|
||||
if (!filter.isEmpty())
|
||||
{
|
||||
const QJsonDocument doc(filter);
|
||||
query.addQueryItem(QStringLiteral("filter"), QString::fromUtf8(doc.toJson(QJsonDocument::Compact)));
|
||||
}
|
||||
|
||||
realUrl.setQuery(query);
|
||||
m_webSocketEem->open(realUrl);
|
||||
DEBUG_LOG(m_logger) << "requesting data from EEM: " << realUrl.toString();
|
||||
}
|
||||
|
||||
TimelineDataProvider::~TimelineDataProvider()
|
||||
{
|
||||
m_webSocketEem->disconnect(this);
|
||||
m_webSocketEem->close();
|
||||
m_webSocketEem->deleteLater();
|
||||
}
|
||||
|
||||
void TimelineDataProvider::disconnectedFromEem()
|
||||
{
|
||||
m_webSocketEem->close();
|
||||
if (m_bFinshed)
|
||||
return;
|
||||
m_bFinshed = true;
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void TimelineDataProvider::textMessageFromEem(const QString &message)
|
||||
{
|
||||
if (message.isEmpty() || message == QStringLiteral("{}"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "textMessageFromEem - finished";
|
||||
disconnectedFromEem();
|
||||
return;
|
||||
}
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(message.toUtf8()));
|
||||
const QJsonArray arr = doc.array();
|
||||
DEBUG_LOG(m_logger) << "textMessageFromEem - #events: " << arr.size();
|
||||
m_eventData.reserve(m_eventData.size() + arr.size());
|
||||
using namespace ExerciseEventManagement::Database;
|
||||
std::transform(arr.begin(), arr.end(),
|
||||
std::back_inserter(m_eventData),
|
||||
[](const QJsonValue &val) { return db2dds(fromJson<EemEvent>(val.toObject())); });
|
||||
}
|
||||
|
||||
TimelineDataProviderInterface *ForeignInterfaceImpl::requestData(qint64 from, qint64 to, const QVector<int> &eventTypeIds, const QJsonObject &filter)
|
||||
{
|
||||
if (!m_webSocketEem)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No connection to EEM - can not request data!";
|
||||
return nullptr;
|
||||
}
|
||||
static int s_requestId = 0;
|
||||
++s_requestId;
|
||||
int curRequestId = s_requestId;
|
||||
TimelineDataProvider *tldp = new TimelineDataProvider(curRequestId, eemUrl(), from, to, eventTypeIds, filter);
|
||||
connect(tldp, &TimelineDataProvider::finished, this, &ForeignInterfaceImpl::requestFinished);
|
||||
connect(tldp, &TimelineDataProvider::destroyed, this, [this, curRequestId]() { m_pendingRequests.remove(curRequestId);});
|
||||
m_pendingRequests[curRequestId] = tldp;
|
||||
DEBUG_LOG(m_logger) << "add to m_pendingRequests: " << curRequestId << ", " << tldp;
|
||||
return tldp;
|
||||
}
|
||||
|
||||
QVector<ExerciseEventManagement::Event> ForeignInterfaceImpl::liveHistory() const
|
||||
{
|
||||
QVector<ExerciseEventManagement::Event> ret;
|
||||
for (const QVector<ExerciseEventManagement::Event> &vec : m_liveHistoryBuffer)
|
||||
ret += vec;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::connectToScm()
|
||||
{
|
||||
cleanupSocket(m_webSocketScm);
|
||||
m_webSocketScm = new QWebSocket;
|
||||
connect(m_webSocketScm, &QWebSocket::connected,
|
||||
this, &ForeignInterfaceImpl::connectedToScm);
|
||||
connect(m_webSocketScm, &QWebSocket::textMessageReceived,
|
||||
this, &ForeignInterfaceImpl::textMessageFromScm);
|
||||
const QUrl scmUrl(QStringLiteral("ws://%1:%2")
|
||||
.arg(NGL::Connections::hostName(NGL::Connections::eConnection::SCM_WEBSOCKET))
|
||||
.arg(NGL::Connections::port(NGL::Connections::eConnection::SCM_WEBSOCKET)));
|
||||
DEBUG_LOG(m_logger) << "Trying to connect to SCM at " << scmUrl.toString();
|
||||
m_webSocketScm->open(scmUrl);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::connectedToScm()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Connected to SCM...";
|
||||
m_webSocketScm->sendTextMessage(QStringLiteral("{\"type\": \"servicePortsInformationRequest\",\"uuid\": \"7777\"}"));
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::textMessageFromScm(const QString &message)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "textMessageFromScm from scm: " << message;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
const QJsonArray exercises = doc.object().value(QStringLiteral("data")).toArray();
|
||||
for (const QJsonValue &valEx : exercises)
|
||||
{
|
||||
const QJsonObject &exercise = valEx.toObject();
|
||||
const int exerciseId = exercise.value(QStringLiteral("exerciseId")).toInt();
|
||||
DEBUG_LOG(m_logger) << "textMessageFromScm from scm - exerciseId " << exerciseId;
|
||||
|
||||
if (exerciseId != m_session->exerciseId())
|
||||
continue;
|
||||
|
||||
const QJsonArray services = exercise.value(QStringLiteral("services")).toArray();
|
||||
for (const QJsonValue &valSvc : services)
|
||||
{
|
||||
const QJsonObject &service = valSvc.toObject();
|
||||
const QString svcName = service.value(QStringLiteral("nameAbbrevation")).toString().toUpper();
|
||||
DEBUG_LOG(m_logger) << "textMessageFromScm from scm - svcName " << svcName;
|
||||
|
||||
if (svcName != QStringLiteral("EEM"))
|
||||
continue;
|
||||
|
||||
const QJsonArray ports = service.value(QStringLiteral("ports")).toArray();
|
||||
for (const QJsonValue &valPort : ports)
|
||||
{
|
||||
const QJsonObject &port = valPort.toObject();
|
||||
int typeId = port.value(QStringLiteral("typeId")).toInt();
|
||||
if (typeId == Core::PortType::WebSocketServer)
|
||||
{
|
||||
m_eemPort = port.value(QStringLiteral("number")).toInt();
|
||||
connectToEem();
|
||||
cleanupSocket(m_webSocketScm);
|
||||
m_webSocketScm = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::connectToEem()
|
||||
{
|
||||
cleanupSocket(m_webSocketEem);
|
||||
m_webSocketEem = new QWebSocket;
|
||||
connect(m_webSocketEem, &QWebSocket::connected,
|
||||
this, &ForeignInterfaceImpl::connectedToEem);
|
||||
connect(m_webSocketEem, &QWebSocket::disconnected,
|
||||
this, &ForeignInterfaceImpl::disconnectedFromEem);
|
||||
connect(m_webSocketEem, &QWebSocket::textMessageReceived,
|
||||
this, &ForeignInterfaceImpl::textMessageFromEem);
|
||||
QUrl url(eemUrl());
|
||||
url.setPath(QStringLiteral("/live"));
|
||||
DEBUG_LOG(m_logger) << "Trying to connect to EEM at " << url.toString();
|
||||
m_webSocketEem->open(url);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::connectedToEem()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Connected to EEM...";
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::disconnectedFromEem()
|
||||
{
|
||||
WARNING_LOG(m_logger) << "EEM connection closed - try to reconnect";
|
||||
QTimer::singleShot(500, this, &ForeignInterfaceImpl::connectToScm);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::textMessageFromEem(const QString &message)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "textMessageFromEem: " << message;
|
||||
|
||||
const QJsonObject obj(QJsonDocument::fromJson(message.toUtf8()).object());
|
||||
using namespace ExerciseEventManagement::Database;
|
||||
ExerciseEventManagement::Event ev(db2dds(fromJson<EemEvent>(obj)));
|
||||
emit liveEvent(ev);
|
||||
m_liveHistoryBuffer[ev.sampleTime() / 1000].push_back(std::move(ev));
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::requestFinished()
|
||||
{
|
||||
TimelineDataProvider *tldp = qobject_cast<TimelineDataProvider *>(sender());
|
||||
if (!tldp)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "requestFinished without valid sender";
|
||||
return;
|
||||
}
|
||||
auto it = m_pendingRequests.find(tldp->requestId());
|
||||
if (it == m_pendingRequests.end())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "requestFinished but request not found in pending requests: " << tldp->requestId() << ", " << tldp;
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "emit requestedDataAvailable for " << tldp->requestId() << ", #events: " << tldp->eventData().size() << ", " << tldp;
|
||||
emit requestedDataAvailable(it.value());
|
||||
it.value()->deleteLater();
|
||||
m_pendingRequests.erase(it);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::cleanupSocket(QWebSocket *s)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
s->disconnect(this);
|
||||
s->close();
|
||||
s->deleteLater();
|
||||
}
|
||||
|
||||
const QUrl ForeignInterfaceImpl::eemUrl() const
|
||||
{
|
||||
return QUrl(QStringLiteral("ws://%1:%2")
|
||||
.arg(NGL::Connections::hostName(NGL::Connections::eConnection::SCM_WEBSOCKET))
|
||||
.arg(m_eemPort));
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::onClearHistoryBuffer()
|
||||
{
|
||||
qint64 toRemove = time(nullptr) - 10;
|
||||
auto it = m_liveHistoryBuffer.begin();
|
||||
while (it != m_liveHistoryBuffer.end() && it.key() < toRemove)
|
||||
it = m_liveHistoryBuffer.erase(it);
|
||||
}
|
||||
|
||||
} // namespace TimeLineManagement
|
||||
Executable
+131
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for The Timeline - DDS => GUI
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-03-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/Timeline/tln_data_plugin_interface.h>
|
||||
#include <ExerciseEventManagement/eem.hpp>
|
||||
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
|
||||
class QTimer;
|
||||
class QWebSocket;
|
||||
namespace TimeLineManagement
|
||||
{
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:tln")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("Timeline"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public QObject, public DataInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DataInterfaceImpl(LtsSession::LtsSessionDataDds *session);
|
||||
|
||||
std::shared_ptr<TimeLineManagement::ForeignDataInterface> getForeignDataInterface() override { return m_foreign; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<TimeLineManagement::ForeignDataInterface> m_foreign;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
|
||||
class TimelineDataProvider final : public QObject, public TimelineDataProviderInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineDataProvider(int requestId, const QUrl &url,
|
||||
qint64 from, qint64 to,
|
||||
const QVector<int> &eventTypeIds = QVector<int>(),
|
||||
const QJsonObject &filter = QJsonObject());
|
||||
~TimelineDataProvider();
|
||||
|
||||
const QVector<ExerciseEventManagement::Event> &eventData() const override { return m_eventData; }
|
||||
int requestId() const override { return m_requestId; }
|
||||
void getRequestTime(qint64 &requestMin /* out */, qint64 &requestMax /* out */) const override { requestMin = m_requestMin; requestMax = m_requestMax; }
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
void disconnectedFromEem();
|
||||
void textMessageFromEem(const QString &message);
|
||||
|
||||
private:
|
||||
QVector<ExerciseEventManagement::Event> m_eventData;
|
||||
QWebSocket *m_webSocketEem;
|
||||
int m_requestId;
|
||||
bool m_bFinshed;
|
||||
qint64 m_requestMin;
|
||||
qint64 m_requestMax;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
class ForeignInterfaceImpl final : public ForeignDataInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ForeignInterfaceImpl(LtsSession::LtsSessionDataDds *session);
|
||||
~ForeignInterfaceImpl();
|
||||
|
||||
TimelineDataProviderInterface *requestData(qint64 from,
|
||||
qint64 to,
|
||||
const QVector<int> &eventTypeIds = QVector<int>(),
|
||||
const QJsonObject &filter = QJsonObject()) override;
|
||||
QVector<ExerciseEventManagement::Event> liveHistory() const override;
|
||||
const QUrl eemUrl() const override;
|
||||
|
||||
private:
|
||||
void connectToScm();
|
||||
void connectedToScm();
|
||||
void textMessageFromScm(const QString &message);
|
||||
void connectToEem();
|
||||
void connectedToEem();
|
||||
void disconnectedFromEem();
|
||||
void textMessageFromEem(const QString &message);
|
||||
|
||||
void requestFinished();
|
||||
void cleanupSocket(QWebSocket *s);
|
||||
|
||||
void onClearHistoryBuffer();
|
||||
|
||||
private:
|
||||
QMap<qint64, QVector<ExerciseEventManagement::Event>> m_liveHistoryBuffer;
|
||||
QHash<int, TimelineDataProvider *> m_pendingRequests; // requestId
|
||||
|
||||
LtsSession::LtsSessionDataDds *m_session;
|
||||
QWebSocket *m_webSocketScm;
|
||||
QWebSocket *m_webSocketEem;
|
||||
QTimer *m_liveHistoryBufferTimer;
|
||||
quint16 m_eemPort;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace TimeLineManagement
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-02-10
|
||||
#
|
||||
|
||||
#ADD_SUBDIRECTORY(TimelineView)
|
||||
ADD_SUBDIRECTORY(EventTimeline)
|
||||
+301
@@ -0,0 +1,301 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Filip Biedziak, SLTE, 2021-06-03
|
||||
#
|
||||
|
||||
# Filter
|
||||
SET(tln_event_types_SRCS
|
||||
# EventTypes/BCContamination/tln_bccontamination_event_factory.cpp
|
||||
# EventTypes/BCContamination/tln_bccontamination_event_factory.h
|
||||
# EventTypes/BCContamination/tln_bccontamination_filter.cpp
|
||||
# EventTypes/BCContamination/tln_bccontamination_filter.h
|
||||
# EventTypes/BCContamination/tln_bccontamination_item.cpp
|
||||
# EventTypes/BCContamination/tln_bccontamination_item.h
|
||||
|
||||
EventTypes/BiteMessage/tln_bite_message_event_factory.cpp
|
||||
EventTypes/BiteMessage/tln_bite_message_event_factory.h
|
||||
EventTypes/BiteMessage/tln_bite_message_filter.cpp
|
||||
EventTypes/BiteMessage/tln_bite_message_filter.h
|
||||
EventTypes/BiteMessage/tln_bite_message_item.cpp
|
||||
EventTypes/BiteMessage/tln_bite_message_item.h
|
||||
|
||||
EventTypes/Block/tln_block_item.cpp
|
||||
EventTypes/Block/tln_block_item.h
|
||||
|
||||
# EventTypes/Borderline/tln_borderline_event_factory.cpp
|
||||
# EventTypes/Borderline/tln_borderline_event_factory.h
|
||||
# EventTypes/Borderline/tln_borderline_filter.cpp
|
||||
# EventTypes/Borderline/tln_borderline_filter.h
|
||||
# EventTypes/Borderline/tln_borderline_item.cpp
|
||||
# EventTypes/Borderline/tln_borderline_item.h
|
||||
|
||||
EventTypes/CameraVideo/tln_camera_video_event_factory.cpp
|
||||
EventTypes/CameraVideo/tln_camera_video_event_factory.h
|
||||
EventTypes/CameraVideo/tln_camera_video_filter.cpp
|
||||
EventTypes/CameraVideo/tln_camera_video_filter.h
|
||||
EventTypes/CameraVideo/tln_camera_video_item.cpp
|
||||
EventTypes/CameraVideo/tln_camera_video_item.h
|
||||
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_event_factory.cpp
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_event_factory.h
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_filter.cpp
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_filter.h
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_item.cpp
|
||||
EventTypes/CrossBorderline/tln_cross_borderline_item.h
|
||||
|
||||
# EventTypes/DangerArea/tln_danger_area_event_factory.cpp
|
||||
# EventTypes/DangerArea/tln_danger_area_event_factory.h
|
||||
# EventTypes/DangerArea/tln_danger_area_filter.cpp
|
||||
# EventTypes/DangerArea/tln_danger_area_filter.h
|
||||
# EventTypes/DangerArea/tln_danger_area_item.cpp
|
||||
# EventTypes/DangerArea/tln_danger_area_item.h
|
||||
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_event_factory.cpp
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_event_factory.h
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_filter.cpp
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_filter.h
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_item.cpp
|
||||
# EventTypes/EmergencyCall/tln_emergency_call_item.h
|
||||
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_event_factory.cpp
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_event_factory.h
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_filter.cpp
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_filter.h
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_item.cpp
|
||||
# EventTypes/EnterDangerArea/tln_enter_danger_area_item.h
|
||||
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_event_factory.cpp
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_event_factory.h
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_filter.cpp
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_filter.h
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_item.cpp
|
||||
# EventTypes/EnterFunctionalArea/tln_enter_functional_area_item.h
|
||||
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_event_factory.cpp
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_event_factory.h
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_filter.cpp
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_filter.h
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_item.cpp
|
||||
# EventTypes/EnterMineArea/tln_enter_mine_area_item.h
|
||||
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_event_factory.cpp
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_event_factory.h
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_filter.cpp
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_filter.h
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_item.cpp
|
||||
# EventTypes/EnterNuclear/tln_enter_nuclear_item.h
|
||||
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_event_factory.cpp
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_event_factory.h
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_filter.cpp
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_filter.h
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_item.cpp
|
||||
# EventTypes/EquipmentErrorReport/tln_equipment_error_report_item.h
|
||||
|
||||
EventTypes/FireEvent/tln_fire_event_event_factory.cpp
|
||||
EventTypes/FireEvent/tln_fire_event_event_factory.h
|
||||
EventTypes/FireEvent/tln_fire_event_filter.cpp
|
||||
EventTypes/FireEvent/tln_fire_event_filter.h
|
||||
EventTypes/FireEvent/tln_fire_event_item.cpp
|
||||
EventTypes/FireEvent/tln_fire_event_item.h
|
||||
|
||||
EventTypes/Hit/tln_hit_event_factory.cpp
|
||||
EventTypes/Hit/tln_hit_event_factory.h
|
||||
EventTypes/Hit/tln_hit_filter.cpp
|
||||
EventTypes/Hit/tln_hit_filter.h
|
||||
EventTypes/Hit/tln_hit_item.cpp
|
||||
EventTypes/Hit/tln_hit_item.h
|
||||
|
||||
EventTypes/HitBuilding/tln_hit_building_event_factory.cpp
|
||||
EventTypes/HitBuilding/tln_hit_building_event_factory.h
|
||||
EventTypes/HitBuilding/tln_hit_building_filter.cpp
|
||||
EventTypes/HitBuilding/tln_hit_building_filter.h
|
||||
EventTypes/HitBuilding/tln_hit_building_item.cpp
|
||||
EventTypes/HitBuilding/tln_hit_building_item.h
|
||||
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_event_factory.cpp
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_event_factory.h
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_filter.cpp
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_filter.h
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_item.cpp
|
||||
EventTypes/HitEffectSimulation/tln_hit_effect_simulation_item.h
|
||||
|
||||
EventTypes/Manipulation/tln_manipulation_event_factory.cpp
|
||||
EventTypes/Manipulation/tln_manipulation_event_factory.h
|
||||
EventTypes/Manipulation/tln_manipulation_filter.cpp
|
||||
EventTypes/Manipulation/tln_manipulation_filter.h
|
||||
EventTypes/Manipulation/tln_manipulation_item.cpp
|
||||
EventTypes/Manipulation/tln_manipulation_item.h
|
||||
|
||||
EventTypes/Marker/tln_marker_event_factory.cpp
|
||||
EventTypes/Marker/tln_marker_event_factory.h
|
||||
EventTypes/Marker/tln_marker_filter.cpp
|
||||
EventTypes/Marker/tln_marker_filter.h
|
||||
EventTypes/Marker/tln_marker_item.cpp
|
||||
EventTypes/Marker/tln_marker_item.h
|
||||
|
||||
EventTypes/RadioCnr/tln_radio_cnr_event_factory.cpp
|
||||
EventTypes/RadioCnr/tln_radio_cnr_event_factory.h
|
||||
EventTypes/RadioCnr/tln_radio_cnr_filter.cpp
|
||||
EventTypes/RadioCnr/tln_radio_cnr_filter.h
|
||||
EventTypes/RadioCnr/tln_radio_cnr_item.cpp
|
||||
EventTypes/RadioCnr/tln_radio_cnr_item.h
|
||||
|
||||
EventTypes/RadioTvc/tln_radio_tvc_event_factory.cpp
|
||||
EventTypes/RadioTvc/tln_radio_tvc_event_factory.h
|
||||
EventTypes/RadioTvc/tln_radio_tvc_filter.cpp
|
||||
EventTypes/RadioTvc/tln_radio_tvc_filter.h
|
||||
EventTypes/RadioTvc/tln_radio_tvc_item.cpp
|
||||
EventTypes/RadioTvc/tln_radio_tvc_item.h
|
||||
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_event_factory.cpp
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_event_factory.h
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_filter.cpp
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_filter.h
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_item.cpp
|
||||
EventTypes/WeaponAssignment/tln_weapon_assignment_item.h
|
||||
|
||||
# EventTypes/MineArea/tln_mine_area_event_factory.cpp
|
||||
# EventTypes/MineArea/tln_mine_area_event_factory.h
|
||||
# EventTypes/MineArea/tln_mine_area_filter.cpp
|
||||
# EventTypes/MineArea/tln_mine_area_filter.h
|
||||
# EventTypes/MineArea/tln_mine_area_item.cpp
|
||||
# EventTypes/MineArea/tln_mine_area_item.h
|
||||
)
|
||||
|
||||
SET(tln_event_types_UICS
|
||||
)
|
||||
|
||||
# Timeline
|
||||
SET(tln_event_timeline_gui_SRCS
|
||||
tln_filter_dialog.cpp
|
||||
tln_filter_dialog.h
|
||||
tln_filter_edit_dialog.cpp
|
||||
tln_filter_edit_dialog.h
|
||||
tln_filter_model.cpp
|
||||
tln_filter_model.h
|
||||
tln_item_info_dialog.cpp
|
||||
tln_item_info_dialog.h
|
||||
tln_item_list_dialog.cpp
|
||||
tln_item_list_dialog.h
|
||||
tln_item_list_model.cpp
|
||||
tln_item_list_model.h
|
||||
tln_legend.cpp
|
||||
tln_legend.h
|
||||
tln_timeline_delegate.cpp
|
||||
tln_timeline_delegate.h
|
||||
tln_timeline_dialog.cpp
|
||||
tln_timeline_dialog.h
|
||||
tln_timeline_model.cpp
|
||||
tln_timeline_model.h
|
||||
tln_timeline_select_handler.cpp
|
||||
tln_timeline_select_handler.h
|
||||
tln_timeline_proxy_model.cpp
|
||||
tln_timeline_proxy_model.h
|
||||
tln_timeline_progress.cpp
|
||||
tln_timeline_progress.h
|
||||
tln_utils.cpp
|
||||
tln_utils.h
|
||||
|
||||
tln_abstract_event_factory.cpp
|
||||
tln_abstract_event_factory.h
|
||||
tln_abstract_event_filter.cpp
|
||||
tln_abstract_event_filter.h
|
||||
tln_abstract_event_item.cpp
|
||||
tln_abstract_event_item.h
|
||||
tln_abstract_participant_event_item.cpp
|
||||
tln_abstract_participant_event_item.h
|
||||
tln_filter_attribute.cpp
|
||||
tln_filter_attribute.h
|
||||
tln_participant_track.cpp
|
||||
tln_participant_track.h
|
||||
tln_party_track.cpp
|
||||
tln_party_track.h
|
||||
tln_av_tracks.cpp
|
||||
tln_av_tracks.h
|
||||
tln_marker_track.cpp
|
||||
tln_marker_track.h
|
||||
|
||||
logger.cpp
|
||||
logger.h
|
||||
|
||||
tln_event_timeline_gui_plugin.cpp
|
||||
tln_event_timeline_gui_plugin.h
|
||||
|
||||
${tln_event_types_SRCS}
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(tln_event_timeline_gui_SRCS
|
||||
tln_timeline_dialog.ui
|
||||
tln_item_info_dialog.ui
|
||||
tln_item_list_dialog.ui
|
||||
tln_filter_dialog.ui
|
||||
tln_filter_edit_dialog.ui
|
||||
tln_legend.ui
|
||||
tln_timeline_progress.ui
|
||||
|
||||
${tln_event_types_UICS}
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS TlnEventTimelineGuiPlugin MODULE ${tln_event_timeline_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(TlnEventTimelineGuiPlugin
|
||||
Qt5::Widgets
|
||||
Qt5::WebSockets
|
||||
Qt5::Concurrent
|
||||
LtsAppManager
|
||||
LtsPluginManager
|
||||
LtsDataView
|
||||
LtsPrinting
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsTimeline
|
||||
LtsUtilsCore # data mod
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
LtsWidgets
|
||||
NGLLogger
|
||||
ngldb
|
||||
nglsettings
|
||||
ngltools # dtg, get settings from fileLts/Plugins/AudioVideoManagement/Gui/AVMenuEdit/CMakeLists.txt
|
||||
|
||||
AvmDataPluginInterface
|
||||
ExmDataPluginInterface
|
||||
IsmDataPluginInterface
|
||||
MrkDataPluginInterface
|
||||
OpmDataPluginInterface
|
||||
PdmDataPluginInterface
|
||||
PpmDataPluginInterface
|
||||
|
||||
FlmExplorerGuiPluginInterface
|
||||
FltAesGuiPluginInterface # SitMap Filter
|
||||
TlnDataPluginInterface
|
||||
TlnViewGuiPluginInterface
|
||||
|
||||
MrkCommon # SitMap Filter Helper
|
||||
|
||||
PpmDataPluginInterface
|
||||
PpmParticipantSelectionGui
|
||||
AvmShared
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(TlnEventTimelineGuiPlugin)
|
||||
|
||||
|
||||
|
||||
## LtsTimelineTest
|
||||
#NGL_ADD_EXECUTABLE(WS EventTimelineTest main.cpp logger.cpp tln_timeline_model.cpp)
|
||||
#NGL_TARGET_LINK_LIBRARIES(EventTimelineTest
|
||||
# LtsTimeline
|
||||
# nglapplication
|
||||
# NGLLogger
|
||||
# Qt5::Core
|
||||
# Qt5::Gui
|
||||
# Qt5::Widgets
|
||||
|
||||
# ngltools # get settings from file
|
||||
# ngldb
|
||||
# nglsettings
|
||||
#)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#include "tln_bccontamination_event_factory.h"
|
||||
#include "tln_bccontamination_filter.h"
|
||||
#include "tln_bccontamination_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BCContaminationEventFactory::BCContaminationEventFactory()
|
||||
: AbstractEventFactory(EventType::BCContamination)
|
||||
, m_logger(getLogger(QStringLiteral("BCContaminationEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> BCContaminationEventFactory::createItem(
|
||||
qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<BCContaminationItem>(BCContaminationItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *BCContaminationEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new BCContaminationFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BCContaminationEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
BCContaminationEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const override;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#include "tln_bccontamination_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString BCContaminationFilter::s_aesName = QStringLiteral("AesName");
|
||||
QString BCContaminationFilter::s_duration = QStringLiteral("duration");
|
||||
QString BCContaminationFilter::s_chargeTypeId = QStringLiteral("ChargeTypeId");
|
||||
|
||||
|
||||
BCContaminationFilter::BCContaminationFilter()
|
||||
: AbstractEventFilter(EventType::BCContamination)
|
||||
, m_logger(getLogger(QStringLiteral("BCContaminationFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
m_attributes[s_aesName] = FilterAttribute(FilterAttribute::Type::eString);
|
||||
m_attributes[s_duration] = FilterAttribute(FilterAttribute::Type::eRange);
|
||||
m_attributes[s_chargeTypeId] = FilterAttribute(FilterAttribute::Type::eId);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList BCContaminationFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
s_aesName,
|
||||
s_duration,
|
||||
s_chargeTypeId
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString BCContaminationFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
if (!m_attributes[s_aesName].isEmpty())
|
||||
stmt += m_attributes[s_aesName].condition(QStringLiteral(" AND properties->>'AesName'"));
|
||||
|
||||
if (!m_attributes[s_duration].isEmpty())
|
||||
stmt += m_attributes[s_duration].condition(QStringLiteral(" AND CAST(properties->>'originatorChargeTypeId' AS INT)")); // <- TODO
|
||||
|
||||
if (!m_attributes[s_chargeTypeId].isEmpty())
|
||||
stmt += m_attributes[s_chargeTypeId].condition(QStringLiteral(" AND CAST(properties->>'friendlyFire' AS INT)")); // <------- TODO
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *BCContaminationFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BCContaminationFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
BCContaminationFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_bccontamination_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BCContaminationItem::BCContaminationItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::Hit, position)
|
||||
, m_logger(getLogger(QStringLiteral("BCContaminationItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void BCContaminationItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BCContaminationItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
BCContaminationItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#include "tln_bite_message_event_factory.h"
|
||||
#include "tln_bite_message_filter.h"
|
||||
#include "tln_bite_message_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BiteMessageEventFactory::BiteMessageEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session)
|
||||
: AbstractEventFactory(EventType::BiteMessage, exerciseStart, exerciseEnd, session)
|
||||
, m_logger(getLogger(QStringLiteral("BiteMessageEventFactory")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> BiteMessageEventFactory::createItem(
|
||||
qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
)
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<BiteMessageItem>(BiteMessageItem(this, start, 0, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *BiteMessageEventFactory::createFilter()
|
||||
{
|
||||
return new BiteMessageFilter(this, m_minRangeStart, m_maxRangeEnd);
|
||||
}
|
||||
|
||||
AbstractEventFilter *BiteMessageEventFactory::filter()
|
||||
{
|
||||
if (m_filter == nullptr)
|
||||
m_filter = static_cast<BiteMessageFilter *>(createFilter());
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
/*
|
||||
AbstractEventFilter *XXXXX::createFilter()
|
||||
{
|
||||
return new YYYYY(this, m_minRangeStart, m_maxRangeEnd);
|
||||
}
|
||||
|
||||
AbstractEventFilter *XXXXX::filter()
|
||||
{
|
||||
if (m_filter == nullptr)
|
||||
m_filter = static_cast<YYYYY *>(createFilter());
|
||||
return m_filter;
|
||||
}
|
||||
*/
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BiteMessageFilter;
|
||||
|
||||
|
||||
class BiteMessageEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
BiteMessageEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session);
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) override;
|
||||
AbstractEventFilter *filter() override;
|
||||
AbstractEventFilter *createFilter() override;
|
||||
|
||||
private:
|
||||
BiteMessageFilter *m_filter{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#include "tln_bite_message_filter.h"
|
||||
#include "tln_bite_message_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <ExerciseEventManagement/eem.hpp>
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BiteMessageFilter::BiteMessageFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd)
|
||||
: AbstractEventFilter(factory, EventType::BiteMessage, exerciseStart, exerciseEnd)
|
||||
, m_logger(getLogger(QStringLiteral("BiteMessageFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
m_attributes.insert(AbstractEventFactory::s_sampleTime, FilterAttribute(FilterAttribute::Type::eTime));
|
||||
updateFilterString();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList BiteMessageFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names = { AbstractEventFactory::s_sampleTime };
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void BiteMessageFilter::addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const
|
||||
{
|
||||
addAttributeTimeWidgetToLayout(AbstractEventFactory::s_sampleTime, layout, dialog, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
bool BiteMessageFilter::check(const AbstractEventItem &item) const
|
||||
{
|
||||
if (item.type() != EventType::BiteMessage)
|
||||
return false;
|
||||
|
||||
if (!m_isActive)
|
||||
return false;
|
||||
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].isEmpty() && m_attributes[AbstractEventFactory::s_sampleTime].isActive())
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].check(static_cast<qint64>(item.startTime())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void BiteMessageFilter::updateFilterString()
|
||||
{
|
||||
if (!m_isActive)
|
||||
{
|
||||
m_filterString.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filterString = QStringLiteral(" WHEN event_type_id = %1").arg(QString::number(type()));
|
||||
if (m_attributes[AbstractEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" THEN 1");
|
||||
else
|
||||
m_filterString += QStringLiteral(" THEN CASE WHEN NOT %1 THEN 0 ELSE 1 END").arg(m_attributes[AbstractEventFactory::s_sampleTime].condition(AbstractEventFactory::s_sampleTime));
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BiteMessageFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BiteMessageFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd);
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
void addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const override;
|
||||
bool check(const AbstractEventItem &item) const override;
|
||||
|
||||
private:
|
||||
void updateFilterString() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#include "tln_bite_message_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QPixmap getBiteMessageItemPixmap()
|
||||
{
|
||||
QPixmap pixmap(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(0, AbstractEventItem::s_defaultHeight);
|
||||
triangle << QPoint(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
triangle << QPoint(AbstractEventItem::s_defaultWidth / 2, 0);
|
||||
triangle << QPoint(0, AbstractEventItem::s_defaultHeight);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter.setBrush(Qt::red);
|
||||
painter.drawPolygon(triangle);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QPixmap BiteMessageItem::pixmap = getBiteMessageItemPixmap();
|
||||
|
||||
|
||||
BiteMessageItem::BiteMessageItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractParticipantEventItem(factory, startTime, duration, properties, Qt::red, EventType::BiteMessage, position)
|
||||
, m_logger(getLogger(QStringLiteral("BiteMessageItem")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void BiteMessageItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const
|
||||
{
|
||||
//fprintf(stderr, "Bite paint!!\n");
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
painter->drawPixmap(
|
||||
QRect(
|
||||
option.rect.center().x() - AbstractEventItem::s_defaultWidth / 2,
|
||||
option.rect.center().y() - AbstractEventItem::s_defaultHeight / 2, AbstractEventItem::s_defaultWidth,
|
||||
AbstractEventItem::s_defaultHeight
|
||||
), pixmap
|
||||
);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_participant_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class QPixmap;
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BiteMessageItem : public AbstractParticipantEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
static QPixmap pixmap;
|
||||
|
||||
BiteMessageItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const override;
|
||||
void addItemInfoRows(QFormLayout *) override {}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "tln_block_item.h"
|
||||
|
||||
#include <LtsTimeline/item.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QPixmap>
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QPixmap getBlockItemPixmap()
|
||||
{
|
||||
QPixmap pixmap(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter.setBrush(QBrush(Qt::white));
|
||||
painter.drawRect(4, 0, 8, 14);
|
||||
painter.drawRect(2, 2, 8, 14);
|
||||
painter.drawRect(0, 4, 8, 14);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QPixmap BlockItem::pixmap = getBlockItemPixmap();
|
||||
|
||||
|
||||
BlockItem::BlockItem(qint64 startTime, qint64 duration, bool isCopy) // TODO: real values !!!
|
||||
: AbstractEventItem(nullptr, startTime, duration, {}, Qt::white, EventType::Block)
|
||||
, m_isCopy(isCopy)
|
||||
{}
|
||||
|
||||
|
||||
void BlockItem::addItem(LtsTimeline::ItemPtr &&itemPtr)
|
||||
{
|
||||
m_items.push_back(std::move(itemPtr));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PROTECTED
|
||||
|
||||
void BlockItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx, bool) const
|
||||
{
|
||||
Q_UNUSED(idx);
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter->setPen(Qt::black);
|
||||
painter->setBrush(QBrush(Qt::white));
|
||||
const int top = option.rect.center().y() - AbstractEventItem::s_defaultHeight / 2;
|
||||
painter->drawRect(option.rect.left() + 4, top, option.rect.width() - 4, 15);
|
||||
painter->drawRect(option.rect.left() + 2, top + 2, option.rect.width() - 4, 15);
|
||||
painter->drawRect(option.rect.left(), top + 4, option.rect.width() - 4, 15);
|
||||
|
||||
#if 0 // #ifdef LTS_DEBUG
|
||||
int itemCount = count();
|
||||
if (itemCount < 2)
|
||||
painter->setPen(QColor("red"));
|
||||
painter->drawText(option.rect.left() + 6, option.rect.center().y() + 6, QStringLiteral("[%1]").arg(itemCount));
|
||||
#endif
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void BlockItem::addItemInfoRows(QFormLayout *form)
|
||||
{
|
||||
Q_UNUSED(form);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
#include <vector>
|
||||
#include <QVector>
|
||||
|
||||
|
||||
class QPixmap;
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BlockItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
static QPixmap pixmap;
|
||||
|
||||
BlockItem(qint64 startTime, qint64 duration, bool isCopy);
|
||||
|
||||
int count() const { return m_items.size(); }
|
||||
void addItem(LtsTimeline::ItemPtr &&itemPtr);
|
||||
std::vector<LtsTimeline::ItemPtr> &items() { return m_items; }
|
||||
const std::vector<LtsTimeline::ItemPtr> &items() const { return m_items; }
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &, bool) const override;
|
||||
void addItemInfoRows(QFormLayout *form);
|
||||
|
||||
private:
|
||||
bool m_isCopy;
|
||||
std::vector<LtsTimeline::ItemPtr> m_items;
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_borderline_event_factory.h"
|
||||
#include "tln_borderline_filter.h"
|
||||
#include "tln_borderline_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BorderlineEventFactory::BorderlineEventFactory()
|
||||
: AbstractEventFactory(EventType::Borderline)
|
||||
, m_logger(getLogger(QStringLiteral("BorderlineEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> BorderlineEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<BorderlineItem>(BorderlineItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *BorderlineEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new BorderlineFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BorderlineEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
BorderlineEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_borderline_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BorderlineFilter::BorderlineFilter()
|
||||
: AbstractEventFilter(EventType::Borderline)
|
||||
, m_logger(getLogger(QStringLiteral("BorderlineFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList BorderlineFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString BorderlineFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *BorderlineFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BorderlineFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
BorderlineFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_borderline_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
BorderlineItem::BorderlineItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::Borderline, position)
|
||||
, m_logger(getLogger(QStringLiteral("BorderlineItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void BorderlineItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class BorderlineItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
BorderlineItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#include "tln_camera_video_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
const QString CameraVideoEventFactory::s_mainStructureElementId = QStringLiteral("MainStructureElementId");
|
||||
const QString CameraVideoEventFactory::s_duration = QStringLiteral("duration");
|
||||
const QString CameraVideoEventFactory::s_menuStream = QStringLiteral("menuStream");
|
||||
const QString CameraVideoEventFactory::s_allStream = QStringLiteral("allStream");
|
||||
const QString CameraVideoEventFactory::s_property_streamName = QStringLiteral("streamName");
|
||||
|
||||
|
||||
CameraVideoEventFactory::CameraVideoEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session)
|
||||
: AbstractEventFactory(EventType::CameraVideo, exerciseStart, exerciseEnd, session)
|
||||
, m_logger(getLogger(QStringLiteral("CameraVideoEventFactory")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> CameraVideoEventFactory::createItem(
|
||||
qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
)
|
||||
{
|
||||
return std::make_unique<CameraVideoItem>(CameraVideoItem(this, start, duration, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *CameraVideoEventFactory::createFilter()
|
||||
{
|
||||
return new CameraVideoFilter(this, m_minRangeStart, m_maxRangeEnd);
|
||||
}
|
||||
|
||||
AbstractEventFilter *CameraVideoEventFactory::filter()
|
||||
{
|
||||
if (m_filter == nullptr)
|
||||
m_filter = static_cast<CameraVideoFilter *>(createFilter());
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
#include "tln_camera_video_filter.h"
|
||||
#include "tln_camera_video_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CameraVideoFilter;
|
||||
|
||||
|
||||
class CameraVideoEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
static const QString s_mainStructureElementId;
|
||||
static const QString s_duration;
|
||||
static const QString s_menuStream;
|
||||
static const QString s_allStream;
|
||||
static const QString s_property_streamName;
|
||||
|
||||
CameraVideoEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session);
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) override;
|
||||
AbstractEventFilter *filter() override;
|
||||
AbstractEventFilter *createFilter() override;
|
||||
|
||||
private:
|
||||
CameraVideoFilter *m_filter{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+586
@@ -0,0 +1,586 @@
|
||||
#include "tln_camera_video_filter.h"
|
||||
#include "tln_camera_video_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <AudioVideoManagement/stream_name_mapping.h>
|
||||
#include <AudioVideoManagement/avs_menus.h>
|
||||
#include <AudioVideoManagement/Shared/stream_list_result.h>
|
||||
#include <ExerciseEventManagement/eem.hpp>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
#include <LtsWidgets/lts_spinbox.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
inline static void sort(QVector<QString> &items)
|
||||
{
|
||||
std::sort(items.begin(), items.end(), [](const QString &itemA, const QString &itemB)
|
||||
{
|
||||
return itemA.compare(itemB);
|
||||
});
|
||||
}
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
const std::vector<int> CameraVideoFilter::s_excluded_mse_ids =
|
||||
{
|
||||
306,312,319,326,316,327,214,310,323,321,322,307,308,309,318,304,320,325,325,314,313,311,317,324,328,2883,2884 // charge_type_ids from pdm_charge_type table
|
||||
};
|
||||
|
||||
CameraVideoFilter::CameraVideoFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd)
|
||||
: AbstractEventFilter(factory, EventType::CameraVideo, exerciseStart, exerciseEnd)
|
||||
, m_checkActiveVideoMenuTimer(new QTimer(this))
|
||||
, m_logger(getLogger(QStringLiteral("CameraVideoFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
m_attributes.insert(CameraVideoEventFactory::s_mainStructureElementId, FilterAttribute(FilterAttribute::Type::eIntCompare));
|
||||
m_attributes.insert(CameraVideoEventFactory::s_duration, FilterAttribute(FilterAttribute::Type::eIntRange));
|
||||
m_attributes.insert(CameraVideoEventFactory::s_menuStream, FilterAttribute(FilterAttribute::Type::eStringCompare));
|
||||
m_attributes.insert(CameraVideoEventFactory::s_allStream, FilterAttribute(FilterAttribute::Type::eStringCompare));
|
||||
m_attributes.insert(CameraVideoEventFactory::s_sampleTime, FilterAttribute(FilterAttribute::Type::eTime));
|
||||
updateFilterString();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
bool CameraVideoFilter::init(
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> avmDtc,
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignMenuEditGuiInterface> &m_avmIfc,
|
||||
qint32 exerciseId)
|
||||
{
|
||||
AudioVideoManagement::StreamListResult *streamResultList = m_avmIfc->getAsyncStreamList();
|
||||
connect(streamResultList, &AudioVideoManagement::StreamListResult::emitStreamList, this, &CameraVideoFilter::onStreamListReceived);
|
||||
m_exerciseId = exerciseId;
|
||||
if (!m_ismDtc)
|
||||
m_ismDtc = ismDtc;
|
||||
m_avmDataIfc = avmDataIfc;
|
||||
m_avmDtc = avmDtc;
|
||||
|
||||
if (m_mainStructureElements.isEmpty())
|
||||
{
|
||||
if (!ismDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Unable to load MainStructureElement IDs from ISM-DTC";
|
||||
return false;
|
||||
}
|
||||
|
||||
QMap<qint32, InfrastructureManagement::MainStructureElement> mainStructureElements = ismDtc->mainStructureElements();
|
||||
m_mainStructureElements.clear();
|
||||
for (auto it = mainStructureElements.constBegin(); it != mainStructureElements.constEnd(); ++it)
|
||||
onMainStructureElementChanged(it.value(), DataModification::eAdded);
|
||||
connect(ismDtc.get(), &InfrastructureManagement::Interface::Dtc::mainStructureElementChanged,
|
||||
this, &CameraVideoFilter::onMainStructureElementChanged);
|
||||
}
|
||||
|
||||
if (m_menuStreams.isEmpty())
|
||||
{
|
||||
if (!m_avmDtc || !m_avmDataIfc || !m_avmDataIfc->hasAvsSession() || !m_avmDataIfc->menus())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Unable to load Video Menus";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_activeVideoMenu = m_avmDataIfc->menus()->currentVideoMenu();
|
||||
|
||||
updateMenuStreams();
|
||||
|
||||
connect(m_avmDtc.get(), &AudioVideoManagement::Interface::Dtc::streamNameChanged,
|
||||
this, &CameraVideoFilter::onStreamChanged);
|
||||
connect(m_avmDtc.get(), &AudioVideoManagement::Interface::Dtc::menuStructChanged,
|
||||
this, &CameraVideoFilter::onMenuStructChanged);
|
||||
|
||||
// since there is no signal to connect to, we have to manually check the active video menu
|
||||
if (!m_checkActiveVideoMenuTimer->isActive())
|
||||
{
|
||||
connect(m_checkActiveVideoMenuTimer, &QTimer::timeout, this, [this]()
|
||||
{
|
||||
qint32 newActiveVideoMenu = m_avmDataIfc->menus()->currentVideoMenu();
|
||||
|
||||
if (newActiveVideoMenu == m_activeVideoMenu)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Changed active video menu from: " << m_activeVideoMenu << ", to: " << newActiveVideoMenu;
|
||||
|
||||
m_activeVideoMenu = newActiveVideoMenu;
|
||||
|
||||
updateMenuStreams();
|
||||
});
|
||||
|
||||
m_checkActiveVideoMenuTimer->start(500);
|
||||
}
|
||||
}
|
||||
|
||||
// if (m_allStreams.isEmpty())
|
||||
// {
|
||||
// if (!m_avmDtc)
|
||||
// {
|
||||
// ERROR_LOG(m_logger) << "Unable to load Video Menus";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// //virtual bool streams(const std::function<void(const AudioVideoManagement::Stream &data)> &cb)
|
||||
|
||||
// m_avmDtc->streamNames([this](const AudioVideoManagement::StreamName &data)
|
||||
// {
|
||||
// m_allStreams.insert(data.mountingPointId(), QString::fromStdString(data.displayName()));
|
||||
// });
|
||||
// m_avmDtc->videoTeams([this](const AudioVideoManagement::VideoTeam &data)
|
||||
// {
|
||||
// if (data.exerciseId() == m_exerciseId)
|
||||
// m_allStreams.insert(-data.id(), QString::fromStdString(data.streamName()));
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QStringList CameraVideoFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
CameraVideoEventFactory::s_mainStructureElementId,
|
||||
CameraVideoEventFactory::s_duration,
|
||||
CameraVideoEventFactory::s_menuStream,
|
||||
CameraVideoEventFactory::s_allStream,
|
||||
CameraVideoEventFactory::s_sampleTime
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void CameraVideoFilter::addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const
|
||||
{
|
||||
QMap<int, QString> filteredTypes;
|
||||
for (auto it = m_mainStructureElements.constBegin(); it != m_mainStructureElements.constEnd(); ++it)
|
||||
{
|
||||
if(std::find(CameraVideoFilter::s_excluded_mse_ids.begin(), CameraVideoFilter::s_excluded_mse_ids.end(), it.key()) != CameraVideoFilter::s_excluded_mse_ids.end())
|
||||
{
|
||||
continue;
|
||||
};
|
||||
filteredTypes.insert(it.key(), it.value());
|
||||
}
|
||||
addAttributeIntCompareWidgetToLayout(CameraVideoEventFactory::s_mainStructureElementId, filteredTypes, layout, dialog, 0, 0, 1, 1, true);
|
||||
addAttributeIntRangeWidgetToLayout(CameraVideoEventFactory::s_duration, layout, dialog, 0, 1, 1, 1, tr("seconds"));
|
||||
addAttributeStringCompareWidgetToLayout(CameraVideoEventFactory::s_menuStream, m_menuStreams, layout, dialog, 1, 0, 1, 1,true);
|
||||
addAttributeStringCompareWidgetToLayout(CameraVideoEventFactory::s_allStream, m_allStreams, layout, dialog, 1, 1, 1, 1, true);
|
||||
addAttributeTimeWidgetToLayout(CameraVideoEventFactory::s_sampleTime, layout, dialog, 2, 0, 2);
|
||||
}
|
||||
|
||||
bool CameraVideoFilter::check(const AbstractEventItem &item) const
|
||||
{
|
||||
if (item.type() != EventType::CameraVideo)
|
||||
return false;
|
||||
|
||||
if (!m_isActive)
|
||||
return false;
|
||||
|
||||
const QJsonObject &properties(item.properties());
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_mainStructureElementId].isEmpty() && m_attributes[CameraVideoEventFactory::s_mainStructureElementId].isActive())
|
||||
if (!m_attributes[CameraVideoEventFactory::s_mainStructureElementId].check(properties.value(CameraVideoEventFactory::s_mainStructureElementId).toInt()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_duration].isEmpty() && m_attributes[CameraVideoEventFactory::s_duration].isActive())
|
||||
if (!m_attributes[CameraVideoEventFactory::s_duration].check(properties.value(CameraVideoEventFactory::s_duration).toInt()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_menuStream].isEmpty() && m_attributes[CameraVideoEventFactory::s_menuStream].isActive())
|
||||
if (!m_attributes[CameraVideoEventFactory::s_property_streamName].check(properties.value(CameraVideoEventFactory::s_menuStream).toString()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_allStream].isEmpty() && m_attributes[CameraVideoEventFactory::s_allStream].isActive())
|
||||
if (!m_attributes[CameraVideoEventFactory::s_property_streamName].check(properties.value(CameraVideoEventFactory::s_allStream).toString()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].isEmpty() && m_attributes[AbstractEventFactory::s_sampleTime].isActive())
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].check(static_cast<qint64>(item.startTime())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CameraVideoFilter::getDisplayName(const QString &internalName)
|
||||
{
|
||||
QString result(internalName);
|
||||
|
||||
m_avmDtc->streamNames(static_cast<std::function<bool(const AudioVideoManagement::StreamName &)>>([&result, internalName](const AudioVideoManagement::StreamName &streamName)
|
||||
{
|
||||
if (QString::fromStdString(streamName.internalName()) == internalName)
|
||||
{
|
||||
result = QString::fromStdString(streamName.displayName());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void CameraVideoFilter::updateMenuStreams()
|
||||
{
|
||||
m_menuStreams.clear();
|
||||
|
||||
AudioVideoManagement::MenuStruct menuStruct = m_avmDtc->menuStruct(m_activeVideoMenu);
|
||||
AudioVideoManagement::StreamNameMapping *streamNameMapping = nullptr;
|
||||
if(m_avmDtc)
|
||||
streamNameMapping = AudioVideoManagement::StreamNameMapping::create(m_avmDtc.get());
|
||||
|
||||
QVector<QString> offline;
|
||||
QVector<QString> mvs;
|
||||
QVector<QString> outdor;
|
||||
QVector<QString> indoor;
|
||||
|
||||
for (auto it = menuStruct.menuEntries().begin(); it != menuStruct.menuEntries().end(); ++it)
|
||||
{
|
||||
if (!(it->mountingPointId().is_set() && it->name().is_set()))
|
||||
continue;
|
||||
|
||||
int32_t mountingPointId = it->mountingPointId().get();
|
||||
QString streamDisplayName = QStringLiteral("");
|
||||
if(streamNameMapping)
|
||||
streamDisplayName = streamNameMapping->displayName(QString::fromStdString(it->name().get()));
|
||||
|
||||
if (mountingPointId < 0)
|
||||
{
|
||||
m_avmDtc->videoTeams([&streamDisplayName, mountingPointId](const AudioVideoManagement::VideoTeam &data)
|
||||
{
|
||||
if (data.id() == -mountingPointId)
|
||||
{
|
||||
streamDisplayName = QString::fromStdString(data.streamName());
|
||||
}
|
||||
});
|
||||
mvs.append(streamDisplayName);
|
||||
}else
|
||||
{
|
||||
InfrastructureManagement::StructureElement mpiE;
|
||||
m_ismDtc->getStructureElementById(mountingPointId,mpiE);
|
||||
if(mpiE.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera)
|
||||
{
|
||||
outdor.append(streamDisplayName);
|
||||
}
|
||||
else
|
||||
{
|
||||
indoor.append(streamDisplayName);
|
||||
}
|
||||
}
|
||||
|
||||
// m_menuStreams.insert(mountingPointId, streamDisplayName);
|
||||
}
|
||||
|
||||
//now sort;
|
||||
std::sort(offline.begin(), offline.end());
|
||||
std::sort(mvs.begin(), mvs.end());
|
||||
std::sort(indoor.begin(), indoor.end());
|
||||
std::sort(outdor.begin(), outdor.end());
|
||||
int sortId =1;
|
||||
for (auto stream: offline)
|
||||
m_menuStreams.insert(sortId++, stream);
|
||||
for (auto stream: mvs)
|
||||
m_menuStreams.insert(sortId++, stream);
|
||||
for (auto stream: outdor)
|
||||
m_menuStreams.insert(sortId++, stream);
|
||||
for (auto stream: indoor)
|
||||
m_menuStreams.insert(sortId++, stream);
|
||||
|
||||
|
||||
delete streamNameMapping;
|
||||
streamNameMapping = nullptr;
|
||||
|
||||
bool hasFilterChanges = false;
|
||||
QVariantList attributeValues = attribute(CameraVideoEventFactory::s_menuStream).values();
|
||||
|
||||
for (const QVariant &attributeValue : attributeValues)
|
||||
{
|
||||
if (m_menuStreams.values().contains(attributeValue.toString()))
|
||||
continue;
|
||||
|
||||
hasFilterChanges = true;
|
||||
|
||||
// remove attributes which are not included in active video menu
|
||||
removeAttributeValue(CameraVideoEventFactory::s_menuStream, attributeValue);
|
||||
}
|
||||
|
||||
if (hasFilterChanges)
|
||||
updateFilterString();
|
||||
}
|
||||
|
||||
void CameraVideoFilter::updateFilterString()
|
||||
{
|
||||
if (!m_isActive)
|
||||
{
|
||||
m_filterString.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filterString = QStringLiteral(" WHEN event_type_id = %1").arg(QString::number(type()));
|
||||
|
||||
QStringList streamInternalNames(getInternalStreamNamesBySelectedStreams()); // stream and menu stream
|
||||
|
||||
if (m_attributes[CameraVideoEventFactory::s_mainStructureElementId].isEmpty() &&
|
||||
m_attributes[CameraVideoEventFactory::s_duration].isEmpty() &&
|
||||
//m_attributes[CameraVideoEventFactory::s_menuStream].isEmpty() && <= must be empty if streamInternalNames is empty
|
||||
m_attributes[CameraVideoEventFactory::s_sampleTime].isEmpty() &&
|
||||
//m_attributes[CameraVideoEventFactory::s_allStream].isEmpty() && <= must be empty if streamInternalNames is empty
|
||||
streamInternalNames.isEmpty())
|
||||
m_filterString += QStringLiteral(" THEN 1");
|
||||
else
|
||||
{
|
||||
m_filterString += QStringLiteral(" THEN CASE");
|
||||
if (!m_attributes[CameraVideoEventFactory::s_mainStructureElementId].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[CameraVideoEventFactory::s_mainStructureElementId].condition(QStringLiteral("CAST((COALESCE(properties->>'%1','-1')) AS INT)").arg(CameraVideoEventFactory::s_mainStructureElementId)));
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_duration].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[CameraVideoEventFactory::s_duration].condition(QStringLiteral("CAST((COALESCE(properties->>'%1','-1')) AS INT)").arg(CameraVideoEventFactory::s_duration)));
|
||||
|
||||
|
||||
// stream names
|
||||
if (!streamInternalNames.isEmpty())
|
||||
{
|
||||
QString conditionString(QStringLiteral("properties->>'streamName' "));
|
||||
|
||||
if (streamInternalNames.size() == 1)
|
||||
conditionString.append(QStringLiteral("= %1").arg(streamInternalNames.at(0)));
|
||||
else
|
||||
conditionString.append(QStringLiteral("IN (%1)").arg(streamInternalNames.join(QStringLiteral(","))));
|
||||
|
||||
m_filterString.append(QStringLiteral(" WHEN NOT %1 THEN 0").arg(conditionString));
|
||||
}
|
||||
|
||||
|
||||
if (!m_attributes[CameraVideoEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[CameraVideoEventFactory::s_sampleTime].condition(CameraVideoEventFactory::s_sampleTime));
|
||||
|
||||
m_filterString += QStringLiteral(" ELSE 1 END");
|
||||
}
|
||||
}
|
||||
|
||||
QStringList CameraVideoFilter::getInternalStreamNamesBySelectedStreams() const
|
||||
{
|
||||
//#warning ! ! ! FUNKTIONIERT NICHT ! ! !
|
||||
if (!m_avmDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Unable to get internal stream names (avm dtc missing)";
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList displayNames(m_attributes[CameraVideoEventFactory::s_allStream].toStringList());
|
||||
displayNames.append(m_attributes[CameraVideoEventFactory::s_menuStream].toStringList());
|
||||
displayNames.removeDuplicates();
|
||||
|
||||
if (displayNames.size() <= 0)
|
||||
return {};
|
||||
|
||||
QStringList result;
|
||||
|
||||
QMapIterator<QString, QString> mit(m_offlineVideoStreams);
|
||||
while (mit.hasNext())
|
||||
{
|
||||
mit.next();
|
||||
if (displayNames.contains(QStringLiteral("'%1'").arg(mit.value())))
|
||||
{
|
||||
// qCritical() << "add new displayname mvs: " << mit.key();
|
||||
|
||||
if (mit.key().endsWith(QStringLiteral("(S)")))
|
||||
{
|
||||
QString secondOffline= mit.key();
|
||||
secondOffline.chop(3);
|
||||
result.append(QStringLiteral("'%1'").arg(secondOffline));
|
||||
}else
|
||||
result.append(QStringLiteral("'%1'").arg(mit.key()));
|
||||
}
|
||||
}
|
||||
|
||||
m_avmDtc->streamNames([this, &result, &displayNames](const AudioVideoManagement::StreamName &streamName)
|
||||
{
|
||||
if (displayNames.contains(QStringLiteral("'%1'").arg(QString::fromStdString(streamName.displayName()))))
|
||||
result.append(QStringLiteral("'%1'").arg(QString::fromStdString(streamName.internalName())));
|
||||
});
|
||||
|
||||
m_avmDtc->videoTeams([this, &result, &displayNames](const AudioVideoManagement::VideoTeam &data)
|
||||
{
|
||||
const QString streamName = QStringLiteral("'%1'").arg(QString::fromStdString(data.streamName()));
|
||||
|
||||
if (displayNames.contains(streamName) && !result.contains(streamName))
|
||||
result.append(streamName);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE SLOTS
|
||||
|
||||
void CameraVideoFilter::onMenuStructChanged(const AudioVideoManagement::MenuStruct &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(modType);
|
||||
updateMenuStreams();
|
||||
}
|
||||
|
||||
void CameraVideoFilter::onStreamChanged(const AudioVideoManagement::StreamName &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(modType);
|
||||
updateMenuStreams();
|
||||
}
|
||||
|
||||
void CameraVideoFilter::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType)
|
||||
{
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(data.properties()), &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Could not parse JSON props of building with ID "
|
||||
<< data.id()
|
||||
<< ". Reason: "
|
||||
<< parseError.errorString()
|
||||
<< "; JSON: "
|
||||
<< doc.toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
bool inExercise = false;
|
||||
const QJsonArray &arr = doc.object().value(QLatin1String("available_in_exercise")).toArray();
|
||||
for (const QJsonValue &value : qAsConst(arr))
|
||||
{
|
||||
if (!value.isDouble())
|
||||
continue;
|
||||
|
||||
const int tmp = value.toInt();
|
||||
if (tmp == m_exerciseId)
|
||||
{
|
||||
inExercise = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_mainStructureElements.contains(data.id()) && !inExercise)
|
||||
m_mainStructureElements.remove(data.id());
|
||||
|
||||
if (!inExercise)
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_mainStructureElements[data.id()] = data.structureElementTypeId() == InfrastructureManagement::StructureElementType_def::Building ? m_ismDtc->getBuildingDisplayName(data.id())
|
||||
: QString::fromStdString(data.description());
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
m_mainStructureElements.remove(data.id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
void CameraVideoFilter::onStreamListReceived(const QMap<QString, QString> &mapInternalNameToDisplayName)
|
||||
{
|
||||
if (!m_avmDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Unable to load Video Menus";
|
||||
return;
|
||||
}
|
||||
|
||||
m_offlineVideoStreams.clear();
|
||||
|
||||
QVector<QString> offline;
|
||||
QVector<QString> mvs;
|
||||
QVector<QString> outdor;
|
||||
QVector<QString> indoor;
|
||||
|
||||
|
||||
for (auto stream : mapInternalNameToDisplayName.values())
|
||||
{
|
||||
int mpi = -1;
|
||||
bool isMVS = false;
|
||||
|
||||
for (auto strm : m_avmDtc->streamNames())
|
||||
{
|
||||
if (strm.displayName() == stream.toStdString())
|
||||
{
|
||||
mpi = strm.mountingPointId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mpi > 0)
|
||||
{
|
||||
//now we need to look for indoor or outdoor
|
||||
InfrastructureManagement::StructureElement mpiE;
|
||||
m_ismDtc->getStructureElementById(mpi,mpiE);
|
||||
if(mpiE.mountingPointTypeId() == InfrastructureManagement::MountingPointType::OutdoorCamera)
|
||||
{
|
||||
outdor.append(stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
indoor.append(stream);
|
||||
}
|
||||
|
||||
}
|
||||
if (mpi <= 0)
|
||||
{
|
||||
//look for MVS
|
||||
|
||||
for (auto mvsTeam : m_avmDtc->videoTeams())
|
||||
{
|
||||
if (isMVS)
|
||||
break;
|
||||
if (mvsTeam.streamName() == stream.toStdString())
|
||||
{
|
||||
isMVS= true;
|
||||
mvs.append(stream);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (isMVS)
|
||||
continue;
|
||||
|
||||
//no MVS no MPI so offline
|
||||
offline.append(stream);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//now sort;
|
||||
std::sort(offline.begin(), offline.end());
|
||||
std::sort(mvs.begin(), mvs.end());
|
||||
std::sort(indoor.begin(), indoor.end());
|
||||
std::sort(outdor.begin(), outdor.end());
|
||||
|
||||
for (auto stream: offline)
|
||||
m_allStreams.insert(m_blub++, stream);
|
||||
for (auto stream: mvs)
|
||||
m_allStreams.insert(m_blub++, stream);
|
||||
for (auto stream: outdor)
|
||||
m_allStreams.insert(m_blub++, stream);
|
||||
for (auto stream: indoor)
|
||||
m_allStreams.insert(m_blub++, stream);
|
||||
|
||||
for (auto stream : mapInternalNameToDisplayName.toStdMap())
|
||||
{
|
||||
// if (m_allStreams.key(stream.second,-1) == -1)
|
||||
// m_allStreams.insert(m_blub++, stream.second);
|
||||
|
||||
if (!m_offlineVideoStreams.contains(stream.first))
|
||||
m_offlineVideoStreams.insert(stream.first, stream.second);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Timeline
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <AudioVideoManagement/avm_menu_edit_gui_plugin_interface.h>
|
||||
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
||||
|
||||
|
||||
class QComboBox;
|
||||
class QTimer;
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CameraVideoFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CameraVideoFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd);
|
||||
|
||||
bool init(std::shared_ptr<AudioVideoManagement::Interface::Dtc> avmDtc,
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignDataInterface> &avmDataIfc,
|
||||
const std::shared_ptr<AudioVideoManagement::ForeignMenuEditGuiInterface> &m_avmIfc,
|
||||
qint32 exerciseId);
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
void addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const override;
|
||||
bool check(const AbstractEventItem &item) const override;
|
||||
|
||||
QString mainStructureElement(int id) const { return m_mainStructureElements.value(id); }
|
||||
QString menuStream(int id) const { return m_menuStreams.value(id); }
|
||||
QString allStream(int id) const { return m_allStreams.value(id); }
|
||||
QString getDisplayName(const QString &internalName);
|
||||
|
||||
|
||||
static const std::vector<int> s_excluded_mse_ids;
|
||||
|
||||
private:
|
||||
void updateMenuStreams();
|
||||
void updateFilterString() override;
|
||||
QStringList getInternalStreamNamesBySelectedStreams() const;
|
||||
|
||||
private slots:
|
||||
void onMenuStructChanged(const AudioVideoManagement::MenuStruct &data, DataModification modType);
|
||||
void onStreamChanged(const AudioVideoManagement::StreamName &data, DataModification modType);
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
|
||||
void onStreamListReceived(const QMap<QString, QString> &mapInternalNameToDisplayName);
|
||||
private:
|
||||
QMap<int, QString> m_mainStructureElements;
|
||||
QMap<int, QString> m_menuStreams;
|
||||
QMap<int, QString> m_allStreams;
|
||||
QMap<QString, QString> m_offlineVideoStreams;
|
||||
|
||||
int m_blub = 0;
|
||||
qint32 m_exerciseId{-1};
|
||||
|
||||
QTimer *m_checkActiveVideoMenuTimer{nullptr};
|
||||
qint32 m_activeVideoMenu{-1};
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc{nullptr};
|
||||
std::shared_ptr<AudioVideoManagement::ForeignDataInterface> m_avmDataIfc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
#include "tln_camera_video_item.h"
|
||||
#include "tln_camera_video_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QPixmap getCameraVideoItemPixmap()
|
||||
{
|
||||
QPixmap pixmap(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter.setBrush(Qt::yellow);
|
||||
painter.drawRect(QRect(0, 0, AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight));
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QPixmap CameraVideoItem::pixmap = getCameraVideoItemPixmap();
|
||||
|
||||
|
||||
CameraVideoItem::CameraVideoItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(factory, startTime, properties[QStringLiteral("duration")].toDouble(), properties, Qt::yellow, EventType::CameraVideo, position)
|
||||
, m_mainStructureElementId(properties[QStringLiteral("MainStructureElementId")].toInt(-1))
|
||||
, m_streamName(properties[QStringLiteral("streamName")].toString())
|
||||
, m_logger(getLogger(QStringLiteral("CameraVideoItem")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void CameraVideoItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
painter->setPen(Qt::black);
|
||||
painter->setBrush(m_color);
|
||||
painter->drawRect(option.rect.left(), option.rect.center().y() - AbstractEventItem::s_defaultHeight / 2,
|
||||
option.rect.width(), AbstractEventItem::s_defaultHeight);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void CameraVideoItem::addItemInfoRows(QFormLayout *form)
|
||||
{
|
||||
CameraVideoFilter *filter = static_cast<CameraVideoFilter *>(m_factory->filter());
|
||||
if (!filter)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "CameraVideoFilter unavailable";
|
||||
return;
|
||||
}
|
||||
|
||||
QString attributeName = FilterAttribute::attributeDisplayName(CameraVideoEventFactory::s_mainStructureElementId) + QStringLiteral(":");
|
||||
QString attributeValue = filter->mainStructureElement(m_properties.value(CameraVideoEventFactory::s_mainStructureElementId).toInt());
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
|
||||
attributeName = FilterAttribute::attributeDisplayName(CameraVideoEventFactory::s_duration) + QStringLiteral(":");
|
||||
attributeValue = QString::number(m_properties.value(CameraVideoEventFactory::s_duration).toInt() / 1000);
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
|
||||
attributeName = FilterAttribute::attributeDisplayName(CameraVideoEventFactory::s_property_streamName) + QStringLiteral(":");
|
||||
attributeValue = filter->getDisplayName(m_properties.value(CameraVideoEventFactory::s_property_streamName).toString());
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class QPixmap;
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CameraVideoItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
static QPixmap pixmap;
|
||||
|
||||
CameraVideoItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const override;
|
||||
void addItemInfoRows(QFormLayout *form) override;
|
||||
|
||||
int mainStructureElementId() const { return m_mainStructureElementId; }
|
||||
QString internalStreamName() const { return m_streamName; }
|
||||
|
||||
private:
|
||||
int m_mainStructureElementId;
|
||||
QString m_streamName;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_cross_borderline_event_factory.h"
|
||||
#include "tln_cross_borderline_filter.h"
|
||||
#include "tln_cross_borderline_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
const QString CrossBorderlineEventFactory::s_global = QStringLiteral("Global");
|
||||
|
||||
|
||||
CrossBorderlineEventFactory::CrossBorderlineEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session)
|
||||
: AbstractEventFactory(EventType::CrossBorderline, exerciseStart, exerciseEnd, session)
|
||||
, m_logger(getLogger(QStringLiteral("CrossBorderlineEventFactory")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> CrossBorderlineEventFactory::createItem(
|
||||
qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
)
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<CrossBorderlineItem>(CrossBorderlineItem(this, start, 0, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *CrossBorderlineEventFactory::createFilter()
|
||||
{
|
||||
return new CrossBorderlineFilter(this, m_minRangeStart, m_maxRangeEnd);
|
||||
}
|
||||
|
||||
AbstractEventFilter *CrossBorderlineEventFactory::filter()
|
||||
{
|
||||
if (m_filter == nullptr)
|
||||
m_filter = static_cast<CrossBorderlineFilter *>(createFilter());
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CrossBorderlineFilter;
|
||||
|
||||
|
||||
class CrossBorderlineEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
static const QString s_global;
|
||||
|
||||
CrossBorderlineEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session);
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) override;
|
||||
AbstractEventFilter *filter() override;
|
||||
AbstractEventFilter *createFilter() override;
|
||||
|
||||
private:
|
||||
CrossBorderlineFilter *m_filter{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#include "tln_cross_borderline_filter.h"
|
||||
#include "tln_cross_borderline_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <ExerciseEventManagement/eem.hpp>
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
#include <QGridLayout>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
CrossBorderlineFilter::CrossBorderlineFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd)
|
||||
: AbstractEventFilter(factory, EventType::CrossBorderline, exerciseStart, exerciseEnd)
|
||||
, m_logger(getLogger(QStringLiteral("CrossBorderlineFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
m_attributes.insert(CrossBorderlineEventFactory::s_global, FilterAttribute(FilterAttribute::Type::eBoolCompare));
|
||||
m_attributes.insert(CrossBorderlineEventFactory::s_sampleTime, FilterAttribute(FilterAttribute::Type::eTime));
|
||||
updateFilterString();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList CrossBorderlineFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names = { CrossBorderlineEventFactory::s_global, CrossBorderlineEventFactory::s_sampleTime };
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void CrossBorderlineFilter::addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const
|
||||
{
|
||||
addAttributeBoolCompareWidgetToLayout(CrossBorderlineEventFactory::s_global, layout, dialog, 0, 0, 1, 1);
|
||||
addAttributeTimeWidgetToLayout(CrossBorderlineEventFactory::s_sampleTime, layout, dialog, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
bool CrossBorderlineFilter::check(const AbstractEventItem &item) const
|
||||
{
|
||||
if (item.type() != EventType::CrossBorderline)
|
||||
return false;
|
||||
|
||||
if (!m_isActive)
|
||||
return false;
|
||||
|
||||
const QJsonObject &properties = item.properties();
|
||||
|
||||
if (!m_attributes[CrossBorderlineEventFactory::s_global].isEmpty() && m_attributes[CrossBorderlineEventFactory::s_global].isActive())
|
||||
if (!m_attributes[CrossBorderlineEventFactory::s_global].check(properties.value(CrossBorderlineEventFactory::s_global).toBool()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].isEmpty() && m_attributes[AbstractEventFactory::s_sampleTime].isActive())
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].check(static_cast<qint64>(item.startTime())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void CrossBorderlineFilter::updateFilterString()
|
||||
{
|
||||
if (!m_isActive)
|
||||
{
|
||||
m_filterString.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filterString = QStringLiteral(" WHEN event_type_id = %1 OR event_type_id = %2")
|
||||
.arg(int(ProjectDataManagement::EventType_def::CrossLocalBorderline))
|
||||
.arg(int(ProjectDataManagement::EventType_def::CrossGlobalBorderline));
|
||||
|
||||
if (m_attributes[CrossBorderlineEventFactory::s_global].isEmpty() &&
|
||||
m_attributes[CrossBorderlineEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" THEN 1");
|
||||
else
|
||||
{
|
||||
m_filterString += QStringLiteral(" THEN CASE");
|
||||
|
||||
if (!m_attributes[CrossBorderlineEventFactory::s_global].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[CrossBorderlineEventFactory::s_global].condition(QStringLiteral("properties->>'%1'").arg(CrossBorderlineEventFactory::s_global)));
|
||||
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[AbstractEventFactory::s_sampleTime].condition(AbstractEventFactory::s_sampleTime));
|
||||
|
||||
m_filterString += QStringLiteral(" ELSE 1 END");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL { class INGLLogger; }
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CrossBorderlineFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CrossBorderlineFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd);
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
void addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const override;
|
||||
bool check(const AbstractEventItem &item) const override;
|
||||
|
||||
private:
|
||||
void updateFilterString() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#include "tln_cross_borderline_item.h"
|
||||
#include "tln_cross_borderline_event_factory.h"
|
||||
#include "tln_cross_borderline_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QModelIndex>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QPixmap getCrossBorderlineItemPixmap()
|
||||
{
|
||||
QPixmap pixmap(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(0, AbstractEventItem::s_defaultHeight);
|
||||
triangle << QPoint(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
triangle << QPoint(AbstractEventItem::s_defaultWidth / 2, 0);
|
||||
triangle << QPoint(0, AbstractEventItem::s_defaultHeight);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter.setBrush(Qt::cyan);
|
||||
painter.drawPolygon(triangle);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QPixmap CrossBorderlineItem::pixmap = getCrossBorderlineItemPixmap();
|
||||
|
||||
|
||||
CrossBorderlineItem::CrossBorderlineItem(
|
||||
AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
)
|
||||
: AbstractParticipantEventItem(factory, startTime, duration, properties, Qt::cyan, EventType::CrossBorderline, position)
|
||||
, m_logger(getLogger(QStringLiteral("CrossBorderlineItem")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void CrossBorderlineItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
painter->drawPixmap(
|
||||
QRect(
|
||||
option.rect.center().x() - AbstractEventItem::s_defaultWidth / 2,
|
||||
option.rect.center().y() - AbstractEventItem::s_defaultHeight / 2, AbstractEventItem::s_defaultWidth,
|
||||
AbstractEventItem::s_defaultHeight
|
||||
), pixmap
|
||||
);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void CrossBorderlineItem::addItemInfoRows(QFormLayout *form)
|
||||
{
|
||||
CrossBorderlineFilter *filter = static_cast<CrossBorderlineFilter *>(m_factory->filter());
|
||||
if (!filter)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "CrossBorderlineFilter unavailable";
|
||||
return;
|
||||
}
|
||||
|
||||
QString attributeName = FilterAttribute::attributeDisplayName(CrossBorderlineEventFactory::s_global) + QStringLiteral(":");
|
||||
QString attributeValue = m_properties.value(CrossBorderlineEventFactory::s_global).toBool() ? QLabel::tr("Yes") : QLabel::tr("No");
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
|
||||
attributeName = QLabel::tr("Local") + QStringLiteral(":");
|
||||
attributeValue = !m_properties.value(CrossBorderlineEventFactory::s_global).toBool() ? QLabel::tr("Yes") : QLabel::tr("No");
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_participant_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class QPixmap;
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class CrossBorderlineItem : public AbstractParticipantEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
static QPixmap pixmap;
|
||||
|
||||
CrossBorderlineItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const override;
|
||||
void addItemInfoRows(QFormLayout *form) override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_danger_area_event_factory.h"
|
||||
#include "tln_danger_area_filter.h"
|
||||
#include "tln_danger_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
DangerAreaEventFactory::DangerAreaEventFactory()
|
||||
: AbstractEventFactory(EventType::DangerArea)
|
||||
, m_logger(getLogger(QStringLiteral("DangerAreaEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> DangerAreaEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<DangerAreaItem>(DangerAreaItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *DangerAreaEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new DangerAreaFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class DangerAreaEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
DangerAreaEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, , const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_danger_area_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
DangerAreaFilter::DangerAreaFilter()
|
||||
: AbstractEventFilter(EventType::DangerArea)
|
||||
, m_logger(getLogger(QStringLiteral("DangerAreaFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList DangerAreaFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString DangerAreaFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *DangerAreaFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class DangerAreaFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
DangerAreaFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_danger_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
DangerAreaItem::DangerAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::DangerArea, position)
|
||||
, m_logger(getLogger(QStringLiteral("DangerAreaItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void DangerAreaItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class DangerAreaItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
DangerAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Lts/Plugins/Timeline/Gui/EventTimeline/EventTypes/EmergencyCall/tln_emergency_call_event_factory.cpp
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_emergency_call_event_factory.h"
|
||||
#include "tln_emergency_call_filter.h"
|
||||
#include "tln_emergency_call_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EmergencyCallEventFactory::EmergencyCallEventFactory()
|
||||
: AbstractEventFactory(EventType::EmergencyCall)
|
||||
, m_logger(getLogger(QStringLiteral("EmergencyCallEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EmergencyCallEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EmergencyCallItem>(EmergencyCallItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *EmergencyCallEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EmergencyCallFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EmergencyCallEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EmergencyCallEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_emergency_call_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EmergencyCallFilter::EmergencyCallFilter()
|
||||
: AbstractEventFilter(EventType::EmergencyCall)
|
||||
, m_logger(getLogger(QStringLiteral("EmergencyCallFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EmergencyCallFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString EmergencyCallFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *EmergencyCallFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EmergencyCallFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
EmergencyCallFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_emergency_call_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EmergencyCallItem::EmergencyCallItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EmergencyCall, position)
|
||||
, m_logger(getLogger(QStringLiteral("EmergencyCallItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EmergencyCallItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EmergencyCallItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EmergencyCallItem(qint64 startTime, int duration, const QJsonObject &properties);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, const LtsUtils::QPoint3D &position) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_enter_danger_area_event_factory.h"
|
||||
#include "tln_enter_danger_area_filter.h"
|
||||
#include "tln_enter_danger_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterDangerAreaEventFactory::EnterDangerAreaEventFactory()
|
||||
: AbstractEventFactory(EventType::EnterDangerArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterDangerAreaEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EnterDangerAreaEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EnterDangerAreaItem>(EnterDangerAreaItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *EnterDangerAreaEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EnterDangerAreaFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterDangerAreaEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EnterDangerAreaEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#include "tln_enter_danger_area_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString EnterDangerAreaFilter::s_aesName = QStringLiteral("AesName");
|
||||
|
||||
|
||||
EnterDangerAreaFilter::EnterDangerAreaFilter()
|
||||
: AbstractEventFilter(EventType::EnterDangerArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterDangerAreaFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EnterDangerAreaFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
s_aesName
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString EnterDangerAreaFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *EnterDangerAreaFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterDangerAreaFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
|
||||
EnterDangerAreaFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_enter_danger_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterDangerAreaItem::EnterDangerAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EnterDangerArea, position)
|
||||
, m_logger(getLogger(QStringLiteral("EnterDangerAreaItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EnterDangerAreaItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterDangerAreaItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EnterDangerAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_enter_functional_area_event_factory.h"
|
||||
#include "tln_enter_functional_area_filter.h"
|
||||
#include "tln_enter_functional_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterFunctionalAreaEventFactory::EnterFunctionalAreaEventFactory()
|
||||
: AbstractEventFactory(EventType::EnterFunctionalArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterFunctionalAreaEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EnterFunctionalAreaEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EnterFunctionalAreaItem>(EnterFunctionalAreaItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *EnterFunctionalAreaEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EnterFunctionalAreaFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterFunctionalAreaEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EnterFunctionalAreaEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#include "tln_enter_functional_area_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString EnterFunctionalAreaFilter::s_aesName = QStringLiteral("AesName");
|
||||
|
||||
|
||||
EnterFunctionalAreaFilter::EnterFunctionalAreaFilter()
|
||||
: AbstractEventFilter(EventType::EnterFunctionalArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterFunctionalAreaFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EnterFunctionalAreaFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
s_aesName
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString EnterFunctionalAreaFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *EnterFunctionalAreaFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterFunctionalAreaFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
|
||||
EnterFunctionalAreaFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_enter_functional_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterFunctionalAreaItem::EnterFunctionalAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EnterFunctionalArea, position)
|
||||
, m_logger(getLogger(QStringLiteral("EnterFunctionalAreaItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EnterFunctionalAreaItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterFunctionalAreaItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EnterFunctionalAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_enter_mine_area_event_factory.h"
|
||||
#include "tln_enter_mine_area_filter.h"
|
||||
#include "tln_enter_mine_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterMineAreaEventFactory::EnterMineAreaEventFactory()
|
||||
: AbstractEventFactory(EventType::EnterMineArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterMineAreaEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EnterMineAreaEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EnterMineAreaItem>(EnterMineAreaItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *EnterMineAreaEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EnterMineAreaFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterMineAreaEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EnterMineAreaEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#include "tln_enter_mine_area_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString EnterMineAreaFilter::s_aesName = QStringLiteral("AesName");
|
||||
QString HitFilter::s_originatorChargeTypeId = QStringLiteral("OriginatorChargeTypeId");
|
||||
|
||||
|
||||
EnterMineAreaFilter::EnterMineAreaFilter()
|
||||
: AbstractEventFilter(EventType::EnterMineArea)
|
||||
, m_logger(getLogger(QStringLiteral("EnterMineAreaFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EnterMineAreaFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
s_aesName,
|
||||
s_originatorChargeTypeId
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterMineAreaFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_originatorChargeTypeId;
|
||||
|
||||
EnterMineAreaFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_enter_mine_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterMineAreaItem::EnterMineAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EnterMineArea, position)
|
||||
, m_logger(getLogger(QStringLiteral("EnterMineAreaItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EnterMineAreaItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterMineAreaItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EnterMineAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#include "tln_enter_nuclear_event_factory.h"
|
||||
#include "tln_enter_nuclear_filter.h"
|
||||
#include "tln_enter_nuclear_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString BCContaminationFilter::s_aesName = QStringLiteral("AesName");
|
||||
|
||||
|
||||
EnterNuclearEventFactory::EnterNuclearEventFactory()
|
||||
: AbstractEventFactory(EventType::EnterNuclear)
|
||||
, m_logger(getLogger(QStringLiteral("EnterNuclearEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EnterNuclearEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EnterNuclearItem>(EnterNuclearItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *EnterNuclearEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EnterNuclearFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterNuclearEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EnterNuclearEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#include "tln_enter_nuclear_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString EnterNuclearFilter::s_aesName = QStringLiteral("AesName");
|
||||
|
||||
|
||||
EnterNuclearFilter::EnterNuclearFilter()
|
||||
: AbstractEventFilter(EventType::EnterNuclear)
|
||||
, m_logger(getLogger(QStringLiteral("EnterNuclearFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EnterNuclearFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
s_aesName
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString EnterNuclearFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *EnterNuclearFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterNuclearFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
|
||||
EnterNuclearFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_enter_nuclear_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EnterNuclearItem::EnterNuclearItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EnterNuclear, position)
|
||||
, m_logger(getLogger(QStringLiteral("EnterNuclearItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EnterNuclearItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EnterNuclearItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EnterNuclearItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_equipment_error_report_factory.h"
|
||||
#include "tln_equipment_error_report_filter.h"
|
||||
#include "tln_equipment_error_report_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EquipmentErrorReportEventFactory::EquipmentErrorReportEventFactory()
|
||||
: AbstractEventFactory(EventType::EquipmentErrorReport)
|
||||
, m_logger(getLogger(QStringLiteral("EquipmentErrorReportEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> EquipmentErrorReportEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<EquipmentErrorReportItem>(EquipmentErrorReportItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
EquipmentErrorReportFilter *EquipmentErrorReportEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new EquipmentErrorReportFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EquipmentErrorReportItem;
|
||||
class EquipmentErrorReportFilter;
|
||||
|
||||
|
||||
class EquipmentErrorReportEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
EquipmentErrorReportEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_equipment_error_report_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EquipmentErrorReportFilter::EquipmentErrorReportFilter()
|
||||
: AbstractEventFilter(EventType::EquipmentErrorReport)
|
||||
, m_logger(getLogger(QStringLiteral("EquipmentErrorReportFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList EquipmentErrorReportFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString EquipmentErrorReportFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *EquipmentErrorReportFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EquipmentErrorReportFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
EquipmentErrorReportFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_equipment_error_report_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
EquipmentErrorReportItem::EquipmentErrorReportItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::EquipmentErrorReport, position)
|
||||
, m_logger(getLogger(QStringLiteral("EquipmentErrorReportItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void EquipmentErrorReportItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class EquipmentErrorReportItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
EquipmentErrorReportItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#include "tln_fire_event_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QString FireEventEventFactory::s_gearTypeId = QStringLiteral("GearTypeId");
|
||||
QString FireEventEventFactory::s_chargeTypeId = QStringLiteral("ChargeTypeId");
|
||||
|
||||
|
||||
FireEventEventFactory::FireEventEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session)
|
||||
: AbstractEventFactory(EventType::FireEvent, exerciseStart, exerciseEnd, session)
|
||||
, m_logger(getLogger(QStringLiteral("FireEventEventFactory")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> FireEventEventFactory::createItem(
|
||||
qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position
|
||||
)
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<FireEventItem>(FireEventItem(this, start, 0, properties, position));
|
||||
}
|
||||
|
||||
AbstractEventFilter *FireEventEventFactory::createFilter()
|
||||
{
|
||||
return new FireEventFilter(this, m_minRangeStart, m_maxRangeEnd);
|
||||
}
|
||||
|
||||
AbstractEventFilter *FireEventEventFactory::filter()
|
||||
{
|
||||
if (m_filter == nullptr)
|
||||
m_filter = static_cast<FireEventFilter *>(createFilter());
|
||||
return m_filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
#include "tln_fire_event_filter.h"
|
||||
#include "tln_fire_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FireEventFilter;
|
||||
|
||||
|
||||
class FireEventEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
static QString s_gearTypeId;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
FireEventEventFactory(qint64 exerciseStart, qint64 exerciseEnd, LtsSession::LtsSession *session);
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) override;
|
||||
AbstractEventFilter *filter() override;
|
||||
AbstractEventFilter *createFilter() override;
|
||||
|
||||
private:
|
||||
FireEventFilter *m_filter{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
#include "tln_fire_event_filter.h"
|
||||
#include "tln_fire_event_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <ExerciseEventManagement/eem.hpp>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FireEventFilter::FireEventFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd)
|
||||
: AbstractEventFilter(factory, EventType::FireEvent, exerciseStart, exerciseEnd)
|
||||
, m_logger(getLogger(QStringLiteral("FireEventFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
m_attributes.insert(FireEventEventFactory::s_gearTypeId, FilterAttribute(FilterAttribute::Type::eIntCompare));
|
||||
m_attributes.insert(FireEventEventFactory::s_chargeTypeId, FilterAttribute(FilterAttribute::Type::eIntCompare));
|
||||
m_attributes.insert(FireEventEventFactory::s_sampleTime, FilterAttribute(FilterAttribute::Type::eTime));
|
||||
updateFilterString();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
bool FireEventFilter::init(std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc)
|
||||
{
|
||||
if (!pdmDtc)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "PDM-DTC is not running";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pdmDtc = pdmDtc;
|
||||
|
||||
if (m_gearTypes.isEmpty())
|
||||
{
|
||||
QMap<qint32, ProjectDataManagement::GearType> gearTypes = m_pdmDtc->gearTypes();
|
||||
for (auto it = gearTypes.constBegin(); it != gearTypes.constEnd(); ++it)
|
||||
onGearTypeChanged(it.value(), DataModification::eAdded);
|
||||
connect(m_pdmDtc.get(), &ProjectDataManagement::Interface::Dtc::gearTypeChanged,
|
||||
this, &FireEventFilter::onGearTypeChanged);
|
||||
}
|
||||
|
||||
if (m_chargeTypes.isEmpty())
|
||||
{
|
||||
QMap<qint32, ProjectDataManagement::ChargeType> chargeTypes = m_pdmDtc->chargeTypes();
|
||||
for (auto it = chargeTypes.constBegin(); it != chargeTypes.constEnd(); ++it)
|
||||
onChargeTypeChanged(it.value(), DataModification::eAdded);
|
||||
connect(m_pdmDtc.get(), &ProjectDataManagement::Interface::Dtc::chargeTypeChanged,
|
||||
this, &FireEventFilter::onChargeTypeChanged);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QStringList FireEventFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
FireEventEventFactory::s_gearTypeId,
|
||||
FireEventEventFactory::s_chargeTypeId,
|
||||
FireEventEventFactory::s_sampleTime
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void FireEventFilter::addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const
|
||||
{
|
||||
addAttributeIntCompareWidgetToLayout(FireEventEventFactory::s_gearTypeId, m_gearTypes, layout, dialog, 0, 0);
|
||||
addAttributeIntCompareWidgetToLayout(FireEventEventFactory::s_chargeTypeId, m_chargeTypes, layout, dialog, 0, 1);
|
||||
addAttributeTimeWidgetToLayout(FireEventEventFactory::s_sampleTime, layout, dialog, 1, 0, 2, 1);
|
||||
}
|
||||
|
||||
bool FireEventFilter::check(const AbstractEventItem &item) const
|
||||
{
|
||||
if (item.type() != EventType::FireEvent)
|
||||
return false;
|
||||
|
||||
if (!m_isActive)
|
||||
return false;
|
||||
|
||||
QJsonObject properties = item.properties();
|
||||
|
||||
if (!m_attributes[FireEventEventFactory::s_gearTypeId].isEmpty() && m_attributes[FireEventEventFactory::s_gearTypeId].isActive())
|
||||
if (!m_attributes[FireEventEventFactory::s_gearTypeId].check(properties.value(FireEventEventFactory::s_gearTypeId).toInt()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[FireEventEventFactory::s_chargeTypeId].isEmpty() && m_attributes[FireEventEventFactory::s_chargeTypeId].isActive())
|
||||
if (!m_attributes[FireEventEventFactory::s_chargeTypeId].check(properties.value(FireEventEventFactory::s_chargeTypeId).toInt()))
|
||||
return false;
|
||||
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].isEmpty() && m_attributes[AbstractEventFactory::s_sampleTime].isActive())
|
||||
if (!m_attributes[AbstractEventFactory::s_sampleTime].check(static_cast<qint64>(item.startTime())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE
|
||||
|
||||
void FireEventFilter::updateFilterString()
|
||||
{
|
||||
if (!m_isActive)
|
||||
{
|
||||
m_filterString.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filterString = QStringLiteral(" WHEN event_type_id = %1").arg(QString::number(type()));
|
||||
if (m_attributes[FireEventEventFactory::s_gearTypeId].isEmpty() &&
|
||||
m_attributes[FireEventEventFactory::s_chargeTypeId].isEmpty() &&
|
||||
m_attributes[FireEventEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" THEN 1");
|
||||
else
|
||||
{
|
||||
m_filterString += QStringLiteral(" THEN CASE");
|
||||
if (!m_attributes[FireEventEventFactory::s_gearTypeId].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[FireEventEventFactory::s_gearTypeId].condition(QStringLiteral("CAST((COALESCE(properties->>'%1','-1')) AS INT)").arg(FireEventEventFactory::s_gearTypeId)));
|
||||
|
||||
if (!m_attributes[FireEventEventFactory::s_chargeTypeId].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[FireEventEventFactory::s_chargeTypeId].condition(QStringLiteral("CAST((COALESCE(properties->>'%1','-1')) AS INT)").arg(FireEventEventFactory::s_chargeTypeId)));
|
||||
|
||||
if (!m_attributes[FireEventEventFactory::s_sampleTime].isEmpty())
|
||||
m_filterString += QStringLiteral(" WHEN NOT %1 THEN 0").arg(m_attributes[FireEventEventFactory::s_sampleTime].condition(FireEventEventFactory::s_sampleTime));
|
||||
|
||||
m_filterString += QStringLiteral(" ELSE 1 END");
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE SLOTS
|
||||
|
||||
void FireEventFilter::onGearTypeChanged(const ProjectDataManagement::GearType &data, DataModification modType)
|
||||
{
|
||||
if (data.gearClassId() != ProjectDataManagement::GearClass_def::DuelSim || data.name() == "N/A")
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_gearTypes[data.id()] = QString::fromStdString(data.name());
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
m_gearTypes.remove(data.id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FireEventFilter::onChargeTypeChanged(const ProjectDataManagement::ChargeType &data, DataModification modType)
|
||||
{
|
||||
if (data.id() < 1)
|
||||
return;
|
||||
|
||||
if (m_pdmDtc->gearClassFromChargeTypeId(data.id()) != ProjectDataManagement::GearClass_def::DuelSim)
|
||||
return;
|
||||
|
||||
const QJsonObject properties = QJsonDocument::fromJson(QString::fromStdString(data.properties()).toUtf8()).object();
|
||||
if (properties.contains(QStringLiteral("isDummy")) && properties.value(QStringLiteral("isDummy")).toBool())
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const QString shortName = m_pdmDtc->trChargeTypeShortName(data.id());
|
||||
m_chargeTypes[data.id()] = shortName.isEmpty() ? m_pdmDtc->trChargeTypeName(data.id()) : shortName;
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
m_chargeTypes.remove(data.id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
|
||||
|
||||
class QComboBox;
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FireEventFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FireEventFilter(AbstractEventFactory *factory, qint64 exerciseStart, qint64 exerciseEnd);
|
||||
|
||||
bool init(std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc);
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
void addWidgetsToLayout(QGridLayout *layout, LtsWidgets::LtsDialog *dialog) const override;
|
||||
bool check(const AbstractEventItem &item) const override;
|
||||
|
||||
QString gearType(int id) const { return m_pdmDtc->trGearTypeName(id); }
|
||||
QString chargeType(int id) const { return m_pdmDtc->trChargeTypeShortName(id); }
|
||||
|
||||
private:
|
||||
void updateFilterString() override;
|
||||
|
||||
private slots:
|
||||
void onGearTypeChanged(const ProjectDataManagement::GearType &data, DataModification modType);
|
||||
void onChargeTypeChanged(const ProjectDataManagement::ChargeType &data, DataModification modType);
|
||||
|
||||
private:
|
||||
QMap<int, QString> m_gearTypes;
|
||||
QMap<int, QString> m_chargeTypes;
|
||||
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc{nullptr};
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#include "tln_fire_event_item.h"
|
||||
#include "tln_fire_event_event_factory.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
QPixmap getFireEventItemPixmap()
|
||||
{
|
||||
QPixmap pixmap(AbstractEventItem::s_defaultWidth, AbstractEventItem::s_defaultHeight);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter.setBrush(QBrush(Qt::blue));
|
||||
painter.drawEllipse(
|
||||
QPoint(AbstractEventItem::s_defaultWidth / 2, AbstractEventItem::s_defaultHeight / 2),
|
||||
AbstractEventItem::s_defaultWidth / 2, AbstractEventItem::s_defaultHeight / 2
|
||||
);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QPixmap FireEventItem::pixmap = getFireEventItemPixmap();
|
||||
|
||||
|
||||
FireEventItem::FireEventItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractParticipantEventItem(factory, startTime, duration, properties, Qt::blue, EventType::FireEvent, position)
|
||||
, m_logger(getLogger(QStringLiteral("FireEventItem")))
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void FireEventItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const
|
||||
{
|
||||
//fprintf(stderr, "Fire Event paint!! @ x=%d\n", option.rect.center().x());
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
painter->drawPixmap(
|
||||
QRect(
|
||||
option.rect.center().x() - AbstractEventItem::s_defaultWidth / 2,
|
||||
option.rect.center().y() - AbstractEventItem::s_defaultHeight / 2, AbstractEventItem::s_defaultWidth,
|
||||
AbstractEventItem::s_defaultHeight
|
||||
), pixmap
|
||||
);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void FireEventItem::addItemInfoRows(QFormLayout *form)
|
||||
{
|
||||
FireEventFilter *filter = static_cast<FireEventFilter *>(m_factory->filter());
|
||||
if (!filter)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "FireEventFilter unavailable";
|
||||
return;
|
||||
}
|
||||
|
||||
QString attributeName = FilterAttribute::attributeDisplayName(FireEventEventFactory::s_chargeTypeId) + QStringLiteral(":");
|
||||
QString attributeValue = filter->chargeType(m_properties.value(FireEventEventFactory::s_chargeTypeId).toInt());
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
|
||||
attributeName = FilterAttribute::attributeDisplayName(FireEventEventFactory::s_gearTypeId) + QStringLiteral(":");
|
||||
attributeValue = filter->gearType(m_properties.value(FireEventEventFactory::s_gearTypeId).toInt());
|
||||
form->addRow(new QLabel(attributeName), new QLabel(attributeValue));
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_participant_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class QPixmap;
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FireEventItem : public AbstractParticipantEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
static QPixmap pixmap;
|
||||
|
||||
FireEventItem(AbstractEventFactory *factory, qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool) const override;
|
||||
void addItemInfoRows(QFormLayout *form) override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_friendly_fire_event_factory.h"
|
||||
#include "tln_friendly_fire_filter.h"
|
||||
#include "tln_friendly_fire_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FriendlyFireEventFactory::FriendlyFireEventFactory()
|
||||
: AbstractEventFactory(EventType::FriendlyFire)
|
||||
, m_logger(getLogger(QStringLiteral("FriendlyFireEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> FriendlyFireEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<FriendlyFireItem>(FriendlyFireItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
FriendlyFireFilter *FriendlyFireEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new FriendlyFireFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FriendlyFireItem;
|
||||
class FriendlyFireFilter;
|
||||
|
||||
|
||||
class FriendlyFireEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
FriendlyFireEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_friendly_fire_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FriendlyFireFilter::FriendlyFireFilter()
|
||||
: AbstractEventFilter(EventType::FriendlyFire)
|
||||
, m_logger(getLogger(QStringLiteral("FriendlyFireFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList FriendlyFireFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString FriendlyFireFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *FriendlyFireFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FriendlyFireFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
FriendlyFireFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_friendly_fire_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FriendlyFireItem::FriendlyFireItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::FriendlyFire, position)
|
||||
, m_logger(getLogger(QStringLiteral("FriendlyFireItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void FriendlyFireItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FriendlyFireItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
FriendlyFireItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_functional_area_event_factory.h"
|
||||
#include "tln_functional_area_filter.h"
|
||||
#include "tln_functional_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FunctionalAreaEventFactory::FunctionalAreaEventFactory()
|
||||
: AbstractEventFactory(EventType::FunctionalArea)
|
||||
, m_logger(getLogger(QStringLiteral("FunctionalAreaEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> FunctionalAreaEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, , const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<FunctionalAreaItem>(FunctionalAreaItem(start, 1, properties , position)));
|
||||
}
|
||||
|
||||
FunctionalAreaFilter *FunctionalAreaEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new FunctionalAreaFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Lts/Plugins/Timeline/Gui/EventTimeline/EventTypes/FunctionalArea/tln_functional_area_event_factory.h
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FunctionalAreaItem;
|
||||
class FunctionalAreaFilter;
|
||||
|
||||
|
||||
class FunctionalAreaEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
FunctionalAreaEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#include "tln_functional_area_filter.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FunctionalAreaFilter::FunctionalAreaFilter()
|
||||
: AbstractEventFilter(EventType::FunctionalArea)
|
||||
, m_logger(getLogger(QStringLiteral("FunctionalAreaFilter")))
|
||||
{
|
||||
m_attributes.reserve(attributeNames().size());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
QStringList FunctionalAreaFilter::attributeNames() const
|
||||
{
|
||||
static QStringList names =
|
||||
{
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
QString FunctionalAreaFilter::conditions() const
|
||||
{
|
||||
QString stmt = QStringLiteral("(event_type_id = ") + QString::number(type());
|
||||
|
||||
stmt += QStringLiteral(")");
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
QWidget *FunctionalAreaFilter::widget()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_filter.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FunctionalAreaFilter : public AbstractEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString s_aesName;
|
||||
static QString s_duration;
|
||||
static QString s_chargeTypeId;
|
||||
|
||||
FunctionalAreaFilter();
|
||||
|
||||
QStringList attributeNames() const override;
|
||||
QString conditions() const override;
|
||||
QWidget *widget() override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include "tln_functional_area_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
FunctionalAreaItem::FunctionalAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position)
|
||||
: AbstractEventItem(startTime, duration, properties, Qt::blue, EventType::FunctionalArea, position)
|
||||
, m_logger(getLogger(QStringLiteral("FunctionalAreaItem")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void FunctionalAreaItem::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
painter->save();
|
||||
QPolygon triangle;
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
triangle << QPoint(option.rect.right(), option.rect.top());
|
||||
triangle << QPoint(option.rect.center().x(), option.rect.bottom());
|
||||
triangle << QPoint(option.rect.left(), option.rect.top());
|
||||
painter->setBrush(m_color);
|
||||
painter->drawPolygon(triangle);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_item.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class FunctionalAreaItem : public AbstractEventItem
|
||||
{
|
||||
|
||||
public:
|
||||
FunctionalAreaItem(qint64 startTime, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#include "tln_gas_pipe_event_factory.h"
|
||||
#include "tln_gas_pipe_filter.h"
|
||||
#include "tln_gas_pipe_item.h"
|
||||
#include "../../logger.h"
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
GasPipeEventFactory::GasPipeEventFactory()
|
||||
: AbstractEventFactory(EventType::GasPipe)
|
||||
, m_logger(getLogger(QStringLiteral("GasPipeEventFactory")))
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
std::unique_ptr<AbstractEventItem> GasPipeEventFactory::createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const
|
||||
{
|
||||
Q_UNUSED(duration);
|
||||
return std::make_unique<GasPipeItem>(GasPipeItem(start, 1, properties, position));
|
||||
}
|
||||
|
||||
GasPipeFilter *GasPipeEventFactory::createFilter() const
|
||||
{
|
||||
AbstractEventFilter *filter = new GasPipeFilter();
|
||||
return filter;
|
||||
}
|
||||
|
||||
} // namespace Timeline
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../tln_abstract_event_factory.h"
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
|
||||
namespace Timeline
|
||||
{
|
||||
|
||||
class GasPipeItem;
|
||||
class GasPipeFilter;
|
||||
|
||||
|
||||
class GasPipeEventFactory : public AbstractEventFactory
|
||||
{
|
||||
|
||||
public:
|
||||
GasPipeEventFactory();
|
||||
|
||||
std::unique_ptr<AbstractEventItem> createItem(qint64 start, int duration, const QJsonObject &properties, const LtsUtils::QPoint3D &position) const;
|
||||
AbstractEventFilter *createFilter() const override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Timeline
|
||||
Loaded 100 of 16245 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user