QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 #include <QFont>
27 
28 #include "qgis.h"
29 #include "qgsmaplayer.h"
30 #include "qgsfeature.h"
31 #include "qgsfeatureiterator.h"
32 #include "qgseditorwidgetconfig.h"
33 #include "qgsfield.h"
34 #include "qgssnapper.h"
35 #include "qgsrelation.h"
37 
38 class QPainter;
39 class QImage;
40 
42 class QgsAttributeAction;
45 class QgsCurveV2;
51 class QgsFeatureRequest;
52 class QgsGeometry;
53 class QgsGeometryCache;
54 class QgsGeometryVertexIndex;
55 class QgsLabel;
56 class QgsMapToPixel;
57 class QgsRectangle;
58 class QgsRectangle;
59 class QgsRelation;
60 class QgsRelationManager;
62 class QgsSymbolV2;
66 class QgsPointV2;
67 
70 
71 
81 class CORE_EXPORT QgsAttributeEditorElement : public QObject
82 {
83  Q_OBJECT
84  public:
85 
87  {
91  AeTypeInvalid
92  };
93 
102  : QObject( parent ), mType( type ), mName( name ) {}
103 
106 
112  QString name() const { return mName; }
113 
119  AttributeEditorType type() const { return mType; }
120 
128  virtual QDomElement toDomElement( QDomDocument& doc ) const = 0;
129 
130  protected:
133 };
134 
140 {
141  public:
149  : QgsAttributeEditorElement( AeTypeContainer, name, parent )
150  , mIsGroupBox( true )
151  {}
152 
155 
163  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
164 
170  virtual void addChildElement( QgsAttributeEditorElement* element );
171 
177  virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
178 
184  virtual bool isGroupBox() const { return mIsGroupBox; }
185 
191  QList<QgsAttributeEditorElement*> children() const { return mChildren; }
192 
200  virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
201 
207  void setName( const QString& name );
208 
209  private:
210  bool mIsGroupBox;
212 };
213 
218 {
219  public:
227  QgsAttributeEditorField( QString name, int idx, QObject *parent )
228  : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx ) {}
229 
232 
240  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
241 
246  int idx() const { return mIdx; }
247 
248  private:
249  int mIdx;
250 };
251 
258 {
259  public:
267  QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent )
268  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
269  , mRelationId( relationId ) {}
270 
278  QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent )
279  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
280  , mRelationId( relation.id() )
281  , mRelation( relation ) {}
282 
285 
293  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
294 
300  const QgsRelation& relation() const { return mRelation; }
301 
308  bool init( QgsRelationManager *relManager );
309 
310  private:
311  QString mRelationId;
312  QgsRelation mRelation;
313 };
314 
315 
316 struct CORE_EXPORT QgsVectorJoinInfo
317 {
330 
335 
340 
341  bool operator==( const QgsVectorJoinInfo& other ) const
342  {
343  return targetFieldName == other.targetFieldName &&
344  joinLayerId == other.joinLayerId &&
345  joinFieldName == other.joinFieldName &&
346  joinFieldsSubset == other.joinFieldsSubset &&
347  memoryCache == other.memoryCache &&
348  prefix == other.prefix;
349  }
350 
353  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
356  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
357 
358 protected:
361 };
362 
363 
364 
627 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
628 {
629  Q_OBJECT
630 
631  public:
634  {
635  GeneratedLayout = 0,
636  TabLayout = 1,
637  UiFileLayout = 2
638  };
639 
643  enum EditType
644  {
666  };
667 
671  {
672  SuppressDefault = 0, // use the application-wide setting
673  SuppressOn = 1,
674  SuppressOff = 2
675  };
676 
677  struct RangeData
678  {
679  RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );}
680  RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
681  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
682 
686  };
687 
689  {
690  ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
691  ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
692  bool allowMulti = false,
693  QString filterExpression = QString::null )
694  : mLayer( layer )
695  , mKey( key )
696  , mValue( value )
697  , mFilterExpression( filterExpression )
698  , mAllowNull( allowNull )
699  , mOrderByValue( orderByValue )
700  , mAllowMulti( allowMulti )
701  {}
702 
709  bool mAllowMulti; /* allow selection of multiple keys */
710  };
711 
712  struct GroupData
713  {
716  : mName( name ), mFields( fields ) {}
719  };
720 
721  struct TabData
722  {
723  TabData() {}
725  : mName( name ), mFields( fields ), mGroups( groups ) {}
729  };
730 
744  QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
745  QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
746 
748  virtual ~QgsVectorLayer();
749 
751  QString storageType() const;
752 
754  QString capabilitiesString() const;
755 
757  QString dataComment() const;
758 
760  void setDisplayField( QString fldName = "" );
761 
763  const QString displayField() const;
764 
771  void setDisplayExpression( const QString &displayExpression );
772 
779  const QString displayExpression();
780 
782  QgsVectorDataProvider* dataProvider();
783 
787  const QgsVectorDataProvider* dataProvider() const;
788 
790  void setProviderEncoding( const QString& encoding );
791 
793  void setCoordinateSystem();
794 
798  bool addJoin( const QgsVectorJoinInfo& joinInfo );
799 
801  void removeJoin( const QString& joinLayerId );
802 
803  const QList<QgsVectorJoinInfo> vectorJoins() const;
804 
815  int addExpressionField( const QString& exp, const QgsField& fld );
816 
824  void removeExpressionField( int index );
825 
835  const QString expressionField( int index );
836 
846  void updateExpressionField( int index, const QString& exp );
847 
849  QgsLabel *label();
850 
851  const QgsLabel *label() const;
852 
853  QgsAttributeAction *actions() { return mActions; }
854 
860  int selectedFeatureCount();
861 
870  void select( QgsRectangle & rect, bool addToSelection );
871 
883  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
884 
886  void invertSelection();
887 
889  void selectAll();
890 
892  QgsFeatureIds allFeatureIds();
893 
901  void invertSelectionInRectangle( QgsRectangle & rect );
902 
911  QgsFeatureList selectedFeatures();
912 
924  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() );
925 
932  const QgsFeatureIds &selectedFeaturesIds() const;
933 
941  void setSelectedFeatures( const QgsFeatureIds &ids );
942 
944  QgsRectangle boundingBoxOfSelected();
945 
950  bool labelsEnabled() const;
951 
956  bool diagramsEnabled() const;
957 
959  void setDiagramRenderer( QgsDiagramRendererV2* r );
960  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
961 
962  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
963  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
964 
966  QgsFeatureRendererV2* rendererV2() { return mRendererV2; }
967 
969  const QgsFeatureRendererV2* rendererV2() const { return mRendererV2; }
970 
972  void setRendererV2( QgsFeatureRendererV2* r );
973 
975  QGis::GeometryType geometryType() const;
976 
978  bool hasGeometryType() const;
979 
981  QGis::WkbType wkbType() const;
982 
984  QString providerType() const;
985 
989  virtual bool readXml( const QDomNode& layer_node ) override;
990 
994  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
995 
1004  virtual void saveStyleToDatabase( QString name, QString description,
1005  bool useAsDefault, QString uiFileContent,
1006  QString &msgError );
1007 
1016  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
1017  QStringList &descriptions, QString &msgError );
1018 
1022  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
1023 
1030  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
1031 
1036  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
1037 
1048  virtual bool applyNamedStyle( QString namedStyle, QString &errorMsg );
1049 
1054  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
1055 
1061  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
1062 
1069  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
1070 
1071  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
1072  bool readSld( const QDomNode& node, QString& errorMessage ) override;
1073 
1080  long featureCount( QgsSymbolV2* symbol );
1081 
1092  void setDataSource( QString dataSource, QString baseName, QString provider, bool loadDefaultStyleFlag = false );
1093 
1099  bool countSymbolFeatures( bool showProgress = true );
1100 
1108  virtual bool setSubsetString( QString subset );
1109 
1114  virtual QString subsetString();
1115 
1119  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
1120 
1126  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
1127 
1134  bool updateFeature( QgsFeature &f );
1135 
1140  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1141 
1146  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1147 
1152  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
1153 
1156  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
1157 
1161  bool deleteSelectedFeatures( int *deletedCount = 0 );
1162 
1172  int addRing( const QList<QgsPoint>& ring );
1173 
1180  int addRing( QgsCurveV2* ring );
1181 
1192  int addPart( const QList<QgsPoint>& ring );
1193 
1194  int addPart( QgsCurveV2* ring );
1195 
1201  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1202 
1210  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1211 
1219  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1220 
1229  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
1230 
1236  int addTopologicalPoints( const QgsGeometry* geom );
1237 
1245  int addTopologicalPoints( const QgsPoint& p );
1246 
1252  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1253 
1257  Q_DECL_DEPRECATED void enableLabels( bool on );
1258 
1262  Q_DECL_DEPRECATED bool hasLabelsEnabled() const;
1263 
1265  virtual bool isEditable() const override;
1266 
1268  virtual bool isReadOnly() const;
1269 
1271  virtual bool isModified() const;
1272 
1279  bool snapPoint( QgsPoint& point, double tolerance );
1280 
1288  int snapWithContext( const QgsPoint& startPoint,
1289  double snappingTolerance,
1290  QMultiMap < double, QgsSnappingResult > &snappingResults,
1291  QgsSnapper::SnappingType snap_to );
1292 
1294  virtual void reload() override;
1295 
1299  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1300 
1304  bool draw( QgsRenderContext& rendererContext ) override;
1305 
1309  Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override;
1310 
1312  QgsRectangle extent() override;
1313 
1320  inline QgsFields fields() const { return mUpdatedFields; }
1321 
1329  inline QgsFields pendingFields() const { return mUpdatedFields; }
1330 
1335  inline QgsAttributeList pendingAllAttributesList() const { return mUpdatedFields.allAttributesList(); }
1336 
1341  inline QgsAttributeList attributeList() const { return mUpdatedFields.allAttributesList(); }
1342 
1347  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1348 
1350  QgsAttributeList pkAttributeList() const;
1351 
1356  inline long pendingFeatureCount() const { return featureCount(); }
1357 
1362  long featureCount() const;
1363 
1367  bool setReadOnly( bool readonly = true );
1368 
1375  bool startEditing();
1376 
1378  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1379 
1386  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1387 
1398  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1399 
1402  bool addAttribute( const QgsField &field );
1403 
1405  void addAttributeAlias( int attIndex, QString aliasString );
1406 
1408  void remAttributeAlias( int attIndex );
1409 
1413  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1414 
1422  const QString editorWidgetV2( int fieldIdx ) const;
1423 
1433  const QString editorWidgetV2( const QString& fieldName ) const;
1434 
1442  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
1443 
1453  const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
1454 
1458  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1462  void clearAttributeEditorWidgets();
1463 
1465  QString attributeAlias( int attributeIndex ) const;
1466 
1468  QString attributeDisplayName( int attributeIndex ) const;
1469 
1470  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1471 
1472  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1473  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1474 
1475  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1476  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1477 
1479  bool deleteAttribute( int attr );
1480 
1488  bool deleteAttributes( QList<int> attrs );
1489 
1491  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1492 
1494  bool deleteFeature( QgsFeatureId fid );
1495 
1511  bool commitChanges();
1512  const QStringList &commitErrors();
1513 
1517  bool rollBack( bool deleteBuffer = true );
1518 
1524  Q_DECL_DEPRECATED EditType editType( int idx );
1525 
1531  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1532 
1534  EditorLayout editorLayout();
1535 
1537  void setEditorLayout( EditorLayout editorLayout );
1538 
1567  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1568 
1584  void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config );
1585 
1591  Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
1592 
1594  QString editForm();
1595 
1597  void setEditForm( QString ui );
1598 
1601  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1602 
1605  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1606 
1608  QString annotationForm() const { return mAnnotationForm; }
1609 
1611  void setAnnotationForm( const QString& ui );
1612 
1614  QString editFormInit();
1615 
1617  void setEditFormInit( QString function );
1618 
1623  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1624 
1630  Q_DECL_DEPRECATED RangeData range( int idx );
1631 
1633  ValueRelationData valueRelation( int idx );
1634 
1641  QList<QgsRelation> referencingRelations( int idx );
1642 
1648  Q_DECL_DEPRECATED QString dateFormat( int idx );
1649 
1655  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1656 
1658  bool fieldEditable( int idx );
1659 
1661  bool labelOnTop( int idx );
1662 
1664  void setFieldEditable( int idx, bool editable );
1665 
1667  void setLabelOnTop( int idx, bool onTop );
1668 
1670  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1671 
1676  void beginEditCommand( QString text );
1677 
1679  void endEditCommand();
1680 
1682  void destroyEditCommand();
1683 
1685  int fieldNameIndex( const QString& fieldName ) const;
1686 
1689  {
1692  NoMarker
1693  };
1694 
1696  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1697 
1699  void updateFields();
1700 
1702  void createJoinCaches();
1703 
1708  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1709 
1711  QVariant minimumValue( int index );
1712 
1714  QVariant maximumValue( int index );
1715 
1724  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false );
1725 
1736  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = 0 );
1737 
1739  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1741  QPainter::CompositionMode featureBlendMode() const;
1742 
1744  void setLayerTransparency( int layerTransparency );
1746  int layerTransparency() const;
1747 
1748  QString metadata() override;
1749 
1751  inline QgsGeometryCache* cache() { return mCache; }
1752 
1756  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1760  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1761 
1766  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1767 
1775  QgsConditionalLayerStyles *conditionalStyles() const;
1776 
1777  public slots:
1785  void select( const QgsFeatureId &featureId );
1786 
1794  void select( const QgsFeatureIds& featureIds );
1795 
1803  void deselect( const QgsFeatureId featureId );
1804 
1812  void deselect( const QgsFeatureIds& featureIds );
1813 
1819  void removeSelection();
1820 
1824  virtual void updateExtents();
1825 
1827  void checkJoinLayerRemove( QString theLayerId );
1828 
1829  protected slots:
1830  void invalidateSymbolCountedFlag();
1831 
1832  signals:
1833 
1841  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1842 
1844  void selectionChanged();
1845 
1847  void layerModified();
1848 
1850  void beforeModifiedCheck() const;
1851 
1853  void editingStarted();
1854 
1856  void editingStopped();
1857 
1859  void beforeCommitChanges();
1860 
1862  void beforeRollBack();
1863 
1872  void attributeAdded( int idx );
1881  void attributeDeleted( int idx );
1887  void featureAdded( QgsFeatureId fid );
1896  void featureDeleted( QgsFeatureId fid );
1906  void featuresDeleted( QgsFeatureIds fids );
1911  void updatedFields();
1912  void layerDeleted();
1913 
1914  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1915  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1916 
1918  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1919  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1920  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1921  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1922  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1923  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1924 
1925  void saveLayerToProject();
1926 
1928  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1929 
1931  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1932 
1934  void layerTransparencyChanged( int layerTransparency );
1935 
1941  void editCommandStarted( const QString& text );
1942 
1948  void editCommandEnded();
1949 
1955  void editCommandDestroyed();
1956 
1966  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1967 
1977  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1978 
1979 
1980  private slots:
1981  void onRelationsLoaded();
1982  void onJoinedFieldsChanged();
1983  void onFeatureDeleted( const QgsFeatureId& fid );
1984 
1985  protected:
1987  void setExtent( const QgsRectangle &rect ) override;
1988 
1989  private: // Private methods
1990 
1992  QgsVectorLayer( const QgsVectorLayer & rhs );
1993 
1995  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1996 
1997 
2002  bool setDataProvider( QString const & provider );
2003 
2005  QgsFeatureId findFreeId();
2006 
2015  void snapToGeometry( const QgsPoint& startPoint,
2016  QgsFeatureId featureId,
2017  const QgsGeometry *geom,
2018  double sqrSnappingTolerance,
2019  QMultiMap<double, QgsSnappingResult>& snappingResults,
2020  QgsSnapper::SnappingType snap_to ) const;
2021 
2023  //void addJoinedAttributes( QgsFeature& f, bool all = false );
2024 
2026  void readSldLabeling( const QDomNode& node );
2027 
2028  private: // Private attributes
2029 
2030  QgsConditionalLayerStyles * mConditionalStyles;
2031 
2033  QgsVectorDataProvider *mDataProvider;
2034 
2036  QString mDisplayField;
2037 
2039  QString mDisplayExpression;
2040 
2042  QString mProviderKey;
2043 
2045  QgsAttributeAction* mActions;
2046 
2048  bool mReadOnly;
2049 
2054  QgsFeatureIds mSelectedFeatureIds;
2055 
2057  QgsFields mUpdatedFields;
2058 
2060  QMap< QString, QString > mAttributeAliasMap;
2061 
2063  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
2064 
2066  QSet<QString> mExcludeAttributesWMS;
2068  QSet<QString> mExcludeAttributesWFS;
2069 
2071  QList< TabData > mTabs;
2072 
2074  QGis::WkbType mWkbType;
2075 
2077  QgsFeatureRendererV2 *mRendererV2;
2078 
2080  QgsVectorSimplifyMethod mSimplifyMethod;
2081 
2083  QgsLabel *mLabel;
2084 
2086  bool mLabelOn;
2087 
2089  bool mLabelFontNotFoundNotified;
2090 
2092  QPainter::CompositionMode mFeatureBlendMode;
2093 
2095  int mLayerTransparency;
2096 
2098  bool mVertexMarkerOnlyForSelection;
2099 
2100  QStringList mCommitErrors;
2101 
2102  QMap< QString, bool> mFieldEditables;
2103  QMap< QString, bool> mLabelOnTop;
2104 
2105  QMap<QString, QString> mEditorWidgetV2Types;
2106  QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs;
2107 
2109  EditorLayout mEditorLayout;
2110 
2111  QString mEditForm, mEditFormInit;
2112 
2115  QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress;
2116 
2117  //annotation form for this layer
2118  QString mAnnotationForm;
2119 
2121  QgsGeometryCache* mCache;
2122 
2124  QgsVectorLayerEditBuffer* mEditBuffer;
2126 
2127  //stores information about joined layers
2128  QgsVectorLayerJoinBuffer* mJoinBuffer;
2129 
2131  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2132 
2133  //diagram rendering object. 0 if diagram drawing is disabled
2134  QgsDiagramRendererV2* mDiagramRenderer;
2135 
2136  //stores infos about diagram placement (placement type, priority, position distance)
2137  QgsDiagramLayerSettings *mDiagramLayerSettings;
2138 
2139  bool mValidExtent;
2140  bool mLazyExtent;
2141 
2142  // Features in renderer classes counted
2143  bool mSymbolFeatureCounted;
2144 
2145  // Feature counts for each renderer symbol
2146  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
2147 
2149  bool mEditCommandActive;
2150 
2151  QgsFeatureIds mDeletedFids;
2152 
2154 };
2155 
2156 #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
QgsAttributeList attributeList() const
Returns list of attribute indexes.
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.
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()
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:408
QgsFields fields() const
Returns the list of fields of this layer.
EditorLayout
The different types to layout the attribute editor.
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.
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:129
QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
FeatureFormSuppress
Types of feature form suppression after feature creation.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfield.h:177
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:75
This element will load a field's widget onto the form.
GeometryType
Definition: qgis.h:155
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
WkbType
Used for symbology operations.
Definition: qgis.h:53
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.
QgsFields pendingFields() const
Returns the list of fields of this layer.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
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
value map from an table
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document)
Called by writeLayerXML(), used by children to write state specific to them to project files...
const QSet< QString > & excludeAttributesWFS() const
VertexMarkerType
Editing vertex markers.
Point geometry type.
Definition: qgspointv2.h:29
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
The attribute value should not be changed in the attribute form.
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:40
const QgsFeatureRendererV2 * rendererV2() const
Return const renderer V2.
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.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
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
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
modularized edit widgets
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) ...
The attribute value should not be shown in the attribute form.
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.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
virtual bool readXml(const QDomNode &layer_node)
Called by readLayerXML(), used by children to read state specific to them from project files...
uuid generator - readonly and automatically intialized
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.
This is the base class for vector data providers.
Abstract base class for curved geometry type.
Definition: qgscurvev2.h:32
QList< int > QgsAttributeList
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
QString joinLayerId
Source layer.
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
QList< GroupData > mGroups