QGIS API Documentation  2.13.0-Master
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"
36 #include "qgseditformconfig.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;
67 class QgsPointV2;
68 
71 
72 
73 struct CORE_EXPORT QgsVectorJoinInfo
74 {
87 
92 
97 
98  bool operator==( const QgsVectorJoinInfo& other ) const
99  {
100  return targetFieldName == other.targetFieldName &&
101  joinLayerId == other.joinLayerId &&
102  joinFieldName == other.joinFieldName &&
103  joinFieldsSubset == other.joinFieldsSubset &&
104  memoryCache == other.memoryCache &&
105  prefix == other.prefix;
106  }
107 
110  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
113  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
114 
115 protected:
118 };
119 
120 
121 
385 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
386 {
387  Q_OBJECT
388 
389  public:
390 
393 
395  {
396  GeneratedLayout = 0,
397  TabLayout = 1,
398  UiFileLayout = 2
399  };
400 
401  struct RangeData
402  {
404  Q_DECL_DEPRECATED RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );}
406  Q_DECL_DEPRECATED RangeData( const QVariant& theMin, const QVariant& theMax, const QVariant& theStep )
407  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
408 
412  };
413 
415  {
416  ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
417  ValueRelationData( const QString& layer, const QString& key, const QString& value, bool allowNull, bool orderByValue,
418  bool allowMulti = false,
419  const QString& filterExpression = QString::null )
420  : mLayer( layer )
421  , mKey( key )
422  , mValue( value )
423  , mFilterExpression( filterExpression )
424  , mAllowNull( allowNull )
425  , mOrderByValue( orderByValue )
426  , mAllowMulti( allowMulti )
427  {}
428 
435  bool mAllowMulti; /* allow selection of multiple keys */
436  };
437 
444  {
445  SuppressDefault = 0, // use the application-wide setting
446  SuppressOn = 1,
447  SuppressOff = 2
448  };
449 
453  enum EditType
454  {
476  };
477 
480  {
481  Success = 0,
482  EmptyGeometry = 1,
483  EditFailed = 2,
484  FetchFeatureFailed = 3,
485  InvalidLayer = 4,
486  };
487 
501  QgsVectorLayer( const QString& path = QString::null, const QString& baseName = QString::null,
502  const QString& providerLib = QString::null, bool loadDefaultStyleFlag = true );
503 
505  virtual ~QgsVectorLayer();
506 
508  QString storageType() const;
509 
511  QString capabilitiesString() const;
512 
514  QString dataComment() const;
515 
517  void setDisplayField( const QString& fldName = "" );
518 
520  const QString displayField() const;
521 
528  void setDisplayExpression( const QString &displayExpression );
529 
536  const QString displayExpression();
537 
539  QgsVectorDataProvider* dataProvider();
540 
544  const QgsVectorDataProvider* dataProvider() const;
545 
547  void setProviderEncoding( const QString& encoding );
548 
550  void setCoordinateSystem();
551 
555  bool addJoin( const QgsVectorJoinInfo& joinInfo );
556 
559  bool removeJoin( const QString& joinLayerId );
560 
561  const QList<QgsVectorJoinInfo> vectorJoins() const;
562 
566  virtual QSet<QString> layerDependencies() const;
567 
578  int addExpressionField( const QString& exp, const QgsField& fld );
579 
587  void removeExpressionField( int index );
588 
598  QString expressionField( int index );
599 
609  void updateExpressionField( int index, const QString& exp );
610 
612  QgsLabel *label();
613 
615  const QgsLabel *label() const;
616 
617  QgsAttributeAction *actions() { return mActions; }
618 
624  int selectedFeatureCount();
625 
634  void select( QgsRectangle & rect, bool addToSelection );
635 
647  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
648 
650  void invertSelection();
651 
653  void selectAll();
654 
656  QgsFeatureIds allFeatureIds();
657 
665  void invertSelectionInRectangle( QgsRectangle & rect );
666 
675  QgsFeatureList selectedFeatures();
676 
688  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() );
689 
696  const QgsFeatureIds &selectedFeaturesIds() const;
697 
705  void setSelectedFeatures( const QgsFeatureIds &ids );
706 
708  QgsRectangle boundingBoxOfSelected();
709 
714  bool labelsEnabled() const;
715 
720  bool diagramsEnabled() const;
721 
723  void setDiagramRenderer( QgsDiagramRendererV2* r );
724  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
725 
726  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
727  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
728 
730  QgsFeatureRendererV2* rendererV2() { return mRendererV2; }
731 
733  const QgsFeatureRendererV2* rendererV2() const { return mRendererV2; }
734 
739  void setRendererV2( QgsFeatureRendererV2* r );
740 
742  QGis::GeometryType geometryType() const;
743 
745  bool hasGeometryType() const;
746 
748  QGis::WkbType wkbType() const;
749 
751  QString providerType() const;
752 
756  virtual bool readXml( const QDomNode& layer_node ) override;
757 
761  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
762 
771  virtual void saveStyleToDatabase( const QString& name, const QString& description,
772  bool useAsDefault, const QString& uiFileContent,
773  QString &msgError );
774 
783  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
784  QStringList &descriptions, QString &msgError );
785 
789  virtual QString getStyleFromDatabase( const QString& styleId, QString &msgError );
790 
797  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
798 
803  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
804 
815  Q_DECL_DEPRECATED virtual bool applyNamedStyle( const QString& namedStyle, QString &errorMsg );
816 
821  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent ) { return mEditFormConfig->attributeEditorElementFromDomElement( elem, parent ); }
822 
828  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
829 
836  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
837 
838  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
839  bool readSld( const QDomNode& node, QString& errorMessage ) override;
840 
847  long featureCount( QgsSymbolV2* symbol );
848 
859  void setDataSource( const QString& dataSource, const QString& baseName, const QString& provider, bool loadDefaultStyleFlag = false );
860 
866  bool countSymbolFeatures( bool showProgress = true );
867 
875  virtual bool setSubsetString( const QString& subset );
876 
881  virtual QString subsetString();
882 
886  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
887 
893  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
894 
901  bool updateFeature( QgsFeature &f );
902 
907  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
908 
913  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
914 
920  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
921 
925  Q_DECL_DEPRECATED bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
926 
932  //TODO QGIS 3.0 - rename back to deleteVertex
933  EditResult deleteVertexV2( QgsFeatureId featureId, int vertex );
934 
938  bool deleteSelectedFeatures( int *deletedCount = nullptr );
939 
951  int addRing( const QList<QgsPoint>& ring, QgsFeatureId* featureId = nullptr );
952 
963  int addRing( QgsCurveV2* ring, QgsFeatureId* featureId = nullptr );
964 
975  int addPart( const QList<QgsPoint>& ring );
976 
978  int addPart( QgsCurveV2* ring );
979 
985  int translateFeature( QgsFeatureId featureId, double dx, double dy );
986 
994  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
995 
1003  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1004 
1013  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, const QgsFeatureIds& ignoreFeatures = QgsFeatureIds() );
1014 
1020  int addTopologicalPoints( const QgsGeometry* geom );
1021 
1029  int addTopologicalPoints( const QgsPoint& p );
1030 
1036  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1037 
1041  Q_DECL_DEPRECATED void enableLabels( bool on );
1042 
1046  Q_DECL_DEPRECATED bool hasLabelsEnabled() const;
1047 
1052  const QgsAbstractVectorLayerLabeling* labeling() const { return mLabeling; }
1053 
1058  void setLabeling( QgsAbstractVectorLayerLabeling* labeling );
1059 
1061  virtual bool isEditable() const override;
1062 
1064  virtual bool isReadOnly() const;
1065 
1067  virtual bool isModified() const;
1068 
1075  bool snapPoint( QgsPoint& point, double tolerance );
1076 
1084  int snapWithContext( const QgsPoint& startPoint,
1085  double snappingTolerance,
1086  QMultiMap < double, QgsSnappingResult > &snappingResults,
1087  QgsSnapper::SnappingType snap_to );
1088 
1090  virtual void reload() override;
1091 
1095  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1096 
1100  bool draw( QgsRenderContext& rendererContext ) override;
1101 
1105  Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override;
1106 
1108  QgsRectangle extent() override;
1109 
1116  inline QgsFields fields() const { return mUpdatedFields; }
1117 
1125  inline QgsFields pendingFields() const { return mUpdatedFields; }
1126 
1131  inline QgsAttributeList pendingAllAttributesList() const { return mUpdatedFields.allAttributesList(); }
1132 
1137  inline QgsAttributeList attributeList() const { return mUpdatedFields.allAttributesList(); }
1138 
1143  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1144 
1146  QgsAttributeList pkAttributeList() const;
1147 
1152  inline long pendingFeatureCount() const { return featureCount(); }
1153 
1158  long featureCount() const;
1159 
1163  bool setReadOnly( bool readonly = true );
1164 
1166  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1167 
1174  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant& value, bool emitSignal );
1175 
1186  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1187 
1190  bool addAttribute( const QgsField &field );
1191 
1193  void addAttributeAlias( int attIndex, const QString& aliasString );
1194 
1196  void remAttributeAlias( int attIndex );
1197 
1203  Q_DECL_DEPRECATED void addAttributeEditorWidget( QgsAttributeEditorElement* data ) {mEditFormConfig->addTab( data );}
1204 
1214  Q_DECL_DEPRECATED const QString editorWidgetV2( int fieldIdx ) const { return mEditFormConfig->widgetType( fieldIdx ); }
1215 
1227  Q_DECL_DEPRECATED const QString editorWidgetV2( const QString& fieldName ) const { return mEditFormConfig->widgetType( fieldName ); }
1228 
1238  Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const { return mEditFormConfig->widgetConfig( fieldIdx ); }
1239 
1251  Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const { return mEditFormConfig->widgetConfig( fieldName ); }
1252 
1258  Q_DECL_DEPRECATED QList< QgsAttributeEditorElement* > attributeEditorElements() { return mEditFormConfig->tabs(); }
1259 
1266  QgsEditFormConfig* editFormConfig() const { return mEditFormConfig; }
1267 
1271  void clearAttributeEditorWidgets() { mEditFormConfig->clearTabs(); }
1272 
1274  QString attributeAlias( int attributeIndex ) const;
1275 
1277  QString attributeDisplayName( int attributeIndex ) const;
1278 
1279  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1280 
1281  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1282  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1283 
1284  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1285  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1286 
1288  bool deleteAttribute( int attr );
1289 
1297  bool deleteAttributes( QList<int> attrs );
1298 
1300  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1301 
1303  bool deleteFeature( QgsFeatureId fid );
1304 
1312  bool deleteFeatures( const QgsFeatureIds& fids );
1313 
1329  bool commitChanges();
1330  const QStringList &commitErrors();
1331 
1335  bool rollBack( bool deleteBuffer = true );
1336 
1342  Q_DECL_DEPRECATED EditType editType( int idx );
1343 
1349  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1350 
1355  Q_DECL_DEPRECATED EditorLayout editorLayout() { return static_cast< EditorLayout >( mEditFormConfig->layout() ); }
1356 
1361  Q_DECL_DEPRECATED void setEditorLayout( EditorLayout editorLayout ) { mEditFormConfig->setLayout( static_cast< QgsEditFormConfig::EditorLayout >( editorLayout ) ); }
1362 
1393  Q_DECL_DEPRECATED void setEditorWidgetV2( int attrIdx, const QString& widgetType ) { mEditFormConfig->setWidgetType( attrIdx, widgetType ); }
1394 
1412  Q_DECL_DEPRECATED void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config ) { mEditFormConfig->setWidgetConfig( attrIdx, config ); }
1413 
1419  Q_DECL_DEPRECATED void setCheckedState( int idx, const QString& checked, const QString& notChecked );
1420 
1426  Q_DECL_DEPRECATED QString editForm() const { return mEditFormConfig->uiForm(); }
1427 
1432  Q_DECL_DEPRECATED void setEditForm( const QString& ui ) { mEditFormConfig->setUiForm( ui ); }
1433 
1438  Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return static_cast< FeatureFormSuppress >( mEditFormConfig->suppress() ); }
1439 
1444  Q_DECL_DEPRECATED void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mEditFormConfig->setSuppress( static_cast< QgsEditFormConfig::FeatureFormSuppress >( s ) ); }
1445 
1447  QString annotationForm() const { return mAnnotationForm; }
1448 
1450  void setAnnotationForm( const QString& ui );
1451 
1457  Q_DECL_DEPRECATED QString editFormInit() const { return mEditFormConfig->initFunction(); }
1458 
1464  Q_DECL_DEPRECATED void setEditFormInit( const QString& function ) { mEditFormConfig->setInitFunction( function ); }
1465 
1470  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1471 
1477  Q_DECL_DEPRECATED RangeData range( int idx );
1478 
1480  ValueRelationData valueRelation( int idx );
1481 
1488  QList<QgsRelation> referencingRelations( int idx );
1489 
1495  Q_DECL_DEPRECATED QString dateFormat( int idx );
1496 
1502  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1503 
1509  Q_DECL_DEPRECATED bool fieldEditable( int idx ) { return !mEditFormConfig->readOnly( idx ); }
1510 
1515  Q_DECL_DEPRECATED bool labelOnTop( int idx ) { return mEditFormConfig->labelOnTop( idx ); }
1516 
1521  Q_DECL_DEPRECATED void setFieldEditable( int idx, bool editable ) { mEditFormConfig->setReadOnly( idx, !editable ); }
1522 
1527  Q_DECL_DEPRECATED void setLabelOnTop( int idx, bool onTop ) { mEditFormConfig->setLabelOnTop( idx, onTop ); }
1528 
1530  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1531 
1536  void beginEditCommand( const QString& text );
1537 
1539  void endEditCommand();
1540 
1542  void destroyEditCommand();
1543 
1545  int fieldNameIndex( const QString& fieldName ) const;
1546 
1549  {
1552  NoMarker
1553  };
1554 
1556  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1557 
1559  void updateFields();
1560 
1562  void createJoinCaches();
1563 
1568  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1569 
1571  QVariant minimumValue( int index );
1572 
1574  QVariant maximumValue( int index );
1575 
1584  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false );
1585 
1596  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = nullptr );
1597 
1599  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1601  QPainter::CompositionMode featureBlendMode() const;
1602 
1604  void setLayerTransparency( int layerTransparency );
1606  int layerTransparency() const;
1607 
1608  QString metadata() override;
1609 
1611  inline QgsGeometryCache* cache() { return mCache; }
1612 
1616  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1620  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1621 
1626  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1627 
1635  QgsConditionalLayerStyles *conditionalStyles() const;
1636 
1637  public slots:
1645  void select( QgsFeatureId featureId );
1646 
1654  void select( const QgsFeatureIds& featureIds );
1655 
1663  void deselect( const QgsFeatureId featureId );
1664 
1672  void deselect( const QgsFeatureIds& featureIds );
1673 
1679  void removeSelection();
1680 
1684  virtual void updateExtents();
1685 
1687  void checkJoinLayerRemove( const QString& theLayerId );
1688 
1695  bool startEditing();
1696 
1697 
1698  protected slots:
1699  void invalidateSymbolCountedFlag();
1700 
1701  signals:
1702 
1710  void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );
1711 
1713  void selectionChanged();
1714 
1716  void layerModified();
1717 
1719  void beforeModifiedCheck() const;
1720 
1722  void beforeEditingStarted();
1723 
1725  void editingStarted();
1726 
1728  void editingStopped();
1729 
1731  void beforeCommitChanges();
1732 
1734  void beforeRollBack();
1735 
1744  void attributeAdded( int idx );
1745 
1752  void beforeAddingExpressionField( const QString& fieldName );
1753 
1762  void attributeDeleted( int idx );
1763 
1770  void beforeRemovingExpressionField( int idx );
1771 
1777  void featureAdded( QgsFeatureId fid );
1778 
1787  void featureDeleted( QgsFeatureId fid );
1788 
1798  void featuresDeleted( const QgsFeatureIds& fids );
1799 
1804  void updatedFields();
1805  void layerDeleted();
1806 
1807  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1808  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1809 
1811  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1812  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1813  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1814  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1815  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1816  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1817 
1818  void saveLayerToProject();
1819 
1821  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1822 
1824  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1825 
1827  void layerTransparencyChanged( int layerTransparency );
1828 
1834  void editCommandStarted( const QString& text );
1835 
1841  void editCommandEnded();
1842 
1848  void editCommandDestroyed();
1849 
1859  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1860 
1870  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1871 
1872  private slots:
1873  void onJoinedFieldsChanged();
1874  void onFeatureDeleted( QgsFeatureId fid );
1875 
1876  protected:
1878  void setExtent( const QgsRectangle &rect ) override;
1879 
1880  private: // Private methods
1881 
1883  QgsVectorLayer( const QgsVectorLayer & rhs );
1884 
1886  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1887 
1888 
1893  bool setDataProvider( QString const & provider );
1894 
1896  QgsFeatureId findFreeId();
1897 
1906  void snapToGeometry( const QgsPoint& startPoint,
1907  QgsFeatureId featureId,
1908  const QgsGeometry *geom,
1909  double sqrSnappingTolerance,
1910  QMultiMap<double, QgsSnappingResult>& snappingResults,
1911  QgsSnapper::SnappingType snap_to ) const;
1912 
1914  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1915 
1917  void readSldLabeling( const QDomNode& node );
1918 
1919  private: // Private attributes
1920 
1921  QgsConditionalLayerStyles * mConditionalStyles;
1922 
1924  QgsVectorDataProvider *mDataProvider;
1925 
1927  QString mDisplayField;
1928 
1930  QString mDisplayExpression;
1931 
1933  QString mProviderKey;
1934 
1936  QgsAttributeAction* mActions;
1937 
1939  bool mReadOnly;
1940 
1945  QgsFeatureIds mSelectedFeatureIds;
1946 
1948  QgsFields mUpdatedFields;
1949 
1951  QMap< QString, QString > mAttributeAliasMap;
1952 
1954  QgsEditFormConfig* mEditFormConfig;
1955 
1957  QSet<QString> mExcludeAttributesWMS;
1958 
1960  QSet<QString> mExcludeAttributesWFS;
1961 
1963  QGis::WkbType mWkbType;
1964 
1966  QgsFeatureRendererV2 *mRendererV2;
1967 
1969  QgsVectorSimplifyMethod mSimplifyMethod;
1970 
1972  QgsLabel *mLabel;
1973 
1975  bool mLabelOn;
1976 
1978  QgsAbstractVectorLayerLabeling* mLabeling;
1979 
1981  bool mLabelFontNotFoundNotified;
1982 
1984  QPainter::CompositionMode mFeatureBlendMode;
1985 
1987  int mLayerTransparency;
1988 
1990  bool mVertexMarkerOnlyForSelection;
1991 
1992  QStringList mCommitErrors;
1993 
1995  QString mAnnotationForm;
1996 
1998  QgsGeometryCache* mCache;
1999 
2001  QgsVectorLayerEditBuffer* mEditBuffer;
2003 
2004  //stores information about joined layers
2005  QgsVectorLayerJoinBuffer* mJoinBuffer;
2006 
2008  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2009 
2010  //diagram rendering object. 0 if diagram drawing is disabled
2011  QgsDiagramRendererV2* mDiagramRenderer;
2012 
2013  //stores infos about diagram placement (placement type, priority, position distance)
2014  QgsDiagramLayerSettings *mDiagramLayerSettings;
2015 
2016  bool mValidExtent;
2017  bool mLazyExtent;
2018 
2019  // Features in renderer classes counted
2020  bool mSymbolFeatureCounted;
2021 
2022  // Feature counts for each renderer symbol
2023  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
2024 
2026  bool mEditCommandActive;
2027 
2028  QgsFeatureIds mDeletedFids;
2029 
2031 };
2032 
2033 #endif
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.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
void clearAttributeEditorWidgets()
Clears all the tabs for the attribute editor form.
void setExcludeAttributesWFS(const QSet< QString > &att)
This is an abstract base class for any elements of a drag and drop form.
QString targetFieldName
Join field in the target layer.
GeometryType
Definition: qgis.h:111
QgsAttributeAction * actions()
ValueRelationData(const QString &layer, const QString &key, const QString &value, bool allowNull, bool orderByValue, bool allowMulti=false, const QString &filterExpression=QString::null)
Q_DECL_DEPRECATED const QString editorWidgetV2(int fieldIdx) const
Get the id for the editor widget used to represent the field at the given index.
QgsEditFormConfig::GroupData GroupData
The attribute value should not be changed in the attribute form.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:433
QgsFields fields() const
Returns the list of fields of this layer.
Manages an editor widget Widget and wrapper share the same parent.
Q_DECL_DEPRECATED void addAttributeEditorWidget(QgsAttributeEditorElement *data)
Adds a tab (for the attribute editor form) holding groups and fields.
void setExcludeAttributesWMS(const QSet< QString > &att)
int joinFieldIndex
Join field index in the source layer.
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(). ...
VertexMarkerType
Editing vertex markers.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfield.h:189
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
Q_DECL_DEPRECATED void setEditForm(const QString &ui)
Set edit form.
WkbType
Used for symbology operations.
Definition: qgis.h:57
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:187
QgsEditFormConfig * editFormConfig() const
Get the configuration of the form used to represent this vector layer.
const QgsDiagramLayerSettings * diagramLayerSettings() const
Q_DECL_DEPRECATED void setFieldEditable(int idx, bool editable)
Set edit widget editable.
QgsGeometryCache * cache()
Returns diagram settings for a feature.
Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config(const QString &fieldName) const
Get the configuration for the editor widget used to represent the field with the given name...
Manages joined fields for a vector layer.
Q_DECL_DEPRECATED void setEditorWidgetV2(int attrIdx, const QString &widgetType)
Set the editor widget type for a field.
Q_DECL_DEPRECATED const QString editorWidgetV2(const QString &fieldName) const
Get the id for the editor widget used to represent the field at the given index.
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
Q_DECL_DEPRECATED void setLabelOnTop(int idx, bool onTop)
Label widget on top.
Q_DECL_DEPRECATED QList< QgsAttributeEditorElement * > attributeEditorElements()
Returns a list of tabs holding groups and fields.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
The attribute value should not be shown in the attribute form.
const QSet< QString > & excludeAttributesWFS() const
Q_DECL_DEPRECATED RangeData(const QVariant &theMin, const QVariant &theMax, const QVariant &theStep)
Q_DECL_DEPRECATED void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:34
Q_DECL_DEPRECATED void setEditFormInit(const QString &function)
Set python function for edit form initialization.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsAttributeEditorElement * attributeEditorElementFromDomElement(QDomElement &elem, QObject *parent)
Convert a saved attribute editor element into a AttributeEditor structure as it&#39;s used internally...
Q_DECL_DEPRECATED bool fieldEditable(int idx)
Is edit widget editable.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:44
Q_DECL_DEPRECATED bool labelOnTop(int idx)
Label widget on top.
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:65
Q_DECL_DEPRECATED void setEditorWidgetV2Config(int attrIdx, const QgsEditorWidgetConfig &config)
Set the editor widget config for a field.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
Partial snapshot of vector layer&#39;s state (only the members necessary for access to features) ...
A class to render labels.
Definition: qgslabel.h:51
uuid generator - readonly and automatically intialized
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Buffers information about expression fields for a vector layer.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
Q_DECL_DEPRECATED QString editFormInit() const
Get python function for edit form initialization.
Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config(int fieldIdx) const
Get the configuration for the editor widget used to represent the field at the given index...
This class manages a set of relations between layers.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
Q_DECL_DEPRECATED EditorLayout editorLayout()
Get the active layout for the attribute editor for this layer.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
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
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
Base class for utility classes that encapsulate information necessary for rendering of map layers...
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
QSet< int > QgsAttributeIds
Q_DECL_DEPRECATED QString editForm() const
Get edit form.
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
Abstract base class for curved geometry type.
Definition: qgscurvev2.h:32
QList< int > QgsAttributeList
Represents a vector layer which manages a vector based data sets.
modularized edit widgets
EditResult
Result of an edit operation.
QString joinLayerId
Source layer.
Q_DECL_DEPRECATED void setEditorLayout(EditorLayout editorLayout)
Set the active layout for the attribute editor for this layer.
value map from an table
Abstract base class for simplify geometries using a specific algorithm.
QgsEditFormConfig::TabData TabData
Q_DECL_DEPRECATED RangeData()