/** * @RDE_HEADER@ * GraphicalObjectRendererAttributes * $Id$ * $HeadURL$ * $Author$ */ // Own #include "graphical_object_renderer_attributes.h" #include // operator<< #include // ESRI #include // This file is created by RME, not ESRI #include #include // Qt #include #include namespace SituationMap { GraphicalObjectRendererAttributes::GraphicalObjectRendererAttributes(const Esri::ArcGISRuntime::GeoView *geoView , Esri::ArcGISRuntime::GraphicsOverlay *graphicsLayer , const QString &debugInfo , const UniqueMapId &uniqueMapId) : BaseClass(geoView, graphicsLayer, debugInfo, uniqueMapId) , m_logger(getLogger("GraphicalObjectRendererAttributes")) { TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'"; TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'"; } GraphicalObjectRendererAttributes::~GraphicalObjectRendererAttributes() { TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'"; TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'"; } void GraphicalObjectRendererAttributes::setAttributeMap(const QVariantMap &attribMap) { m_attributeMap = attribMap; } QVariantMap GraphicalObjectRendererAttributes::attributeMap() const { return m_attributeMap.value(); } bool GraphicalObjectRendererAttributes::create() { return BaseClass::create(); } bool GraphicalObjectRendererAttributes::updateViewImpl() { TRACE_LOG(m_logger) << LOGFUNCTION << " START, debugInfo='" << m_debugInfo << "'" << " origin =" << this->origin() // .x() << " , " << this->origin().y() << " visibility=" << m_visibility << " pickable=" << m_pickable << " pickable.changed=" << m_pickable.changed() << " selected=" << m_selected << " m_attributeMap = " << m_attributeMap.value().size() << " m_drawOrder = " << m_drawOrder; // some checks: if (!isSinglePoint()) { ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'" << " incorrect number of positions" << " (" << this->positions().count() << ")"; return false; } bool success = create(); if (!success) { ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'" << " create failed"; return false; } const Point3D &origin = this->origin(); m_graphic->setGeometry(Esri::ArcGISRuntime::Point(origin.x(), origin.y(), origin.z(), spatialReference())); if (m_attributeMap.changed()) { QVariantMap cur = m_graphic->attributes()->attributesMap(); if (m_logger.isDebugEnabled()) qCritical() << " debugInfo='" << m_debugInfo << "'" << ", QVariantMap before unite " << cur; cur.unite(m_attributeMap.value()); if (m_logger.isDebugEnabled()) qCritical() << " debugInfo='" << m_debugInfo << "'" << ", QVariantMap after unite " << cur; m_graphic->attributes()->setAttributesMap(cur); } // keep anchor like Esri::ArcGISRuntime::SceneSymbolAnchorPosition::Bottom in mind. // assigned during setup the Renderer (LayerFactory, AdapterDds...) success = BaseClass::updateViewImpl(); if (!success) { ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'" << " updateView failed"; return false; } success = addUpdateGraphic(); if (!success) { ERROR_LOG(m_logger) << LOGFUNCTION << " debugInfo='" << m_debugInfo << "'" << " updateView failed"; return false; } TRACE_LOG(m_logger) << LOGFUNCTION << " END, debugInfo='" << m_debugInfo << "'" << " success=" << success << " m_drawOrder = " << m_drawOrder << " m_graphic->drawOrder = " << m_graphic->zIndex(); return success; } } // namespace SituationMap