19 #ifndef QGSPROVIDERMETADATA_H
20 #define QGSPROVIDERMETADATA_H
24 #include <QVariantMap>
32 #include "qgis_core.h"
63 CanWriteFaceDatasets = 1 << 0,
64 CanWriteVertexDatasets = 1 << 1,
65 CanWriteEdgeDatasets = 1 << 2,
68 Q_ENUM( MeshDriverCapability )
69 Q_DECLARE_FLAGS( MeshDriverCapabilities, MeshDriverCapability )
70 Q_FLAG( MeshDriverCapabilities )
83 const QString &description,
84 const MeshDriverCapabilities &capabilities );
89 MeshDriverCapabilities capabilities()
const;
99 QString description()
const;
103 QString mDescription;
104 MeshDriverCapabilities mCapabilities;
107 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMeshDriverMetadata::MeshDriverCapabilities )
144 QgsProviderMetadata(
const QString &key,
const QString &description,
const QString &library = QString() );
169 QString description()
const;
193 virtual
void initProvider();
199 virtual
void cleanupProvider();
220 virtual QString filters( FilterType type );
227 virtual QList<QgsMeshDriverMetadata> meshDriversMetadata();
241 static void setBoolParameter( QVariantMap &uri,
const QString ¶meter,
const QVariant &value );
249 static bool boolParameter(
const QVariantMap &uri,
const QString ¶meter,
bool defaultValue =
false );
264 QMap<int, int> &oldToNewAttrIdxMap,
265 QString &errorMessage,
266 const QMap<QString, QVariant> *options );
275 const QString &format,
280 double *geoTransform,
282 const QStringList &createOptions = QStringList() )
SIP_FACTORY;
288 virtual QList<QPair<QString, QString> > pyramidResamplingMethods();
307 virtual QVariantMap decodeUri( const QString &uri );
317 virtual QString encodeUri( const QVariantMap &parts );
332 virtual
int listStyles( const QString &uri, QStringList &ids, QStringList &names,
333 QStringList &descriptions, QString &errCause );
339 virtual QString getStyleById( const QString &uri, QString styleId, QString &errCause );
345 virtual
bool deleteStyleById( const QString &uri, QString styleId, QString &errCause );
351 virtual
bool saveStyle( const QString &uri, const QString &qmlStyle, const QString &sldStyle,
352 const QString &styleName, const QString &styleDescription,
353 const QString &uiFileContent,
bool useAsDefault, QString &errCause );
359 virtual QString loadStyle( const QString &uri, QString &errCause );
365 virtual
bool createDb( const QString &dbPath, QString &errCause );
415 template <
typename T> QMap<QString, T *>connections(
bool cached =
true );
464 void connectionCreated(
const QString &name );
472 void connectionDeleted(
const QString &name );
481 void connectionChanged(
const QString &name );
493 template <
class T_prov
ider_conn,
class T_conn> QMap<QString, QgsAbstractProviderConnection *> connectionsProtected(
bool cached =
true )
495 if ( ! cached || mProviderConnections.isEmpty() )
497 qDeleteAll( mProviderConnections );
498 mProviderConnections.clear();
499 const auto connNames { T_conn::connectionList() };
500 for (
const auto &cname : connNames )
502 mProviderConnections.insert( cname,
new T_provider_conn( cname ) );
505 return mProviderConnections;
508 template <
class T_prov
ider_conn>
void deleteConnectionProtected(
const QString &name )
510 T_provider_conn conn( name );
512 mProviderConnections.clear();
513 emit connectionDeleted( name );
517 QMap<QString, QgsAbstractProviderConnection *> mProviderConnections;
528 QString mDescription;
534 CreateDataProviderFunction mCreateFunction =
nullptr;
538 #endif //QGSPROVIDERMETADATA_H