21 #include "qgis_core.h" 60 Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
61 Q_PROPERTY(
int autoRefreshInterval READ autoRefreshInterval WRITE setAutoRefreshInterval NOTIFY autoRefreshIntervalChanged )
62 Q_PROPERTY(
QgsLayerMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
72 switch ( layer->type() )
75 sipType = sipType_QgsVectorLayer;
78 sipType = sipType_QgsRasterLayer;
81 sipType = sipType_QgsPluginLayer;
144 static QString extensionPropertyType(
PropertyType type );
154 void setName(
const QString &name );
160 QString name()
const;
179 void setShortName( const QString &shortName ) { mShortName = shortName; }
193 void setTitle(
const QString &title ) { mTitle = title; }
201 QString
title()
const {
return mTitle; }
209 void setAbstract(
const QString &
abstract ) { mAbstract =
abstract; }
217 QString
abstract()
const {
return mAbstract; }
244 void setDataUrl(
const QString &dataUrl ) { mDataUrl = dataUrl; }
372 void setBlendMode( QPainter::CompositionMode blendMode );
378 QPainter::CompositionMode blendMode()
const;
402 bool isValid()
const;
410 QString publicSource()
const;
417 QString source()
const;
423 virtual QStringList subLayers()
const;
429 virtual void setLayerOrder(
const QStringList &layers );
436 virtual void setSubLayerVisibility(
const QString &name,
bool visible );
439 virtual bool isEditable()
const;
445 virtual bool isSpatial()
const;
482 bool writeLayerXml( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
488 virtual void resolveReferences(
QgsProject *project );
495 QStringList customPropertyKeys()
const;
502 void setCustomProperty(
const QString &key,
const QVariant &value );
508 QVariant customProperty(
const QString &value,
const QVariant &defaultValue = QVariant() )
const;
520 void removeCustomProperty(
const QString &key );
543 static QString formatLayerName(
const QString &name );
552 virtual QString metadataUri()
const;
560 void exportNamedMetadata( QDomDocument &doc, QString &errorMsg )
const;
571 virtual QString saveDefaultMetadata(
bool &resultFlag
SIP_OUT );
587 QString saveNamedMetadata(
const QString &uri,
bool &resultFlag );
603 virtual QString loadNamedMetadata(
const QString &uri,
bool &resultFlag SIP_OUT );
614 QString loadDefaultMetadata(
bool &resultFlag );
624 bool loadNamedMetadataFromDatabase(
const QString &db,
const QString &uri, QString &qmd );
633 bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
642 virtual QString styleURI()
const;
653 virtual QString loadDefaultStyle(
bool &resultFlag SIP_OUT );
669 virtual QString loadNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT );
678 virtual bool loadNamedStyleFromDatabase(
const QString &db,
const QString &uri, QString &qml SIP_OUT );
688 virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT );
696 virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg )
const;
705 virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg )
const;
716 virtual QString saveDefaultStyle(
bool &resultFlag SIP_OUT );
732 virtual QString saveNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT );
742 virtual QString saveSldStyle(
const QString &uri,
bool &resultFlag )
const;
752 virtual QString loadSldStyle(
const QString &uri,
bool &resultFlag );
754 virtual bool readSld(
const QDomNode &node, QString &errorMessage )
755 { Q_UNUSED( node ); errorMessage = QStringLiteral(
"Layer type %1 not supported" ).arg( type() );
return false; }
766 virtual bool readSymbology(
const QDomNode &node, QString &errorMessage,
const QgsReadWriteContext &context ) = 0;
777 virtual bool readStyle(
const QDomNode &node, QString &errorMessage,
const QgsReadWriteContext &context );
787 virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context )
const = 0;
799 virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context )
const;
802 QUndoStack *undoStack();
808 QUndoStack *undoStackStyles();
813 void setLegendUrl(
const QString &legendUrl ) { mLegendUrl = legendUrl; }
870 bool isInScaleRange(
double scale )
const;
882 double minimumScale()
const;
894 double maximumScale()
const;
904 bool hasScaleBasedVisibility()
const;
912 bool hasAutoRefreshEnabled()
const;
921 int autoRefreshInterval()
const;
934 void setAutoRefreshInterval(
int interval );
942 void setAutoRefreshEnabled(
bool enabled );
964 virtual QString htmlMetadata()
const;
967 virtual QDateTime timestamp()
const;
976 virtual QSet<QgsMapLayerDependency> dependencies()
const;
1003 void setMinimumScale(
double scale );
1014 void setMaximumScale(
double scale );
1023 void setScaleBasedVisibility(
const bool enabled );
1033 void triggerRepaint(
bool deferredUpdate =
false );
1039 void emitStyleChanged();
1049 virtual bool setDependencies(
const QSet<QgsMapLayerDependency> &layers );
1056 void setRefreshOnNotifyEnabled(
bool enabled );
1070 void statusChanged(
const QString &status );
1088 void repaintRequested(
bool deferredUpdate =
false );
1091 void recalculateExtents()
const;
1097 void blendModeChanged( QPainter::CompositionMode blendMode );
1103 void rendererChanged();
1112 void styleChanged();
1118 void legendChanged();
1124 void renderer3DChanged();
1130 void configChanged();
1135 void dependenciesChanged();
1143 void willBeDeleted();
1150 void autoRefreshIntervalChanged(
int interval );
1158 void metadataChanged();
1162 void onNotifiedTriggerRepaint(
const QString &message );
1177 void setValid(
bool valid );
1189 virtual bool writeXml( QDomNode &layer_node, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1195 void readCustomProperties(
const QDomNode &layerNode,
const QString &keyStartsWith = QString() );
1198 void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc )
const;
1201 void readStyleManager(
const QDomNode &layerNode );
1203 void writeStyleManager( QDomNode &layerNode, QDomDocument &doc )
const;
1209 void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1215 void readCommonStyle(
const QDomElement &layerElement,
const QgsReadWriteContext &context );
1219 void connectNotify(
const char *signal )
override;
1233 bool mValid =
false;
1272 bool hasDependencyCycle(
const QSet<QgsMapLayerDependency> &layers )
const;
1274 bool mIsRefreshOnNofifyEnabled =
false;
1282 bool loadNamedPropertyFromDatabase(
const QString &db,
const QString &uri, QString &xml,
QgsMapLayer::PropertyType type );
1288 virtual bool isReadOnly()
const;
1302 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1310 double mMinScale = 0;
1312 double mMaxScale = 100000000;
1314 bool mScaleBasedVisibility =
false;
1317 QUndoStack *mUndoStack =
nullptr;
1319 QUndoStack *mUndoStackStyles =
nullptr;
1331 QTimer *mRefreshTimer =
nullptr;
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.
PropertyType
Maplayer has a style and a metadata property.
virtual void reload()
Synchronises with changes in the datasource.
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.
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
Q_DECLARE_METATYPE(QModelIndex)
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.
LayerType
Types of layers that can be added to a map.
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...
QString legendUrl() const
Returns the URL for the layer's legend.
Reads and writes project states.
QgsErrorMessage represents single error message.
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.
QString mAttribution
Attribution of the layer.
QString mAbstract
Description of the layer.
QString mRefreshOnNofifyMessage
Contains information about the context of a rendering operation.
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.
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 repaine 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)
Set 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.