16 #ifndef QGSJSONUTILS_H 17 #define QGSJSONUTILS_H 19 #include "qgis_core.h" 26 #include <json_fwd.hpp> 31 #include <QJsonObject> 205 QString exportFeature(
const QgsFeature &feature,
206 const QVariantMap &extraProperties = QVariantMap(),
207 const QVariant &
id = QVariant(),
208 int indent = -1 )
const;
219 json exportFeatureToJsonObject(
const QgsFeature &feature,
220 const QVariantMap &extraProperties = QVariantMap(),
221 const QVariant &
id = QVariant() )
const SIP_SKIP;
231 QString exportFeatures(
const QgsFeatureList &features,
int indent = -1 )
const;
257 bool mIncludeGeometry =
true;
260 bool mIncludeAttributes =
true;
263 bool mIncludeRelatedAttributes =
false;
266 QPointer< QgsVectorLayer > mLayer;
272 bool mAttributeDisplayName =
false;
295 static QgsFeatureList stringToFeatureList(
const QString &
string,
const QgsFields &fields, QTextCodec *encoding );
305 static QgsFields stringToFields(
const QString &
string, QTextCodec *encoding );
313 static QString encodeValue(
const QVariant &value );
324 const QVector<QVariant> &attributeWidgetCaches = QVector<QVariant>() );
337 const QVector<QVariant> &attributeWidgetCaches = QVector<QVariant>() )
SIP_SKIP;
347 static QVariantList parseArray(
const QString &json, QVariant::Type type = QVariant::Invalid );
355 static json jsonFromVariant(
const QVariant &v )
SIP_SKIP;
362 static QVariant parseJson(
const std::string &jsonString )
SIP_SKIP;
369 static QVariant parseJson(
const QString &jsonString )
SIP_SKIP;
373 #endif // QGSJSONUTILS_H QgsAttributeList excludedAttributes() const
Returns a list of attributes which will be specifically excluded from the JSON exports.
bool includeRelated() const
Returns whether attributes of related (child) features will be included in the JSON exports...
void setAttributeDisplayName(bool displayName)
Sets whether to print original names of attributes or aliases if defined.
void setIncludeAttributes(bool includeAttributes)
Sets whether to include attributes in the JSON exports.
QList< QgsFeature > QgsFeatureList
void setIncludeGeometry(bool includeGeometry)
Sets whether to include geometry in the JSON exports.
Helper utilities for working with JSON and GeoJSON conversions.
Container of fields for a vector layer.
bool includeAttributes() const
Returns whether attributes will be included in the JSON exports.
int precision() const
Returns the maximum number of decimal places to use in geometry coordinates.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
const QgsCoordinateReferenceSystem & crs
bool attributeDisplayName() const
Returns whether original names of attributes or aliases are printed.
void setAttributes(const QgsAttributeList &attributes)
Sets the list of attributes to include in the JSON exports.
void setExcludedAttributes(const QgsAttributeList &attributes)
Sets a list of attributes to specifically exclude from the JSON exports.
QgsAttributeList attributes() const
Returns the list of attributes which will be included in the JSON exports, or an empty list if all at...
void setIncludeRelated(bool includeRelated)
Sets whether to include attributes of features linked via references in the JSON exports.
Handles exporting QgsFeature features to GeoJSON features.
bool includeGeometry() const
Returns whether geometry will be included in the JSON exports.
This class represents a coordinate reference system (CRS).
QList< int > QgsAttributeList
void setPrecision(int precision)
Sets the maximum number of decimal places to use in geometry coordinates.
Represents a vector layer which manages a vector based data sets.