Skip to content

Class QfFeatureUtils

ClassList > QfFeatureUtils

Inherits the following classes: QObject

Public Types

Type Name
enum FieldType

Public Functions

Type Name
QfFeatureUtils (QObject * parent=nullptr)

Public Static Functions

Type Name
Q_INVOKABLE bool attributeIsNull (const QVariant & value)
Q_INVOKABLE QgsFeature createBlankFeature (const QgsFields & fields=QgsFields(), const QgsGeometry & geometry=QgsGeometry())
Q_INVOKABLE QgsFeature createFeature (QgsVectorLayer * layer, const QgsGeometry & geometry=QgsGeometry(), const QfGnssPositionInformation & positionInformation=QfGnssPositionInformation(), const QfCloudUserInformation & cloudUserInformation=QfCloudUserInformation())
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, bool skipSinglePointLogic=false)
Q_INVOKABLE QList< QgsFeature > featuresFromJsonString (const QString & string)

Public Types Documentation

enum FieldType

enum QfFeatureUtils::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 QfFeatureUtils

explicit QfFeatureUtils::QfFeatureUtils (
    QObject * parent=nullptr
) 

Public Static Functions Documentation

function attributeIsNull

static Q_INVOKABLE bool QfFeatureUtils::attributeIsNull (
    const QVariant & value
) 

Returns TRUE if an attribute value is null.


function createBlankFeature

static Q_INVOKABLE QgsFeature QfFeatureUtils::createBlankFeature (
    const QgsFields & fields=QgsFields(),
    const QgsGeometry & geometry=QgsGeometry()
) 

Returns a new feature with its fields completely blank.


function createFeature

static Q_INVOKABLE QgsFeature QfFeatureUtils::createFeature (
    QgsVectorLayer * layer,
    const QgsGeometry & geometry=QgsGeometry(),
    const QfGnssPositionInformation & positionInformation=QfGnssPositionInformation (),
    const QfCloudUserInformation & cloudUserInformation=QfCloudUserInformation ()
) 

Returns a new feature with its fields set to default values.


function createField

static Q_INVOKABLE QgsField QfFeatureUtils::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 QfFeatureUtils::createFields (
    const QList< QgsField > & fields
) 

Returns a new a fields gadget.


function displayName

static Q_INVOKABLE QString QfFeatureUtils::displayName (
    QgsVectorLayer * layer,
    const QgsFeature & feature
) 

Returns the display name of a given feature.

Parameters:

  • layer the vector layer containing the feature
  • feature the feature to be named

function extent

static Q_INVOKABLE QgsRectangle QfFeatureUtils::extent (
    QgsQuickMapSettings * mapSettings,
    QgsVectorLayer * layer,
    const QgsFeature & feature,
    bool skipSinglePointLogic=false
) 

Returns the map extent encompassig a given feature.

Parameters:

  • mapSettings the map settings used to determine the CRS
  • layer the vector layer containing the feature
  • feature the feature from which the geometry will be used
  • skipSinglePointLogic when TRUE, the special handling for determining a single point extent will be skipped

Returns:

a QgsRectangle extent


function featuresFromJsonString

static Q_INVOKABLE QList< QgsFeature > QfFeatureUtils::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/qffeatureutils.h