19 #ifndef QGSPROVIDERMETADATA_H
20 #define QGSPROVIDERMETADATA_H
24 #include <QVariantMap>
32 #include "qgis_core.h"
68 CanWriteFaceDatasets = 1 << 0,
69 CanWriteVertexDatasets = 1 << 1,
70 CanWriteEdgeDatasets = 1 << 2,
71 CanWriteMeshData = 1 << 3,
74 Q_ENUM( MeshDriverCapability )
75 Q_DECLARE_FLAGS( MeshDriverCapabilities, MeshDriverCapability )
76 Q_FLAG( MeshDriverCapabilities )
92 const QString &description,
93 const MeshDriverCapabilities &capabilities,
109 const QString &description,
110 const MeshDriverCapabilities &capabilities,
111 const QString &writeDatasetOnFileSuffix,
112 const QString &writeMeshFrameOnFileSuffix,
113 int maxVerticesPerface );
118 MeshDriverCapabilities capabilities()
const;
123 QString name()
const;
128 QString description()
const;
133 QString writeDatasetOnFileSuffix()
const;
140 QString writeMeshFrameOnFileSuffix()
const;
147 int maximumVerticesCountPerFace()
const;
151 QString mDescription;
152 MeshDriverCapabilities mCapabilities;
153 QString mWriteDatasetOnFileSuffix;
154 QString mWriteMeshFrameOnFileSuffix;
155 int mMaxVerticesPerFace = -1;
190 PriorityForUri = 1 << 0,
191 LayerTypesForUri = 1 << 1,
192 QuerySublayers = 1 << 2,
194 Q_DECLARE_FLAGS( ProviderMetadataCapabilities, ProviderMetadataCapability )
203 FileBasedUris = 1 << 0,
204 SaveLayerMetadata = 1 << 1,
206 Q_DECLARE_FLAGS( ProviderCapabilities, ProviderCapability )
220 QgsProviderMetadata( const QString &key, const QString &description, const QString &library = QString() );
245 QString description() const;
252 virtual QIcon icon() const;
274 virtual QList< QgsMapLayerType > supportedLayerTypes()
const;
282 PyObject *l = PyList_New( cppRes.size() );
288 for (
int i = 0; i < cppRes.size(); ++i )
290 PyObject *eobj = sipConvertFromEnum(
static_cast<int>( cppRes.at( i ) ),
291 sipType_QgsMapLayerType );
298 PyList_SetItem( l, i, eobj );
329 SIP_SKIP Q_DECL_DEPRECATED CreateDataProviderFunction createFunction() const;
335 virtual
void initProvider();
341 virtual
void cleanupProvider();
363 virtual QString filters( FilterType type );
370 virtual QList<QgsMeshDriverMetadata> meshDriversMetadata();
387 virtual int priorityForUri(
const QString &uri )
const;
399 virtual QList< QgsMapLayerType > validLayerTypesForUri(
const QString &uri )
const;
417 virtual bool uriIsBlocklisted(
const QString &uri )
const;
440 virtual QStringList sidecarFilesForUri(
const QString &uri )
const;
456 virtual QList< QgsProviderSublayerDetails > querySublayers(
const QString &uri, Qgis::SublayerQueryFlags flags = Qgis::SublayerQueryFlags(),
QgsFeedback *feedback =
nullptr )
const;
469 QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() )
SIP_FACTORY;
477 static
void setBoolParameter( QVariantMap &uri, const QString ¶meter, const QVariant &value );
485 static
bool boolParameter( const QVariantMap &uri, const QString ¶meter,
bool defaultValue = false );
500 QMap<int, int> &oldToNewAttrIdxMap,
501 QString &errorMessage,
502 const QMap<QString, QVariant> *options );
511 const QString &format,
516 double *geoTransform,
518 const QStringList &createOptions = QStringList() )
SIP_FACTORY;
524 virtual
bool createMeshData(
526 const QString &fileName,
527 const QString &driverName,
534 virtual
bool createMeshData(
543 virtual QList<QPair<QString, QString> > pyramidResamplingMethods();
562 virtual QVariantMap decodeUri( const QString &uri ) const;
572 virtual QString encodeUri( const QVariantMap &parts ) const;
587 virtual
int listStyles( const QString &uri, QStringList &ids, QStringList &names,
588 QStringList &descriptions, QString &errCause );
601 virtual
bool styleExists( const QString &uri, const QString &styleId, QString &errorCause
SIP_OUT );
610 virtual QString getStyleById( const QString &uri, const QString &styleId, QString &errCause );
616 virtual
bool deleteStyleById( const QString &uri, const QString &styleId, QString &errCause );
629 virtual
bool saveStyle( const QString &uri, const QString &qmlStyle, const QString &sldStyle,
630 const QString &styleName, const QString &styleDescription,
631 const QString &uiFileContent,
bool useAsDefault, QString &errCause );
637 virtual QString loadStyle( const QString &uri, QString &errCause );
659 virtual
bool createDb( const QString &dbPath, QString &errCause );
709 template <
typename T> QMap<QString, T *>connections(
bool cached =
true );
751 SIP_PYOBJECT __repr__();
753 QString
str = QStringLiteral(
"<QgsProviderMetadata: %1>" ).arg( sipCpp->key() );
754 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
766 void connectionCreated(
const QString &name );
774 void connectionDeleted(
const QString &name );
783 void connectionChanged(
const QString &name );
795 template <
class T_prov
ider_conn,
class T_conn> QMap<QString, QgsAbstractProviderConnection *> connectionsProtected(
bool cached =
true )
797 if ( ! cached || mProviderConnections.isEmpty() )
799 qDeleteAll( mProviderConnections );
800 mProviderConnections.clear();
801 const auto connNames { T_conn::connectionList() };
802 for (
const auto &cname : connNames )
804 mProviderConnections.insert( cname,
new T_provider_conn( cname ) );
807 return mProviderConnections;
810 template <
class T_prov
ider_conn>
void deleteConnectionProtected(
const QString &name )
812 T_provider_conn conn( name );
814 mProviderConnections.clear();
815 emit connectionDeleted( name );
819 QMap<QString, QgsAbstractProviderConnection *> mProviderConnections;
831 QString mDescription;
837 CreateDataProviderFunction mCreateFunction =
nullptr;
844 #endif //QGSPROVIDERMETADATA_H