QGIS API Documentation  3.19.0-Master (67c226385a)
qgsmaplayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaplayer.h - description
3  -------------------
4  begin : Fri Jun 28 2002
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMAPLAYER_H
19 #define QGSMAPLAYER_H
20 
21 #include "qgis_core.h"
22 #include <QDateTime>
23 #include <QDomNode>
24 #include <QImage>
25 #include <QObject>
26 #include <QPainter>
27 #include <QUndoStack>
28 #include <QVariant>
29 #include <QIcon>
30 
31 #include "qgis_sip.h"
32 #include "qgserror.h"
34 #include "qgsrectangle.h"
36 #include "qgsrendercontext.h"
37 #include "qgsmaplayerdependency.h"
38 #include "qgslayermetadata.h"
39 #include "qgsmaplayerstyle.h"
40 #include "qgsreadwritecontext.h"
41 #include "qgsdataprovider.h"
42 
44 class QgsDataProvider;
45 class QgsMapLayerLegend;
48 class QgsProject;
52 
53 class QDomDocument;
54 class QKeyEvent;
55 class QPainter;
56 
57 /*
58  * Constants used to describe copy-paste MIME types
59  */
60 #define QGSCLIPBOARD_MAPLAYER_MIME "application/qgis.maplayer"
61 
62 
69  {
73  MeshLayer,
77 };
78 
84 class CORE_EXPORT QgsMapLayer : public QObject
85 {
86  Q_OBJECT
87 
88  Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
89  Q_PROPERTY( int autoRefreshInterval READ autoRefreshInterval WRITE setAutoRefreshInterval NOTIFY autoRefreshIntervalChanged )
90  Q_PROPERTY( QgsLayerMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
91  Q_PROPERTY( QgsCoordinateReferenceSystem crs READ crs WRITE setCrs NOTIFY crsChanged )
92  Q_PROPERTY( QgsMapLayerType type READ type CONSTANT )
93  Q_PROPERTY( bool isValid READ isValid NOTIFY isValidChanged )
94  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
95 
96 #ifdef SIP_RUN
98  QgsMapLayer * layer = qobject_cast<QgsMapLayer *>( sipCpp );
99 
100  sipType = 0;
101 
102  if ( layer )
103  {
104  switch ( layer->type() )
105  {
107  sipType = sipType_QgsVectorLayer;
108  break;
110  sipType = sipType_QgsRasterLayer;
111  break;
113  sipType = sipType_QgsPluginLayer;
114  break;
116  sipType = sipType_QgsMeshLayer;
117  break;
119  sipType = sipType_QgsVectorTileLayer;
120  break;
122  sipType = sipType_QgsAnnotationLayer;
123  break;
125  sipType = sipType_QgsPointCloudLayer;
126  break;
127  default:
128  sipType = nullptr;
129  break;
130  }
131  }
132  SIP_END
133 #endif
134 
135  public:
136 
142  {
143  Style = 0,
145  };
146 
153  {
154  Identifiable = 1 << 0,
155  Removable = 1 << 1,
156  Searchable = 1 << 2,
157  Private = 1 << 3,
158  };
159  Q_ENUM( LayerFlag )
160  Q_DECLARE_FLAGS( LayerFlags, LayerFlag )
161  Q_FLAG( LayerFlags )
162 
163 
168  {
169  LayerConfiguration = 1 << 0,
170  Symbology = 1 << 1,
171  Symbology3D = 1 << 2,
172  Labeling = 1 << 3,
173  Fields = 1 << 4,
174  Forms = 1 << 5,
175  Actions = 1 << 6,
176  MapTips = 1 << 7,
177  Diagrams = 1 << 8,
178  AttributeTable = 1 << 9,
179  Rendering = 1 << 10,
180  CustomProperties = 1 << 11,
181  GeometryOptions = 1 << 12,
182  Relations = 1 << 13,
183  Temporal = 1 << 14,
184  Legend = 1 << 15,
185  Elevation = 1 << 16,
186  AllStyleCategories = LayerConfiguration | Symbology | Symbology3D | Labeling | Fields | Forms | Actions |
187  MapTips | Diagrams | AttributeTable | Rendering | CustomProperties | GeometryOptions | Relations | Temporal | Legend | Elevation,
188  };
189  Q_ENUM( StyleCategory )
190  Q_DECLARE_FLAGS( StyleCategories, StyleCategory )
191  Q_FLAG( StyleCategories )
192 
193 
199  QgsMapLayer( QgsMapLayerType type = QgsMapLayerType::VectorLayer, const QString &name = QString(), const QString &source = QString() );
200 
201  ~QgsMapLayer() override;
202 
204  QgsMapLayer( QgsMapLayer const & ) = delete;
206  QgsMapLayer &operator=( QgsMapLayer const & ) = delete;
207 
214  virtual QgsMapLayer *clone() const = 0;
215 
219  QgsMapLayerType type() const;
220 
228  QgsMapLayer::LayerFlags flags() const;
229 
237  void setFlags( QgsMapLayer::LayerFlags flags );
238 
244  static QString extensionPropertyType( PropertyType type );
245 
247  QString id() const;
248 
254  void setName( const QString &name );
255 
260  QString name() const;
261 
265  Q_INVOKABLE virtual QgsDataProvider *dataProvider();
266 
271  virtual const QgsDataProvider *dataProvider() const SIP_SKIP;
272 
279  void setShortName( const QString &shortName ) { mShortName = shortName; }
280 
286  QString shortName() const;
287 
293  void setTitle( const QString &title ) { mTitle = title; }
294 
301  QString title() const { return mTitle; }
302 
309  void setAbstract( const QString &abstract ) { mAbstract = abstract; }
310 
317  QString abstract() const { return mAbstract; }
318 
325  void setKeywordList( const QString &keywords ) { mKeywordList = keywords; }
326 
333  QString keywordList() const { return mKeywordList; }
334 
335  /* Layer dataUrl information */
336 
344  void setDataUrl( const QString &dataUrl ) { mDataUrl = dataUrl; }
345 
353  QString dataUrl() const { return mDataUrl; }
354 
362  void setDataUrlFormat( const QString &dataUrlFormat ) { mDataUrlFormat = dataUrlFormat; }
363 
371  QString dataUrlFormat() const { return mDataUrlFormat; }
372 
373  /* Layer attribution information */
374 
382  void setAttribution( const QString &attrib ) { mAttribution = attrib; }
383 
391  QString attribution() const { return mAttribution; }
392 
400  void setAttributionUrl( const QString &attribUrl ) { mAttributionUrl = attribUrl; }
401 
409  QString attributionUrl() const { return mAttributionUrl; }
410 
411  /* Layer metadataUrl information */
412 
420  void setMetadataUrl( const QString &metaUrl ) { mMetadataUrl = metaUrl; }
421 
429  QString metadataUrl() const { return mMetadataUrl; }
430 
438  void setMetadataUrlType( const QString &metaUrlType ) { mMetadataUrlType = metaUrlType; }
439 
447  QString metadataUrlType() const { return mMetadataUrlType; }
448 
456  void setMetadataUrlFormat( const QString &metaUrlFormat ) { mMetadataUrlFormat = metaUrlFormat; }
457 
465  QString metadataUrlFormat() const { return mMetadataUrlFormat; }
466 
472  void setBlendMode( QPainter::CompositionMode blendMode );
473 
478  QPainter::CompositionMode blendMode() const;
479 
488  virtual void setOpacity( double opacity );
489 
498  virtual double opacity() const;
499 
501  bool readOnly() const { return isReadOnly(); }
502 
506  Q_INVOKABLE virtual void reload() {}
507 
513 
515  virtual QgsRectangle extent() const;
516 
522  bool isValid() const;
523 
530  QString publicSource() const;
531 
537  QString source() const;
538 
543  virtual QStringList subLayers() const;
544 
549  virtual void setLayerOrder( const QStringList &layers );
550 
556  virtual void setSubLayerVisibility( const QString &name, bool visible );
557 
559  virtual bool isEditable() const;
560 
565  virtual bool isSpatial() const;
566 
576  virtual bool isTemporary() const;
577 
582  enum ReadFlag
583  {
584  FlagDontResolveLayers = 1 << 0,
585  FlagTrustLayerMetadata = 1 << 1,
586  };
587  Q_DECLARE_FLAGS( ReadFlags, ReadFlag )
588 
589 
606  bool readLayerXml( const QDomElement &layerElement, QgsReadWriteContext &context, QgsMapLayer::ReadFlags flags = QgsMapLayer::ReadFlags() );
607 
625  bool writeLayerXml( QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
626 
631  virtual void resolveReferences( QgsProject *project );
632 
638  Q_INVOKABLE QStringList customPropertyKeys() const;
639 
645  Q_INVOKABLE void setCustomProperty( const QString &key, const QVariant &value );
646 
651  Q_INVOKABLE QVariant customProperty( const QString &value, const QVariant &defaultValue = QVariant() ) const;
652 
657  void setCustomProperties( const QgsObjectCustomProperties &properties );
658 
664  const QgsObjectCustomProperties &customProperties() const;
665 
670  void removeCustomProperty( const QString &key );
671 
677  virtual QgsError error() const;
678 
684 
686  void setCrs( const QgsCoordinateReferenceSystem &srs, bool emitSignal = true );
687 
693  QgsCoordinateTransformContext transformContext( ) const;
694 
695 
701  static QString formatLayerName( const QString &name );
702 
710  virtual QString metadataUri() const;
711 
718  void exportNamedMetadata( QDomDocument &doc, QString &errorMsg ) const;
719 
729  virtual QString saveDefaultMetadata( bool &resultFlag SIP_OUT );
730 
745  QString saveNamedMetadata( const QString &uri, bool &resultFlag );
746 
761  virtual QString loadNamedMetadata( const QString &uri, bool &resultFlag SIP_OUT );
762 
772  virtual QString loadDefaultMetadata( bool &resultFlag );
773 
782  bool loadNamedMetadataFromDatabase( const QString &db, const QString &uri, QString &qmd );
783 
791  bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
792 
800  virtual QString styleURI() const;
801 
811  virtual QString loadDefaultStyle( bool &resultFlag SIP_OUT );
812 
828  virtual QString loadNamedStyle( const QString &uri, bool &resultFlag SIP_OUT, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
829 
837  virtual bool loadNamedStyleFromDatabase( const QString &db, const QString &uri, QString &qml SIP_OUT );
838 
848  virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT,
849  QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
850 
859  virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT, const QgsReadWriteContext &context = QgsReadWriteContext(),
860  QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
861 
862 
869  virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;
870 
880  virtual QString saveDefaultStyle( bool &resultFlag SIP_OUT );
881 
897  virtual QString saveNamedStyle( const QString &uri, bool &resultFlag SIP_OUT, StyleCategories categories = AllStyleCategories );
898 
907  virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;
908 
917  virtual QString loadSldStyle( const QString &uri, bool &resultFlag );
918 
919  virtual bool readSld( const QDomNode &node, QString &errorMessage )
920  { Q_UNUSED( node ) errorMessage = QStringLiteral( "Layer type %1 not supported" ).arg( static_cast<int>( type() ) ); return false; }
921 
922 
923 
932  virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
933  QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) = 0;
934 
945  virtual bool readStyle( const QDomNode &node, QString &errorMessage,
946  QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories );
947 
958  virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
959  StyleCategories categories = AllStyleCategories ) const = 0;
960 
973  virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
974  StyleCategories categories = AllStyleCategories ) const;
975 
976 
992  virtual void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false );
993 
997  QString providerType() const;
998 
1000  QUndoStack *undoStack();
1001 
1006  QUndoStack *undoStackStyles();
1007 
1011  void setLegendUrl( const QString &legendUrl ) { mLegendUrl = legendUrl; }
1012 
1016  QString legendUrl() const { return mLegendUrl; }
1017 
1021  void setLegendUrlFormat( const QString &legendUrlFormat ) { mLegendUrlFormat = legendUrlFormat; }
1022 
1026  QString legendUrlFormat() const { return mLegendUrlFormat; }
1027 
1033  void setLegend( QgsMapLayerLegend *legend SIP_TRANSFER );
1034 
1039  QgsMapLayerLegend *legend() const;
1040 
1045  QgsMapLayerStyleManager *styleManager() const;
1046 
1051  void setRenderer3D( QgsAbstract3DRenderer *renderer SIP_TRANSFER );
1052 
1057  QgsAbstract3DRenderer *renderer3D() const;
1058 
1068  bool isInScaleRange( double scale ) const;
1069 
1080  double minimumScale() const;
1081 
1092  double maximumScale() const;
1093 
1102  bool hasScaleBasedVisibility() const;
1103 
1110  bool hasAutoRefreshEnabled() const;
1111 
1119  int autoRefreshInterval() const;
1120 
1132  void setAutoRefreshInterval( int interval );
1133 
1140  void setAutoRefreshEnabled( bool enabled );
1141 
1148  virtual const QgsLayerMetadata &metadata() const;
1149 
1156  virtual void setMetadata( const QgsLayerMetadata &metadata );
1157 
1162  virtual QString htmlMetadata() const;
1163 
1165  virtual QDateTime timestamp() const;
1166 
1174  virtual QSet<QgsMapLayerDependency> dependencies() const;
1175 
1181  QString refreshOnNotifyMessage() const { return mRefreshOnNofifyMessage; }
1182 
1188  bool isRefreshOnNotifyEnabled() const { return mIsRefreshOnNofifyEnabled; }
1189 
1198  QString originalXmlProperties() const;
1199 
1207  void setOriginalXmlProperties( const QString &originalXmlProperties );
1208 
1213  static QString generateId( const QString &layerName );
1214 
1224  virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
1225 
1231  virtual QgsMapLayerTemporalProperties *temporalProperties() { return nullptr; }
1232 
1239 
1240  public slots:
1241 
1251  void setMinimumScale( double scale );
1252 
1262  void setMaximumScale( double scale );
1263 
1271  void setScaleBasedVisibility( bool enabled );
1272 
1281  void triggerRepaint( bool deferredUpdate = false );
1282 
1289  void trigger3DUpdate();
1290 
1295  void emitStyleChanged();
1296 
1305  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers );
1306 
1312  void setRefreshOnNotifyEnabled( bool enabled );
1313 
1321  void setRefreshOnNofifyMessage( const QString &message ) { mRefreshOnNofifyMessage = message; }
1322 
1328  virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) = 0;
1329 
1330 #ifdef SIP_RUN
1331  SIP_PYOBJECT __repr__();
1332  % MethodCode
1333  QString str = QStringLiteral( "<QgsMapLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
1334  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
1335  % End
1336 #endif
1337 
1344  QgsProject *project() const;
1345 
1346  signals:
1347 
1355 
1357  void statusChanged( const QString &status );
1358 
1364  void nameChanged();
1365 
1367  void crsChanged();
1368 
1375  void repaintRequested( bool deferredUpdate = false );
1376 
1378  void recalculateExtents() const;
1379 
1381  void dataChanged();
1382 
1384  void blendModeChanged( QPainter::CompositionMode blendMode );
1385 
1394  void opacityChanged( double opacity );
1395 
1401 
1410 
1416 
1422 
1429 
1435 
1440 
1448 
1454  void autoRefreshIntervalChanged( int interval );
1455 
1463 
1471 
1480 
1486  void styleLoaded( QgsMapLayer::StyleCategories categories );
1487 
1494 
1500  void customPropertyChanged( const QString &key );
1501 
1502  private slots:
1503 
1504  void onNotified( const QString &message );
1505 
1506  protected:
1507 
1513  void clone( QgsMapLayer *layer ) const;
1514 
1516  virtual void setExtent( const QgsRectangle &rect );
1517 
1519  void setValid( bool valid );
1520 
1525  virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );
1526 
1531  virtual bool writeXml( QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context ) const;
1532 
1544  virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;
1545 
1558  virtual QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const;
1559 
1565  void readCustomProperties( const QDomNode &layerNode, const QString &keyStartsWith = QString() );
1566 
1568  void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc ) const;
1569 
1571  void readStyleManager( const QDomNode &layerNode );
1573  void writeStyleManager( QDomNode &layerNode, QDomDocument &doc ) const;
1574 
1579  void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
1580  const QgsReadWriteContext &context,
1581  StyleCategories categories = AllStyleCategories ) const;
1582 
1587  void readCommonStyle( const QDomElement &layerElement, const QgsReadWriteContext &context,
1588  StyleCategories categories = AllStyleCategories );
1589 
1591  void setProviderType( const QString &providerType );
1592 
1593 #ifndef SIP_RUN
1594 #if 0
1596  void connectNotify( const char *signal ) override;
1597 #endif
1598 #endif
1599 
1601  void appendError( const QgsErrorMessage &error ) { mError.append( error );}
1603  void setError( const QgsError &error ) { mError = error;}
1604 
1607 
1609  bool mValid = false;
1610 
1612  QString mDataSource;
1613 
1615  QString mLayerName;
1616 
1617  QString mShortName;
1618  QString mTitle;
1619 
1621  QString mAbstract;
1622  QString mKeywordList;
1623 
1625  QString mDataUrl;
1627 
1629  QString mAttribution;
1631 
1633  QString mMetadataUrl;
1636 
1638  QString mLegendUrl;
1640 
1643 
1645  QSet<QgsMapLayerDependency> mDependencies;
1646 
1652  Q_DECL_DEPRECATED bool hasDependencyCycle( const QSet<QgsMapLayerDependency> & ) const {return false;}
1653 
1654  bool mIsRefreshOnNofifyEnabled = false;
1656 
1658  QString mProviderKey;
1659 
1660  //TODO QGIS 4 - move to readXml as a new argument (breaks API)
1661 
1663  QgsMapLayer::ReadFlags mReadFlags = QgsMapLayer::ReadFlags();
1664 
1670  bool mShouldValidateCrs = true;
1671 
1677  double mLayerOpacity = 1.0;
1678 
1679  private:
1680 
1681  virtual QString baseURI( PropertyType type ) const;
1682  QString saveNamedProperty( const QString &uri, QgsMapLayer::PropertyType type,
1683  bool &resultFlag, StyleCategories categories = AllStyleCategories );
1684  QString loadNamedProperty( const QString &uri, QgsMapLayer::PropertyType type,
1685  bool &resultFlag, StyleCategories categories = AllStyleCategories );
1686  bool loadNamedPropertyFromDatabase( const QString &db, const QString &uri, QString &xml, QgsMapLayer::PropertyType type );
1687 
1692  virtual bool isReadOnly() const;
1693 
1699 
1701  QString mID;
1702 
1704  QgsMapLayerType mLayerType;
1705 
1706  LayerFlags mFlags = LayerFlags( Identifiable | Removable | Searchable );
1707 
1709  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1710 
1712  QString mTag;
1713 
1714  //set some generous defaults for scale based visibility
1715 
1717  double mMinScale = 0;
1719  double mMaxScale = 100000000;
1721  bool mScaleBasedVisibility = false;
1722 
1724  QUndoStack *mUndoStack = nullptr;
1725 
1726  QUndoStack *mUndoStackStyles = nullptr;
1727 
1729  QgsObjectCustomProperties mCustomProperties;
1730 
1732  QgsMapLayerLegend *mLegend = nullptr;
1733 
1735  QgsMapLayerStyleManager *mStyleManager = nullptr;
1736 
1738  QTimer *mRefreshTimer = nullptr;
1739 
1740  QgsLayerMetadata mMetadata;
1741 
1743  QgsAbstract3DRenderer *m3DRenderer = nullptr;
1744 
1750  QString mOriginalXmlProperties;
1751 
1753  bool mRepaintRequestedFired = false;
1754 };
1755 
1757 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayer::LayerFlags )
1758 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayer::StyleCategories )
1759 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayer::ReadFlags )
1760 
1761 
1762 #ifndef SIP_RUN
1763 
1769 typedef QPointer< QgsMapLayer > QgsWeakMapLayerPointer;
1770 
1776 typedef QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList;
1777 #endif
1778 
1779 #endif
Base class for all renderers that may to participate in 3D view.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Abstract base class for spatial data provider implementations.
QgsErrorMessage represents single error message.
Definition: qgserror.h:33
QgsError is container for error messages (report).
Definition: qgserror.h:81
A structured metadata store for a map layer.
Base class for storage of map layer elevation properties.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Management of styles for use with one map layer.
Base class for storage of map layer temporal properties.
Base class for all map layer types.
Definition: qgsmaplayer.h:85
QString mKeywordList
Definition: qgsmaplayer.h:1622
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 docment provided.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
Definition: qgsmaplayer.h:1026
void dependenciesChanged()
Emitted when dependencies are changed.
void setError(const QgsError &error)
Sets error message.
Definition: qgsmaplayer.h:1603
void legendChanged()
Signal emitted when legend of the layer has changed.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:309
void recalculateExtents() const
This is used to send a request that any mapcanvas using this layer update its extents.
void metadataChanged()
Emitted when the layer's metadata is changed.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
Definition: qgsmaplayer.h:1011
void request3DUpdate()
Signal emitted when a layer requires an update in any 3D maps.
QgsError mError
Error.
Definition: qgsmaplayer.h:1642
void configChanged()
Emitted whenever the configuration is changed.
void autoRefreshIntervalChanged(int interval)
Emitted when the auto refresh interval changes.
Q_DECL_DEPRECATED bool hasDependencyCycle(const QSet< QgsMapLayerDependency > &) const
Checks whether a new set of dependencies will introduce a cycle this method is now deprecated and alw...
Definition: qgsmaplayer.h:1652
void isValidChanged()
Emitted when the validity of this layer changed.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:391
QString mRefreshOnNofifyMessage
Definition: qgsmaplayer.h:1655
QString mLegendUrl
WMS legend.
Definition: qgsmaplayer.h:1638
QgsRectangle mExtent
Extent of the layer.
Definition: qgsmaplayer.h:1606
QString mLayerName
Name of the layer - used for display.
Definition: qgsmaplayer.h:1615
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:400
void renderer3DChanged()
Signal emitted when 3D renderer associated with the layer has changed.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:371
void statusChanged(const QString &status)
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
QString mTitle
Definition: qgsmaplayer.h:1618
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:344
QgsMapLayer(QgsMapLayer const &)=delete
QgsMapLayer cannot be copied.
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:325
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:382
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
Definition: qgsmaplayer.h:1188
QSet< QgsMapLayerDependency > mDependencies
List of layers that may modify this layer on modification.
Definition: qgsmaplayer.h:1645
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:362
QString mLegendUrlFormat
Definition: qgsmaplayer.h:1639
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)=0
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context.
QString mProviderKey
Data provider key (name of the data provider)
Definition: qgsmaplayer.h:1658
QString mMetadataUrlType
Definition: qgsmaplayer.h:1634
void styleChanged()
Signal emitted whenever a change affects the layer's style.
void rendererChanged()
Signal emitted when renderer is changed.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:301
void crsChanged()
Emit a signal that layer's CRS has been reset.
QString mAttributionUrl
Definition: qgsmaplayer.h:1630
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.
Definition: qgsmaplayer.h:353
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:465
void setRefreshOnNofifyMessage(const QString &message)
Set the notification message that triggers repaint If refresh on notification is enabled,...
Definition: qgsmaplayer.h:1321
void opacityChanged(double opacity)
Emitted when the layer's opacity is changed, where opacity is a value between 0 (transparent) and 1 (...
void styleLoaded(QgsMapLayer::StyleCategories categories)
Emitted when a style has been loaded.
QString mShortName
Definition: qgsmaplayer.h:1617
void dataChanged()
Data of layer changed.
QString mMetadataUrlFormat
Definition: qgsmaplayer.h:1635
void willBeDeleted()
Emitted in the destructor when the layer is about to be deleted, but it is still in a perfectly valid...
void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:456
void blendModeChanged(QPainter::CompositionMode blendMode)
Signal emitted when the blend mode is changed, through QgsMapLayer::setBlendMode()
bool readOnly() const
Returns if this layer is read only.
Definition: qgsmaplayer.h:501
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.
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:429
QString mMetadataUrl
MetadataUrl of the layer.
Definition: qgsmaplayer.h:1633
LayerFlag
Flags for the map layer.
Definition: qgsmaplayer.h:153
void appendError(const QgsErrorMessage &error)
Add error message.
Definition: qgsmaplayer.h:1601
QgsMapLayer & operator=(QgsMapLayer const &)=delete
QgsMapLayer cannot be copied.
QString mDataSource
Data source description string, varies by layer type.
Definition: qgsmaplayer.h:1612
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
Definition: qgsmaplayer.h:1181
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:919
ReadFlag
Flags which control project read behavior.
Definition: qgsmaplayer.h:583
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:409
QString mAbstract
Description of the layer.
Definition: qgsmaplayer.h:1621
void customPropertyChanged(const QString &key)
Emitted when a custom property of the layer has been changed or removed.
QString legendUrl() const
Returns the URL for the layer's legend.
Definition: qgsmaplayer.h:1016
QString mDataUrlFormat
Definition: qgsmaplayer.h:1626
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.
Definition: qgsmaplayer.h:1021
void beforeResolveReferences(QgsProject *project)
Emitted when all layers are loaded and references can be resolved, just before the references of this...
void setMetadataUrl(const QString &metaUrl)
Sets the metadata URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:420
void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
Definition: qgsmaplayer.h:438
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)=0
Sets the coordinate transform context to transformContext.
virtual QgsMapLayerElevationProperties * elevationProperties()
Returns the layer's elevation properties.
Definition: qgsmaplayer.h:1238
void nameChanged()
Emitted when the name has been changed.
QString mDataUrl
DataUrl of the layer.
Definition: qgsmaplayer.h:1625
StyleCategory
Categories of style to distinguish appropriate sections for import/export.
Definition: qgsmaplayer.h:168
@ AllStyleCategories
Definition: qgsmaplayer.h:186
virtual Q_INVOKABLE void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:506
virtual QgsMapLayerTemporalProperties * temporalProperties()
Returns the layer's temporal properties.
Definition: qgsmaplayer.h:1231
QString mAttribution
Attribution of the layer.
Definition: qgsmaplayer.h:1629
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:447
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:333
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:293
PropertyType
Maplayer has a style and a metadata property.
Definition: qgsmaplayer.h:142
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:99
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgsmaplayer.h:69
@ PointCloudLayer
Added in 3.18.
@ MeshLayer
Added in 3.2.
@ VectorTileLayer
Added in 3.14.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition: qgis_sip.h:257
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_OUT
Definition: qgis_sip.h:58
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:194
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
Definition: qgsmaplayer.h:1769
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.
Definition: qgsmaplayer.h:1776
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.