Skip to content
Permalink
Browse files

Python bindings

  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent 82d1871 commit 826c44092b8fbe07ddd65f391836826387657111
@@ -61,6 +61,8 @@
%Include qgsfield.sip
%Include qgsfieldconstraints.sip
%Include qgsfields.sip
%Include qgsfieldkitregistry.sip
%Include qgsfieldkit.sip
%Include qgsgeometrysimplifier.sip
%Include qgsgeometryvalidator.sip
%Include qgsgml.sip
@@ -242,6 +244,14 @@
%Include gps/qgsnmeaconnection.sip
%Include gps/qgsqtlocationconnection.sip

%Include fieldkit/qgsdatetimefieldkit.sip
%Include fieldkit/qgsfallbackfieldkit.sip
%Include fieldkit/qgskeyvaluefieldkit.sip
%Include fieldkit/qgslistfieldkit.sip
%Include fieldkit/qgsrelationreferencefieldkit.sip
%Include fieldkit/qgsvaluemapfieldkit.sip
%Include fieldkit/qgsvaluerelationfieldkit.sip

%Include layertree/qgslayertree.sip
%Include layertree/qgslayertreegroup.sip
%Include layertree/qgslayertreelayer.sip
@@ -0,0 +1,29 @@
/***************************************************************************
qgsdatetimefieldkit.sip - QgsDateTimeFieldKit

---------------------
begin : 2.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsDateTimeFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsdatetimefieldkit.h"
%End
public:
QgsDateTimeFieldKit();

QString id() const;

virtual QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;

static QString defaultFormat( const QVariant::Type type );
};
@@ -0,0 +1,9 @@
class QgsFallbackFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsfallbackfieldkit.h"
%End
public:
QgsFallbackFieldKit();
QString id() const;
};
@@ -0,0 +1,25 @@
/***************************************************************************
qgskeyvaluefieldkit.sip - QgsKeyValueFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsKeyValueFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgskeyvaluefieldkit"
%End
public:
QgsKeyValueFieldKit();
QString id() const;
QString representValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
};
@@ -0,0 +1,28 @@
/***************************************************************************
qgslistfieldkit.sip - QgsListFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsListFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgslistfieldkit.h"
%End

public:
QgsListFieldKit();

QString id() const;

QString representValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
};
@@ -0,0 +1,30 @@
/***************************************************************************
qgsrelationreferencefieldkit.sip - QgsRelationReferenceFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

class QgsRelationReferenceFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsrelationreferencefieldkit"
%End
public:
QgsRelationReferenceFieldKit();

QString id() const;

virtual QString representValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const override;

virtual QVariant sortValue( QgsVectorLayer *vl, int fieldIdx, const QVariantMap&config, const QVariant& cache, const QVariant& value ) const override;
};
@@ -0,0 +1,29 @@
/***************************************************************************
qgsvaluemapfieldkit.sip - QgsValueMapFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsValueMapFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsvaluemapfieldkit.h"
%End
public:
QgsValueMapFieldKit();

QString id() const;

QString representValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;

QVariant sortValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
};
@@ -0,0 +1,45 @@
/***************************************************************************
qgsvaluerelationfieldkit.sip - QgsValueRelationFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsValueRelationFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsvaluerelationfieldkit"
%End

public:
struct ValueRelationItem
{
ValueRelationItem( const QVariant& key, const QString& value );

ValueRelationItem();

QVariant key;
QString value;
};

typedef QVector < ValueRelationItem > ValueRelationCache;

QgsValueRelationFieldKit();

QString id() const;
QString representValue( QgsVectorLayer *layer, int fieldIdx, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;

QVariant sortValue( QgsVectorLayer *vl, int fieldIdx, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;

QVariant createCache( QgsVectorLayer *vl, int fieldIdx, const QVariantMap &config ) const;

static ValueRelationCache createCache( const QVariantMap& config );
};
@@ -0,0 +1,35 @@
/***************************************************************************
qgsfieldkit.sip - QgsFieldKit

---------------------
begin : 2.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsFieldKit
{
%TypeHeaderCode
#include "qgsfieldkit.h"
%End
public:
QgsFieldKit();

virtual ~QgsFieldKit();

virtual QString id() const = 0;

virtual QString representValue( QgsVectorLayer* layer, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;

virtual QVariant sortValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;

virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config ) const;

virtual QVariant createCache( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config ) const;
};
@@ -0,0 +1,36 @@
/***************************************************************************
qgsfieldkitregistry.sip - QgsFieldKitRegistry

---------------------
begin : 2.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsFieldKitRegistry : QObject
{
%TypeHeaderCode
#include "qgsfieldkitregistry.h"
%End
public:

QgsFieldKitRegistry();
~QgsFieldKitRegistry();

void addFieldKit( QgsFieldKit* kit /Transfer/ );

void removeFieldKit( QgsFieldKit* kit );

QgsFieldKit* fieldKit( const QString& id ) const;

signals:
void fieldKitAdded( QgsFieldKit* kit );

void fieldKitRemoved( QgsFieldKit* kit );
};

0 comments on commit 826c440

Please sign in to comment.
You can’t perform that action at this time.