15 #include <QStringBuilder>
23 : mMetadata( metadata )
29 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
30 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Fees" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
fees() + QStringLiteral(
"</td></tr>\n" );
31 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Licenses" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
licenses().join( QStringLiteral(
"<br />" ) ) + QStringLiteral(
"</td></tr>\n" );
32 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Rights" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
rights().join( QStringLiteral(
"<br />" ) ) + QStringLiteral(
"</td></tr>\n" );
33 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Constraints" ) + QStringLiteral(
"</td><td>" );
34 const QList<QgsLayerMetadata::Constraint> &constraints = mMetadata.
constraints();
35 bool notFirstRow =
false;
40 myMetadata += QStringLiteral(
"<br />" );
42 myMetadata += QStringLiteral(
"<strong>" ) + constraint.type + QStringLiteral(
": </strong>" ) + constraint.constraint;
45 mMetadata.
rights().join( QStringLiteral(
"<br />" ) );
46 myMetadata += QStringLiteral(
"</td></tr>\n" );
47 myMetadata += QStringLiteral(
"</table>\n" );
53 const QList<QgsAbstractMetadataBase::Contact> &contacts = mMetadata.
contacts();
55 if ( contacts.isEmpty() )
57 myMetadata += QStringLiteral(
"<p>" ) + tr(
"No contact yet." ) + QStringLiteral(
"</p>" );
61 myMetadata += QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
62 myMetadata += QLatin1String(
"<tr><th>" ) + tr(
"ID" ) + QLatin1String(
"</th><th>" ) + tr(
"Name" ) + QLatin1String(
"</th><th>" ) + tr(
"Position" ) + QLatin1String(
"</th><th>" ) + tr(
"Organization" ) + QLatin1String(
"</th><th>" ) + tr(
"Role" ) + QLatin1String(
"</th><th>" ) + tr(
"Email" ) + QLatin1String(
"</th><th>" ) + tr(
"Voice" ) + QLatin1String(
"</th><th>" ) + tr(
"Fax" ) + QLatin1String(
"</th><th>" ) + tr(
"Addresses" ) + QLatin1String(
"</th></tr>\n" );
68 rowClass = QStringLiteral(
"class=\"odd-row\"" );
69 myMetadata += QLatin1String(
"<tr " ) + rowClass + QLatin1String(
"><td>" ) + QString::number( i ) + QLatin1String(
"</td><td>" ) + contact.name + QLatin1String(
"</td><td>" ) + contact.position + QLatin1String(
"</td><td>" ) + contact.organization + QLatin1String(
"</td><td>" ) + contact.role + QLatin1String(
"</td><td>" ) + contact.email + QLatin1String(
"</td><td>" ) + contact.voice + QLatin1String(
"</td><td>" ) + contact.fax + QLatin1String(
"</td><td>" );
70 bool notFirstRow =
false;
75 myMetadata += QLatin1String(
"<br />\n" );
77 if ( ! oneAddress.
type.isEmpty() )
79 myMetadata += oneAddress.
type + QStringLiteral(
"<br />" );
81 if ( ! oneAddress.
address.isEmpty() )
83 myMetadata += oneAddress.
address + QStringLiteral(
"<br />" );
87 myMetadata += oneAddress.
postalCode + QStringLiteral(
"<br />" );
89 if ( ! oneAddress.
city.isEmpty() )
91 myMetadata += oneAddress.
city + QStringLiteral(
"<br />" );
97 if ( ! oneAddress.
country.isEmpty() )
99 myMetadata += oneAddress.
country;
103 myMetadata += QLatin1String(
"</td></tr>\n" );
106 myMetadata += QLatin1String(
"</table>\n" );
114 bool notFirstRow =
false;
115 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
116 if ( showSpatialExtent )
118 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"CRS" ) + QStringLiteral(
"</td><td>" );
123 myMetadata += tr(
"Geographic" );
125 myMetadata += tr(
"Projected" );
127 myMetadata += QLatin1String(
"</td></tr>\n" );
129 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Spatial Extent" ) + QStringLiteral(
"</td><td>" );
130 const QList< QgsLayerMetadata::SpatialExtent > spatialExtents = extent.
spatialExtents();
135 myMetadata += QLatin1String(
"<br />\n" );
137 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"CRS" ) + QStringLiteral(
": </strong>" ) + spatialExtent.extentCrs.userFriendlyIdentifier() + QStringLiteral(
" - " );
138 if ( spatialExtent.extentCrs.isGeographic() )
139 myMetadata += tr(
"Geographic" );
141 myMetadata += tr(
"Projected" );
142 myMetadata += QStringLiteral(
"<br />" );
143 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"X Minimum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.xMinimum() ) + QStringLiteral(
"<br />" );
144 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Y Minimum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.yMinimum() ) + QStringLiteral(
"<br />" );
145 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"X Maximum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.xMaximum() ) + QStringLiteral(
"<br />" );
146 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Y Maximum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.yMaximum() ) + QStringLiteral(
"<br />" );
147 if ( spatialExtent.bounds.zMinimum() || spatialExtent.bounds.zMaximum() )
149 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Z Minimum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.zMinimum() ) + QStringLiteral(
"<br />" );
150 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Z Maximum:" ) + QStringLiteral(
" </strong>" ) +
qgsDoubleToString( spatialExtent.bounds.zMaximum() );
154 myMetadata += QLatin1String(
"</td></tr>\n" );
156 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Temporal Extent" ) + QStringLiteral(
"</td><td>" );
157 const QList< QgsDateTimeRange > temporalExtents = extent.
temporalExtents();
159 for (
const QgsDateTimeRange &temporalExtent : temporalExtents )
163 myMetadata += QLatin1String(
"<br />\n" );
165 if ( temporalExtent.isInstant() )
167 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Instant:" ) + QStringLiteral(
" </strong>" ) + temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate );
171 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"Start:" ) + QStringLiteral(
" </strong>" ) + temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) + QStringLiteral(
"<br />\n" );
172 myMetadata += QStringLiteral(
"<strong>" ) + tr(
"End:" ) + QStringLiteral(
" </strong>" ) + temporalExtent.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate );
176 myMetadata += QLatin1String(
"</td></tr>\n" );
177 myMetadata += QLatin1String(
"</table>\n" );
183 QString myMetadata = QStringLiteral(
"<table class=\"list-view\">\n" );
186 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Identifier" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
identifier() + QStringLiteral(
"</td></tr>\n" );
189 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Parent Identifier" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
parentIdentifier() + QStringLiteral(
"</td></tr>\n" );
192 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Title" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
title() + QStringLiteral(
"</td></tr>\n" );
195 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Type" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
type() + QStringLiteral(
"</td></tr>\n" );
198 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Language" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
language() + QStringLiteral(
"</td></tr>\n" );
201 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Abstract" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
abstract() + QStringLiteral(
"</td></tr>\n" );
204 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Categories" ) + QStringLiteral(
"</td><td>" ) + mMetadata.
categories().join( QStringLiteral(
", " ) ) + QStringLiteral(
"</td></tr>\n" );
207 myMetadata += QStringLiteral(
"<tr><td class=\"highlight\">" ) + tr(
"Keywords" ) + QStringLiteral(
"</td><td>\n" );
208 QMapIterator<QString, QStringList> i( mMetadata.
keywords() );
211 myMetadata += QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
212 myMetadata += QLatin1String(
"<tr><th>" ) + tr(
"Vocabulary" ) + QLatin1String(
"</th><th>" ) + tr(
"Items" ) + QLatin1String(
"</th></tr>\n" );
214 while ( i.hasNext() )
219 rowClass = QStringLiteral(
"class=\"odd-row\"" );
220 myMetadata += QLatin1String(
"<tr " ) + rowClass + QLatin1String(
"><td>" ) + i.key() + QLatin1String(
"</td><td>" ) + i.value().join( QStringLiteral(
", " ) ) + QLatin1String(
"</td></tr>\n" );
223 myMetadata += QLatin1String(
"</table>\n" );
225 myMetadata += QLatin1String(
"</td></tr>\n" );
226 myMetadata += QLatin1String(
"</table>\n" );
233 const QStringList historyItems = mMetadata.
history();
234 if ( historyItems.isEmpty() )
236 myMetadata += QStringLiteral(
"<p>" ) + tr(
"No history yet." ) + QStringLiteral(
"</p>\n" );
240 myMetadata += QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
241 myMetadata += QLatin1String(
"<tr><th>" ) + tr(
"ID" ) + QLatin1String(
"</th><th>" ) + tr(
"Action" ) + QLatin1String(
"</th></tr>\n" );
243 for (
const QString &history : historyItems )
247 rowClass = QStringLiteral(
"class=\"odd-row\"" );
248 myMetadata += QLatin1String(
"<tr " ) + rowClass + QLatin1String(
"><td width=\"5%\">" ) + QString::number( i ) + QLatin1String(
"</td><td>" ) + history + QLatin1String(
"</td></tr>\n" );
251 myMetadata += QLatin1String(
"</table>\n" );
259 const QList<QgsAbstractMetadataBase::Link> &links = mMetadata.
links();
260 if ( links.isEmpty() )
262 myMetadata += QStringLiteral(
"<p>" ) + tr(
"No links yet." ) + QStringLiteral(
"</p>\n" );
266 myMetadata += QStringLiteral(
"<table width=\"100%\" class=\"tabular-view\">\n" );
267 myMetadata += QLatin1String(
"<tr><th>" ) + tr(
"ID" ) + QLatin1String(
"</th><th>" ) + tr(
"Name" ) + QLatin1String(
"</th><th>" ) + tr(
"Type" ) + QLatin1String(
"</th><th>" ) + tr(
"URL" ) + QLatin1String(
"</th><th>" ) + tr(
"Description" ) + QLatin1String(
"</th><th>" ) + tr(
"Format" ) + QLatin1String(
"</th><th>" ) + tr(
"MIME Type" ) + QLatin1String(
"</th><th>" ) + tr(
"Size" ) + QLatin1String(
"</th></tr>\n" );
273 rowClass = QStringLiteral(
"class=\"odd-row\"" );
274 myMetadata += QLatin1String(
"<tr " ) + rowClass + QLatin1String(
"><td>" ) + QString::number( i ) + QLatin1String(
"</td><td>" ) + link.name + QLatin1String(
"</td><td>" ) + link.type + QLatin1String(
"</td><td>" ) + link.url + QLatin1String(
"</td><td>" ) + link.description + QLatin1String(
"</td><td>" ) + link.format + QLatin1String(
"</td><td>" ) + link.mimeType + QLatin1String(
"</td><td>" ) + link.size + QLatin1String(
"</td></tr>\n" );
277 myMetadata += QLatin1String(
"</table>\n" );