20 #include <QDomDocument> 21 #include <QDomElement> 22 #include <QDomImplementation> 26 #include <QTextStream> 62 return QStringLiteral(
".qmd" );
65 return QStringLiteral(
".qml" );
71 const QString &lyrname,
76 , mUndoStack( new QUndoStack( this ) )
77 , mUndoStackStyles( new QUndoStack( this ) )
79 , mRefreshTimer( new QTimer( this ) )
84 QString uuid = QUuid::createUuid().toString();
86 mID = lyrname +
'_' + uuid.mid( 1, uuid.length() - 2 );
94 mID.replace( QRegExp(
"[\\W]" ), QStringLiteral(
"_" ) );
100 connect( mRefreshTimer, &QTimer::timeout,
this, [ = ] {
triggerRepaint(
true ); } );
107 delete mStyleManager;
114 Q_FOREACH (
const QString &s,
styleManager()->styles() )
218 mnl = layerElement.namedItem( QStringLiteral(
"provider" ) );
219 mne = mnl.toElement();
220 provider = mne.text();
223 mnl = layerElement.namedItem( QStringLiteral(
"datasource" ) );
224 mne = mnl.toElement();
228 QRegExp rx(
"authcfg=([a-z]|[A-Z]|[0-9]){7}" );
241 mnl = layerElement.namedItem( QStringLiteral(
"layername" ) );
242 mne = mnl.toElement();
247 QDomNode srsNode = layerElement.namedItem( QStringLiteral(
"srs" ) );
265 layerError = !
readXml( layerElement, context );
284 mnl = layerElement.namedItem( QStringLiteral(
"id" ) );
285 if ( ! mnl.isNull() )
287 mne = mnl.toElement();
288 if ( ! mne.isNull() && mne.text().length() > 10 )
295 setScaleBasedVisibility( layerElement.attribute( QStringLiteral(
"hasScaleBasedVisibilityFlag" ) ).toInt() == 1 );
296 if ( layerElement.hasAttribute( QStringLiteral(
"minimumScale" ) ) )
299 setMaximumScale( layerElement.attribute( QStringLiteral(
"minimumScale" ) ).toDouble() );
300 setMinimumScale( layerElement.attribute( QStringLiteral(
"maximumScale" ) ).toDouble() );
304 setMaximumScale( layerElement.attribute( QStringLiteral(
"maxScale" ) ).toDouble() );
305 setMinimumScale( layerElement.attribute( QStringLiteral(
"minScale" ) ).toDouble() );
308 setAutoRefreshInterval( layerElement.attribute( QStringLiteral(
"autoRefreshTime" ), QStringLiteral(
"0" ) ).toInt() );
309 setAutoRefreshEnabled( layerElement.attribute( QStringLiteral(
"autoRefreshEnabled" ), QStringLiteral(
"0" ) ).toInt() );
311 setRefreshOnNotifyEnabled( layerElement.attribute( QStringLiteral(
"refreshOnNotifyEnabled" ), QStringLiteral(
"0" ) ).toInt() );
315 mnl = layerElement.namedItem( QStringLiteral(
"layername" ) );
316 mne = mnl.toElement();
320 QDomElement shortNameElem = layerElement.firstChildElement( QStringLiteral(
"shortname" ) );
321 if ( !shortNameElem.isNull() )
327 QDomElement titleElem = layerElement.firstChildElement( QStringLiteral(
"title" ) );
328 if ( !titleElem.isNull() )
330 mTitle = titleElem.text();
334 QDomElement abstractElem = layerElement.firstChildElement( QStringLiteral(
"abstract" ) );
335 if ( !abstractElem.isNull() )
341 QDomElement keywordListElem = layerElement.firstChildElement( QStringLiteral(
"keywordList" ) );
342 if ( !keywordListElem.isNull() )
345 for ( QDomNode n = keywordListElem.firstChild(); !n.isNull(); n = n.nextSibling() )
347 kwdList << n.toElement().text();
353 QDomElement dataUrlElem = layerElement.firstChildElement( QStringLiteral(
"dataUrl" ) );
354 if ( !dataUrlElem.isNull() )
357 mDataUrlFormat = dataUrlElem.attribute( QStringLiteral(
"format" ), QLatin1String(
"" ) );
361 QDomElement legendUrlElem = layerElement.firstChildElement( QStringLiteral(
"legendUrl" ) );
362 if ( !legendUrlElem.isNull() )
365 mLegendUrlFormat = legendUrlElem.attribute( QStringLiteral(
"format" ), QLatin1String(
"" ) );
369 QDomElement attribElem = layerElement.firstChildElement( QStringLiteral(
"attribution" ) );
370 if ( !attribElem.isNull() )
373 mAttributionUrl = attribElem.attribute( QStringLiteral(
"href" ), QLatin1String(
"" ) );
377 QDomElement metaUrlElem = layerElement.firstChildElement( QStringLiteral(
"metadataUrl" ) );
378 if ( !metaUrlElem.isNull() )
381 mMetadataUrlType = metaUrlElem.attribute( QStringLiteral(
"type" ), QLatin1String(
"" ) );
382 mMetadataUrlFormat = metaUrlElem.attribute( QStringLiteral(
"format" ), QLatin1String(
"" ) );
386 QDomElement metadataElem = layerElement.firstChildElement( QStringLiteral(
"resourceMetadata" ) );
395 Q_UNUSED( layer_node );
407 layerElement.setAttribute( QStringLiteral(
"hasScaleBasedVisibilityFlag" ),
hasScaleBasedVisibility() ? 1 : 0 );
408 layerElement.setAttribute( QStringLiteral(
"maxScale" ), QString::number(
maximumScale() ) );
409 layerElement.setAttribute( QStringLiteral(
"minScale" ), QString::number(
minimumScale() ) );
416 layerElement.setAttribute( QStringLiteral(
"autoRefreshTime" ), QString::number( mRefreshTimer->interval() ) );
417 layerElement.setAttribute( QStringLiteral(
"autoRefreshEnabled" ), mRefreshTimer->isActive() ? 1 : 0 );
423 QDomElement layerId = document.createElement( QStringLiteral(
"id" ) );
424 QDomText layerIdText = document.createTextNode(
id() );
425 layerId.appendChild( layerIdText );
427 layerElement.appendChild( layerId );
430 QDomElement dataSource = document.createElement( QStringLiteral(
"datasource" ) );
432 QDomText dataSourceText = document.createTextNode( src );
433 dataSource.appendChild( dataSourceText );
434 layerElement.appendChild( dataSource );
437 QDomElement layerName = document.createElement( QStringLiteral(
"layername" ) );
438 QDomText layerNameText = document.createTextNode(
name() );
439 layerName.appendChild( layerNameText );
440 layerElement.appendChild( layerName );
445 QDomElement layerShortName = document.createElement( QStringLiteral(
"shortname" ) );
446 QDomText layerShortNameText = document.createTextNode(
mShortName );
447 layerShortName.appendChild( layerShortNameText );
448 layerElement.appendChild( layerShortName );
454 QDomElement layerTitle = document.createElement( QStringLiteral(
"title" ) );
455 QDomText layerTitleText = document.createTextNode(
mTitle );
456 layerTitle.appendChild( layerTitleText );
457 layerElement.appendChild( layerTitle );
463 QDomElement layerAbstract = document.createElement( QStringLiteral(
"abstract" ) );
464 QDomText layerAbstractText = document.createTextNode(
mAbstract );
465 layerAbstract.appendChild( layerAbstractText );
466 layerElement.appendChild( layerAbstract );
470 QStringList keywordStringList =
keywordList().split(
',' );
471 if ( !keywordStringList.isEmpty() )
473 QDomElement layerKeywordList = document.createElement( QStringLiteral(
"keywordList" ) );
474 for (
int i = 0; i < keywordStringList.size(); ++i )
476 QDomElement layerKeywordValue = document.createElement( QStringLiteral(
"value" ) );
477 QDomText layerKeywordText = document.createTextNode( keywordStringList.at( i ).trimmed() );
478 layerKeywordValue.appendChild( layerKeywordText );
479 layerKeywordList.appendChild( layerKeywordValue );
481 layerElement.appendChild( layerKeywordList );
486 if ( !aDataUrl.isEmpty() )
488 QDomElement layerDataUrl = document.createElement( QStringLiteral(
"dataUrl" ) );
489 QDomText layerDataUrlText = document.createTextNode( aDataUrl );
490 layerDataUrl.appendChild( layerDataUrlText );
491 layerDataUrl.setAttribute( QStringLiteral(
"format" ),
dataUrlFormat() );
492 layerElement.appendChild( layerDataUrl );
497 if ( !aLegendUrl.isEmpty() )
499 QDomElement layerLegendUrl = document.createElement( QStringLiteral(
"legendUrl" ) );
500 QDomText layerLegendUrlText = document.createTextNode( aLegendUrl );
501 layerLegendUrl.appendChild( layerLegendUrlText );
502 layerLegendUrl.setAttribute( QStringLiteral(
"format" ),
legendUrlFormat() );
503 layerElement.appendChild( layerLegendUrl );
508 if ( !aAttribution.isEmpty() )
510 QDomElement layerAttribution = document.createElement( QStringLiteral(
"attribution" ) );
511 QDomText layerAttributionText = document.createTextNode( aAttribution );
512 layerAttribution.appendChild( layerAttributionText );
513 layerAttribution.setAttribute( QStringLiteral(
"href" ),
attributionUrl() );
514 layerElement.appendChild( layerAttribution );
519 if ( !aMetadataUrl.isEmpty() )
521 QDomElement layerMetadataUrl = document.createElement( QStringLiteral(
"metadataUrl" ) );
522 QDomText layerMetadataUrlText = document.createTextNode( aMetadataUrl );
523 layerMetadataUrl.appendChild( layerMetadataUrlText );
524 layerMetadataUrl.setAttribute( QStringLiteral(
"type" ),
metadataUrlType() );
525 layerMetadataUrl.setAttribute( QStringLiteral(
"format" ),
metadataUrlFormat() );
526 layerElement.appendChild( layerMetadataUrl );
532 QDomElement stamp = document.createElement( QStringLiteral(
"timestamp" ) );
533 QDomText stampText = document.createTextNode(
timestamp().toString( Qt::ISODate ) );
534 stamp.appendChild( stampText );
535 layerElement.appendChild( stamp );
538 layerElement.appendChild( layerName );
545 QDomElement mySrsElement = document.createElement( QStringLiteral(
"srs" ) );
546 mCRS.
writeXml( mySrsElement, document );
547 layerElement.appendChild( mySrsElement );
550 QDomElement myMetadataElem = document.createElement( QStringLiteral(
"resourceMetadata" ) );
552 layerElement.appendChild( myMetadataElem );
558 return writeXml( layerElement, document, context );
565 Q_UNUSED( layer_node );
566 Q_UNUSED( document );
582 Q_UNUSED( dataProvider );
595 mCustomProperties.
readXml( layerNode, keyStartsWith );
600 mCustomProperties.
writeXml( layerNode, doc );
605 QDomElement styleMgrElem = layerNode.firstChildElement( QStringLiteral(
"map-layer-style-manager" ) );
606 if ( !styleMgrElem.isNull() )
607 mStyleManager->
readXml( styleMgrElem );
609 mStyleManager->
reset();
616 QDomElement styleMgrElem = doc.createElement( QStringLiteral(
"map-layer-style-manager" ) );
617 mStyleManager->
writeXml( styleMgrElem );
618 layerNode.appendChild( styleMgrElem );
628 void QgsMapLayer::connectNotify(
const char *signal )
637 return !mScaleBasedVisibility ||
639 && ( mMaxScale == 0 || scale < mMaxScale ) );
644 return mScaleBasedVisibility;
649 return mRefreshTimer->isActive();
654 return mRefreshTimer->interval();
661 mRefreshTimer->stop();
662 mRefreshTimer->setInterval( 0 );
666 mRefreshTimer->setInterval( interval );
674 mRefreshTimer->stop();
675 else if ( mRefreshTimer->interval() > 0 )
676 mRefreshTimer->start();
704 mScaleBasedVisibility = enabled;
714 return QStringList();
751 QString layerName( name );
752 layerName.replace(
'_',
' ' );
762 if ( myURI.startsWith( QLatin1String(
"/vsigzip/" ), Qt::CaseInsensitive ) )
764 myURI.remove( 0, 9 );
766 else if ( myURI.startsWith( QLatin1String(
"/vsizip/" ), Qt::CaseInsensitive ) &&
767 myURI.endsWith( QLatin1String(
".zip" ), Qt::CaseInsensitive ) )
770 myURI.remove( 0, 8 );
772 else if ( myURI.startsWith( QLatin1String(
"/vsitar/" ), Qt::CaseInsensitive ) &&
773 ( myURI.endsWith( QLatin1String(
".tar" ), Qt::CaseInsensitive ) ||
774 myURI.endsWith( QLatin1String(
".tar.gz" ), Qt::CaseInsensitive ) ||
775 myURI.endsWith( QLatin1String(
".tgz" ), Qt::CaseInsensitive ) ) )
778 myURI.remove( 0, 8 );
781 QFileInfo myFileInfo( myURI );
784 if ( myFileInfo.exists() )
787 if ( myURI.endsWith( QLatin1String(
".gz" ), Qt::CaseInsensitive ) )
789 else if ( myURI.endsWith( QLatin1String(
".zip" ), Qt::CaseInsensitive ) )
791 else if ( myURI.endsWith( QLatin1String(
".tar" ), Qt::CaseInsensitive ) )
793 else if ( myURI.endsWith( QLatin1String(
".tar.gz" ), Qt::CaseInsensitive ) )
795 else if ( myURI.endsWith( QLatin1String(
".tgz" ), Qt::CaseInsensitive ) )
797 myFileInfo.setFile( myURI );
811 return baseURI( PropertyType::Metadata );
826 return baseURI( PropertyType::Style );
836 return loadNamedPropertyFromDatabase( db, uri, qmd, PropertyType::Metadata );
841 return loadNamedPropertyFromDatabase( db, uri, qml, PropertyType::Style );
848 bool resultFlag =
false;
856 QgsDebugMsgLevel( QString(
"Trying to load style or metadata for \"%1\" from \"%2\"" ).arg( uri, db ), 4 );
858 if ( db.isEmpty() || !QFile( db ).exists() )
861 myResult = database.
open_v2( db, SQLITE_OPEN_READONLY,
nullptr );
862 if ( myResult != SQLITE_OK )
871 mySql = QStringLiteral(
"select qmd from tbl_metadata where metadata=?" );
875 mySql = QStringLiteral(
"select qml from tbl_styles where style=?" );
879 statement = database.
prepare( mySql, myResult );
880 if ( myResult == SQLITE_OK )
882 QByteArray param = uri.toUtf8();
884 if ( sqlite3_bind_text( statement.get(), 1, param.data(), param.length(), SQLITE_STATIC ) == SQLITE_OK &&
885 sqlite3_step( statement.get() ) == SQLITE_ROW )
887 xml = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( statement.get(), 0 ) ) );
897 return loadNamedProperty( uri, PropertyType::Style, resultFlag );
906 QDomDocument myDocument( QStringLiteral(
"qgis" ) );
910 QString myErrorMessage;
913 if ( myFile.open( QFile::ReadOnly ) )
917 resultFlag = myDocument.setContent( &myFile, &myErrorMessage, &line, &column );
919 myErrorMessage = tr(
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
925 QgsDebugMsgLevel( QString(
"project fileName: %1" ).arg( project.absoluteFilePath() ), 4 );
933 ( project.exists() &&
loadNamedStyleFromDatabase( project.absoluteDir().absoluteFilePath( project.baseName() +
".qmldb" ), uri, xml ) ) ||
936 resultFlag = myDocument.setContent( xml, &myErrorMessage, &line, &column );
939 myErrorMessage = tr(
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
944 myErrorMessage = tr(
"Style not found in database" );
952 ( project.exists() &&
loadNamedMetadataFromDatabase( project.absoluteDir().absoluteFilePath( project.baseName() +
".qmldb" ), uri, xml ) ) ||
955 resultFlag = myDocument.setContent( xml, &myErrorMessage, &line, &column );
958 myErrorMessage = tr(
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
963 myErrorMessage = tr(
"Metadata not found in database" );
973 return myErrorMessage;
981 myErrorMessage = tr(
"Loading style file %1 failed because:\n%2" ).arg( uri, myErrorMessage );
986 myErrorMessage = tr(
"Loading metadata file %1 failed because:\n%2" ).arg( uri, myErrorMessage );
989 return myErrorMessage;
994 QDomElement myRoot = document.firstChildElement( QStringLiteral(
"qgis" ) );
995 if ( myRoot.isNull() )
997 errorMessage = tr(
"Root <qgis> element could not be found" );
1006 QDomElement myRoot = myDocument.firstChildElement( QStringLiteral(
"qgis" ) );
1007 if ( myRoot.isNull() )
1009 myErrorMessage = tr(
"Root <qgis> element could not be found" );
1014 QgsProjectVersion fileVersion( myRoot.attribute( QStringLiteral(
"version" ) ) );
1017 if ( thisVersion > fileVersion )
1030 myErrorMessage = tr(
"Cannot apply style to layer with a different geometry type" );
1037 if ( myRoot.hasAttribute( QStringLiteral(
"minimumScale" ) ) )
1040 setMaximumScale( myRoot.attribute( QStringLiteral(
"minimumScale" ) ).toDouble() );
1041 setMinimumScale( myRoot.attribute( QStringLiteral(
"maximumScale" ) ).toDouble() );
1045 setMaximumScale( myRoot.attribute( QStringLiteral(
"maxScale" ) ).toDouble() );
1046 setMinimumScale( myRoot.attribute( QStringLiteral(
"minScale" ) ).toDouble() );
1055 QDomImplementation DomImplementation;
1056 QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral(
"qgis" ), QStringLiteral(
"http://mrcc.com/qgis.dtd" ), QStringLiteral(
"SYSTEM" ) );
1057 QDomDocument myDocument( documentType );
1059 QDomElement myRootNode = myDocument.createElement( QStringLiteral(
"qgis" ) );
1061 myDocument.appendChild( myRootNode );
1065 errorMsg = QObject::tr(
"Could not save metadata" );
1074 QDomImplementation DomImplementation;
1075 QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral(
"qgis" ), QStringLiteral(
"http://mrcc.com/qgis.dtd" ), QStringLiteral(
"SYSTEM" ) );
1076 QDomDocument myDocument( documentType );
1078 QDomElement myRootNode = myDocument.createElement( QStringLiteral(
"qgis" ) );
1080 myDocument.appendChild( myRootNode );
1082 myRootNode.setAttribute( QStringLiteral(
"hasScaleBasedVisibilityFlag" ),
hasScaleBasedVisibility() ? 1 : 0 );
1083 myRootNode.setAttribute( QStringLiteral(
"maxScale" ), QString::number(
maximumScale() ) );
1084 myRootNode.setAttribute( QStringLiteral(
"minScale" ), QString::number(
minimumScale() ) );
1088 errorMsg = QObject::tr(
"Could not save symbology because:\n%1" ).arg( errorMsg );
1100 QString geoType = QString::number( vl->
geometryType() );
1103 QDomElement layerGeometryType = myDocument.createElement( QStringLiteral(
"layerGeometryType" ) );
1104 QDomText
type = myDocument.createTextNode( geoType );
1106 layerGeometryType.appendChild( type );
1107 myRootNode.appendChild( layerGeometryType );
1136 if ( vlayer && vlayer->
providerType() == QLatin1String(
"ogr" ) )
1138 QStringList theURIParts = uri.split(
'|' );
1139 filename = theURIParts[0];
1141 else if ( vlayer && vlayer->
providerType() == QLatin1String(
"gpx" ) )
1143 QStringList theURIParts = uri.split(
'?' );
1144 filename = theURIParts[0];
1146 else if ( vlayer && vlayer->
providerType() == QLatin1String(
"delimitedtext" ) )
1148 filename = QUrl::fromEncoded( uri.toLatin1() ).toLocalFile();
1150 if ( filename.isEmpty() )
1158 QString myErrorMessage;
1159 QDomDocument myDocument;
1171 QFileInfo myFileInfo( filename );
1174 QFileInfo myDirInfo( myFileInfo.path() );
1175 if ( !myDirInfo.isWritable() )
1177 return tr(
"The directory containing your dataset needs to be writable!" );
1183 QFile myFile( myFileName );
1184 if ( myFile.open( QFile::WriteOnly | QFile::Truncate ) )
1186 QTextStream myFileStream( &myFile );
1188 myDocument.save( myFileStream, 2 );
1194 return tr(
"Created default metadata file as %1" ).arg( myFileName );
1197 return tr(
"Created default style file as %1" ).arg( myFileName );
1207 return tr(
"ERROR: Failed to created default metadata file as %1. Check file permissions and retry." ).arg( myFileName );
1210 return tr(
"ERROR: Failed to created default style file as %1. Check file permissions and retry." ).arg( myFileName );
1216 QString qml = myDocument.toString();
1223 if ( myResult != SQLITE_OK )
1225 return tr(
"User database could not be opened." );
1228 QByteArray param0 = uri.toUtf8();
1229 QByteArray param1 = qml.toUtf8();
1235 mySql = QStringLiteral(
"create table if not exists tbl_metadata(metadata varchar primary key,qmd varchar)" );
1239 mySql = QStringLiteral(
"create table if not exists tbl_styles(style varchar primary key,qml varchar)" );
1243 statement = database.
prepare( mySql, myResult );
1244 if ( myResult == SQLITE_OK )
1246 if ( sqlite3_step( statement.get() ) != SQLITE_DONE )
1252 return tr(
"The metadata table could not be created." );
1255 return tr(
"The style table could not be created." );
1263 mySql = QStringLiteral(
"insert into tbl_metadata(metadata,qmd) values (?,?)" );
1267 mySql = QStringLiteral(
"insert into tbl_styles(style,qml) values (?,?)" );
1270 statement = database.
prepare( mySql, myResult );
1271 if ( myResult == SQLITE_OK )
1273 if ( sqlite3_bind_text( statement.get(), 1, param0.data(), param0.length(), SQLITE_STATIC ) == SQLITE_OK &&
1274 sqlite3_bind_text( statement.get(), 2, param1.data(), param1.length(), SQLITE_STATIC ) == SQLITE_OK &&
1275 sqlite3_step( statement.get() ) == SQLITE_DONE )
1281 myErrorMessage = tr(
"The metadata %1 was saved to database" ).arg( uri );
1285 myErrorMessage = tr(
"The style %1 was saved to database" ).arg( uri );
1297 mySql = QStringLiteral(
"update tbl_metadata set qmd=? where metadata=?" );
1301 mySql = QStringLiteral(
"update tbl_styles set qml=? where style=?" );
1304 statement = database.
prepare( mySql, myResult );
1305 if ( myResult == SQLITE_OK )
1307 if ( sqlite3_bind_text( statement.get(), 2, param0.data(), param0.length(), SQLITE_STATIC ) == SQLITE_OK &&
1308 sqlite3_bind_text( statement.get(), 1, param1.data(), param1.length(), SQLITE_STATIC ) == SQLITE_OK &&
1309 sqlite3_step( statement.get() ) == SQLITE_DONE )
1315 myErrorMessage = tr(
"The metadata %1 was updated in the database." ).arg( uri );
1319 myErrorMessage = tr(
"The style %1 was updated in the database." ).arg( uri );
1329 myErrorMessage = tr(
"The metadata %1 could not be updated in the database." ).arg( uri );
1333 myErrorMessage = tr(
"The style %1 could not be updated in the database." ).arg( uri );
1344 myErrorMessage = tr(
"The metadata %1 could not be inserted into database." ).arg( uri );
1348 myErrorMessage = tr(
"The style %1 could not be inserted into database." ).arg( uri );
1355 return myErrorMessage;
1365 QDomDocument myDocument = QDomDocument();
1367 QDomNode header = myDocument.createProcessingInstruction( QStringLiteral(
"xml" ), QStringLiteral(
"version=\"1.0\" encoding=\"UTF-8\"" ) );
1368 myDocument.appendChild( header );
1371 QDomElement root = myDocument.createElementNS( QStringLiteral(
"http://www.opengis.net/sld" ), QStringLiteral(
"StyledLayerDescriptor" ) );
1372 root.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.1.0" ) );
1373 root.setAttribute( QStringLiteral(
"xsi:schemaLocation" ), QStringLiteral(
"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" ) );
1374 root.setAttribute( QStringLiteral(
"xmlns:ogc" ), QStringLiteral(
"http://www.opengis.net/ogc" ) );
1375 root.setAttribute( QStringLiteral(
"xmlns:se" ), QStringLiteral(
"http://www.opengis.net/se" ) );
1376 root.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1377 root.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
1378 myDocument.appendChild( root );
1381 QDomElement namedLayerNode = myDocument.createElement( QStringLiteral(
"NamedLayer" ) );
1382 root.appendChild( namedLayerNode );
1387 errorMsg = tr(
"Could not save symbology because:\n%1" )
1388 .arg( QStringLiteral(
"Non-vector layers not supported yet" ) );
1395 props[ QStringLiteral(
"scaleMinDenom" )] = QString::number( mMinScale );
1396 props[ QStringLiteral(
"scaleMaxDenom" )] = QString::number( mMaxScale );
1398 if ( !vlayer->
writeSld( namedLayerNode, myDocument, errorMsg, props ) )
1400 errorMsg = tr(
"Could not save symbology because:\n%1" ).arg( errorMsg );
1410 QDomDocument myDocument;
1412 if ( !errorMsg.isNull() )
1422 if ( vlayer->
providerType() == QLatin1String(
"ogr" ) )
1424 QStringList theURIParts = uri.split(
'|' );
1425 filename = theURIParts[0];
1427 else if ( vlayer->
providerType() == QLatin1String(
"gpx" ) )
1429 QStringList theURIParts = uri.split(
'?' );
1430 filename = theURIParts[0];
1432 else if ( vlayer->
providerType() == QLatin1String(
"delimitedtext" ) )
1434 filename = QUrl::fromEncoded( uri.toLatin1() ).toLocalFile();
1436 if ( filename.isEmpty() )
1444 QFileInfo myFileInfo( filename );
1445 if ( myFileInfo.exists() || filename.endsWith( QLatin1String(
".sld" ), Qt::CaseInsensitive ) )
1447 QFileInfo myDirInfo( myFileInfo.path() );
1448 if ( !myDirInfo.isWritable() )
1450 return tr(
"The directory containing your dataset needs to be writable!" );
1454 QString myFileName = myFileInfo.path() + QDir::separator() + myFileInfo.completeBaseName() +
".sld";
1456 QFile myFile( myFileName );
1457 if ( myFile.open( QFile::WriteOnly | QFile::Truncate ) )
1459 QTextStream myFileStream( &myFile );
1461 myDocument.save( myFileStream, 2 );
1464 return tr(
"Created default style file as %1" ).arg( myFileName );
1469 return tr(
"ERROR: Failed to created SLD style file as %1. Check file permissions and retry." ).arg( filename );
1476 QDomDocument myDocument;
1480 QString myErrorMessage;
1482 QFile myFile( uri );
1483 if ( myFile.open( QFile::ReadOnly ) )
1486 resultFlag = myDocument.setContent( &myFile,
true, &myErrorMessage, &line, &column );
1488 myErrorMessage = tr(
"%1 at line %2 column %3" ).arg( myErrorMessage ).arg( line ).arg( column );
1493 myErrorMessage = tr(
"Unable to open file %1" ).arg( uri );
1498 return myErrorMessage;
1502 QDomElement myRoot = myDocument.firstChildElement( QStringLiteral(
"StyledLayerDescriptor" ) );
1503 if ( myRoot.isNull() )
1505 myErrorMessage = QStringLiteral(
"Error: StyledLayerDescriptor element not found in %1" ).arg( uri );
1507 return myErrorMessage;
1512 QDomElement namedLayerElem = myRoot.firstChildElement( QStringLiteral(
"NamedLayer" ) );
1513 if ( namedLayerElem.isNull() )
1515 myErrorMessage = QStringLiteral(
"Info: NamedLayer element not found." );
1517 return myErrorMessage;
1521 resultFlag =
readSld( namedLayerElem, errorMsg );
1524 myErrorMessage = tr(
"Loading style file %1 failed because:\n%2" ).arg( uri, errorMsg );
1525 return myErrorMessage;
1528 return QLatin1String(
"" );
1534 Q_UNUSED( errorMessage );
1535 Q_UNUSED( context );
1543 Q_UNUSED( errorMessage );
1544 Q_UNUSED( context );
1553 QDomElement renderer3DElem = document.createElement( QStringLiteral(
"renderer-3d" ) );
1554 renderer3DElem.setAttribute( QStringLiteral(
"type" ), m3DRenderer->
type() );
1555 m3DRenderer->
writeXml( renderer3DElem, context );
1556 layerElement.appendChild( renderer3DElem );
1563 QDomElement renderer3DElem = layerElement.firstChildElement( QStringLiteral(
"renderer-3d" ) );
1564 if ( !renderer3DElem.isNull() )
1566 QString type3D = renderer3DElem.attribute( QStringLiteral(
"type" ) );
1583 return mUndoStackStyles;
1588 return mCustomProperties.
keys();
1593 mCustomProperties.
setValue( key, value );
1598 mCustomProperties = properties;
1603 return mCustomProperties.
value( value, defaultValue );
1608 mCustomProperties.
remove( key );
1635 if ( legend == mLegend )
1643 mLegend->setParent(
this );
1657 return mStyleManager;
1662 if ( renderer == m3DRenderer )
1666 m3DRenderer = renderer;
1707 static QList<const QgsMapLayer *> _depOutEdges(
const QgsMapLayer *vl,
const QgsMapLayer *that,
const QSet<QgsMapLayerDependency> &layers )
1709 QList<const QgsMapLayer *> lst;
1729 static bool _depHasCycleDFS(
const QgsMapLayer *n, QHash<const QgsMapLayer *, int> &mark,
const QgsMapLayer *that,
const QSet<QgsMapLayerDependency> &layers )
1731 if ( mark.value( n ) == 1 )
1733 if ( mark.value( n ) == 0 )
1736 Q_FOREACH (
const QgsMapLayer *m, _depOutEdges( n, that, layers ) )
1738 if ( _depHasCycleDFS( m, mark, that, layers ) )
1748 QHash<const QgsMapLayer *, int> marks;
1749 return _depHasCycleDFS(
this, marks,
this, layers );
1752 bool QgsMapLayer::isReadOnly()
const 1764 QSet<QgsMapLayerDependency> deps;
1796 void QgsMapLayer::onNotifiedTriggerRepaint(
const QString &message )
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
Origin origin() const
Returns the dependency origin.
virtual QStringList subLayers() const
Returns the sublayers of this layer.
void writeCommonStyle(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context) const
Write style data common to all layer types.
void setMetadataUrl(const QString &metaUrl)
Sets the metadata URL of the layer used by QGIS Server in GetCapabilities request.
The class is used as a container of context for various read/write operations on other objects...
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
A rectangle specified with double values.
Base class for all map layer types.
static QString formatLayerName(const QString &name)
A convenience function to capitalize and format a layer name.
static Qgs3DRendererRegistry * renderer3DRegistry()
Returns registry of available 3D renderers.
static const QString QGIS_VERSION
Version string.
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml()
virtual void exportSldStyle(QDomDocument &doc, QString &errorMsg) const
Export the properties of this layer as SLD style in a QDomDocument.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
void dependenciesChanged()
Emitted when dependencies are changed.
virtual QString loadSldStyle(const QString &uri, bool &resultFlag)
Attempts to style the layer using the formatting from an SLD type file.
Base class for all renderers that may to participate in 3D view.
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from XML.
void reset()
Reset the style manager to a basic state - with one default style which is set as current...
QStringList customPropertyKeys() const
Returns list of all keys within custom properties.
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory(const QString &category, const QString &details=QString())
Push a category to the stack.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QgsMapLayerLegend * legend() const
Can be null.
Unique pointer for sqlite3 prepared statements, which automatically finalizes the statement when the ...
void setCustomProperties(const QgsObjectCustomProperties &properties)
Set custom properties for layer.
void metadataChanged()
Emitted when the layer's metadata is changed.
virtual QgsError error() const
Gets current status error.
void validate()
Perform some validation on this CRS.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void readCommonStyle(const QDomElement &layerElement, const QgsReadWriteContext &context)
Read style data common to all layer types.
void emitStyleChanged()
Triggers an emission of the styleChanged() signal.
virtual QString loadNamedStyle(const QString &uri, bool &resultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
PropertyType
Maplayer has a style and a metadata property.
void setRefreshOnNotifyEnabled(bool enabled)
Set whether provider notification is connected to triggerRepaint.
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
static void setCustomCrsValidation(CUSTOM_CRS_VALIDATION f)
Sets custom function to force valid CRS.
void readCustomProperties(const QDomNode &layerNode, const QString &keyStartsWith=QString())
Read custom properties from project file.
virtual bool loadNamedStyleFromDatabase(const QString &db, const QString &uri, QString &qml)
Retrieve a named style for this layer from a sqlite database.
virtual void resolveReferences(QgsProject *project)
Resolve references to other layers (kept as layer IDs after reading XML) into layer objects...
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...
virtual QString saveSldStyle(const QString &uri, bool &resultFlag) const
Saves the properties of this layer to an SLD format file.
static QDomElement writeRectangle(const QgsRectangle &rect, QDomDocument &doc)
void crsChanged()
Emit a signal that layer's CRS has been reset.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
virtual const QgsLayerMetadata & metadata() const
Returns a reference to the layer's metadata store.
void configChanged()
Emitted whenever the configuration is changed.
bool isInScaleRange(double scale) const
Tests whether the layer should be visible at the specified scale.
bool readLayerXml(const QDomElement &layerElement, QgsReadWriteContext &context)
Sets state from Dom document.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns value for the given key. If the key is not stored, default value will be used.
void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
Allows entering a context category and takes care of leaving this category on deletion of the class...
Abstract base class for spatial data provider implementations.
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...
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 writeXml(QDomNode &parentNode, QDomDocument &doc) const
Write store contents to XML.
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...
bool isValid() const
Returns the status of the layer.
void notify(const QString &msg)
Emitted when datasource issues a notification.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
bool mIsRefreshOnNofifyEnabled
QgsMapLayer::LayerType type() const
Returns the type of the layer.
QMap< QString, QString > QgsStringMap
void remove(const QString &key)
Remove a key (entry) from the store.
void exportNamedMetadata(QDomDocument &doc, QString &errorMsg) const
Export the current metadata of this layer as named metadata in a QDomDocument.
QString mLayerName
Name of the layer - used for display.
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
void styleChanged()
Signal emitted whenever a change affects the layer's style.
bool loadNamedMetadataFromDatabase(const QString &db, const QString &uri, QString &qmd)
Retrieve a named metadata for this layer from a sqlite database.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this layer.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsMapLayer(QgsMapLayer::LayerType type=VectorLayer, const QString &name=QString(), const QString &source=QString())
Constructor for QgsMapLayer.
void writeCustomProperties(QDomNode &layerNode, QDomDocument &doc) const
Write custom properties to project file.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context) const =0
Write the symbology for the layer into the docment provided.
QgsRectangle mExtent
Extent of the layer.
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes renderer's properties to given XML element.
QString mMetadataUrl
MetadataUrl of the layer.
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
void setValidationHint(const QString &html)
Set user hint for validation.
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setValue(const QString &key, const QVariant &value)
Add an entry to the store. If the entry with the keys exists already, it will be overwritten.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
static QString capitalize(const QString &string, Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void readStyleManager(const QDomNode &layerNode)
Read style manager's configuration (if any). To be called by subclasses.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted...
int autoRefreshInterval() const
Returns the auto refresh interval (in milliseconds).
virtual void setSubLayerVisibility(const QString &name, bool visible)
Set the visibility of the given sublayer name.
#define QgsDebugMsgLevel(str, level)
virtual QString type() const =0
Returns unique identifier of the renderer class (used to identify subclass)
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...
LayerType
Types of layers that can be added to a map.
virtual void setMetadata(const QgsLayerMetadata &metadata)
Sets the layer's metadata store.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
QSet< QgsMapLayerDependency > mDependencies
List of layers that may modify this layer on modification.
virtual void setListening(bool isListening)
Set whether the provider will listen to datasource notifications If set, the provider will issue noti...
void nameChanged()
Emitted when the name has been changed.
A class to describe the version of a project.
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
void readXml(const QDomElement &mgrElement)
Read configuration (for project loading)
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
bool writeSld(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props=QgsStringMap()) const
Writes the symbology of the layer into the document provided in SLD 1.1 format.
QString mDataUrl
DataUrl of the layer.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context)=0
Read the symbology for the current layer from the Dom node supplied.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer...
virtual bool isEditable() const
Returns true if the layer can be edited.
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 ...
QString legendUrl() const
Returns the URL for the layer's legend.
QgsCoordinateReferenceSystem crs() const
Returns the layer's spatial reference system.
Reads and writes project states.
QString publicSource() const
Gets a version of the internal layer definition that has sensitive bits removed (for example...
void setRenderer3D(QgsAbstract3DRenderer *renderer)
Sets 3D renderer for the layer.
void removeCustomProperty(const QString &key)
Remove a custom property from layer.
static QString extensionPropertyType(PropertyType type)
Returns the extension of a Property.
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg)
Import the properties of this layer from a QDomDocument.
sqlite3_statement_unique_ptr prepare(const QString &sql, int &resultCode) const
Prepares a sql statement, returning the result.
double minimumScale() const
Returns the minimum map scale (i.e.
double maximumScale() const
Returns the maximum map scale (i.e.
bool mValid
Indicates if the layer is valid and can be drawn.
void setName(const QString &name)
Set the display name of the layer.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
int open(const QString &path)
Opens the database at the specified file path.
QStringList keys() const
Returns list of stored keys.
QgsAbstract3DRenderer * renderer3D() const
Returns 3D renderer associated with the layer.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
Convert just the first letter of each word to uppercase, leave the rest untouched.
QString mMetadataUrlFormat
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
bool hasDependencyCycle(const QSet< QgsMapLayerDependency > &layers) const
Checks whether a new set of dependencies will introduce a cycle.
void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
virtual bool readXml(const QDomNode &layer_node, QgsReadWriteContext &context)
Called by readLayerXML(), used by children to read state specific to them from project files...
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
static QString pkgDataPath()
Returns the common root path of all application data directories.
static CUSTOM_CRS_VALIDATION customCrsValidation()
Gets custom function.
void repaintRequested(bool deferredUpdate=false)
By emitting this signal the layer tells that either appearance or content have been changed and any v...
QString mAttribution
Attribution of the layer.
QString mAbstract
Description of the layer.
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
void writeStyleManager(QDomNode &layerNode, QDomDocument &doc) const
Write style manager's configuration (if exists). To be called by subclasses.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
void blendModeChanged(QPainter::CompositionMode blendMode)
Signal emitted when the blend mode is changed, through QgsMapLayer::setBlendMode() ...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
QString mRefreshOnNofifyMessage
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
int open_v2(const QString &path, int flags, const char *zVfs)
Opens the database at the specified file path.
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...
virtual QString saveDefaultStyle(bool &resultFlag)
Save the properties of this layer as the default style (either as a .qml file on disk or as a record ...
void itemsChanged()
Emitted when existing items/nodes got invalid and should be replaced by new ones. ...
QString name() const
Returns the display name of the layer.
QString mDataSource
Data source description string, varies by layer type.
QString source() const
Returns the source for the layer.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
QgsError is container for error messages (report).
bool setMasterPassword(bool verify=false)
Main call to initially set or continually check master password is set.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Qgs3DRendererAbstractMetadata * rendererMetadata(const QString &type) const
Returns metadata for a 3D renderer type (may be used to create a new instance of the type) ...
QString mLegendUrl
WMS legend.
This class represents a coordinate reference system (CRS).
QString layerId() const
Returns the ID of the layer this dependency depends on.
void legendChanged()
Signal emitted when legend of the layer has changed.
virtual bool readStyle(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context)
Read the style for the current layer from the Dom node supplied.
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
void setAutoRefreshInterval(int interval)
Sets the auto refresh interval (in milliseconds) for the layer.
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
virtual QString saveNamedStyle(const QString &uri, bool &resultFlag)
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in t...
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context) const
Write just the style information for the layer into the document.
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...
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
void setAutoRefreshEnabled(bool enabled)
Sets whether auto refresh is enabled for the layer.
QUndoStack * undoStackStyles()
Returns pointer to layer's style undo stack.
bool addStyle(const QString &name, const QgsMapLayerStyle &style)
Add a style with given name and data.
QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
QUndoStack * undoStack()
Returns pointer to layer's undo stack.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request. ...
void(* CUSTOM_CRS_VALIDATION)(QgsCoordinateReferenceSystem &)
QString providerType() const
Returns the provider type for this layer.
void setRefreshOnNofifyMessage(const QString &message)
Set the notification message that triggers repaine If refresh on notification is enabled, the notification will triggerRepaint only if the notification message is equal to.
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 ...
bool hasAutoRefreshEnabled() const
Returns true if auto refresh is enabled for the layer.
void setLegend(QgsMapLayerLegend *legend)
Assign a legend controller to the map layer.
bool writeXml(QDomNode &node, QDomDocument &doc) const
Stores state to the given Dom node in the given document.
void autoRefreshIntervalChanged(int interval)
Emitted when the auto refresh interval changes.
This class models dependencies with or between map layers.
Management of styles for use with one map layer.
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
Represents a vector layer which manages a vector based data sets.
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
virtual void setLayerOrder(const QStringList &layers)
Reorders the previously selected sublayers of this layer from bottom to top.
void writeXml(QDomElement &mgrElement) const
Write configuration (for project saving)
bool writeLayerXml(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context) const
Stores state in Dom node.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void setValid(bool valid)
Sets whether layer is valid or not - should be used in constructor.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
static const double SCALE_PRECISION
Fudge factor used to compare two scales.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
void renderer3DChanged()
Signal emitted when 3D renderer associated with the layer has changed.
static QString removePassword(const QString &aUri)
Removes password element from uris.
bool importNamedMetadata(QDomDocument &document, QString &errorMessage)
Import the metadata of this layer from a QDomDocument.
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 setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
virtual void exportNamedStyle(QDomDocument &doc, QString &errorMsg) const
Export the properties of this layer as named style in a QDomDocument.