15 #include <QStringBuilder> 22 : mMetadata( metadata )
28 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
29 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Fees" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
fees() + QStringLiteral(
"</td></tr>\n" );
30 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Licenses" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
licenses().join( QStringLiteral(
"<br />" ) ) + QStringLiteral(
"</td></tr>\n" );
31 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Rights" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
rights().join( QStringLiteral(
"<br />" ) ) + QStringLiteral(
"</td></tr>\n" );
32 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Constraints" ) + QStringLiteral(
"</td><td>" );
33 const QList<QgsLayerMetadata::Constraint> &constraints = mMetadata.
constraints();
34 bool notFirstRow =
false;
39 myMetadata += QLatin1String(
"<br />" );
41 myMetadata += QStringLiteral(
"<strong>" ) + constraint.type + QStringLiteral(
": </strong>" ) + constraint.constraint;
44 myMetadata += QLatin1String(
"</td></tr>\n" );
45 mMetadata.
rights().join( QStringLiteral(
"<br />" ) ) + QStringLiteral(
"</td></tr>\n" );
46 myMetadata += QLatin1String(
"</table>\n" );
52 const QList<QgsAbstractMetadataBase::Contact> &contacts = mMetadata.
contacts();
54 if ( contacts.isEmpty() )
56 myMetadata += QStringLiteral(
"<p>" ) + QObject::tr(
"No contact yet." ) + QStringLiteral(
"</p>" );
60 myMetadata = QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
61 myMetadata +=
"<tr><th>" + QObject::tr(
"ID" ) +
"</th><th>" + QObject::tr(
"Name" ) +
"</th><th>" + QObject::tr(
"Position" ) +
"</th><th>" + QObject::tr(
"Organization" ) +
"</th><th>" + QObject::tr(
"Role" ) +
"</th><th>" + QObject::tr(
"Email" ) +
"</th><th>" + QObject::tr(
"Voice" ) +
"</th><th>" + QObject::tr(
"Fax" ) +
"</th><th>" + QObject::tr(
"Addresses" ) +
"</th></tr>\n";
67 rowClass = QStringLiteral(
"class=\"odd-row\"" );
68 myMetadata +=
"<tr " + rowClass +
"><td>" + QString::number( i ) +
"</td><td>" + contact.name +
"</td><td>" + contact.position +
"</td><td>" + contact.organization +
"</td><td>" + contact.role +
"</td><td>" + contact.email +
"</td><td>" + contact.voice +
"</td><td>" + contact.fax +
"</td><td>";
69 bool notFirstRow =
false;
74 myMetadata += QLatin1String(
"<br />\n" );
76 if ( ! oneAddress.
type.isEmpty() )
78 myMetadata += oneAddress.
type + QStringLiteral(
"<br />" );
80 if ( ! oneAddress.
address.isEmpty() )
82 myMetadata += oneAddress.
address + QStringLiteral(
"<br />" );
86 myMetadata += oneAddress.
postalCode + QStringLiteral(
"<br />" );
88 if ( ! oneAddress.
city.isEmpty() )
90 myMetadata += oneAddress.
city + QStringLiteral(
"<br />" );
96 if ( ! oneAddress.
country.isEmpty() )
98 myMetadata += oneAddress.
country;
102 myMetadata += QLatin1String(
"</td></tr>\n" );
105 myMetadata += QLatin1String(
"</table>\n" );
112 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
113 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"CRS" ) + QStringLiteral(
"</td><td>" );
116 myMetadata += mMetadata.
crs().
authid() + QStringLiteral(
" - " );
117 myMetadata += mMetadata.
crs().
description() + QStringLiteral(
" - " );
119 myMetadata += QObject::tr(
"Geographic" );
121 myMetadata += QObject::tr(
"Projected" );
123 myMetadata += QLatin1String(
"</td></tr>\n" );
126 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Spatial Extent" ) + QStringLiteral(
"</td><td>" );
127 const QList< QgsLayerMetadata::SpatialExtent > spatialExtents = extent.
spatialExtents();
128 bool notFirstRow =
false;
133 myMetadata += QLatin1String(
"<br />\n" );
135 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"CRS" ) + QStringLiteral(
": </strong>" ) + spatialExtent.extentCrs.authid() + QStringLiteral(
" - " );
136 myMetadata += spatialExtent.extentCrs.description() + QStringLiteral(
" - " );
137 if ( spatialExtent.extentCrs.isGeographic() )
138 myMetadata += QObject::tr(
"Geographic" );
140 myMetadata += QObject::tr(
"Projected" );
141 myMetadata += QStringLiteral(
"<br />" );
142 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"X Minimum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.xMinimum() ) + QStringLiteral(
"<br />" );
143 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Y Minimum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.yMinimum() ) + QStringLiteral(
"<br />" );
144 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"X Maximum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.xMaximum() ) + QStringLiteral(
"<br />" );
145 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Y Maximum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.yMaximum() ) + QStringLiteral(
"<br />" );
146 if ( spatialExtent.bounds.zMinimum() || spatialExtent.bounds.zMinimum() )
148 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Z Minimum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.zMinimum() ) + QStringLiteral(
"<br />" );
149 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Z Maximum" ) + QStringLiteral(
": </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.zMaximum() );
153 myMetadata += QLatin1String(
"</td></tr>\n" );
154 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Temporal Extent" ) + QStringLiteral(
"</td><td>" );
155 const QList< QgsDateTimeRange > temporalExtents = extent.
temporalExtents();
157 for (
const QgsDateTimeRange &temporalExtent : temporalExtents )
161 myMetadata += QLatin1String(
"<br />\n" );
163 if ( temporalExtent.isInstant() )
165 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Instant" ) + QStringLiteral(
": </strong>" ) + temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate );
169 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"Start" ) + QStringLiteral(
": </strong>" ) + temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) + QStringLiteral(
"<br />\n" );
170 myMetadata += QStringLiteral(
"<strong>" ) + QObject::tr(
"End" ) + QStringLiteral(
": </strong>" ) + temporalExtent.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate );
174 myMetadata += QLatin1String(
"</td></tr>\n" );
175 myMetadata += QLatin1String(
"</table>\n" );
181 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
184 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Identifier" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
identifier() + QStringLiteral(
"</td></tr>\n" );
187 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Parent Identifier" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
parentIdentifier() + QStringLiteral(
"</td></tr>\n" );
190 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Title" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
title() + QStringLiteral(
"</td></tr>\n" );
193 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Type" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
type() + QStringLiteral(
"</td></tr>\n" );
196 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Language" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
language() + QStringLiteral(
"</td></tr>\n" );
199 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Abstract" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
abstract() + QStringLiteral(
"</td></tr>\n" );
202 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Categories" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
categories().join( QStringLiteral(
", " ) ) + QStringLiteral(
"</td></tr>\n" );
205 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + QObject::tr(
"Keywords" ) + QStringLiteral(
"</td><td>\n" );
206 QMapIterator<QString, QStringList> i( mMetadata.
keywords() );
209 myMetadata += QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
210 myMetadata +=
"<tr><th>" + QObject::tr(
"Vocabulary" ) +
"</th><th>" + QObject::tr(
"Items" ) +
"</th></tr>\n";
212 while ( i.hasNext() )
217 rowClass = QStringLiteral(
"class=\"odd-row\"" );
218 myMetadata +=
"<tr " + rowClass +
"><td>" + i.key() +
"</td><td>" + i.value().join( QStringLiteral(
", " ) ) +
"</td></tr>\n";
221 myMetadata += QLatin1String(
"</table>\n" );
223 myMetadata += QLatin1String(
"</td></tr>\n" );
224 myMetadata += QLatin1String(
"</table>\n" );
231 const QStringList historyItems = mMetadata.
history();
232 if ( historyItems.isEmpty() )
234 myMetadata += QStringLiteral(
"<p>" ) + QObject::tr(
"No history yet." ) + QStringLiteral(
"</p>\n" );
238 myMetadata = QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
239 myMetadata +=
"<tr><th>" + QObject::tr(
"ID" ) +
"</th><th>" + QObject::tr(
"Action" ) +
"</th></tr>\n";
241 for (
const QString &history : historyItems )
245 rowClass = QStringLiteral(
"class=\"odd-row\"" );
246 myMetadata +=
"<tr " + rowClass +
"><td width=\"5%\">" + QString::number( i ) +
"</td><td>" + history +
"</td></tr>\n";
249 myMetadata += QLatin1String(
"</table>\n" );
257 const QList<QgsAbstractMetadataBase::Link> &links = mMetadata.
links();
258 if ( links.isEmpty() )
260 myMetadata += QStringLiteral(
"<p>" ) + QObject::tr(
"No links yet." ) + QStringLiteral(
"</p>\n" );
264 myMetadata = QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
265 myMetadata +=
"<tr><th>" + QObject::tr(
"ID" ) +
"</th><th>" + QObject::tr(
"Name" ) +
"</th><th>" + QObject::tr(
"Type" ) +
"</th><th>" + QObject::tr(
"URL" ) +
"</th><th>" + QObject::tr(
"Description" ) +
"</th><th>" + QObject::tr(
"Format" ) +
"</th><th>" + QObject::tr(
"MIME Type" ) +
"</th><th>" + QObject::tr(
"Size" ) +
"</th></tr>\n";
271 rowClass = QStringLiteral(
"class=\"odd-row\"" );
272 myMetadata +=
"<tr " + rowClass +
"><td>" + QString::number( i ) +
"</td><td>" + link.name +
"</td><td>" + link.type +
"</td><td>" + link.url +
"</td><td>" + link.description +
"</td><td>" + link.format +
"</td><td>" + link.mimeType +
"</td><td>" + link.size +
"</td></tr>\n";
275 myMetadata += QLatin1String(
"</table>\n" );
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString description() const
Returns the descriptive name of the CRS, e.g., "WGS 84" or "GDA 94 / Vicgrid94".
bool isGeographic() const
Returns whether the CRS is a geographic CRS (using lat/lon coordinates)
QString authid() const
Returns the authority identifier for the CRS.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.