Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of SymbolDictionaryImpl
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// Own
|
||||
#include <Symbology/symbol_dictionary.h> // Our interface "SymbolDictionary"
|
||||
#include "esri_dictionary_processor.h"
|
||||
#include "advanced_symbology_logging.h"
|
||||
|
||||
// Esri
|
||||
#include <arcgis/DictionarySymbolStyle.h>
|
||||
|
||||
|
||||
class QStandardItemModel;
|
||||
class QTimer;
|
||||
|
||||
namespace SymbologyXML { class PixmapSymbolCache; }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/**
|
||||
* Support advanced Symbology (like APP6 and MIL2525).
|
||||
* Some extensions like injury/damage are added to standard and rendered to the final image.
|
||||
* It is related to SituationMap.
|
||||
*
|
||||
*/
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class BaseSymbolModel;
|
||||
|
||||
QStringList listOfEtsPointSidcs_Internal();
|
||||
|
||||
QStringList listOfPointSidcs_Internal();
|
||||
QStringList listOfLineSidcs_Internal();
|
||||
QStringList listOfAreaSidcs_Internal();
|
||||
QStringList listOfPlanEditorSidcs_Internal();
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \addtogroup AdvancedSymbology
|
||||
* @{ Handle the symbology based on MIL2525 and APP6 standard
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief The SymbolDictionaryImpl class
|
||||
*
|
||||
* Current focus: Only access to the dictionary for generating images/icons
|
||||
* Wrapper to EsriSymbolDictionaryImpl
|
||||
*/
|
||||
class ADVANCED_SYMBOLOGY_EXPORT SymbolDictionaryImpl : public /*virtual*/ SymbolDictionary
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*! \name Construction, Destruction */
|
||||
//@{
|
||||
SymbolDictionaryImpl(SymbologyType symbologyType,
|
||||
const QString &symbologyResourcePath);
|
||||
virtual ~SymbolDictionaryImpl();
|
||||
private:
|
||||
bool init(SymbologyType symbologyType, const QString &symbologyResourcePath);
|
||||
void connectSignals();
|
||||
|
||||
public:
|
||||
|
||||
bool isOk() const override;
|
||||
|
||||
void load() override;
|
||||
|
||||
bool isLoaded() const override;
|
||||
bool isLoading() const { return m_isLoading; }
|
||||
|
||||
LoadStatus loadStatus() const override;
|
||||
|
||||
|
||||
bool setEtsSymbol(int fileId,
|
||||
const QString &encodedSidc,
|
||||
const SymbolProperties &properties,
|
||||
const QImage &image) override;
|
||||
void removeEtsSymbol(int fileId) override;
|
||||
void removeEtsSymbol(const QString &encodedSidc) override;
|
||||
void clearEtsSymbols() override;
|
||||
|
||||
int addEtsSymbols(const QString &path) override;
|
||||
int etsSymbolCount() const override;
|
||||
QStringList etsSymbols() const override;
|
||||
|
||||
bool containsXmlSymbol(const QString &encodedSidc) const override;
|
||||
bool setXmlSymbol(int fileId, const QString &name, const QString &operatorName, qint64 lastModified, const QString &xmlSymbol, const SymbolProperties &properties) override;
|
||||
bool setXmlSymbol(int fileId, const QString &name, const QString &operatorName, qint64 lastModified, const SymbologyXML::Symbol &symbol, const SymbolProperties &properties) override;
|
||||
void removeXmlSymbol(int fileId) override; /**< Remove symbol from dictionary */
|
||||
void removeXmlSymbol(const QString &encodedSidc) override;
|
||||
void clearXmlSymbols() override;
|
||||
void clearXmlSymbolCache() override;
|
||||
|
||||
int xmlSymbolCount() const override;
|
||||
QStringList xmlSymbols() const override;
|
||||
QString xmlSidc(const QString &xmlSymbol) const override;
|
||||
QString xmlSidc(const SymbologyXML::Symbol &symbol) const override;
|
||||
|
||||
SymbologyXML::Symbol xmlSymbol(const QString &encodedSidc) const override;
|
||||
SymbolProperties xmlSymbolProps(const QString &encodedSidc) const override;
|
||||
|
||||
SymbolDictionaryImpl(const SymbolDictionaryImpl &other) = delete;
|
||||
SymbolDictionaryImpl &operator=(const SymbolDictionaryImpl &other) = delete;
|
||||
//@}
|
||||
|
||||
|
||||
SymbologyType symbologyType() const override;
|
||||
QString specificationType() const override;
|
||||
QString symbologyResourcePath() const override;
|
||||
|
||||
int symbologySpecificCount() const override;
|
||||
|
||||
const Esri::ArcGISRuntime::DictionarySymbolStyle *getEsriSymbolDictionary() const;
|
||||
|
||||
|
||||
static QImage temporaryImage(int sizeL = 100);
|
||||
static QImage notFoundImage(int sizeL = 100, const QColor &fillColor = QColor(255, 255, 0, 128));
|
||||
static QSharedPointer<SymbolResult> notFoundSymbolResult(const SymbolDataToRender &symDataToRender);
|
||||
static QSharedPointer<SymbolResult> notFoundSymbolResult(int sizeL = 100);
|
||||
|
||||
QStringList symbologyAttributeKeyList() const override;
|
||||
|
||||
QStringList cachedBaseSymbolCodes() const override;
|
||||
|
||||
SymbolProperties symbolProperties(const QString &baseSymbolCode) const override;
|
||||
|
||||
bool searchResultIsValid(const QHash<QString, int> &key8LookupTable,
|
||||
const Esri::ArcGISRuntime::SymbolStyleSearchResult &resultItem,
|
||||
QString *toBeRemovedFromName = nullptr);
|
||||
|
||||
|
||||
QSharedPointer<SymbolResult> symbolPropertyImage(const SymbolProperties &symbolProperties, int sizeL = 100) const override;
|
||||
QSharedPointer<SymbolResult> symbolPropertyImage(QSharedPointer<SymbolResult> symResult, const SymbolProperties &symbolProperties, int sizeL = 100) const;
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \name Render symbol: findImage, findPreview, findBaseSymbol*/
|
||||
//@{
|
||||
// for concrete symbols (with frame, modifier, injury..)
|
||||
QSharedPointer<SymbolResult> findImage(const SymbolDataToRender &symDataToRender) const override;
|
||||
|
||||
// for concrete symbols (with frame)
|
||||
QSharedPointer<SymbolResult> findPreview(const QString &sidc, int sizeL = 100) const override;
|
||||
|
||||
// for abstract object (just baseSymbol/Mainicon)
|
||||
QSharedPointer<SymbolResult> findBaseSymbol(const QString &sidc) const override;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Fetch
|
||||
* Similar to findImage, except that fetchSymbol returns a different baseSymbolIcon for multiPoint sidcs.
|
||||
* In most cases you should prefer findImage, findPreview, findBaseSymbol
|
||||
*/
|
||||
//@{
|
||||
QSharedPointer<SymbolResult> fetchSymbol(const QString &sidc, int sizeL = 100) const override;
|
||||
QSharedPointer<SymbolResult> fetchSymbol(const SymbolDataToRender &symDataToRender) const override;
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
QStringList symbolModifierKeys() const override;
|
||||
|
||||
bool symbolModifierData(const QString &key, ModifierData &data) const override;
|
||||
|
||||
QList<ModifierData> symbolModifierList(SidcDefinitions::SymbolSet symbolSet, unsigned int modifierSector) const override;
|
||||
QList<ModifierData> symbolModifierList(const QString &baseSymbolCode, unsigned int modifierSector) const override;
|
||||
|
||||
|
||||
bool insertXmlTestSymbol(const SymbolProperties &symbolProps) override;
|
||||
bool insertXmlComplexTestSymbol(const SymbolProperties &symbolProps) override;
|
||||
|
||||
int count() const override;
|
||||
|
||||
|
||||
//-------------------------------
|
||||
|
||||
// void createSidc(QString &sidc_inOut,
|
||||
// SymbolTypes::t_affil identity, // friend, neutral...
|
||||
// SymbolTypes::t_state state) const override // present, anticipated
|
||||
// {};
|
||||
|
||||
|
||||
QString toString() const override;
|
||||
|
||||
|
||||
|
||||
const EsriDictionaryProcessor *getEsriDictionaryProcessor() const
|
||||
{
|
||||
return m_esriDictionaryProcessor;
|
||||
}
|
||||
const SidcCodec::SidcHashTable<SymbolProperties> baseSymbolCodeToSymbolPropertyTable() const
|
||||
{
|
||||
if (!m_esriDictionaryProcessor)
|
||||
return SidcCodec::SidcHashTable<SymbolProperties>();
|
||||
return m_esriDictionaryProcessor->baseSymbolCodeToSymbolPropertyTable();
|
||||
}
|
||||
|
||||
|
||||
QStringList symbologyFieldNamesInternal() const;
|
||||
QStringList textFieldNamesInternal() const;
|
||||
|
||||
BaseSymbolModel* getBaseSymbolModelEsri();
|
||||
|
||||
BaseSymbolModel* getBaseSymbolModelXML() { return m_xmlBaseSymbolModel; }
|
||||
const BaseSymbolModel* getBaseSymbolModelXML() const { return m_xmlBaseSymbolModel; }
|
||||
|
||||
BaseSymbolModel* getBaseSymbolModelEts() { return m_etsBaseSymbolModel; }
|
||||
const BaseSymbolModel* getBaseSymbolModelEts() const { return m_etsBaseSymbolModel; }
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onErrorDictionary(const Esri::ArcGISRuntime::Error &error);
|
||||
void onLoadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus);
|
||||
void onProcessorAllIsDone();
|
||||
|
||||
void onFetchSymbolCompleted(QUuid fsTaskId, Esri::ArcGISRuntime::Symbol *symbol);
|
||||
|
||||
void onSwatchCompleted(const QUuid &csTaskId, const QImage &image);
|
||||
|
||||
private:
|
||||
Esri::ArcGISRuntime::DictionarySymbolStyle *m_esri_dictionary = nullptr;
|
||||
|
||||
protected:
|
||||
|
||||
bool m_initOk;
|
||||
// ESRI data:
|
||||
QString m_specificationType;
|
||||
SymbologyType m_symbolDictionaryType_own = SymbologyType::MIL2525C;
|
||||
QString m_symbologyResourcePath;
|
||||
|
||||
// // OWN data:
|
||||
|
||||
// createSwatch-Uuid -> findSymbol-Uuid
|
||||
QMap<QUuid, QUuid> m_createSwatch2findSymbolTaskId;
|
||||
|
||||
|
||||
// searchSymbol-Uuid -> propertyResult
|
||||
mutable QMap<QUuid, QWeakPointer<PropertyResult>> m_findSymbol2propertyResult;
|
||||
|
||||
// findSymbol-Uuid -> symbolResult
|
||||
mutable QMap<QUuid, QWeakPointer<SymbolResult>> m_findSymbol2symbolResult;
|
||||
|
||||
|
||||
// QStringList m_sidcList;
|
||||
// QList<AdvancedSymbology::SymbolProperties> m_symbolProperties;
|
||||
// QHash<QString, SymbolProperties> m_sidcToSymbolProperties;
|
||||
|
||||
EsriDictionaryProcessor *m_esriDictionaryProcessor = nullptr;
|
||||
|
||||
SidcCodec::SidcHashTable<SymbolProperties> m_baseSymbolCodeToSymbolPropertyTable; // just a copy
|
||||
|
||||
|
||||
|
||||
// to extent the esriDict by own entries :
|
||||
SidcCodec::SidcHashTable<SymbolProperties> m_etsSidcSymbolProperties;
|
||||
SidcCodec::SidcHashTable<QImage> m_etsSidcImages;
|
||||
QStringList m_etsSidcOrdered;
|
||||
|
||||
SidcCodec::SidcHashTable<SymbolProperties> m_xmlSidcSymbolProperties;
|
||||
SidcCodec::SidcHashTable<SymbologyXML::Symbol> m_xmlSymbols;
|
||||
QSharedPointer<SymbologyXML::PixmapSymbolCache> m_xmlSymbolCache;
|
||||
|
||||
// : to extent the esriDict by own entries
|
||||
|
||||
// EsriSymbols:
|
||||
BaseSymbolModel *m_esriBaseSymbolModel = nullptr;
|
||||
|
||||
// XML:
|
||||
BaseSymbolModel *m_xmlBaseSymbolModel = nullptr;
|
||||
|
||||
// Ets:
|
||||
BaseSymbolModel *m_etsBaseSymbolModel = nullptr;
|
||||
|
||||
|
||||
QTimer *m_changedDelayTimer;
|
||||
bool m_isLoading;
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
};
|
||||
|
||||
|
||||
|
||||
QImage renderExtensions(QImage &coreImage,
|
||||
const SymbolDataToRender &symbolDataToRender,
|
||||
const QColor &colorToBeReplaced,
|
||||
bool renderJustCoreImage = false);
|
||||
|
||||
QImage renderXML_Symbol(const QSharedPointer<SymbologyXML::PixmapSymbolCache> &xmlSymbolCache,
|
||||
const SidcCodec::SidcHashTable<SymbologyXML::Symbol> &xmlSymbols,
|
||||
const SymbolDataToRender &symbolDataToRender,
|
||||
bool renderJustCoreImage = false);
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
|
||||
|
||||
Reference in new issue
Block a user