Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/MapObjectsImpl/map_object_attributes_impl.cpp
T
2026-08-13 18:33:10 +02:00

112 lines
3.0 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Interface-Implementation of DangerArea
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "map_object_attributes_impl.h"
#include <MapImpl/map_impl.h>
#include <GraphicalObjects/graphical_object_attributes.h>
#include <Symbology/sidc_codec.h>
// ESRI
// Qt
namespace SituationMap
{
//-----------------------------------------------------------------------------
// class MapObjectAttributesImpl
//-----------------------------------------------------------------------------
MapObjectAttributesImpl::MapObjectAttributesImpl(const QString &debugInfo)
: MapObjectAttributes() // Interface
, BaseClass(debugInfo) // Implementation
, m_logger(getLogger("MapObjectAttributesImpl"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
MapObjectAttributesImpl::~MapObjectAttributesImpl()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
QVariantMap MapObjectAttributesImpl::attributes() const
{
if (!m_mainGraphicalObject)
return {};
GraphicalObjectAttributes *goa = static_cast<GraphicalObjectAttributes *>(m_mainGraphicalObject);
if (!goa)
return {};
return goa->attributes();
}
void MapObjectAttributesImpl::setAttributes(const QVariantMap &attributes)
{
if (!m_mainGraphicalObject)
return;
GraphicalObjectAttributes *goa = static_cast<GraphicalObjectAttributes *>(m_mainGraphicalObject);
if (!goa)
return;
goa->setAttributes(attributes);
}
bool MapObjectAttributesImpl::updateViewImpl()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " symbol=" << m_symbol.value().sidc
<< " visibility=" << m_visibility
<< " visiTechn=" << m_visibilityTechnical
<< " visiTact=" << m_visibilityTactical;
m_mainGraphicalObject->setOrigin(this->originTranslated());
bool success = BaseClass::updateViewImpl();
if (!success)
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl failed";
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
return success;
}
bool MapObjectAttributesImpl::init(MapImpl *mapImpl, const QString &logicalLayerName)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
bool success = BaseClass::init(mapImpl, logicalLayerName);
if (!success)
ERROR_LOG(m_logger) << LOGFUNCTION << " init failed";
if (success)
{
// create underlying object (to save most attributes only there)
if (!m_mainGraphicalObject)
m_mainGraphicalObject = new GraphicalObjectAttributes(m_mapImpl,
m_graphicsLayer,
m_debugInfo + QLatin1String("#GOAttributes"),
m_uniqueMapId);
}
else
ERROR_LOG(m_logger) << LOGFUNCTION << " init failed";
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
return success;
}
} // namespace SituationMap