53#include <QDomDocument> 
   55#include <QDomImplementation> 
   63#include <QStandardPaths> 
   65#include <QRegularExpression> 
   74      return QStringLiteral( 
".qmd" );
 
   77      return QStringLiteral( 
".qml" );
 
   83                          const QString &lyrname,
 
   84                          const QString &source )
 
   85  : mDataSource( source )
 
   86  , mLayerName( lyrname )
 
   89  , mUndoStack( new QUndoStack( this ) )
 
   90  , mUndoStackStyles( new QUndoStack( this ) )
 
   92  , mRefreshTimer( new QTimer( this ) )
 
   97  connect( mRefreshTimer, &QTimer::timeout, 
this, [ = ] { 
triggerRepaint( 
true ); } );
 
  109  delete mStyleManager;
 
  119  for ( 
const QString &s : constStyles )
 
  167  if ( 
flags == mFlags )
 
  178  return Qgis::MapLayerProperties();
 
  236  if ( urls.isEmpty() )
 
  239    urls.prepend( newItem );
 
  245    urls.prepend( newItem );
 
  254  if ( mServerProperties->metadataUrls().isEmpty() )
 
  256    return QLatin1String();
 
  260    return mServerProperties->metadataUrls().first().url;
 
  268  QList<QgsMapLayerServerProperties::MetadataUrl> urls = mServerProperties->metadataUrls();
 
  269  if ( urls.isEmpty() )
 
  272    urls.prepend( newItem );
 
  278    urls.prepend( newItem );
 
  280  mServerProperties->setMetadataUrls( urls );
 
  287  if ( mServerProperties->metadataUrls().isEmpty() )
 
  289    return QLatin1String();
 
  293    return mServerProperties->metadataUrls().first().type;
 
  301  QList<QgsMapLayerServerProperties::MetadataUrl> urls = mServerProperties->metadataUrls();
 
  302  if ( urls.isEmpty() )
 
  305    urls.prepend( newItem );
 
  311    urls.prepend( newItem );
 
  313  mServerProperties->setMetadataUrls( urls );
 
  320  if ( mServerProperties->metadataUrls().isEmpty() )
 
  326    return mServerProperties->metadataUrls().first().format;
 
  405  mnl = layerElement.namedItem( QStringLiteral( 
"provider" ) );
 
  406  mne = mnl.toElement();
 
  407  provider = mne.text();
 
  410  mnl = layerElement.namedItem( QStringLiteral( 
"datasource" ) );
 
  411  mne = mnl.toElement();
 
  415  const thread_local QRegularExpression rx( 
"authcfg=([a-z]|[A-Z]|[0-9]){7}" );
 
  428  mnl = layerElement.namedItem( QStringLiteral( 
"layername" ) );
 
  429  mne = mnl.toElement();
 
  434  const QDomNode srsNode = layerElement.namedItem( QStringLiteral( 
"srs" ) );
 
  453  mnl = layerElement.namedItem( QStringLiteral( 
"id" ) );
 
  454  if ( ! mnl.isNull() )
 
  456    mne = mnl.toElement();
 
  457    if ( ! mne.isNull() && mne.text().length() > 10 ) 
 
  464  mnl = layerElement.namedItem( QStringLiteral( 
"layername" ) );
 
  465  mne = mnl.toElement();
 
  468  setName( context.
projectTranslator()->
translate( QStringLiteral( 
"project:layers:%1" ).arg( layerElement.namedItem( QStringLiteral( 
"id" ) ).toElement().text() ), mne.text() ) );
 
  471  layerError = !
readXml( layerElement, context );
 
  480  const QDomElement shortNameElem = layerElement.firstChildElement( QStringLiteral( 
"shortname" ) );
 
  481  if ( !shortNameElem.isNull() )
 
  487  const QDomElement titleElem = layerElement.firstChildElement( QStringLiteral( 
"title" ) );
 
  488  if ( !titleElem.isNull() )
 
  490    mTitle = titleElem.text();
 
  494  const QDomElement abstractElem = layerElement.firstChildElement( QStringLiteral( 
"abstract" ) );
 
  495  if ( !abstractElem.isNull() )
 
  501  const QDomElement keywordListElem = layerElement.firstChildElement( QStringLiteral( 
"keywordList" ) );
 
  502  if ( !keywordListElem.isNull() )
 
  505    for ( QDomNode n = keywordListElem.firstChild(); !n.isNull(); n = n.nextSibling() )
 
  507      kwdList << n.toElement().text();
 
  513  const QDomElement dataUrlElem = layerElement.firstChildElement( QStringLiteral( 
"dataUrl" ) );
 
  514  if ( !dataUrlElem.isNull() )
 
  517    mDataUrlFormat = dataUrlElem.attribute( QStringLiteral( 
"format" ), QString() );
 
  521  const QDomElement legendUrlElem = layerElement.firstChildElement( QStringLiteral( 
"legendUrl" ) );
 
  522  if ( !legendUrlElem.isNull() )
 
  525    mLegendUrlFormat = legendUrlElem.attribute( QStringLiteral( 
"format" ), QString() );
 
  529  const QDomElement attribElem = layerElement.firstChildElement( QStringLiteral( 
"attribution" ) );
 
  530  if ( !attribElem.isNull() )
 
  533    mAttributionUrl = attribElem.attribute( QStringLiteral( 
"href" ), QString() );
 
  542    const QDomElement metaUrlElem = layerElement.firstChildElement( QStringLiteral( 
"metadataUrl" ) );
 
  543    if ( !metaUrlElem.isNull() )
 
  545      const QString url = metaUrlElem.text();
 
  546      const QString 
type = metaUrlElem.attribute( QStringLiteral( 
"type" ), QString() );
 
  547      const QString format = metaUrlElem.attribute( QStringLiteral( 
"format" ), QString() );
 
  549      mServerProperties->setMetadataUrls( QList<QgsMapLayerServerProperties::MetadataUrl>() << newItem );
 
  554  const QDomElement metadataElem = layerElement.firstChildElement( QStringLiteral( 
"resourceMetadata" ) );
 
  557  setAutoRefreshInterval( layerElement.attribute( QStringLiteral( 
"autoRefreshTime" ), QStringLiteral( 
"0" ) ).toInt() );
 
  558  setAutoRefreshEnabled( layerElement.attribute( QStringLiteral( 
"autoRefreshEnabled" ), QStringLiteral( 
"0" ) ).toInt() );
 
  560  setRefreshOnNotifyEnabled( layerElement.attribute( QStringLiteral( 
"refreshOnNotifyEnabled" ), QStringLiteral( 
"0" ) ).toInt() );
 
  563  if ( 
mReadFlags & QgsMapLayer::ReadFlag::FlagTrustLayerMetadata )
 
  565    const QDomNode wgs84ExtentNode = layerElement.namedItem( QStringLiteral( 
"wgs84extent" ) );
 
  566    if ( !wgs84ExtentNode.isNull() )
 
  570  mLegendPlaceholderImage = layerElement.attribute( QStringLiteral( 
"legendPlaceholderImage" ) );
 
  580  Q_UNUSED( layer_node )
 
  587    const QDomNode extentNode = layer_node.namedItem( QStringLiteral( 
"extent" ) );
 
  588    if ( !extentNode.isNull() )
 
  608  layerElement.setAttribute( QStringLiteral( 
"autoRefreshTime" ), QString::number( mRefreshTimer->interval() ) );
 
  609  layerElement.setAttribute( QStringLiteral( 
"autoRefreshEnabled" ), mRefreshTimer->isActive() ? 1 : 0 );
 
  614  QDomElement layerId = document.createElement( QStringLiteral( 
"id" ) );
 
  615  const QDomText layerIdText = document.createTextNode( 
id() );
 
  616  layerId.appendChild( layerIdText );
 
  618  layerElement.appendChild( layerId );
 
  621  QDomElement dataSource = document.createElement( QStringLiteral( 
"datasource" ) );
 
  623  const QDomText dataSourceText = document.createTextNode( src );
 
  624  dataSource.appendChild( dataSourceText );
 
  625  layerElement.appendChild( dataSource );
 
  628  QDomElement layerName = document.createElement( QStringLiteral( 
"layername" ) );
 
  629  const QDomText layerNameText = document.createTextNode( 
name() );
 
  630  layerName.appendChild( layerNameText );
 
  631  layerElement.appendChild( layerName );
 
  636    QDomElement layerShortName = document.createElement( QStringLiteral( 
"shortname" ) );
 
  637    const QDomText layerShortNameText = document.createTextNode( 
mShortName );
 
  638    layerShortName.appendChild( layerShortNameText );
 
  639    layerElement.appendChild( layerShortName );
 
  645    QDomElement layerTitle = document.createElement( QStringLiteral( 
"title" ) );
 
  646    const QDomText layerTitleText = document.createTextNode( 
mTitle );
 
  647    layerTitle.appendChild( layerTitleText );
 
  648    layerElement.appendChild( layerTitle );
 
  654    QDomElement layerAbstract = document.createElement( QStringLiteral( 
"abstract" ) );
 
  655    const QDomText layerAbstractText = document.createTextNode( 
mAbstract );
 
  656    layerAbstract.appendChild( layerAbstractText );
 
  657    layerElement.appendChild( layerAbstract );
 
  661  const QStringList keywordStringList = 
keywordList().split( 
',' );
 
  662  if ( !keywordStringList.isEmpty() )
 
  664    QDomElement layerKeywordList = document.createElement( QStringLiteral( 
"keywordList" ) );
 
  665    for ( 
int i = 0; i < keywordStringList.size(); ++i )
 
  667      QDomElement layerKeywordValue = document.createElement( QStringLiteral( 
"value" ) );
 
  668      const QDomText layerKeywordText = document.createTextNode( keywordStringList.at( i ).trimmed() );
 
  669      layerKeywordValue.appendChild( layerKeywordText );
 
  670      layerKeywordList.appendChild( layerKeywordValue );
 
  672    layerElement.appendChild( layerKeywordList );
 
  676  const QString aDataUrl = 
dataUrl();
 
  677  if ( !aDataUrl.isEmpty() )
 
  679    QDomElement layerDataUrl = document.createElement( QStringLiteral( 
"dataUrl" ) );
 
  680    const QDomText layerDataUrlText = document.createTextNode( aDataUrl );
 
  681    layerDataUrl.appendChild( layerDataUrlText );
 
  682    layerDataUrl.setAttribute( QStringLiteral( 
"format" ), 
dataUrlFormat() );
 
  683    layerElement.appendChild( layerDataUrl );
 
  688  if ( !aLegendUrl.isEmpty() )
 
  690    QDomElement layerLegendUrl = document.createElement( QStringLiteral( 
"legendUrl" ) );
 
  691    const QDomText layerLegendUrlText = document.createTextNode( aLegendUrl );
 
  692    layerLegendUrl.appendChild( layerLegendUrlText );
 
  693    layerLegendUrl.setAttribute( QStringLiteral( 
"format" ), 
legendUrlFormat() );
 
  694    layerElement.appendChild( layerLegendUrl );
 
  699  if ( !aAttribution.isEmpty() )
 
  701    QDomElement layerAttribution = document.createElement( QStringLiteral( 
"attribution" ) );
 
  702    const QDomText layerAttributionText = document.createTextNode( aAttribution );
 
  703    layerAttribution.appendChild( layerAttributionText );
 
  704    layerAttribution.setAttribute( QStringLiteral( 
"href" ), 
attributionUrl() );
 
  705    layerElement.appendChild( layerAttribution );
 
  711    QDomElement stamp = document.createElement( QStringLiteral( 
"timestamp" ) );
 
  712    const QDomText stampText = document.createTextNode( 
timestamp().toString( Qt::ISODate ) );
 
  713    stamp.appendChild( stampText );
 
  714    layerElement.appendChild( stamp );
 
  717  layerElement.appendChild( layerName );
 
  724  QDomElement mySrsElement = document.createElement( QStringLiteral( 
"srs" ) );
 
  725  mCRS.
writeXml( mySrsElement, document );
 
  726  layerElement.appendChild( mySrsElement );
 
  729  QDomElement myMetadataElem = document.createElement( QStringLiteral( 
"resourceMetadata" ) );
 
  731  layerElement.appendChild( myMetadataElem );
 
  733  layerElement.setAttribute( QStringLiteral( 
"legendPlaceholderImage" ), mLegendPlaceholderImage );
 
  736  return writeXml( layerElement, document, context );
 
  745  const QMetaEnum metaEnum = QMetaEnum::fromType<QgsMapLayer::StyleCategories>();
 
  746  const QString categoriesKeys( metaEnum.valueToKeys( 
static_cast<int>( categories ) ) );
 
  747  layerElement.setAttribute( QStringLiteral( 
"styleCategories" ), categoriesKeys );
 
  752    layerElement.setAttribute( QStringLiteral( 
"hasScaleBasedVisibilityFlag" ), 
hasScaleBasedVisibility() ? 1 : 0 );
 
  753    layerElement.setAttribute( QStringLiteral( 
"maxScale" ), QString::number( 
maximumScale() ) );
 
  754    layerElement.setAttribute( QStringLiteral( 
"minScale" ), QString::number( 
minimumScale() ) );
 
  761      QDomElement renderer3DElem = document.createElement( QStringLiteral( 
"renderer-3d" ) );
 
  762      renderer3DElem.setAttribute( QStringLiteral( 
"type" ), m3DRenderer->
type() );
 
  763      m3DRenderer->
writeXml( renderer3DElem, context );
 
  764      layerElement.appendChild( renderer3DElem );
 
  772    QDomElement layerFlagsElem = document.createElement( QStringLiteral( 
"flags" ) );
 
  773    const auto enumMap = qgsEnumMap<QgsMapLayer::LayerFlag>();
 
  774    for ( 
auto it = enumMap.constBegin(); it != enumMap.constEnd(); ++it )
 
  776      const bool flagValue = mFlags.testFlag( it.key() );
 
  777      QDomElement flagElem = document.createElement( it.value() );
 
  778      flagElem.appendChild( document.createTextNode( QString::number( flagValue ) ) );
 
  779      layerFlagsElem.appendChild( flagElem );
 
  781    layerElement.appendChild( layerFlagsElem );
 
  784  if ( categories.testFlag( 
Temporal ) )
 
  787      properties->writeXml( layerElement, document, context );
 
  793      properties->writeXml( layerElement, document, context );
 
  798    QDomElement notesElem = document.createElement( QStringLiteral( 
"userNotes" ) );
 
  800    layerElement.appendChild( notesElem );
 
  815  Q_UNUSED( layer_node )
 
  856  mCustomProperties.
readXml( layerNode, keyStartsWith );
 
  858  for ( 
const QString &key : mCustomProperties.
keys() )
 
  860    if ( !oldKeys.contains( key ) || mCustomProperties.
value( key ) != oldKeys.value( key ) )
 
  871  mCustomProperties.
writeXml( layerNode, doc );
 
  878  const QDomElement styleMgrElem = layerNode.firstChildElement( QStringLiteral( 
"map-layer-style-manager" ) );
 
  879  if ( !styleMgrElem.isNull() )
 
  880    mStyleManager->
readXml( styleMgrElem );
 
  882    mStyleManager->
reset();
 
  891    QDomElement styleMgrElem = doc.createElement( QStringLiteral( 
"map-layer-style-manager" ) );
 
  892    mStyleManager->
writeXml( styleMgrElem );
 
  893    layerNode.appendChild( styleMgrElem );
 
  901  return mMapTipTemplate;
 
  908  if ( mMapTipTemplate == mapTip )
 
  911  mMapTipTemplate = mapTip;
 
  924void QgsMapLayer::connectNotify( 
const char *signal )
 
  936  return !mScaleBasedVisibility ||
 
  938           && ( mMaxScale == 0 || scale < mMaxScale ) );
 
  946  return mScaleBasedVisibility;
 
  953  return mRefreshTimer->isActive();
 
  960  return mRefreshTimer->interval();
 
  969    mRefreshTimer->stop();
 
  970    mRefreshTimer->setInterval( 0 );
 
  974    mRefreshTimer->setInterval( interval );
 
  984    mRefreshTimer->stop();
 
  985  else if ( mRefreshTimer->interval() > 0 )
 
  986    mRefreshTimer->start();
 
 1023  mScaleBasedVisibility = enabled;
 
 1037  return QStringList();
 
 1096  QString layerName( 
name );
 
 1097  layerName.replace( 
'_', 
' ' );
 
 1102QString QgsMapLayer::baseURI( PropertyType type )
 const 
 1116    myURI = components[
"path"].toString();
 
 1119  QFileInfo myFileInfo( myURI );
 
 1122  if ( myFileInfo.exists() )
 
 1125    if ( myURI.endsWith( QLatin1String( 
".gz" ), Qt::CaseInsensitive ) )
 
 1127    else if ( myURI.endsWith( QLatin1String( 
".zip" ), Qt::CaseInsensitive ) )
 
 1129    else if ( myURI.endsWith( QLatin1String( 
".tar" ), Qt::CaseInsensitive ) )
 
 1131    else if ( myURI.endsWith( QLatin1String( 
".tar.gz" ), Qt::CaseInsensitive ) )
 
 1133    else if ( myURI.endsWith( QLatin1String( 
".tgz" ), Qt::CaseInsensitive ) )
 
 1135    myFileInfo.setFile( myURI );
 
 1151  return baseURI( PropertyType::Metadata );
 
 1164        QString errorMessage;
 
 1167          return tr( 
"Successfully saved default layer metadata" );
 
 1169          return errorMessage;
 
 1194  return baseURI( PropertyType::Style );
 
 1208  return loadNamedPropertyFromDatabase( db, uri, qmd, PropertyType::Metadata );
 
 1215  return loadNamedPropertyFromDatabase( db, uri, qml, PropertyType::Style );
 
 1218bool QgsMapLayer::loadNamedPropertyFromDatabase( 
const QString &db, 
const QString &uri, QString &xml, 
QgsMapLayer::PropertyType type )
 
 1222  QgsDebugMsgLevel( QStringLiteral( 
"db = %1 uri = %2" ).arg( db, uri ), 4 );
 
 1224  bool resultFlag = 
false;
 
 1232  QgsDebugMsgLevel( QStringLiteral( 
"Trying to load style or metadata for \"%1\" from \"%2\"" ).arg( uri, db ), 4 );
 
 1234  if ( db.isEmpty() || !QFile( db ).exists() )
 
 1237  myResult = database.
open_v2( db, SQLITE_OPEN_READONLY, 
nullptr );
 
 1238  if ( myResult != SQLITE_OK )
 
 1247      mySql = QStringLiteral( 
"select qmd from tbl_metadata where metadata=?" );
 
 1251      mySql = QStringLiteral( 
"select qml from tbl_styles where style=?" );
 
 1255  statement = database.
prepare( mySql, myResult );
 
 1256  if ( myResult == SQLITE_OK )
 
 1258    QByteArray param = uri.toUtf8();
 
 1260    if ( sqlite3_bind_text( statement.get(), 1, param.data(), param.length(), SQLITE_STATIC ) == SQLITE_OK &&
 
 1261         sqlite3_step( statement.get() ) == SQLITE_ROW )
 
 1263      xml = QString::fromUtf8( 
reinterpret_cast< const char * 
>( sqlite3_column_text( statement.get(), 0 ) ) );
 
 1275  return loadNamedProperty( uri, PropertyType::Style, resultFlag, categories );
 
 1278QString QgsMapLayer::loadNamedProperty( 
const QString &uri, 
QgsMapLayer::PropertyType type, 
bool &resultFlag, StyleCategories categories )
 
 1285  if ( uri.isEmpty() )
 
 1288  QDomDocument myDocument( QStringLiteral( 
"qgis" ) );
 
 1292  QString myErrorMessage;
 
 1294  QFile myFile( uri );
 
 1295  if ( myFile.open( QFile::ReadOnly ) )
 
 1299    resultFlag = myDocument.setContent( &myFile, &myErrorMessage, &line, &column );
 
 1301      myErrorMessage = tr( 
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
 
 1318          resultFlag = myDocument.setContent( xml, &myErrorMessage, &line, &column );
 
 1321            myErrorMessage = tr( 
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
 
 1326          myErrorMessage = tr( 
"Style not found in database" );
 
 1337          resultFlag = myDocument.setContent( xml, &myErrorMessage, &line, &column );
 
 1340            myErrorMessage = tr( 
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
 
 1345          myErrorMessage = tr( 
"Metadata not found in database" );
 
 1355    return myErrorMessage;
 
 1363        myErrorMessage = tr( 
"Loading style file %1 failed because:\n%2" ).arg( uri, myErrorMessage );
 
 1368        myErrorMessage = tr( 
"Loading metadata file %1 failed because:\n%2" ).arg( uri, myErrorMessage );
 
 1371  return myErrorMessage;
 
 1378  const QDomElement myRoot = document.firstChildElement( QStringLiteral( 
"qgis" ) );
 
 1379  if ( myRoot.isNull() )
 
 1381    errorMessage = tr( 
"Root <qgis> element could not be found" );
 
 1392  const QDomElement myRoot = myDocument.firstChildElement( QStringLiteral( 
"qgis" ) );
 
 1393  if ( myRoot.isNull() )
 
 1395    myErrorMessage = tr( 
"Root <qgis> element could not be found" );
 
 1400  const QgsProjectVersion fileVersion( myRoot.attribute( QStringLiteral( 
"version" ) ) );
 
 1403  if ( thisVersion > fileVersion )
 
 1416    if ( 
type() == Qgis::LayerType::Vector && !myRoot.firstChildElement( QStringLiteral( 
"layerGeometryType" ) ).isNull() )
 
 1420      if ( importLayerGeometryType != Qgis::GeometryType::Unknown && vl->
geometryType() != importLayerGeometryType )
 
 1422        myErrorMessage = tr( 
"Cannot apply style with symbology to layer with a different geometry type" );
 
 1429  return readSymbology( myRoot, myErrorMessage, context, categories ); 
 
 1436  QDomImplementation DomImplementation;
 
 1437  const QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral( 
"qgis" ), QStringLiteral( 
"http://mrcc.com/qgis.dtd" ), QStringLiteral( 
"SYSTEM" ) );
 
 1438  QDomDocument myDocument( documentType );
 
 1440  QDomElement myRootNode = myDocument.createElement( QStringLiteral( 
"qgis" ) );
 
 1441  myRootNode.setAttribute( QStringLiteral( 
"version" ), 
Qgis::version() );
 
 1442  myDocument.appendChild( myRootNode );
 
 1446    errorMsg = QObject::tr( 
"Could not save metadata" );
 
 1457  QDomImplementation DomImplementation;
 
 1458  const QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral( 
"qgis" ), QStringLiteral( 
"http://mrcc.com/qgis.dtd" ), QStringLiteral( 
"SYSTEM" ) );
 
 1459  QDomDocument myDocument( documentType );
 
 1461  QDomElement myRootNode = myDocument.createElement( QStringLiteral( 
"qgis" ) );
 
 1462  myRootNode.setAttribute( QStringLiteral( 
"version" ), 
Qgis::version() );
 
 1463  myDocument.appendChild( myRootNode );
 
 1465  if ( !
writeSymbology( myRootNode, myDocument, errorMsg, context, categories ) )  
 
 1467    errorMsg = QObject::tr( 
"Could not save symbology because:\n%1" ).arg( errorMsg );
 
 1475  if ( 
type() == Qgis::LayerType::Vector )
 
 1478    const QgsVectorLayer *vl = qobject_cast<const QgsVectorLayer *>( 
this );
 
 1479    const QString geoType = QString::number( 
static_cast<int>( vl->
geometryType() ) );
 
 1482    QDomElement layerGeometryType = myDocument.createElement( QStringLiteral( 
"layerGeometryType" ) );
 
 1483    const QDomText 
type = myDocument.createTextNode( geoType );
 
 1485    layerGeometryType.appendChild( 
type );
 
 1486    myRootNode.appendChild( layerGeometryType );
 
 1520QString QgsMapLayer::saveNamedProperty( 
const QString &uri, 
QgsMapLayer::PropertyType type, 
bool &resultFlag, StyleCategories categories )
 
 1530  if ( vlayer && vlayer->
providerType() == QLatin1String( 
"ogr" ) )
 
 1532    QStringList theURIParts = uri.split( 
'|' );
 
 1533    filename = theURIParts[0];
 
 1535  else if ( vlayer && vlayer->
providerType() == QLatin1String( 
"gpx" ) )
 
 1537    QStringList theURIParts = uri.split( 
'?' );
 
 1538    filename = theURIParts[0];
 
 1540  else if ( vlayer && vlayer->
providerType() == QLatin1String( 
"delimitedtext" ) )
 
 1542    filename = QUrl::fromEncoded( uri.toLatin1() ).toLocalFile();
 
 1544    if ( filename.isEmpty() )
 
 1552  QString myErrorMessage;
 
 1553  QDomDocument myDocument;
 
 1566  const QFileInfo myFileInfo( filename );
 
 1569    const QFileInfo myDirInfo( myFileInfo.path() );  
 
 1570    if ( !myDirInfo.isWritable() )
 
 1572      return tr( 
"The directory containing your dataset needs to be writable!" );
 
 1578    QFile myFile( myFileName );
 
 1579    if ( myFile.open( QFile::WriteOnly | QFile::Truncate ) )
 
 1581      QTextStream myFileStream( &myFile );
 
 1583      myDocument.save( myFileStream, 2 );
 
 1589          return tr( 
"Created default metadata file as %1" ).arg( myFileName );
 
 1592          return tr( 
"Created default style file as %1" ).arg( myFileName );
 
 1602          return tr( 
"ERROR: Failed to created default metadata file as %1. Check file permissions and retry." ).arg( myFileName );
 
 1605          return tr( 
"ERROR: Failed to created default style file as %1. Check file permissions and retry." ).arg( myFileName );
 
 1611    const QString qml = myDocument.toString();
 
 1618    if ( myResult != SQLITE_OK )
 
 1620      return tr( 
"User database could not be opened." );
 
 1623    QByteArray param0 = uri.toUtf8();
 
 1624    QByteArray param1 = qml.toUtf8();
 
 1630        mySql = QStringLiteral( 
"create table if not exists tbl_metadata(metadata varchar primary key,qmd varchar)" );
 
 1634        mySql = QStringLiteral( 
"create table if not exists tbl_styles(style varchar primary key,qml varchar)" );
 
 1638    statement = database.
prepare( mySql, myResult );
 
 1639    if ( myResult == SQLITE_OK )
 
 1641      if ( sqlite3_step( statement.get() ) != SQLITE_DONE )
 
 1647            return tr( 
"The metadata table could not be created." );
 
 1650            return tr( 
"The style table could not be created." );
 
 1658        mySql = QStringLiteral( 
"insert into tbl_metadata(metadata,qmd) values (?,?)" );
 
 1662        mySql = QStringLiteral( 
"insert into tbl_styles(style,qml) values (?,?)" );
 
 1665    statement = database.
prepare( mySql, myResult );
 
 1666    if ( myResult == SQLITE_OK )
 
 1668      if ( sqlite3_bind_text( statement.get(), 1, param0.data(), param0.length(), SQLITE_STATIC ) == SQLITE_OK &&
 
 1669           sqlite3_bind_text( statement.get(), 2, param1.data(), param1.length(), SQLITE_STATIC ) == SQLITE_OK &&
 
 1670           sqlite3_step( statement.get() ) == SQLITE_DONE )
 
 1676            myErrorMessage = tr( 
"The metadata %1 was saved to database" ).arg( uri );
 
 1680            myErrorMessage = tr( 
"The style %1 was saved to database" ).arg( uri );
 
 1692          mySql = QStringLiteral( 
"update tbl_metadata set qmd=? where metadata=?" );
 
 1696          mySql = QStringLiteral( 
"update tbl_styles set qml=? where style=?" );
 
 1699      statement = database.
prepare( mySql, myResult );
 
 1700      if ( myResult == SQLITE_OK )
 
 1702        if ( sqlite3_bind_text( statement.get(), 2, param0.data(), param0.length(), SQLITE_STATIC ) == SQLITE_OK &&
 
 1703             sqlite3_bind_text( statement.get(), 1, param1.data(), param1.length(), SQLITE_STATIC ) == SQLITE_OK &&
 
 1704             sqlite3_step( statement.get() ) == SQLITE_DONE )
 
 1710              myErrorMessage = tr( 
"The metadata %1 was updated in the database." ).arg( uri );
 
 1714              myErrorMessage = tr( 
"The style %1 was updated in the database." ).arg( uri );
 
 1724              myErrorMessage = tr( 
"The metadata %1 could not be updated in the database." ).arg( uri );
 
 1728              myErrorMessage = tr( 
"The style %1 could not be updated in the database." ).arg( uri );
 
 1739            myErrorMessage = tr( 
"The metadata %1 could not be inserted into database." ).arg( uri );
 
 1743            myErrorMessage = tr( 
"The style %1 could not be inserted into database." ).arg( uri );
 
 1750  return myErrorMessage;
 
 1770  QDomDocument myDocument = QDomDocument();
 
 1772  const QDomNode header = myDocument.createProcessingInstruction( QStringLiteral( 
"xml" ), QStringLiteral( 
"version=\"1.0\" encoding=\"UTF-8\"" ) );
 
 1773  myDocument.appendChild( header );
 
 1775  const QgsVectorLayer *vlayer = qobject_cast<const QgsVectorLayer *>( 
this );
 
 1776  const QgsRasterLayer *rlayer = qobject_cast<const QgsRasterLayer *>( 
this );
 
 1777  if ( !vlayer && !rlayer )
 
 1779    errorMsg = tr( 
"Could not save symbology because:\n%1" )
 
 1780               .arg( tr( 
"Only vector and raster layers are supported" ) );
 
 1785  QDomElement root = myDocument.createElementNS( QStringLiteral( 
"http://www.opengis.net/sld" ), QStringLiteral( 
"StyledLayerDescriptor" ) );
 
 1786  QDomElement layerNode;
 
 1789    root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.1.0" ) );
 
 1790    root.setAttribute( QStringLiteral( 
"xsi:schemaLocation" ), QStringLiteral( 
"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" ) );
 
 1791    root.setAttribute( QStringLiteral( 
"xmlns:ogc" ), QStringLiteral( 
"http://www.opengis.net/ogc" ) );
 
 1792    root.setAttribute( QStringLiteral( 
"xmlns:se" ), QStringLiteral( 
"http://www.opengis.net/se" ) );
 
 1793    root.setAttribute( QStringLiteral( 
"xmlns:xlink" ), QStringLiteral( 
"http://www.w3.org/1999/xlink" ) );
 
 1794    root.setAttribute( QStringLiteral( 
"xmlns:xsi" ), QStringLiteral( 
"http://www.w3.org/2001/XMLSchema-instance" ) );
 
 1795    myDocument.appendChild( root );
 
 1798    layerNode = myDocument.createElement( QStringLiteral( 
"NamedLayer" ) );
 
 1799    root.appendChild( layerNode );
 
 1806    root.setAttribute( QStringLiteral( 
"version" ), QStringLiteral( 
"1.0.0" ) );
 
 1807    root.setAttribute( QStringLiteral( 
"xmlns:gml" ), QStringLiteral( 
"http://www.opengis.net/gml" ) );
 
 1808    root.setAttribute( QStringLiteral( 
"xmlns:ogc" ), QStringLiteral( 
"http://www.opengis.net/ogc" ) );
 
 1809    root.setAttribute( QStringLiteral( 
"xmlns:sld" ), QStringLiteral( 
"http://www.opengis.net/sld" ) );
 
 1810    myDocument.appendChild( root );
 
 1813    layerNode = myDocument.createElement( QStringLiteral( 
"UserLayer" ) );
 
 1814    root.appendChild( layerNode );
 
 1820  context.setValue( exportContext );
 
 1822  props[ QStringLiteral( 
"SldExportContext" ) ] = context;
 
 1826    props[ QStringLiteral( 
"scaleMinDenom" ) ] = QString::number( mMinScale );
 
 1827    props[ QStringLiteral( 
"scaleMaxDenom" ) ] = QString::number( mMaxScale );
 
 1832    if ( !vlayer->
writeSld( layerNode, myDocument, errorMsg, props ) )
 
 1834      errorMsg = tr( 
"Could not save symbology because:\n%1" ).arg( errorMsg );
 
 1841    if ( !rlayer->
writeSld( layerNode, myDocument, errorMsg, props ) )
 
 1843      errorMsg = tr( 
"Could not save symbology because:\n%1" ).arg( errorMsg );
 
 1862  const QgsMapLayer *mlayer = qobject_cast<const QgsMapLayer *>( 
this );
 
 1869  if ( mlayer->providerType() == QLatin1String( 
"ogr" ) )
 
 1871    QStringList theURIParts = uri.split( 
'|' );
 
 1872    filename = theURIParts[0];
 
 1874  else if ( mlayer->providerType() == QLatin1String( 
"gpx" ) )
 
 1876    QStringList theURIParts = uri.split( 
'?' );
 
 1877    filename = theURIParts[0];
 
 1879  else if ( mlayer->providerType() == QLatin1String( 
"delimitedtext" ) )
 
 1881    filename = QUrl::fromEncoded( uri.toLatin1() ).toLocalFile();
 
 1883    if ( filename.isEmpty() )
 
 1891  const QFileInfo myFileInfo( filename );
 
 1892  if ( myFileInfo.exists() || filename.endsWith( QLatin1String( 
".sld" ), Qt::CaseInsensitive ) )
 
 1894    const QFileInfo myDirInfo( myFileInfo.path() );  
 
 1895    if ( !myDirInfo.isWritable() )
 
 1897      return tr( 
"The directory containing your dataset needs to be writable!" );
 
 1901    const QString myFileName = myFileInfo.path() + QDir::separator() + myFileInfo.completeBaseName() + 
".sld";
 
 1904    QDomDocument myDocument;
 
 1909    mlayer->exportSldStyleV2( myDocument, errorMsg, context );
 
 1911    if ( !errorMsg.isNull() )
 
 1917    QFile myFile( myFileName );
 
 1918    if ( myFile.open( QFile::WriteOnly | QFile::Truncate ) )
 
 1920      QTextStream myFileStream( &myFile );
 
 1922      myDocument.save( myFileStream, 2 );
 
 1925      return tr( 
"Created default style file as %1" ).arg( myFileName );
 
 1930  return tr( 
"ERROR: Failed to created SLD style file as %1. Check file permissions and retry." ).arg( filename );
 
 1940  QDomDocument myDocument;
 
 1944  QString myErrorMessage;
 
 1946  QFile myFile( uri );
 
 1947  if ( myFile.open( QFile::ReadOnly ) )
 
 1950    resultFlag = myDocument.setContent( &myFile, 
true, &myErrorMessage, &line, &column );
 
 1952      myErrorMessage = tr( 
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
 
 1957    myErrorMessage = tr( 
"Unable to open file %1" ).arg( uri );
 
 1962    return myErrorMessage;
 
 1966  const QDomElement myRoot = myDocument.firstChildElement( QStringLiteral( 
"StyledLayerDescriptor" ) );
 
 1967  if ( myRoot.isNull() )
 
 1969    myErrorMessage = QStringLiteral( 
"Error: StyledLayerDescriptor element not found in %1" ).arg( uri );
 
 1971    return myErrorMessage;
 
 1976  const QDomElement namedLayerElem = myRoot.firstChildElement( QStringLiteral( 
"NamedLayer" ) );
 
 1977  if ( namedLayerElem.isNull() )
 
 1979    myErrorMessage = QStringLiteral( 
"Info: NamedLayer element not found." );
 
 1981    return myErrorMessage;
 
 1985  resultFlag = 
readSld( namedLayerElem, errorMsg );
 
 1988    myErrorMessage = tr( 
"Loading style file %1 failed because:\n%2" ).arg( uri, errorMsg );
 
 1989    return myErrorMessage;
 
 2000  Q_UNUSED( errorMessage )
 
 2002  Q_UNUSED( categories )
 
 2013  Q_UNUSED( errorMessage )
 
 2015  Q_UNUSED( categories )
 
 2021                                 bool loadDefaultStyleFlag )
 
 2027  QgsDataProvider::ReadFlags 
flags = QgsDataProvider::ReadFlags();
 
 2028  if ( loadDefaultStyleFlag )
 
 2045  QgsDataProvider::ReadFlags 
flags = QgsDataProvider::ReadFlags();
 
 2046  if ( loadDefaultStyleFlag )
 
 2068  setDataSourcePrivate( dataSource, baseName, provider, options, 
flags );
 
 2075void QgsMapLayer::setDataSourcePrivate( 
const QString &dataSource, 
const QString &baseName, 
const QString &provider,
 
 2080  Q_UNUSED( dataSource )
 
 2081  Q_UNUSED( baseName )
 
 2082  Q_UNUSED( provider )
 
 2096                                   QgsMapLayer::StyleCategories categories )
 
 2105    QDomElement renderer3DElem = layerElement.firstChildElement( QStringLiteral( 
"renderer-3d" ) );
 
 2106    if ( !renderer3DElem.isNull() )
 
 2108      const QString type3D = renderer3DElem.attribute( QStringLiteral( 
"type" ) );
 
 2128    setScaleBasedVisibility( layerElement.attribute( QStringLiteral( 
"hasScaleBasedVisibilityFlag" ) ).toInt() == 1 );
 
 2129    if ( layerElement.hasAttribute( QStringLiteral( 
"minimumScale" ) ) )
 
 2132      setMaximumScale( layerElement.attribute( QStringLiteral( 
"minimumScale" ) ).toDouble() );
 
 2133      setMinimumScale( layerElement.attribute( QStringLiteral( 
"maximumScale" ) ).toDouble() );
 
 2137      setMaximumScale( layerElement.attribute( QStringLiteral( 
"maxScale" ) ).toDouble() );
 
 2138      setMinimumScale( layerElement.attribute( QStringLiteral( 
"minScale" ) ).toDouble() );
 
 2145    const QDomElement flagsElem = layerElement.firstChildElement( QStringLiteral( 
"flags" ) );
 
 2146    LayerFlags 
flags = mFlags;
 
 2147    const auto enumMap = qgsEnumMap<QgsMapLayer::LayerFlag>();
 
 2148    for ( 
auto it = enumMap.constBegin(); it != enumMap.constEnd(); ++it )
 
 2150      const QDomNode flagNode = flagsElem.namedItem( it.value() );
 
 2151      if ( flagNode.isNull() )
 
 2153      const bool flagValue = flagNode.toElement().text() == 
"1" ? true : 
false;
 
 2154      if ( 
flags.testFlag( it.key() ) && !flagValue )
 
 2156      else if ( !
flags.testFlag( it.key() ) && flagValue )
 
 2162  if ( categories.testFlag( 
Temporal ) )
 
 2167      properties->readXml( layerElement.toElement(), context );
 
 2175      properties->readXml( layerElement.toElement(), context );
 
 2178  if ( categories.testFlag( 
Notes ) )
 
 2180    const QDomElement notesElem = layerElement.firstChildElement( QStringLiteral( 
"userNotes" ) );
 
 2181    if ( !notesElem.isNull() )
 
 2183      const QString notes = notesElem.attribute( QStringLiteral( 
"value" ) );
 
 2200  return mUndoStackStyles;
 
 2207  return mCustomProperties.
keys();
 
 2214  if ( !mCustomProperties.
contains( key ) || mCustomProperties.
value( key ) != value )
 
 2216    mCustomProperties.
setValue( key, value );
 
 2226  for ( 
const QString &key : mCustomProperties.keys() )
 
 2236  return mCustomProperties;
 
 2244  return mCustomProperties.
value( value, defaultValue );
 
 2251  if ( mCustomProperties.
contains( key ) )
 
 2253    mCustomProperties.
remove( key );
 
 2298  const QString path = sourceParts.value( QStringLiteral( 
"path" ) ).toString();
 
 2299  if ( path.isEmpty() )
 
 2303  const QStringList tempPaths = QStandardPaths::standardLocations( QStandardPaths::TempLocation );
 
 2304  for ( 
const QString &tempPath : tempPaths )
 
 2306    if ( path.startsWith( tempPath ) )
 
 2336    mLegend->setParent( 
this );
 
 2354  return mStyleManager;
 
 2361  if ( renderer == m3DRenderer )
 
 2365  m3DRenderer = renderer;
 
 2382  if ( mRepaintRequestedFired )
 
 2384  mRepaintRequestedFired = 
true;
 
 2386  mRepaintRequestedFired = 
false;
 
 2434bool QgsMapLayer::isReadOnly()
 const 
 2445  return mOriginalXmlProperties;
 
 2458  const QString uuid = QUuid::createUuid().toString();
 
 2460  QString 
id = layerName + 
'_' + uuid.mid( 1, uuid.length() - 2 );
 
 2467  id.replace( QRegularExpression( 
"[\\W]" ), QStringLiteral( 
"_" ) );
 
 2482  return !mMapTipTemplate.isEmpty();
 
 2503  QSet<QgsMapLayerDependency> deps;
 
 2504  const auto constODeps = oDeps;
 
 2522  if ( !lDataProvider )
 
 2527    lDataProvider->setListening( enabled );
 
 2542  if ( 
QgsMapLayerStore *store = qobject_cast<QgsMapLayerStore *>( parent() ) )
 
 2544    return qobject_cast<QgsProject *>( store->parent() );
 
 2549void QgsMapLayer::onNotified( 
const QString &message )
 
 2566  if ( ! forceRecalculate && ! mWgs84Extent.
isNull() )
 
 2570  else if ( ! mExtent.
isNull() )
 
 2573    transformer.setBallparkTransformsAreAppropriate( 
true );
 
 2576      wgs84Extent = transformer.transformBoundingBox( mExtent );
 
 2587void QgsMapLayer::updateExtent( 
const QgsRectangle &extent )
 const 
 2597  if ( 
mReadFlags & QgsMapLayer::ReadFlag::FlagTrustLayerMetadata )
 
 2608  if ( 
mReadFlags & QgsMapLayer::ReadFlag::FlagTrustLayerMetadata )
 
 2618  QString 
metadata = QStringLiteral( 
"<h1>" ) + tr( 
"General" ) + QStringLiteral( 
"</h1>\n<hr>\n" ) + QStringLiteral( 
"<table class=\"list-view\">\n" );
 
 2621  metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Name" ) + QStringLiteral( 
"</td><td>" ) + 
name() + QStringLiteral( 
"</td></tr>\n" );
 
 2624  bool isLocalPath = 
false;
 
 2629    if ( uriComponents.contains( QStringLiteral( 
"path" ) ) )
 
 2631      path = uriComponents[QStringLiteral( 
"path" )].toString();
 
 2632      QFileInfo fi( path );
 
 2636        metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Path" ) + QStringLiteral( 
"</td><td>%1" ).arg( QStringLiteral( 
"<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( path ).toString(), QDir::toNativeSeparators( path ) ) ) + QStringLiteral( 
"</td></tr>\n" );
 
 2638        QDateTime lastModified = fi.lastModified();
 
 2639        QString lastModifiedFileName;
 
 2643          qint64 fileSize = fi.size();
 
 2644          if ( !sidecarFiles.isEmpty() )
 
 2646            lastModifiedFileName = fi.fileName();
 
 2647            QStringList sidecarFileNames;
 
 2648            for ( 
const QString &sidecarFile : sidecarFiles )
 
 2650              QFileInfo sidecarFi( sidecarFile );
 
 2651              fileSize += sidecarFi.size();
 
 2652              if ( sidecarFi.lastModified() > lastModified )
 
 2654                lastModified = sidecarFi.lastModified();
 
 2655                lastModifiedFileName = sidecarFi.fileName();
 
 2657              sidecarFileNames << sidecarFi.fileName();
 
 2659            metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + ( sidecarFiles.size() > 1 ? tr( 
"Sidecar files" ) : tr( 
"Sidecar file" ) ) + QStringLiteral( 
"</td><td>%1" ).arg( sidecarFileNames.join( QLatin1String( 
", " ) ) ) + QStringLiteral( 
"</td></tr>\n" );
 
 2661          metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + ( !sidecarFiles.isEmpty() ? tr( 
"Total size" ) : tr( 
"Size" ) ) + QStringLiteral( 
"</td><td>%1" ).arg( 
QgsFileUtils::representFileSize( fileSize ) ) + QStringLiteral( 
"</td></tr>\n" );
 
 2663        metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Last modified" ) + QStringLiteral( 
"</td><td>%1" ).arg( QLocale().toString( fi.lastModified() ) ) + ( !lastModifiedFileName.isEmpty() ? QStringLiteral( 
" (%1)" ).arg( lastModifiedFileName ) : QString() ) + QStringLiteral( 
"</td></tr>\n" );
 
 2666    if ( uriComponents.contains( QStringLiteral( 
"url" ) ) )
 
 2668      const QString url = uriComponents[QStringLiteral( 
"url" )].toString();
 
 2669      metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"URL" ) + QStringLiteral( 
"</td><td>%1" ).arg( QStringLiteral( 
"<a href=\"%1\">%2</a>" ).arg( QUrl( url ).toString(), url ) ) + QStringLiteral( 
"</td></tr>\n" );
 
 2675    metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Source" ) + QStringLiteral( 
"</td><td>%1" ).arg( 
publicSource() != path ? 
publicSource() : path ) + QStringLiteral( 
"</td></tr>\n" );
 
 2679    metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Provider" ) + QStringLiteral( 
"</td><td>%1" ).arg( 
dataProvider()->
name() ) + QStringLiteral( 
"</td></tr>\n" );
 
 2681  metadata += QLatin1String( 
"</table>\n<br><br>" );
 
 2689  QString 
metadata = QStringLiteral( 
"<h1>" ) + tr( 
"Coordinate Reference System (CRS)" ) + QStringLiteral( 
"</h1>\n<hr>\n" );
 
 2690  metadata += QLatin1String( 
"<table class=\"list-view\">\n" );
 
 2695    metadata += QStringLiteral( 
"<tr><td colspan=\"2\" class=\"highlight\">" ) + tr( 
"Unknown" ) + QStringLiteral( 
"</td></tr>\n" );
 
 2701    metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Units" ) + QStringLiteral( 
"</td><td>" )
 
 2702                + ( 
c.isGeographic() ? tr( 
"Geographic (uses latitude and longitude for coordinates)" ) : 
QgsUnitTypes::toString( 
c.mapUnits() ) )
 
 2703                + QStringLiteral( 
"</td></tr>\n" );
 
 2708    metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Method" ) + QStringLiteral( 
"</td><td>" ) + operation.
description() + QStringLiteral( 
"</td></tr>\n" );
 
 2713      const QString celestialBody = 
c.celestialBodyName();
 
 2714      if ( !celestialBody.isEmpty() )
 
 2716        metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Celestial body" ) + QStringLiteral( 
"</td><td>" ) + celestialBody + QStringLiteral( 
"</td></tr>\n" );
 
 2724    QString accuracyString;
 
 2726    if ( 
c.isDynamic() && std::isnan( 
c.coordinateEpoch() ) )
 
 2728      accuracyString = tr( 
"Based on a dynamic CRS, but no coordinate epoch is set. Coordinates are ambiguous and of limited accuracy." );
 
 2738        if ( !ensemble.
code().isEmpty() )
 
 2739          id = QStringLiteral( 
"<i>%1</i> (%2:%3)" ).arg( ensemble.
name(), ensemble.
authority(), ensemble.
code() );
 
 2741          id = QStringLiteral( 
"<i>%</i>”" ).arg( ensemble.
name() );
 
 2745          accuracyString = tr( 
"Based on %1, which has a limited accuracy of <b>at best %2 meters</b>." ).arg( 
id ).arg( ensemble.
accuracy() );
 
 2749          accuracyString = tr( 
"Based on %1, which has a limited accuracy." ).arg( 
id );
 
 2758    if ( !accuracyString.isEmpty() )
 
 2760      metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Accuracy" ) + QStringLiteral( 
"</td><td>" ) + accuracyString + QStringLiteral( 
"</td></tr>\n" );
 
 2764    metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Reference" ) + QStringLiteral( 
"</td><td>%1</td></tr>\n" ).arg( 
c.isDynamic() ? tr( 
"Dynamic (relies on a datum which is not plate-fixed)" ) : tr( 
"Static (relies on a datum which is plate-fixed)" ) );
 
 2767    if ( !std::isnan( 
c.coordinateEpoch() ) )
 
 2769      metadata += QStringLiteral( 
"<tr><td class=\"highlight\">" ) + tr( 
"Coordinate epoch" ) + QStringLiteral( 
"</td><td>%1</td></tr>\n" ).arg( 
c.coordinateEpoch() );
 
 2773  metadata += QLatin1String( 
"</table>\n<br><br>\n" );
 
static QString version()
Version string.
static const double SCALE_PRECISION
Fudge factor used to compare two scales.
@ ForceFirstLetterToCapital
Convert just the first letter of each word to uppercase, leave the rest untouched.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
LayerType
Types of layers that can be added to a map.
Qgs3DRendererAbstractMetadata * rendererMetadata(const QString &type) const
Returns metadata for a 3D renderer type (may be used to create a new instance of the type)
Base class for all renderers that may to participate in 3D view.
virtual QString type() const =0
Returns unique identifier of the renderer class (used to identify subclass)
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes renderer's properties to given XML element.
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml()
static QString pkgDataPath()
Returns the common root path of all application data directories.
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
static Qgs3DRendererRegistry * renderer3DRegistry()
Returns registry of available 3D renderers.
bool setMasterPassword(bool verify=false)
Main call to initially set or continually check master password is set.
This class represents a coordinate reference system (CRS).
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
void validate()
Perform some validation on this CRS.
static CUSTOM_CRS_VALIDATION customCrsValidation()
Gets custom function.
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
static void setCustomCrsValidation(CUSTOM_CRS_VALIDATION f)
Sets custom function to force valid CRS.
void setValidationHint(const QString &html)
Set user hint for validation.
@ FullString
Full definition – possibly a very lengthy string, e.g. with no truncation of custom WKT definitions.
bool writeXml(QDomNode &node, QDomDocument &doc) const
Stores state to the given Dom node in the given document.
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for spatial data provider implementations.
@ FlagLoadDefaultStyle
Reset the layer's style to the default for the datasource.
@ FlagTrustDataSource
Trust datasource config (primary key unicity, geometry type and srid, etc). Improves provider load ti...
void notify(const QString &msg)
Emitted when the datasource issues a notification.
static QString removePassword(const QString &aUri)
Removes the password element from a URI.
Contains information about a datum ensemble.
QString code() const
Identification code, e.g.
QString authority() const
Authority name, e.g.
bool isValid() const
Returns true if the datum ensemble is a valid object, or false if it is a null/invalid object.
QString name() const
Display name of datum ensemble.
double accuracy() const
Positional accuracy (in meters).
QgsError is container for error messages (report).
static QSet< QString > sidecarFilesForPath(const QString &path)
Returns a list of the sidecar files which exist for the dataset a the specified path.
static QString representFileSize(qint64 bytes)
Returns the human size from bytes.
static void setLayerNotes(QgsMapLayer *layer, const QString ¬es)
Sets the notes for the specified layer, where notes is a HTML formatted string.
static bool layerHasNotes(const QgsMapLayer *layer)
Returns true if the specified layer has notes available.
static QString layerNotes(const QgsMapLayer *layer)
Returns the notes for the specified layer.
This class models dependencies with or between map layers.
Base class for storage of map layer elevation properties.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer.
void itemsChanged()
Emitted when existing items/nodes got invalid and should be replaced by new ones.
Manages QGIS Server properties for a map layer.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
void copyTo(QgsMapLayerServerProperties *properties) const
Copy properties to another instance.
A storage object for map layers, in which the layers are owned by the store and have their lifetime b...
Management of styles for use with one map layer.
bool addStyle(const QString &name, const QgsMapLayerStyle &style)
Add a style with given name and data.
QStringList styles() const
Returns list of all defined style names.
void writeXml(QDomElement &mgrElement) const
Write configuration (for project saving)
void reset()
Reset the style manager to a basic state - with one default style which is set as current.
void readXml(const QDomElement &mgrElement)
Read configuration (for project loading)
Base class for storage of map layer temporal properties.
Base class for all map layer types.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
bool importNamedMetadata(QDomDocument &document, QString &errorMessage)
Import the metadata of this layer from a QDomDocument.
void readStyleManager(const QDomNode &layerNode)
Read style manager's configuration (if any). To be called by subclasses.
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const =0
Write the style for the layer into the document provided.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
QgsRectangle wgs84Extent(bool forceRecalculate=false) const
Returns the WGS84 extent (EPSG:4326) of the layer according to ReadFlag::FlagTrustLayerMetadata.
void setRefreshOnNotifyEnabled(bool enabled)
Set whether provider notification is connected to triggerRepaint.
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
QgsAbstract3DRenderer * renderer3D() const
Returns 3D renderer associated with the layer.
virtual bool isTemporary() const
Returns true if the layer is considered a temporary layer.
virtual void exportNamedStyle(QDomDocument &doc, QString &errorMsg, const QgsReadWriteContext &context=QgsReadWriteContext(), QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) const
Export the properties of this layer as named style in a QDomDocument.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the layer.
void dependenciesChanged()
Emitted when dependencies are changed.
virtual bool hasMapTips() const
Returns true if the layer contains map tips.
bool isInScaleRange(double scale) const
Tests whether the layer should be visible at the specified scale.
void legendChanged()
Signal emitted when legend of the layer has changed.
void writeStyleManager(QDomNode &layerNode, QDomDocument &doc) const
Write style manager's configuration (if exists). To be called by subclasses.
QgsMapLayerLegend * legend() const
Can be nullptr.
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Import the properties of this layer from a QDomDocument.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
void metadataChanged()
Emitted when the layer's metadata is changed.
virtual QgsRectangle extent() const
Returns the extent of the layer.
virtual QString saveSldStyle(const QString &uri, bool &resultFlag) const
Saves the properties of this layer to an SLD format file.
QString source() const
Returns the source for the layer.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.
void request3DUpdate()
Signal emitted when a layer requires an update in any 3D maps.
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
int mBlockStyleChangedSignal
If non-zero, the styleChanged signal should not be emitted.
QString providerType() const
Returns the provider type (provider key) for this layer.
void removeCustomProperty(const QString &key)
Remove a custom property from layer.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
void configChanged()
Emitted whenever the configuration is changed.
void trigger3DUpdate()
Will advise any 3D maps that this layer requires to be updated in the scene.
void autoRefreshIntervalChanged(int interval)
Emitted when the auto refresh interval changes.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
void setCustomProperties(const QgsObjectCustomProperties &properties)
Set custom properties for layer.
virtual QString encodedSource(const QString &source, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to proje...
QString publicSource() const
Gets a version of the internal layer definition that has sensitive bits removed (for example,...
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
virtual void setSubLayerVisibility(const QString &name, bool visible)
Set the visibility of the given sublayer name.
void isValidChanged()
Emitted when the validity of this layer changed.
QgsCoordinateReferenceSystem crs
bool loadNamedMetadataFromDatabase(const QString &db, const QString &uri, QString &qmd)
Retrieve a named metadata for this layer from a sqlite database.
virtual bool readXml(const QDomNode &layer_node, QgsReadWriteContext &context)
Called by readLayerXML(), used by children to read state specific to them from project files.
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
void setOriginalXmlProperties(const QString &originalXmlProperties)
Sets the original XML properties for the layer to originalXmlProperties.
void writeCustomProperties(QDomNode &layerNode, QDomDocument &doc) const
Write custom properties to project file.
QString mRefreshOnNofifyMessage
QString mLegendUrl
WMS legend.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
virtual QString loadDefaultStyle(bool &resultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
QString mLayerName
Name of the layer - used for display.
virtual QString loadNamedMetadata(const QString &uri, bool &resultFlag)
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record ...
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by children to write state specific to them to project files.
bool hasAutoRefreshEnabled() const
Returns true if auto refresh is enabled for the layer.
void mapTipTemplateChanged()
Emitted when the map tip template changes.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
QString crsHtmlMetadata() const
Returns a HTML fragment containing the layer's CRS metadata, for use in the htmlMetadata() method.
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void setAutoRefreshEnabled(bool enabled)
Sets whether auto refresh is enabled for the layer.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsLayerMetadata metadata
static QString formatLayerName(const QString &name)
A convenience function to capitalize and format a layer name.
void renderer3DChanged()
Signal emitted when 3D renderer associated with the layer has changed.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
QgsMapLayer(Qgis::LayerType type=Qgis::LayerType::Vector, const QString &name=QString(), const QString &source=QString())
Constructor for QgsMapLayer.
QString originalXmlProperties() const
Returns the XML properties of the original layer as they were when the layer was first read from the ...
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
void setFlags(QgsMapLayer::LayerFlags flags)
Returns the flags for this layer.
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QSet< QgsMapLayerDependency > mDependencies
List of layers that may modify this layer on modification.
void readCustomProperties(const QDomNode &layerNode, const QString &keyStartsWith=QString())
Read custom properties from project file.
virtual Qgis::MapLayerProperties properties() const
Returns the map layer properties of this layer.
virtual QString loadSldStyle(const QString &uri, bool &resultFlag)
Attempts to style the layer using the formatting from an SLD type file.
virtual void setMetadata(const QgsLayerMetadata &metadata)
Sets the layer's metadata store.
virtual bool readStyle(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read the style for the current layer from the DOM node supplied.
virtual QString saveDefaultMetadata(bool &resultFlag)
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as ...
virtual bool supportsEditing() const
Returns whether the layer supports editing or not.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
QString mProviderKey
Data provider key (name of the data provider)
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
void styleChanged()
Signal emitted whenever a change affects the layer's style.
virtual bool isEditable() const
Returns true if the layer can be edited.
QUndoStack * undoStack()
Returns pointer to layer's undo stack.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
void crsChanged()
Emit a signal that layer's CRS has been reset.
virtual QgsError error() const
Gets current status error.
bool writeLayerXml(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context) const
Stores state in DOM node.
virtual QString styleURI() const
Retrieve the style URI for this layer (either as a .qml file on disk or as a record in the users styl...
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
void dataSourceChanged()
Emitted whenever the layer's data source has been changed.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
bool readLayerXml(const QDomElement &layerElement, QgsReadWriteContext &context, QgsMapLayer::ReadFlags flags=QgsMapLayer::ReadFlags())
Sets state from DOM document.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
virtual QString loadNamedStyle(const QString &uri, bool &resultFlag, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
Q_DECL_DEPRECATED QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
void setRefreshOnNofifyMessage(const QString &message)
Set the notification message that triggers repaint If refresh on notification is enabled,...
static QString generateId(const QString &layerName)
Generates an unique identifier for this layer, the generate ID is prefixed by layerName.
void opacityChanged(double opacity)
Emitted when the layer's opacity is changed, where opacity is a value between 0 (transparent) and 1 (...
virtual bool isModified() const
Returns true if the layer has been modified since last commit/save.
void emitStyleChanged()
Triggers an emission of the styleChanged() signal.
virtual QgsMapLayerTemporalProperties * temporalProperties()
Returns the layer's temporal properties.
QUndoStack * undoStackStyles()
Returns pointer to layer's style undo stack.
void dataChanged()
Data of layer changed.
virtual QStringList subLayers() const
Returns the sublayers of this layer.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this layer.
Q_DECL_DEPRECATED void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
virtual bool loadNamedStyleFromDatabase(const QString &db, const QString &uri, QString &qml)
Retrieve a named style for this layer from a sqlite database.
static QString extensionPropertyType(PropertyType type)
Returns the extension of a Property.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
void blendModeChanged(QPainter::CompositionMode blendMode)
Signal emitted when the blend mode is changed, through QgsMapLayer::setBlendMode()
virtual QString saveSldStyleV2(bool &resultFlag, const QgsSldExportContext &exportContext) const
Saves the properties of this layer to an SLD format file.
void setName(const QString &name)
Set the display name of the layer.
void setAutoRefreshInterval(int interval)
Sets the auto refresh interval (in milliseconds) for the layer.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)=0
Read the symbology for the current layer from the DOM node supplied.
Q_DECL_DEPRECATED QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
virtual void resolveReferences(QgsProject *project)
Resolve references to other layers (kept as layer IDs after reading XML) into layer objects.
QString saveNamedMetadata(const QString &uri, bool &resultFlag)
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a re...
QString mDataSource
Data source description string, varies by layer type.
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
virtual QString loadDefaultMetadata(bool &resultFlag)
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a rec...
@ FlagReadExtentFromXml
Read extent from xml and skip get extent from provider.
@ FlagTrustLayerMetadata
Trust layer metadata. Improves layer load time by skipping expensive checks like primary key unicity,...
void setValid(bool valid)
Sets whether layer is valid or not.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void readCommonStyle(const QDomElement &layerElement, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read style data common to all layer types.
QString mAbstract
Description of the layer.
void customPropertyChanged(const QString &key)
Emitted when a custom property of the layer has been changed or removed.
QgsMapLayer::ReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when restoring state from XML.
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
double minimumScale() const
Returns the minimum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QString legendUrl() const
Returns the URL for the layer's legend.
void flagsChanged()
Emitted when layer's flags have been modified.
void repaintRequested(bool deferredUpdate=false)
By emitting this signal the layer tells that either appearance or content have been changed and any v...
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
void exportNamedMetadata(QDomDocument &doc, QString &errorMsg) const
Export the current metadata of this layer as named metadata in a QDomDocument.
virtual QString saveNamedStyle(const QString &uri, bool &resultFlag, StyleCategories categories=AllStyleCategories)
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in t...
virtual void exportSldStyle(QDomDocument &doc, QString &errorMsg) const
Export the properties of this layer as SLD style in a QDomDocument.
void beforeResolveReferences(QgsProject *project)
Emitted when all layers are loaded and references can be resolved, just before the references of this...
void setMapTipTemplate(const QString &mapTipTemplate)
The mapTip is a pretty, html representation for feature information.
Q_DECL_DEPRECATED void setMetadataUrl(const QString &metaUrl)
Sets the metadata URL of the layer used by QGIS Server in GetCapabilities request.
virtual QgsMapLayerElevationProperties * elevationProperties()
Returns the layer's elevation properties.
Q_INVOKABLE QStringList customPropertyKeys() const
Returns list of all keys within custom properties.
QgsProject * project() const
Returns the parent project if this map layer is added to a project.
Q_DECL_DEPRECATED void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
virtual QString decodedSource(const QString &source, const QString &dataProvider, const QgsReadWriteContext &context) const
Called by readLayerXML(), used by derived classes to decode provider's specific data source from proj...
void nameChanged()
Emitted when the name has been changed.
virtual QString metadataUri() const
Retrieve the metadata URI for this layer (either as a .qmd file on disk or as a record in the users s...
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const
Write just the symbology information for the layer into the document.
bool mIsRefreshOnNofifyEnabled
QString mDataUrl
DataUrl of the layer.
virtual Q_INVOKABLE QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
double mLayerOpacity
Layer opacity.
bool mValid
Indicates if the layer is valid and can be drawn.
@ LayerConfiguration
General configuration: identifiable, removable, searchable, display expression, read-only.
@ Notes
Layer user notes (since QGIS 3.20)
@ Temporal
Temporal properties (since QGIS 3.14)
@ Rendering
Rendering: scale visibility, simplify method, opacity.
@ Elevation
Elevation settings (since QGIS 3.18)
@ Symbology3D
3D symbology
@ CustomProperties
Custom properties (by plugins for instance)
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
void setProviderType(const QString &providerType)
Sets the providerType (provider key)
virtual QString saveDefaultStyle(bool &resultFlag, StyleCategories categories)
Save the properties of this layer as the default style (either as a .qml file on disk or as a record ...
void setRenderer3D(QgsAbstract3DRenderer *renderer)
Sets 3D renderer for the layer.
QString mAttribution
Attribution of the layer.
const QgsObjectCustomProperties & customProperties() const
Read all custom properties from layer.
virtual void exportSldStyleV2(QDomDocument &doc, QString &errorMsg, const QgsSldExportContext &exportContext) const
Export the properties of this layer as SLD style in a QDomDocument.
QString generalHtmlMetadata() const
Returns an HTML fragment containing general metadata information, for use in the htmlMetadata() metho...
Q_DECL_DEPRECATED QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
void writeCommonStyle(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const
Write style data common to all layer types.
double maximumScale() const
Returns the maximum map scale (i.e.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
virtual void setLayerOrder(const QStringList &layers)
Reorders the previously selected sublayers of this layer from bottom to top.
void invalidateWgs84Extent()
Invalidates the WGS84 extent.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
PropertyType
Maplayer has a style and a metadata property.
bool mShouldValidateCrs
true if the layer's CRS should be validated and invalid CRSes are not permitted.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Custom exception class which is raised when an operation is not supported.
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
void setValue(const QString &key, const QVariant &value)
Add an entry to the store with the specified key.
QStringList keys() const
Returns a list of all stored keys.
void writeXml(QDomNode &parentNode, QDomDocument &doc) const
Writes the store contents to an XML node.
void remove(const QString &key)
Removes a key (entry) from the store.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for the given key.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from an XML node.
bool contains(const QString &key) const
Returns true if the properties contains a key with the specified name.
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
Contains information about a PROJ operation.
QString description() const
Description.
virtual QString translate(const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
The derived translate() translates with QTranslator and qm file the sourceText.
A class to describe the version of a project.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
bool removeAttachedFile(const QString &path)
Removes the attached file.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QString baseName() const
Returns the base name of the project file without the path and without extension - derived from fileN...
QString absoluteFilePath() const
Returns full absolute path to the project file if the project is stored in a file system - derived fr...
QVariantMap decodeUri(const QString &providerKey, const QString &uri)
Breaks a provider data source URI into its component paths (e.g.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
bool saveLayerMetadata(const QString &providerKey, const QString &uri, const QgsLayerMetadata &metadata, QString &errorMessage) SIP_THROW(QgsNotSupportedException)
Saves metadata to the layer corresponding to the specified uri.
Represents a raster layer.
bool writeSld(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props=QVariantMap()) const
Writes the symbology of the layer into the document provided in SLD 1.0.0 format.
Allows entering a context category and takes care of leaving this category on deletion of the class.
The class is used as a container of context for various read/write operations on other objects.
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory(const QString &category, const QString &details=QString()) const
Push a category to the stack.
const QgsProjectTranslator * projectTranslator() const
Returns the project translator.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
A rectangle specified with double values.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
The QgsSldExportContext class holds SLD export options and other information related to SLD export of...
QString exportFilePath() const
Returns the export file path for the SLD.
void setExportFilePath(const QString &exportFilePath)
Sets the export file path for the SLD to exportFilePath.
static QString capitalize(const QString &string, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
An interface for classes which can visit style entity (e.g.
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
Represents a vector layer which manages a vector based data sets.
bool writeSld(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props=QVariantMap()) const
Writes the symbology of the layer into the document provided in SLD 1.1 format.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
static T readFlagAttribute(const QDomElement &element, const QString &attributeName, T defaultValue)
Read a flag value from an attribute of the element.
static QDomElement writeRectangle(const QgsRectangle &rect, QDomDocument &doc, const QString &elementName=QStringLiteral("extent"))
Encodes a rectangle to a DOM element.
static QgsRectangle readRectangle(const QDomElement &element)
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
sqlite3_statement_unique_ptr prepare(const QString &sql, int &resultCode) const
Prepares a sql statement, returning the result.
int open(const QString &path)
Opens the database at the specified file path.
int open_v2(const QString &path, int flags, const char *zVfs)
Opens the database at the specified file path.
Unique pointer for sqlite3 prepared statements, which automatically finalizes the statement when the ...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
CONSTLATIN1STRING geoEpsgCrsAuthId()
Geographic coord sys from EPSG authority.
void(* CUSTOM_CRS_VALIDATION)(QgsCoordinateReferenceSystem &)
#define QgsDebugMsgLevel(str, level)
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS_NON_FATAL
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
Setting options for creating vector data providers.