Address review

This commit is contained in:
Mathieu Pellerin 2025-06-13 08:16:59 +07:00
parent 3dea59c37e
commit 9d62e9e38b
27 changed files with 98 additions and 39 deletions

View File

@ -14,7 +14,7 @@ class QgsStacAsset
%Docstring(signature="appended")
Class for storing a STAC asset's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -14,7 +14,7 @@ class QgsStacCatalog : QgsStacObject
%Docstring(signature="appended")
Class for storing a STAC Catalog's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -13,7 +13,7 @@ class QgsStacCollection : QgsStacCatalog
%Docstring(signature="appended")
Class for storing a STAC Collection's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -16,7 +16,7 @@ class QgsStacCollectionList
Class for storing a list of STAC Collections, which is typically used to
store the data returned by STAC API /collections endpoint.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -17,7 +17,7 @@ The :py:class:`QgsStacController` class handles STAC requests.
Contains methods to generate STAC objects from local and remote urls.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -13,7 +13,7 @@ class QgsStacItem : QgsStacObject
%Docstring(signature="appended")
Class for storing a STAC Item's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -19,7 +19,7 @@ An Item Collection is typically returned by STAP API endpoints and
contains a subset of the STAC Items available in a STAC Catalog or
Collection.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -14,11 +14,32 @@ class QgsStacObject
%Docstring(signature="appended")
Abstract base class for storing STAC objects.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode
#include "qgsstacobject.h"
#include "qgsstacitem.h"
#include "qgsstaccollection.h"
#include "qgsstaccatalog.h"
%End
%ConvertToSubClassCode
if ( QgsStacItem *item = dynamic_cast< QgsStacItem * >( sipCpp ) )
{
sipType = sipType_QgsStacItem;
}
else if ( QgsStacCollection *item = dynamic_cast< QgsStacCollection * >( sipCpp ) )
{
sipType = sipType_QgsStacCollection;
}
else if ( QgsStacCatalog *item = dynamic_cast< QgsStacCatalog * >( sipCpp ) )
{
sipType = sipType_QgsStacCatalog;
}
else
{
sipType = NULL;
}
%End
public:

View File

@ -18,6 +18,8 @@ SpatioTemporal Asset Catalog JSON parser.
This class parses json data and creates the appropriate STAC Catalog,
Collection, Item or ItemCollection.
.. versionadded:: 3.44
%End
%TypeHeaderCode
@ -40,14 +42,11 @@ Sets the base ``url`` that will be used to resolve relative links. If
not called, relative links will not be resolved to absolute links.
%End
QgsStacCatalog *catalog() /Factory/;
std::unique_ptr< QgsStacCatalog > catalog();
%Docstring
Returns the parsed STAC Catalog If parsing failed, ``None`` is returned
The caller takes ownership of the returned catalog
%End
%MethodCode
sipRes = sipCpp->catalog().release();
%End

View File

@ -14,7 +14,7 @@ class QgsStacAsset
%Docstring(signature="appended")
Class for storing a STAC asset's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -14,7 +14,7 @@ class QgsStacCatalog : QgsStacObject
%Docstring(signature="appended")
Class for storing a STAC Catalog's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -13,7 +13,7 @@ class QgsStacCollection : QgsStacCatalog
%Docstring(signature="appended")
Class for storing a STAC Collection's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -16,7 +16,7 @@ class QgsStacCollectionList
Class for storing a list of STAC Collections, which is typically used to
store the data returned by STAC API /collections endpoint.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -17,7 +17,7 @@ The :py:class:`QgsStacController` class handles STAC requests.
Contains methods to generate STAC objects from local and remote urls.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -13,7 +13,7 @@ class QgsStacItem : QgsStacObject
%Docstring(signature="appended")
Class for storing a STAC Item's data.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -19,7 +19,7 @@ An Item Collection is typically returned by STAP API endpoints and
contains a subset of the STAC Items available in a STAC Catalog or
Collection.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode

View File

@ -14,11 +14,32 @@ class QgsStacObject
%Docstring(signature="appended")
Abstract base class for storing STAC objects.
.. versionadded:: 3.40
.. versionadded:: 3.44
%End
%TypeHeaderCode
#include "qgsstacobject.h"
#include "qgsstacitem.h"
#include "qgsstaccollection.h"
#include "qgsstaccatalog.h"
%End
%ConvertToSubClassCode
if ( QgsStacItem *item = dynamic_cast< QgsStacItem * >( sipCpp ) )
{
sipType = sipType_QgsStacItem;
}
else if ( QgsStacCollection *item = dynamic_cast< QgsStacCollection * >( sipCpp ) )
{
sipType = sipType_QgsStacCollection;
}
else if ( QgsStacCatalog *item = dynamic_cast< QgsStacCatalog * >( sipCpp ) )
{
sipType = sipType_QgsStacCatalog;
}
else
{
sipType = NULL;
}
%End
public:

View File

@ -18,6 +18,8 @@ SpatioTemporal Asset Catalog JSON parser.
This class parses json data and creates the appropriate STAC Catalog,
Collection, Item or ItemCollection.
.. versionadded:: 3.44
%End
%TypeHeaderCode
@ -40,14 +42,11 @@ Sets the base ``url`` that will be used to resolve relative links. If
not called, relative links will not be resolved to absolute links.
%End
QgsStacCatalog *catalog() /Factory/;
std::unique_ptr< QgsStacCatalog > catalog();
%Docstring
Returns the parsed STAC Catalog If parsing failed, ``None`` is returned
The caller takes ownership of the returned catalog
%End
%MethodCode
sipRes = sipCpp->catalog().release();
%End

View File

@ -27,7 +27,7 @@
* \ingroup core
* \brief Class for storing a STAC asset's data.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacAsset
{

View File

@ -27,7 +27,7 @@
* \ingroup core
* \brief Class for storing a STAC Catalog's data.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacCatalog : public QgsStacObject
{

View File

@ -27,7 +27,7 @@
* \ingroup core
* \brief Class for storing a STAC Collection's data.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacCollection : public QgsStacCatalog
{

View File

@ -28,7 +28,7 @@ class QgsStacCollection;
* \ingroup core
* \brief Class for storing a list of STAC Collections, which is typically used to store the data returned by STAC API /collections endpoint.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacCollectionList
{

View File

@ -39,7 +39,7 @@ class QNetworkReply;
*
* Contains methods to generate STAC objects from local and remote urls.
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacController : public QObject
{

View File

@ -29,7 +29,7 @@
* \ingroup core
* \brief Class for storing a STAC Item's data.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacItem : public QgsStacObject
{

View File

@ -31,7 +31,7 @@ class QgsStacItem;
* An Item Collection is typically returned by STAP API endpoints and contains a subset
* of the STAC Items available in a STAC Catalog or Collection.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacItemCollection
{

View File

@ -28,10 +28,35 @@
* \ingroup core
* \brief Abstract base class for storing STAC objects.
*
* \since QGIS 3.40
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacObject
{
//SIP_TYPEHEADER_INCLUDE( "qgsstacitem.h" );
//SIP_TYPEHEADER_INCLUDE( "qgsstaccollection.h" );
//SIP_TYPEHEADER_INCLUDE( "qgsstaccatalog.h" );
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( QgsStacItem *item = dynamic_cast< QgsStacItem * >( sipCpp ) )
{
sipType = sipType_QgsStacItem;
}
else if ( QgsStacCollection *item = dynamic_cast< QgsStacCollection * >( sipCpp ) )
{
sipType = sipType_QgsStacCollection;
}
else if ( QgsStacCatalog *item = dynamic_cast< QgsStacCatalog * >( sipCpp ) )
{
sipType = sipType_QgsStacCatalog;
}
else
{
sipType = NULL;
}
SIP_END
#endif
public:
//! Default constructor is used for creating invalid objects

View File

@ -36,6 +36,7 @@ class QgsStacItemCollection;
* This class parses json data and creates the appropriate
* STAC Catalog, Collection, Item or ItemCollection.
*
* \since QGIS 3.44
*/
class CORE_EXPORT QgsStacParser
{
@ -57,14 +58,7 @@ class CORE_EXPORT QgsStacParser
* If parsing failed, NULLPTR is returned
* The caller takes ownership of the returned catalog
*/
#ifndef SIP_RUN
std::unique_ptr< QgsStacCatalog > catalog();
#else
QgsStacCatalog *catalog() SIP_FACTORY;
% MethodCode
sipRes = sipCpp->catalog().release();
% End
#endif
/**