QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include <QMap>
23 #include <QSet>
24 #include <QList>
25 #include <QStringList>
26 
27 #include "qgis.h"
28 #include "qgsmaplayer.h"
29 #include "qgsfeature.h"
30 #include "qgsfeatureiterator.h"
31 #include "qgseditorwidgetconfig.h"
32 #include "qgsfield.h"
33 #include "qgssnapper.h"
34 #include "qgsrelation.h"
36 
37 class QPainter;
38 class QImage;
39 
41 class QgsAttributeAction;
48 class QgsFeatureRequest;
49 class QgsGeometry;
50 class QgsGeometryCache;
51 class QgsGeometryVertexIndex;
52 class QgsLabel;
53 class QgsMapToPixel;
54 class QgsRectangle;
55 class QgsRectangle;
56 class QgsRelation;
57 class QgsRelationManager;
59 class QgsSymbolV2;
63 
66 
76 class CORE_EXPORT QgsAttributeEditorElement : public QObject
77 {
78  Q_OBJECT
79  public:
80 
82  {
86  AeTypeInvalid
87  };
88 
97  : QObject( parent ), mType( type ), mName( name ) {}
98 
101 
107  QString name() const { return mName; }
108 
114  AttributeEditorType type() const { return mType; }
115 
123  virtual QDomElement toDomElement( QDomDocument& doc ) const = 0;
124 
125  protected:
128 };
129 
135 {
136  public:
144  : QgsAttributeEditorElement( AeTypeContainer, name, parent )
145  , mIsGroupBox( true )
146  {}
147 
150 
158  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
159 
165  virtual void addChildElement( QgsAttributeEditorElement* element );
166 
172  virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
173 
179  virtual bool isGroupBox() const { return mIsGroupBox; }
180 
186  QList<QgsAttributeEditorElement*> children() const { return mChildren; }
187 
195  virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
196 
202  void setName( const QString& name );
203 
204  private:
205  bool mIsGroupBox;
207 };
208 
213 {
214  public:
222  QgsAttributeEditorField( QString name, int idx, QObject *parent )
223  : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx ) {}
224 
227 
235  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
236 
241  int idx() const { return mIdx; }
242 
243  private:
244  int mIdx;
245 };
246 
253 {
254  public:
262  QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent )
263  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
264  , mRelationId( relationId ) {}
265 
273  QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent )
274  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
275  , mRelationId( relation.id() )
276  , mRelation( relation ) {}
277 
280 
288  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
289 
295  const QgsRelation& relation() const { return mRelation; }
296 
303  bool init( QgsRelationManager *relManager );
304 
305  private:
306  QString mRelationId;
307  QgsRelation mRelation;
308 };
309 
310 
311 struct CORE_EXPORT QgsVectorJoinInfo
312 {
325 
330 
335 
336  bool operator==( const QgsVectorJoinInfo& other ) const
337  {
338  return targetFieldName == other.targetFieldName &&
339  joinLayerId == other.joinLayerId &&
340  joinFieldName == other.joinFieldName &&
341  joinFieldsSubset == other.joinFieldsSubset &&
342  memoryCache == other.memoryCache &&
343  prefix == other.prefix;
344  }
345 
348  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
351  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
352 
353 protected:
356 };
357 
620 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
621 {
622  Q_OBJECT
623 
624  public:
627  {
628  GeneratedLayout = 0,
629  TabLayout = 1,
630  UiFileLayout = 2
631  };
632 
636  enum EditType
637  {
659  };
660 
664  {
665  SuppressDefault = 0, // use the application-wide setting
666  SuppressOn = 1,
667  SuppressOff = 2
668  };
669 
670  struct RangeData
671  {
672  RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );}
673  RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
674  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
675 
679  };
680 
682  {
683  ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
684  ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
685  bool allowMulti = false,
686  QString filterExpression = QString::null )
687  : mLayer( layer )
688  , mKey( key )
689  , mValue( value )
690  , mFilterExpression( filterExpression )
691  , mAllowNull( allowNull )
692  , mOrderByValue( orderByValue )
693  , mAllowMulti( allowMulti )
694  {}
695 
702  bool mAllowMulti; /* allow selection of multiple keys */
703  };
704 
705  struct GroupData
706  {
709  : mName( name ), mFields( fields ) {}
712  };
713 
714  struct TabData
715  {
716  TabData() {}
718  : mName( name ), mFields( fields ), mGroups( groups ) {}
722  };
723 
737  QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
738  QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
739 
741  virtual ~QgsVectorLayer();
742 
744  QString storageType() const;
745 
747  QString capabilitiesString() const;
748 
750  QString dataComment() const;
751 
753  void setDisplayField( QString fldName = "" );
754 
756  const QString displayField() const;
757 
764  void setDisplayExpression( const QString &displayExpression );
765 
772  const QString displayExpression();
773 
775  QgsVectorDataProvider* dataProvider();
776 
780  const QgsVectorDataProvider* dataProvider() const;
781 
783  void setProviderEncoding( const QString& encoding );
784 
786  void setCoordinateSystem();
787 
791  bool addJoin( const QgsVectorJoinInfo& joinInfo );
792 
794  void removeJoin( const QString& joinLayerId );
795 
796  const QList<QgsVectorJoinInfo> vectorJoins() const;
797 
808  int addExpressionField( const QString& exp, const QgsField& fld );
809 
817  void removeExpressionField( int index );
818 
828  const QString expressionField( int index );
829 
839  void updateExpressionField( int index, const QString& exp );
840 
842  QgsLabel *label();
843 
844  const QgsLabel *label() const;
845 
846  QgsAttributeAction *actions() { return mActions; }
847 
853  int selectedFeatureCount();
854 
863  void select( QgsRectangle & rect, bool addToSelection );
864 
876  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
877 
879  void invertSelection();
880 
882  void selectAll();
883 
885  QgsFeatureIds allFeatureIds();
886 
894  void invertSelectionInRectangle( QgsRectangle & rect );
895 
904  QgsFeatureList selectedFeatures();
905 
917  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() );
918 
925  const QgsFeatureIds &selectedFeaturesIds() const;
926 
934  void setSelectedFeatures( const QgsFeatureIds &ids );
935 
937  QgsRectangle boundingBoxOfSelected();
938 
943  bool labelsEnabled() const;
944 
949  bool diagramsEnabled() const;
950 
952  void setDiagramRenderer( QgsDiagramRendererV2* r );
953  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
954 
955  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
956  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
957 
959  QgsFeatureRendererV2* rendererV2();
961  void setRendererV2( QgsFeatureRendererV2* r );
962 
964  QGis::GeometryType geometryType() const;
965 
967  bool hasGeometryType() const;
968 
970  QGis::WkbType wkbType() const;
971 
973  QString providerType() const;
974 
978  virtual bool readXml( const QDomNode& layer_node ) override;
979 
983  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
984 
993  virtual void saveStyleToDatabase( QString name, QString description,
994  bool useAsDefault, QString uiFileContent,
995  QString &msgError );
996 
1005  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
1006  QStringList &descriptions, QString &msgError );
1007 
1011  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
1012 
1019  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
1020 
1025  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
1026 
1037  virtual bool applyNamedStyle( QString namedStyle, QString &errorMsg );
1038 
1043  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
1044 
1050  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
1051 
1058  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
1059 
1060  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
1061  bool readSld( const QDomNode& node, QString& errorMessage ) override;
1062 
1070  virtual long featureCount() const;
1071 
1078  long featureCount( QgsSymbolV2* symbol );
1079 
1090  void setDataSource( QString dataSource, QString baseName, QString provider, bool loadDefaultStyleFlag = false );
1091 
1097  bool countSymbolFeatures( bool showProgress = true );
1098 
1106  virtual bool setSubsetString( QString subset );
1107 
1112  virtual QString subsetString();
1113 
1117  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
1118 
1124  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
1125 
1132  bool updateFeature( QgsFeature &f );
1133 
1138  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1139 
1144  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1145 
1148  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
1149 
1153  bool deleteSelectedFeatures( int *deletedCount = 0 );
1154 
1164  int addRing( const QList<QgsPoint>& ring );
1165 
1176  int addPart( const QList<QgsPoint>& ring );
1177 
1183  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1184 
1192  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1193 
1201  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1202 
1211  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
1212 
1218  int addTopologicalPoints( const QgsGeometry* geom );
1219 
1227  int addTopologicalPoints( const QgsPoint& p );
1228 
1234  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1235 
1239  Q_DECL_DEPRECATED void enableLabels( bool on );
1240 
1244  Q_DECL_DEPRECATED bool hasLabelsEnabled() const;
1245 
1247  virtual bool isEditable() const override;
1248 
1250  virtual bool isReadOnly() const;
1251 
1253  virtual bool isModified() const;
1254 
1261  bool snapPoint( QgsPoint& point, double tolerance );
1262 
1270  int snapWithContext( const QgsPoint& startPoint,
1271  double snappingTolerance,
1272  QMultiMap < double, QgsSnappingResult > &snappingResults,
1273  QgsSnapper::SnappingType snap_to );
1274 
1276  virtual void reload() override;
1277 
1281  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1282 
1286  bool draw( QgsRenderContext& rendererContext ) override;
1287 
1291  Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override;
1292 
1294  QgsRectangle extent() override;
1295 
1297  const QgsFields &pendingFields() const;
1298 
1300  QgsAttributeList pendingAllAttributesList();
1301 
1303  QgsAttributeList pendingPkAttributesList();
1304 
1306  int pendingFeatureCount();
1307 
1311  bool setReadOnly( bool readonly = true );
1312 
1314  bool startEditing();
1315 
1317  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1318 
1325  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1326 
1337  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1338 
1341  bool addAttribute( const QgsField &field );
1342 
1344  void addAttributeAlias( int attIndex, QString aliasString );
1345 
1347  void remAttributeAlias( int attIndex );
1348 
1352  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1353 
1361  const QString editorWidgetV2( int fieldIdx ) const;
1362 
1372  const QString editorWidgetV2( const QString& fieldName ) const;
1373 
1381  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
1382 
1392  const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
1393 
1397  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1401  void clearAttributeEditorWidgets();
1402 
1404  QString attributeAlias( int attributeIndex ) const;
1405 
1407  QString attributeDisplayName( int attributeIndex ) const;
1408 
1409  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1410 
1411  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1412  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1413 
1414  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1415  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1416 
1418  bool deleteAttribute( int attr );
1419 
1427  bool deleteAttributes( QList<int> attrs );
1428 
1430  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1431 
1433  bool deleteFeature( QgsFeatureId fid );
1434 
1450  bool commitChanges();
1451  const QStringList &commitErrors();
1452 
1456  bool rollBack( bool deleteBuffer = true );
1457 
1463  Q_DECL_DEPRECATED EditType editType( int idx );
1464 
1470  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1471 
1473  EditorLayout editorLayout();
1474 
1476  void setEditorLayout( EditorLayout editorLayout );
1477 
1506  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1507 
1523  void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config );
1524 
1530  Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
1531 
1533  QString editForm();
1534 
1536  void setEditForm( QString ui );
1537 
1540  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1541 
1544  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1545 
1547  QString annotationForm() const { return mAnnotationForm; }
1548 
1550  void setAnnotationForm( const QString& ui );
1551 
1553  QString editFormInit();
1554 
1556  void setEditFormInit( QString function );
1557 
1562  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1563 
1569  Q_DECL_DEPRECATED RangeData range( int idx );
1570 
1572  ValueRelationData valueRelation( int idx );
1573 
1580  QList<QgsRelation> referencingRelations( int idx );
1581 
1587  Q_DECL_DEPRECATED QString dateFormat( int idx );
1588 
1594  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1595 
1597  bool fieldEditable( int idx );
1598 
1600  bool labelOnTop( int idx );
1601 
1603  void setFieldEditable( int idx, bool editable );
1604 
1606  void setLabelOnTop( int idx, bool onTop );
1607 
1609  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1610 
1615  void beginEditCommand( QString text );
1616 
1618  void endEditCommand();
1619 
1621  void destroyEditCommand();
1622 
1624  int fieldNameIndex( const QString& fieldName ) const;
1625 
1628  {
1631  NoMarker
1632  };
1633 
1635  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1636 
1638  void updateFields();
1639 
1641  void createJoinCaches();
1642 
1647  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1648 
1650  QVariant minimumValue( int index );
1651 
1653  QVariant maximumValue( int index );
1654 
1663  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false );
1664 
1675  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = 0 );
1676 
1678  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1680  QPainter::CompositionMode featureBlendMode() const;
1681 
1683  void setLayerTransparency( int layerTransparency );
1685  int layerTransparency() const;
1686 
1687  QString metadata() override;
1688 
1690  inline QgsGeometryCache* cache() { return mCache; }
1691 
1695  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1699  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1700 
1705  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1706 
1707  public slots:
1715  void select( const QgsFeatureId &featureId );
1716 
1724  void select( const QgsFeatureIds& featureIds );
1725 
1733  void deselect( const QgsFeatureId featureId );
1734 
1742  void deselect( const QgsFeatureIds& featureIds );
1743 
1749  void removeSelection();
1750 
1754  virtual void updateExtents();
1755 
1757  void checkJoinLayerRemove( QString theLayerId );
1758 
1759  protected slots:
1760  void invalidateSymbolCountedFlag();
1761 
1762  signals:
1763 
1771  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1772 
1774  void selectionChanged();
1775 
1777  void layerModified();
1778 
1780  void beforeModifiedCheck() const;
1781 
1783  void editingStarted();
1784 
1786  void editingStopped();
1787 
1789  void beforeCommitChanges();
1790 
1792  void beforeRollBack();
1793 
1802  void attributeAdded( int idx );
1811  void attributeDeleted( int idx );
1817  void featureAdded( QgsFeatureId fid );
1826  void featureDeleted( QgsFeatureId fid );
1836  void featuresDeleted( QgsFeatureIds fids );
1841  void updatedFields();
1842  void layerDeleted();
1843 
1844  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1845  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1846 
1848  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1849  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1850  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1851  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1852  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1853  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1854 
1855  void saveLayerToProject();
1856 
1858  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1859 
1861  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1862 
1864  void layerTransparencyChanged( int layerTransparency );
1865 
1871  void editCommandStarted( const QString& text );
1872 
1878  void editCommandEnded();
1879 
1885  void editCommandDestroyed();
1886 
1896  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1897 
1907  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1908 
1909  private slots:
1910  void onRelationsLoaded();
1911  void onJoinedFieldsChanged();
1912  void onFeatureDeleted( const QgsFeatureId& fid );
1913 
1914  protected:
1916  void setExtent( const QgsRectangle &rect ) override;
1917 
1918  private: // Private methods
1919 
1921  QgsVectorLayer( const QgsVectorLayer & rhs );
1922 
1924  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1925 
1926 
1931  bool setDataProvider( QString const & provider );
1932 
1934  QgsFeatureId findFreeId();
1935 
1944  void snapToGeometry( const QgsPoint& startPoint,
1945  QgsFeatureId featureId,
1946  const QgsGeometry *geom,
1947  double sqrSnappingTolerance,
1948  QMultiMap<double, QgsSnappingResult>& snappingResults,
1949  QgsSnapper::SnappingType snap_to ) const;
1950 
1952  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1953 
1955  void readSldLabeling( const QDomNode& node );
1956 
1957  private: // Private attributes
1958 
1960  QgsVectorDataProvider *mDataProvider;
1961 
1963  QString mDisplayField;
1964 
1966  QString mDisplayExpression;
1967 
1969  QString mProviderKey;
1970 
1972  QgsAttributeAction* mActions;
1973 
1975  bool mReadOnly;
1976 
1981  QgsFeatureIds mSelectedFeatureIds;
1982 
1984  QgsFields mUpdatedFields;
1985 
1987  QMap< QString, QString > mAttributeAliasMap;
1988 
1990  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
1991 
1993  QSet<QString> mExcludeAttributesWMS;
1995  QSet<QString> mExcludeAttributesWFS;
1996 
1998  QList< TabData > mTabs;
1999 
2001  QGis::WkbType mWkbType;
2002 
2004  QgsFeatureRendererV2 *mRendererV2;
2005 
2007  QgsVectorSimplifyMethod mSimplifyMethod;
2008 
2010  QgsLabel *mLabel;
2011 
2013  bool mLabelOn;
2014 
2016  bool mLabelFontNotFoundNotified;
2017 
2019  QPainter::CompositionMode mFeatureBlendMode;
2020 
2022  int mLayerTransparency;
2023 
2025  bool mVertexMarkerOnlyForSelection;
2026 
2027  QStringList mCommitErrors;
2028 
2029  QMap< QString, bool> mFieldEditables;
2030  QMap< QString, bool> mLabelOnTop;
2031 
2032  QMap<QString, QString> mEditorWidgetV2Types;
2033  QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs;
2034 
2036  EditorLayout mEditorLayout;
2037 
2038  QString mEditForm, mEditFormInit;
2039 
2042  QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress;
2043 
2044  //annotation form for this layer
2045  QString mAnnotationForm;
2046 
2048  QgsGeometryCache* mCache;
2049 
2051  QgsVectorLayerEditBuffer* mEditBuffer;
2053 
2054  //stores information about joined layers
2055  QgsVectorLayerJoinBuffer* mJoinBuffer;
2056 
2058  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2059 
2060  //diagram rendering object. 0 if diagram drawing is disabled
2061  QgsDiagramRendererV2* mDiagramRenderer;
2062 
2063  //stores infos about diagram placement (placement type, priority, position distance)
2064  QgsDiagramLayerSettings *mDiagramLayerSettings;
2065 
2066  bool mValidExtent;
2067  bool mLazyExtent;
2068 
2069  // Features in renderer classes counted
2070  bool mSymbolFeatureCounted;
2071 
2072  // Feature counts for each renderer symbol
2073  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
2074 
2076  bool mEditCommandActive;
2077 
2078  QgsFeatureIds mDeletedFids;
2079 
2081 };
2082 
2083 #endif
virtual bool isEditable() const
True if the layer can be edited.
Wrapper for iterator of features from vector data provider or vector layer.
QString annotationForm() const
get annotation form
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:49
virtual ~QgsAttributeEditorContainer()
Destructor.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
void setExcludeAttributesWFS(const QSet< QString > &att)
This is an abstract base class for any elements of a drag and drop form.
virtual QString metadata()
Obtain Metadata for this layer.
QString targetFieldName
Join field in the target layer.
virtual void drawLabels(QgsRenderContext &rendererContext)
Draw labels.
GeometryType
Definition: qgis.h:155
virtual bool isGroupBox() const
Returns if this ccontainer is going to be rendered as a group box.
RangeData(QVariant theMin, QVariant theMax, QVariant theStep)
QgsAttributeAction * actions()
EditorLayout
The different types to layout the attribute editor.
The attribute value should not be changed in the attribute form.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:408
Manages an editor widget Widget and wrapper share the same parent.
void setExcludeAttributesWMS(const QSet< QString > &att)
int joinFieldIndex
Join field index in the source layer.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage)=0
Read the symbology for the current layer from the Dom node supplied.
Storage and management of actions associated with Qgis layer attributes.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:129
VertexMarkerType
Editing vertex markers.
QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfield.h:173
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:75
This element will load a field's widget onto the form.
WkbType
Used for symbology operations.
Definition: qgis.h:53
virtual ~QgsAttributeEditorElement()
Destructor.
This element will load a relation editor onto the form.
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
Definition: qgsmaplayer.h:134
const QgsRelation & relation() const
Get the id of the relation which shall be embedded.
bool memoryCache
True if the join is cached in virtual memory.
int targetFieldIndex
Join field index in the target layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:162
const QgsDiagramLayerSettings * diagramLayerSettings() const
QgsAttributeEditorField(QString name, int idx, QObject *parent)
Creates a new attribute editor element which represents a field.
int idx() const
Return the index of the field.
TabData(QString name, QList< QString > fields, QList< GroupData > groups)
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
QgsAttributeEditorRelation(QString name, const QString &relationId, QObject *parent)
Creates a new element which embeds a relation.
Returns diagram settings for a feature.
QString name() const
Return the name of this element.
Manages joined fields for a vector layer.
virtual bool draw(QgsRenderContext &rendererContext)
This is the method that does the actual work of drawing the layer onto a paint device.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:66
QString prefix
An optional prefix.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
void setJoinFieldNamesSubset(QStringList *fieldNamesSubset)
Set subset of fields to be used from joined layer.
bool operator==(const QgsVectorJoinInfo &other) const
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document)
called by writeLayerXML(), used by children to write state specific to them to project files...
The attribute value should not be shown in the attribute form.
const QSet< QString > & excludeAttributesWFS() const
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
AttributeEditorType type() const
The type of this element.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
virtual ~QgsAttributeEditorField()
Destructor.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:38
const QMap< QString, QString > & attributeAliases() const
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
Definition: qgspoint.h:63
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:353
void setName(const char *name)
virtual ~QgsAttributeEditorRelation()
Destructor.
QList< QgsAttributeEditorElement * > children() const
Get a list of the children elements of this container.
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
QList< QString > mFields
A class to render labels.
Definition: qgslabel.h:51
uuid generator - readonly and automatically intialized
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
ValueRelationData(QString layer, QString key, QString value, bool allowNull, bool orderByValue, bool allowMulti=false, QString filterExpression=QString::null)
Buffers information about expression fields for a vector layer.
virtual QDomElement toDomElement(QDomDocument &doc) const =0
Is reimplemented in classes inheriting from this to serialize it.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
GroupData(QString name, QList< QString > fields)
virtual void setIsGroupBox(bool isGroupBox)
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
This class manages a set of relations between layers.
virtual bool readXml(const QDomNode &layer_node)
called by readLayerXML(), used by children to read state specific to them from project files...
QgsAttributeEditorRelation(QString name, const QgsRelation &relation, QObject *parent)
Creates a new element which embeds a relation.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Base class for utility classes that encapsulate information necessary for rendering of map layers...
void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
virtual QString loadNamedStyle(const QString &theURI, bool &theResultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
QList< QString > mFields
QgsAttributeEditorElement(AttributeEditorType type, QString name, QObject *parent=NULL)
Constructor.
QSet< int > QgsAttributeIds
QgsAttributeEditorContainer(QString name, QObject *parent)
Creates a new attribute editor container.
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
QList< int > QgsAttributeList
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
modularized edit widgets
QString joinLayerId
Source layer.
value map from an table
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
QList< GroupData > mGroups