Initial commit

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

No files matched your search

@@ -0,0 +1,190 @@
/**
* @RDE_HEADER@
* GraphicalObjectAttributes
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "graphical_object_attributes.h"
#include <MapImpl/map_impl.h>
#include <Map/situation_map_utils.h> // operator<<
#include <Common/simple_value.h>
// ESRI
#include <arcgis/Map.h>
#include <arcgis/GraphicsOverlay.h>
// Qt
namespace SituationMap
{
class GraphicalObjectAttributes::Private
{
public:
Private() = default;
~Private() = default;
// ESRI data:
MapImpl *m_mapImpl = nullptr;
QString m_logicalLayerName;
// OWN data:
SimpleValue<QVariantMap> m_attributes;
}; // class GraphicalObjectAttributes::Private
//-----------------------------------------------------------------------------
GraphicalObjectAttributes::GraphicalObjectAttributes(MapImpl *mapImpl,
Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer,
const QString &debugInfo,
const UniqueMapId &uniqueMapId)
: BaseClass(mapImpl->getEsriGeoView(), graphicsLayer, debugInfo, uniqueMapId),
m_logger(getLogger("GraphicalObjectAttributes")),
d(new Private)
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'";
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'";
}
GraphicalObjectAttributes::~GraphicalObjectAttributes()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'";
delete d;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'";
}
bool GraphicalObjectAttributes::create()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'"
<< " m_visibility = " << m_visibility;
bool success = BaseClass::create();
if (!success)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'"
<< " create failed";
return false;
}
bool successGraphic = addUpdateGraphic(); // CHECK
if (!successGraphic)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " addUpdateGraphic failed, debugInfo='" << m_debugInfo << "'" << " uniqueMapId=" << m_uniqueMapId;
return false;
}
// real work:
// empty
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'";
return success;
}
QVariantMap GraphicalObjectAttributes::attributes() const
{
return d->m_attributes.value();
}
void GraphicalObjectAttributes::setAttributes(const QVariantMap &attributes)
{
d->m_attributes = attributes;
}
bool GraphicalObjectAttributes::changed()
{
return BaseClass::changed()
|| d->m_attributes.changed();
}
void GraphicalObjectAttributes::resetChanged()
{
BaseClass::resetChanged();
d->m_attributes.reset();
}
Esri::ArcGISRuntime::Geometry GraphicalObjectAttributes::getGraphicGeometry() const
{
if (m_graphic) return m_graphic->geometry();
ERROR_LOG(m_logger) << LOGFUNCTION << "Geometry is undefined";
return Esri::ArcGISRuntime::Geometry();
} // Esri::ArcGISRuntime::Geometry GraphicalObjectAttributes::getGraphicGeometry() const
bool GraphicalObjectAttributes::updateViewImpl()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'"
<< " visibility=" << m_visibility
<< " selected=" << m_selected
<< " origin=" << this->origin()
<< " scale=" << m_scale.value();
bool success = create();
if (!success)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'"
<< " create failed";
return false;
}
if (!BaseClass::updateViewImpl())
{
ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'"
<< " updateView failed";
return false;
}
// real work:
if (m_positions.changed())
{
const PositionCont &posCont = m_positions.value();
if (posCont.size() == 1)
{
const Point3D &origin = this->origin();
Esri::ArcGISRuntime::Point originGeometry(origin.x(),
origin.y(),
origin.z(),
spatialReference());
m_graphic->setGeometry(originGeometry);
}
}
if (d->m_attributes.changed())
{
QVariantMap rawAttributes = d->m_attributes.value();
// add basics:
rawAttributes[QLatin1String(SituationMap::UniqueMapIdAttribute)] = m_uniqueMapId;
rawAttributes[QLatin1String(SituationMap::IsPickableAttribute)] = m_pickable.value();
m_graphic->attributes()->setAttributesMap(rawAttributes);
if (m_logger.isDebugEnabled())
qCritical() << " XXXXX set rawAttributes " << rawAttributes;
}
if (m_graphic)
{
m_graphic->setZIndex(m_drawOrder.value());
m_graphic->setVisible(m_visibility.value());
m_graphic->setSelected(m_selected.value());
}
if (!success)
ERROR_LOG(m_logger) << LOGFUNCTION << " failure, debugInfo='" << m_debugInfo << "'";
TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'"
<< " success = " << success
<< " visibility=" << m_visibility;
return success;
}
} // namespace SituationMap