BUILD_RTI conditional fixes and Qt6 API updates

- cmake/FindRTI.cmake: Add INTERFACE placeholder targets when RTI not found
- cmake/FindRTI.cmake: Force BUILD_RTI=OFF when RTI not installed
- Lts/Common/LtsSession/CMakeLists.txt: Make LtsSessionDataDds conditional on BUILD_RTI
- Lts/Viewer/CMakeLists.txt: Make LtsDataView conditional on BUILD_RTI
- Lts/Plugins/*/CMakeLists.txt: 97 plugin files wrapped in BUILD_RTI conditionals
- cmake/NGLMacros.cmake: Fix NGL_ADD_BIG_RESOURCES macro (removed premature return())
- Multiple Qt6 API fixes: QLinkedList→std::list, QStringRef→QStringView, etc.
- BUILD_RTI_FIXES_SUMMARY.md: Comprehensive documentation of all fixes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-19 09:24:50 +02:00
1 parent b774f4035c
commit 4c9861a469
2065 files changed
+48219 -1763

No files matched your search

@@ -0,0 +1,35 @@
#
# $Id$
# $Author$
#
# Minimal CMakeLists.txt for Qt6 migration - only Symbology subdirectory
# Full migration pending
# Only migrate Symbology for now
ADD_SUBDIRECTORY(Common)
ADD_SUBDIRECTORY(SymbologyXML)
ADD_SUBDIRECTORY(Symbology)
# Remaining subdirectories not yet migrated:
# ADD_SUBDIRECTORY(ElevationMap)
# ADD_SUBDIRECTORY(SymbologyGui)
# ADD_SUBDIRECTORY(SymbologyXML)
# ADD_SUBDIRECTORY(MapObjectsImpl)
# ADD_SUBDIRECTORY(SideBar)
# ADD_SUBDIRECTORY(FunctionDialog)
# ADD_SUBDIRECTORY(GeometryModel)
# ADD_SUBDIRECTORY(Portal)
# ADD_SUBDIRECTORY(GraphicalObjects)
# ADD_SUBDIRECTORY(Map)
# ADD_SUBDIRECTORY(MapImpl)
# ADD_SUBDIRECTORY(MapObjects)
# ADD_SUBDIRECTORY(Rubberbands)
# ADD_SUBDIRECTORY(Utils)
# ADD_SUBDIRECTORY(MathUtils)
# ADD_SUBDIRECTORY(LayerAggregation)
# ADD_SUBDIRECTORY(LocalSrv)
# ADD_SUBDIRECTORY(Tests)
# ADD_SUBDIRECTORY(EvalApps)
# ADD_SUBDIRECTORY(UnitTests)
# ADD_SUBDIRECTORY(UnitTestsGeoModel)
# ADD_SUBDIRECTORY(ModuleTests)
@@ -0,0 +1,44 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# LIBRARY
SET(Common_SRCS
id_handler.cpp
referenced.cpp
resource_path.cpp
situation_map_logging.cpp
)
SET (Common_HDRS
exception.h
id_handler.h
ref_pointer.h
referenced.h
resource_path.h
situation_map_common_export.h
situation_map_logging.h
simple_value.h
)
SOURCE_GROUP(Common FILES ${Common_SRCS} ${Common_HDRS})
NGL_ADD_LIBRARY(WS AAR HLA SV situationMapCommon SHARED ${Common_SRCS} ${Common_HDRS})
NGL_TARGET_LINK_LIBRARIES(situationMapCommon
PRIVATE
ngltools
PUBLIC
NGLLogger
Qt6::Core
)
NGL_TARGET_INCLUDE_DIRECTORIES(situationMapCommon
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/..
)
NGL_INSTALL_TARGET(situationMapCommon)
@@ -0,0 +1,93 @@
/**
**
** @RDE_HEADER@
** Implementation of Splines
** $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 .........:
**
** 19.06.2012, JT : Urversion for use in VIntel project
** 12.08.2015, JT : adapted to SituationMap
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <QtCore/QString>
namespace SituationMap
{
/**
\class Exception exception.h
\brief Basisklasse for Exception-Handling
The class Exception defines a very simple exception handler, that will be able to return
a string message when an exception is thrown
*/
class Exception
{
public:
Exception()
: _message(QLatin1String("Error"))
{}
Exception(const Exception &) = default;
explicit Exception(const QString &msg)
: _message(msg)
{}
// explicit is not used here because
// throw SituationMap::Exception(__FILE__, __LINE__, "Message" );
// will become more complicated
Exception(const char *Source
, unsigned int lineNo
, const char *msg)
: Exception(QLatin1String(Source), lineNo, QLatin1String(msg))
{}
Exception(const char *Source
, unsigned int lineNo
, const QString &msg)
: Exception(QLatin1String(Source), lineNo, msg)
{}
Exception(const QString &Source
, unsigned int lineNo
, const QString &msg)
: _message(QStringLiteral("\"%1\" in %2 at %3").arg(msg, Source).arg(lineNo))
{}
~Exception() = default;
Exception &operator = (const Exception &e) = default;
QString getMessage() const { return _message; } //!< returns a specific error message as QString
protected:
QString _message;
};
} // namespace SituationMap
@@ -0,0 +1,346 @@
/**
**
** @RDE_HEADER@
** Simple Id Handler
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Linux, Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** ??.??.1994, JT : First edition for use with Tcl/Tk in START Feature Editor fe
** 16.08.2004, JT : Refactoring for use in Geo-Map Library GeISiR
** 11.05.2015, JT : Refactoring for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#include "id_handler.h"
#include <typeinfo>
#include <NGLLogger/INGLLogger.h>
#include "referenced.h"
namespace SituationMap
{
const IdHandler::UniqueId IdHandler::BadId = static_cast<IdHandler::UniqueId>(-1);
bool IdHandler::isIdValid(const UniqueId &id) { return id != BadId; }
IdHandler::IdHandler(unsigned int maxItems, unsigned int blockS)
: _blockSize(blockS)
, _maxIds(maxItems)
, _freeIds(maxItems)
, _firstFree(BadId)
, _lastAlloc(BadId)
, _notify(getLogger("IdHandler"))
, _idVector()
{
} // IdHandler::IdHandler
IdHandler::~IdHandler()
{
if (!_idVector.isEmpty())
{
if (_lastAlloc != BadId)
{
for (UniqueId i = 0; i <= _lastAlloc; ++i)
_idVector[i] = nullptr;
}
_maxIds = 0;
_freeIds = 0;
_firstFree = BadId;
_lastAlloc = BadId;
}
} // IdHandler::~IdHandler
bool IdHandler::initMemHandler()
{
if (_idVector.empty())
{
_idVector.resize(_maxIds);
_freeIds = _maxIds;
_firstFree = 0;
_lastAlloc = BadId;
return false;
}
return true;
} // IdHandler::initMemHandler
void IdHandler::lookForNextFreeId()
{
++_firstFree;
while (_firstFree < _lastAlloc)
{
if (!_idVector[_firstFree]) break;
++_firstFree;
}
if (_firstFree >= _lastAlloc) _firstFree = _maxIds;
} //IdHandler::lookForNextFreeId
bool IdHandler::valid() const
{
return ((static_cast<quint32>(_idVector.size()) == _maxIds) && (_firstFree != BadId));
} // IdHandler::valid
unsigned int IdHandler::countReservedIds() const { return _maxIds; }
unsigned int IdHandler::countUsedIds() const { return _maxIds - _freeIds; }
unsigned int IdHandler::countFreeIds() const { return _freeIds; }
bool IdHandler::resize(quint32 maxItems)
{
if (initMemHandler())
{
if (maxItems > static_cast<quint32>(_idVector.size()))
{
_freeIds += maxItems - _maxIds;
_maxIds = maxItems;
_idVector.resize(_maxIds);
}
}
return (static_cast<quint32>(_idVector.size()) == _maxIds);
} // IdHandler::resize
IdHandler::UniqueId IdHandler::createId(AccessableId *idPtr)
{
initMemHandler();
UniqueId id((_lastAlloc == BadId) ? 0 : _lastAlloc + 1);
if (id < _maxIds)
{
_idVector[id] = idPtr;
_lastAlloc = id;
if (_firstFree == id) ++_firstFree;
}
else
{
if (_firstFree >= _maxIds)
{
resize(_maxIds + _blockSize);
if (id < _maxIds)
{
_idVector[id] = idPtr;
_lastAlloc = id;
if (_firstFree == id)
++_firstFree;
}
else
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< QStringLiteral("Id table overflow, object <%1> of type <%2>, reserved Ids %3")
.arg(reinterpret_cast<qulonglong>(idPtr), 0, 16)
.arg(QLatin1String(typeid(idPtr).name()))
.arg(_maxIds);
return BadId;
}
}
else
{
id = _firstFree;
_idVector[id] = idPtr;
lookForNextFreeId();
}
}
_freeIds--;
return (id);
} // IdHandler::createId
bool IdHandler::reserveId(UniqueId id, AccessableId *idPtr)
{
initMemHandler();
if (!valid())
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< QStringLiteral("IdHandler is not initialzed, object <%1> of type <%2> ")
.arg(reinterpret_cast<qulonglong>(idPtr), 0, 16)
.arg(QLatin1String(typeid(idPtr).name()));
return false;
}
if (id == BadId)
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< " Requested id is bad id <" << id << ">";
return false;
}
if (id >= _maxIds)
{
if (!resize((((id + 1) / _blockSize) + 1) * _blockSize))
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< QStringLiteral("Requested id is to large, id <%1> object <%2> of type <%3>.")
.arg(id)
.arg(reinterpret_cast<qulonglong>(idPtr), 0, 16)
.arg(QLatin1String(typeid(idPtr).name()));
return false;
}
}
if (_idVector[id])
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< QStringLiteral("Requested id is already in use, object <%1> of type <%2>.")
.arg(reinterpret_cast<qulonglong>(idPtr), 0, 16)
.arg(QLatin1String(typeid(idPtr).name()));
return false;
}
_idVector[id] = idPtr;
if ((_lastAlloc == BadId) || (id > _lastAlloc)) _lastAlloc = id;
if (id == _firstFree)
{
++_firstFree;
lookForNextFreeId();
}
_freeIds--;
return true;
} // IdHandler::reserveId
bool IdHandler::freeId(UniqueId id)
{
if (valid() && (_lastAlloc != BadId) && (id != BadId))
{
if (id <= _lastAlloc)
{
if (_idVector[id])
{
_idVector[id] = nullptr;
if (id < _firstFree) _firstFree = id;
if (id == _lastAlloc)
{
/* ---------------------------------------------------------
* Last allocated id is now free. Search new lastAlloc ...
* ---------------------------------------------------------- */
if (_lastAlloc > 0)
{
--_lastAlloc;
while (!_idVector[_lastAlloc])
{
if (_lastAlloc < 1)
{
_lastAlloc = BadId;
break;
}
else --_lastAlloc;
} // while
}
else _lastAlloc = BadId;
}
_freeIds++;
return true;
}
}
else
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< "Id is not in use, id <" << id << ">";
}
}
else
{
if (id != BadId)
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< "IdHandler is not initialzed.";
}
else
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< "Bad id, id <" << id << ">";
}
}
return false;
} // IdHandler::freeId
IdHandler::AccessableId *IdHandler::accessId(UniqueId id) const
{
if (valid())
{
if ((id != BadId) && (id <= _lastAlloc))
return _idVector[id].get();
else
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< "Bad id or id is not in use, id <" << id << ">";
#ifdef UseDebugBreaks
#ifdef WIN32
#ifdef _DEBUG
__asm int 3
#endif
#endif
#endif
}
}
else
{
ERROR_LOG(_notify)
<< LOGFUNCTION
<< "IdHandler is not initialzed";
}
return nullptr;
} // IdHandler::accessId
bool IdHandler::isIdInUse(UniqueId id) const
{
if (valid())
{
if ((id != BadId) && (id <= _lastAlloc))
return (_idVector[id].get() != nullptr);
}
return false;
} // IdHandler::isIdInUse
} // SituationMap
@@ -0,0 +1,120 @@
/**
**
** @RDE_HEADER@
** Simple Id Handler
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Linux, Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** ??.??.1994, JT : First edition for use with Tcl/Tk in START Feature Editor fe
** 16.08.2004, JT : Refactoring for use in Geo-Map Library GeISiR
** 11.05.2015, JT : Refactoring for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
//#include <Map/situation_map_types.h>
#include "referenced.h"
#include "ref_pointer.h"
#include "situation_map_logging.h"
#include "situation_map_common_export.h"
#include <QVector>
namespace SituationMap
{
/**
@class IdHandler id_handler.h
@brief Simple IdHandler to map id's to data pointers
IdHandler is a class to manage integer ids and map them to data pointers. The IdHandler stores
the data pointer in a vector container. The index of the data pointer in this vector is used as
id value. If the vector gets out of size new vector elements will be added automaticaly. This
will be done blockwises. The initial size of the vector and the block size can be set as
parameter of IdHandler ctor. The default values are 10000 for the initial vector size and 1000
for the block size.
*/
class SITUATIONMAPCOMMON_EXPORT IdHandler
{
public:
using AccessableId = Referenced;
using UniqueId = quint32; // see UniqueMapId @ situation_map_types.h
static const UniqueId BadId;
static bool isIdValid(const UniqueId &id); //!< Checks if the \c id is not a BadId
IdHandler(const IdHandler &) = delete;
IdHandler &operator = (const IdHandler &) = delete;
/**
@brief Construction of IdHandler
Initialize IdHandler instances. The vector container to store data pointers is
reserved with \c maxItems. If the vector gets out of size new vector elements
will be added automaticaly
@param maxItems Initial size of the vector container to store the data pointer.
@param blockS Block size is used when the vector container will be extended.
*/
IdHandler(unsigned int maxItems = 10000, unsigned int blockS = 1000);
/**
@brief Destruction of IdHandler
*/
virtual ~IdHandler();
bool valid() const; //!< Checks if IdHandler is valid
quint32 countReservedIds() const; //!< Returns count of reserved ids.
quint32 countUsedIds() const; //!< Returns count of used ids.
quint32 countFreeIds() const; //!< Returnes count of free ids
bool resize(quint32 maxItems); //!< Resize idMem to store now maxItems ids. Returns true on success.
UniqueId createId(AccessableId *); //!< Create new \c id and returns this new id.
bool reserveId(UniqueId id, AccessableId *); //!< Reserve \c id if the id is unused. Returns true if \c id is not already in use and reservation of \c id is successful elsewise false.
bool freeId(UniqueId id); //!< Frees \c id. Returns true on success elsewise false.
AccessableId *accessId(UniqueId id) const; //!< Returns pointer to object for \c id. Returns pointer on success elsewise \c nullptr.
bool isIdInUse(UniqueId id) const; //!< Checks if a id is already in use.
protected:
quint32 _blockSize;
quint32 _maxIds;
quint32 _freeIds;
UniqueId _firstFree;
UniqueId _lastAlloc;
LOGGER_T _notify;
mutable QVector<RefPointer<AccessableId>> _idVector;
private:
bool initMemHandler();
void lookForNextFreeId();
}; /* IdHandler */
} /* SituationMap */
@@ -0,0 +1,226 @@
/**
**
** @RDE_HEADER@
** Base class for reference counted objects
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Umgebung: Intel-PC
** Software-Umgebung: Linux, Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Pgrm-Sprache ....: C++ 11
**
** HIER/SACHN ......: P: -- ---- - --- QE
**
** Version .........: $Revision$
** -----------------------------------------------------------------------------------------------
**
** Autor ...........: Nikolaus Hanekamp, SEDG, Tel. 2906
**
** -----------------------------------------------------------------------------------------------
**
** Notizen .........:
**
** 18.08.2004, NH : Urversion
** 13.05.2015, JT : Refactoring for use with Qt5, ArcGIS 10.2.5
** adding methodes according to std::share_ptr like reset
**
** -----------------------------------------------------------------------------------------------
**
** Copyright (C) 2004 Rheinmetall Defence Electronics GmbH, D-28309 BREMEN
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include "referenced.h"
namespace SituationMap
{
/**
@class RefPointer ref_pointer.h
@brief Smart pointer for handling referenced counted objects
Simple class template to implement reference counted pointers or smart pointers. The RefPointer class controls the
reference counter of the object \c T the pointer points to. The class \c T have to be derived from class \c Referenced,
where the reference counter member variable is located. In case of this reference counter gets zero delete will be called
automatically.
@see Referenced
*/
template<class T> class RefPointer
{
public:
using ElementType = T;
/**
@name Construction and Destruction
@{
*/
RefPointer() : RefPointer(nullptr) {}
RefPointer(const RefPointer &rp) : RefPointer(rp._ptr) {}
explicit RefPointer(ElementType *t)
: _ptr(t)
{
static_assert(std::is_base_of<Referenced, T>::value
, "Class of template SituationMap::RefPointer have to be derived from class SituationMap::Referenced");
if (_ptr) _ptr->ref();
} /* RefPointer */
~RefPointer()
{
if (_ptr) _ptr->unref();
_ptr = nullptr;
} /* ~RefPointer */
/** @} */
/**
Checks if pointer is valid.
*/
explicit inline operator bool() const { return (_ptr != nullptr); }
/**
@name Casting
@{
*/
/**
To create reference pointer from a derived class directly this contructor template can be used.
How to use it is shown in the following example:
\code
RefPointer<AbstractMapObject> objPtr = getAbstractMapObject();
RefPointer<Participant> participantObj( objPtr );
if (participantObj != NULL)
{
...
}
\endcode
Alternatively it is posible to create \b participantObj from example above as follows:
\code
RefPointer<Participant> participantObj = RefPointer<Participant>(dynamic_cast<Participant*>(objPtr.get()));
\endcode
*/
template<class Y> explicit RefPointer(RefPointer<Y> assignPtr)
{
_ptr = dynamic_cast<T *>(assignPtr.get());
if (_ptr) _ptr->ref();
}
template<class Y> explicit RefPointer(Y *assignPtr)
{
_ptr = dynamic_cast<T *>(assignPtr);
if (_ptr) _ptr->ref();
}
/** @} */
inline RefPointer &operator = (const RefPointer &rp)
{
if (_ptr == rp._ptr) return *this;
T *tmp_ptr = _ptr;
_ptr = rp._ptr;
if (_ptr) _ptr->ref();
// unref second to prevent any deletion of any object which might
// be referenced by the other object. i.e rp is child of the
// original _ptr.
if (tmp_ptr) tmp_ptr->unref();
return *this;
}
inline RefPointer &operator = (ElementType *ptr)
{
if (_ptr == ptr) return *this;
T *tmp_ptr = _ptr;
_ptr = ptr;
if (_ptr) _ptr->ref();
// unref second to prevent any deletion of any object which might
// be referenced by the other object. i.e rp is child of the
// original _ptr.
if (tmp_ptr) tmp_ptr->unref();
return *this;
}
inline void reset() { *this = nullptr; }
inline void reset(T *ptr) { *this = ptr; }
/**
@name Comparison Operators
Compares the pointer element \c _ptr with other pointers.
@{
*/
inline bool operator == (const RefPointer &rp) const { return (_ptr == rp._ptr); }
inline bool operator != (const RefPointer &rp) const { return (_ptr != rp._ptr); }
inline bool operator < (const RefPointer &rp) const { return (_ptr < rp._ptr); }
inline bool operator > (const RefPointer &rp) const { return (_ptr > rp._ptr); }
inline bool operator == (const ElementType *ptr) const { return (_ptr == ptr); }
inline bool operator != (const ElementType *ptr) const { return (_ptr != ptr); }
inline bool operator < (const ElementType *ptr) const { return (_ptr < ptr); }
inline bool operator > (const ElementType *ptr) const { return (_ptr > ptr); }
/** @} */
/**
@name Access Operators
Get access to the pointer or the object it points to.
@{
*/
inline ElementType &operator*() { return *_ptr; }
inline const ElementType &operator*() const { return *_ptr; }
inline ElementType *operator->() { return _ptr; }
inline const ElementType *operator->() const { return _ptr; }
inline ElementType *get() { return _ptr; }
inline const ElementType *get() const { return _ptr; }
/** @} */
/**
@name Checks if the pointer is valid.
@{
*/
inline bool valid() const { return _ptr != nullptr; }
inline bool operator!() const { return _ptr == nullptr; }
/** @} */
/**
* @name Control Over Object Pointer
* Take control over the object pointed to by RefPointer, unreference but do not delete even if ref count goes to 0,
* return the pointer to the object.
* Note, do not use this unless you are 100% sure your code handles the deletion of the object correctly, and
* only use when absolutely required.
@{
*/
inline ElementType *take() { return release();}
inline ElementType *release() { T *tmp = _ptr; if (_ptr) _ptr->unref_nodelete(); _ptr = nullptr; return tmp;}
/** @} */
private:
ElementType *_ptr;
};
} // SituationMap
@@ -0,0 +1,76 @@
/**
**
** @RDE_HEADER@
** Base class for reference counted objects
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Umgebung: Intel-PC
** Software-Umgebung: Linux, Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Pgrm-Sprache ....: C++ 11
**
** HIER/SACHN ......: P: -- ---- - --- QE
**
** Version .........: $Revision$
** -----------------------------------------------------------------------------------------------
**
** Autor ...........: Nikolaus Hanekamp, SEDG, Tel. 2906
** Joerg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notizen .........:
**
** 18.08.2004, NH : Urversion
** 13.05.2015, JT : Refactoring for use with Qt5, ArcGIS 10.2.5
**
** -----------------------------------------------------------------------------------------------
*/
#include "referenced.h"
#include <QDebug>
#include <typeinfo>
#include <memory>
namespace SituationMap
{
std::shared_ptr<DeleteHandler> & s_deleteHandler()
{
static std::shared_ptr<DeleteHandler> deleteHandler(nullptr);
return deleteHandler;
} // std::shared_ptr<DeleteHandler> & s_deleteHandler()
void Referenced::setDeleteHandler(DeleteHandler *handler)
{
s_deleteHandler().reset(handler);
} // Referenced::setDeleteHandler
DeleteHandler *Referenced::getDeleteHandler() { return s_deleteHandler().get(); }
Referenced::~Referenced()
{
if (_refCount > 0)
{
qCritical() << "Deleting still referenced object < " << QString::number((qint64)this, 0, 16) << ">"
<< "of type <" << typeid(this).name() << ">"
<< "refCnt: <" << _refCount;
}
} // Referenced::~Referenced
} // end of namespace SituationMap
@@ -0,0 +1,157 @@
/**
**
** @RDE_HEADER@
** Base class for reference counted objects
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Umgebung: Intel-PC
** Software-Umgebung: Linux, Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Pgrm-Sprache ....: C++ 11
**
** HIER/SACHN ......: P: -- ---- - --- QE
**
** Version .........: $Revision$
** -----------------------------------------------------------------------------------------------
**
** Autor ...........: Nikolaus Hanekamp, SEDG, Tel. 2906
** Joerg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notizen .........:
**
** 18.08.2004, NH : Urversion
** 13.05.2015, JT : Refactoring for use with Qt5, ArcGIS 10.2.5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include "situation_map_common_export.h"
namespace SituationMap
{
// forward declar, declared after Refenced below.
class DeleteHandler;
/**
@class Referenced referenced.h
@brief Base class for referenced counted object classes
Base class from providing referencing counted objects. Objects from type "Referenced" should
be used in combination with the class "RefPointer" for memory handling. In this case calling
delete direcly for those objects will result in an error at runtime. Unfortunately there is
no way to check this at compile time - to declare delete operator protected does not work.
@sa RefPointer
*/
class SITUATIONMAPCOMMON_EXPORT Referenced
{
public:
/**
@name Construction
@{
*/
Referenced() { _refCount = 0; }
Referenced(const Referenced &) { _refCount = 0; }
/** @} */
/**
Assign operator has to do nothing because is is permitted to change _refCount during assignment operation.
*/
inline Referenced &operator = (const Referenced &) { return *this; }
friend class DeleteHandler;
/** Set a DeleteHandler to which deletion of all referenced counted objects
* will be delegated to.*/
static void setDeleteHandler(DeleteHandler *handler);
/** Get a DeleteHandler.*/
static DeleteHandler *getDeleteHandler();
/** Increment the reference count by one, indicating that
this object has another pointer which is referencing it.*/
inline void ref() const { ++_refCount; }
/** Decrement the reference count by one, indicating that
a pointer to this object is referencing it. If the
reference count goes to zero, it is assumed that this object
is no longer referenced and is automatically deleted.*/
inline void unref() const;
/** Decrement the reference count by one, indicating that
a pointer to this object is referencing it. However, do
not delete it, even if ref count goes to 0. Warning, unref_nodelete()
should only be called if the user knows exactly who will
be resonsible for, one should prefer unref() over unref_nodelete()
as the later can lead to memory leaks.*/
inline void unref_nodelete() const { --_refCount; }
/** Return the number pointers currently referencing this object. */
inline int referenceCount() const { return _refCount; }
protected:
/**
Declaration of destructor is protected because only methode unref() or the delete
handler itself are allowed to destroy referenced objects.
*/
virtual ~Referenced();
mutable int _refCount;
};
/** Class for override the default delete behavior so that users can implement their own object
* deletion schemes. This might be done to help implement protection of multiple threads from deleting
* objects unintentionally.
* Note, the DeleteHandler cannot itself be reference counted, otherwise it
* would be responsible for deleting itself!
* An static auto_ptr<> is used internally in Referenced.cpp to manage the
* DeleteHandler's memory.*/
class SITUATIONMAPCOMMON_EXPORT DeleteHandler
{
public:
DeleteHandler() = default;
virtual ~DeleteHandler() = default;
/** Flush any cache of objects that need to be deleted by doing an actual delete.*/
virtual void flush() {}
static inline void doDelete(const Referenced *object) { delete object; }
/** Request the deletion of an object.
* Depending on users implementation of DeleteHandler, the delete of the object may occur
* straight away or be delayed until doDelete is called.
* The default implementation does a delete straight away.*/
virtual void requestDelete(const Referenced *object) { doDelete(object); }
}; /* DeleteHandler */
inline void Referenced::unref() const
{
--_refCount;
if (_refCount == 0)
{
if (getDeleteHandler()) getDeleteHandler()->requestDelete(this);
else delete this;
}
else if (_refCount < 0)
throw 2325;
} /* Referenced::unref */
} // SituationMap
@@ -0,0 +1,51 @@
/**
* @RDE_HEADER@
* Helper function to get the resource path
* $Id$
* $HeadURL$
* $Author$
*/
#include "resource_path.h"
#include <ngltools/ngltools_filesystem.h> // for NGL::directories
// Qt
#include <QDir>
#include <QVector>
//----------------------------------------------------------------------------
namespace SituationMap
{
QString getResourcePath()
{
const QString resDir = NGL::directory(NGL::FileType::ConfigFile, QLatin1String("resources"));
if (!resDir.isEmpty())
return resDir;
QVector<QString> pathsToSearch;
// for old systems
#ifdef Q_OS_WIN
pathsToSearch += QLatin1String("C:/ExtFw/resources/");
#else
pathsToSearch += QLatin1String("/usr/share/arcgis/resources");
#endif
for (const QString &path : qAsConst(pathsToSearch))
{
if (QDir(path).exists())
return path + QLatin1Char('/');
}
return QString();
}
} // namespace SituationMap
@@ -0,0 +1,24 @@
/**
* @RDE_HEADER@
* Helper function to get the resource path
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "situation_map_common_export.h"
// Qt
#include <QString>
//----------------------------------------------------------------------------
namespace SituationMap
{
QString SITUATIONMAPCOMMON_EXPORT getResourcePath();
} // namespace SituationMap
@@ -0,0 +1,96 @@
/**
* @RDE_HEADER@
* Helper class for storing a simple value and an implizit changed flag
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Qt
#include <sstream>
//----------------------------------------------------------------------------
namespace SituationMap
{
/*! \class SimpleValue
\brief Simple storing fo values
*/
template <class TYPE> class SimpleValue
{
protected:
TYPE m_value = TYPE(); // '{}' to initialize the member (and avoid unconditional jumps@valgrind)
bool m_changed = true;
public:
SimpleValue() = default;
// cppcheck-suppress noExplicitConstructor
SimpleValue(const TYPE &value) // should not be declared explicit to avoid additional writing stuff to cast values
: m_value(value)
{}
SimpleValue<TYPE> &operator=(const TYPE &newValue)
{
if (this->m_value != newValue)
{
this->m_value = newValue;
m_changed = true;
}
return *this;
}
const TYPE &operator()() const
{
return this->m_value;
}
const TYPE &value() const
{
return this->m_value;
}
TYPE &refValue()
{
m_changed = true;
return this->m_value;
}
const TYPE &refValue() const
{
return this->m_value;
}
bool changed() const
{
return m_changed;
}
void reset()
{
m_changed = false;
}
void setChanged()
{
m_changed = true;
}
friend std::ostream &operator<<(std::ostream &stream,
const SimpleValue &simpleVal)
{
stream << simpleVal.value();
return stream;
}
};
} // namespace SituationMap
@@ -0,0 +1,21 @@
/**
* Export definitions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <qglobal.h>
#ifndef SITUATIONMAPCOMMON_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define SITUATIONMAPCOMMON_EXPORT
# else
# if defined(MAKE_SITUATIONMAPCOMMON_LIB)
# define SITUATIONMAPCOMMON_EXPORT Q_DECL_EXPORT
# else
# define SITUATIONMAPCOMMON_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
@@ -0,0 +1,51 @@
/**
* @RDE_HEADER@
* Logging within SituationMap
* $Id$
* $HeadURL$
* $Author$
*/
#include "situation_map_logging.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QUuid>
namespace SituationMap
{
LOGGER_T getLogger(const char *name, int id)
{
static const QLatin1String prefix("SituationMap.");
std::string loggerName;
const size_t len = strlen(name);
loggerName.reserve(prefix.size() + len);
loggerName.append(prefix.data(), prefix.size());
loggerName.append(name, len);
if (id > 0)
{
std::stringstream loggerStream;
loggerStream << loggerName << "." << id;
loggerName = loggerStream.str();
}
try
{
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
getNGLLogger(loggerName);
}
catch (const std::exception &ex)
{
fprintf(stderr, "Error retrieving logger: %s", ex.what());
abort();
}
}
} // namespace SituationMap
std::ostream &operator<< (std::ostream &stream,
const QUuid &value)
{
stream << "QUuid(" << value.toString() << ")";
return stream;
}
@@ -0,0 +1,38 @@
/**
* @RDE_HEADER@
* Logging within SituationMap
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <NGLLogger/INGLLogger.h>
#include "situation_map_common_export.h"
class QUuid;
namespace SituationMap
{
using LOGGER_T = NGL::INGLLogger&;
// export for executables within 'Tests'
LOGGER_T SITUATIONMAPCOMMON_EXPORT getLogger(const char *name, int id = -1);
} // namespace SituationMap
SITUATIONMAPCOMMON_EXPORT std::ostream &operator<< (std::ostream &stream,
const QUuid &value);
@@ -0,0 +1,120 @@
#
# $Id$
# $HeadURL$
# $Author$
#
# LIBRARY
SET(Symbology_SRCS
sidc_codec.cpp
symbol_dictionary.cpp
property_result.cpp
symbol_data_to_render.cpp
symbol_result.cpp
symbol_properties.cpp
sidc_definitions.cpp
sidc_builder_base.cpp
sidc_builder.cpp
# sidc2525_delta.cpp
)
SET(Symbology_HDRS
advanced_symbology_export.h
bulk_renderer.h
symbology_type.h
symbol_dictionary_types.h
symbol_dictionary.h
property_result.h
symbol_data_to_render.h
symbol_result.h
symbol_properties.h
sidc_codec.h
sidc_definitions.h
sidc_builder_base.h
sidc_builder.h
# sidc2525_delta.h
result_watcher.h
)
SET(SymbologyImpl_SRCS
../SymbologyImpl/advanced_symbology_logging.cpp
../SymbologyImpl/symbol_extension_renderer.cpp
../SymbologyImpl/symbol_dictionary_impl.cpp
../SymbologyImpl/esri_dictionary_processor.cpp
../SymbologyImpl/esri_dictionary_processor_mil2525d.cpp
../SymbologyImpl/esri_dictionary_processor_app6.cpp
../SymbologyImpl/esri_dictionary_processor_app6d.cpp
../SymbologyImpl/base_symbol_model.cpp
)
SET(SymbologyImpl_HDRS
../SymbologyImpl/advanced_symbology_logging.h
../SymbologyImpl/symbol_extension_renderer.h
../SymbologyImpl/symbol_dictionary_impl.h
../SymbologyImpl/esri_dictionary_processor.h
../SymbologyImpl/esri_dictionary_processor_mil2525d.h
../SymbologyImpl/esri_dictionary_processor_app6.h
../SymbologyImpl/esri_dictionary_processor_app6d.h
../SymbologyImpl/base_symbol_model.h
)
QT6_ADD_RESOURCES(Symbology_SRCS ../SymbologyImpl/Resources/symbols.qrc)
SOURCE_GROUP(Symbology FILES ${Symbology_SRCS} ${Symbology_HDRS} ${SymbologyImpl_SRCS} ${SymbologyImpl_HDRS})
NGL_ADD_LIBRARY(WS advancedSymbology SHARED ${Symbology_SRCS} ${Symbology_HDRS} ${SymbologyImpl_SRCS} ${SymbologyImpl_HDRS})
NGL_TARGET_INCLUDE_DIRECTORIES(advancedSymbology
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/..
)
NGL_TARGET_LINK_LIBRARIES(advancedSymbology
PRIVATE
# ArcGIS::ArcGIS - not available in Qt6 migration
Qt6::Concurrent
ngltools # DTG
situationMapCommon
LtsDataView
LtsSessionData
LtsUtilsCoreHeaderOnly
PUBLIC
advancedSymbologyXML
NGLLogger
Qt6::Core
Qt6::Widgets
)
IF(BUILD_TESTING AND BUILD_SITMAP_UNIT_TESTS AND TARGET situationMapCommon)
NGL_ADD_LIBRARY(WS NO_TRANSLATION advancedSymbology_static STATIC ${Symbology_SRCS} ${Symbology_HDRS} ${SymbologyImpl_SRCS} ${SymbologyImpl_HDRS})
NGL_TARGET_COMPILE_DEFINITIONS(advancedSymbology_static PUBLIC "ADVANCED_SYMBOLOGY_EXPORT=")
NGL_TARGET_INCLUDE_DIRECTORIES(advancedSymbology_static
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/..
# INTERFACE
# ${CMAKE_CURRENT_SOURCE_DIR}
)
NGL_TARGET_LINK_LIBRARIES(advancedSymbology_static
PRIVATE
NGLLogger
# ArcGIS::ArcGIS - not available in Qt6 migration
Qt6::Concurrent
PUBLIC
advancedSymbologyXML
Qt6::Core
Qt6::Widgets
LtsDataView
LtsSessionData
LtsUtilsCoreHeaderOnly
)
ENDIF()
NGL_INSTALL_TARGET(advancedSymbology)
@@ -0,0 +1,21 @@
/**
* Export definitions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <qglobal.h>
#ifndef ADVANCED_SYMBOLOGY_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define ADVANCED_SYMBOLOGY_EXPORT
# else
# if defined(MAKE_ADVANCEDSYMBOLOGY_LIB)
# define ADVANCED_SYMBOLOGY_EXPORT Q_DECL_EXPORT
# else
# define ADVANCED_SYMBOLOGY_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
@@ -0,0 +1,225 @@
/**
* @RDE_HEADER@
* BulkRenderer
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "symbol_dictionary.h"
#include "symbol_result.h"
// Qt
#include <QSharedPointer>
#include <QVector>
#include <QString>
// Forward
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
//----------------------------------------------------------------------------
class ADVANCED_SYMBOLOGY_EXPORT BulkRendererBase : public QObject
{
Q_OBJECT
public:
BulkRendererBase() = default;
virtual ~BulkRendererBase() = default;
public Q_SLOTS:
void onSingleResultReady()
{
++m_resultReadyCounter;
if (m_resultReadyCounter >= m_requestCount)
emit resultsReady();
}
Q_SIGNALS:
/// Signal emits when all results are ready
void resultsReady();
protected:
uint m_resultReadyCounter = 0;
uint m_requestCount = 0;
};
//----------------------------------------------------------------------------
template<class INPUT_TYPE>
class BulkRenderer : public BulkRendererBase
{
public:
using RequestResult = QPair<INPUT_TYPE, QSharedPointer<SymbolResultWatcher>>;
using RequestResultVector = QVector<RequestResult>;
explicit BulkRenderer(SymbologyType symbologyType)
: m_symbologyType(symbologyType)
{}
virtual ~BulkRenderer() = default;
void addRequest(const INPUT_TYPE &request)
{
m_requestResultVector.append(RequestResult(request, QSharedPointer<AdvancedSymbology::SymbolResultWatcher>(new AdvancedSymbology::SymbolResultWatcher(this))));
}
int size() { return m_requestResultVector.size(); }
virtual void run() = 0;
void cancel()
{
for (RequestResult &requestResult : m_requestResultVector)
{
QSharedPointer<SymbolResultWatcher> watcher = requestResult.second;
if (watcher)
watcher->cancel();
} // for
}
void reset()
{
// will destroy the associated SymbolResults if the shdPtr has last reference.
// In that case waitForFinished will be called.
m_requestResultVector.clear();
// to be complete:
m_resultReadyCounter = 0;
m_requestCount = 0;
}
const RequestResultVector &results() const
{
return m_requestResultVector;
}
QSharedPointer<SymbolResultWatcher> getResult(const INPUT_TYPE &request)
{
for (const RequestResult &requestResult : m_requestResultVector)
{
if (requestResult.first == request)
return requestResult.second;
}
return nullptr;
}
protected:
void setupWatcher()
{
m_resultReadyCounter = 0;
m_requestCount = m_requestResultVector.size();
// start every single render request:
for (RequestResult &requestResult : m_requestResultVector)
{
// requestResult.second =
// QSharedPointer<SymbolResultWatcher> (new SymbolResultWatcher());
connect(requestResult.second.data(), &SymbolResultWatcher::resultReady,
this, &BulkRendererBase::onSingleResultReady, Qt::QueuedConnection);
} // for
}
protected:
SymbologyType m_symbologyType = SymbologyType::None;
RequestResultVector m_requestResultVector;
};
//----------------------------------------------------------------------------
class ADVANCED_SYMBOLOGY_EXPORT BulkRendererFindImage : public BulkRenderer<SymbolDataToRender>
{
public:
explicit BulkRendererFindImage(SymbologyType symbologyType)
: BulkRenderer<SymbolDataToRender>(symbologyType)
{}
virtual ~BulkRendererFindImage() = default;
void run() override
{
setupWatcher();
const SymbolDictionary &dict = SymbolDictionary::dictionary(m_symbologyType);
// start every single render request:
for (RequestResult &requestResult : m_requestResultVector)
{
// 1st
const SymbolDataToRender &input = requestResult.first;
// 2nd
QSharedPointer<SymbolResultWatcher> watcher = requestResult.second;
if (watcher)
watcher->setSymbolResult(dict.findImage(input));
} // for
}
};
//----------------------------------------------------------------------------
class ADVANCED_SYMBOLOGY_EXPORT BulkRendererFindBaseSymbol : public BulkRenderer<QString>
{
public:
explicit BulkRendererFindBaseSymbol(SymbologyType symbologyType)
: BulkRenderer<QString>(symbologyType)
{}
virtual ~BulkRendererFindBaseSymbol() = default;
void run() override
{
setupWatcher();
const SymbolDictionary &dict = SymbolDictionary::dictionary(m_symbologyType);
// start every single render request:
for (RequestResult &requestResult : m_requestResultVector)
{
// 1st
const QString &input = requestResult.first;
// 2nd
QSharedPointer<SymbolResultWatcher> watcher = requestResult.second;
if (watcher)
watcher->setSymbolResult(dict.findBaseSymbol(input));
} // for
}
};
//----------------------------------------------------------------------------
class ADVANCED_SYMBOLOGY_EXPORT BulkRendererFindPreview : public BulkRenderer<QString>
{
public:
explicit BulkRendererFindPreview(SymbologyType symbologyType)
: BulkRenderer<QString>(symbologyType)
{}
void run() override
{
setupWatcher();
const SymbolDictionary &dict = SymbolDictionary::dictionary(m_symbologyType);
// start every single render request:
for (RequestResult &requestResult : m_requestResultVector)
{
// 1st
const QString &input = requestResult.first;
// 2nd
QSharedPointer<SymbolResultWatcher> watcher = requestResult.second;
if (watcher)
watcher->setSymbolResult(dict.findPreview(input));
} // for
}
};
} // namespace AdvancedSymbology
@@ -0,0 +1,129 @@
/**
* @RDE_HEADER@
* Class PropertyResult
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "property_result.h"
// Qt
#include <QUuid>
namespace AdvancedSymbology
{
class PropertyResult::Private
{
public:
Private() = default;
~Private() = default;
// Input data:
// process data:
QUuid m_taskIdFindSymbol; // of esriDict::findSymbol
// Result data:
bool m_resultReady = false;
SymbolPropertyList m_symbolPropertyList;
// For debugging:
static unsigned long m_counter;
};
unsigned long PropertyResult::Private::m_counter = 0;
PropertyResult::PropertyResult()
: QObject()
, d(new Private)
, m_logger(getLogger("PropertyResult"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, m_counter=" << d->m_counter;
++d->m_counter;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, m_counter=" << d->m_counter;
}
PropertyResult::~PropertyResult()
{
LOGGER_T m_logger = getLogger("PropertyResult");
TRACE_LOG(m_logger) << LOGFUNCTION << " START, m_counter=" << d->m_counter;
--d->m_counter;
delete d;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, m_counter=" << Private::m_counter;
}
void PropertyResult::fireResultReady()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
// (this bool don`t has to be reset.
// a new request will return a new instance of this class...)
d->m_resultReady = true;
emit resultReadyInternal();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
void PropertyResult::setTaskId(const QUuid &uuid)
{
d->m_taskIdFindSymbol = uuid;
}
const QUuid &PropertyResult::taskId() const
{
return d->m_taskIdFindSymbol;
}
void PropertyResult::setProperties(const SymbolPropertyList &properties)
{
d->m_symbolPropertyList = properties;
}
bool PropertyResult::isResultReady() const
{
return d->m_resultReady;
}
SymbolPropertyList PropertyResult::properties() const
{
return d->m_symbolPropertyList;
}
//------------------------------------------------------------------------------
// PropertyResultWatcher
//------------------------------------------------------------------------------
PropertyResultWatcher::PropertyResultWatcher(QObject *parent)
: BaseClass(parent)
, m_logger(getLogger("PropertyResultWatcher"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
QSharedPointer<PropertyResult> PropertyResultWatcher::propertyResult() const
{
return BaseClass::result();
}
void PropertyResultWatcher::setPropertyResult(const QSharedPointer<PropertyResult> &propertyResult)
{
BaseClass::setResult(propertyResult);
}
} // namespace AdvancedSymbology
@@ -0,0 +1,137 @@
/**
* @RDE_HEADER@
* Class PropertyResult
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include "symbol_properties.h"
#include "result_watcher.h"
#include <SymbologyImpl/advanced_symbology_logging.h>
// Qt
#include <QObject>
// forward
class QUuid;
//----------------------------------------------------------------------------
/**
* Store PropertyResult
*/
namespace AdvancedSymbology
{
using SymbolPropertyList = QList<SymbolProperties>;
/**
* @brief The PropertyResult class
*/
/**
* @brief The PropertyResult class mainly contains a SymbolPropertyList.
* It´s based on the future pattern. So the real result can only be retrieved if
* the asynchron operation has finished (and the result is ready).
* To standardize this you should use a propper watcher: PropertyResultWatcher.
*
* \sa \ref secResultWatcherExample
*/
class ADVANCED_SYMBOLOGY_EXPORT PropertyResult : public QObject
{
Q_OBJECT
/*! \name Construction, Destruction */
//@{
public:
///< Constructor
explicit PropertyResult();
///< Destructor
virtual ~PropertyResult();
//@}
/*! \name Data regarding requested */
//@{
//@}
/*! \name Data regarding processing*/
//@{
/**
* @brief taskId internal taskId
* @return internal taskId
*/
const QUuid &taskId() const;
/*! \name Data regarding result*/
//@{
/**
* @brief Get SymbolPropertyList
* @return SymbolPropertyList
*/
SymbolPropertyList properties() const;
//@}
Q_SIGNALS:
/// This signal is for internal usage only. Use PropertyResultWatcher!
void resultReadyInternal();
protected:
friend class SymbolDictionaryImpl;
void fireResultReady();
friend class ResultWatcher<PropertyResult>;
bool isResultReady() const;
void setTaskId(const QUuid &uuid);
void setProperties(const SymbolPropertyList &properties);
private:
class Private;
/**
* The private d->pointer to not break BC when changing internals of this class
*/
Private *d = nullptr;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
//------------------------------------------------------------------------------
/**
* @brief The PropertyResultWatcher class takes one PropertyResult using setPropertyResult.
* If the background operation has finished, the signal resultReady is emitted exactly one time.
*
* \sa \ref secResultWatcherExample
*/
class ADVANCED_SYMBOLOGY_EXPORT PropertyResultWatcher : public ResultWatcher<PropertyResult>
{
Q_OBJECT
using BaseClass = ResultWatcher<PropertyResult>;
public:
///< Constructor
explicit PropertyResultWatcher(QObject *parent = nullptr);
///< Destructor
~PropertyResultWatcher() = default;
QSharedPointer<PropertyResult> propertyResult() const;
void setPropertyResult(const QSharedPointer<PropertyResult> &propertyResult);
protected:
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
} // namespace AdvancedSymbology
@@ -0,0 +1,170 @@
/**
* @RDE_HEADER@
* Class ResultWatcherBase, ResultWatcher
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include <SymbologyImpl/advanced_symbology_logging.h>
// Qt
#include <QObject>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
//----------------------------------------------------------------------------
// - ResultWatcherBase (containing the Q_OBJECT for signal/slot)
// - ResultWatcher (containing template)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// ResultWatcherBase (containing the Q_OBJECT for signal/slot)
//----------------------------------------------------------------------------
/**
* @brief The ResultWatcherBase class is a simple base class of ResultWatcher
* and contain the signal resultReady, since a template class can`t.
*/
class ADVANCED_SYMBOLOGY_EXPORT ResultWatcherBase : public QObject
{
Q_OBJECT
public:
///< Constructor
explicit ResultWatcherBase(QObject *parent = nullptr)
: QObject(parent)
{}
///< Destructor
~ResultWatcherBase() = default;
Q_SIGNALS:
/// Signal emits when result is ready
void resultReady();
protected Q_SLOTS:
void onResultReadyInternal()
{
// to avoid emitting signal twice:
if (! m_alreadyEmitted)
emit resultReady();
m_alreadyEmitted = true;
}
protected:
bool m_alreadyEmitted = false;
};
//----------------------------------------------------------------------------
// ResultWatcher (containing template)
//----------------------------------------------------------------------------
/**
* @brief The ResultWatcher class takes a result and will emit resultReady exactly one time.
*
* \section secResultWatcherExample Using the ResultWatcher
* Here is an example of using the ResultWatcher
*
* \code
* AdvancedSymbology::SymbolDictionary &dict = AdvancedSymbology::SymbolDictionary::dictionary(AdvancedSymbology::MIL2525D);
*
* AdvancedSymbology::SymbolResultWatcher symbolResultWatcher;
*
* // FIRST connect:
* connect(&symbolResultWatcher, &AdvancedSymbology::SymbolResultWatcher::resultReady, this, [](){
*
* QSharedPointer<AdvancedSymbology::SymbolResult> symResult = symbolResultWatcher.symbolResult();
* if (! symResult)
* return; // should NEVER happen! (Which object should have triggered the signal???)
*
* if (this->m_targetObject)
* {
* this->m_targetObject->setImage(symResult->symbolImage().image());
* }
* });
*
* // SECOND setResult (starting the asynchronous operation)
* symbolResultWatcher.setSymbolResult( dict.findSymbol("mySidc") );
* \endcode
*
* There is an convenience class: SymbolResultWatcherComboxBox
*
* @note
* Template classes can not contain signals why this is moved to the base class ResultWatcherBase.
*
*/
template <typename RESULT_TYPE>
class ResultWatcher : public ResultWatcherBase
{
public:
///< Constructor
explicit ResultWatcher(QObject *parent = nullptr)
: ResultWatcherBase(parent)
{}
///< Destructor
virtual ~ResultWatcher() = default;
bool resultIsValid() const
{
return ! m_result.isNull();
}
void cancel()
{
m_result.clear();
}
protected:
QSharedPointer<RESULT_TYPE> result() const
{
return m_result;
}
void setResult(const QSharedPointer<RESULT_TYPE> &result)
{
// 2017-11-13, N.Thoden :
// With rev 36928 the SymbolResult of two identical request (identical SymbolDataToRender)
// will shared ONE SymbolResult!
// This szenario happens while showing a snapshot.
// So we have to disconnect explicitly:
// make sure, that we won`t be called by the 'old' object:
// so disconnect:
if (m_result)
m_result->disconnect(this);
// : 2017-11-13, N.Thoden
m_result = result;
m_alreadyEmitted = false;
if (m_result)
{
// Handle race condition:
// 1. connect
connect(m_result.data(), &RESULT_TYPE::resultReadyInternal, this, &ResultWatcher::onResultReadyInternal);
// 2. maybe result was ready before?
if (m_result->isResultReady())
onResultReadyInternal();
}
}
QSharedPointer<RESULT_TYPE> m_result;
};
} // namespace AdvancedSymbology
@@ -0,0 +1,479 @@
/**
* @RDE_HEADER@
* Class SidcBuilder
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "sidc_builder.h"
#include "sidc_codec.h"
// 1234567890
qint32 AdvancedSymbology::SidcBuilder::_smallest = 1000000000;
qint32 AdvancedSymbology::SidcBuilder::_specialPartA = 1001980000;
qint32 AdvancedSymbology::SidcBuilder::_invalidPartB = 1000000000;
qint32 AdvancedSymbology::SidcBuilder::_retiredPartB = 1100000000;
namespace AdvancedSymbology
{
//-----------------------------------------------------------------------------
// SidcBuilder
//-----------------------------------------------------------------------------
SidcBuilder::SidcBuilder(AdvancedSymbology::SymbolDictionary *symbolDictionary)
: SidcBuilderBase(symbolDictionary, "SidcBuilder")
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
init();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
void SidcBuilder::init()
{
m_first10_mil2525D = QString::number(_specialPartA);
m_second10_mil2525D = QString::number(_invalidPartB);
initAmplifier();
}
void SidcBuilder::initAmplifier()
{
m_amplifierGroup = AmplifierGroup::Unknown;
m_e_BrigadeAndBelow = EchelonBrigadeAndBelow::Unknown;
m_e_DivisionAndAbove = EchelonDivisionAndAbove::Unknown;
m_e_MobilityOnLand = MobilityOnLand::Unknown;
m_e_MobilityOnSnow = MobilityOnSnow::Unknown;
m_e_MobilityOnWater = MobilityOnWater::Unknown;
m_e_NavalTowedArray = NavalTowedArray::Unknown;
}
SidcDefinitions::StandardIdentity SidcBuilder::standardIdentity() const
{
StandardIdentity si;
si.context = context();
si.identity = identity();
return si;
}
void SidcBuilder::setStandardIdentity(const SidcDefinitions::StandardIdentity &standardIdentity)
{
setContext(standardIdentity.context);
setIdentity(standardIdentity.identity);
}
SidcDefinitions::Context SidcBuilder::context() const
{
return static_cast<Context>(QStringRef(&m_first10_mil2525D, 2, 1).toInt());
}
void SidcBuilder::setContext(SidcDefinitions::Context context)
{
m_first10_mil2525D.replace(2, 1, QString::number((int)context));
}
SidcDefinitions::Identity SidcBuilder::identity() const
{
return static_cast<Identity>(QStringRef(&m_first10_mil2525D, 3, 1).toInt());
}
void SidcBuilder::setIdentity(SidcDefinitions::Identity identity)
{
m_first10_mil2525D.replace(3, 1, QString::number((int)identity));
}
bool SidcBuilder::isIdentityAssumed() const
{
const SidcDefinitions::Identity identityValue = identity();
switch (identityValue) {
case SidcDefinitions::Identity::Pending:
return true;
case SidcDefinitions::Identity::AssumedFriend:
return true;
case SidcDefinitions::Identity::SuspectJoker:
return true;
break;
default:
// empty
break;
}
return false;
}
SidcDefinitions::SymbolSet SidcBuilder::symbolSet() const
{
SymbolSet sset = static_cast<SymbolSet>(QStringRef(&m_first10_mil2525D, 4, 2).toString().toInt());
return sset;
}
void SidcBuilder::setSymbolSet(const SymbolSet &symbolSet)
{
m_first10_mil2525D.replace(4, 2, QStringLiteral("%1").arg((int)symbolSet, 2, 10, QLatin1Char('0')));
}
SidcDefinitions::Status SidcBuilder::status() const
{
Status status = static_cast<Status>(QStringRef(&m_first10_mil2525D, 6, 1).toInt());
return status;
}
void SidcBuilder::setStatus(const Status &status)
{
m_first10_mil2525D.replace(6, 1, QString::number((int)status));
}
QString SidcBuilder::symbolEntityCode() const
{
SymbologyType symbologyType = m_symbolDictionary->symbologyType();
switch (symbologyType)
{
case SymbologyType::APP6B : return SidcCodec::decodeRawSidc(concreteSidcToBaseSymbolCode(SidcCodec::encodeComplete(symbologyType,m_app6bRawSidc)));
case SymbologyType::APP6D : return m_second10_mil2525D.left(6);
case SymbologyType::MIL2525C : return QString();
case SymbologyType::MIL2525D : return m_second10_mil2525D.left(6);
case SymbologyType::None : return QString();
}
return QString();
}
void SidcBuilder::setSymbolEntityCode(const QString &entityCode)
{
if (entityCode.size() == 6) m_second10_mil2525D.replace(0, 6, entityCode);
}
SidcDefinitions::HQTFDummy SidcBuilder::hqTfFd() const
{
HQTFDummy hdtffd = static_cast<HQTFDummy>(QStringRef(&m_first10_mil2525D, 7, 1).toInt());
return hdtffd;
}
uint SidcBuilder::hqTfFd_UInt() const
{
return static_cast<int>(hqTfFd());
}
void SidcBuilder::setHqTfFd(const HQTFDummy &hqTfFd)
{
m_first10_mil2525D.replace(7, 1, QString::number((int)hqTfFd));
}
bool SidcBuilder::headquarters() const
{
bool headquarters;
bool taskForce;
bool feintDummy;
SidcDefinitions::HQTFDummyConverter::toBool(hqTfFd(), headquarters, taskForce, feintDummy);
return headquarters;
}
bool SidcBuilder::taskForce() const
{
bool headquarters;
bool taskForce;
bool feintDummy;
SidcDefinitions::HQTFDummyConverter::toBool(hqTfFd(), headquarters, taskForce, feintDummy);
return taskForce;
}
bool SidcBuilder::feintDummy() const
{
bool headquarters;
bool taskForce;
bool feintDummy;
SidcDefinitions::HQTFDummyConverter::toBool(hqTfFd(), headquarters, taskForce, feintDummy);
return feintDummy;
}
SidcDefinitions::AmplifierGroup SidcBuilder::amplifierGroup() const
{
AmplifierGroup amplifierGroup = static_cast<AmplifierGroup>(QStringRef(&m_first10_mil2525D, 8, 1).toInt());
return amplifierGroup;
}
void SidcBuilder::setAmplifierGroup(const AmplifierGroup &amplifierGroup)
{
m_first10_mil2525D.replace(8, 1, QString::number((int)amplifierGroup));
}
unsigned int SidcBuilder::amplifier2ndDigit() const
{
return QStringRef(&m_first10_mil2525D, 9, 1).toUInt();
} // unsigned int SidcBuilder::amplifier2ndDigit() const
void SidcBuilder::setAmplifier2ndDigit(unsigned int amplifierSecondDigit)
{
if (amplifierSecondDigit > 9) return; // ToDo error message
m_first10_mil2525D.replace(9, 1, QString::number(amplifierSecondDigit));
}
unsigned int SidcBuilder::sectorModifier1Digit()
{
return QStringRef(&m_second10_mil2525D, 6, 2).toUInt();
} // unsigned int SidcBuilder::sectorModifier1Digit()
unsigned int SidcBuilder::sectorModifier2Digit()
{
return QStringRef(&m_second10_mil2525D, 8, 2).toUInt();
} // unsigned int SidcBuilder::sectorModifier2Digit()
void SidcBuilder::setSectorModifier1Digit(unsigned int digit)
{
if (digit > 99) return; // ToDo error message
m_second10_mil2525D.replace(6, 2, QStringLiteral("%1").arg(digit, 2, 10, QLatin1Char('0')));
} // void SidcBuilder::setSectorModifier1Digit( unsigned int )
void SidcBuilder::setSectorModifier2Digit(unsigned int digit)
{
if (digit > 99) return; // ToDo error message
m_second10_mil2525D.replace(8, 2, QStringLiteral("%1").arg(digit, 2, 10, QLatin1Char('0')));
} // void SidcBuilder::setSectorModifier2Digit( unsigned int digit )
QString SidcBuilder::toRawSidc() const
{
if (!m_symbolDictionary)
return QString();
switch (m_symbolDictionary->symbologyType())
{
case SymbologyType::APP6B : return m_app6bRawSidc;
case SymbologyType::APP6D : return m_first10_mil2525D + m_second10_mil2525D;
case SymbologyType::MIL2525C : return QString();
case SymbologyType::MIL2525D : return m_first10_mil2525D + m_second10_mil2525D;
case SymbologyType::None : return QString();
}
return QString();
}
QString SidcBuilder::toSidc() const
{
if (!m_symbolDictionary)
return QString();
const QString &rawSidc = toRawSidc();
return (rawSidc.isEmpty()) ? QString() : SidcCodec::encodeComplete(m_symbolDictionary->symbologyType(), rawSidc);
} // QString SidcBuilder::toSidc() const
bool SidcBuilder::initFromSymbologyType(SymbologyType symbologyType, const QString &sidc)
{
QString rawSidc(sidc);
if (SidcCodec::isEncoded(sidc))
{
SymbologyType sidcSymbolType = SidcCodec::decodeSymbologyType(sidc);
SidcCodec::SidcType sidcType = SidcCodec::decodeSidcType(sidc);
rawSidc = SidcCodec::decodeRawSidc(sidc);
if (symbologyType != sidcSymbolType)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidc='" << sidc << "'"
<< ", wrong symbology type";
return false;
}
if (SidcCodec::SidcType::Complete != sidcType)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidcMIL2525D='" << sidc << "'"
<< ", wrong sidc type";
return false;
}
}
// check size
if (rawSidc.size() != 20)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidc='" << sidc << "'"
<< ", size failed";
return false;
}
// check version
if (QStringRef(&rawSidc, 0, 2) != QLatin1String("10"))
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidc='" << sidc << "'"
<< ", wrong version";
return false;
}
init();
m_first10_mil2525D = rawSidc.mid( 0, 10);
m_second10_mil2525D = rawSidc.mid(10, 10);
DEBUG_LOG(m_logger) << LOGFUNCTION
<< " m_first10='" << m_first10_mil2525D << "'"
<< " m_second10='" << m_second10_mil2525D << "'";
return true;
}
bool SidcBuilder::initFromSymbologyTypeBaseSymbolCode(SymbologyType symbologyType, const QString &baseSymbolCode)
{
QString rawBaseSymbolCode(baseSymbolCode);
if (SidcCodec::isEncoded(baseSymbolCode))
{
if (SidcCodec::decodeSymbologyType(baseSymbolCode) != symbologyType)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidc='" << baseSymbolCode << "'"
<< ", wrong symbology type";
return false;
}
if (SidcCodec::decodeSidcType(baseSymbolCode) != SidcCodec::SidcType::Base)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " sidc='" << baseSymbolCode << "'"
<< ", wrong sidc type";
return false;
}
rawBaseSymbolCode = SidcCodec::decodeRawSidc(baseSymbolCode);
}
// check size
if (rawBaseSymbolCode.size() != 8)
{
ERROR_LOG(m_logger) << LOGFUNCTION
<< " baseSymbolCode='" << baseSymbolCode << "'"
<< ", size failed";
return false;
}
init();
// set SymbolSet:
SymbolSet sSet = static_cast<SymbolSet>(QStringRef(&rawBaseSymbolCode, 0, 2).toInt());
this->setSymbolSet(sSet);
// set Entity:
const QString &entityChars = rawBaseSymbolCode.mid(2, 6);
// merge into second10:
m_second10_mil2525D.replace(0, 6, entityChars);
return true;
} // bool SidcBuilder::initFromSymbologyTypeBaseSymbolCode(SymbologyType symbologyType, const QString &baseSymbolCode)
bool SidcBuilder::initFromMil2525D(const QString &sidcMil2525D)
{
return SidcBuilder::initFromSymbologyType(SymbologyType::MIL2525D,sidcMil2525D);
}
bool SidcBuilder::initFromMil2525DBaseSymbolCode(const QString &sidcMil2525D_baseSymbolCode)
{
return initFromSymbologyTypeBaseSymbolCode(SymbologyType::MIL2525D, sidcMil2525D_baseSymbolCode);
}
bool SidcBuilder::initFromApp6B(const QString &sidcApp6B)
{
m_app6bRawSidc = SidcCodec::decodeRawSidc(sidcApp6B);
return true;
}
bool SidcBuilder::initFromApp6BBaseSymbolCode(const QString &sidcApp6B_baseSymbolCode)
{
m_app6bRawSidc = SidcCodec::decodeRawSidc(baseSymbolCodeToSidc( sidcApp6B_baseSymbolCode ));
return false;
}
bool SidcBuilder::initFromApp6D(const QString &sidcAPP6D)
{
return SidcBuilder::initFromSymbologyType(SymbologyType::APP6D,sidcAPP6D);
}
bool SidcBuilder::initFromApp6DBaseSymbolCode(const QString &sidcAPP6D_baseSymbolCode)
{
return initFromSymbologyTypeBaseSymbolCode(SymbologyType::APP6D, sidcAPP6D_baseSymbolCode);
}
/*
private void _BuildSIDC()
{
// Builds a current (2525D) SIDC from the JMSML Library elements currently associated
// with this symbol.
if (_version != null && _context != null &&
_standardIdentity != null && _symbolSet != null && _status != null &&
_hqTFDummy != null && _amplifierGroup != null && _amplifier != null)
{
_sidc.PartAUInt = (uint)_version.VersionCode.DigitOne * 1000000000 +
(uint)_version.VersionCode.DigitTwo * 100000000 +
(uint)_context.ContextCode * 10000000 +
(uint)_standardIdentity.StandardIdentityCode * 1000000 +
(uint)_symbolSet.SymbolSetCode.DigitOne * 100000 +
(uint)_symbolSet.SymbolSetCode.DigitTwo * 10000 +
(uint)_status.StatusCode * 1000 +
(uint)_hqTFDummy.HQTFDummyCode * 100 +
(uint)_amplifierGroup.AmplifierGroupCode * 10 +
(uint)_amplifier.AmplifierCode;
}
if (_entity != null)
{
_sidc.PartBUInt = (uint)_entity.EntityCode.DigitOne * 1000000000 +
(uint)_entity.EntityCode.DigitTwo * 100000000;
}
if (_entityType != null)
{
_sidc.PartBUInt = _sidc.PartBUInt + (uint)_entityType.EntityTypeCode.DigitOne * 10000000 +
(uint)_entityType.EntityTypeCode.DigitTwo * 1000000;
}
if (_entitySubType != null)
{
_sidc.PartBUInt = _sidc.PartBUInt + (uint)_entitySubType.EntitySubTypeCode.DigitOne * 100000 +
(uint)_entitySubType.EntitySubTypeCode.DigitTwo * 10000;
}
if (_modifierOne != null)
{
_sidc.PartBUInt = _sidc.PartBUInt + (uint)_modifierOne.ModifierCode.DigitOne * 1000 +
(uint)_modifierOne.ModifierCode.DigitTwo * 100;
}
if (_modifierTwo != null)
{
_sidc.PartBUInt = _sidc.PartBUInt + (uint)_modifierTwo.ModifierCode.DigitOne * 10 +
(uint)_modifierTwo.ModifierCode.DigitTwo;
}
}
*/
} // namespace AdvancedSymbology
@@ -0,0 +1,198 @@
/**
* @RDE_HEADER@
* Class SidcBuilder
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "sidc_builder_base.h"
#include "sidc_codec.h"
#include "symbol_dictionary.h"
// Qt
#include <QString>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
class ADVANCED_SYMBOLOGY_EXPORT SidcBuilder : SidcBuilderBase
{
public:
explicit SidcBuilder(AdvancedSymbology::SymbolDictionary *symbolDictionary = nullptr);
bool setSidc(const QString &sidc)
{
if (SidcCodec::isEncoded(sidc))
{
switch (SidcCodec::decodeSymbologyType(sidc))
{
case SymbologyType::APP6B : return initFromApp6B(sidc);
case SymbologyType::APP6D : return initFromApp6D(sidc);
case SymbologyType::MIL2525C : return false; // return initFromMil2525C(sidc);
case SymbologyType::MIL2525D : return initFromMil2525D(sidc);
case SymbologyType::None : return false;
}
}
else
{
if (m_symbolDictionary)
{
switch (m_symbolDictionary->symbologyType())
{
case SymbologyType::APP6B : return initFromApp6B(SidcCodec::encodeComplete(SymbologyType::APP6B, sidc));
case SymbologyType::APP6D : return initFromApp6D(SidcCodec::encodeComplete(SymbologyType::APP6D, sidc));
case SymbologyType::MIL2525C : return false; // return initFromMil2525C(sidc);
case SymbologyType::MIL2525D : return initFromMil2525D(SidcCodec::encodeComplete(SymbologyType::MIL2525D, sidc));
case SymbologyType::None : return false;
}
}
return initFromMil2525D(SidcCodec::encodeComplete(SymbologyType::MIL2525D, sidc));
}
return false;
} // setSidc
bool initFromSymbologyType(SymbologyType symbologyType, const QString &sidc);
bool initFromSymbologyTypeBaseSymbolCode(SymbologyType symbologyType, const QString &baseSymbolCode);
bool initFromMil2525D(const QString &sidcMil2525D);
bool initFromMil2525DBaseSymbolCode(const QString &sidcMil2525D_baseSymbolCode);
bool initFromApp6B(const QString &sidcApp6B);
bool initFromApp6BBaseSymbolCode(const QString &sidcApp6B_baseSymbolCode);
bool initFromApp6D(const QString &sidcAPP6D);
bool initFromApp6DBaseSymbolCode(const QString &sidcAPP6D_baseSymbolCode);
~SidcBuilder() = default;
QString toSidc() const;
QString toRawSidc() const;
// !!! Attention: digit count starts with 1, not with 0!!!
//
// Set A, digit 1,2
//
// Version
//
// Set A, digit 3,4
//
// StandardIdentity
SidcDefinitions::StandardIdentity standardIdentity() const; // 1st and 2nd
void setStandardIdentity(const SidcDefinitions::StandardIdentity &standardIdentity);
SidcDefinitions::Context context() const;
void setContext(SidcDefinitions::Context context);
SidcDefinitions::Identity identity() const;
void setIdentity(SidcDefinitions::Identity identity);
bool isIdentityAssumed() const;
//
// Set A, digit 5,6
//
// SymbolSet
SidcDefinitions::SymbolSet symbolSet() const;
void setSymbolSet(const SidcDefinitions::SymbolSet &symbolSet);
//
// Set A, digit 7
//
// Status
SidcDefinitions::Status status() const;
void setStatus(const SidcDefinitions::Status &status);
//
// Set A, digit 8
//
// HQTFDummy
SidcDefinitions::HQTFDummy hqTfFd() const;
uint hqTfFd_UInt() const;
void setHqTfFd(const SidcDefinitions::HQTFDummy &hqTfFd);
bool headquarters() const;
bool taskForce() const;
bool feintDummy() const;
//
// Set A, digit 9, 10
//
SidcDefinitions::AmplifierGroup amplifierGroup() const; // digit 9
void setAmplifierGroup(const SidcDefinitions::AmplifierGroup &amplifierGroup);
unsigned int amplifier2ndDigit() const; // digit 10
void setAmplifier2ndDigit(unsigned int amplifierSecondDigit);
//
// Set B, digit 11 - 16
//
QString symbolEntityCode() const;
void setSymbolEntityCode(const QString &);
unsigned int sectorModifier1Digit(); // Set B, digit 17 - 18
unsigned int sectorModifier2Digit(); // set B, digit 19 - 20
void setSectorModifier1Digit(unsigned int); // Set B, digit 17 - 18
void setSectorModifier2Digit(unsigned int); // set B, digit 19 - 20
private:
void init();
void initAmplifier();
QString m_first10_mil2525D;
QString m_second10_mil2525D;
QString m_app6bRawSidc;
//
// SET A :
//
// Amplifier (Echelon/Mobility/TowedArray)
SidcDefinitions::AmplifierGroup m_amplifierGroup;
SidcDefinitions::EchelonBrigadeAndBelow m_e_BrigadeAndBelow;
SidcDefinitions::EchelonDivisionAndAbove m_e_DivisionAndAbove;
SidcDefinitions::MobilityOnLand m_e_MobilityOnLand;
SidcDefinitions::MobilityOnSnow m_e_MobilityOnSnow;
SidcDefinitions::MobilityOnWater m_e_MobilityOnWater;
SidcDefinitions::NavalTowedArray m_e_NavalTowedArray;
//
// : SET A
//
//
// SET B :
//
// not implemented yes
//
// : SET B
//
static qint32 _smallest;
static qint32 _specialPartA;
static qint32 _invalidPartB;
static qint32 _retiredPartB;
};
} // namespace AdvancedSymbology
@@ -0,0 +1,195 @@
/**
* @RDE_HEADER@
* Class SidcBuilderBase
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "sidc_builder_base.h"
#include "sidc_codec.h"
// ESRI
// Qt
#include <QtCore/QDebug>
namespace AdvancedSymbology
{
SidcBuilderBase::SidcBuilderBase(SymbolDictionary *symbolDictionary, const char *loggerName)
: SidcDefinitions(symbolDictionary, loggerName)
{
}
QString SidcBuilderBase::baseSymbolCodeToSidc(const QString &baseSymbolCodeCodec)
{
if (!SidcCodec::isEncoded(baseSymbolCodeCodec))
{
qCritical() << LOGFUNCTION << " baseSymbolCodeCodec input parameter isn't encoded: " << baseSymbolCodeCodec;
return QString();
}
switch (SidcCodec::decodeSidcType(baseSymbolCodeCodec))
{
case SidcCodec::SidcType::CivilEts:
case SidcCodec::SidcType::CivilXml:
return baseSymbolCodeCodec;
case SidcCodec::SidcType::Base:
break;
default :
{
qCritical() << LOGFUNCTION << " baseSymbolCodeCodec is not a base symbol code: " << baseSymbolCodeCodec;
return QString();
}
} // switch
QString sidc;
QString baseSymbolCode = SidcCodec::decodeRawSidc(baseSymbolCodeCodec);
SymbologyType symbologyType = SidcCodec::decodeSymbologyType(baseSymbolCodeCodec);
if ((SymbologyType::MIL2525D == symbologyType) || (SymbologyType::APP6D == symbologyType))
{
//
// its MIL2525D or APP6D
//
if ((baseSymbolCode.size() != 8) && (baseSymbolCode.size() != 10))
{
return QString(); // failure !!
}
QRegExp sidcTemplate(QStringLiteral("^[0-9]{8}(_[0-9])?$"));
if (!sidcTemplate.exactMatch(baseSymbolCode))
{
return QString(); // Failure
}
// Version
sidc += QLatin1Char('1');
sidc += QLatin1Char('0');
// Standard Identity
sidc += QLatin1Char('0');
if (baseSymbolCode.size() == 10) sidc += baseSymbolCode[9];
else sidc += QLatin1Char('1');
// SymbolSet
sidc += baseSymbolCode[0];
sidc += baseSymbolCode[1];
// Status
sidc += QLatin1Char('0');
// HeadQuarter, TaskForce, Dummy
sidc += QLatin1Char('0');
// Amplifier/Descriptor
sidc += QLatin1Char('0');
sidc += QLatin1Char('0');
sidc += baseSymbolCode[2];
sidc += baseSymbolCode[3];
sidc += baseSymbolCode[4];
sidc += baseSymbolCode[5];
sidc += baseSymbolCode[6];
sidc += baseSymbolCode[7];
sidc = sidc.leftJustified(20, QLatin1Char('0'));
return SidcCodec::encodeComplete(symbologyType, sidc);
}
if (SymbologyType::APP6B == symbologyType)
{
sidc = baseSymbolCode;
sidc[1] = QLatin1Char('U');
sidc[3] = QLatin1Char('P');
return SidcCodec::encodeComplete(symbologyType, sidc);
}
return QString();
} // QString SidcBuilderBase::baseSymbolCodeToSidc(const QString &baseSymbolCodeCodec)
QString SidcBuilderBase::concreteSidcToBaseSymbolCode(const QString &sidcCodec)
{
if (!SidcCodec::isEncoded(sidcCodec))
{
qCritical() << LOGFUNCTION << " sidcCodec is not a complete sidc: " << sidcCodec;
return QString();
}
switch (SidcCodec::decodeSidcType(sidcCodec))
{
case SidcCodec::SidcType::CivilEts:
case SidcCodec::SidcType::CivilXml:
return sidcCodec;
break;
case SidcCodec::SidcType::Complete:
break;
default :
{
qCritical() << LOGFUNCTION << " sidcCodec is not a complete sidc: " << sidcCodec;
return QString();
}
} // switch
const QString &rawSidc = SidcCodec::decodeRawSidc(sidcCodec);
SymbologyType symbologyType = SidcCodec::decodeSymbologyType(sidcCodec);
switch (symbologyType)
{
case SymbologyType::APP6B :
{
const QString & baseSymbolCode = normalizeAPP6BaseSymbolCode(rawSidc);
return SidcCodec::encodeBaseSymbolCode(symbologyType, baseSymbolCode);
}
case SymbologyType::MIL2525C : return QString();
case SymbologyType::APP6D : // it's same as MIL2525D
case SymbologyType::MIL2525D :
{
if (rawSidc.count() != 20)
return QString();
QString baseSymbolCode(
QStringRef(&rawSidc, 4, 2).toString() +
QStringRef(&rawSidc, 10, 6).toString());
return SidcCodec::encodeBaseSymbolCode(symbologyType, baseSymbolCode);
} break;
case SymbologyType::None: return QString();
}
return QString();
} // QString SidcBuilderBase::concreteSidcToBaseSymbolCode(const QString &sidcCodec)
QString SidcBuilderBase::normalizeAPP6BaseSymbolCode(const QString & baseSymbolCode)
{
QString baseNorm = baseSymbolCode;
baseNorm.resize(15, QLatin1Char('*'));
baseNorm[1] = QLatin1Char('*');
baseNorm[3] = QLatin1Char('*');
if (QLatin1Char('*') != baseNorm[10]) baseNorm[10] = QLatin1Char('-');
if (QLatin1Char('*') != baseNorm[11]) baseNorm[11] = QLatin1Char('-');
if (QLatin1Char('*') != baseNorm[14]) baseNorm[14] = QLatin1Char('-');
return baseNorm;
} // QString SidcBuilderBase::normalizeAPP6BaseSymbolCode(const QString & baseSymbolCode)
} // namespace AdvancedSymbology
@@ -0,0 +1,65 @@
/**
* @RDE_HEADER@
* Class SidcBuilderBase
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include "sidc_definitions.h"
// Qt
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
// forward:
class ADVANCED_SYMBOLOGY_EXPORT SidcBuilderBase : public SidcDefinitions
{
public:
/*! \name Construction, Destruction */
//@{
///< Constructor
explicit SidcBuilderBase(AdvancedSymbology::SymbolDictionary *symbolDictionary, const char *loggerName);
///< Destructor
virtual ~SidcBuilderBase() = default;
//@}
/*! \name Convert */
//@{
/**
* @brief baseSymbolCodeToSidc
* @param baseSymbolCode ????????? -> Joerg TODO!!!
* @param identity
* @return
*/
static QString baseSymbolCodeToSidc(const QString &baseSymbolCodeCodec); // 25270100 --> 20 digit code
/**
* @brief concreteSidcToBaseSymbolCode
* @param sidc sidc to convert.
* @return if MIL: 20 digit code -> 8 digits like 25270100, if civil: return identical sidc.
*/
static QString concreteSidcToBaseSymbolCode(const QString &sidcCodec);
//@}
static QString normalizeAPP6BaseSymbolCode(const QString & baseSymbolCode);
}; // class SidcBuilderBase
} // namespace AdvancedSymbology
@@ -0,0 +1,221 @@
/**
* @RDE_HEADER@
* SidcCodec for internal handling of SIDCs
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "sidc_codec.h" // enbles highlighting and is harmless since 'pragma once'
#include "sidc_definitions.h"
#include <SymbologyXML/xml_symbol_codec.h>
// Qt
#include <QRegExp>
namespace AdvancedSymbology
{
//
// SidcCodecHelper
//
namespace SidcCodecHelper
{
QString encode(SymbologyType symbologyType)
{
switch (symbologyType)
{
case SymbologyType::None: return QStringLiteral("NONE"); break;
case SymbologyType::APP6B: return QStringLiteral("AP6B"); break;
case SymbologyType::APP6D: return QStringLiteral("AP6D"); break;
case SymbologyType::MIL2525C: return QStringLiteral("M25C"); break;
case SymbologyType::MIL2525D: return QStringLiteral("M25D"); break;
};
return QLatin1String("EROR");
}
SymbologyType decodeSymbology(const QStringRef &symbologyTypeStr)
{
SymbologyType symbologyType = SymbologyType::None;
if (symbologyTypeStr.compare(QLatin1String("NONE")) == 0) symbologyType = SymbologyType::None;
else if (symbologyTypeStr.compare(QLatin1String("AP6B")) == 0) symbologyType = SymbologyType::APP6B;
else if (symbologyTypeStr.compare(QLatin1String("AP6D")) == 0) symbologyType = SymbologyType::APP6D;
else if (symbologyTypeStr.compare(QLatin1String("M25C")) == 0) symbologyType = SymbologyType::MIL2525C;
else if (symbologyTypeStr.compare(QLatin1String("M25D")) == 0) symbologyType = SymbologyType::MIL2525D;
return symbologyType;
}
QString encode(SidcCodec::SidcType sidcType)
{
switch (sidcType)
{
case SidcCodec::SidcType::None: return QStringLiteral("NONE"); break;
case SidcCodec::SidcType::Base: return QStringLiteral("BASE"); break;
case SidcCodec::SidcType::Complete: return QStringLiteral("CMPL"); break;
case SidcCodec::SidcType::CivilEts: return QStringLiteral("CVLE"); break;
case SidcCodec::SidcType::CivilXml: return QStringLiteral("CVLX"); break;
}
return QLatin1String("EROR");
}
SidcCodec::SidcType decodeSidc(const QStringRef &sidcTypeStr)
{
SidcCodec::SidcType symbologyType = SidcCodec::SidcType::None;
if ( sidcTypeStr.compare(QLatin1String("NONE")) == 0) symbologyType = SidcCodec::SidcType::None;
else if (sidcTypeStr.compare(QLatin1String("BASE")) == 0) symbologyType = SidcCodec::SidcType::Base;
else if (sidcTypeStr.compare(QLatin1String("CMPL")) == 0) symbologyType = SidcCodec::SidcType::Complete;
else if (sidcTypeStr.compare(QLatin1String("CVLE")) == 0) symbologyType = SidcCodec::SidcType::CivilEts;
else if (sidcTypeStr.compare(QLatin1String("CVLX")) == 0) symbologyType = SidcCodec::SidcType::CivilXml;
return symbologyType;
}
} // SidcCodecHelper
unsigned int SidcCodec::rawSidcOffset() { return 10; }
//
// isEncoded
//
bool SidcCodec::isEncoded(const QString &encodedSidc)
{
const QChar separator(QLatin1Char('|'));
return ((encodedSidc.size() > 9) && (encodedSidc.at(4) == separator) && (encodedSidc.at(9) == separator));
}
bool SidcCodec::checkSidcSyntax(const QString &encodedSidc)
{
if (!isEncoded(encodedSidc)) return false;
SidcCodec::SidcType sidcType = SidcCodecHelper::decodeSidc(QStringRef(&encodedSidc, 5, 4));
const QStringRef symbologyTypeStr(&encodedSidc, 0, 4);
if (symbologyTypeStr.compare(QLatin1String("NONE")) == 0) return true;
else if (symbologyTypeStr.compare(QLatin1String("AP6B")) == 0) return true;
else if (symbologyTypeStr.compare(QLatin1String("AP6D")) == 0) return true;
else if (symbologyTypeStr.compare(QLatin1String("M25C")) == 0) return true;
else if ((symbologyTypeStr.compare(QLatin1String("M25D")) == 0) || (symbologyTypeStr.compare(QLatin1String("AP6D")) == 0))
{
const QString &rawSidcStr(encodedSidc.mid(10));
QRegExp isDigit(QStringLiteral("^[0..9]*$"));
if (isDigit.exactMatch(rawSidcStr))
{
switch (sidcType)
{
case SidcCodec::SidcType::Base : return (rawSidcStr.size() == 8); break;
case SidcCodec::SidcType::Complete : return (rawSidcStr.size() == 20); break;
default: break;
}
}
}
return false;
}
bool SidcCodec::isCivil(const QString &encodedSidc)
{
SidcCodec::SidcType sidcType = SidcCodec::decodeSidcType(encodedSidc);
return ((sidcType == SidcCodec::SidcType::CivilEts) || (sidcType == SidcCodec::SidcType::CivilXml));
}
//
// ENCODE
//
QString SidcCodec::encodeBaseSymbolCode(SymbologyType symbologyType, const QString &baseSymboCodeSidc)
{
return QStringLiteral("%1|BASE|%3").arg(SidcCodecHelper::encode(symbologyType), baseSymboCodeSidc);
}
QString SidcCodec::encodeComplete(SymbologyType symbologyType, const QString &completeSidc)
{
return QStringLiteral("%1|CMPL|%3").arg(SidcCodecHelper::encode(symbologyType), completeSidc);
}
QString SidcCodec::encodeCivilEts(const QString &civilSidc)
{
return QStringLiteral("NONE|CVLE|%1").arg(civilSidc);
}
QString SidcCodec::encodeCivilXml(const QString &civilSidc)
{
return QStringLiteral("NONE|CVLX|%1").arg(civilSidc);
}
int SidcCodec::decodeCivilXml(const QString &civilSidc)
{
return decodeRawSidc(civilSidc).toInt();
}
//
// DECODE
//
// QStringRef(const QString *string, int position, int size);
// QString mid(int position, int n = -1) const Q_REQUIRED_RESULT;
//
SymbologyType SidcCodec::decodeSymbologyType(const QString &encodedSidc)
{
return SidcCodecHelper::decodeSymbology(QStringRef(&encodedSidc, 0, 4));
}
SidcCodec::SidcType SidcCodec::decodeSidcType(const QString &encodedSidc)
{
return SidcCodecHelper::decodeSidc(QStringRef(&encodedSidc, 5, 4));
}
QString SidcCodec::decodeRawSidc(const QString &encodedSidc)
{
return (isEncoded(encodedSidc)) ? encodedSidc.mid(rawSidcOffset()) : encodedSidc;
}
QString SidcCodec::encodeCivilXmlSymbolId( uint symbolId )
{
const QString &rawSidc = QString::number(symbolId);
return encodeCivilXml(rawSidc);
} // QString SidcCodec::encodeCivilXmlSymbolId( uint symbolId )
QString SidcCodec::encodeCivilXmlSymbolId( uint symbolId
, SymbologyXML::SymbolTypes::t_state state
, SymbologyXML::SymbolTypes::t_uncertainty uncertainty
, SymbologyXML::SymbolTypes::t_affil affil
, SymbologyXML::SymbolTypes::t_mob mob )
{
const QString &rawSidc = SymbologyXML::xmlSymbolEncodeId(symbolId,state,uncertainty,affil,mob);
return encodeCivilXml(rawSidc);
} // QString SidcCodec::encodeCivilXmlSymbolId(...)
QString SidcCodec::extractCivilXmlBaseSidc( const QString &sidc )
{
return SymbologyXML::xmlSymbolExtractBaseSidc(sidc);
} // QString SidcCodec::extractCivilXmlBaseSidc( const QString &sidc )
//
// Some convenience functions
QString SidcCodec::encodeBaseSymbolCode(SymbologyType symbologyType, const QStringRef &baseSymboCodeSidc) { return encodeBaseSymbolCode(symbologyType, *baseSymboCodeSidc.string()); }
QString SidcCodec::encodeBaseSymbolCode(SymbologyType symbologyType, const std::string &baseSymboCodeSidc) { return encodeBaseSymbolCode(symbologyType, QString::fromStdString(baseSymboCodeSidc));}
QString SidcCodec::encodeBaseSymbolCode(SymbologyType symbologyType, const char *baseSymboCodeSidc) { return encodeBaseSymbolCode(symbologyType, QString::fromLatin1(baseSymboCodeSidc));}
QString SidcCodec::encodeComplete(SymbologyType symbologyType, const QStringRef &completeSidc) { return encodeComplete(symbologyType, *completeSidc.string());}
QString SidcCodec::encodeComplete(SymbologyType symbologyType, const std::string &completeSidc) { return encodeComplete(symbologyType, QString::fromStdString(completeSidc)); }
QString SidcCodec::encodeComplete(SymbologyType symbologyType, const char *completeSidc) { return encodeComplete(symbologyType, QString::fromLatin1(completeSidc)); }
QString SidcCodec::encodeCivilEts(const QStringRef &civilSidc) { return encodeCivilEts(*civilSidc.string());}
QString SidcCodec::encodeCivilEts(const std::string &civilSidc) { return encodeCivilEts(QString::fromStdString(civilSidc)); }
QString SidcCodec::encodeCivilEts(const char *civilSidc) { return encodeCivilEts(QString::fromLatin1(civilSidc)); }
QString SidcCodec::encodeCivilXml(const QStringRef &civilSidc) { return encodeCivilXml(*civilSidc.string());}
QString SidcCodec::encodeCivilXml(const std::string &civilSidc) { return encodeCivilXml(QString::fromStdString(civilSidc)); }
QString SidcCodec::encodeCivilXml(const char *civilSidc) { return encodeCivilXml(QString::fromLatin1(civilSidc)); }
} // namespace AdvancedSymbology
@@ -0,0 +1,222 @@
/**
* @RDE_HEADER@
* SidcCodec for internal handling of SIDCs
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "symbology_type.h"
#include "advanced_symbology_export.h"
#include <SymbologyXML/symbol_types.h>
// Qt
#include <QHash>
#include <QString>
#include <QStringRef>
namespace AdvancedSymbology
{
/**
* \brief The SidcCodec namespace enables the encoding and decoding of a (raw) sidc (SymbolIdCode)
* The BaseSymbolCode describes the base symbol, the *Typ* like 'soldier', 'tank'
* WITHOUT the affiliation (membership to a party) and so on.
* Only the complete SIDC (WITH affiliation and so on) describes a concrete instanciation,
* examples:
*
* - APP6D / MIL2525D
* + M25D|BASE|25271300 - abstract/Typ (Context "template": assign symbol)
* + M25D|CMPL|10012500002713000000 - concrete (message from Training Area)
*
* - APP6C / MIL2525C
* Here a abstract (Base) and concrete (Complete) are existing also:
* M25C|BASE|S*A*MFUM--*****
* M25C|CMPL|SNAAMFUM--AL***
* - Extra / Civil / ETS / XML:
* NONE|CIVE|PlanStelle
* NONE|CIVX|<Dateiname alter XML-basierter SymbolEditor>
* @note This namespace uses a QString (and not QLatin1String) since maybe a chinese operator create a symbol and uses a name in his first language.
*/
namespace SidcCodec
{
/**
* Type of SIDC code or symbol
*/
enum class SidcType
{
None, ///< NONE
Base, ///< base symbol without frame, modifier or amplifier coded as "BASE"
Complete, ///< concrete symbol with complete definition coded as "CMPL"
CivilEts, ///< Civil Ets coded as "CVLE"
CivilXml ///< Civil XML coded as "CVLX"
};
/**
* Check if sidc string is encoded.
* @param encodedSidc sidc string to check
* @return Returns true if encoded, otherwise false.
*/
ADVANCED_SYMBOLOGY_EXPORT bool isEncoded(const QString &encodedSidc);
/**
* Check if sidc syntax is correct.
* @param encodedSidc sidc string to check
* @return Returns true if syntax is correct, otherwise false.
*/
ADVANCED_SYMBOLOGY_EXPORT bool checkSidcSyntax(const QString &encodedSidc);
/**
* Check an encode sidc string if it's a civil symbol.
* @param encodedSidc Encoded sidc string
* @return Return value is true in case of civil symbols, otherwise false
*/
ADVANCED_SYMBOLOGY_EXPORT bool isCivil(const QString &encodedSidc);
/**
* Check an encode sidc string if the syntax is correctly.
* @param encodedSidc Encoded sidc string
* @return Return value is true if \c encodeSidc builded correctly. In case of wrong syntax the return value is false.
*/
ADVANCED_SYMBOLOGY_EXPORT bool checkSidcSyntax(const QString &encodedSidc);
ADVANCED_SYMBOLOGY_EXPORT unsigned int rawSidcOffset();
/**
* Functions to encode and decode a SIDC from or to raw string codes. These functions are really simple and
* can not convert between SidcType::Base and SidcType::Complete. This purposes are handled by class \c SidcBuilder.
* @see SidcBuilder
* @{
*/
ADVANCED_SYMBOLOGY_EXPORT QString encodeBaseSymbolCode(SymbologyType symbologyType, const QString &baseSymboCodeSidc); /**< Encode base symbol. Example: M25D|BASE|25271300 */
ADVANCED_SYMBOLOGY_EXPORT QString encodeComplete(SymbologyType symbologyType, const QString &completeSidc); /**< Encode comlete symbol. Example: M25D|CMPL|10012500002713000000 */
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilEts(const QString &civilSidc); /**< Encode ETS civil symbol. Example: NONE|CVLE|PlanStelle */
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXml(const QString &civilSidc); /**< Encode XML civil symbol. Example: NONE|CVLX|PlanStelle */
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXmlSymbolId( uint symbolId );
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXmlSymbolId( uint symbolId
, SymbologyXML::SymbolTypes::t_state state
, SymbologyXML::SymbolTypes::t_uncertainty uncertainty
, SymbologyXML::SymbolTypes::t_affil affil
, SymbologyXML::SymbolTypes::t_mob mob );
ADVANCED_SYMBOLOGY_EXPORT QString extractCivilXmlBaseSidc( const QString &sidc );
ADVANCED_SYMBOLOGY_EXPORT SymbologyType decodeSymbologyType(const QString &encodedSidc); /**< Decode symbology type */
ADVANCED_SYMBOLOGY_EXPORT SidcType decodeSidcType(const QString &encodedSidc); /**< Decode sidc type */
ADVANCED_SYMBOLOGY_EXPORT QString decodeRawSidc(const QString &encodedSidc); /**< Decode raw sidc */
ADVANCED_SYMBOLOGY_EXPORT int decodeCivilXml(const QString &civilSidc);
/** @} */
/**
* Some convience functions ...
* @{
*/
ADVANCED_SYMBOLOGY_EXPORT QString encodeBaseSymbolCode(SymbologyType symbologyType, const QStringRef &baseSymboCodeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeComplete(SymbologyType symbologyType, const QStringRef &completeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilEts(const QStringRef &civilSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXml(const QStringRef &civilSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeBaseSymbolCode(SymbologyType symbologyType, const std::string &baseSymboCodeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeComplete(SymbologyType symbologyType, const std::string &completeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilEts(const std::string &civilSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXml(const std::string &civilSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeBaseSymbolCode(SymbologyType symbologyType, const char *baseSymboCodeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeComplete(SymbologyType symbologyType, const char *completeSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilEts(const char *civilSidc);
ADVANCED_SYMBOLOGY_EXPORT QString encodeCivilXml(const char *civilSidc);
/** @} */
/**
* @brief Helper class to store information appropriate to a sidc.
* In symbol dictionary symbols are stored with a key to get access to complete set of symbol's data. This key is
* equal with base or complete symbol code. The class \c SidcHashTable stores information appropriate to a sidc
* in a QHashTable. The hash tabke index here is the encoded sidc.
*/
template<class Storage> class SidcHashTable
{
QHash<QString, Storage> m_hashTable;
SymbologyType m_symbologyType = SymbologyType::None;
SidcType m_sidcType = SidcType::None;
QString buildSidc(const QString &key) const
{
if (isEncoded(key)) return key;
switch (m_sidcType)
{
case SidcType::Base : return SidcCodec::encodeBaseSymbolCode(m_symbologyType, key);
case SidcType::Complete : return SidcCodec::encodeComplete(m_symbologyType, key);
case SidcType::CivilEts : return SidcCodec::encodeCivilEts(key);
case SidcType::CivilXml : return SidcCodec::encodeCivilXml(key);
case SidcType::None :
default : break;
}
return QString();
} // QString buildSidc(const QString & key) const
public:
SidcHashTable() = default;
explicit SidcHashTable(SymbologyType symbologyType) : m_symbologyType(symbologyType) {}
explicit SidcHashTable(SymbologyType symbologyType, SidcType sidcType) : m_symbologyType(symbologyType), m_sidcType(sidcType) {}
SymbologyType symbologyType() const { return m_symbologyType; }
SidcType sidcType() const { return m_sidcType; }
void clear() { m_hashTable.clear(); }
bool empty() const { return m_hashTable.empty(); }
int count() const { return m_hashTable.count(); }
int size() const { return m_hashTable.size(); }
QStringList keys() const { return m_hashTable.keys(); }
bool contains(const QString &key) const { return m_hashTable.contains(buildSidc(key)); }
bool containsSidc(const QString &sidc) const
{
if (decodeSymbologyType(sidc) == m_symbologyType)
{
if (decodeSidcType(sidc) == m_sidcType) return m_hashTable.contains(sidc);
}
return false;
} // bool containSidc( const QString & sidc ) const
typename QHash<QString, Storage>::iterator find(const QString &key) { return m_hashTable.find(buildSidc(key)); }
typename QHash<QString, Storage>::iterator begin() { return m_hashTable.begin(); }
typename QHash<QString, Storage>::iterator end() { return m_hashTable.end(); }
typename QHash<QString, Storage>::const_iterator find(const QString &key) const { return m_hashTable.find(buildSidc(key)); }
typename QHash<QString, Storage>::const_iterator begin() const { return m_hashTable.begin(); }
typename QHash<QString, Storage>::const_iterator end() const { return m_hashTable.end(); }
Storage &operator[](const QString &key) { return m_hashTable[buildSidc(key)]; }
Storage operator[](const QString &key) const { return m_hashTable[buildSidc(key)]; }
void remove(const QString &sidc)
{
isEncoded(sidc) ? m_hashTable.remove(sidc) : m_hashTable.remove(buildSidc(sidc));
} // void remove(const QString & sidc)
}; // SidcHashTable
} // namespace SidcCodec
} // namespace AdvancedSymbology
// #include "sidc_codec.inl"
@@ -0,0 +1,805 @@
/**
* @RDE_HEADER@
* Class SidcDefinitions
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "sidc_definitions.h"
#include <SymbologyImpl/symbol_dictionary_impl.h>
#ifdef XML_SYMBOL_ICONS
#include <SymbologyXML/symbol.h>
#include <SymbologyXML/symbol_reader.h>
#include <SymbologyXML/symbol_exporter.h>
#endif
#include <QtCore/QFile>
#include <QtGui/QPainter>
#include <QtGui/QPixmap>
#include <QtWidgets/QGraphicsScene>
//
//#include <sstream>
namespace AdvancedSymbology
{
SidcDefinitions::SidcDefinitions(SymbolDictionary *symbolDictionary, const char *loggerName)
: m_symbolDictionary(symbolDictionary)
, m_logger(getLogger(loggerName))
{
if (m_symbolDictionary)
{
if (m_symbolDictionary->isLoaded())
{
SymbolDictionaryImpl *symDicImpl = static_cast<SymbolDictionaryImpl *>(m_symbolDictionary);
m_esriDictProcessor = symDicImpl->getEsriDictionaryProcessor();
}
else
ERROR_LOG(m_logger) << LOGFUNCTION << " symbolDictionary not loaded";
}
else
ERROR_LOG(m_logger) << LOGFUNCTION << " no symbolDictionary";
}
QLatin1String SidcDefinitions::toString(ShapeType value)
{
switch (value)
{
case ShapeType::Undefined:
return QLatin1String("Undefined");
case ShapeType::Circle:
return QLatin1String("Circle");
case ShapeType::Clover:
return QLatin1String("Clover");
case ShapeType::Curve:
return QLatin1String("Curve");
case ShapeType::Diamond:
return QLatin1String("Diamond");
case ShapeType::Rectangle:
return QLatin1String("Rectangle");
case ShapeType::Square:
return QLatin1String("Square");
}
return QLatin1String("ERROR-ShapeType");
}
QLatin1String SidcDefinitions::toString(Context value)
{
switch (value)
{
case Context::Reality:
return QLatin1String("Reality");
case Context::Exercise:
return QLatin1String("Exercise");
case Context::Simulation:
return QLatin1String("Simulation");
}
return QLatin1String("ERROR-Context");
}
QPixmap SidcDefinitions::toPixmap(Context value)
{
Q_UNUSED(value)
return QPixmap();
}
QLatin1String SidcDefinitions::toString(Identity value)
{
switch (value)
{
case Identity::Pending:
return QLatin1String("Pending");
case Identity::Unknown:
return QLatin1String("Unknown");
case Identity::AssumedFriend:
return QLatin1String("AssumedFriend");
case Identity::Friend:
return QLatin1String("Friend");
case Identity::Neutral:
return QLatin1String("Neutral");
case Identity::SuspectJoker:
return QLatin1String("SuspectJoker");
case Identity::HostileFaker:
return QLatin1String("HostileFaker");
} // switch
return QLatin1String("ERROR-Identity");
}
QPixmap SidcDefinitions::toPixmap(Identity value)
{
Q_UNUSED(value);
return QPixmap(); // render XML symbol frame not activated yet
#ifdef XML_SYMBOL_ICONS
QGraphicsScene scene;
QString frameXml;
QString frameResource;
SymbologyXML::Symbol symbol;
SymbologyXML::SymbolReader symbolReader;
QColor fillColor;
SymbologyXML::SymbolTypes::t_affil affil;
static QMap<Identity,QImage*> frameImageMap;
if (frameImageMap[value]) return QPixmap::fromImage(*frameImageMap[value]);
scene.setSceneRect( QRectF(-2.0, -2.0, 4.0, 4.0) );
switch (value)
{
case Identity::Pending :
{
affil = SymbologyXML::SymbolTypes::t_affil::PENDING;
fillColor = QColor(QStringLiteral("yellow"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_unknown.xml");
} break;
case Identity::Unknown :
{
affil = SymbologyXML::SymbolTypes::t_affil::UNKNOWN;
fillColor = QColor(QStringLiteral("yellow"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_unknown.xml");
} break;
case Identity::AssumedFriend :
{
affil = SymbologyXML::SymbolTypes::t_affil::ASSUMED_FRIEND;
fillColor = QColor(QStringLiteral("light blue"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_friend.xml");
} break;
case Identity::Friend :
{
affil = SymbologyXML::SymbolTypes::t_affil::FRIEND;
fillColor = QColor(QStringLiteral("light blue"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_friend.xml");
} break;
case Identity::Neutral :
{
affil = SymbologyXML::SymbolTypes::t_affil::NEUTRAL;
fillColor = QColor(QStringLiteral("darkseagreen"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_neutral.xml");
} break;
case Identity::SuspectJoker :
{
affil = SymbologyXML::SymbolTypes::t_affil::SUSPECT;
fillColor = QColor(QStringLiteral("orange"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_enemy.xml");
} break;
case Identity::HostileFaker :
{
affil = SymbologyXML::SymbolTypes::t_affil::ENEMY;
fillColor = QColor(QStringLiteral("red"));
frameResource = QStringLiteral(":/Symbole/Attributes/symbolframes/frame_landunits_enemy.xml");
} break;
} //switch
if (frameResource.isEmpty()) return QPixmap();
QFile fileXml(frameResource);
if (!fileXml.exists()) return QPixmap();
if (!fileXml.open(QIODevice::ReadOnly | QIODevice::Text)) return QPixmap();
frameXml = QString::fromLocal8Bit( fileXml.readAll() );
fileXml.close();
if (frameXml.isEmpty()) return QPixmap();
if (!symbolReader.read(frameXml,symbol)) return QPixmap();
symbol.setAffil(affil);
symbol.setDimen(SymbologyXML::SymbolTypes::t_dimen::LAND_UNITS);
symbol.setHeadquarter(false);
QImage *frameImage = new QImage(40,40,QImage::Format::Format_ARGB32);
QPainter painter(frameImage);
painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
frameImage->fill(QColor(255,255,255,0));
SymbologyXML::SymbolTypes::AdditionalSymbolData options;
options.m_filltype = SymbologyXML::SymbolTypes::FILLTYPE_FILLED;
SymbologyXML::SymbolExporter::drawFrameSymbol( symbol, options, &scene, QColor(0,0,0,255), fillColor, 0.0, true);
scene.render(&painter);
frameImageMap[value] = frameImage;
return QPixmap::fromImage(*frameImage);
#endif
}
SidcDefinitions::ShapeType SidcDefinitions::StandardIdentity::getShape() const
{
switch (identity)
{
case Identity::Unknown:
case Identity::Pending:
return ShapeType::Clover;
case Identity::Friend:
case Identity::AssumedFriend:
return ShapeType::Rectangle;
case Identity::Neutral:
return ShapeType::Square;
case Identity::HostileFaker:
case Identity::SuspectJoker:
return ShapeType::Diamond;
} // switch
return ShapeType::Undefined;
}
QVector<SidcDefinitions::Context> SidcDefinitions::contexts()
{
return { Context::Reality, Context::Exercise, Context::Simulation };
}
QVector<SidcDefinitions::Identity> SidcDefinitions::identities()
{
return {Identity::Pending,
Identity::Unknown,
Identity::AssumedFriend,
Identity::Friend,
Identity::Neutral,
Identity::SuspectJoker,
Identity::HostileFaker};
}
QLatin1String SidcDefinitions::toString(HQTFDummy value)
{
switch (value)
{
case HQTFDummy::Unknown:
return QLatin1String("Unknown");
case HQTFDummy::FeintDummy:
return QLatin1String("FeintDummy");
case HQTFDummy::Headquarters:
return QLatin1String("Headquarters");
case HQTFDummy::FeintDummy_Headquarters:
return QLatin1String("FeintDummy_Headquarters");
case HQTFDummy::TaskForce:
return QLatin1String("TaskForce");
case HQTFDummy::FeintDummy_TaskForce:
return QLatin1String("FeintDummy_TaskForce");
case HQTFDummy::TaskForce_Headquarters:
return QLatin1String("TaskForce_Headquarters");
case HQTFDummy::FeintDummy_TaskForce_Headquarters:
return QLatin1String("FeintDummy_TaskForce_Headquarters");
} // switch
return QLatin1String("ERROR-HQTFDummy");
}
QPixmap SidcDefinitions::toPixmap(HQTFDummy value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::HQTFDummy> SidcDefinitions::hQTFDummy()
{
return {HQTFDummy::Unknown,
HQTFDummy::FeintDummy,
HQTFDummy::Headquarters,
HQTFDummy::FeintDummy_Headquarters,
HQTFDummy::TaskForce,
HQTFDummy::FeintDummy_TaskForce,
HQTFDummy::TaskForce_Headquarters,
HQTFDummy::FeintDummy_TaskForce_Headquarters
};
}
void SidcDefinitions::HQTFDummyConverter::toBool(const SidcDefinitions::HQTFDummy &hqTfDummy, bool &headquarters, bool &taskForce, bool &feintDummy)
{
uint asInt = static_cast<uint>(hqTfDummy);
headquarters = asInt & 2; // mask
taskForce = asInt & 4; // mask
feintDummy = asInt & 1; // mask
}
uint SidcDefinitions::HQTFDummyConverter::toHqTfDummyAsInt(bool headquarters, bool taskForce, bool feintDummy)
{
uint hdtffd = 0;
if (headquarters) hdtffd += 2;
if (taskForce) hdtffd += 4;
if (feintDummy) ++hdtffd;
return hdtffd;
}
SidcDefinitions::HQTFDummy SidcDefinitions::HQTFDummyConverter::toHqTfDummy(bool headquarters, bool taskForce, bool feintDummy)
{
return static_cast<HQTFDummy>(toHqTfDummyAsInt(headquarters,
taskForce,
feintDummy));
}
QLatin1String SidcDefinitions::toString(AmplifierGroup value)
{
switch (value)
{
case AmplifierGroup::Unknown:
return QLatin1String("Unknown");
case AmplifierGroup::Echelon_BrigadeAndBelow:
return QLatin1String("Echelon_BrigadeAndBelow");
case AmplifierGroup::Echelon_DivisionAndAbove:
return QLatin1String("Echelon_DivisionAndAbove");
case AmplifierGroup::Mobility_OnLand:
return QLatin1String("Mobility_OnLand");
case AmplifierGroup::Mobility_OnSnow:
return QLatin1String("Mobility_OnSnow");
case AmplifierGroup::Mobility_OnWater:
return QLatin1String("Mobility_OnWater");
case AmplifierGroup::Naval_TowedArry:
return QLatin1String("Naval_TowedArry");
} // switch
return QLatin1String("ERROR-AmplifierGroup");
}
QPixmap SidcDefinitions::toPixmap(AmplifierGroup value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::AmplifierGroup> SidcDefinitions::amplifierGroups()
{
return { AmplifierGroup::Unknown,
AmplifierGroup::Echelon_BrigadeAndBelow,
AmplifierGroup::Echelon_DivisionAndAbove,
AmplifierGroup::Mobility_OnLand,
AmplifierGroup::Mobility_OnSnow,
AmplifierGroup::Mobility_OnWater,
AmplifierGroup::Naval_TowedArry
};
}
QLatin1String SidcDefinitions::toString(EchelonBrigadeAndBelow value)
{
switch (value)
{
case EchelonBrigadeAndBelow::Unknown:
return QLatin1String("Unknown");
case EchelonBrigadeAndBelow::TeamCrew:
return QLatin1String("TeamCrew");
case EchelonBrigadeAndBelow::Squad:
return QLatin1String("Squad");
case EchelonBrigadeAndBelow::Section:
return QLatin1String("Section");
case EchelonBrigadeAndBelow::PlatoonDetachment:
return QLatin1String("PlatoonDetachment");
case EchelonBrigadeAndBelow::BattalionSquadron:
return QLatin1String("BattalionSquadron");
case EchelonBrigadeAndBelow::CompanyBatteryTroop:
return QLatin1String("CompanyBatteryTroop");
case EchelonBrigadeAndBelow::RegimentGroup:
return QLatin1String("RegimentGroup");
case EchelonBrigadeAndBelow::Brigade:
return QLatin1String("Brigade");
} // switch
return QLatin1String("ERROR-EchelonBrigadeAndBelow");
}
QPixmap SidcDefinitions::toPixmap(EchelonBrigadeAndBelow value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::EchelonBrigadeAndBelow> SidcDefinitions::echelonBrigadeAndBelows()
{
return { EchelonBrigadeAndBelow::Unknown,
EchelonBrigadeAndBelow::TeamCrew,
EchelonBrigadeAndBelow::Squad,
EchelonBrigadeAndBelow::Section,
EchelonBrigadeAndBelow::PlatoonDetachment,
EchelonBrigadeAndBelow::CompanyBatteryTroop,
EchelonBrigadeAndBelow::BattalionSquadron,
EchelonBrigadeAndBelow::RegimentGroup,
EchelonBrigadeAndBelow::Brigade
};
}
QLatin1String SidcDefinitions::toString(EchelonDivisionAndAbove value)
{
switch (value)
{
case EchelonDivisionAndAbove::Unknown:
return QLatin1String("Unknown");
case EchelonDivisionAndAbove::Division:
return QLatin1String("Division");
case EchelonDivisionAndAbove::CorpsMEF:
return QLatin1String("CorpsMEF");
case EchelonDivisionAndAbove::Army:
return QLatin1String("Army");
case EchelonDivisionAndAbove::Army_GroupFront:
return QLatin1String("Army_GroupFront");
case EchelonDivisionAndAbove::RegionTheater:
return QLatin1String("RegionTheater");
case EchelonDivisionAndAbove::Command:
return QLatin1String("Command");
} // switch
return QLatin1String("ERROR-EchelonDivisionAndAbove");
}
QVector<SidcDefinitions::EchelonDivisionAndAbove> SidcDefinitions::echelonDivisionAndAboves()
{
return {EchelonDivisionAndAbove::Unknown,
EchelonDivisionAndAbove::Division,
EchelonDivisionAndAbove::CorpsMEF,
EchelonDivisionAndAbove::Army,
EchelonDivisionAndAbove::Army_GroupFront,
EchelonDivisionAndAbove::RegionTheater,
EchelonDivisionAndAbove::Command,
};
}
QLatin1String SidcDefinitions::toString(MobilityOnLand value)
{
switch (value)
{
case MobilityOnLand::Unknown:
return QLatin1String("Unknown");
case MobilityOnLand::WheeledLimitedCrossCountry:
return QLatin1String("WheeledLimitedCrossCountry");
case MobilityOnLand::WheeledCrossCountry:
return QLatin1String("WheeledCrossCountry");
case MobilityOnLand::Tracked:
return QLatin1String("Tracked");
case MobilityOnLand::WheeledAndTrackedCombination:
return QLatin1String("WheeledAndTrackedCombination");
case MobilityOnLand::Towed:
return QLatin1String("Towed");
case MobilityOnLand::Rail:
return QLatin1String("Rail");
case MobilityOnLand::PackAnimal:
return QLatin1String("PackAnimal");
} // switch
return QLatin1String("ERROR-MobilityOnLand");
}
QPixmap SidcDefinitions::toPixmap(MobilityOnLand value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::MobilityOnLand> SidcDefinitions::mobilityOnLands()
{
return { MobilityOnLand::Unknown,
MobilityOnLand::WheeledLimitedCrossCountry,
MobilityOnLand::WheeledCrossCountry,
MobilityOnLand::Tracked,
MobilityOnLand::WheeledAndTrackedCombination,
MobilityOnLand::Towed,
MobilityOnLand::Rail,
MobilityOnLand::PackAnimal
};
}
QLatin1String SidcDefinitions::toString(MobilityOnSnow value)
{
switch (value)
{
case MobilityOnSnow::Unknown:
return QLatin1String("Unknown");
case MobilityOnSnow::OverSnow:
return QLatin1String("OverSnow");
case MobilityOnSnow::Sled:
return QLatin1String("Sled");
} // switch
return QLatin1String("ERROR-MobilityOnSnow");
}
QPixmap SidcDefinitions::toPixmap(MobilityOnSnow value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::MobilityOnSnow> SidcDefinitions::mobilityOnSnows()
{
return { MobilityOnSnow::Unknown,
MobilityOnSnow::OverSnow,
MobilityOnSnow::Sled
};
}
QLatin1String SidcDefinitions::toString(MobilityOnWater value)
{
switch (value)
{
case MobilityOnWater::Unknown:
return QLatin1String("Unknown");
case MobilityOnWater::Barge:
return QLatin1String("Barge");
case MobilityOnWater::Amphibious:
return QLatin1String("Amphibious");
} // switch
return QLatin1String("ERROR-MobilityOnWater");
}
QPixmap SidcDefinitions::toPixmap(MobilityOnWater value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::MobilityOnWater> SidcDefinitions::mobilityOnWaters()
{
return { MobilityOnWater::Unknown,
MobilityOnWater::Barge,
MobilityOnWater::Amphibious
};
}
QLatin1String SidcDefinitions::toString(NavalTowedArray value)
{
switch (value)
{
case NavalTowedArray::Unknown:
return QLatin1String("Unknown");
case NavalTowedArray::ShortTowedArray:
return QLatin1String("ShortTowedArray");
case NavalTowedArray::LongTowedArray:
return QLatin1String("LongTowedArray");
} // switch
return QLatin1String("ERROR-NavalTowedArray");
}
QPixmap SidcDefinitions::toPixmap(NavalTowedArray value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::NavalTowedArray> SidcDefinitions::navalTowedArrays()
{
return {NavalTowedArray::Unknown,
NavalTowedArray::ShortTowedArray,
NavalTowedArray::LongTowedArray
};
}
QLatin1String SidcDefinitions::toString(SymbolSet value)
{
switch (value)
{
case SymbolSet::Unknown:
return QLatin1String("Unknown");
case SymbolSet::Air:
return QLatin1String("Air");
case SymbolSet::AirMissle:
return QLatin1String("AirMissle");
case SymbolSet::Space:
return QLatin1String("Space");
case SymbolSet::SpaceMissle:
return QLatin1String("SpaceMissle");
case SymbolSet::LandUnit:
return QLatin1String("LandUnit");
case SymbolSet::LandCivilian_UnitOrganisation:
return QLatin1String("LandCivilian_UnitOrganisation");
case SymbolSet::LandEquipment:
return QLatin1String("LandEquipment");
case SymbolSet::LandInstallation:
return QLatin1String("LandInstallation");
case SymbolSet::ControlMeasure:
return QLatin1String("ControlMeasure");
case SymbolSet::DismountedIndividual:
return QLatin1String("DismountedIndividual");
case SymbolSet::SeaSurface:
return QLatin1String("SeaSurface");
case SymbolSet::SeaSubSurface:
return QLatin1String("SeaSubSurface");
case SymbolSet::MineWarfare:
return QLatin1String("MineWarfare");
case SymbolSet::Activities:
return QLatin1String("Activities");
case SymbolSet::Atmospheric:
return QLatin1String("Atmospheric");
case SymbolSet::Oceanographic:
return QLatin1String("Oceanographic");
case SymbolSet::MeteorologicalSpace:
return QLatin1String("MeteorologicalSpace");
case SymbolSet::SignalsIntelligence_Space:
return QLatin1String("SignalsIntelligence_Space");
case SymbolSet::SignalsIntelligence_Air:
return QLatin1String("SignalsIntelligence_Air");
case SymbolSet::SignalsIntelligence_Land:
return QLatin1String("SignalsIntelligence_Land");
case SymbolSet::SignalsIntelligence_Surface:
return QLatin1String("SignalsIntelligence_Surface");
case SymbolSet::SignalsIntelligence_Subsurface:
return QLatin1String("SignalsIntelligence_Subsurface");
case SymbolSet::Cyberspace:
return QLatin1String("Cyberspace");
} // switch
return QLatin1String("ERROR-SymbolSet");
}
QPixmap SidcDefinitions::toPixmap(SymbolSet value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::SymbolSet> SidcDefinitions::symbolSets()
{
return {SymbolSet::Unknown,
SymbolSet::Air,
SymbolSet::AirMissle,
SymbolSet::Space,
SymbolSet::SpaceMissle,
SymbolSet::LandUnit,
SymbolSet::LandCivilian_UnitOrganisation,
SymbolSet::LandEquipment,
SymbolSet::LandInstallation,
SymbolSet::ControlMeasure,
SymbolSet::DismountedIndividual,
SymbolSet::SeaSurface,
SymbolSet::SeaSubSurface,
SymbolSet::MineWarfare,
SymbolSet::Activities,
SymbolSet::Atmospheric,
SymbolSet::Oceanographic,
SymbolSet::MeteorologicalSpace,
SymbolSet::SignalsIntelligence_Space,
SymbolSet::SignalsIntelligence_Air,
SymbolSet::SignalsIntelligence_Land,
SymbolSet::SignalsIntelligence_Surface,
SymbolSet::SignalsIntelligence_Subsurface,
SymbolSet::Cyberspace
};
}
QLatin1String SidcDefinitions::toString(Status value)
{
switch (value)
{
case Status::Present:
return QLatin1String("Present");
case Status::Planned_Anticipated_Suspect:
return QLatin1String("Planned_Anticipated_Suspect");
case Status::Present_FullCapable:
return QLatin1String("Present_FullCapable");
case Status::Present_Damaged:
return QLatin1String("Present_Damaged");
case Status::Present_Destroyed:
return QLatin1String("Present_Destroyed");
case Status::Present_FullToCapacity:
return QLatin1String("Present_FullToCapacity");
} // switch
return QLatin1String("ERROR-Status");
}
QPixmap SidcDefinitions::toPixmap(Status value)
{
Q_UNUSED(value);
return QPixmap();
}
QVector<SidcDefinitions::Status> SidcDefinitions::statuss()
{
return
{
Status::Present,
Status::Planned_Anticipated_Suspect,
Status::Present_FullCapable,
Status::Present_Damaged,
Status::Present_Destroyed,
Status::Present_FullToCapacity
};
}
QStringList SidcDefinitions::modifierKeys() const
{
if (!m_esriDictProcessor)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " no m_esriDictProcessor";
return QStringList();
}
return m_esriDictProcessor->symbolModifierKeys();
}
QVector<ModifierData> SidcDefinitions::modifierList(SidcDefinitions::SymbolSet symbolSet, unsigned int modifierSector) const
{
if (!m_esriDictProcessor)
{
ERROR_LOG(m_logger) << LOGFUNCTION << " no m_esriDictProcessor";
return QVector<ModifierData>();
}
return m_esriDictProcessor->symbolModifierList(symbolSet, modifierSector);
}
//----------------------------------------------------------------------------
std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::ShapeType &value)
{
stream << "ShapeType(" << AdvancedSymbology::SidcDefinitions::toString(value)
<< ")";
return stream;
}
std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::Identity &value)
{
stream << "Identity(" << AdvancedSymbology::SidcDefinitions::toString(value)
<< ")";
return stream;
}
std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::SymbolSet &value)
{
stream << "SymbolSet(" << AdvancedSymbology::SidcDefinitions::toString(value)
<< ")";
return stream;
}
std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::Status &value)
{
stream << "Status(" << AdvancedSymbology::SidcDefinitions::toString(value)
<< ")";
return stream;
}
} // namespace AdvancedSymbology
@@ -0,0 +1,396 @@
/**
* @RDE_HEADER@
* Class SidcDefinitions
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include "../SymbologyImpl/advanced_symbology_logging.h" // ToDo
// Qt
#include <QString>
#include <QVector>
#include <QPixmap>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
static const QLatin1String ETS_SYMBOL_KEYWORD("ETS");
// forward:
class SymbolDictionary;
class EsriDictionaryProcessor;
struct ModifierData;
/**
* @brief The SidcDefinitions class contains a row of enum definitions common to the AdvancedSymbology.
* A couple (like SidcDefinitions::modifierList) require a loaded SymbolDictionary.
*/
class ADVANCED_SYMBOLOGY_EXPORT SidcDefinitions
{
public:
/*! \name Construction, Destruction */
//@{
///< Constructor
explicit SidcDefinitions(AdvancedSymbology::SymbolDictionary *symbolDictionary, const char *loggerName = "SidcDefinitions");
///< Destructor
virtual ~SidcDefinitions() = default;
//@}
//
// Counting startw with 1
//
//
// Version : digit 1,2
//
//
// StandardIdentity : digit 3,4
//
enum class ShapeType
{
Undefined,
Circle,
Clover,
Curve,
Diamond,
Rectangle,
Square
};
static QLatin1String toString(ShapeType value);
// StandardIdentity, 1st digit
enum class Context
{
Reality, ///< 0
Exercise, ///< 1
Simulation ///< 2
};
static QLatin1String toString(Context value);
static QPixmap toPixmap(Context value);
static QVector<Context> contexts();
// StandardIdentity, 2nd digit
enum class Identity
{
Pending, ///< 0
Unknown, ///< 1
AssumedFriend, ///< 2
Friend, ///< 3
Neutral, ///< 4
SuspectJoker, ///< 5
HostileFaker ///< 6
};
static QLatin1String toString(Identity value);
static QPixmap toPixmap(Identity value);
static QVector<Identity> identities();
struct ADVANCED_SYMBOLOGY_EXPORT StandardIdentity
{
Context context = Context::Reality; ///< 1st digit
Identity identity = Identity::Unknown; ///< 2nd digit
ShapeType getShape() const; // BattleDimension missing!!!!!!!
};
//
// : StandardIdentity
//
//
// Symbol Set : digit 5,6 TODO: maybe generated out of esri stylx file, becasuse it depends on MIL/APP ???
//
enum class SymbolSet
{
Unknown, ///< 0
Air,
AirMissle,
Space = 5,
SpaceMissle,
LandUnit = 10,
LandCivilian_UnitOrganisation,
LandEquipment = 15,
LandInstallation = 20,
ControlMeasure = 25,
DismountedIndividual = 27, // APP6D, not MIL2525D
SeaSurface = 30,
SeaSubSurface = 35,
MineWarfare,
Activities = 40,
Atmospheric = 45,
Oceanographic,
MeteorologicalSpace = 50,
SignalsIntelligence_Space,
SignalsIntelligence_Air,
SignalsIntelligence_Land,
SignalsIntelligence_Surface,
SignalsIntelligence_Subsurface,
Cyberspace = 60
};
static QLatin1String toString(SymbolSet value);
static QPixmap toPixmap(SymbolSet value);
static QVector<SymbolSet> symbolSets();
template<typename T> static SymbolSet castToSymbolSet(T value)
{
SymbolSet symbolSet = static_cast<SymbolSet>(value);
if (!symbolSets().contains(symbolSet))
symbolSet = SymbolSet::Unknown;
return symbolSet;
} // template<typename T> SymbolSet castToSymbolSet(T value)
//
// Status : digit 7
//
enum class Status
{
Present = 0, ///< exeption, no Unknown
Planned_Anticipated_Suspect = 1,
Present_FullCapable = 2,
Present_Damaged = 3,
Present_Destroyed = 4,
Present_FullToCapacity = 5
};
static QLatin1String toString(Status value);
static QPixmap toPixmap(Status value);
static QVector<Status> statuss();
//
// HQ TF Dummy : digit 8
//
enum class HQTFDummy
{
Unknown, ///< 0
FeintDummy, ///< 1
Headquarters, ///< 2
FeintDummy_Headquarters, ///< 3
TaskForce, ///< 4
FeintDummy_TaskForce, ///< 5
TaskForce_Headquarters, ///< 6
FeintDummy_TaskForce_Headquarters, ///< 7
};
static QLatin1String toString(HQTFDummy value);
static QPixmap toPixmap(HQTFDummy value);
static QVector<HQTFDummy> hQTFDummy();
// some helper functions:
struct HQTFDummyConverter
{
static void toBool(const HQTFDummy &hqTfDummy,
bool &headquarters,
bool &taskForce,
bool &feintDummy);
static uint toHqTfDummyAsInt(bool headquarters,
bool taskForce,
bool feintDummy);
static HQTFDummy toHqTfDummy(bool headquarters,
bool taskForce,
bool feintDummy);
};
//
// Amplifier : digit 9,10
//
// Amplifier-Group : 1st digit
enum class AmplifierGroup
{
Unknown,
Echelon_BrigadeAndBelow,
Echelon_DivisionAndAbove,
Mobility_OnLand,
Mobility_OnSnow,
Mobility_OnWater,
Naval_TowedArry,
};
static QLatin1String toString(AmplifierGroup value);
static QPixmap toPixmap(AmplifierGroup value);
static QVector<AmplifierGroup> amplifierGroups();
// Depending on AmplifierGroup :
// Amplifier-Echelon/Mobility/Naval - 2nd digit
enum class EchelonBrigadeAndBelow
{
Unknown = 0,
TeamCrew,
Squad,
Section,
PlatoonDetachment,
CompanyBatteryTroop,
BattalionSquadron,
RegimentGroup,
Brigade
};
static QLatin1String toString(EchelonBrigadeAndBelow value);
static QPixmap toPixmap(EchelonBrigadeAndBelow value);
static QVector<EchelonBrigadeAndBelow> echelonBrigadeAndBelows();
// OR
enum class EchelonDivisionAndAbove
{
Unknown = 0,
Division,
CorpsMEF,
Army,
Army_GroupFront,
RegionTheater,
Command
};
static QLatin1String toString(EchelonDivisionAndAbove value);
static QVector<EchelonDivisionAndAbove> echelonDivisionAndAboves();
// OR
enum class MobilityOnLand
{
Unknown = 0,
WheeledLimitedCrossCountry,
WheeledCrossCountry,
Tracked,
WheeledAndTrackedCombination,
Towed,
Rail,
PackAnimal
};
static QLatin1String toString(MobilityOnLand value);
static QPixmap toPixmap(MobilityOnLand value);
static QVector<MobilityOnLand> mobilityOnLands();
// OR
enum class MobilityOnSnow
{
Unknown = 0,
OverSnow,
Sled
};
static QLatin1String toString(MobilityOnSnow value);
static QPixmap toPixmap(MobilityOnSnow value);
static QVector<MobilityOnSnow> mobilityOnSnows();
// OR
enum class MobilityOnWater
{
Unknown = 0,
Barge,
Amphibious
};
static QLatin1String toString(MobilityOnWater value);
static QPixmap toPixmap(MobilityOnWater value);
static QVector<MobilityOnWater> mobilityOnWaters();
// OR
enum class NavalTowedArray
{
Unknown = 0,
ShortTowedArray,
LongTowedArray
};
static QLatin1String toString(NavalTowedArray value);
static QPixmap toPixmap(NavalTowedArray value);
static QVector<NavalTowedArray> navalTowedArrays();
//
// : Amplifier
//
/*! \name Methods requiring a loaded SymbolDictionary*/
//@{
//
// Modifier
//
/**
* @brief Provides a list of all modifier keys
*/
QStringList modifierKeys() const;
/**
* @brief A List of all modifiers of a symbolSet
* @param symbolSet symbol set
* @param modifierSector sector of the modifier, range of values [1,2]
* @see SymbolSet
*/
QVector<ModifierData> modifierList(SidcDefinitions::SymbolSet symbolSet, unsigned int modifierSector) const;
//@}
protected:
SymbolDictionary *m_symbolDictionary = nullptr;
const EsriDictionaryProcessor *m_esriDictProcessor = nullptr;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
}; // class SidcDefinitions
// move to different place!?!? Todo check
/**
* Stores data to each symbol modifier. Each symbol can have a list of sector 1 and sector 2 modifiers
*/
struct ModifierData
{
QString m_modifierKey; /*!< 5 digits key from ESRI stylx : SymbolSet<2>ModifierValue<2>ModifierSector<1> */
SidcDefinitions::SymbolSet m_symbolSet; /*!< Symbol set matching to the modifier */
unsigned int m_modifierSector; /*!< Modifier sector, can be 1 or 2 */
unsigned int m_modifierValue; /*!< Value of modifier depending on symbol set and modifier sector */
QString m_modifierName; /*!< Name of modifier to show at GUI */
QPixmap m_modifierIcon; /*!< Icon of the modifier */
};
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::ShapeType &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::Identity &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::SymbolSet &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream, const AdvancedSymbology::SidcDefinitions::Status &value);
} // namespace AdvancedSymbology
@@ -0,0 +1,192 @@
/**
* @RDE_HEADER@
* ViewshedParameter
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "symbol_data_to_render.h"
#include <SymbologyImpl/advanced_symbology_logging.h>
#include <Symbology/sidc_codec.h>
#include <Symbology/sidc_builder.h>
//Qt
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
//----------------------------------------------------------------------------
SymbolDataToRender::SymbolDataToRender(const QString &_sidc, int _sizeL)
{
init();
sidc = _sidc;
sizeL = _sizeL;
}
void SymbolDataToRender::init()
{
sidc.clear();
role = Role::Unknown;
sizeL = 100;
fillColor = Qt::magenta;
fillColorReplace = false;
marking = false;
injury = Injury::NoInjury; // NoInjury, Hit, MobilityKill, WeaponKill, TotalKill
injuryColor = Qt::gray;
additionalSymbols.clear();
spiOriginalKey.clear();
spiSizeL = 100;
renderJustCoreImage = false;
}
QString SymbolDataToRender::sidcAccordingRole() const
{
if (!SidcCodec::isEncoded(sidc))
return sidc;
const SymbologyType symType = SidcCodec::decodeSymbologyType(sidc);
if ((symType != SymbologyType::MIL2525D) && (symType != SymbologyType::APP6D))
return sidc;
AdvancedSymbology::SidcBuilder sidcBuilder(&AdvancedSymbology::SymbolDictionary::dictionary(symType));
if (!sidcBuilder.setSidc(sidc))
return sidc;
sidcBuilder.setIdentity(static_cast<SidcDefinitions::Identity>(role)); // This works just for MIL2525D, APP6D symbols...
// // This works just for MIL2525D symbols :
// QString sidcToBeModified = sidc;
// sidcToBeModified.replace(13, 1, QString::number((int)role)); // enum role is (at least now) identical to Identity
// // : This works just for MIL2525D symbols
return sidcBuilder.toSidc();
}
bool SymbolDataToRender::operator==(const SymbolDataToRender &o) const
{
return sidc == o.sidc &&
role == o.role &&
sizeL == o.sizeL &&
fillColor == o.fillColor &&
fillColorReplace == o.fillColorReplace &&
marking == o.marking &&
injury == o.injury &&
injuryColor == o.injuryColor &&
additionalSymbols == o.additionalSymbols;
}
bool SymbolDataToRender::operator!=(const SymbolDataToRender &o) const
{
return !operator ==(o);
}
//-----------------------------------------------------------------------------
QString toString(AdditionalSymbolType value)
{
switch (value)
{
case AdditionalSymbolType::BiteError:
return QLatin1String("BiteError");
case AdditionalSymbolType::Manipulation:
return QLatin1String("Manipulation");
case AdditionalSymbolType::NoPosition:
return QLatin1String("NoPosition");
case AdditionalSymbolType::NbcProtection:
return QLatin1String("NbcProtection");
} // switch
return QLatin1String("additionalSymbolTypeToStringERROR");
}
std::ostream &operator<<(std::ostream &stream, const AdditionalSymbolType &value)
{
stream << toString(value);
return stream;
}
std::ostream &operator<<(std::ostream &stream, const AdditionalSymbolTypeCont &value)
{
stream << "AST_Cont(" << value.size() << ") ";
for (const AdditionalSymbolType &item : value)
stream << toString(item) << ";";
return stream;
}
//-----------------------------------------------------------------------------
QString toString(Injury value)
{
switch (value)
{
case Injury::NoInjury:
return QLatin1String("NoInjury");
case Injury::Hit:
return QLatin1String("Hit");
case Injury::MobilityKill:
return QLatin1String("MobilityKill");
case Injury::WeaponKill:
return QLatin1String("WeaponKill");
case Injury::TotalKill:
return QLatin1String("TotalKill");
} // switch
return QLatin1String("InjuryToStringERROR");
}
std::ostream &operator<<(std::ostream &stream, const Injury &value)
{
stream << toString(value);
return stream;
}
std::ostream &operator<<(std::ostream &stream, const SymbolDataToRender &value)
{
stream << value.toString().constData();
return stream;
}
QString SymbolDataToRender::toString() const
{
QString str;
str = QStringLiteral("sidc='%1'").arg(sidc) +
QStringLiteral(" role=%1").arg(AdvancedSymbology::toString(role)) +
QStringLiteral(" sizeL=%1").arg(sizeL) +
// QStringLiteral(" lineColor=%1")).arg(lineColor.name(QColor::HexArgb)) +
QStringLiteral(" fillColor=%1").arg(fillColor.name(QColor::HexArgb)) +
QStringLiteral(" fillColorReplace=%1").arg(fillColorReplace) +
QStringLiteral(" marking=%1").arg(marking) +
QStringLiteral(" injury=%1").arg(AdvancedSymbology::toString(injury)) +
QStringLiteral(" injuryColor=%1").arg(injuryColor.name(QColor::HexArgb)) +
QStringLiteral(" spiOriginalKey=%1").arg(spiOriginalKey) +
QStringLiteral(" spiSizeL=%1").arg(spiSizeL) +
QStringLiteral(" renderJustCoreImage=%1").arg(renderJustCoreImage);
std::stringstream stream;
stream << additionalSymbols;
str += QStringLiteral(" additionalSymbols=%1").arg(QLatin1String(stream.str().c_str()));
return str;
}
} // namespace AdvancedSymbology
@@ -0,0 +1,136 @@
/**
* @RDE_HEADER@
* ViewshedParameter
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "symbol_dictionary_types.h"
#include "advanced_symbology_export.h"
// Qt
#include <QString>
#include <QColor>
#include <QSet>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
//----------------------------------------------------------------------------
/**
* @brief The AdditionalSymbolType enum
*/
enum class AdditionalSymbolType
{
NbcProtection, ///< Line at top left.
Manipulation, ///< Black and white dashed lines at bottom (1st of three)
NoPosition, ///< Red line at bottom (2nd of three)
BiteError ///< Yellow line at bottom. (3rd of three)
};
QString ADVANCED_SYMBOLOGY_EXPORT toString(AdditionalSymbolType);
// enable usage as key (e.g. QSet<AdditionalSymbolType>)
inline uint qHash(AdditionalSymbolType type)
{
return ::qHash(static_cast<int>(type));
}
using AdditionalSymbolTypeCont = QSet<AdditionalSymbolType>;
//----------------------------------------------------------------------------
/**
* @brief The injury enum
*/
enum class Injury
{
NoInjury, ///< ""
Hit, ///< "-"
MobilityKill, ///< "\"
WeaponKill, ///< "/"
TotalKill ///< "/\"
};
QString toString(Injury value);
//----------------------------------------------------------------------------
/**
* @brief The SymbolDataToRender struct contains all data usefull to render
* an advanced symbol.
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolDataToRender
{
public:
explicit SymbolDataToRender(const QString &_sidc = QString(), int _sizeL = 100);
void init();
QString sidcAccordingRole() const;
public:
QString sidc;
Role role;
int sizeL;
// QColor lineColor = Qt::black; // not supported by esri yet
QColor fillColor;
bool fillColorReplace;
bool marking;
Injury injury;
QColor injuryColor;
AdditionalSymbolTypeCont additionalSymbols; // noPos, Manip...
static QColor unknownColor()
{
return QColor(255, 255, 0); // 10012500002108000000@Mil2525D: color = QColor(255, 255, 0);
}
QString toString() const;
bool operator==(const SymbolDataToRender &o) const;
bool operator!=(const SymbolDataToRender &o) const;
// just for internal use :
friend class SymbolDictionaryImpl;
friend class EsriDictionaryProcessor;
private:
QString spiOriginalKey; // spi = symbolPropertyImage
int spiSizeL = 100; // spi = symbolPropertyImage
bool renderJustCoreImage = false;
// : just for internal use
};
//-----------------------------------------------------------------------------
// output operator:
//-----------------------------------------------------------------------------
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::AdditionalSymbolType &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::AdditionalSymbolTypeCont &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::Injury &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::SymbolDataToRender &value);
} // namespace AdvancedSymbology
@@ -0,0 +1,49 @@
/**
* @RDE_HEADER@
* ViewshedParameter
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include <Symbology/symbol_dictionary_types.h>
// Qt
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
// forwarding of enum which is declared within a class is not possible:
// enum class ParticipantManagement::Role;
template<class PARTICIPANT_ROLE_TYPE = ParticipantManagement::Role>
AdvancedSymbology::Role roleToRole(const PARTICIPANT_ROLE_TYPE role)
{
switch (role.underlying())
{
case ParticipantManagement::Role_def::Unknown:
return AdvancedSymbology::Role::Unknown;
case ParticipantManagement::Role_def::Friend:
return AdvancedSymbology::Role::Friend;
case ParticipantManagement::Role_def::Neutral:
return AdvancedSymbology::Role::Neutral;
case ParticipantManagement::Role_def::Enemy:
return AdvancedSymbology::Role::HostileFaker;
case ParticipantManagement::Role_def::Pending:
return AdvancedSymbology::Role::Pending;
case ParticipantManagement::Role_def::AssumedFriend:
return AdvancedSymbology::Role::AssumedFriend;
case ParticipantManagement::Role_def::Suspect:
return AdvancedSymbology::Role::SuspectJoker;
} // switch
return AdvancedSymbology::Role::Unknown;
}
} // namespace AdvancedSymbology
@@ -0,0 +1,242 @@
/**
* @RDE_HEADER@
* Interface of SymbolDictionary
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "symbol_dictionary.h"
#include <Common/resource_path.h>
#include <SymbologyImpl/symbol_dictionary_impl.h>
#include "sidc_codec.h"
// Qt
#include <QCoreApplication>
#include <QMap>
#include <QProcessEnvironment>
void initResource()
{
Q_INIT_RESOURCE(symbols);
}
namespace AdvancedSymbology
{
bool SymbolDictionary::doParanoiaChecks()
{
static bool s_read = false;
static bool s_doParanoiaChecks = false;
if (!s_read)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString val = env.value(QStringLiteral("DO_SITMAP_CHECKS"), QStringLiteral("1"));
s_read = true;
s_doParanoiaChecks = (val.compare(QStringLiteral("1"))==0);
if (s_doParanoiaChecks)
qCritical() << " paranoiaChecks are ON (via DO_SITMAP_CHECKS)";
else
qCritical() << " paranoiaChecks are OFF (via DO_SITMAP_CHECKS)";
}
return s_doParanoiaChecks;
}
static QMap<SymbologyType, QString> &s_symbologyResourcePaths()
{
static QMap<SymbologyType, QString> map;
return map;
} // QMap<SymbologyType, QString> &s_symbologyResourcePaths()
static QMap<SymbologyType, SymbolDictionary *> &s_symbologyDictionaries()
{
static QMap<SymbologyType, SymbolDictionary *> map;
return map;
} // QMap<SymbologyType, SymbolDictionary *> &s_symbologyDictionaries
static void cleanupDictionary()
{
qDeleteAll(s_symbologyDictionaries());
s_symbologyDictionaries().clear();
}
bool SearchParameters::isEmpty() const
{
return keys.isEmpty() &&
names.isEmpty() &&
categories.isEmpty() &&
symbolClasses.isEmpty() &&
tags.isEmpty();
}
int SearchParameters::numberOfParameter() const
{
int count = 0;
if (!keys.isEmpty()) ++count;
if (!names.isEmpty()) ++count;
if (!categories.isEmpty()) ++count;
if (!symbolClasses.isEmpty()) ++count;
if (!tags.isEmpty()) ++count;
return count;
}
SymbolDictionary::SymbolDictionary(QObject *parent)
: QObject(parent)
{
LOGGER_T m_logger = getLogger("SymbolDictionary");
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
initResource();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
static SymbologyType _defaultSymbologyType = SymbologyType::None;
SymbologyType SymbolDictionary::defaultSymbologyType()
{
return _defaultSymbologyType;
} // SymbologyType SymbolDictionary::defaultSymbologyType()
void SymbolDictionary::setDefaultSymbologyType( SymbologyType symbologyType )
{
if (SymbologyType::None == _defaultSymbologyType)
{
// set default only once
_defaultSymbologyType = symbologyType;
}
} // void SymbolDictionary::setDefaultSymbologyType( SymbologyType symbologyType )
QString SymbolDictionary::initializeSymbologyResourcePath(SymbologyType symbologyType)
{
LOGGER_T m_logger = getLogger("SymbolDictionary");
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " symbologyType=" << symbologyType;
if (s_symbologyResourcePaths()[symbologyType].isEmpty())
{
#ifdef USE_ARCADE_SYMBOLOGY
QString finalSymbologyResourcePath = SituationMap::getResourcePath() + QLatin1String("symbols_arcade/");
#else
QString finalSymbologyResourcePath = SituationMap::getResourcePath() + QLatin1String("symbols/");
#endif // USE_ARCADE_SYMBOLOGY
switch (symbologyType)
{
case AdvancedSymbology::SymbologyType::MIL2525D:
finalSymbologyResourcePath.append(QLatin1String("mil2525d/mil2525d.stylx")); // like /arcgis/runtime_sdk/qt100.0/resources/symbols/mil2525d/mil2525d.stylx
break;
case AdvancedSymbology::SymbologyType::MIL2525C:
finalSymbologyResourcePath.append(QLatin1String("mil2525c_b2/mil2525c_2b.stylX"));
break;
case AdvancedSymbology::SymbologyType::APP6B:
finalSymbologyResourcePath.append(QLatin1String("app6b/app6b.stylx"));
break;
case AdvancedSymbology::SymbologyType::APP6D:
finalSymbologyResourcePath.append(QLatin1String("app6d/app6d.stylx"));
break;
case AdvancedSymbology::SymbologyType::None:
finalSymbologyResourcePath.clear();
break;
} // switch
s_symbologyResourcePaths()[symbologyType] = finalSymbologyResourcePath;
}
DEBUG_LOG(m_logger) << LOGFUNCTION << " dict of type/path:"
<< " symbologyType=" << symbologyType
<< ", symbologyResourcePath='" << s_symbologyResourcePaths()[symbologyType] << "'";
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< " symbologyType=" << symbologyType
<< ", symbologyResourcePath='" << s_symbologyResourcePaths()[symbologyType] << "'";
return s_symbologyResourcePaths()[symbologyType];
}
SymbolDictionary &SymbolDictionary::dictionary(SymbologyType symbologyType)
{
LOGGER_T m_logger = getLogger("SymbolDictionary");
TRACE_LOG(m_logger) << LOGFUNCTION << " START"
<< " symbologyType=" << symbologyType;
if (!s_symbologyDictionaries().contains(symbologyType))
{
// store and get final path:
const QString &resPath = initializeSymbologyResourcePath(symbologyType);
// Do NOT removed this message!!!
NOTICE_LOG(m_logger) << LOGFUNCTION << " dictionary path: '" << resPath << "'"
<< ", symbologyType " << symbologyType;
// Do NOT removed this message!!!
// create dict:
AdvancedSymbology::SymbolDictionaryImpl *dict =
new AdvancedSymbology::SymbolDictionaryImpl(symbologyType, resPath);
// store dict:
s_symbologyDictionaries()[symbologyType] = dict;
qAddPostRoutine(cleanupDictionary);
}
TRACE_LOG(m_logger) << LOGFUNCTION << " END"
<< " symbologyType=" << symbologyType;
return *(s_symbologyDictionaries()[symbologyType]);
}
bool SymbolDictionary::alreadyExists(SymbologyType symbologyType)
{
return s_symbologyDictionaries().contains(symbologyType);
}
QImage SymbolDictionary::temporaryImage(int sizeL)
{
return SymbolDictionaryImpl::temporaryImage(sizeL);
}
void cleanupSymbolDictionaryInternal()
{
LOGGER_T m_logger = getLogger("SymbolDictionary");
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
cleanupDictionary();
if (! s_symbologyDictionaries().isEmpty())
FATAL_LOG(m_logger) << LOGFUNCTION << " s_symbologyDictionaries NOT empty";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
} // namespace AdvancedSymbology
@@ -0,0 +1,418 @@
/**
* @RDE_HEADER@
* Interface of SymbolDictionary
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include "property_result.h"
#include "symbol_result.h"
#include "../SymbologyXML/symbol.h"
// Qt
#include <QImage>
#include <QString>
#include <QStringList>
// Forward
class QValidator;
# include <arcgis/arcgisversion.h> // This file is created by RME, not ESRI
#if ACRGIS_VERSION >= 0x640600 // 100.6.0 / Update 6
//# define USE_ARCADE_SYMBOLOGY
#endif
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
/**
* @brief The SymbolDictionary class is the main class in this namespace.
* \section secCommon Common
* To create an instance
* - use static method SymbolDictionary::dictionary() (one instance per AdvancedSymbology::SymbologyType).
* - load the dictionary (on finish the signal loaded is emitted.)
*
* To support symbol independent from an official symbology standard you can add extra symbols: insertExtraSymbol.
*
* To get symbol information there are different approaches: search, find and fetch \n
* - searchSymbol() is looking for symbol by defining some strings or stringLists as definded at SearchParameters. \n
* The result contains one or more SymbolProperties in a list (SymbolPropertyList)
*
* - find... to get an QImage
* - findImage(), findPreview() is looking using a complete sidc. \n
* \sa \ref secfindImageExplanation
*
* - findBaseSymbol() is looking using the baseSymboCode (SymbolSet and Entity). \n
* If a abtract symbol is requested the first overload should be used. \n
*
* - fetchSymbol() is looking using a complete sidc for internal use. \n
*
* Most methods are using the future pattern.
* The result value (like PropertyResult and SymbolResult) will contain the real result - when available.
* To get a (ready)signal, a propper watcher is prepared: PropertyResultWatcher or SymbolResultWatcher.
*
* This is explained at the base class ResultWatcher.
*
*
* \section secfindImageExplanation Use proper find method
*
* There are following use cases:
*
* - PlayerInfoWindow \n
* PointSymbol with frame, modifier, injury; multiPointSymbol (maybe with concrete geometry) \n
* (THE tank of a concrete party/color with concrete modifier, injury...)
*
* - PlayerTree (SymbolSelectionDlg) \n
* (A tank of party 'Unknown', (with modifier like platoon, but no space for injury))
*
* - Favourites at PlanEditor \n
* (A tank, no party (black - just the baseSymbol)
*
* To get a suitable image for your use case youd should pay attention to following table:
*
| UseCase | Method | SinglePointSymbol | MultiPointSymbol |
| :----------------------------------------------------| : ---------------| : ---------------------------|: ------------------- |
| concrete Obj with partyColor,Frame,Modifier, Injury | findImage() | fetch | lookupTable (search) |
| abstract Obj with Frame (Unknown) | findPreview() | fetch | lookupTable (search) |
| abstract Obj without Frame/Modifier | findBaseSymbol() | lookupTable (search) | lookupTable (search) |
* (lookupTable == m_baseSymbolCodeToSymbolPropertyTable & m_originalKeyToEsriSymbol)
*
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolDictionary : public QObject
{
Q_OBJECT
public:
static bool doParanoiaChecks();
protected:
/*! \name Construction, Destruction */
//@{
/**
* @brief Constructor.
* @param parent
*/
explicit SymbolDictionary(QObject *parent = nullptr);
public:
/**
* @brief Initialize the SymbologyResourcePath.
* @param symbologyType Type of symbology to initialize.
* @return resulting symbologyResourcePath
*/
static QString initializeSymbologyResourcePath(SymbologyType symbologyType);
/**
* @brief Get access to dictionary of a SymbologyType (singleton per SymbologyType)
* @param symbologyType The SymbologyType the Dictionary should base on.
* @param symbologyResourcePath ResourcePath to be set (e.g. /opt/EXTFW/resources/symbols/app6b).
* @return Reference to requested SymbolDictionary.
*/
static SymbolDictionary &dictionary(SymbologyType symbologyType);
/**
* @brief Does the requested SymbolDictionary already exists?
* @param symbologyType requested SymbologyType
* @return true if already existing, otherwise false
*/
static bool alreadyExists(SymbologyType symbologyType);
/**
* @brief Provide default SymbologyType
*/
static SymbologyType defaultSymbologyType();
/**
* @brief Defines default SymbologyType. Is been called while situation map is loading map settings.
* @param symbologyType SymbologyType to set as default
*/
static void setDefaultSymbologyType( SymbologyType symbologyType );
/**
* Returns state of dictionary. In case of failure the return value is false and in other case true.
*/
virtual bool isOk() const = 0;
/**
* @brief load
* Object can load data asynchronously.
* Call load() to initiate loading.
* If loading has finished the signal loaded is emitted.
*/
virtual void load() = 0;
/**
* @brief Information about Loading.
* @return true if loaded, otherwise false.
*/
virtual bool isLoaded() const = 0;
/**
* @brief Get current loadStatus
* @return
*/
virtual LoadStatus loadStatus() const = 0;
virtual ~SymbolDictionary() = default; ///< Destructor
//@}
/** \name Ets symbols
* To support symbol independent from an official symbology standard you can add ets symbols:
*/
//@{
/**
* @brief Insert (add/update) (own) ETS symbol to dictionary.
* @param sidc Symbol Id Code to add. If sidc is already in use, the entry (properties and image) is updated.
* @param properties To be associated to sidc.
* @param image To be associated to sidc.
* @return True on success, otherwise false.
*/
virtual bool setEtsSymbol(int fileId,
const QString &sidc,
const SymbolProperties &properties,
const QImage &image) = 0;
///< remove Extra symbol
virtual void removeEtsSymbol(int fileId) = 0;
virtual void removeEtsSymbol(const QString &sidc) = 0;
///< clear all Extra symbols
virtual void clearEtsSymbols() = 0;
///< add complete directory recursively with Extra symbols.
virtual int addEtsSymbols(const QString &path = QString()) = 0;
///< complete list of all Extra symbols.
virtual QStringList etsSymbols() const = 0;
/**
* @brief Number of Extra symbols
* @return number of Extra symbols
*/
virtual int etsSymbolCount() const = 0;
//@}
/** \name Xml symbols
* To support symbol independent from ESRI symbology standard you can add symbols base on symbol editor XML based format
*/
//@{
virtual bool containsXmlSymbol(const QString &sidc) const = 0; /**< Returns true in case of symbol is in dictionary, otherwise false. */
virtual bool setXmlSymbol(int fileId, const QString &name, const QString &operatorName, qint64 lastModified, const QString &xmlSymbol, const SymbolProperties &properties) = 0; /**< Inserts (add/update) a symbol from XML format and returns true on success. */
virtual bool setXmlSymbol(int fileId, const QString &name, const QString &operatorName, qint64 lastModified, const SymbologyXML::Symbol &symbol, const SymbolProperties &properties) = 0; /**< Inserts (add/update) a symbol from SymbologyXML::Symbol and returns true on success. */
virtual void removeXmlSymbol(int fileId) = 0; /**< Remove symbol from dictionary */
virtual void removeXmlSymbol(const QString &sidc) = 0; /**< Remove symbol from dictionary */
virtual void clearXmlSymbols() = 0; /**< Remove all symbols from dictionary */
virtual void clearXmlSymbolCache() = 0; /**< Clear internal Cache for XML-Symbols */
virtual int xmlSymbolCount() const = 0; /**< Pass back the number of XML symbols in dictonary */
virtual QStringList xmlSymbols() const = 0; /**< Returns a list of all XML symbol sidc's in dictionary */
virtual QString xmlSidc(const QString &xmlSymbol) const = 0; /**< Returns the sidc of a symbol */
virtual QString xmlSidc(const SymbologyXML::Symbol &symbol) const = 0; /**< Returns the sidc of a symbol */
virtual SymbologyXML::Symbol xmlSymbol(const QString &sidc) const = 0; /**< Pass back the SymbologyXML::Symbol of sidc */
virtual SymbolProperties xmlSymbolProps(const QString &sidc) const = 0; /**< Pass back the SymbolProperties of sidc */
//@}
public:
SymbolDictionary(const SymbolDictionary &other) = delete;
SymbolDictionary &operator=(const SymbolDictionary &other) = delete;
virtual SymbologyType symbologyType() const = 0;
virtual QString specificationType() const = 0;
virtual QString symbologyResourcePath() const = 0;
virtual int symbologySpecificCount() const = 0;
static QImage temporaryImage(int sizeL = 100);
/**
* @brief Get all known attribute keys which are interpreted by rendering process
*/
virtual QStringList symbologyAttributeKeyList() const = 0;
/** \name Search */
//@{
/**
* @brief Get a list of all cached symbol codes
*/
virtual QStringList cachedBaseSymbolCodes() const = 0;
/**
* @brief Get properties (like geometry) of one symbol.
* @param baseSymbolCode like '25270100' (2 digits symbol set and 6 digits entity), see SymbolProperties::concreteSidcToBaseSymbolCode
* @return SymbolProperties
* @see SymbolProperties
*/
virtual SymbolProperties symbolProperties(const QString &baseSymbolCode) const = 0;
virtual QSharedPointer<SymbolResult> symbolPropertyImage(const SymbolProperties &symbolProperties, int sizeL = 100) const = 0;
//@}
/*! \name Render symbol: findImage, findPreview, findBaseSymbol*/
//@{
/**
* @brief findImage returns a 'concrete' symbol containing mainIcon, frame, echelon, noPosition etc.
* This is also valid for extraSymbols.
* @param symDataToRender data to render
* @return Instance of class SymbolResult (based on the FuturePattern).
* @internal fullImage containing a coreImage and additionalSymbols
*/
virtual QSharedPointer<SymbolResult> findImage(const SymbolDataToRender &symDataToRender) const = 0;
/**
* @brief findPreview returns an 'abstract' / 'typical' symbol containing mainIcon and frame but no echelon noPosition etc.
* This is also valid for extraSymbols.
* @param sidc sidc to render
* @param sizeL referenceSize to render
* @return Instance of class SymbolResult (based on the FuturePattern).
*/
virtual QSharedPointer<SymbolResult> findPreview(const QString &sidc, int sizeL = 100) const = 0;
/**
* @brief findBaseSymbol returns an 'abstract' / 'typical' symbol containing the and nothing more.
* @param sidc_8or20chars sidc to render
* @return Instance of class SymbolResult (based on the FuturePattern).
*/
virtual QSharedPointer<SymbolResult> findBaseSymbol(const QString &sidc_8or20chars) const = 0;
//@}
/*! \name Fetch
* Similar to findImage, except that fetchSymbol returns a different baseSymbolIcon for multiPoint sidcs.
* In most cases you should prefer findImage, findPreview, findBaseSymbol
*/
//@{
/**
* @brief fetchSymbol for abstract symbols. Use a sidc a input
* Similar to findImage, except that fetchSymbol returns a different baseSymbolIcon for multiPoint sidcs.
* @param sidc to find
* @param sizeL specify the reference size. Named 'L' within the standard.
* @return Instance of class SymbolResult (based on the FuturePattern).
*/
virtual QSharedPointer<SymbolResult> fetchSymbol(const QString &sidc, int sizeL = 100) const = 0;
/**
* @brief fetchSymbol for concrete symbols. Use a sidc a input as well a specific color, injury...
* Similar to findImage, except that fetchSymbol returns a different baseSymbolIcon for multiPoint sidcs.
* @param symDataToRender specify the render hints.
* @return Instance of class SymbolResult (based on the FuturePattern).
*/
virtual QSharedPointer<SymbolResult> fetchSymbol(const SymbolDataToRender &symDataToRender) const = 0;
//@}
/*! \name Handling symbol modifier */
//@{
/**
* @brief Provides a list of all modifier keys
*/
virtual QStringList symbolModifierKeys() const = 0;
/**
* @brief Get modifier data according to a modifier key
* @param key One modifier key returned from symbolModifierKeys()
* @param modifierData Reference to return symbol set of the modifier
* @return true on success in other case false
*/
virtual bool symbolModifierData(const QString &key, ModifierData &data) const = 0;
/**
* @brief Provides a list of all modifiers matching to a symbolSet
* @param symbolSet symbol set
* @param modifierSector sector of the modifier, range of values [1,2]
* @see SymbolSet
*/
virtual QList<ModifierData> symbolModifierList(SidcDefinitions::SymbolSet symbolSet, unsigned int modifierSector) const = 0;
/**
* @brief Overloads the function symbolModifierList( SymbolSet ... ) to provide a list of all modifiers matching to a symbol. The symbol set is
* determined from baseSymbolCode
* @param baseSymbolCode baseSymbolCode like '25270100' (2 digits symbol set and 6 digits entity), see SymbolProperties::concreteSidcToBaseSymbolCode
* @param modifierSector sector of the modifier, range of values [1,2]
* @see SymbolProperties
*/
virtual QList<ModifierData> symbolModifierList(const QString &baseSymbolCode, unsigned int modifierSector) const = 0;
//@}
// virtual QValidator *buildSidcPatternValidator(QObject *parent) const = 0;
/**
* @brief Test one XML symbol
*/
virtual bool insertXmlTestSymbol(const SymbolProperties &symbolProps) = 0;
virtual bool insertXmlComplexTestSymbol(const SymbolProperties &symbolProps) = 0;
//-------------------------------
virtual int count() const = 0;
// virtual const QStringList &sidcList() const = 0;
/**
* @brief createSidc in: abtract sidc, out: concrete sidc:
* @param sidc_inOut
* @param identity
* @param state
*/
// virtual void createSidc(QString &sidc_inOut,
// SymbolTypes::t_affil identity, // friend, neutral... (position 2)
// SymbolTypes::t_state state) const = 0; // present, anticipated (position 4)
// virtual bool contains(const QString &sidc) const = 0;
// virtual SymbolProperties symbolProperties(const QString &sidc) = 0;
// virtual int minNumberOfPoints(const QString &sidc) = 0;
virtual QString toString() const = 0;
Q_SIGNALS:
/// Signal emits when content changed
void changed();
void changedDelayed(); // to avoid multiple signals (delayed for ~500ms)
/// Signal emits when dictionay is loaded
void loaded();
};
void cleanupSymbolDictionaryInternal();
} // namespace AdvancedSymbology
@@ -0,0 +1,175 @@
/**
* @RDE_HEADER@
* Type definition of namespace AdvancedSymbology
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbology_type.h"
#include "sidc_definitions.h"
// Qt
#include <QColor>
#include <QImage>
#include <QPixmap>
class QValidator;
class QUuid;
//----------------------------------------------------------------------------
/**
* Support Advanced Symbology (MIL2525D).
* Some extensions like injury/damage are added to the standard.
* (It is related to SituationMap, but is an independent library.)
*/
namespace AdvancedSymbology
{
//----------------------------------------------------------------------------
enum class Role
{
Pending, ///< 0
Unknown, ///< 1
AssumedFriend, ///< 2
Friend, ///< 3
Neutral, ///< 4
SuspectJoker, ///< 5
HostileFaker ///< 6
};
QString ADVANCED_SYMBOLOGY_EXPORT toString(AdvancedSymbology::Role);
/**
* @brief Enumerates possible load status for a resource (like Dictionary).
*/
enum class LoadStatus
{
Loaded = 0,
Loading = 1,
FailedToLoad = 2,
NotLoaded = 3,
Unknown = -1
};
QString ADVANCED_SYMBOLOGY_EXPORT toString(LoadStatus type);
/**
* @brief Define GeometryType
*/
enum class GeometryType
{
Undefined,
Point,
Polyline,
Polygon
};
inline uint qHash(GeometryType t, uint seed)
{
return ::qHash(static_cast<int>(t), seed);
}
QString ADVANCED_SYMBOLOGY_EXPORT toString(GeometryType gt);
/**
* @brief Constructor.
* @param requested geometry type
* @return min number of points for geometry type
* @note point -> 1 ; line -> 2 ; polygone -> 3
*/
int minNumberOfPoints(GeometryType gt);
/**
* @brief The SearchParameters struct is used for the method searchSymbol.
*/
struct SearchParameters
{
QStringList keys;
bool keysStrictMatch = false;
QStringList names;
bool namesStrictMatch = false;
QStringList categories;
bool categoriesStrictMatch = false;
QStringList symbolClasses;
bool symbolClassesStrictMatch = false;
QStringList tags;
bool tagsStrictMatch = false;
bool isEmpty() const;
int numberOfParameter() const;
};
/**
* @brief The SymbolImage class
* @note QImage has implicit data sharing :-)
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolImage
{
public:
bool isValid() const
{
return m_isValid;
}
void setValid(bool valid)
{
m_isValid = valid;
}
void setImage(const QImage &img)
{
m_image = img;
}
const QImage &image() const
{
return m_image;
}
void reset()
{
m_isValid = false;
m_image = QImage();
}
private:
bool m_isValid = false;
QImage m_image;
// HotSpot can added if required :-)
};
//-----------------------------------------------------------------------------
// output operator:
//-----------------------------------------------------------------------------
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::Role &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::LoadStatus &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::SymbologyType &value);
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::GeometryType &value);
} // namespace AdvancedSymbology
#include "symbol_data_to_render.h"
@@ -0,0 +1,156 @@
/**
* @RDE_HEADER@
* SymbolProperties
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "symbol_properties.h"
#include <SymbologyImpl/advanced_symbology_logging.h> // to get operator<< (std::ostream& stream, const QString& string_ref)
// ESRI
// Qt
#include <QStringRef>
namespace AdvancedSymbology
{
QString SymbolProperties::key() const
{
return m_key;
}
void SymbolProperties::setKey(const QString &key)
{
m_key = key;
}
QString SymbolProperties::name() const
{
return m_name;
}
void SymbolProperties::setName(const QString &name)
{
m_name = name;
}
QString SymbolProperties::category() const
{
return m_category;
}
void SymbolProperties::setCategory(const QString &category)
{
m_category = category;
}
QString SymbolProperties::symbolClass() const
{
return m_symbolClass;
}
void SymbolProperties::setSymbolClass(const QString &symbolClass)
{
m_symbolClass = symbolClass;
}
QStringList SymbolProperties::tags() const
{
return m_tags;
}
QString SymbolProperties::gctString() const
{
for (const QString &tag : m_tags)
{
if (tag.startsWith(QLatin1String("gct_")))
return tag;
} // foreach
return QString();
}
void SymbolProperties::setTags(const QStringList &tags)
{
m_tags = tags;
}
GeometryType SymbolProperties::geometryType() const
{
return m_geometryType;
}
void SymbolProperties::setGeometryType(const GeometryType &geometryType)
{
m_geometryType = geometryType;
}
QString SymbolProperties::sidc() const
{
return m_sidc;
}
void SymbolProperties::setSidc(const QString &sidc)
{
m_sidc = sidc;
}
QString SymbolProperties::originalKey() const
{
return m_originalKey;
}
void SymbolProperties::setOriginalKey(const QString &originalKey)
{
m_originalKey = originalKey;
}
QString SymbolProperties::key_SymbolSet() const
{
if (m_key.count() < 8)
return QString();
return QStringRef(&m_key, 0, 2).toString();
}
QString SymbolProperties::key_Entity() const
{
if (m_key.count() < 8)
return QString();
return QStringRef(&m_key, 2, 6).toString();
}
QString SymbolProperties::key_SymbolSetEntity() const
{
if (m_key.count() < 8)
return QString();
return key_SymbolSet() + key_Entity();
}
QColor SymbolProperties::colorToBeReplaced() const
{
return m_colorToBeReplaced;
}
void SymbolProperties::setColorToBeReplaced(const QColor &colorToBeReplaced)
{
m_colorToBeReplaced = colorToBeReplaced;
}
//-----------------------------------------------------------------------------
} // namespace AdvancedSymbology
@@ -0,0 +1,145 @@
/**
* @RDE_HEADER@
* SymbolProperties
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
// Qt
#include <QStringList>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
/**
* @brief The SymbolProperties class stores some symbol properties like name, keywords etc.
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolProperties
{
public:
SymbolProperties() = default;
// TODO: sidc: lowerCase vs. upperCase
/*! \name Basic functions*/
//@{
QString key() const;
void setKey(const QString &key);
QString name() const;
void setName(const QString &name);
QString category() const;
void setCategory(const QString &category);
QString symbolClass() const;
void setSymbolClass(const QString &symbolClass);
QStringList tags() const;
QString gctString() const;
void setTags(const QStringList &tags);
GeometryType geometryType() const;
void setGeometryType(const GeometryType &geometryType);
QString sidc() const;
void setSidc(const QString &sidc);
//@}
QString originalKey() const;
void setOriginalKey(const QString &originalKey);
/*! \name Convenience functions*/
//@{
QString key_SymbolSet() const;
QString key_Entity() const;
QString key_SymbolSetEntity() const;
//@}
/*! \name ColorToBeReplaced
* \note Some symbols (like ETS symbols) may have a certain color.
* This is to be replaced by concrete partyColor */
//@{
/**
* @brief colorToBeReplaced
* @return colorToBeReplaced
*/
QColor colorToBeReplaced() const;
/**
* @brief setColorToBeReplaced
* @param colorToBeReplaced
*/
void setColorToBeReplaced(const QColor &colorToBeReplaced);
//@}
// int minNumberOfPoints() const;
/**
* @brief operator== Compare two objects
* @param other to be compared with
* @return true if identical, otherwise false.
*/
bool operator==(const SymbolProperties &other) const
{
return ((this->m_key == other.m_key) &&
(this->m_name == other.m_name) &&
(this->m_category == other.m_category) &&
(this->m_symbolClass == other.m_symbolClass) &&
(this->m_tags == other.m_tags) &&
(this->m_geometryType == other.m_geometryType) &&
(this->m_sidc == other.m_sidc) &&
(this->m_originalKey == other.m_originalKey) &&
(this->m_colorToBeReplaced == other.m_colorToBeReplaced)
);
}
/**
* @brief operator!= Compare two objects
* @param other to be compared with
* @return true if NOT identical, otherwise false.
*/
bool operator!=(const SymbolProperties &other) const
{
return !(*this == other);
}
private :
QString m_key;
QString m_name;
QString m_category;
QString m_symbolClass;
QStringList m_tags;
GeometryType m_geometryType = GeometryType::Undefined;
QString m_sidc;
QString m_originalKey;
QColor m_colorToBeReplaced; // color of ETS symbols to be replaced by concrete partyColor
};
//-----------------------------------------------------------------------------
// output operator:
//-----------------------------------------------------------------------------
} // namespace AdvancedSymbology
@@ -0,0 +1,279 @@
/**
* @RDE_HEADER@
* Class SymbolResult
* $Id$
* $HeadURL$
* $Author$
*/
// Own
#include "symbol_result.h"
// Qt
#include <QUuid>
#include <QComboBox>
#include <QFutureWatcher>
#include <QTimer>
namespace AdvancedSymbology
{
class SymbolResult::Private
{
public:
Private() = default;
~Private() = default;
// Input data:
SymbolDataToRender m_symDataToRender;
// process data:
QUuid m_taskIdFindSymbol; // of esriDict::findSymbol
QFutureWatcher<QImage> m_futureWatcher;
bool m_isReady = false;
// Result data:
GeometryType m_geometryType = GeometryType::Undefined;
SymbolImage m_symbolImage;
// For debugging:
static unsigned long m_counter;
};
unsigned long SymbolResult::Private::m_counter = 0;
SymbolResult::SymbolResult()
: QObject()
, d(new Private)
, m_logger(getLogger("SymbolResult"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START, m_counter=" << d->m_counter;
++Private::m_counter;
connect(&d->m_futureWatcher, &QFutureWatcherBase::finished, this, &SymbolResult::onFinished);
TRACE_LOG(m_logger) << LOGFUNCTION << " END, m_counter=" << d->m_counter;
}
SymbolResult::~SymbolResult()
{
LOGGER_T m_logger = getLogger("SymbolResult");
TRACE_LOG(m_logger) << LOGFUNCTION << " START, m_counter=" << d->m_counter;
--Private::m_counter;
d->m_futureWatcher.disconnect(this);
d->m_futureWatcher.cancel();
d->m_futureWatcher.waitForFinished();
delete d;
TRACE_LOG(m_logger) << LOGFUNCTION << " END, m_counter=" << Private::m_counter;
}
void SymbolResult::onFinished()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
const QImage &image = d->m_futureWatcher.future().result();
d->m_symbolImage.setImage(image);
d->m_symbolImage.setValid(true);
fireResultReady();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
void SymbolResult::fireResultReady()
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
d->m_isReady = true; // Future can`t manually be set to 'ready' :-(
emit resultReadyInternal();
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
void SymbolResult::setSymbolDataToRender(const SymbolDataToRender &symDataToRender)
{
d->m_symDataToRender = symDataToRender;
}
const SymbolDataToRender &SymbolResult::symbolDataToRender() const
{
return d->m_symDataToRender;
}
void SymbolResult::setTaskId(const QUuid &uuid)
{
d->m_taskIdFindSymbol = uuid;
}
const QUuid &SymbolResult::taskId() const
{
return d->m_taskIdFindSymbol;
}
void SymbolResult::setFuture(const QFuture<QImage> &future)
{
d->m_isReady = false;
d->m_futureWatcher.setFuture(future);
}
void SymbolResult::setGeometryType(GeometryType geometryType)
{
d->m_geometryType = geometryType;
}
GeometryType SymbolResult::geometryType() const
{
return d->m_geometryType;
}
void SymbolResult::setSymbolImage(const SymbolImage &symbolImage)
{
d->m_symbolImage = symbolImage;
}
SymbolImage SymbolResult::symbolImage() const
{
return d->m_symbolImage;
}
bool SymbolResult::isResultReady() const
{
// Do not or 'd->m_futureWatcher.future().isResultReadyAt(0)' will lead to timing problems
// When d->m_futureWatcher.future() is ready, the according slot will set d->m_isReady.
return d->m_isReady;
}
//------------------------------------------------------------------------------
// SymbolResultWatcher
//------------------------------------------------------------------------------
SymbolResultWatcher::SymbolResultWatcher(QObject *parent)
: BaseClass(parent)
, m_logger(getLogger("SymbolResultWatcher"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
QSharedPointer<SymbolResult> SymbolResultWatcher::symbolResult() const
{
return BaseClass::result();
}
void SymbolResultWatcher::setSymbolResult(const QSharedPointer<SymbolResult> &symbolResult)
{
BaseClass::setResult(symbolResult);
}
//------------------------------------------------------------------------------
// SymbolResultWatcherComboxBox
//------------------------------------------------------------------------------
SymbolResultWatcherComboxBox::SymbolResultWatcherComboxBox(QComboBox *comboBox, int role)
: QObject(comboBox),
m_comboBox(comboBox),
m_role(role)
{
connect(&m_watcher, &AdvancedSymbology::SymbolResultWatcher::resultReady,
this, &SymbolResultWatcherComboxBox::onResultReady);
}
void SymbolResultWatcherComboxBox::setSymbolResult(const QSharedPointer<AdvancedSymbology::SymbolResult> &symbolResult)
{
m_watcher.setSymbolResult(symbolResult);
}
void SymbolResultWatcherComboxBox::onResultReady()
{
QSharedPointer<AdvancedSymbology::SymbolResult> symResult = m_watcher.symbolResult();
if (! symResult)
return; // should NEVER happen! (Which object should have triggered the signal???)
int idx = m_comboBox->findData(QVariant::fromValue(this), m_role);
const QImage &img = symResult->symbolImage().image();
m_comboBox->setItemIcon(idx, QPixmap::fromImage(img));
if (m_enableToolTip && !img.isNull())
{
QString tooltip(QStringLiteral("<html>"));
// without a temporary file:
QByteArray baData;
QBuffer buffer(&baData);
img.save(&buffer, "PNG", 100);
tooltip.append(QStringLiteral("<center><img src='data:image/png;base64,%1'></center>").arg(QString::fromLatin1(baData.toBase64()))); // how can i center the image?
tooltip.append(QStringLiteral("</html>"));
m_comboBox->setItemData(idx, tooltip, Qt::ToolTipRole);
}
}
//------------------------------------------------------------------------------
// for convenience (QWidget)
//------------------------------------------------------------------------------
SymbolResultWatcherQWidgetBase::SymbolResultWatcherQWidgetBase(QObject *widget)
: BaseClass(widget)
{
connect(&m_watcher, &AdvancedSymbology::SymbolResultWatcher::resultReady,
this, &SymbolResultWatcherQWidgetBase::onResultReady);
}
void SymbolResultWatcherQWidgetBase::setSymbolResult(const QSharedPointer<AdvancedSymbology::SymbolResult> &symbolResult)
{
m_watcher.setSymbolResult(symbolResult);
}
QSharedPointer<SymbolResult> SymbolResultWatcherQWidgetBase::symbolResult() const
{
return m_watcher.symbolResult();
}
void SymbolResultWatcherQWidgetBase::onResultReady()
{
this->onResultReadyImpl();
emit resultReady();
}
//------------------------------------------------------------------------------
// SymbolResultWatcherLabel
//------------------------------------------------------------------------------
SymbolResultWatcherLabel::SymbolResultWatcherLabel(QLabel *label, const QSize &size)
: QObject(label)
, m_size(size)
, m_label(label)
{
connect(&m_watcher, &AdvancedSymbology::SymbolResultWatcher::resultReady,
this, &SymbolResultWatcherLabel::onResultReady);
}
void SymbolResultWatcherLabel::setSymbolResult(const QSharedPointer<AdvancedSymbology::SymbolResult> &symbolResult)
{
m_watcher.setSymbolResult(symbolResult);
}
void SymbolResultWatcherLabel::onResultReady()
{
QSharedPointer<AdvancedSymbology::SymbolResult> symResult = m_watcher.symbolResult();
if (!symResult)
return; // should NEVER happen! (Which object should have triggered the signal???)
const SymbolImage &symImage = symResult->symbolImage();
const auto dpr = m_label->devicePixelRatioF();
QImage image = symImage.image().scaled(m_size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
image.setDevicePixelRatio(dpr);
m_label->setPixmap(QPixmap::fromImage(std::move(image)));
}
} // namespace AdvancedSymbology
@@ -0,0 +1,343 @@
/**
* @RDE_HEADER@
* Class SymbolResult
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
#include "symbol_dictionary_types.h"
#include <SymbologyImpl/advanced_symbology_logging.h>
#include "result_watcher.h"
// Qt
#include <QObject>
#include <QImage>
#include <QLabel>
#include <QFuture>
#include <QSize>
#include <QBuffer>
#include <QElapsedTimer>
// forward
class QUuid;
class QComboBox;
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
/**
* @brief The SymbolResult class mainly contains a GeometryType and a SymbolImage.
* It´s based on the future pattern. So the real result can only be retrieved if
* the asynchron operation has finished (and the result is ready).
* To standardize this you should use a propper watcher: SymbolResultWatcher.
*
* \sa \ref secResultWatcherExample
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolResult : public QObject
{
Q_OBJECT
/*! \name Construction, Destruction */
//@{
public:
/**
* @brief Constructor / Destructor.
*/
explicit SymbolResult();
virtual ~SymbolResult();
//@}
/*! \name Data regarding requested */
//@{
/**
* @brief symbolDataToRender What was requested?
* @return Requested data
*/
const SymbolDataToRender &symbolDataToRender() const;
//@}
/*! \name Data regarding processing*/
//@{
/**
* @brief taskId internal taskId
* @return internal taskId
*/
const QUuid &taskId() const;
/*! \name Data regarding result*/
//@{
/**
* @brief Get geometryType of request
* @return Geometry type
*/
GeometryType geometryType() const;
/**
* @brief Get symbol image
* @return symbol image
*/
SymbolImage symbolImage() const;
//@}
bool isResultReady() const;
Q_SIGNALS:
/// This signal is for internal usage only. Use SymbolResultWatcher!
void resultReadyInternal();
protected:
friend class SymbolDictionaryImpl;
friend class EsriDictionaryProcessor;
friend class BaseSymbolModel;
void fireResultReady();
friend class ResultWatcher<SymbolResult>;
friend class SymbolResultWatcher;
void setSymbolDataToRender(const SymbolDataToRender &symDataToRender);
void setTaskId(const QUuid &uuid);
void setFuture(const QFuture<QImage> &future);
void setGeometryType(GeometryType geometryType);
void setSymbolImage(const SymbolImage &symbolImage);
protected Q_SLOTS:
void onFinished();
private:
class Private;
/**
* The private d->pointer to not break BC when changing internals of this class
*/
Private *d = nullptr;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
//------------------------------------------------------------------------------
/**
* @brief The SymbolResultWatcher class can watch one SymbolResult using setSymbolResult.
* If the background operation has finished, the signal resultReady is emitted exactly one time.
*
* \sa \ref secResultWatcherExample
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolResultWatcher : public ResultWatcher<SymbolResult>
{
Q_OBJECT
using BaseClass = ResultWatcher<SymbolResult>;
public:
explicit SymbolResultWatcher(QObject *parent = nullptr);
~SymbolResultWatcher() = default;
QSharedPointer<SymbolResult> symbolResult() const;
void setSymbolResult(const QSharedPointer<SymbolResult> &symbolResult);
QElapsedTimer *m_et { nullptr };
protected:
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
//------------------------------------------------------------------------------
// for convenience (ComboxBox)
//------------------------------------------------------------------------------
/**
* @brief The SymbolResultWatcherComboxBox class can be used to combine a comboBox
* and an infinite number of item containing an icon.
*
* Here is an example:
*
* \code
* AdvancedSymbology::SymbolResultWatcherComboxBox *srwCb;
foreach(auto sidc, sidcs)
{
// SymbolResultWatcherComboxBox is stored as userData at every item.
// The lifetime is limited to the lifetime of the comboBox since it`s the parent.
d->m_cbRubSidc->addItem(sidc, QVariant::fromValue(srwCb = new AdvancedSymbology::SymbolResultWatcherComboxBox(d->m_cbRubSidc)) );
srwCb->setSymbolResult(dict.fetchSymbol(sidc));
}
* \endcode
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolResultWatcherComboxBox : public QObject
{
Q_OBJECT
public:
explicit SymbolResultWatcherComboxBox(QComboBox *comboBox, int role = Qt::UserRole);
void setSymbolResult(const QSharedPointer<SymbolResult> &symbolResult);
/**
* @brief enableToolTip of each entry
* @param on
*/
void enableToolTip(bool on = true) { m_enableToolTip = on; }
bool isToolTipEnabled() { return m_enableToolTip; }
private slots:
void onResultReady();
private:
QComboBox *m_comboBox{nullptr};
AdvancedSymbology::SymbolResultWatcher m_watcher;
int m_role{Qt::UserRole};
bool m_enableToolTip{true};
};
//------------------------------------------------------------------------------
// for convenience (QWidget)
//------------------------------------------------------------------------------
/**
* @brief The SymbolResultWatcherQWidgetBase class can be used with a QWidget,
* most of the time a LtsWidgets::LtsDragIcon.
* Required is a method 'setIcon(const QPixmap &pixmap)'
*
* Here is an example:
*
* \code
LtsWidgets::LtsDragIcon *dummyIcon = new LtsWidgets::LtsDragIcon(this);
AdvancedSymbology::SymbolResultWatcherQWidgetBase *dummyIconSibling =
new AdvancedSymbology::SymbolResultWatcherQWidget<LtsWidgets::LtsDragIcon>(dummyIcon);
AdvancedSymbology::SymbolDictionary &dict = d->m_mapImpl->symbolDictionary();
dummyIconSibling->setSymbolResult(dict.fetchSymbol(SidcCodec::encodeComplete(SymbologyType::MIL2525D,"10042500001401040000")));
* \endcode
* This sibling define the lifetime.
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolResultWatcherQWidgetBase : public QObject
{
Q_OBJECT
using BaseClass = QObject;
public:
explicit SymbolResultWatcherQWidgetBase(QObject *widget);
void setSymbolResult(const QSharedPointer<SymbolResult> &symbolResult);
QSharedPointer<AdvancedSymbology::SymbolResult> symbolResult() const;
private slots:
void onResultReady();
signals:
void resultReady();
protected:
virtual void onResultReadyImpl() = 0;
AdvancedSymbology::SymbolResultWatcher m_watcher;
};
template <typename PARENT_TYPE>
class SymbolResultWatcherQWidget : public SymbolResultWatcherQWidgetBase
{
using BaseClass = SymbolResultWatcherQWidgetBase;
public:
explicit SymbolResultWatcherQWidget(PARENT_TYPE *parentWidget, const QSize &size = QSize())
: BaseClass(parentWidget)
, m_size(size)
, m_parentWidget(parentWidget)
{}
private:
void onResultReadyImpl() override
{
if (!m_parentWidget)
return;
QSharedPointer<AdvancedSymbology::SymbolResult> symResult = m_watcher.symbolResult();
if (!symResult)
return; // should NEVER happen! (Which object should have triggered the signal???)
const SymbolImage &symImage = symResult->symbolImage();
const auto dpr = m_parentWidget->devicePixelRatioF();
QImage imgCopy;
if (m_size.isValid())
imgCopy = symImage.image().scaled(m_size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
else
imgCopy = symImage.image();
imgCopy.setDevicePixelRatio(dpr);
m_parentWidget->setIcon(QPixmap::fromImage(std::move(imgCopy)));
{
QString tooltip;
QByteArray data;
QBuffer buffer(&data);
// XML-Symbol with scale = 4 will produce huge images. Limit the size:
symImage.image().scaled(QSize(300, 300), Qt::KeepAspectRatio, Qt::SmoothTransformation).save(&buffer, "PNG", 100);
tooltip = QStringLiteral("<html>");
tooltip += QStringLiteral("<center>");
tooltip += QStringLiteral("<img src='data:image/png;base64,%1'>").arg(QString::fromLatin1(data.toBase64()));
tooltip += QStringLiteral("</center>");
tooltip += QStringLiteral("<center>");
tooltip += symResult->symbolDataToRender().sidc;
tooltip += QStringLiteral("</center>");
tooltip += QStringLiteral("<hr>");
tooltip += QStringLiteral("</html>");
m_parentWidget->setToolTip(tooltip);
}
}
QSize m_size;
PARENT_TYPE *m_parentWidget;
};
//------------------------------------------------------------------------------
// for convenience (QLabel)
//------------------------------------------------------------------------------
/**
* @brief The SymbolResultWatcherLabel class can be used to combine a QLabel
* Here is an example:
*
* \code
* QLabel *label = new QLabel(this);
* AdvancedSymbology::SymbolResultWatcherLabel *symbolLabelWatcher(label);
*
*
*
* \endcode
*/
class ADVANCED_SYMBOLOGY_EXPORT SymbolResultWatcherLabel : public QObject
{
Q_OBJECT
public:
explicit SymbolResultWatcherLabel(QLabel *label, const QSize &size = QSize(45, 45));
void setSymbolResult(const QSharedPointer<AdvancedSymbology::SymbolResult> &symbolResult);
private slots:
void onResultReady();
private:
QSize m_size;
QLabel *m_label{nullptr};
AdvancedSymbology::SymbolResultWatcher m_watcher;
};
} // namespace AdvancedSymbology
Q_DECLARE_METATYPE_TEMPLATE_1ARG(AdvancedSymbology::ResultWatcher)
@@ -0,0 +1,50 @@
/**
* @RDE_HEADER@
* Declaration of symbology_type
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "advanced_symbology_export.h"
// Qt
#include <QObject>
#include <QString>
namespace AdvancedSymbology
{
/*!
* \addtogroup AdvancedSymbology
* Handle the symbology based on MIL2525 and APP6 standard
*/
enum class SymbologyType
{
None,
APP6B = 10,
APP6D = 12,
MIL2525C = 20,
MIL2525D,
};
QString ADVANCED_SYMBOLOGY_EXPORT toString(SymbologyType type);
bool ADVANCED_SYMBOLOGY_EXPORT fromString(SymbologyType &symbologyType, const QString &str);
//-----------------------------------------------------------------------------
// output operator:
//-----------------------------------------------------------------------------
ADVANCED_SYMBOLOGY_EXPORT std::ostream &operator<< (std::ostream &stream,
const AdvancedSymbology::SymbologyType &value);
} // namespace AdvancedSymbology
Q_DECLARE_METATYPE(AdvancedSymbology::SymbologyType)
Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Loaded 100 of 2065 files, more files were not shown because too many files have changed in this diff. Show more