Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+226
@@ -0,0 +1,226 @@
|
||||
/**
|
||||
**
|
||||
** @RDE_HEADER@
|
||||
** Definition of transient map objects for use while rubberbanding is done
|
||||
** $Id$
|
||||
** $HeadURL$
|
||||
** $Author$
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
**
|
||||
** Hardware-Environment: Intel-PC
|
||||
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
|
||||
**
|
||||
** Language ........: C++ 11
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
**
|
||||
** Author ...........: Joerg Turla, SPD G, Tel. 3132
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
**
|
||||
** Notes .........:
|
||||
**
|
||||
** 29.09.2015, JT : First edition for use with Qt5
|
||||
**
|
||||
** -----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
// Own
|
||||
#include "sidc_symbol_impl.h"
|
||||
#include "map_impl.h"
|
||||
|
||||
#include <Map/bounding_box.h>
|
||||
#include <Map/coord_translation_functor.h>
|
||||
#include <Map/object_factory.h>
|
||||
|
||||
#include <GraphicalObjects/stub_graphical_object.h>
|
||||
#include <GraphicalObjects/tactical_appearance.h>
|
||||
|
||||
#include <Symbology/sidc_codec.h>
|
||||
|
||||
// ESRI
|
||||
#include <arcgis/Envelope.h>
|
||||
#include <arcgis/Graphic.h>
|
||||
|
||||
|
||||
//Qt
|
||||
#include <QPointF>
|
||||
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
|
||||
SidcSymbolImpl::SidcSymbolImpl(const QString &debugInfo) : SidcSymbolImpl(QString(), debugInfo) {;}
|
||||
|
||||
SidcSymbolImpl::SidcSymbolImpl(const QString &sidc, const QString &debugInfo)
|
||||
: InterfaceClass() // Interface
|
||||
, BaseClass(debugInfo) // Implementation
|
||||
, m_sidc(sidc)
|
||||
, m_color(0, 0, 0, 0)
|
||||
, m_logger(getLogger("SIDC_SymbolImpl"))
|
||||
{
|
||||
m_visibility = true;
|
||||
m_visibilityTactical = true;
|
||||
m_visibilityTechnical = false;
|
||||
m_selected = false;
|
||||
m_pickable = false;
|
||||
|
||||
m_positions.setMapObjectImpl(this);
|
||||
|
||||
} /* SidcSymbolImpl::SidcSymbolImpl */
|
||||
|
||||
|
||||
PositionCont SidcSymbolImpl::positions() const { return m_positions.positions(); }
|
||||
void SidcSymbolImpl::setPositions(const PositionCont &posCont) { m_positions.setPositions(posCont); }
|
||||
|
||||
PositionCont SidcSymbolImpl::positionsTranslated() const { return m_positions.positionsTranslated(); }
|
||||
void SidcSymbolImpl::setPositionsTranslated(const PositionCont &posCont) { m_positions.setPositionsTranslated(posCont); }
|
||||
|
||||
LineStyle SidcSymbolImpl::lineStyle() const { return BaseClass::lineStyle(); }
|
||||
LineStyle &SidcSymbolImpl::rLineStyle() { return BaseClass::rLineStyle(); }
|
||||
void SidcSymbolImpl::setLineStyle(const LineStyle &lineStyle) { BaseClass::setLineStyle(lineStyle); }
|
||||
FillStyle SidcSymbolImpl::fillStyle() const { return BaseClass::fillStyle(); }
|
||||
FillStyle &SidcSymbolImpl::rFillStyle() { return BaseClass::rFillStyle(); }
|
||||
void SidcSymbolImpl::setFillStyle(const FillStyle &fillStyle) { BaseClass::setFillStyle(fillStyle); }
|
||||
|
||||
float SidcSymbolImpl::scale() const { return (m_tacticalAppearance) ? m_tacticalAppearance->scale() : 1; }
|
||||
void SidcSymbolImpl::setScale(float scale) { if (m_tacticalAppearance) m_tacticalAppearance->setScale(scale); }
|
||||
|
||||
|
||||
const QString &SidcSymbolImpl::sidc() const { return m_symbol.value().sidc; }
|
||||
|
||||
const QColor &SidcSymbolImpl::color() const { return m_color; }
|
||||
|
||||
|
||||
void SidcSymbolImpl::boundingBox(BoundingBox &bbox) const
|
||||
{
|
||||
if (m_tacticalAppearance)
|
||||
{
|
||||
SituationMap::CoordTranslationFunctor *coordTransFunctor = nullptr;
|
||||
if (const_cast<SidcSymbolImpl *>(this)->mapImpl())
|
||||
{
|
||||
// if useful, a MapObjectType specific functor can be prefered here:
|
||||
// like: if (m_mapObjectImpl->coordTranslationFunctor()) ctFunctor=m_mapObjectImpl->coordTranslationFunctor();
|
||||
coordTransFunctor = const_cast<SidcSymbolImpl *>(this)->mapImpl()->coordTranslationFunctor();
|
||||
}
|
||||
|
||||
if (coordTransFunctor)
|
||||
{
|
||||
const Esri::ArcGISRuntime::Envelope &extent = m_tacticalAppearance->getGraphicGeometry().extent();
|
||||
|
||||
const QPointF &min = coordTransFunctor->mapToGeographic(extent.xMin(), extent.yMin());
|
||||
const QPointF &max = coordTransFunctor->mapToGeographic(extent.xMax(), extent.yMax());
|
||||
const QPointF ¢er = (min + max) * 0.5;
|
||||
bbox = BoundingBox(BoundingBox::ExtentType::Sim, Point3D::fromQPointF(center), max.x() - min.x(), max.y() - min.y());
|
||||
}
|
||||
}
|
||||
} // void SidcSymbolImpl::boundingBox(BoundingBox &bbox) const
|
||||
|
||||
|
||||
void SidcSymbolImpl::setSidc(const QString &sidc)
|
||||
{
|
||||
SymbolData symbolData = symbol();
|
||||
symbolData.sidc = sidc;
|
||||
symbolData.useAlwaysDictionaryRenderer = (!AdvancedSymbology::SidcCodec::isCivil(sidc));
|
||||
setSymbol(symbolData);
|
||||
m_sidc = sidc;
|
||||
} // void SidcSymbolImpl::setSidc( const QString & sidc )
|
||||
|
||||
|
||||
|
||||
void SidcSymbolImpl::setColor(const QColor &color)
|
||||
{
|
||||
m_color = color;
|
||||
} // void SidcSymbolImpl::setColor(const QColor & color)
|
||||
|
||||
|
||||
const QMap<QString, QVariant> &SidcSymbolImpl::attributeMap() const { return m_symbol.value().attributeMap; }
|
||||
|
||||
|
||||
void SidcSymbolImpl::setAttributeMap(const QMap<QString, QVariant> &attrMap)
|
||||
{
|
||||
SymbolData symbolData = symbol();
|
||||
symbolData.attributeMap = attrMap;
|
||||
setSymbol(symbolData);
|
||||
} // SidcSymbolImpl::setAttributeMap(const QMap<QString, QVariant> & attrMap)
|
||||
|
||||
|
||||
void SidcSymbolImpl::defineSymbol(const QString &sidc, const PositionCont &posCont, const QMap<QString, QVariant> &attrMap, const QColor &color)
|
||||
{
|
||||
SymbolData symbolData = symbol();
|
||||
symbolData.sidc = sidc;
|
||||
symbolData.attributeMap = attrMap;
|
||||
symbolData.color = (color.alpha() < 1) ? QColor(0, 0, 0, 0) : color;
|
||||
symbolData.useAlwaysDictionaryRenderer = (!AdvancedSymbology::SidcCodec::isCivil(sidc));
|
||||
setSymbol(symbolData);
|
||||
m_sidc = sidc;
|
||||
m_color = color;
|
||||
m_positions.setPositions(posCont);
|
||||
} // void SidcSymbolImpl::defineSymbol( const QString & sidc, const PositionCont & posCont, const QMap<QString, QVariant> & attrMap )
|
||||
|
||||
|
||||
bool SidcSymbolImpl::updateViewImplPre()
|
||||
{
|
||||
return BaseClass::updateViewImplPre();
|
||||
} // SidcSymbolImpl::updateViewImplPre
|
||||
|
||||
|
||||
bool SidcSymbolImpl::updateViewImpl()
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
|
||||
<< " visibility=" << m_visibility
|
||||
<< " visiTechn=" << m_visibilityTechnical
|
||||
<< " visiTact=" << m_visibilityTactical;
|
||||
|
||||
// REGG-5261 - Alle Wirkfelder blinken in 3D, wenn C-Kampf ausgelöst ist
|
||||
// War mit 100.4 meist, aber nicht immer reproduzierbar.
|
||||
// Wenn aber per FunctionsDialog die TacticalAppearance sichtbar wurde,
|
||||
// so war ein massives Flackern erkennbar.
|
||||
// Daher wird die Ausdehnung nur an SICHTBARE m_tacticalAppearance übergeben
|
||||
// [basic_path_object, sidc_symbol_impl]
|
||||
if (m_tacticalAppearance && m_tacticalAppearance->visibility())
|
||||
{
|
||||
m_tacticalAppearance->setSymbol(m_symbol.value());
|
||||
m_tacticalAppearance->setPositions(m_positions.positionsTranslated());
|
||||
this->resetTacticalAppearanceDrawOrderOffset(); // avoid tacticalAppearance getting drawOrderOffset (2)
|
||||
}
|
||||
|
||||
bool success = BaseClass::updateViewImpl();
|
||||
|
||||
if (!success)
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " updateViewImpl failed";
|
||||
else
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
|
||||
return success;
|
||||
} /* SidcSymbolImpl::updateViewImpl */
|
||||
|
||||
|
||||
|
||||
bool SidcSymbolImpl::init(MapImpl *mapImpl, const QString &logicalLayerName)
|
||||
{
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
|
||||
|
||||
if (!mapImpl) return false;
|
||||
|
||||
bool success = BaseClass::init(mapImpl, logicalLayerName);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (!m_mainGraphicalObject) m_mainGraphicalObject = new StubGraphicalObject();
|
||||
|
||||
m_symbol.refValue().sidc = m_sidc;
|
||||
m_symbol.refValue().color = (m_color.alpha() < 255) ? QColor(0, 0, 0, 0) : m_color; // to avoid color replacement (use default color)
|
||||
|
||||
TRACE_LOG(m_logger) << LOGFUNCTION << " END, success=" << success;
|
||||
}
|
||||
else ERROR_LOG(m_logger) << LOGFUNCTION << " init failed";
|
||||
|
||||
return success;
|
||||
} /* SidcSymbolImpl::init */
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
|
||||
Reference in new issue
Block a user