QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
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 }
 Flags which control the behavior of converting features to JSON. More...
 

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. More...
 
static QDateTime convertDateTime (const QVariant &value)
 Converts a date time value to a QDateTime. More...
 
static QVariant::Type convertFieldType (const QString &type)
 Converts an ESRI REST field type to a QVariant type. More...
 
static Qt::BrushStyle convertFillStyle (const QString &style)
 Converts an ESRI fill style to a Qt brush style. More...
 
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. More...
 
static QgsWkbTypes::Type convertGeometryType (const QString &type)
 Converts an ESRI REST geometry type to a WKB type. More...
 
static QgsAbstractVectorLayerLabelingconvertLabeling (const QVariantList &data)
 Converts labeling JSON data to an equivalent QGIS vector labeling. More...
 
static QString convertLabelingExpression (const QString &string)
 Converts an ESRI labeling expression to a QGIS expression string. More...
 
static Qt::PenStyle convertLineStyle (const QString &style)
 Converts an ESRI line style to a Qt pen style. More...
 
static QgsFeatureRendererconvertRenderer (const QVariantMap &rendererData)
 Converts renderer JSON data to an equivalent QgsFeatureRenderer. More...
 
static QgsCoordinateReferenceSystem convertSpatialReference (const QVariantMap &spatialReferenceMap)
 Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value. More...
 
static QgsSymbolconvertSymbol (const QVariantMap &definition)
 Converts a symbol JSON definition to a QgsSymbol. More...
 
static QVariantMap crsToJson (const QgsCoordinateReferenceSystem &crs)
 Converts a crs to an ArcGIS REST JSON representation. More...
 
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)))
 Flags which control the behavior of converting features to JSON. More...
 
static QVariantMap fieldDefinitionToJson (const QgsField &field)
 Converts a field's definition to an ArcGIS REST JSON representation. More...
 
static QVariantMap geometryToJson (const QgsGeometry &geometry, const QgsArcGisRestContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Converts a geometry to an ArcGIS REST JSON representation. More...
 
static Qgis::ArcGisRestServiceType serviceTypeFromString (const QString &type)
 Converts a string value to a REST service type. More...
 
static QVariant variantToAttributeValue (const QVariant &variant, QVariant::Type expectedType, const QgsArcGisRestContext &context)
 Converts a variant to a REST attribute value. More...
 

Friends

class TestQgsArcGisRestUtils
 

Detailed Description

Utility functions for working with ArcGIS REST services.

See also
QgsArcGisPortalUtils
Since
QGIS 3.18

Definition at line 112 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.

Definition at line 217 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 986 of file qgsarcgisrestutils.cpp.

◆ convertDateTime()

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

Converts a date time value to a QDateTime.

Definition at line 1039 of file qgsarcgisrestutils.cpp.

◆ convertFieldType()

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

Converts an ESRI REST field type to a QVariant type.

Definition at line 47 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 1017 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 462 of file qgsarcgisrestutils.cpp.

◆ convertGeometryType()

QgsWkbTypes::Type QgsArcGisRestUtils::convertGeometryType ( const QString &  type)
static

Converts an ESRI REST geometry type to a WKB type.

Definition at line 78 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 749 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 962 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 999 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 884 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 501 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 535 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 1520 of file qgsarcgisrestutils.cpp.

◆ featureToJson()

QVariantMap QgsArcGisRestUtils::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 ) ) 
)
static

Flags which control the behavior of converting features to JSON.

Since
QGIS 3.28 Converts a feature to an ArcGIS REST JSON representation.
QGIS 3.28

Definition at line 1550 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 1604 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 1054 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 1657 of file qgsarcgisrestutils.cpp.

◆ variantToAttributeValue()

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

Converts a variant to a REST attribute value.

Since
QGIS 3.28

Definition at line 1572 of file qgsarcgisrestutils.cpp.

Friends And Related Function Documentation

◆ TestQgsArcGisRestUtils

friend class TestQgsArcGisRestUtils
friend

Definition at line 330 of file qgsarcgisrestutils.h.


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