21 #include "qgis_core.h" 56 #define QGSCLIPBOARD_MAPLAYER_MIME "application/qgis.maplayer" 67 Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
68 Q_PROPERTY(
int autoRefreshInterval READ autoRefreshInterval WRITE setAutoRefreshInterval NOTIFY autoRefreshIntervalChanged )
69 Q_PROPERTY(
QgsLayerMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
80 switch ( layer->type() )
83 sipType = sipType_QgsVectorLayer;
86 sipType = sipType_QgsRasterLayer;
89 sipType = sipType_QgsPluginLayer;
92 sipType = sipType_QgsMeshLayer;
130 Identifiable = 1 << 0,
144 LayerConfiguration = 1 << 0,
146 Symbology3D = 1 << 2,
153 AttributeTable = 1 << 9,
155 CustomProperties = 1 << 11,
156 GeometryOptions = 1 << 12,
157 AllStyleCategories = LayerConfiguration | Symbology | Symbology3D | Labeling | Fields | Forms | Actions |
158 MapTips | Diagrams | AttributeTable | Rendering | CustomProperties | GeometryOptions,
162 Q_FLAG( StyleCategories )
215 static QString extensionPropertyType(
PropertyType type );
225 void setName( const QString &name );
231 QString name() const;
250 void setShortName( const QString &shortName ) { mShortName = shortName; }
264 void setTitle(
const QString &title ) { mTitle = title; }
272 QString
title()
const {
return mTitle; }
280 void setAbstract(
const QString &
abstract ) { mAbstract =
abstract; }
288 QString
abstract()
const {
return mAbstract; }
315 void setDataUrl(
const QString &dataUrl ) { mDataUrl = dataUrl; }
443 void setBlendMode( QPainter::CompositionMode blendMode );
449 QPainter::CompositionMode blendMode()
const;
473 bool isValid()
const;
481 QString publicSource()
const;
488 QString source()
const;
494 virtual QStringList subLayers()
const;
500 virtual void setLayerOrder(
const QStringList &layers );
507 virtual void setSubLayerVisibility(
const QString &name,
bool visible );
510 virtual bool isEditable()
const;
516 virtual bool isSpatial()
const;
553 bool writeLayerXml( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
559 virtual void resolveReferences(
QgsProject *project );
566 QStringList customPropertyKeys()
const;
573 void setCustomProperty(
const QString &key,
const QVariant &value );
579 QVariant customProperty(
const QString &value,
const QVariant &defaultValue = QVariant() )
const;
591 void removeCustomProperty(
const QString &key );
614 static QString formatLayerName(
const QString &name );
623 virtual QString metadataUri()
const;
631 void exportNamedMetadata( QDomDocument &doc, QString &errorMsg )
const;
642 virtual QString saveDefaultMetadata(
bool &resultFlag
SIP_OUT );
658 QString saveNamedMetadata(
const QString &uri,
bool &resultFlag );
674 virtual QString loadNamedMetadata(
const QString &uri,
bool &resultFlag SIP_OUT );
685 QString loadDefaultMetadata(
bool &resultFlag );
695 bool loadNamedMetadataFromDatabase(
const QString &db,
const QString &uri, QString &qmd );
704 bool importNamedMetadata( QDomDocument &document, QString &errorMessage );
713 virtual QString styleURI()
const;
724 virtual QString loadDefaultStyle(
bool &resultFlag SIP_OUT );
741 virtual QString loadNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT, QgsMapLayer::StyleCategories categories =
QgsMapLayer::AllStyleCategories );
750 virtual bool loadNamedStyleFromDatabase(
const QString &db,
const QString &uri, QString &qml SIP_OUT );
761 virtual bool importNamedStyle( QDomDocument &doc, QString &errorMsg SIP_OUT,
782 virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg )
const;
793 virtual QString saveDefaultStyle(
bool &resultFlag SIP_OUT );
810 virtual QString saveNamedStyle(
const QString &uri,
bool &resultFlag SIP_OUT, StyleCategories categories = AllStyleCategories );
820 virtual QString saveSldStyle(
const QString &uri,
bool &resultFlag )
const;
830 virtual QString loadSldStyle(
const QString &uri,
bool &resultFlag );
832 virtual bool readSld(
const QDomNode &node, QString &errorMessage )
833 { Q_UNUSED( node ); errorMessage = QStringLiteral(
"Layer type %1 not supported" ).arg( type() );
return false; }
845 virtual bool readSymbology(
const QDomNode &node, QString &errorMessage,
858 virtual bool readStyle(
const QDomNode &node, QString &errorMessage,
871 virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context,
872 StyleCategories categories = AllStyleCategories )
const = 0;
886 virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
const QgsReadWriteContext &context,
887 StyleCategories categories = AllStyleCategories )
const;
890 QUndoStack *undoStack();
896 QUndoStack *undoStackStyles();
901 void setLegendUrl(
const QString &legendUrl ) { mLegendUrl = legendUrl; }
958 bool isInScaleRange(
double scale )
const;
970 double minimumScale()
const;
982 double maximumScale()
const;
992 bool hasScaleBasedVisibility()
const;
1000 bool hasAutoRefreshEnabled()
const;
1009 int autoRefreshInterval()
const;
1022 void setAutoRefreshInterval(
int interval );
1030 void setAutoRefreshEnabled(
bool enabled );
1052 virtual QString htmlMetadata()
const;
1055 virtual QDateTime timestamp()
const;
1064 virtual QSet<QgsMapLayerDependency> dependencies()
const;
1091 void setMinimumScale(
double scale );
1102 void setMaximumScale(
double scale );
1111 void setScaleBasedVisibility(
bool enabled );
1121 void triggerRepaint(
bool deferredUpdate =
false );
1127 void emitStyleChanged();
1137 virtual bool setDependencies(
const QSet<QgsMapLayerDependency> &layers );
1144 void setRefreshOnNotifyEnabled(
bool enabled );
1158 void statusChanged(
const QString &status );
1176 void repaintRequested(
bool deferredUpdate =
false );
1179 void recalculateExtents()
const;
1185 void blendModeChanged( QPainter::CompositionMode blendMode );
1191 void rendererChanged();
1200 void styleChanged();
1206 void legendChanged();
1212 void renderer3DChanged();
1218 void configChanged();
1223 void dependenciesChanged();
1231 void willBeDeleted();
1238 void autoRefreshIntervalChanged(
int interval );
1246 void metadataChanged();
1254 void flagsChanged();
1258 void onNotifiedTriggerRepaint(
const QString &message );
1273 void setValid(
bool valid );
1285 virtual bool writeXml( QDomNode &layer_node, QDomDocument &document,
const QgsReadWriteContext &context )
const;
1298 virtual QString encodedSource(
const QString &source,
const QgsReadWriteContext &context )
const;
1312 virtual QString decodedSource(
const QString &source,
const QString &dataProvider,
const QgsReadWriteContext &context )
const;
1318 void readCustomProperties(
const QDomNode &layerNode,
const QString &keyStartsWith = QString() );
1321 void writeCustomProperties( QDomNode &layerNode, QDomDocument &doc )
const;
1324 void readStyleManager(
const QDomNode &layerNode );
1326 void writeStyleManager( QDomNode &layerNode, QDomDocument &doc )
const;
1332 void writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
1334 StyleCategories categories = AllStyleCategories )
const;
1340 void readCommonStyle(
const QDomElement &layerElement,
const QgsReadWriteContext &context,
1341 StyleCategories categories = AllStyleCategories );
1345 void connectNotify(
const char *signal )
override;
1359 bool mValid =
false;
1398 bool hasDependencyCycle(
const QSet<QgsMapLayerDependency> &layers )
const;
1400 bool mIsRefreshOnNofifyEnabled =
false;
1407 bool &resultFlag, StyleCategories categories = AllStyleCategories );
1409 bool &resultFlag, StyleCategories categories = AllStyleCategories );
1410 bool loadNamedPropertyFromDatabase(
const QString &db,
const QString &uri, QString &xml,
QgsMapLayer::PropertyType type );
1416 virtual bool isReadOnly()
const;
1429 LayerFlags mFlags = LayerFlags( Identifiable | Removable | Searchable );
1432 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
1440 double mMinScale = 0;
1442 double mMaxScale = 100000000;
1444 bool mScaleBasedVisibility =
false;
1447 QUndoStack *mUndoStack =
nullptr;
1449 QUndoStack *mUndoStackStyles =
nullptr;
1461 QTimer *mRefreshTimer =
nullptr;
1471 Q_DECLARE_OPERATORS_FOR_FLAGS(
QgsMapLayer::LayerFlags )
1472 Q_DECLARE_OPERATORS_FOR_FLAGS(
QgsMapLayer::StyleCategories )
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...
A rectangle specified with double values.
Base class for all map layer types.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
Base class for all renderers that may to participate in 3D view.
bool isRefreshOnNotifyEnabled() const
Returns true if the refresh on provider nofification is enabled.
QString refreshOnNotifyMessage() const
Returns the message that should be notified by the provider to triggerRepaint.
PropertyType
Maplayer has a style and a metadata property.
virtual void reload()
Synchronises with changes in the datasource.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
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.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
const QgsCoordinateReferenceSystem & crs
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
Q_DECLARE_METATYPE(QModelIndex)
QString mLayerName
Name of the layer - used for display.
bool readOnly() const
Returns if this layer is read only.
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.
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 mDataUrl
DataUrl of the layer.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer...
Reads and writes project states.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
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 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.
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 metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
QString mRefreshOnNofifyMessage
Contains information about the context of a rendering operation.
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
QString mDataSource
Data source description string, varies by layer type.
QString legendUrl() const
Returns the URL for the layer's legend.
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)
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
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...
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request. ...
QString keywordList() const
Returns the keyword list 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 attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QString metadataUrlFormat() const
Returns the metadata format 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.