QGIS API Documentation  2.9.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 
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 
64 typedef QList<int> QgsAttributeList;
65 typedef QSet<int> QgsAttributeIds;
66 
67 class CORE_EXPORT QgsAttributeEditorElement : public QObject
68 {
69  Q_OBJECT
70  public:
71 
73  {
77  AeTypeInvalid
78  };
79 
80  QgsAttributeEditorElement( AttributeEditorType type, QString name, QObject *parent = NULL )
81  : QObject( parent ), mType( type ), mName( name ) {}
82 
84 
85  QString name() const { return mName; }
86  AttributeEditorType type() const { return mType; }
87 
88  virtual QDomElement toDomElement( QDomDocument& doc ) const = 0;
89 
90  protected:
92  QString mName;
93 };
94 
96 {
97  public:
98  QgsAttributeEditorContainer( QString name, QObject *parent )
99  : QgsAttributeEditorElement( AeTypeContainer, name, parent )
100  , mIsGroupBox( true )
101  {}
102 
104 
105  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
106  virtual void addChildElement( QgsAttributeEditorElement *widget );
107  virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
108  virtual bool isGroupBox() const { return mIsGroupBox; }
109  QList<QgsAttributeEditorElement*> children() const { return mChildren; }
110  virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
111 
112  private:
113  bool mIsGroupBox;
114  QList<QgsAttributeEditorElement*> mChildren;
115 };
116 
117 
119 {
120  public:
121  QgsAttributeEditorField( QString name, int idx, QObject *parent )
122  : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx ) {}
123 
125 
126  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
127  int idx() const { return mIdx; }
128 
129  private:
130  int mIdx;
131 };
132 
135 {
136  public:
137  QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent )
138  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
139  , mRelationId( relationId ) {}
140 
141  QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent )
142  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
143  , mRelationId( relation.id() )
144  , mRelation( relation ) {}
145 
147 
148  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
149  const QgsRelation& relation() const { return mRelation; }
150 
157  bool init( QgsRelationManager *relManager );
158 
159  private:
160  QString mRelationId;
161  QgsRelation mRelation;
162 };
163 
164 
165 struct CORE_EXPORT QgsVectorJoinInfo
166 {
170  QString joinLayerId;
172  QString joinFieldName;
178  QHash< QString, QgsAttributes> cachedAttributes;
179 
184 
188  QString prefix;
189 
190  bool operator==( const QgsVectorJoinInfo& other ) const
191  {
192  return targetFieldName == other.targetFieldName &&
193  joinLayerId == other.joinLayerId &&
194  joinFieldName == other.joinFieldName &&
195  joinFieldsSubset == other.joinFieldsSubset &&
196  memoryCache == other.memoryCache &&
197  prefix == other.prefix;
198  }
199 
202  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
205  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
206 
207 protected:
209  QSharedPointer<QStringList> joinFieldsSubset;
210 };
211 
474 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
475 {
476  Q_OBJECT
477 
478  public:
481  {
482  GeneratedLayout = 0,
483  TabLayout = 1,
484  UiFileLayout = 2
485  };
486 
490  enum EditType
491  {
513  };
514 
518  {
519  SuppressDefault = 0, // use the application-wide setting
520  SuppressOn = 1,
521  SuppressOff = 2
522  };
523 
524  struct RangeData
525  {
526  RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );}
527  RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
528  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
529 
530  QVariant mMin;
531  QVariant mMax;
532  QVariant mStep;
533  };
534 
536  {
537  ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
538  ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
539  bool allowMulti = false,
540  QString filterExpression = QString::null )
541  : mLayer( layer )
542  , mKey( key )
543  , mValue( value )
544  , mFilterExpression( filterExpression )
545  , mAllowNull( allowNull )
546  , mOrderByValue( orderByValue )
547  , mAllowMulti( allowMulti )
548  {}
549 
550  QString mLayer;
551  QString mKey;
552  QString mValue;
556  bool mAllowMulti; /* allow selection of multiple keys */
557  };
558 
559  struct GroupData
560  {
562  GroupData( QString name, QList<QString> fields )
563  : mName( name ), mFields( fields ) {}
564  QString mName;
565  QList<QString> mFields;
566  };
567 
568  struct TabData
569  {
570  TabData() {}
571  TabData( QString name, QList<QString> fields, QList<GroupData> groups )
572  : mName( name ), mFields( fields ), mGroups( groups ) {}
573  QString mName;
574  QList<QString> mFields;
575  QList<GroupData> mGroups;
576  };
577 
591  QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
592  QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
593 
595  virtual ~QgsVectorLayer();
596 
598  QString storageType() const;
599 
601  QString capabilitiesString() const;
602 
604  QString dataComment() const;
605 
607  void setDisplayField( QString fldName = "" );
608 
610  const QString displayField() const;
611 
618  void setDisplayExpression( const QString &displayExpression );
619 
626  const QString displayExpression();
627 
629  QgsVectorDataProvider* dataProvider();
630 
634  const QgsVectorDataProvider* dataProvider() const;
635 
637  void setProviderEncoding( const QString& encoding );
638 
640  void setCoordinateSystem();
641 
645  bool addJoin( const QgsVectorJoinInfo& joinInfo );
646 
648  void removeJoin( const QString& joinLayerId );
649 
650  const QList< QgsVectorJoinInfo >& vectorJoins() const;
651 
662  int addExpressionField( const QString& exp, const QgsField& fld );
663 
671  void removeExpressionField( int index );
672 
682  const QString expressionField( int index );
683 
693  void updateExpressionField( int index, const QString& exp );
694 
696  QgsLabel *label();
697 
698  const QgsLabel *label() const;
699 
700  QgsAttributeAction *actions() { return mActions; }
701 
707  int selectedFeatureCount();
708 
717  void select( QgsRectangle & rect, bool addToSelection );
718 
730  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
731 
733  void invertSelection();
734 
736  void selectAll();
737 
739  QgsFeatureIds allFeatureIds();
740 
748  void invertSelectionInRectangle( QgsRectangle & rect );
749 
758  QgsFeatureList selectedFeatures();
759 
771  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() );
772 
779  const QgsFeatureIds &selectedFeaturesIds() const;
780 
788  void setSelectedFeatures( const QgsFeatureIds &ids );
789 
791  QgsRectangle boundingBoxOfSelected();
792 
797  bool labelsEnabled() const;
798 
803  bool diagramsEnabled() const;
804 
806  void setDiagramRenderer( QgsDiagramRendererV2* r );
807  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
808 
809  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
810  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
811 
813  QgsFeatureRendererV2* rendererV2();
815  void setRendererV2( QgsFeatureRendererV2* r );
816 
818  QGis::GeometryType geometryType() const;
819 
821  bool hasGeometryType() const;
822 
824  QGis::WkbType wkbType() const;
825 
827  QString providerType() const;
828 
832  virtual bool readXml( const QDomNode& layer_node ) override;
833 
837  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
838 
847  virtual void saveStyleToDatabase( QString name, QString description,
848  bool useAsDefault, QString uiFileContent,
849  QString &msgError );
850 
859  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
860  QStringList &descriptions, QString &msgError );
861 
865  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
866 
873  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
874 
879  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
880 
891  virtual bool applyNamedStyle( QString namedStyle, QString &errorMsg );
892 
897  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
898 
904  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
905 
912  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
913 
914  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
915  bool readSld( const QDomNode& node, QString& errorMessage ) override;
916 
924  virtual long featureCount() const;
925 
932  long featureCount( QgsSymbolV2* symbol );
933 
937  void setDataSource( QString dataSource, QString baseName, QString provider , bool loadDefaultStyleFlag = false );
938 
944  bool countSymbolFeatures( bool showProgress = true );
945 
953  virtual bool setSubsetString( QString subset );
954 
959  virtual QString subsetString();
960 
964  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
965 
971  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
972 
979  bool updateFeature( QgsFeature &f );
980 
985  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
986 
991  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
992 
995  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
996 
1000  bool deleteSelectedFeatures( int *deletedCount = 0 );
1001 
1011  int addRing( const QList<QgsPoint>& ring );
1012 
1023  int addPart( const QList<QgsPoint>& ring );
1024 
1030  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1031 
1039  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1040 
1048  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1049 
1058  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
1059 
1065  int addTopologicalPoints( const QgsGeometry* geom );
1066 
1074  int addTopologicalPoints( const QgsPoint& p );
1075 
1081  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1082 
1086  Q_DECL_DEPRECATED void enableLabels( bool on );
1087 
1091  Q_DECL_DEPRECATED bool hasLabelsEnabled() const;
1092 
1094  virtual bool isEditable() const override;
1095 
1097  virtual bool isReadOnly() const;
1098 
1100  virtual bool isModified() const;
1101 
1108  bool snapPoint( QgsPoint& point, double tolerance );
1109 
1117  int snapWithContext( const QgsPoint& startPoint,
1118  double snappingTolerance,
1119  QMultiMap < double, QgsSnappingResult > &snappingResults,
1120  QgsSnapper::SnappingType snap_to );
1121 
1123  virtual void reload() override;
1124 
1128  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1129 
1133  bool draw( QgsRenderContext& rendererContext ) override;
1134 
1138  Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override;
1139 
1141  QgsRectangle extent() override;
1142 
1144  const QgsFields &pendingFields() const;
1145 
1147  QgsAttributeList pendingAllAttributesList();
1148 
1150  QgsAttributeList pendingPkAttributesList();
1151 
1153  int pendingFeatureCount();
1154 
1158  bool setReadOnly( bool readonly = true );
1159 
1161  bool startEditing();
1162 
1164  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1165 
1172  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1173 
1184  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1185 
1188  bool addAttribute( const QgsField &field );
1189 
1191  void addAttributeAlias( int attIndex, QString aliasString );
1192 
1194  void remAttributeAlias( int attIndex );
1195 
1199  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1200 
1208  const QString editorWidgetV2( int fieldIdx ) const;
1209 
1219  const QString editorWidgetV2( const QString& fieldName ) const;
1220 
1228  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
1229 
1239  const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
1240 
1244  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1248  void clearAttributeEditorWidgets();
1249 
1251  QString attributeAlias( int attributeIndex ) const;
1252 
1254  QString attributeDisplayName( int attributeIndex ) const;
1255 
1256  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1257 
1258  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1259  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1260 
1261  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1262  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1263 
1265  bool deleteAttribute( int attr );
1266 
1274  bool deleteAttributes( QList<int> attrs );
1275 
1277  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1278 
1280  bool deleteFeature( QgsFeatureId fid );
1281 
1297  bool commitChanges();
1298  const QStringList &commitErrors();
1299 
1303  bool rollBack( bool deleteBuffer = true );
1304 
1310  Q_DECL_DEPRECATED EditType editType( int idx );
1311 
1317  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1318 
1320  EditorLayout editorLayout();
1321 
1323  void setEditorLayout( EditorLayout editorLayout );
1324 
1353  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1354 
1370  void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config );
1371 
1377  Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
1378 
1380  QString editForm();
1381 
1383  void setEditForm( QString ui );
1384 
1387  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1388 
1391  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1392 
1394  QString annotationForm() const { return mAnnotationForm; }
1395 
1397  void setAnnotationForm( const QString& ui );
1398 
1400  QString editFormInit();
1401 
1403  void setEditFormInit( QString function );
1404 
1409  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1410 
1416  Q_DECL_DEPRECATED RangeData range( int idx );
1417 
1419  ValueRelationData valueRelation( int idx );
1420 
1427  QList<QgsRelation> referencingRelations( int idx );
1428 
1434  Q_DECL_DEPRECATED QString dateFormat( int idx );
1435 
1441  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1442 
1444  bool fieldEditable( int idx );
1445 
1447  bool labelOnTop( int idx );
1448 
1450  void setFieldEditable( int idx, bool editable );
1451 
1453  void setLabelOnTop( int idx, bool onTop );
1454 
1456  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1457 
1462  void beginEditCommand( QString text );
1463 
1465  void endEditCommand();
1466 
1468  void destroyEditCommand();
1469 
1471  int fieldNameIndex( const QString& fieldName ) const;
1472 
1475  {
1478  NoMarker
1479  };
1480 
1482  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1483 
1485  void updateFields();
1486 
1488  void createJoinCaches();
1489 
1494  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1495 
1497  QVariant minimumValue( int index );
1498 
1500  QVariant maximumValue( int index );
1501 
1510  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false );
1511 
1522  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = 0 );
1523 
1525  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1527  QPainter::CompositionMode featureBlendMode() const;
1528 
1530  void setLayerTransparency( int layerTransparency );
1532  int layerTransparency() const;
1533 
1534  QString metadata() override;
1535 
1537  inline QgsGeometryCache* cache() { return mCache; }
1538 
1542  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1546  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1547 
1552  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1553 
1554  public slots:
1562  void select( const QgsFeatureId &featureId );
1563 
1571  void select( const QgsFeatureIds& featureIds );
1572 
1580  void deselect( const QgsFeatureId featureId );
1581 
1589  void deselect( const QgsFeatureIds& featureIds );
1590 
1596  void removeSelection();
1597 
1601  virtual void updateExtents();
1602 
1604  void checkJoinLayerRemove( QString theLayerId );
1605 
1606  protected slots:
1607  void invalidateSymbolCountedFlag();
1608 
1609  signals:
1610 
1618  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1619 
1621  void selectionChanged();
1622 
1624  void layerModified();
1625 
1627  void beforeModifiedCheck() const;
1628 
1630  void editingStarted();
1631 
1633  void editingStopped();
1634 
1636  void beforeCommitChanges();
1637 
1639  void beforeRollBack();
1640 
1649  void attributeAdded( int idx );
1658  void attributeDeleted( int idx );
1664  void featureAdded( QgsFeatureId fid );
1673  void featureDeleted( QgsFeatureId fid );
1683  void featuresDeleted( QgsFeatureIds fids );
1688  void updatedFields();
1689  void layerDeleted();
1690 
1691  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1692  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1693 
1695  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1696  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1697  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1698  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1699  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1700  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1701 
1702  void saveLayerToProject();
1703 
1705  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1706 
1708  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1709 
1711  void layerTransparencyChanged( int layerTransparency );
1712 
1718  void editCommandStarted( const QString& text );
1719 
1725  void editCommandEnded();
1726 
1732  void editCommandDestroyed();
1733 
1743  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1744 
1754  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1755 
1756  private slots:
1757  void onRelationsLoaded();
1758  void onJoinedFieldsChanged();
1759  void onFeatureDeleted( const QgsFeatureId& fid );
1760 
1761  protected:
1763  void setExtent( const QgsRectangle &rect ) override;
1764 
1765  private: // Private methods
1766 
1768  QgsVectorLayer( const QgsVectorLayer & rhs );
1769 
1771  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1772 
1773 
1778  bool setDataProvider( QString const & provider );
1779 
1781  QgsFeatureId findFreeId();
1782 
1791  void snapToGeometry( const QgsPoint& startPoint,
1792  QgsFeatureId featureId,
1793  const QgsGeometry *geom,
1794  double sqrSnappingTolerance,
1795  QMultiMap<double, QgsSnappingResult>& snappingResults,
1796  QgsSnapper::SnappingType snap_to ) const;
1797 
1799  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1800 
1802  void readSldLabeling( const QDomNode& node );
1803 
1804  private: // Private attributes
1805 
1807  QgsVectorDataProvider *mDataProvider;
1808 
1810  QString mDisplayField;
1811 
1813  QString mDisplayExpression;
1814 
1816  QString mProviderKey;
1817 
1819  QgsAttributeAction* mActions;
1820 
1822  bool mReadOnly;
1823 
1828  QgsFeatureIds mSelectedFeatureIds;
1829 
1831  QgsFields mUpdatedFields;
1832 
1834  QMap< QString, QString > mAttributeAliasMap;
1835 
1837  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
1838 
1840  QSet<QString> mExcludeAttributesWMS;
1842  QSet<QString> mExcludeAttributesWFS;
1843 
1845  QList< TabData > mTabs;
1846 
1848  QGis::WkbType mWkbType;
1849 
1851  QgsFeatureRendererV2 *mRendererV2;
1852 
1854  QgsVectorSimplifyMethod mSimplifyMethod;
1855 
1857  QgsLabel *mLabel;
1858 
1860  bool mLabelOn;
1861 
1863  bool mLabelFontNotFoundNotified;
1864 
1866  QPainter::CompositionMode mFeatureBlendMode;
1867 
1869  int mLayerTransparency;
1870 
1872  bool mVertexMarkerOnlyForSelection;
1873 
1874  QStringList mCommitErrors;
1875 
1876  QMap< QString, bool> mFieldEditables;
1877  QMap< QString, bool> mLabelOnTop;
1878 
1879  QMap<QString, QString> mEditorWidgetV2Types;
1880  QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs;
1881 
1883  EditorLayout mEditorLayout;
1884 
1885  QString mEditForm, mEditFormInit;
1886 
1889  QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress;
1890 
1891  //annotation form for this layer
1892  QString mAnnotationForm;
1893 
1895  QgsGeometryCache* mCache;
1896 
1898  QgsVectorLayerEditBuffer* mEditBuffer;
1900 
1901  //stores information about joined layers
1902  QgsVectorLayerJoinBuffer* mJoinBuffer;
1903 
1905  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
1906 
1907  //diagram rendering object. 0 if diagram drawing is disabled
1908  QgsDiagramRendererV2* mDiagramRenderer;
1909 
1910  //stores infos about diagram placement (placement type, priority, position distance)
1911  QgsDiagramLayerSettings *mDiagramLayerSettings;
1912 
1913  bool mValidExtent;
1914  bool mLazyExtent;
1915 
1916  // Features in renderer classes counted
1917  bool mSymbolFeatureCounted;
1918 
1919  // Feature counts for each renderer symbol
1920  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
1921 
1923  bool mEditCommandActive;
1924 
1925  QgsFeatureIds mDeletedFids;
1926 
1928 };
1929 
1930 #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
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:363
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:49
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
void setExcludeAttributesWFS(const QSet< QString > &att)
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
RangeData(QVariant theMin, QVariant theMax, QVariant theStep)
QgsAttributeAction * actions()
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:365
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:370
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.
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:173
GeometryType
Definition: qgis.h:155
virtual ~QgsAttributeEditorElement()
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
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:119
const QgsDiagramLayerSettings * diagramLayerSettings() const
QgsAttributeEditorField(QString name, int idx, QObject *parent)
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)
Returns diagram settings for a feature.
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
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.
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)...
QList< int > QgsAttributeList
AttributeEditorType type() const
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
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
QList< QgsAttributeEditorElement * > children() const
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
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
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:360
The attribute value should not be shown in the attribute form.
GroupData(QString name, QList< QString > fields)
virtual void setIsGroupBox(bool isGroupBox)
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...
uuid generator - readonly and automatically intialized
QgsAttributeEditorRelation(QString name, const QgsRelation &relation, QObject *parent)
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
QMap< QString, QVariant > QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
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)
QSet< int > QgsAttributeIds
QgsAttributeEditorContainer(QString name, QObject *parent)
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.
QString joinLayerId
Source layer.
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
QList< GroupData > mGroups