QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
85 :
QgsDataItem(
Qgis::BrowserItemType::Layer, parent, name, path, providerKey )
87 , mLayerType( layerType )
127 switch ( layer->
type() )
131 switch ( qobject_cast< QgsVectorLayer * >( layer )->geometryType() )
179 return QStringLiteral(
"/mIconPointLayer.svg" );
181 return QStringLiteral(
"/mIconLineLayer.svg" );
183 return QStringLiteral(
"/mIconPolygonLayer.svg" );
185 return QStringLiteral(
"/mIconGeometryCollectionLayer.svg" );
188 return QStringLiteral(
"/mIconTableLayer.svg" );
190 return QStringLiteral(
"/mIconRaster.svg" );
192 return QStringLiteral(
"/mIconMeshLayer.svg" );
194 return QStringLiteral(
"/mIconPointCloudLayer.svg" );
196 return QStringLiteral(
"/mIconLayer.png" );
213 const QgsLayerItem *o = qobject_cast<const QgsLayerItem *>( other );
227 u.
layerType = QStringLiteral(
"vector" );
256 u.
layerType = QStringLiteral(
"raster" );
262 u.
layerType = QStringLiteral(
"vector-tile" );
265 u.
layerType = QStringLiteral(
"pointcloud" );
268 u.
layerType = QStringLiteral(
"plugin" );
274 u.
layerType = QStringLiteral(
"annotation" );
QgsMapLayerType mapLayerType() const
Returns QgsMapLayerType.
QgsWkbTypes::Type wkbType
WKB type, if associated with a vector layer, or QgsWkbTypes::Unknown if not yet known.
QString name
Human readable name to be used e.g. in layer tree.
QString uri
Identifier of the data source recognized by its providerKey.
static QIcon iconRaster()
Returns an icon representing raster layers.
static QIcon iconTable()
Returns an icon representing non-spatial layers (tables).
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
static QIcon iconPointCloud()
Returns icon for point cloud layer.
QStringList supportedFormats
@ MeshLayer
Mesh layer. Added in QGIS 3.2.
static QIcon iconPolygon()
Returns an icon representing polygon geometries.
@ VectorLayer
Vector layer.
static QIcon iconDefault()
QString layerType
Type of URI.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
QgsMapLayerType
Types of layers that can be added to a map.
static QIcon iconRaster()
@ PointCloud
Point cloud layer.
static QIcon iconLine()
Returns an icon representing line geometries.
Type
The WKB type describes the number of dimensions a geometry has.
QgsLayerItem(QgsDataItem *parent, const QString &name, const QString &path, const QString &uri, Qgis::BrowserLayerType layerType, const QString &providerKey)
Constructor for QgsLayerItem.
static QIcon iconDefaultLayer()
Returns a default icon for layers, which aren't the standard raster/vector/...
static QString layerTypeAsString(Qgis::BrowserLayerType layerType)
Returns the string representation of the given layerType.
QList< QgsMimeDataUtils::Uri > UriList
BrowserLayerType
Browser item layer types.
virtual Q_DECL_DEPRECATED bool deleteLayer()
Delete this layer item Use QgsDataItemGuiProvider::deleteLayer instead.
virtual QgsAbstractDatabaseProviderConnection * databaseConnection() const
For data items that represent a DB connection or one of its children, this method returns a connectio...
@ Plugin
Plugin based layer.
@ ItemRepresentsFile
Item's path() directly represents a file on disk (since QGIS 3.22)
QgsDataItem * parent() const
Gets item parent.
@ GroupLayer
Composite group layer. Added in QGIS 3.24.
static QString iconName(Qgis::BrowserLayerType layerType)
Returns the icon name of the given layerType.
static QIcon iconVectorTile()
Returns icon for vector tile layer.
@ RasterLayer
Raster layer.
static QIcon iconPointCloud()
Returns an icon representing point cloud layers.
QString filePath
Path to file, if uri is associated with a file.
static QIcon iconPoint()
Returns an icon representing point geometries.
static QIcon iconForWkbType(QgsWkbTypes::Type type)
Returns the icon for a vector layer whose geometry type is provided.
@ Database
Database layer.
static QIcon iconPolygon()
QString providerKey
For "vector" / "raster" type: provider id.
@ VectorTile
Vector tile layer.
static QIcon iconMesh()
Returns icon for mesh layer type.
static Qgis::BrowserLayerType typeFromMapLayer(QgsMapLayer *layer)
Returns the layer item type corresponding to a QgsMapLayer layer.
static QIcon iconVectorTile()
Returns an icon representing vector tile layers.
static QIcon iconForWkbType(QgsWkbTypes::Type type)
Returns the icon for a vector layer whose geometry type is provided.
Base class for all map layer types. This is the base class for all map layer types (vector,...
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.
bool equal(const QgsDataItem *other) override
Returns true if this item is equal to another item (by testing item type and path).
QgsMimeDataUtils::UriList mimeUris() const override
Returns mime URIs for the data item, most data providers will only return a single URI but some data ...
Qgis::BrowserLayerType mLayerType
The layer type.
QStringList supportedCrs() const
Returns the supported CRS.
Item that represents a layer that can be opened with one of the providers.
@ Point
Vector point layer.
The Qgis class provides global constants for use throughout the application.
virtual Qgis::BrowserItemCapabilities capabilities2() const
Returns the capabilities for the data item.
@ TableLayer
Vector non-spatial layer.
QString providerKey() const
Returns provider key.
static QIcon iconMesh()
Returns an icon representing mesh layers.
virtual QString layerName() const
Base class for all items in the model.
QStringList supportedFormats() const
Returns the supported formats.
@ PointCloudLayer
Point cloud layer. Added in QGIS 3.18.
Qgis::BrowserItemType type() const
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
@ PluginLayer
Plugin based layer.
@ Polygon
Vector polygon layer.
@ Vector
Generic vector layer.
QgsAbstractDatabaseProviderConnection * databaseConnection() const override
For data items that represent a DB connection or one of its children, this method returns a connectio...
QString uri() const
Returns layer uri or empty string if layer cannot be created.