21 #include "qgis_core.h" 57 #define QGSCLIPBOARD_MAPLAYER_MIME "application/qgis.maplayer" 82 Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
83 Q_PROPERTY(
int autoRefreshInterval READ autoRefreshInterval WRITE setAutoRefreshInterval NOTIFY autoRefreshIntervalChanged )
84 Q_PROPERTY(
QgsLayerMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
95 switch ( layer->type() )
98 sipType = sipType_QgsVectorLayer;
101 sipType = sipType_QgsRasterLayer;
104 sipType = sipType_QgsPluginLayer;
107 sipType = sipType_QgsMeshLayer;
136 Identifiable = 1 << 0,
150 LayerConfiguration = 1 << 0,
152 Symbology3D = 1 << 2,
159 AttributeTable = 1 << 9,
161 CustomProperties = 1 << 11,
162 GeometryOptions = 1 << 12,
163 AllStyleCategories = LayerConfiguration | Symbology | Symbology3D | Labeling | Fields | Forms | Actions |
164 MapTips | Diagrams | AttributeTable | Rendering | CustomProperties | GeometryOptions,
168 Q_FLAG( StyleCategories )
205 QgsMapLayer::LayerFlags flags()
const;
214 void setFlags( QgsMapLayer::LayerFlags flags );
221 static QString extensionPropertyType(
PropertyType type );
231 void setName(
const QString &name );
237 QString name()
const;
256 void setShortName( const QString &shortName ) { mShortName = shortName; }
270 void setTitle(
const QString &title ) { mTitle = title; }
278 QString
title()
const {
return mTitle; }
286 void setAbstract(
const QString &
abstract ) { mAbstract =
abstract; }
294 QString
abstract()
const {
return mAbstract; }
321 void setDataUrl(
const QString &dataUrl ) { mDataUrl = dataUrl; }
449 void setBlendMode( QPainter::CompositionMode blendMode );
455 QPainter::CompositionMode blendMode()
const;
479 bool isValid()
const;
487 QString publicSource()
const;
494 QString source()
const;
500 virtual QStringList subLayers()
const;
506 virtual void setLayerOrder(
const QStringList &layers );
513 virtual void setSubLayerVisibility(
const QString &name,
bool visible );
516 virtual bool isEditable()
const;
522 virtual bool isSpatial()
const;
559 bool writeLayerXml( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
565 virtual void resolveReferences(
QgsProject *project );
572 QStringList customPropertyKeys()
const;
579 void setCustomProperty(
const QString &key,
const QVariant &value );
585 QVariant customProperty(
const QString &value,
const QVariant &defaultValue = QVariant() )
const;
597 void removeCustomProperty(
const QString &key );
628 static QString formatLayerName(
const QString &name );
637 virtual QString metadataUri()
const;
645 void exportNamedMetadata( QDomDocument &doc, QString &errorMsg )
const;
656 virtual QString saveDefaultMetadata(
bool &resultFlag
SIP_OUT );
672 QString saveNamedMetadata(
const QString &uri,
bool &resultFlag );
688 virtual QString loadNamedMetadata(
const QString &uri,
bool &resultFlag SIP_OUT );
699 QString loadDefaultMetadata(
bool &resultFlag );
709 bool loadNamedMetadataFromDatabase(
const QString &db,
const QString &uri, QString &qmd );
718 bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
727 virtual QString styleURI()
const;
738 virtual QString loadDefaultStyle(
bool &resultFlag SIP_OUT );
755 virtual QString loadNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT, QgsMapLayer::StyleCategories categories =
QgsMapLayer::AllStyleCategories );
764 virtual bool loadNamedStyleFromDatabase(
const QString &db,
const QString &uri, QString &qml SIP_OUT );
775 virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT,
796 virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg )
const;
807 virtual QString saveDefaultStyle(
bool &resultFlag SIP_OUT );
824 virtual QString saveNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT, StyleCategories categories = AllStyleCategories );
834 virtual QString saveSldStyle(
const QString &uri,
bool &resultFlag )
const;
844 virtual QString loadSldStyle(
const QString &uri,
bool &resultFlag );
846 virtual bool readSld(
const QDomNode &node, QString &errorMessage )
847 { Q_UNUSED( node ) errorMessage = QStringLiteral(
"Layer type %1 not supported" ).arg( static_cast<int>( type() ) );
return false; }
859 virtual bool readSymbology(
const QDomNode &node, QString &errorMessage,
872 virtual bool readStyle(
const QDomNode &node, QString &errorMessage,
885 virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context,
886 StyleCategories categories = AllStyleCategories )
const = 0;
900 virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context,
901 StyleCategories categories = AllStyleCategories )
const;
919 virtual void setDataSource(
const QString &dataSource,
const QString &baseName,
const QString &provider,
const QgsDataProvider::ProviderOptions &options,
bool loadDefaultStyleFlag =
false );
924 QString providerType()
const;
927 QUndoStack *undoStack();
933 QUndoStack *undoStackStyles();
938 void setLegendUrl(
const QString &legendUrl ) { mLegendUrl = legendUrl; }
995 bool isInScaleRange(
double scale )
const;
1007 double minimumScale()
const;
1019 double maximumScale()
const;
1029 bool hasScaleBasedVisibility()
const;
1037 bool hasAutoRefreshEnabled()
const;
1046 int autoRefreshInterval()
const;
1059 void setAutoRefreshInterval(
int interval );
1067 void setAutoRefreshEnabled(
bool enabled );
1089 virtual QString htmlMetadata()
const;
1092 virtual QDateTime timestamp()
const;
1101 virtual QSet<QgsMapLayerDependency> dependencies()
const;
1125 QString originalXmlProperties()
const;
1134 void setOriginalXmlProperties(
const QString &originalXmlProperties );
1140 static QString generateId(
const QString &layerName );
1154 void setMinimumScale(
double scale );
1165 void setMaximumScale(
double scale );
1174 void setScaleBasedVisibility(
bool enabled );
1184 void triggerRepaint(
bool deferredUpdate =
false );
1190 void emitStyleChanged();
1200 virtual bool setDependencies(
const QSet<QgsMapLayerDependency> &layers );
1207 void setRefreshOnNotifyEnabled(
bool enabled );
1228 void statusChanged(
const QString &status );
1246 void repaintRequested(
bool deferredUpdate =
false );
1249 void recalculateExtents()
const;
1255 void blendModeChanged( QPainter::CompositionMode blendMode );
1261 void rendererChanged();
1270 void styleChanged();
1276 void legendChanged();
1282 void renderer3DChanged();
1288 void configChanged();
1293 void dependenciesChanged();
1301 void willBeDeleted();
1308 void autoRefreshIntervalChanged(
int interval );
1316 void metadataChanged();
1324 void flagsChanged();
1333 void dataSourceChanged();
1338 void onNotifiedTriggerRepaint(
const QString &message );
1353 void setValid(
bool valid );
1365 virtual bool writeXml( QDomNode &layer_node, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1378 virtual QString encodedSource(
const QString &source,
const QgsReadWriteContext &context )
const;
1392 virtual QString decodedSource(
const QString &source,
const QString &dataProvider,
const QgsReadWriteContext &context )
const;
1398 void readCustomProperties(
const QDomNode &layerNode,
const QString &keyStartsWith = QString() );
1401 void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc )
const;
1404 void readStyleManager(
const QDomNode &layerNode );
1406 void writeStyleManager( QDomNode &layerNode, QDomDocument &doc )
const;
1412 void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
1414 StyleCategories categories = AllStyleCategories )
const;
1420 void readCommonStyle(
const QDomElement &layerElement,
const QgsReadWriteContext &context,
1421 StyleCategories categories = AllStyleCategories );
1424 void setProviderType(
const QString &providerType );
1428 void connectNotify(
const char *signal )
override;
1442 bool mValid =
false;
1481 bool hasDependencyCycle(
const QSet<QgsMapLayerDependency> &layers )
const;
1483 bool mIsRefreshOnNofifyEnabled =
false;
1494 bool &resultFlag, StyleCategories categories = AllStyleCategories );
1496 bool &resultFlag, StyleCategories categories = AllStyleCategories );
1497 bool loadNamedPropertyFromDatabase(
const QString &db,
const QString &uri, QString &xml,
QgsMapLayer::PropertyType type );
1503 virtual bool isReadOnly()
const;
1516 LayerFlags mFlags = LayerFlags( Identifiable | Removable | Searchable );
1519 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1527 double mMinScale = 0;
1529 double mMaxScale = 100000000;
1531 bool mScaleBasedVisibility =
false;
1534 QUndoStack *mUndoStack =
nullptr;
1536 QUndoStack *mUndoStackStyles =
nullptr;
1548 QTimer *mRefreshTimer =
nullptr;
1560 QString mOriginalXmlProperties;
1565 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayer::LayerFlags )
1566 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayer::StyleCategories )
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
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.
Base class for all renderers that may to participate in 3D view.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QString mProviderKey
Data provider key (name of the data provider)
PropertyType
Maplayer has a style and a metadata property.
virtual void reload()
Synchronises with changes in the datasource.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
void setMetadataUrlType(const QString &metaUrlType)
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType ind...
Abstract base class for spatial data provider implementations.
const QgsCoordinateReferenceSystem & crs
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
QString mLayerName
Name of the layer - used for display.
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
QgsRectangle mExtent
Extent of the layer.
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 setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
QSet< QgsMapLayerDependency > mDependencies
List of layers that may modify this layer on modification.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
QString mDataUrl
DataUrl of the layer.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer...
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QString legendUrl() const
Returns the URL for the layer's legend.
Reads and writes project states.
QgsErrorMessage represents single error message.
Contains information about the context in which a coordinate transform is executed.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
QString mMetadataUrlFormat
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
void setMetadataUrlFormat(const QString &metaUrlFormat)
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
LayerFlag
Flags for the map layer.
StyleCategory
Categories of style to distinguish appropriate sections for import/export.
QString mAttribution
Attribution of the layer.
QString mAbstract
Description of the layer.
QString mRefreshOnNofifyMessage
Contains information about the context of a rendering operation.
Setting options for creating vector data providers.
QString mDataSource
Data source description string, varies by layer type.
QgsError is container for error messages (report).
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.
QString mLegendUrl
WMS legend.
This class represents a coordinate reference system (CRS).
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
void appendError(const QgsErrorMessage &error)
Add error message.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
bool readOnly() const
Returns if this layer is read only.
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
QgsMapLayerType
Types of layers that can be added to a map.
void setAttribution(const QString &attrib)
Sets the attribution 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, the notification will triggerRepaint only if the notification message is equal to.
Management of styles for use with one map layer.
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void setError(const QgsError &error)
Sets error message.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
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.