QGIS API Documentation 3.99.0-Master (752b475928d)
Loading...
Searching...
No Matches
QgsArcGisRestUtils Class Reference

Utility functions for working with ArcGIS REST services. More...

#include <qgsarcgisrestutils.h>

Public Types

enum class  FeatureToJsonFlag : int { IncludeGeometry = 1 << 0 , IncludeNonObjectIdAttributes = 1 << 1 , SkipUnsetAttributes = 1 << 2 }
 Flags which control the behavior of converting features to JSON. More...
typedef QFlags< FeatureToJsonFlagFeatureToJsonFlags
 Flags which control the behavior of converting features to JSON.

Public Member Functions

 Q_ENUM (FeatureToJsonFlag)

Static Public Member Functions

static QColor convertColor (const QVariant &data)
 Converts ESRI JSON color data to a QColor object.
static QDateTime convertDateTime (const QVariant &value)
 Converts a date time value to a QDateTime.
static QMetaType::Type convertFieldType (const QString &type)
 Converts an ESRI REST field type to a QVariant type.
static Qt::BrushStyle convertFillStyle (const QString &style)
 Converts an ESRI fill style to a Qt brush style.
static QgsAbstractGeometryconvertGeometry (const QVariantMap &geometry, const QString &esriGeometryType, bool hasM, bool hasZ, QgsCoordinateReferenceSystem *crs=nullptr)
 Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.
static Qgis::WkbType convertGeometryType (const QString &type)
 Converts an ESRI REST geometry type to a WKB type.
static QgsAbstractVectorLayerLabelingconvertLabeling (const QVariantList &data)
 Converts labeling JSON data to an equivalent QGIS vector labeling.
static QString convertLabelingExpression (const QString &string)
 Converts an ESRI labeling expression to a QGIS expression string.
static Qt::PenStyle convertLineStyle (const QString &style)
 Converts an ESRI line style to a Qt pen style.
static QgsRectangle convertRectangle (const QVariant &value)
 Converts a rectangle value to a QgsRectangle.
static QgsFeatureRendererconvertRenderer (const QVariantMap &rendererData)
 Converts renderer JSON data to an equivalent QgsFeatureRenderer.
static QgsCoordinateReferenceSystem convertSpatialReference (const QVariantMap &spatialReferenceMap)
 Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
static QgsSymbolconvertSymbol (const QVariantMap &definition)
 Converts a symbol JSON definition to a QgsSymbol.
static QVariantMap crsToJson (const QgsCoordinateReferenceSystem &crs)
 Converts a crs to an ArcGIS REST JSON representation.
static QVariantMap featureToJson (const QgsFeature &feature, const QgsArcGisRestContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), QgsArcGisRestUtils::FeatureToJsonFlags flags=QgsArcGisRestUtils::FeatureToJsonFlags(static_cast< int >(QgsArcGisRestUtils::FeatureToJsonFlag::IncludeGeometry)|static_cast< int >(QgsArcGisRestUtils::FeatureToJsonFlag::IncludeNonObjectIdAttributes)))
 Converts a feature to an ArcGIS REST JSON representation.
static QVariantMap fieldDefinitionToJson (const QgsField &field)
 Converts a field's definition to an ArcGIS REST JSON representation.
static QVariantMap geometryToJson (const QgsGeometry &geometry, const QgsArcGisRestContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Converts a geometry to an ArcGIS REST JSON representation.
static Qgis::ArcGisRestServiceType serviceTypeFromString (const QString &type)
 Converts a string value to a REST service type.
static QVariant variantToAttributeValue (const QVariant &variant, QMetaType::Type expectedType, const QgsArcGisRestContext &context)
 Converts a variant to a REST attribute value.

Friends

class TestQgsArcGisRestUtils

Detailed Description

Utility functions for working with ArcGIS REST services.

See also
QgsArcGisPortalUtils
Since
QGIS 3.18

Definition at line 113 of file qgsarcgisrestutils.h.

Member Typedef Documentation

◆ FeatureToJsonFlags

Flags which control the behavior of converting features to JSON.

Since
QGIS 3.28

Definition at line 240 of file qgsarcgisrestutils.h.

Member Enumeration Documentation

◆ FeatureToJsonFlag

enum class QgsArcGisRestUtils::FeatureToJsonFlag : int
strong

Flags which control the behavior of converting features to JSON.

Since
QGIS 3.28
Enumerator
IncludeGeometry 

Whether to include the geometry definition.

IncludeNonObjectIdAttributes 

Whether to include any non-objectId attributes.

SkipUnsetAttributes 

Skip unset attributes.

Since
QGIS 3.44

Definition at line 227 of file qgsarcgisrestutils.h.

Member Function Documentation

◆ convertColor()

QColor QgsArcGisRestUtils::convertColor ( const QVariant & data)
static

Converts ESRI JSON color data to a QColor object.

Definition at line 1225 of file qgsarcgisrestutils.cpp.

◆ convertDateTime()

QDateTime QgsArcGisRestUtils::convertDateTime ( const QVariant & value)
static

Converts a date time value to a QDateTime.

Definition at line 1278 of file qgsarcgisrestutils.cpp.

◆ convertFieldType()

QMetaType::Type QgsArcGisRestUtils::convertFieldType ( const QString & type)
static

Converts an ESRI REST field type to a QVariant type.

Definition at line 61 of file qgsarcgisrestutils.cpp.

◆ convertFillStyle()

Qt::BrushStyle QgsArcGisRestUtils::convertFillStyle ( const QString & style)
static

Converts an ESRI fill style to a Qt brush style.

Definition at line 1256 of file qgsarcgisrestutils.cpp.

◆ convertGeometry()

QgsAbstractGeometry * QgsArcGisRestUtils::convertGeometry ( const QVariantMap & geometry,
const QString & esriGeometryType,
bool hasM,
bool hasZ,
QgsCoordinateReferenceSystem * crs = nullptr )
static

Converts an ESRI REST geometry JSON definition to a QgsAbstractGeometry.

Caller takes ownership of the returned object.

Parameters
geometryJSON geometry definition
esriGeometryTypeESRI geometry type string
hasMset to true to if geometry includes M values
hasZset to true to if geometry includes Z values
crsif specified will be set to the parsed geometry CRS
Returns
converted geometry

Definition at line 476 of file qgsarcgisrestutils.cpp.

◆ convertGeometryType()

Qgis::WkbType QgsArcGisRestUtils::convertGeometryType ( const QString & type)
static

Converts an ESRI REST geometry type to a WKB type.

Definition at line 92 of file qgsarcgisrestutils.cpp.

◆ convertLabeling()

QgsAbstractVectorLayerLabeling * QgsArcGisRestUtils::convertLabeling ( const QVariantList & data)
static

Converts labeling JSON data to an equivalent QGIS vector labeling.

Caller takes ownership of the returned object.

Definition at line 839 of file qgsarcgisrestutils.cpp.

◆ convertLabelingExpression()

QString QgsArcGisRestUtils::convertLabelingExpression ( const QString & string)
static

Converts an ESRI labeling expression to a QGIS expression string.

Definition at line 1201 of file qgsarcgisrestutils.cpp.

◆ convertLineStyle()

Qt::PenStyle QgsArcGisRestUtils::convertLineStyle ( const QString & style)
static

Converts an ESRI line style to a Qt pen style.

Definition at line 1238 of file qgsarcgisrestutils.cpp.

◆ convertRectangle()

QgsRectangle QgsArcGisRestUtils::convertRectangle ( const QVariant & value)
static

Converts a rectangle value to a QgsRectangle.

Returns a null rectangle if the value cannot be converted.

Since
QGIS 3.34

Definition at line 1293 of file qgsarcgisrestutils.cpp.

◆ convertRenderer()

QgsFeatureRenderer * QgsArcGisRestUtils::convertRenderer ( const QVariantMap & rendererData)
static

Converts renderer JSON data to an equivalent QgsFeatureRenderer.

Caller takes ownership of the returned renderer.

Definition at line 974 of file qgsarcgisrestutils.cpp.

◆ convertSpatialReference()

QgsCoordinateReferenceSystem QgsArcGisRestUtils::convertSpatialReference ( const QVariantMap & spatialReferenceMap)
static

Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.

Definition at line 515 of file qgsarcgisrestutils.cpp.

◆ convertSymbol()

QgsSymbol * QgsArcGisRestUtils::convertSymbol ( const QVariantMap & definition)
static

Converts a symbol JSON definition to a QgsSymbol.

Caller takes ownership of the returned symbol.

Definition at line 549 of file qgsarcgisrestutils.cpp.

◆ crsToJson()

QVariantMap QgsArcGisRestUtils::crsToJson ( const QgsCoordinateReferenceSystem & crs)
static

Converts a crs to an ArcGIS REST JSON representation.

Returns an empty map if the crs is not valid.

Since
QGIS 3.28

Definition at line 1794 of file qgsarcgisrestutils.cpp.

◆ featureToJson()

Converts a feature to an ArcGIS REST JSON representation.

Since
QGIS 3.28

Definition at line 1824 of file qgsarcgisrestutils.cpp.

◆ fieldDefinitionToJson()

QVariantMap QgsArcGisRestUtils::fieldDefinitionToJson ( const QgsField & field)
static

Converts a field's definition to an ArcGIS REST JSON representation.

Since
QGIS 3.28

Definition at line 1893 of file qgsarcgisrestutils.cpp.

◆ geometryToJson()

QVariantMap QgsArcGisRestUtils::geometryToJson ( const QgsGeometry & geometry,
const QgsArcGisRestContext & context,
const QgsCoordinateReferenceSystem & crs = QgsCoordinateReferenceSystem() )
static

Converts a geometry to an ArcGIS REST JSON representation.

Returns an empty map if the geometry cannot be converted.

Since
QGIS 3.28

Definition at line 1320 of file qgsarcgisrestutils.cpp.

◆ Q_ENUM()

QgsArcGisRestUtils::Q_ENUM ( FeatureToJsonFlag )

◆ serviceTypeFromString()

Qgis::ArcGisRestServiceType QgsArcGisRestUtils::serviceTypeFromString ( const QString & type)
static

Converts a string value to a REST service type.

Since
QGIS 3.28

Definition at line 1946 of file qgsarcgisrestutils.cpp.

◆ variantToAttributeValue()

QVariant QgsArcGisRestUtils::variantToAttributeValue ( const QVariant & variant,
QMetaType::Type expectedType,
const QgsArcGisRestContext & context )
static

Converts a variant to a REST attribute value.

Since
QGIS 3.28

Definition at line 1855 of file qgsarcgisrestutils.cpp.

◆ TestQgsArcGisRestUtils

friend class TestQgsArcGisRestUtils
friend

Definition at line 342 of file qgsarcgisrestutils.h.


The documentation for this class was generated from the following files: