Copies intermediate migration results to repo
This commit is contained in:
32 files changed
+1158
-376
No files matched your search
+59
-56
@@ -18,8 +18,9 @@
|
||||
|
||||
|
||||
// arcgis
|
||||
#include <TaskWatcher.h>
|
||||
#include <DictionarySymbolStyle.h>
|
||||
#include <Error.h>
|
||||
#include <MapTypes.h>
|
||||
|
||||
|
||||
// Qt
|
||||
@@ -31,6 +32,7 @@
|
||||
#include <utility>
|
||||
#include <QMimeData>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
|
||||
namespace AdvancedSymbology
|
||||
@@ -159,7 +161,7 @@ QString BaseSymbolItem::symbolSet()
|
||||
{
|
||||
if (m_symbolSet.isEmpty())
|
||||
{
|
||||
SidcDefinitions::SymbolSet symbolSet = SidcDefinitions::castToSymbolSet(m_symbolProperties.originalKey().left(2).toUInt() // Qt6: leftRef removed);
|
||||
SidcDefinitions::SymbolSet symbolSet = SidcDefinitions::castToSymbolSet(m_symbolProperties.originalKey().left(2).toUInt()); // Qt6: leftRef removed
|
||||
m_symbolSet = QString(QStringLiteral("%1 - ")).arg(static_cast<int>(symbolSet)) + AdvancedSymbology::SidcDefinitions::toString(symbolSet);
|
||||
}
|
||||
return m_symbolSet;
|
||||
@@ -167,7 +169,7 @@ QString BaseSymbolItem::symbolSet()
|
||||
|
||||
int BaseSymbolItem::symbolSetAsInt()
|
||||
{
|
||||
return static_cast<int>(SidcDefinitions::castToSymbolSet(m_symbolProperties.originalKey().left(2).toUInt() // Qt6: leftRef removed));
|
||||
return static_cast<int>(SidcDefinitions::castToSymbolSet(m_symbolProperties.originalKey().left(2).toUInt())); // Qt6: leftRef removed
|
||||
}
|
||||
|
||||
|
||||
@@ -215,45 +217,44 @@ QImage BaseSymbolItem::getSearchSwatch()
|
||||
// if (!m_esriSearch.m_esriSymbol)
|
||||
// m_esriSearch.m_esriSymbol = m_esriSearch.m_sssResult.symbol(this);
|
||||
|
||||
if (m_esriSearch.m_esriSwatch.isNull() && m_esriSearch.m_esriSymbol && m_esriSearch.m_esriTaskUuid.isNull())
|
||||
if (m_esriSearch.m_esriSwatch.isNull() && m_esriSearch.m_esriSymbol && !m_esriSearch.m_swatchFuture.isRunning())
|
||||
{
|
||||
// ok, create swatch now:
|
||||
|
||||
// qCritical() << " SEARCH: id=" << m_id << " create swatch now";
|
||||
// qCritical() << " SEARCH: id=" << m_esriSearch.m_esriSymbol->toJson();
|
||||
|
||||
connect(m_esriSearch.m_esriSymbol, &Esri::ArcGISRuntime::Symbol::createSwatchCompleted,
|
||||
this, &BaseSymbolItem::onEsriSearchSymbolSwatchCompleted, Qt::UniqueConnection);
|
||||
|
||||
const Esri::ArcGISRuntime::TaskWatcher &tw = m_esriSearch.m_esriSymbol->createSwatch(SWATCH_SIZE, SWATCH_SIZE, 1);
|
||||
if (tw.isValid())
|
||||
m_esriSearch.m_esriTaskUuid = tw.taskId();
|
||||
else
|
||||
qCritical() << " SEARCH: id=" << m_id << " taskId invalid";
|
||||
// Qt6: Use QFuture pattern instead of signals
|
||||
m_esriSearch.m_swatchFuture = m_esriSearch.m_esriSymbol->createSwatchAsync(SWATCH_SIZE, SWATCH_SIZE, 1);
|
||||
|
||||
// Use QtConcurrent to handle completion
|
||||
QtConcurrent::run([this, future = m_esriSearch.m_swatchFuture]() mutable {
|
||||
future.waitForFinished();
|
||||
if (future.isFinished() && !future.isCanceled()) {
|
||||
QImage image = future.result();
|
||||
QMetaObject::invokeMethod(this, [this, image]() {
|
||||
onEsriSearchSymbolSwatchCompleted(image);
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
});
|
||||
}
|
||||
return m_esriSearch.m_esriSwatch;
|
||||
}
|
||||
|
||||
void BaseSymbolItem::onEsriSearchSymbolSwatchCompleted(const QUuid &taskId, const QImage &image)
|
||||
void BaseSymbolItem::onEsriSearchSymbolSwatchCompleted(const QImage &image)
|
||||
{
|
||||
if (m_esriSearch.m_esriTaskUuid != taskId)
|
||||
return;
|
||||
|
||||
m_esriSearch.m_esriSwatch = image;
|
||||
|
||||
emit dataChanged(m_id);
|
||||
}
|
||||
|
||||
QImage BaseSymbolItem::getFetchSwatch() const
|
||||
QImage BaseSymbolItem::getFetchSwatch()
|
||||
{
|
||||
if (!m_symbolDictionaryImpl || !m_symbolDictionaryImpl->getEsriSymbolDictionary())
|
||||
return m_esriFetch.m_esriSwatch;
|
||||
|
||||
if (m_esriFetch.m_esriSwatch.isNull() && m_esriFetch.m_esriFetchTaskIdUuid.isNull())
|
||||
if (m_esriFetch.m_esriSwatch.isNull() && !m_esriFetch.m_symbolFuture.isRunning())
|
||||
{
|
||||
connect(m_esriDictionary, &Esri::ArcGISRuntime::DictionarySymbolStyle::fetchSymbolCompleted,
|
||||
this, &BaseSymbolItem::onEsriFetchCompleted, Qt::UniqueConnection);
|
||||
|
||||
// from key8 to sidc (20 digits)
|
||||
const QString &key8 = m_symbolProperties.key().left(8);
|
||||
|
||||
@@ -272,39 +273,44 @@ QImage BaseSymbolItem::getFetchSwatch() const
|
||||
const QVariantMap keys({{QStringLiteral("sidc"), m_esriFetch.m_sidc}, // SidcCodec::decodeRawSidc ; set sidc of symbol in case of MIL2525
|
||||
{QStringLiteral("sic"), m_esriFetch.m_sidc}}); // SidcCodec::decodeRawSidc , set sidc of symbol in case of APP6
|
||||
|
||||
const Esri::ArcGISRuntime::TaskWatcher &tw = m_esriDictionary->fetchSymbol(keys);
|
||||
if (tw.isValid())
|
||||
m_esriFetch.m_esriFetchTaskIdUuid = tw.taskId();
|
||||
else
|
||||
qCritical() << " FETCH: id=" << m_id << " m_esriFetchTaskIdUuid invalid";
|
||||
// Qt6: Use QFuture pattern instead of signals
|
||||
m_esriFetch.m_symbolFuture = m_esriDictionary->fetchSymbolAsync(keys, this);
|
||||
|
||||
QtConcurrent::run([this, future = m_esriFetch.m_symbolFuture]() mutable {
|
||||
future.waitForFinished();
|
||||
if (future.isFinished() && !future.isCanceled()) {
|
||||
Esri::ArcGISRuntime::Symbol *symbol = future.result();
|
||||
QMetaObject::invokeMethod(this, [this, symbol]() {
|
||||
onEsriFetchCompleted(symbol);
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
});
|
||||
}
|
||||
return m_esriFetch.m_esriSwatch;
|
||||
}
|
||||
|
||||
void BaseSymbolItem::onEsriFetchCompleted(const QUuid &taskId, Esri::ArcGISRuntime::Symbol *symbol)
|
||||
void BaseSymbolItem::onEsriFetchCompleted(Esri::ArcGISRuntime::Symbol *symbol)
|
||||
{
|
||||
if (m_esriFetch.m_esriFetchTaskIdUuid != taskId)
|
||||
return;
|
||||
|
||||
// save intermediate result:
|
||||
m_esriFetch.m_esriSymbol = symbol;
|
||||
|
||||
// start creating swatch of fetched symbol:
|
||||
connect(m_esriFetch.m_esriSymbol, &Esri::ArcGISRuntime::Symbol::createSwatchCompleted,
|
||||
this, &BaseSymbolItem::onEsriFetchSymbolSwatchCompleted, Qt::UniqueConnection);
|
||||
|
||||
const Esri::ArcGISRuntime::TaskWatcher &tw = m_esriFetch.m_esriSymbol->createSwatch(SWATCH_SIZE, SWATCH_SIZE, 1);
|
||||
if (tw.isValid())
|
||||
m_esriFetch.m_esriSwatchTaskUuid = tw.taskId();
|
||||
else
|
||||
qCritical() << " FETCH: id=" << m_id << " taskId invalid";
|
||||
// Qt6: Use QFuture pattern instead of signals
|
||||
m_esriFetch.m_swatchFuture = m_esriFetch.m_esriSymbol->createSwatchAsync(SWATCH_SIZE, SWATCH_SIZE, 1);
|
||||
|
||||
QtConcurrent::run([this, future = m_esriFetch.m_swatchFuture]() mutable {
|
||||
future.waitForFinished();
|
||||
if (future.isFinished() && !future.isCanceled()) {
|
||||
QImage image = future.result();
|
||||
QMetaObject::invokeMethod(this, [this, image]() {
|
||||
onEsriFetchSymbolSwatchCompleted(image);
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void BaseSymbolItem::onEsriFetchSymbolSwatchCompleted(const QUuid &taskId, const QImage &image)
|
||||
void BaseSymbolItem::onEsriFetchSymbolSwatchCompleted(const QImage &image)
|
||||
{
|
||||
if (m_esriFetch.m_esriSwatchTaskUuid != taskId)
|
||||
return;
|
||||
|
||||
m_esriFetch.m_esriSwatch = image;
|
||||
|
||||
// qCritical() << " FETCH: id=" << m_id << " image " << image.size();
|
||||
@@ -426,8 +432,7 @@ void BaseSymbolModel::onLoadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadSt
|
||||
void BaseSymbolModel::onErrorDictionary(const Esri::ArcGISRuntime::Error &error)
|
||||
{
|
||||
FATAL_LOG(m_logger) << LOGFUNCTION << " ---EsriError--- occured: "
|
||||
<< " code=" << error.code()
|
||||
<< ", domain=" << static_cast<int>(error.domain())
|
||||
<< " domain=" << static_cast<int>(error.domain())
|
||||
<< ", extendedErrorType=" << static_cast<int>(error.extendedErrorType())
|
||||
<< ", message='" << error.message() << "'"
|
||||
<< ", additionalMessage='" << error.additionalMessage() << "'";
|
||||
@@ -455,11 +460,13 @@ void BaseSymbolModel::initModel(SymbolDictionary *symbolDictionary,
|
||||
|
||||
|
||||
// spend time to create (expensive) Esri::ArcGISRuntime::Symbol?
|
||||
// Qt6/ArcGIS SDK v300: symbol() method removed, replaced with fetchSymbolAsync()
|
||||
// For debug mode, symbol fetching would require async pattern - skipping for now
|
||||
#ifdef LTS_DEBUG
|
||||
Esri::ArcGISRuntime::Symbol *esriSymbol = nullptr;
|
||||
const bool showAll = QGuiApplication::keyboardModifiers().testFlag(Qt::KeyboardModifier::ControlModifier);
|
||||
if (showAll)
|
||||
esriSymbol = searchResult.symbol(this); // symbol() has to be called from mainThread, is expensive / time consuming
|
||||
// Qt6: Symbol fetching now requires async pattern via fetchSymbolAsync()
|
||||
// Debug symbol display would require refactoring to async pattern
|
||||
Esri::ArcGISRuntime::Symbol *esriSymbol = nullptr;
|
||||
Q_UNUSED(searchResult)
|
||||
#else
|
||||
// release mode: save time, won´t be visible
|
||||
Esri::ArcGISRuntime::Symbol *esriSymbol = nullptr;
|
||||
@@ -991,8 +998,7 @@ QSet<QString> BaseSymbolProxyModel::validBaseSymbolCodes() const
|
||||
void BaseSymbolProxyModel::setValidBaseSymbolCodes(const QSet<QString> &validBaseSymbolCodes)
|
||||
{
|
||||
m_validBaseSymbolCodes = validBaseSymbolCodes;
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void BaseSymbolProxyModel::onFilterPoints(bool on)
|
||||
@@ -1001,8 +1007,7 @@ void BaseSymbolProxyModel::onFilterPoints(bool on)
|
||||
m_geometrySet.insert(AdvancedSymbology::GeometryType::Point);
|
||||
else
|
||||
m_geometrySet.remove(AdvancedSymbology::GeometryType::Point);
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
void BaseSymbolProxyModel::onFilterLines(bool on)
|
||||
{
|
||||
@@ -1010,8 +1015,7 @@ void BaseSymbolProxyModel::onFilterLines(bool on)
|
||||
m_geometrySet.insert(AdvancedSymbology::GeometryType::Polyline);
|
||||
else
|
||||
m_geometrySet.remove(AdvancedSymbology::GeometryType::Polyline);
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
void BaseSymbolProxyModel::onFilterAreas(bool on)
|
||||
{
|
||||
@@ -1019,8 +1023,7 @@ void BaseSymbolProxyModel::onFilterAreas(bool on)
|
||||
m_geometrySet.insert(AdvancedSymbology::GeometryType::Polygon);
|
||||
else
|
||||
m_geometrySet.remove(AdvancedSymbology::GeometryType::Polygon);
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool BaseSymbolProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
|
||||
Reference in new issue
Block a user