QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include <QMap>
23 #include <QSet>
24 #include <QList>
25 #include <QStringList>
26 
27 #include "qgis.h"
28 #include "qgsmaplayer.h"
29 #include "qgsfeature.h"
30 #include "qgsfeatureiterator.h"
31 #include "qgseditorwidgetconfig.h"
32 #include "qgsfield.h"
33 #include "qgssnapper.h"
34 #include "qgsrelation.h"
36 
37 class QPainter;
38 class QImage;
39 
41 class QgsAttributeAction;
48 class QgsFeatureRequest;
49 class QgsGeometry;
50 class QgsGeometryCache;
51 class QgsGeometryVertexIndex;
52 class QgsLabel;
53 class QgsMapToPixel;
54 class QgsRectangle;
55 class QgsRectangle;
56 class QgsRelation;
57 class QgsRelationManager;
59 class QgsSymbolV2;
63 class QgsPointV2;
64 
67 
77 class CORE_EXPORT QgsAttributeEditorElement : public QObject
78 {
79  Q_OBJECT
80  public:
81 
83  {
87  AeTypeInvalid
88  };
89 
98  : QObject( parent ), mType( type ), mName( name ) {}
99 
102 
108  QString name() const { return mName; }
109 
115  AttributeEditorType type() const { return mType; }
116 
124  virtual QDomElement toDomElement( QDomDocument& doc ) const = 0;
125 
126  protected:
129 };
130 
136 {
137  public:
145  : QgsAttributeEditorElement( AeTypeContainer, name, parent )
146  , mIsGroupBox( true )
147  {}
148 
151 
159  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
160 
166  virtual void addChildElement( QgsAttributeEditorElement* element );
167 
173  virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
174 
180  virtual bool isGroupBox() const { return mIsGroupBox; }
181 
187  QList<QgsAttributeEditorElement*> children() const { return mChildren; }
188 
196  virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
197 
203  void setName( const QString& name );
204 
205  private:
206  bool mIsGroupBox;
208 };
209 
214 {
215  public:
223  QgsAttributeEditorField( QString name, int idx, QObject *parent )
224  : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx ) {}
225 
228 
236  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
237 
242  int idx() const { return mIdx; }
243 
244  private:
245  int mIdx;
246 };
247 
254 {
255  public:
263  QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent )
264  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
265  , mRelationId( relationId ) {}
266 
274  QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent )
275  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
276  , mRelationId( relation.id() )
277  , mRelation( relation ) {}
278 
281 
289  virtual QDomElement toDomElement( QDomDocument& doc ) const override;
290 
296  const QgsRelation& relation() const { return mRelation; }
297 
304  bool init( QgsRelationManager *relManager );
305 
306  private:
307  QString mRelationId;
308  QgsRelation mRelation;
309 };
310 
311 
312 struct CORE_EXPORT QgsVectorJoinInfo
313 {
326 
331 
336 
337  bool operator==( const QgsVectorJoinInfo& other ) const
338  {
339  return targetFieldName == other.targetFieldName &&
340  joinLayerId == other.joinLayerId &&
341  joinFieldName == other.joinFieldName &&
342  joinFieldsSubset == other.joinFieldsSubset &&
343  memoryCache == other.memoryCache &&
344  prefix == other.prefix;
345  }
346 
349  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
352  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
353 
354 protected:
357 };
358 
621 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
622 {
623  Q_OBJECT
624 
625  public:
628  {
629  GeneratedLayout = 0,
630  TabLayout = 1,
631  UiFileLayout = 2
632  };
633 
637  enum EditType
638  {
660  };
661 
665  {
666  SuppressDefault = 0, // use the application-wide setting
667  SuppressOn = 1,
668  SuppressOff = 2
669  };
670 
671  struct RangeData
672  {
673  RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );}
674  RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
675  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
676 
680  };
681 
683  {
684  ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
685  ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
686  bool allowMulti = false,
687  QString filterExpression = QString::null )
688  : mLayer( layer )
689  , mKey( key )
690  , mValue( value )
691  , mFilterExpression( filterExpression )
692  , mAllowNull( allowNull )
693  , mOrderByValue( orderByValue )
694  , mAllowMulti( allowMulti )
695  {}
696 
703  bool mAllowMulti; /* allow selection of multiple keys */
704  };
705 
706  struct GroupData
707  {
710  : mName( name ), mFields( fields ) {}
713  };
714 
715  struct TabData
716  {
717  TabData() {}
719  : mName( name ), mFields( fields ), mGroups( groups ) {}
723  };
724 
738  QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
739  QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
740 
742  virtual ~QgsVectorLayer();
743 
745  QString storageType() const;
746 
748  QString capabilitiesString() const;
749 
751  QString dataComment() const;
752 
754  void setDisplayField( QString fldName = "" );
755 
757  const QString displayField() const;
758 
765  void setDisplayExpression( const QString &displayExpression );
766 
773  const QString displayExpression();
774 
776  QgsVectorDataProvider* dataProvider();
777 
781  const QgsVectorDataProvider* dataProvider() const;
782 
784  void setProviderEncoding( const QString& encoding );
785 
787  void setCoordinateSystem();
788 
792  bool addJoin( const QgsVectorJoinInfo& joinInfo );
793 
795  void removeJoin( const QString& joinLayerId );
796 
797  const QList<QgsVectorJoinInfo> vectorJoins() const;
798 
809  int addExpressionField( const QString& exp, const QgsField& fld );
810 
818  void removeExpressionField( int index );
819 
829  const QString expressionField( int index );
830 
840  void updateExpressionField( int index, const QString& exp );
841 
843  QgsLabel *label();
844 
845  const QgsLabel *label() const;
846 
847  QgsAttributeAction *actions() { return mActions; }
848 
854  int selectedFeatureCount();
855 
864  void select( QgsRectangle & rect, bool addToSelection );
865 
877  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
878 
880  void invertSelection();
881 
883  void selectAll();
884 
886  QgsFeatureIds allFeatureIds();
887 
895  void invertSelectionInRectangle( QgsRectangle & rect );
896 
905  QgsFeatureList selectedFeatures();
906 
918  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() );
919 
926  const QgsFeatureIds &selectedFeaturesIds() const;
927 
935  void setSelectedFeatures( const QgsFeatureIds &ids );
936 
938  QgsRectangle boundingBoxOfSelected();
939 
944  bool labelsEnabled() const;
945 
950  bool diagramsEnabled() const;
951 
953  void setDiagramRenderer( QgsDiagramRendererV2* r );
954  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
955 
956  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
957  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
958 
960  QgsFeatureRendererV2* rendererV2() const;
962  void setRendererV2( QgsFeatureRendererV2* r );
963 
965  QGis::GeometryType geometryType() const;
966 
968  bool hasGeometryType() const;
969 
971  QGis::WkbType wkbType() const;
972 
974  QString providerType() const;
975 
979  virtual bool readXml( const QDomNode& layer_node ) override;
980 
984  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
985 
994  virtual void saveStyleToDatabase( QString name, QString description,
995  bool useAsDefault, QString uiFileContent,
996  QString &msgError );
997 
1006  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
1007  QStringList &descriptions, QString &msgError );
1008 
1012  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
1013 
1020  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
1021 
1026  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
1027 
1038  virtual bool applyNamedStyle( QString namedStyle, QString &errorMsg );
1039 
1044  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
1045 
1051  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
1052 
1059  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
1060 
1061  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
1062  bool readSld( const QDomNode& node, QString& errorMessage ) override;
1063 
1071  virtual long featureCount() const;
1072 
1079  long featureCount( QgsSymbolV2* symbol );
1080 
1091  void setDataSource( QString dataSource, QString baseName, QString provider, bool loadDefaultStyleFlag = false );
1092 
1098  bool countSymbolFeatures( bool showProgress = true );
1099 
1107  virtual bool setSubsetString( QString subset );
1108 
1113  virtual QString subsetString();
1114 
1118  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
1119 
1125  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
1126 
1133  bool updateFeature( QgsFeature &f );
1134 
1139  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1140 
1145  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1146 
1151  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
1152 
1155  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
1156 
1160  bool deleteSelectedFeatures( int *deletedCount = 0 );
1161 
1171  int addRing( const QList<QgsPoint>& ring );
1172 
1183  int addPart( const QList<QgsPoint>& ring );
1184 
1190  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1191 
1199  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1200 
1208  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1209 
1218  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
1219 
1225  int addTopologicalPoints( const QgsGeometry* geom );
1226 
1234  int addTopologicalPoints( const QgsPoint& p );
1235 
1241  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1242 
1246  Q_DECL_DEPRECATED void enableLabels( bool on );
1247 
1251  Q_DECL_DEPRECATED bool hasLabelsEnabled() const;
1252 
1254  virtual bool isEditable() const override;
1255 
1257  virtual bool isReadOnly() const;
1258 
1260  virtual bool isModified() const;
1261 
1268  bool snapPoint( QgsPoint& point, double tolerance );
1269 
1277  int snapWithContext( const QgsPoint& startPoint,
1278  double snappingTolerance,
1279  QMultiMap < double, QgsSnappingResult > &snappingResults,
1280  QgsSnapper::SnappingType snap_to );
1281 
1283  virtual void reload() override;
1284 
1288  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1289 
1293  bool draw( QgsRenderContext& rendererContext ) override;
1294 
1298  Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override;
1299 
1301  QgsRectangle extent() override;
1302 
1309  const QgsFields &pendingFields() const { return mUpdatedFields; }
1310 
1312  QgsAttributeList pendingAllAttributesList();
1313 
1315  QgsAttributeList pendingPkAttributesList();
1316 
1318  int pendingFeatureCount();
1319 
1323  bool setReadOnly( bool readonly = true );
1324 
1331  bool startEditing();
1332 
1334  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1335 
1342  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1343 
1354  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1355 
1358  bool addAttribute( const QgsField &field );
1359 
1361  void addAttributeAlias( int attIndex, QString aliasString );
1362 
1364  void remAttributeAlias( int attIndex );
1365 
1369  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1370 
1378  const QString editorWidgetV2( int fieldIdx ) const;
1379 
1389  const QString editorWidgetV2( const QString& fieldName ) const;
1390 
1398  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
1399 
1409  const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
1410 
1414  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1418  void clearAttributeEditorWidgets();
1419 
1421  QString attributeAlias( int attributeIndex ) const;
1422 
1424  QString attributeDisplayName( int attributeIndex ) const;
1425 
1426  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1427 
1428  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1429  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1430 
1431  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1432  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1433 
1435  bool deleteAttribute( int attr );
1436 
1444  bool deleteAttributes( QList<int> attrs );
1445 
1447  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1448 
1450  bool deleteFeature( QgsFeatureId fid );
1451 
1467  bool commitChanges();
1468  const QStringList &commitErrors();
1469 
1473  bool rollBack( bool deleteBuffer = true );
1474 
1480  Q_DECL_DEPRECATED EditType editType( int idx );
1481 
1487  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1488 
1490  EditorLayout editorLayout();
1491 
1493  void setEditorLayout( EditorLayout editorLayout );
1494 
1523  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1524 
1540  void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config );
1541 
1547  Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
1548 
1550  QString editForm();
1551 
1553  void setEditForm( QString ui );
1554 
1557  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1558 
1561  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1562 
1564  QString annotationForm() const { return mAnnotationForm; }
1565 
1567  void setAnnotationForm( const QString& ui );
1568 
1570  QString editFormInit();
1571 
1573  void setEditFormInit( QString function );
1574 
1579  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1580 
1586  Q_DECL_DEPRECATED RangeData range( int idx );
1587 
1589  ValueRelationData valueRelation( int idx );
1590 
1597  QList<QgsRelation> referencingRelations( int idx );
1598 
1604  Q_DECL_DEPRECATED QString dateFormat( int idx );
1605 
1611  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1612 
1614  bool fieldEditable( int idx );
1615 
1617  bool labelOnTop( int idx );
1618 
1620  void setFieldEditable( int idx, bool editable );
1621 
1623  void setLabelOnTop( int idx, bool onTop );
1624 
1626  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1627 
1632  void beginEditCommand( QString text );
1633 
1635  void endEditCommand();
1636 
1638  void destroyEditCommand();
1639 
1641  int fieldNameIndex( const QString& fieldName ) const;
1642 
1645  {
1648  NoMarker
1649  };
1650 
1652  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1653 
1655  void updateFields();
1656 
1658  void createJoinCaches();
1659 
1664  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1665 
1667  QVariant minimumValue( int index );
1668 
1670  QVariant maximumValue( int index );
1671 
1680  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false );
1681 
1692  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = 0 );
1693 
1695  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1697  QPainter::CompositionMode featureBlendMode() const;
1698 
1700  void setLayerTransparency( int layerTransparency );
1702  int layerTransparency() const;
1703 
1704  QString metadata() override;
1705 
1707  inline QgsGeometryCache* cache() { return mCache; }
1708 
1712  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1716  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1717 
1722  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1723 
1724  public slots:
1732  void select( const QgsFeatureId &featureId );
1733 
1741  void select( const QgsFeatureIds& featureIds );
1742 
1750  void deselect( const QgsFeatureId featureId );
1751 
1759  void deselect( const QgsFeatureIds& featureIds );
1760 
1766  void removeSelection();
1767 
1771  virtual void updateExtents();
1772 
1774  void checkJoinLayerRemove( QString theLayerId );
1775 
1776  protected slots:
1777  void invalidateSymbolCountedFlag();
1778 
1779  signals:
1780 
1788  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1789 
1791  void selectionChanged();
1792 
1794  void layerModified();
1795 
1797  void beforeModifiedCheck() const;
1798 
1800  void editingStarted();
1801 
1803  void editingStopped();
1804 
1806  void beforeCommitChanges();
1807 
1809  void beforeRollBack();
1810 
1819  void attributeAdded( int idx );
1828  void attributeDeleted( int idx );
1834  void featureAdded( QgsFeatureId fid );
1843  void featureDeleted( QgsFeatureId fid );
1853  void featuresDeleted( QgsFeatureIds fids );
1858  void updatedFields();
1859  void layerDeleted();
1860 
1861  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1862  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1863 
1865  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1866  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1867  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1868  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1869  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1870  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1871 
1872  void saveLayerToProject();
1873 
1875  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1876 
1878  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1879 
1881  void layerTransparencyChanged( int layerTransparency );
1882 
1888  void editCommandStarted( const QString& text );
1889 
1895  void editCommandEnded();
1896 
1902  void editCommandDestroyed();
1903 
1913  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1914 
1924  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1925 
1926  private slots:
1927  void onRelationsLoaded();
1928  void onJoinedFieldsChanged();
1929  void onFeatureDeleted( const QgsFeatureId& fid );
1930 
1931  protected:
1933  void setExtent( const QgsRectangle &rect ) override;
1934 
1935  private: // Private methods
1936 
1938  QgsVectorLayer( const QgsVectorLayer & rhs );
1939 
1941  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1942 
1943 
1948  bool setDataProvider( QString const & provider );
1949 
1951  QgsFeatureId findFreeId();
1952 
1961  void snapToGeometry( const QgsPoint& startPoint,
1962  QgsFeatureId featureId,
1963  const QgsGeometry *geom,
1964  double sqrSnappingTolerance,
1965  QMultiMap<double, QgsSnappingResult>& snappingResults,
1966  QgsSnapper::SnappingType snap_to ) const;
1967 
1969  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1970 
1972  void readSldLabeling( const QDomNode& node );
1973 
1974  private: // Private attributes
1975 
1977  QgsVectorDataProvider *mDataProvider;
1978 
1980  QString mDisplayField;
1981 
1983  QString mDisplayExpression;
1984 
1986  QString mProviderKey;
1987 
1989  QgsAttributeAction* mActions;
1990 
1992  bool mReadOnly;
1993 
1998  QgsFeatureIds mSelectedFeatureIds;
1999 
2001  QgsFields mUpdatedFields;
2002 
2004  QMap< QString, QString > mAttributeAliasMap;
2005 
2007  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
2008 
2010  QSet<QString> mExcludeAttributesWMS;
2012  QSet<QString> mExcludeAttributesWFS;
2013 
2015  QList< TabData > mTabs;
2016 
2018  QGis::WkbType mWkbType;
2019 
2021  QgsFeatureRendererV2 *mRendererV2;
2022 
2024  QgsVectorSimplifyMethod mSimplifyMethod;
2025 
2027  QgsLabel *mLabel;
2028 
2030  bool mLabelOn;
2031 
2033  bool mLabelFontNotFoundNotified;
2034 
2036  QPainter::CompositionMode mFeatureBlendMode;
2037 
2039  int mLayerTransparency;
2040 
2042  bool mVertexMarkerOnlyForSelection;
2043 
2044  QStringList mCommitErrors;
2045 
2046  QMap< QString, bool> mFieldEditables;
2047  QMap< QString, bool> mLabelOnTop;
2048 
2049  QMap<QString, QString> mEditorWidgetV2Types;
2050  QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs;
2051 
2053  EditorLayout mEditorLayout;
2054 
2055  QString mEditForm, mEditFormInit;
2056 
2059  QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress;
2060 
2061  //annotation form for this layer
2062  QString mAnnotationForm;
2063 
2065  QgsGeometryCache* mCache;
2066 
2068  QgsVectorLayerEditBuffer* mEditBuffer;
2070 
2071  //stores information about joined layers
2072  QgsVectorLayerJoinBuffer* mJoinBuffer;
2073 
2075  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2076 
2077  //diagram rendering object. 0 if diagram drawing is disabled
2078  QgsDiagramRendererV2* mDiagramRenderer;
2079 
2080  //stores infos about diagram placement (placement type, priority, position distance)
2081  QgsDiagramLayerSettings *mDiagramLayerSettings;
2082 
2083  bool mValidExtent;
2084  bool mLazyExtent;
2085 
2086  // Features in renderer classes counted
2087  bool mSymbolFeatureCounted;
2088 
2089  // Feature counts for each renderer symbol
2090  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
2091 
2093  bool mEditCommandActive;
2094 
2095  QgsFeatureIds mDeletedFids;
2096 
2098 };
2099 
2100 #endif
virtual bool isEditable() const
True if the layer can be edited.
Wrapper for iterator of features from vector data provider or vector layer.
QString annotationForm() const
Get annotation form.
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:49
virtual ~QgsAttributeEditorContainer()
Destructor.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
void setExcludeAttributesWFS(const QSet< QString > &att)
This is an abstract base class for any elements of a drag and drop form.
virtual QString metadata()
Obtain Metadata for this layer.
QString targetFieldName
Join field in the target layer.
virtual void drawLabels(QgsRenderContext &rendererContext)
Draw labels.
GeometryType
Definition: qgis.h:155
virtual bool isGroupBox() const
Returns if this ccontainer is going to be rendered as a group box.
RangeData(QVariant theMin, QVariant theMax, QVariant theStep)
QgsAttributeAction * actions()
EditorLayout
The different types to layout the attribute editor.
The attribute value should not be changed in the attribute form.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:408
Manages an editor widget Widget and wrapper share the same parent.
void setExcludeAttributesWMS(const QSet< QString > &att)
int joinFieldIndex
Join field index in the source layer.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage)=0
Read the symbology for the current layer from the Dom node supplied.
Storage and management of actions associated with Qgis layer attributes.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:129
VertexMarkerType
Editing vertex markers.
QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfield.h:173
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:75
This element will load a field's widget onto the form.
WkbType
Used for symbology operations.
Definition: qgis.h:53
virtual ~QgsAttributeEditorElement()
Destructor.
This element will load a relation editor onto the form.
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
Definition: qgsmaplayer.h:134
const QgsRelation & relation() const
Get the id of the relation which shall be embedded.
bool memoryCache
True if the join is cached in virtual memory.
int targetFieldIndex
Join field index in the target layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:162
const QgsDiagramLayerSettings * diagramLayerSettings() const
QgsAttributeEditorField(QString name, int idx, QObject *parent)
Creates a new attribute editor element which represents a field.
int idx() const
Return the index of the field.
TabData(QString name, QList< QString > fields, QList< GroupData > groups)
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
QgsAttributeEditorRelation(QString name, const QString &relationId, QObject *parent)
Creates a new element which embeds a relation.
Returns diagram settings for a feature.
QString name() const
Return the name of this element.
Manages joined fields for a vector layer.
virtual bool draw(QgsRenderContext &rendererContext)
This is the method that does the actual work of drawing the layer onto a paint device.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:66
QString prefix
An optional prefix.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
void setJoinFieldNamesSubset(QStringList *fieldNamesSubset)
Set subset of fields to be used from joined layer.
bool operator==(const QgsVectorJoinInfo &other) const
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document)
Called by writeLayerXML(), used by children to write state specific to them to project files...
The attribute value should not be shown in the attribute form.
const QSet< QString > & excludeAttributesWFS() const
Point geometry type.
Definition: qgspointv2.h:29
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
const QgsFields & pendingFields() const
Returns the list of fields of this layer.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
AttributeEditorType type() const
The type of this element.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
virtual ~QgsAttributeEditorField()
Destructor.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:38
const QMap< QString, QString > & attributeAliases() const
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
Definition: qgspoint.h:63
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:353
void setName(const char *name)
virtual ~QgsAttributeEditorRelation()
Destructor.
QList< QgsAttributeEditorElement * > children() const
Get a list of the children elements of this container.
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
QList< QString > mFields
A class to render labels.
Definition: qgslabel.h:51
uuid generator - readonly and automatically intialized
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
ValueRelationData(QString layer, QString key, QString value, bool allowNull, bool orderByValue, bool allowMulti=false, QString filterExpression=QString::null)
Buffers information about expression fields for a vector layer.
virtual QDomElement toDomElement(QDomDocument &doc) const =0
Is reimplemented in classes inheriting from this to serialize it.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
GroupData(QString name, QList< QString > fields)
virtual void setIsGroupBox(bool isGroupBox)
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
This class manages a set of relations between layers.
virtual bool readXml(const QDomNode &layer_node)
Called by readLayerXML(), used by children to read state specific to them from project files...
QgsAttributeEditorRelation(QString name, const QgsRelation &relation, QObject *parent)
Creates a new element which embeds a relation.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Base class for utility classes that encapsulate information necessary for rendering of map layers...
void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
virtual QString loadNamedStyle(const QString &theURI, bool &theResultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
QList< QString > mFields
QgsAttributeEditorElement(AttributeEditorType type, QString name, QObject *parent=NULL)
Constructor.
QSet< int > QgsAttributeIds
QgsAttributeEditorContainer(QString name, QObject *parent)
Creates a new attribute editor container.
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
QList< int > QgsAttributeList
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
modularized edit widgets
QString joinLayerId
Source layer.
value map from an table
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
QList< GroupData > mGroups