Class FeatureUtils
Inherits the following classes: QObject
Public Types
| Type | Name |
|---|---|
| enum | FieldType |
Public Functions
| Type | Name |
|---|---|
| FeatureUtils (QObject * parent=nullptr) |
Public Static Functions
| Type | Name |
|---|---|
| Q_INVOKABLE QgsFeature | createBlankFeature (const QgsFields & fields=QgsFields(), const QgsGeometry & geometry=QgsGeometry()) |
| Q_INVOKABLE QgsFeature | createFeature (QgsVectorLayer * layer, const QgsGeometry & geometry=QgsGeometry(), const GnssPositionInformation & positionInformation=GnssPositionInformation(), const CloudUserInformation & cloudUserInformation=CloudUserInformation()) |
| Q_INVOKABLE QgsField | createField (const QString & name, FieldType type, const QString & typeName=QString(), int length=0, int precision=0, const QString & comment=QString()) |
| Q_INVOKABLE QgsFields | createFields (const QList< QgsField > & fields) |
| Q_INVOKABLE QString | displayName (QgsVectorLayer * layer, const QgsFeature & feature) |
| Q_INVOKABLE QgsRectangle | extent (QgsQuickMapSettings * mapSettings, QgsVectorLayer * layer, const QgsFeature & feature) |
| Q_INVOKABLE QList< QgsFeature > | featuresFromJsonString (const QString & string) |
Public Types Documentation
enum FieldType
enum FeatureUtils::FieldType {
Bool = QMetaType::Type::Bool,
Int = QMetaType::Type::Int,
String = QMetaType::Type::QString,
Double = QMetaType::Type::Double,
Date = QMetaType::Type::QDate,
DateTime = QMetaType::Type::QDateTime,
Time = QMetaType::Type::QTime
};
Public Functions Documentation
function FeatureUtils
explicit FeatureUtils::FeatureUtils (
QObject * parent=nullptr
)
Public Static Functions Documentation
function createBlankFeature
static Q_INVOKABLE QgsFeature FeatureUtils::createBlankFeature (
const QgsFields & fields=QgsFields(),
const QgsGeometry & geometry=QgsGeometry()
)
Returns a new feature with its fields completely blank.
function createFeature
static Q_INVOKABLE QgsFeature FeatureUtils::createFeature (
QgsVectorLayer * layer,
const QgsGeometry & geometry=QgsGeometry(),
const GnssPositionInformation & positionInformation=GnssPositionInformation (),
const CloudUserInformation & cloudUserInformation=CloudUserInformation ()
)
Returns a new feature with its fields set to default values.
function createField
static Q_INVOKABLE QgsField FeatureUtils::createField (
const QString & name,
FieldType type,
const QString & typeName=QString(),
int length=0,
int precision=0,
const QString & comment=QString()
)
Returns a new a field gadget.
function createFields
static Q_INVOKABLE QgsFields FeatureUtils::createFields (
const QList< QgsField > & fields
)
Returns a new a fields gadget.
function displayName
static Q_INVOKABLE QString FeatureUtils::displayName (
QgsVectorLayer * layer,
const QgsFeature & feature
)
Returns the display name of a given feature.
Parameters:
layerthe vector layer containing the featurefeaturethe feature to be named
function extent
static Q_INVOKABLE QgsRectangle FeatureUtils::extent (
QgsQuickMapSettings * mapSettings,
QgsVectorLayer * layer,
const QgsFeature & feature
)
Returns the map extent encompassig a given feature.
Parameters:
mapSettingsthe map settings used to determine the CRSlayerthe vector layer containing the featurefeaturethe feature from which the geometry will be used
Returns:
a QgsRectangle extent
function featuresFromJsonString
static Q_INVOKABLE QList< QgsFeature > FeatureUtils::featuresFromJsonString (
const QString & string
)
Returns a list of features while attempting to parse a GeoJSON string. If the string could not be parsed, an enmpty list will be returned.
The documentation for this class was generated from the following file src/core/utils/featureutils.h