7#include "DgmlStorageLayoutTagHandler.h"
9#include "MarbleDebug.h"
11#include "DgmlAttributeDictionary.h"
12#include "DgmlElementDictionary.h"
14#include "GeoSceneTileDataset.h"
15#include "ServerLayout.h"
21DGML_DEFINE_TAG_HANDLER(StorageLayout)
23GeoNode *DgmlStorageLayoutTagHandler::parse(GeoParser &parser)
const
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(
QLatin1StringView(dgmlTag_StorageLayout)));
29 int levelZeroColumns = 2;
30 const QString levelZeroColumnsStr = parser.attribute(dgmlAttr_levelZeroColumns).
trimmed();
31 if (!levelZeroColumnsStr.
isEmpty()) {
32 levelZeroColumns = levelZeroColumnsStr.
toInt();
36 int levelZeroRows = 1;
37 const QString levelZeroRowsStr = parser.attribute(dgmlAttr_levelZeroRows).
trimmed();
38 if (!levelZeroRowsStr.
isEmpty()) {
39 levelZeroRows = levelZeroRowsStr.
toInt();
43 int minimumTileLevel = 0;
44 const QString minimumTileLevelStr = parser.attribute(dgmlAttr_minimumTileLevel).
trimmed();
45 if (!minimumTileLevelStr.
isEmpty()) {
46 minimumTileLevel = minimumTileLevelStr.
toInt();
50 int maximumTileLevel = -1;
51 const QString maximumTileLevelStr = parser.attribute(dgmlAttr_maximumTileLevel).
trimmed();
52 if (!maximumTileLevelStr.
isEmpty()) {
53 maximumTileLevel = maximumTileLevelStr.
toInt();
57 const QString tileLevels = parser.attribute(dgmlAttr_tileLevels).
trimmed();
60 GeoStackItem parentItem = parser.parentElement();
61 if (parentItem.represents(dgmlTag_Texture) || parentItem.represents(dgmlTag_Vectortile)) {
62 auto texture = parentItem.nodeAs<GeoSceneTileDataset>();
65 GeoSceneTileDataset::StorageLayout storageLayout = GeoSceneTileDataset::OpenStreetMap;
66 ServerLayout *serverLayout =
nullptr;
69 serverLayout =
new OsmServerLayout(texture);
71 serverLayout =
new CustomServerLayout(texture);
73 serverLayout =
new WmsServerLayout(texture);
75 serverLayout =
new WmtsServerLayout(texture);
77 serverLayout =
new QuadTreeServerLayout(texture);
79 storageLayout = GeoSceneTileDataset::TileMapService;
80 serverLayout =
new TmsServerLayout(texture);
82 storageLayout = GeoSceneTileDataset::Marble;
83 serverLayout =
new MarbleServerLayout(texture);
86 mDebug() <<
"Unknown storage layout mode " << modeStr <<
", falling back to default.";
90 texture->setLevelZeroColumns(levelZeroColumns);
91 texture->setLevelZeroRows(levelZeroRows);
92 texture->setMinimumTileLevel(minimumTileLevel);
93 texture->setMaximumTileLevel(maximumTileLevel);
94 texture->setTileLevels(tileLevels);
95 texture->setStorageLayout(storageLayout);
96 texture->setServerLayout(serverLayout);
Binds a QML item to a specific geodetic location in screen coordinates.
bool isEmpty() const const
int toInt(bool *ok, int base) const const
QString trimmed() const const