6#include "DgmlTextureTagWriter.h"
8#include "DgmlElementDictionary.h"
9#include "DownloadPolicy.h"
10#include "GeoSceneTileDataset.h"
11#include "GeoSceneTypes.h"
13#include "ServerLayout.h"
22 new DgmlTextureTagWriter());
24bool DgmlTextureTagWriter::write(
const GeoNode *node, GeoWriter &writer)
const
26 const auto texture =
static_cast<const GeoSceneTileDataset *
>(node);
28 writer.writeAttribute(QStringLiteral(
"name"), texture->name());
32 writer.writeAttribute(QStringLiteral(
"format"), texture->fileFormat());
33 if (texture->expire()) {
36 writer.writeCharacters(texture->sourceDir());
37 writer.writeEndElement();
39 writer.writeAttribute(
"width",
QString::number(texture->tileSize().width()));
40 writer.writeAttribute(
"height",
QString::number(texture->tileSize().height()));
41 writer.writeEndElement();
43 writer.writeOptionalElement(
QString::fromLatin1(dgml::dgmlTag_InstallMap), texture->installMap());
46 if (texture->hasMaximumTileLevel()) {
47 writer.writeAttribute(
"maximumTileLevel",
QString::number(texture->maximumTileLevel()));
48 writer.writeAttribute(
"levelZeroColumns",
QString::number(texture->levelZeroColumns()));
49 writer.writeAttribute(
"levelZeroRows",
QString::number(texture->levelZeroRows()));
50 writer.writeAttribute(
"mode", texture->serverLayout()->name());
52 writer.writeEndElement();
54 if (!texture->downloadUrls().isEmpty()) {
55 for (
int i = 0; i < texture->downloadUrls().size(); ++i) {
56 QString protocol = texture->downloadUrls().
at(i).toString().left(texture->downloadUrls().at(i).toString().indexOf(
QLatin1Char(
':')));
58 int port = texture->downloadUrls().at(i).port();
63 writer.writeAttribute(
"protocol", protocol);
64 writer.writeAttribute(
"host", host);
68 writer.writeAttribute(
"path", path);
69 writer.writeAttribute(
"query", query);
70 writer.writeEndElement();
74 for (
const DownloadPolicy *policy : texture->downloadPolicies()) {
78 writer.writeAttribute(
"usage",
"Browse");
79 writer.writeAttribute(
"maximumConnections",
QString::number(policy->maximumConnections()));
83 writer.writeAttribute(
"usage",
"Bulk");
84 writer.writeAttribute(
"maximumConnections",
QString::number(policy->maximumConnections()));
87 writer.writeEndElement();
91 const GeoSceneAbstractTileProjection::Type tileProjectionType = texture->tileProjectionType();
92 if (tileProjectionType == GeoSceneAbstractTileProjection::Mercator) {
93 writer.writeAttribute(QStringLiteral(
"name"),
"Mercator");
94 }
else if (tileProjectionType == GeoSceneAbstractTileProjection::Equirectangular) {
95 writer.writeAttribute(QStringLiteral(
"name"),
"Equirectangular");
97 writer.writeEndElement();
100 if (!texture->blending().isEmpty()) {
101 writer.writeAttribute(QStringLiteral(
"name"), texture->blending());
103 writer.writeEndElement();
105 writer.writeEndElement();
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
QString path(const QString &relativePath)
Binds a QML item to a specific geodetic location in screen coordinates.
@ DownloadBrowse
Browsing mode, normal operation of Marble, like a web browser.
@ DownloadBulk
Bulk download, for example "File/Download region".
const_reference at(qsizetype i) const const
const QChar at(qsizetype position) const const
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
QString number(double n, char format, int precision)