Initial commit

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

No files matched your search

@@ -0,0 +1,225 @@
/**
* @RDE_HEADER@
* Interface-Implementation of EsriDictionaryProcessor
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include <Symbology/symbol_dictionary.h> // Our interface "SymbolDictionary"
#include "advanced_symbology_logging.h"
#include <Symbology/sidc_definitions.h>
#include <Symbology/sidc_codec.h>
// Qt
#include <QImage>
// Esri
#include <arcgis/DictionarySymbolStyle.h>
//----------------------------------------------------------------------------
namespace AdvancedSymbology
{
struct createSwatchParameter
{
static constexpr int m_width = 128;
static constexpr int m_height = 64;
static constexpr float m_screenScale = 2;
};
static constexpr createSwatchParameter CREATE_SWATCH_PARAMETER = createSwatchParameter();
static constexpr float CREATE_SWATCH_SCREEN_SCALE = 5;
QImage scaleImage(const QImage &image, int sizeL = 100);
/**
* @brief The EsriDictionaryProcessor class analyses the stylx files of ESRI.
* The process is seperated:
* Setup: The EsriDictionaryProcessor has to be set up with the desired
* SymbologyType and initialized with the loaded raw Esri::ArcGISRuntime::DictionarySymbolStyle.
* Step 1:
* Search all from esri_dictionary (prepare)
* When this is finished,
* Step 2:
* For all results the associated Esri::ArcGISRuntime:Symbol has to be retrieved.
* This has to be done in the mainThread (syncTableWithinMainThread).
* Step 3:
* The single jobs can be triggered and performed in seperate threads:
* Job 1: startBaseSymbolCodeToPropertyTable();
* Job 2: startModifierTable();
* And the end of each job it´s checked if all jobs are finished (checkIfAllAreDone).
* If so the signal allIsDone is emitted.
*
* Now the BaseSymbolCodeToPropertyTableFinished and the ModifierTable is prepared.
*/
class EsriDictionaryProcessor : public QObject
{
Q_OBJECT
public:
/*! \name Construction, Destruction */
//@{
explicit EsriDictionaryProcessor(SymbologyType symbologyType);
virtual ~EsriDictionaryProcessor();
void cancel();
void waitForFinished();
//@}
virtual bool searchResultIsValid(const QHash<QString, int> &key8LookupTable,
const Esri::ArcGISRuntime::SymbolStyleSearchResult &resultItem,
QString *toBeRemovedFromName = nullptr) = 0;
//
// Common:
//
/*! \name Common */
//@{
void init(Esri::ArcGISRuntime::DictionarySymbolStyle *loaded_esri_dictionary);
void prepare();
protected:
//@}
//
// Job 1: BaseSymbolCodeToPropertyTable
//
public:
/*! \name Job 1: BaseSymbolCodeToPropertyTable */
//@{
void startBaseSymbolCodeToPropertyTable();
virtual bool processBaseSymbolCodeToPropertyTable() = 0;
bool baseSymbolCodeToPropertyTableFinished()
{
return m_baseSymbolCodeToSymbolPropertyTableFilled;
}
const SidcCodec::SidcHashTable<SymbolProperties> baseSymbolCodeToSymbolPropertyTable() const
{
return m_baseSymbolCodeToSymbolPropertyTable;
}
//@}
//
// Job 2: ModifierTable
//
public:
/*! \name Job 2: ModifierTable */
//@{
void startModifierTable();
virtual bool processModifierTable() = 0;
bool modifierTableFinished()
{
return m_modifierTableFilled;
}
QStringList symbolModifierKeys() const;
bool symbolModifierData(const QString &key, ModifierData &data) const;
QVector<ModifierData> symbolModifierList(SidcDefinitions::SymbolSet symbolSet, unsigned int modifierSector) const;
//@}
//
// Job n:
//
public:
//
// common final:
//
public:
bool allJobsDone() const;
Q_SIGNALS:
void allIsDone();
void baseSymbolCodeToPropertyTableDone();
void modifierTableDone();
protected Q_SLOTS:
void onSearchSymbolsCompletedPropertyTable(QUuid /*ssTaskId*/, Esri::ArcGISRuntime::SymbolStyleSearchResultListModel *searchResults);
void onEsriSymbolSwatchCompleted(const QUuid &csTaskId, const QImage &image);
protected:
void checkIfAllAreDone();
void searchSymbols();
void syncTableWithinMainThread();
//
// Common
//
LOGGER_T m_logger; ///< Interface of the Logging-Facility
Esri::ArcGISRuntime::DictionarySymbolStyle *m_esri_dictionary = nullptr;
QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> m_searchResultList;
QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> m_searchResultListValid;
// originalKey
struct EsriSymbol
{
Esri::ArcGISRuntime::SymbolStyleSearchResult m_sssResult;
mutable Esri::ArcGISRuntime::Symbol *esriSymbol = nullptr;
mutable QImage swatchImage;
};
QHash<QString, EsriSymbol> m_originalKeyToEsriSymbol;
// symbolPropertyImage-Uuid -> SymbolResult
mutable QMap<QUuid, QWeakPointer<SymbolResult>> m_symbolPropertyImage2symbolResult;
public:
bool symbolPropertyImageContains(const QString &originalKey) const;
QSharedPointer<SymbolResult> symbolPropertyImage(QSharedPointer<SymbolResult> symResult, const QString &originalKey) const;
const QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> & getSearchResultList() const { return m_searchResultList; }
const QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> & getSearchResultListValid() const { return m_searchResultListValid; }
protected:
//
// Job 1: baseSymbolCodeToSymbolPropertyTable:
//
SidcCodec::SidcHashTable<SymbolProperties> m_baseSymbolCodeToSymbolPropertyTable;
bool m_baseSymbolCodeToSymbolPropertyTableFilled = false;
QFuture<bool> m_baseSymbolCodeToSymbolPropertyTableWatcher;
//
// Job 2:
//
QMap<QString, ModifierData> m_modifierTable;
bool m_modifierTableFilled = false;
QFuture<bool> m_modifierTableWatcher;
//
// Job n:
//
};
} // namespace AdvancedSymbology