21 #include "qgis_core.h" 54 #define QGSCLIPBOARD_MAPLAYER_MIME "application/qgis.maplayer" 65 Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
66 Q_PROPERTY(
int autoRefreshInterval READ autoRefreshInterval WRITE setAutoRefreshInterval NOTIFY autoRefreshIntervalChanged )
67 Q_PROPERTY(
QgsLayerMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
77 switch ( layer->type() )
80 sipType = sipType_QgsVectorLayer;
83 sipType = sipType_QgsRasterLayer;
86 sipType = sipType_QgsPluginLayer;
89 sipType = sipType_QgsMeshLayer;
153 static QString extensionPropertyType(
PropertyType type );
163 void setName(
const QString &name );
169 QString name()
const;
188 void setShortName( const QString &shortName ) { mShortName = shortName; }
202 void setTitle(
const QString &title ) { mTitle = title; }
210 QString
title()
const {
return mTitle; }
218 void setAbstract(
const QString &
abstract ) { mAbstract =
abstract; }
226 QString
abstract()
const {
return mAbstract; }
253 void setDataUrl(
const QString &dataUrl ) { mDataUrl = dataUrl; }
381 void setBlendMode( QPainter::CompositionMode blendMode );
387 QPainter::CompositionMode blendMode()
const;
411 bool isValid()
const;
419 QString publicSource()
const;
426 QString source()
const;
432 virtual QStringList subLayers()
const;
438 virtual void setLayerOrder(
const QStringList &layers );
445 virtual void setSubLayerVisibility(
const QString &name,
bool visible );
448 virtual bool isEditable()
const;
454 virtual bool isSpatial()
const;
491 bool writeLayerXml( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
497 virtual void resolveReferences(
QgsProject *project );
504 QStringList customPropertyKeys()
const;
511 void setCustomProperty(
const QString &key,
const QVariant &value );
517 QVariant customProperty(
const QString &value,
const QVariant &defaultValue = QVariant() )
const;
529 void removeCustomProperty(
const QString &key );
552 static QString formatLayerName(
const QString &name );
561 virtual QString metadataUri()
const;
569 void exportNamedMetadata( QDomDocument &doc, QString &errorMsg )
const;
580 virtual QString saveDefaultMetadata(
bool &resultFlag
SIP_OUT );
596 QString saveNamedMetadata(
const QString &uri,
bool &resultFlag );
612 virtual QString loadNamedMetadata(
const QString &uri,
bool &resultFlag SIP_OUT );
623 QString loadDefaultMetadata(
bool &resultFlag );
633 bool loadNamedMetadataFromDatabase(
const QString &db,
const QString &uri, QString &qmd );
642 bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
651 virtual QString styleURI()
const;
662 virtual QString loadDefaultStyle(
bool &resultFlag SIP_OUT );
678 virtual QString loadNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT );
687 virtual bool loadNamedStyleFromDatabase(
const QString &db,
const QString &uri, QString &qml SIP_OUT );
697 virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT );
705 virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg )
const;
714 virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg )
const;
725 virtual QString saveDefaultStyle(
bool &resultFlag SIP_OUT );
741 virtual QString saveNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT );
751 virtual QString saveSldStyle(
const QString &uri,
bool &resultFlag )
const;
761 virtual QString loadSldStyle(
const QString &uri,
bool &resultFlag );
763 virtual bool readSld(
const QDomNode &node, QString &errorMessage )
764 { Q_UNUSED( node ); errorMessage = QStringLiteral(
"Layer type %1 not supported" ).arg( type() );
return false; }
775 virtual bool readSymbology(
const QDomNode &node, QString &errorMessage,
QgsReadWriteContext &context ) = 0;
786 virtual bool readStyle(
const QDomNode &node, QString &errorMessage,
QgsReadWriteContext &context );
796 virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context )
const = 0;
808 virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context )
const;
811 QUndoStack *undoStack();
817 QUndoStack *undoStackStyles();
822 void setLegendUrl(
const QString &legendUrl ) { mLegendUrl = legendUrl; }
879 bool isInScaleRange(
double scale )
const;
891 double minimumScale()
const;
903 double maximumScale()
const;
913 bool hasScaleBasedVisibility()
const;
921 bool hasAutoRefreshEnabled()
const;
930 int autoRefreshInterval()
const;
943 void setAutoRefreshInterval(
int interval );
951 void setAutoRefreshEnabled(
bool enabled );
973 virtual QString htmlMetadata()
const;
976 virtual QDateTime timestamp()
const;
985 virtual QSet<QgsMapLayerDependency> dependencies()
const;
1012 void setMinimumScale(
double scale );
1023 void setMaximumScale(
double scale );
1032 void setScaleBasedVisibility(
bool enabled );
1042 void triggerRepaint(
bool deferredUpdate =
false );
1048 void emitStyleChanged();
1058 virtual bool setDependencies(
const QSet<QgsMapLayerDependency> &layers );
1065 void setRefreshOnNotifyEnabled(
bool enabled );
1079 void statusChanged(
const QString &status );
1097 void repaintRequested(
bool deferredUpdate =
false );
1100 void recalculateExtents()
const;
1106 void blendModeChanged( QPainter::CompositionMode blendMode );
1112 void rendererChanged();
1121 void styleChanged();
1127 void legendChanged();
1133 void renderer3DChanged();
1139 void configChanged();
1144 void dependenciesChanged();
1152 void willBeDeleted();
1159 void autoRefreshIntervalChanged(
int interval );
1167 void metadataChanged();
1171 void onNotifiedTriggerRepaint(
const QString &message );
1186 void setValid(
bool valid );
1198 virtual bool writeXml( QDomNode &layer_node, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1211 virtual QString encodedSource(
const QString &source,
const QgsReadWriteContext &context )
const;
1225 virtual QString decodedSource(
const QString &source,
const QString &dataProvider,
const QgsReadWriteContext &context )
const;
1231 void readCustomProperties(
const QDomNode &layerNode,
const QString &keyStartsWith = QString() );
1234 void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc )
const;
1237 void readStyleManager(
const QDomNode &layerNode );
1239 void writeStyleManager( QDomNode &layerNode, QDomDocument &doc )
const;
1245 void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1251 void readCommonStyle(
const QDomElement &layerElement,
const QgsReadWriteContext &context );
1255 void connectNotify(
const char *signal )
override;
1269 bool mValid =
false;
1308 bool hasDependencyCycle(
const QSet<QgsMapLayerDependency> &layers )
const;
1310 bool mIsRefreshOnNofifyEnabled =
false;
1318 bool loadNamedPropertyFromDatabase(
const QString &db,
const QString &uri, QString &xml,
QgsMapLayer::PropertyType type );
1324 virtual bool isReadOnly()
const;
1338 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1346 double mMinScale = 0;
1348 double mMaxScale = 100000000;
1350 bool mScaleBasedVisibility =
false;
1353 QUndoStack *mUndoStack =
nullptr;
1355 QUndoStack *mUndoStackStyles =
nullptr;
1367 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)
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.