Skip to content

Commit

Permalink
Move QgsArcGisRestUtils to core, cleanup API, add docs and selectively
Browse files Browse the repository at this point in the history
expose to Python
  • Loading branch information
nyalldawson committed Dec 18, 2020
1 parent 4f4ef6d commit 8d45910
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 309 deletions.
1 change: 1 addition & 0 deletions doc/CMakeLists.txt
Expand Up @@ -76,6 +76,7 @@ if(WITH_APIDOC)
${CMAKE_SOURCE_DIR}/src/core/processing
${CMAKE_SOURCE_DIR}/src/core/pointcloud
${CMAKE_SOURCE_DIR}/src/core/providers
${CMAKE_SOURCE_DIR}/src/core/providers/arcgis
${CMAKE_SOURCE_DIR}/src/core/providers/memory
${CMAKE_SOURCE_DIR}/src/core/raster
${CMAKE_SOURCE_DIR}/src/core/scalebar
Expand Down
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Expand Up @@ -125,6 +125,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/processing
${CMAKE_SOURCE_DIR}/src/core/processing/models
${CMAKE_SOURCE_DIR}/src/core/providers
${CMAKE_SOURCE_DIR}/src/core/providers/arcgis
${CMAKE_SOURCE_DIR}/src/core/pointcloud
${CMAKE_SOURCE_DIR}/src/core/providers/memory
${CMAKE_SOURCE_DIR}/src/core/raster
Expand Down
112 changes: 112 additions & 0 deletions python/core/auto_generated/providers/arcgis/qgsarcgisrestutils.sip.in
@@ -0,0 +1,112 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/arcgis/qgsarcgisrestutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsArcGisRestUtils
{
%Docstring
Utility functions for working with ArcGIS REST services.

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgsarcgisrestutils.h"
%End
public:


static QVariant::Type convertFieldType( const QString &type );
%Docstring
Converts an ESRI REST field ``type`` to a QVariant type.
%End

static QgsWkbTypes::Type convertGeometryType( const QString &type );
%Docstring
Converts an ESRI REST geometry ``type`` to a WKB type.
%End

static QgsAbstractGeometry *convertGeometry( const QVariantMap &geometry, const QString &esriGeometryType, bool hasM, bool hasZ, QgsCoordinateReferenceSystem *crs /Out/ = 0 ) /Factory/;
%Docstring
Converts an ESRI REST ``geometry`` JSON definition to a :py:class:`QgsAbstractGeometry`.

Caller takes ownership of the returned object.

:param geometry: JSON geometry definition
:param esriGeometryType: ESRI geometry type string
:param hasM: set to ``True`` to if geometry includes M values
:param hasZ: set to ``True`` to if geometry includes Z values

:return: - converted geometry
- crs: will be set to the parsed geometry CRS
%End

static QgsCoordinateReferenceSystem convertSpatialReference( const QVariantMap &spatialReferenceMap );
%Docstring
Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
%End

static QgsSymbol *convertSymbol( const QVariantMap &definition ) /Factory/;
%Docstring
Converts a symbol JSON ``definition`` to a :py:class:`QgsSymbol`.

Caller takes ownership of the returned symbol.
%End

static QgsFeatureRenderer *convertRenderer( const QVariantMap &rendererData ) /Factory/;
%Docstring
Converts renderer JSON ``data`` to an equivalent :py:class:`QgsFeatureRenderer`.

Caller takes ownership of the returned renderer.
%End

static QgsAbstractVectorLayerLabeling *convertLabeling( const QVariantList &data ) /Factory/;
%Docstring
Converts labeling JSON ``data`` to an equivalent QGIS vector labeling.

Caller takes ownership of the returned object.
%End

static QString convertLabelingExpression( const QString &string );
%Docstring
Converts an ESRI labeling expression to a QGIS expression string.
%End

static QColor convertColor( const QVariant &data );
%Docstring
Converts ESRI JSON color data to a QColor object.
%End

static Qt::PenStyle convertLineStyle( const QString &style );
%Docstring
Converts an ESRI line ``style`` to a Qt pen style.
%End

static Qt::BrushStyle convertFillStyle( const QString &style );
%Docstring
Converts an ESRI fill ``style`` to a Qt brush style.
%End

static QDateTime convertDateTime( const QVariant &value );
%Docstring
Converts a date time ``value`` to a QDateTime.
%End



};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/arcgis/qgsarcgisrestutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -500,6 +500,7 @@
%Include auto_generated/processing/qgsprocessingprovider.sip
%Include auto_generated/processing/qgsprocessingregistry.sip
%Include auto_generated/processing/qgsprocessingutils.sip
%Include auto_generated/providers/arcgis/qgsarcgisrestutils.sip
%Include auto_generated/providers/memory/qgsmemoryproviderutils.sip
%Include auto_generated/raster/qgsbilinearrasterresampler.sip
%Include auto_generated/raster/qgsbrightnesscontrastfilter.sip
Expand Down
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -179,6 +179,8 @@ set(QGIS_CORE_SRCS
processing/models/qgsprocessingmodelparameter.cpp
processing/models/qgsprocessingmodeloutput.cpp

providers/arcgis/qgsarcgisrestutils.cpp

providers/gdal/qgsgdalproviderbase.cpp
providers/gdal/qgsgdalprovider.cpp
providers/gdal/qgsgdaldataitems.cpp
Expand Down Expand Up @@ -1400,6 +1402,7 @@ set(QGIS_CORE_HDRS
processing/qgsprocessingregistry.h
processing/qgsprocessingutils.h

providers/arcgis/qgsarcgisrestutils.h
providers/gdal/qgsgdaldataitems.h
providers/gdal/qgsgdalprovider.h
providers/memory/qgsmemoryfeatureiterator.h
Expand Down

0 comments on commit 8d45910

Please sign in to comment.