Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
174 lines
5.6 KiB
C++
174 lines
5.6 KiB
C++
/**
|
|
* Handler ShootbackAreas (L400)
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by N. Thoden, NLE, 06.04.2020
|
|
*/
|
|
|
|
#include "object_shootback_area.h"
|
|
#include "main_handler.h"
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
namespace TargetManagement
|
|
{
|
|
ObjectShootbackArea::ObjectShootbackArea(MainHandler *mainHandler)
|
|
: m_mainHandler(mainHandler)
|
|
, m_logger(getLogger("ObjectShootbackArea"))
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
ObjectShootbackArea::~ObjectShootbackArea()
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
if (isValid())
|
|
m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id());
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
bool ObjectShootbackArea::isValid() const
|
|
{
|
|
return m_data.id() > 0;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
bool ObjectShootbackArea::isUsed() const
|
|
{
|
|
return m_data.isUsed();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
Core::FunctionReplyObject ObjectShootbackArea::createObject(const ShootbackArea &data)
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
m_data = data;
|
|
|
|
if (m_data.id() <= 0)
|
|
{
|
|
m_data.isUsed(false);
|
|
|
|
Database::TgtShootbackArea dbData(toDbData(data));
|
|
|
|
if (!m_mainHandler->db()->insert(dbData))
|
|
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting ShootbackArea-data into database"));
|
|
|
|
m_data.id(dbData.id);
|
|
DEBUG_LOG(m_logger) << "New TgtShootbackArea: " << m_data.id();
|
|
}
|
|
|
|
// Publish Data via DTS
|
|
onPublishData();
|
|
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
Core::FunctionReplyObject ObjectShootbackArea::updateObject(const ShootbackArea &data)
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
if (!isValid())
|
|
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Object not valid/blocked"));
|
|
|
|
Database::TgtShootbackArea dbData;
|
|
dbData = toDbData(data);
|
|
|
|
if (!m_mainHandler->db()->update(dbData))
|
|
return Core::FunctionReplyObject(data.id(), tr_lts("dds", "Error updating ShootbackArea-data into database"));
|
|
|
|
m_data = data;
|
|
DEBUG_LOG(m_logger) << "Data changed for ShootbackAreaId: " << m_data.id();
|
|
|
|
// Publish Data via DTS
|
|
onPublishData();
|
|
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
Core::FunctionReplyObject ObjectShootbackArea::setUsed(bool isUsed)
|
|
{
|
|
if (!isValid())
|
|
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Trying to update an already removed ShootbackArea object"));
|
|
|
|
m_data.isUsed(isUsed);
|
|
|
|
// Publish Data via DTS
|
|
onPublishData();
|
|
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
Core::FunctionReplyObject ObjectShootbackArea::removeObject()
|
|
{
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
|
if (isUsed())
|
|
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea still in use"));
|
|
|
|
if (!m_mainHandler->db()->removeTgtShootbackArea(m_data.id()))
|
|
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea with id %1 can not be removed from DB")).arg(m_data.id());
|
|
|
|
if (!m_mainHandler->dds()->dtsTgt()->removeShootbackAreaByKey(m_data.id()))
|
|
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "ShootbackArea with id %1 can not be removed from DDS")).arg(m_data.id());
|
|
|
|
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
void ObjectShootbackArea::onPublishData()
|
|
{
|
|
TRACE_LOG(m_logger) << "Publish ShootbackArea-data to dds (" << m_data.id() << ") ...";
|
|
|
|
if (!m_mainHandler->dds()->dtsTgt()->publish(m_data))
|
|
ERROR_LOG(m_logger) << "Error publishing ShootbackArea-data to dds";
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------------
|
|
// convert methods
|
|
// -------------------------------------------------------------------------------------------------------
|
|
|
|
// TargetManagement::ShootbackArea => Database::TgtShootbackArea
|
|
Database::TgtShootbackArea ObjectShootbackArea::toDbData(const ShootbackArea &ddsData)
|
|
{
|
|
Database::TgtShootbackArea dbData;
|
|
|
|
dbData.id = ddsData.id();
|
|
dbData.name = QString::fromStdString(ddsData.name());
|
|
dbData.position = QPointF(ddsData.position().lon(), ddsData.position().lat());
|
|
dbData.width = ddsData.width();
|
|
dbData.height = ddsData.height();
|
|
|
|
return dbData;
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------------
|
|
// Database::TgtShootbackArea => TargetManagement::ShootbackArea
|
|
ShootbackArea ObjectShootbackArea::toDdsData(const Database::TgtShootbackArea &dbData)
|
|
{
|
|
ShootbackArea ddsData;
|
|
|
|
ddsData.id(dbData.id);
|
|
ddsData.name(dbData.name.toStdString());
|
|
ddsData.position(Core::GeoPosition2D(dbData.position.x(), dbData.position.y()));
|
|
ddsData.width(dbData.width);
|
|
ddsData.height(dbData.height);
|
|
|
|
// init data not in db
|
|
ddsData.isDeleted(false);
|
|
ddsData.isUsed(false);
|
|
|
|
return ddsData;
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------------
|
|
|
|
} // Namespace TargetManagement
|