QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
QgsVectorLayer::LayerOptions Struct Reference

Setting options for loading vector layers. More...

#include <qgsvectorlayer.h>

Public Member Functions

 LayerOptions (bool loadDefaultStyle=true, bool readExtentFromXml=false)
 Constructor for LayerOptions.
 
 LayerOptions (const QgsCoordinateTransformContext &transformContext, bool loadDefaultStyle=true, bool readExtentFromXml=false)
 Constructor for LayerOptions.
 

Public Attributes

QgsCoordinateReferenceSystem fallbackCrs
 Fallback layer coordinate reference system.
 
Qgis::WkbType fallbackWkbType = Qgis::WkbType::Unknown
 Fallback geometry type.
 
bool forceReadOnly = false
 Controls whether the layer is forced to be load as Read Only.
 
bool loadAllStoredStyles = false
 Controls whether the stored styles will be all loaded.
 
bool loadDefaultStyle = true
 Set to true if the default layer style should be loaded.
 
bool readExtentFromXml = false
 If true, the layer extent will be read from XML (i.e.
 
bool skipCrsValidation = false
 Controls whether the layer is allowed to have an invalid/unknown CRS.
 
QgsCoordinateTransformContext transformContext = QgsCoordinateTransformContext()
 Coordinate transform context.
 

Detailed Description

Setting options for loading vector layers.

Since
QGIS 3.0

Definition at line 422 of file qgsvectorlayer.h.

Constructor & Destructor Documentation

◆ LayerOptions() [1/2]

QgsVectorLayer::LayerOptions::LayerOptions ( bool  loadDefaultStyle = true,
bool  readExtentFromXml = false 
)
inlineexplicit

Constructor for LayerOptions.

Definition at line 428 of file qgsvectorlayer.h.

◆ LayerOptions() [2/2]

QgsVectorLayer::LayerOptions::LayerOptions ( const QgsCoordinateTransformContext transformContext,
bool  loadDefaultStyle = true,
bool  readExtentFromXml = false 
)
inlineexplicit

Constructor for LayerOptions.

Since
QGIS 3.8

Definition at line 438 of file qgsvectorlayer.h.

Member Data Documentation

◆ fallbackCrs

QgsCoordinateReferenceSystem QgsVectorLayer::LayerOptions::fallbackCrs

Fallback layer coordinate reference system.

This may be set for layers where the coordinate reference system is known in advance, and where the layer path may not be initially resolvable. (E.g. layers with a URI pointing to a non-existent file). It is only ever used if the layer cannot be resolved, otherwise the actual layer CRS will be detected and used for the layer.

See also
fallbackWkbType
Since
QGIS 3.8

Definition at line 486 of file qgsvectorlayer.h.

◆ fallbackWkbType

Qgis::WkbType QgsVectorLayer::LayerOptions::fallbackWkbType = Qgis::WkbType::Unknown

Fallback geometry type.

This may be set for layers where the geometry type is known in advance, and where the layer path may not be initially resolvable. (E.g. layers with a URI pointing to a non-existent file). It is only ever used if the layer cannot be resolved, otherwise the actual layer geometry type will be detected and used for the layer.

See also
fallbackCrs
Since
QGIS 3.8

Definition at line 473 of file qgsvectorlayer.h.

◆ forceReadOnly

bool QgsVectorLayer::LayerOptions::forceReadOnly = false

Controls whether the layer is forced to be load as Read Only.

If true, then the layer's provider will only check read capabilities. Write capabilities will be skipped.

If false (the default), the layer's provider will check the edition capabilities based on user rights or file rights or others.

Since
QGIS 3.28

Definition at line 514 of file qgsvectorlayer.h.

◆ loadAllStoredStyles

bool QgsVectorLayer::LayerOptions::loadAllStoredStyles = false

Controls whether the stored styles will be all loaded.

If true and the layer's provider supports style stored in the data source all the available styles will be loaded in addition to the default one.

If false (the default), the layer's provider will only load the default style.

Since
QGIS 3.30

Definition at line 528 of file qgsvectorlayer.h.

◆ loadDefaultStyle

bool QgsVectorLayer::LayerOptions::loadDefaultStyle = true

Set to true if the default layer style should be loaded.

Definition at line 448 of file qgsvectorlayer.h.

◆ readExtentFromXml

bool QgsVectorLayer::LayerOptions::readExtentFromXml = false

If true, the layer extent will be read from XML (i.e.

stored in the project file). If false, the extent will be determined by the provider on layer load.

Definition at line 454 of file qgsvectorlayer.h.

◆ skipCrsValidation

bool QgsVectorLayer::LayerOptions::skipCrsValidation = false

Controls whether the layer is allowed to have an invalid/unknown CRS.

If true, then no validation will be performed on the layer's CRS and the layer layer's crs() may be invalid() (i.e. the layer will have no georeferencing available and will be treated as having purely numerical coordinates).

If false (the default), the layer's CRS will be validated using QgsCoordinateReferenceSystem::validate(), which may cause a blocking, user-facing dialog asking users to manually select the correct CRS for the layer.

Since
QGIS 3.10

Definition at line 501 of file qgsvectorlayer.h.

◆ transformContext

QgsCoordinateTransformContext QgsVectorLayer::LayerOptions::transformContext = QgsCoordinateTransformContext()

Coordinate transform context.

Since
QGIS 3.8

Definition at line 460 of file qgsvectorlayer.h.


The documentation for this struct was generated from the following file: