Skip to content

Commit

Permalink
fix warnings, add copyright headers, cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 28, 2013
1 parent 74ace4a commit 4cbec18
Show file tree
Hide file tree
Showing 47 changed files with 1,067 additions and 571 deletions.
14 changes: 14 additions & 0 deletions python/core/qgsdataprovider.sip
Expand Up @@ -208,4 +208,18 @@ class QgsDataProvider : QObject
*/
void fullExtentCalculated();

/**
* This is emitted whenever an asynchronous operation has finished
* and the data should be redrawn
* @note added in 1.5
*/
void dataChanged();

/**
* This is emitted whenever data or metadata (e.g. color table, extent) has changed
* @param changed binary combination of changes
* @note added in 1.7
*/
void dataChanged( int changed );

};
3 changes: 2 additions & 1 deletion python/core/qgsfeature.sip
@@ -1,4 +1,5 @@

typedef qint64 QgsFeatureId;

// key = field index, value = field value
typedef QMap<int, QVariant> QgsAttributeMap;
Expand Down Expand Up @@ -189,6 +190,6 @@ class QgsFeature
*/
int fieldNameIndex( const QString& fieldName ) const;


}; // class QgsFeature

typedef QSet<QgsFeatureId> QgsFeatureIds;
6 changes: 3 additions & 3 deletions python/core/qgsfeaturerequest.sip
Expand Up @@ -16,9 +16,9 @@ class QgsFeatureRequest

enum FilterType
{
FilterNone, //!< No filter is applied
FilterRect, //!< Filter using a rectangle
FilterFid //!< Filter using feature ID
FilterNone, //!< No filter is applied
FilterRect, //!< Filter using a rectangle
FilterFid //!< Filter using feature ID
};

//! construct a default request: for all features get attributes and geometries
Expand Down
59 changes: 33 additions & 26 deletions python/core/qgsvectordataprovider.sip
Expand Up @@ -7,28 +7,28 @@ class QgsVectorDataProvider : QgsDataProvider

public:

// If you add to this, please also add to capabilitiesString()
/**
* enumeration with capabilities that providers might implement
*/
enum Capability
{
NoCapabilities = 0,
AddFeatures = 1,
DeleteFeatures = 2,
ChangeAttributeValues = 4,
AddAttributes = 8,
DeleteAttributes = 16,
SaveAsShapefile = 32,
CreateSpatialIndex = 64,
SelectAtId = 128,
ChangeGeometries = 256,
SelectGeometryAtId = 512,
RandomSelectGeometryAtId = 1024,
SequentialSelectGeometryAtId = 2048,
CreateAttributeIndex = 4096,
SetEncoding = 8192,
};
// If you add to this, please also add to capabilitiesString()
/**
* enumeration with capabilities that providers might implement
*/
enum Capability
{
NoCapabilities = 0,
AddFeatures = 1,
DeleteFeatures = 2,
ChangeAttributeValues = 4,
AddAttributes = 8,
DeleteAttributes = 16,
SaveAsShapefile = 32,
CreateSpatialIndex = 64,
SelectAtId = 128,
ChangeGeometries = 256,
SelectGeometryAtId = 512,
RandomSelectGeometryAtId = 1024,
SequentialSelectGeometryAtId = 2048,
CreateAttributeIndex = 4096,
SetEncoding = 8192,
};

/** bitmask of all provider's editing capabilities */
static const int EditingCapabilities;
Expand Down Expand Up @@ -120,7 +120,7 @@ class QgsVectorDataProvider : QgsDataProvider
* Adds a list of features
* @return true in case of success and false in case of failure
*/
virtual bool addFeatures( QList<QgsFeature> & flist /In,Out/ );
virtual bool addFeatures( QList<QgsFeature> &flist /In,Out/ );

/**
* Deletes one or more features
Expand Down Expand Up @@ -158,9 +158,10 @@ class QgsVectorDataProvider : QgsDataProvider

/**
* Changes geometries of existing features
* @param geometry_map A std::map containing the feature IDs to change the geometries of.
* the second map parameter being the new geometries themselves
* @return true in case of success and false in case of failure
* @param geometry_map A QgsGeometryMap whose index contains the feature IDs
* that will have their geometries changed.
* The second map parameter being the new geometries themselves
* @return True in case of success and false in case of failure
*/
virtual bool changeGeometryValues( QMap<qint64, QgsGeometry> & geometry_map );

Expand Down Expand Up @@ -208,6 +209,12 @@ class QgsVectorDataProvider : QgsDataProvider
*/
QList<int> attributeIndexes();

/**
* Return list of indexes of fields that make up the primary key
* @note added in 2.0
*/
virtual QList<int> pkAttributeIndexes();

/**
* Set whether provider should also return features that don't have
* associated geometry. false by default
Expand Down
150 changes: 124 additions & 26 deletions python/core/qgsvectorlayer.sip
@@ -1,9 +1,63 @@

typedef QList<int> QgsAttributeList;
typedef QSet<qint64> QgsFeatureIds;
typedef QSet<int> QgsAttributeIds;
typedef qint64 QgsFeatureId;

/** @note Added in 1.9 */
class QgsAttributeEditorElement : QObject
{
%TypeHeaderCode
#include "qgsvectorlayer.h"
%End

public:

enum AttributeEditorType
{
AeTypeContainer,
AeTypeField,
AeTypeInvalid
};

QgsAttributeEditorElement( AttributeEditorType type, QString name, QObject *parent = NULL );

virtual ~QgsAttributeEditorElement();

QString name() const;
AttributeEditorType type() const;

virtual QDomElement toDomElement( QDomDocument& doc ) const = 0;
};

/** @note Added in 1.9 */
class QgsAttributeEditorContainer : QgsAttributeEditorElement
{
%TypeHeaderCode
#include "qgsvectorlayer.h"
%End

public:
QgsAttributeEditorContainer( QString name, QObject *parent );
~QgsAttributeEditorContainer();

virtual QDomElement toDomElement( QDomDocument& doc ) const;
virtual void addChildElement( QgsAttributeEditorElement *widget );
QList<QgsAttributeEditorElement*> children() const;
};

/** @note Added in 1.9 */
class QgsAttributeEditorField : QgsAttributeEditorElement
{
%TypeHeaderCode
#include "qgsvectorlayer.h"
%End

public:
QgsAttributeEditorField( QString name , int idx, QObject *parent );
~QgsAttributeEditorField();

virtual QDomElement toDomElement( QDomDocument& doc ) const;
int idx() const;
};

/** @note added in 1.7 */
struct QgsVectorJoinInfo
Expand Down Expand Up @@ -52,6 +106,13 @@ class QgsVectorLayer : QgsMapLayer
}
%End

enum EditorLayout
{
GeneratedLayout,
TabLayout,
UiFileLayout,
};

enum EditType
{
LineEdit,
Expand All @@ -73,13 +134,6 @@ class QgsVectorLayer : QgsMapLayer
UuidGenerator, /* uuid generator - readonly and automatically intialized @added in 1.9 */
};

enum EditorLayout
{
GeneratedLayout,
TabLayout,
UiFileLayout,
};

struct RangeData
{
RangeData();
Expand Down Expand Up @@ -108,6 +162,23 @@ class QgsVectorLayer : QgsMapLayer
bool mAllowMulti; /* allow selection of multiple keys @added in 1.9 */
};

struct GroupData
{
GroupData();
GroupData( QString name , QList<QString> fields );
QString mName;
QList<QString> mFields;
};

struct TabData
{
TabData();
TabData( QString name , QList<QString> fields , QList<QgsVectorLayer::GroupData> groups );
QString mName;
QList<QString> mFields;
QList<QgsVectorLayer::GroupData> mGroups;
};

/** Constructor */
QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
Expand Down Expand Up @@ -250,6 +321,12 @@ class QgsVectorLayer : QgsMapLayer
*/
virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );

/** convert a saved attribute editor element into a AttributeEditor structure as it's used internally.
* @param elem the DOM element
* @param parent the QObject which will own this object
*/
QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );

/** Read the symbology for the current layer from the Dom node supplied.
* @param node node that will contain the symbology definition for this layer.
* @param errorMessage reference to string that will be updated with any error messages
Expand Down Expand Up @@ -277,6 +354,21 @@ class QgsVectorLayer : QgsMapLayer
*/
virtual long featureCount() const;

/**
* Number of features rendered with specified symbol. Features must be first
* calculated by countSymbolFeatures()
* @param symbol the symbol
* @return number of features rendered by symbol or -1 if failed or counts are not available
*/
long featureCount( QgsSymbolV2* symbol );

/**
* Count features for symbols. Feature counts may be get by featureCount( QgsSymbolV2*).
* @param showProgress show progress dialog
* @return true if calculated, false if failed or was canceled by user
*/
bool countSymbolFeatures( bool showProgress = true );

/**
* Set the string (typically sql) used to define a subset of the layer
* @param subset The subset string. This may be the where clause of a sql statement
Expand Down Expand Up @@ -362,7 +454,8 @@ class QgsVectorLayer : QgsMapLayer
2 ring not closed,
3 ring not valid,
4 ring crosses existing rings,
5 no feature found where ring can be inserted*/
5 no feature found where ring can be inserted
6 layer not editable */
int addRing( const QList<QgsPoint>& ring );

/**Adds a new part polygon to a multipart feature
Expand All @@ -373,7 +466,8 @@ class QgsVectorLayer : QgsMapLayer
3 if new polygon ring not disjoint with existing rings,
4 if no feature was selected,
5 if several features are selected,
6 if selected geometry not found*/
6 if selected geometry not found
7 layer not editable */
int addPart( const QList<QgsPoint>& ring );

/**Translates feature by dx, dy
Expand Down Expand Up @@ -481,6 +575,11 @@ class QgsVectorLayer : QgsMapLayer
/** returns list of attributes */
QList<int> pendingAllAttributesList();

/** returns list of attribute making up the primary key
* @note added in 2.0
*/
QList<int> pendingPkAttributesList();

/** returns feature count after commit */
int pendingFeatureCount();

Expand Down Expand Up @@ -509,6 +608,16 @@ class QgsVectorLayer : QgsMapLayer
@note added in version 1.2*/
void addAttributeAlias( int attIndex, QString aliasString );

/**Adds a tab (for the attribute editor form) holding groups and fields
@note added in version 1.9*/
void addAttributeEditorWidget( QgsAttributeEditorElement* data );
/**Returns a list of tabs holding groups and fields
@note added in version 1.9*/
QList< QgsAttributeEditorElement* > &attributeEditorElements();
/**Clears all the tabs for the attribute editor form
@note added in version 1.9*/
void clearAttributeEditorWidgets();

/**Returns the alias of an attribute name or an empty string if there is no alias
@note added in version 1.2*/
QString attributeAlias( int attributeIndex ) const;
Expand Down Expand Up @@ -561,11 +670,11 @@ class QgsVectorLayer : QgsMapLayer
/**set edit type*/
void setEditType( int idx, EditType edit );

/**get editor layout**/
/** get the active layout for the attribute editor for this layer (added in 1.9) */
EditorLayout editorLayout();

/**set editor layout*/
void setEditorLayout( EditorLayout layout );
/** set the active layout for the attribute editor for this layer (added in 1.9) */
void setEditorLayout( EditorLayout editorLayout );

/** set string representing 'true' for a checkbox (added in 1.4) */
void setCheckedState( int idx, QString checked, QString notChecked );
Expand Down Expand Up @@ -625,7 +734,6 @@ class QgsVectorLayer : QgsMapLayer
*/
QgsVectorOverlay* findOverlayByType( const QString& typeName );


//! Buffer with uncommitted editing operations. Only valid after editing has been turned on.
QgsVectorLayerEditBuffer* editBuffer();

Expand All @@ -641,16 +749,6 @@ class QgsVectorLayer : QgsMapLayer
/** Destroy active command and reverts all changes in it */
void destroyEditCommand();

/** Execute undo operation. To be called only from QgsVectorLayerUndoCommand.
* @note not available in python bindings
*/
// void undoEditCommand( QgsUndoCommand* cmd );

/** Execute redo operation. To be called only from QgsVectorLayerUndoCommand.
* @note not available in python bindings
*/
// void redoEditCommand( QgsUndoCommand* cmd );

/** Returns the index of a field name or -1 if the field does not exist
@note this method was added in version 1.4
*/
Expand Down Expand Up @@ -732,7 +830,7 @@ class QgsVectorLayer : QgsMapLayer

/** Signals emitted after committing changes
\note added in v1.6 */
void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributeIds );
void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
Expand Down

0 comments on commit 4cbec18

Please sign in to comment.