QGIS API Documentation  2.9.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgsvectorlayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayer.h - description
3  -------------------
4  begin : Oct 29, 2003
5  copyright : (C) 2003 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSVECTORLAYER_H
19 #define QGSVECTORLAYER_H
20 
21 #include <QMap>
22 #include <QSet>
23 #include <QList>
24 #include <QStringList>
25 
26 #include "qgis.h"
27 #include "qgsmaplayer.h"
28 #include "qgsfeature.h"
29 #include "qgsfeatureiterator.h"
30 #include "qgseditorwidgetconfig.h"
31 #include "qgsfield.h"
32 #include "qgssnapper.h"
33 #include "qgsfield.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 
794  void setDiagramRenderer( QgsDiagramRendererV2* r );
795  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
796 
797  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
798  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
799 
801  QgsFeatureRendererV2* rendererV2();
803  void setRendererV2( QgsFeatureRendererV2* r );
804 
806  QGis::GeometryType geometryType() const;
807 
809  bool hasGeometryType() const;
810 
812  QGis::WkbType wkbType() const;
813 
815  QString providerType() const;
816 
820  virtual bool readXml( const QDomNode& layer_node ) override;
821 
825  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) override;
826 
835  virtual void saveStyleToDatabase( QString name, QString description,
836  bool useAsDefault, QString uiFileContent,
837  QString &msgError );
838 
847  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
848  QStringList &descriptions, QString &msgError );
849 
853  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
854 
861  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
862 
867  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
868 
879  virtual bool applyNamedStyle( QString namedStyle, QString &errorMsg );
880 
885  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
886 
892  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
893 
900  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
901 
902  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
903  bool readSld( const QDomNode& node, QString& errorMessage ) override;
904 
912  virtual long featureCount() const;
913 
920  long featureCount( QgsSymbolV2* symbol );
921 
927  bool countSymbolFeatures( bool showProgress = true );
928 
936  virtual bool setSubsetString( QString subset );
937 
942  virtual QString subsetString();
943 
947  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
948 
954  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
955 
962  bool updateFeature( QgsFeature &f );
963 
968  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
969 
974  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
975 
978  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
979 
983  bool deleteSelectedFeatures( int *deletedCount = 0 );
984 
994  int addRing( const QList<QgsPoint>& ring );
995 
1006  int addPart( const QList<QgsPoint>& ring );
1007 
1013  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1014 
1022  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1023 
1031  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1032 
1041  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
1042 
1048  int addTopologicalPoints( QgsGeometry* geom );
1049 
1057  int addTopologicalPoints( const QgsPoint& p );
1058 
1064  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1065 
1067  void enableLabels( bool on );
1068 
1070  bool hasLabelsEnabled() const;
1071 
1073  virtual bool isEditable() const override;
1074 
1076  virtual bool isReadOnly() const;
1077 
1079  virtual bool isModified() const;
1080 
1087  bool snapPoint( QgsPoint& point, double tolerance );
1088 
1096  int snapWithContext( const QgsPoint& startPoint,
1097  double snappingTolerance,
1098  QMultiMap < double, QgsSnappingResult > &snappingResults,
1099  QgsSnapper::SnappingType snap_to );
1100 
1102  virtual void reload() override;
1103 
1107  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1108 
1112  bool draw( QgsRenderContext& rendererContext ) override;
1113 
1115  void drawLabels( QgsRenderContext& rendererContext ) override;
1116 
1118  QgsRectangle extent() override;
1119 
1121  const QgsFields &pendingFields() const;
1122 
1124  QgsAttributeList pendingAllAttributesList();
1125 
1127  QgsAttributeList pendingPkAttributesList();
1128 
1130  int pendingFeatureCount();
1131 
1135  bool setReadOnly( bool readonly = true );
1136 
1138  bool startEditing();
1139 
1141  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1142 
1149  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1150 
1161  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1162 
1165  bool addAttribute( const QgsField &field );
1166 
1168  void addAttributeAlias( int attIndex, QString aliasString );
1169 
1171  void remAttributeAlias( int attIndex );
1172 
1176  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1177 
1185  const QString editorWidgetV2( int fieldIdx ) const;
1186 
1196  const QString editorWidgetV2( const QString& fieldName ) const;
1197 
1205  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
1206 
1216  const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
1217 
1221  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1225  void clearAttributeEditorWidgets();
1226 
1228  QString attributeAlias( int attributeIndex ) const;
1229 
1231  QString attributeDisplayName( int attributeIndex ) const;
1232 
1233  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1234 
1235  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1236  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1237 
1238  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1239  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1240 
1242  bool deleteAttribute( int attr );
1243 
1251  bool deleteAttributes( QList<int> attrs );
1252 
1254  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1255 
1257  bool deleteFeature( QgsFeatureId fid );
1258 
1274  bool commitChanges();
1275  const QStringList &commitErrors();
1276 
1280  bool rollBack( bool deleteBuffer = true );
1281 
1287  Q_DECL_DEPRECATED EditType editType( int idx );
1288 
1294  Q_DECL_DEPRECATED void setEditType( int idx, EditType edit );
1295 
1297  EditorLayout editorLayout();
1298 
1300  void setEditorLayout( EditorLayout editorLayout );
1301 
1330  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1331 
1347  void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& config );
1348 
1354  Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
1355 
1357  QString editForm();
1358 
1360  void setEditForm( QString ui );
1361 
1364  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1365 
1368  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1369 
1371  QString annotationForm() const { return mAnnotationForm; }
1372 
1374  void setAnnotationForm( const QString& ui );
1375 
1377  QString editFormInit();
1378 
1380  void setEditFormInit( QString function );
1381 
1386  Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
1387 
1393  Q_DECL_DEPRECATED RangeData range( int idx );
1394 
1396  ValueRelationData valueRelation( int idx );
1397 
1404  QList<QgsRelation> referencingRelations( int idx );
1405 
1411  Q_DECL_DEPRECATED QString dateFormat( int idx );
1412 
1418  Q_DECL_DEPRECATED QSize widgetSize( int idx );
1419 
1421  bool fieldEditable( int idx );
1422 
1424  bool labelOnTop( int idx );
1425 
1427  void setFieldEditable( int idx, bool editable );
1428 
1430  void setLabelOnTop( int idx, bool onTop );
1431 
1433  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1434 
1439  void beginEditCommand( QString text );
1440 
1442  void endEditCommand();
1443 
1445  void destroyEditCommand();
1446 
1448  int fieldNameIndex( const QString& fieldName ) const;
1449 
1452  {
1455  NoMarker
1456  };
1457 
1459  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1460 
1462  void updateFields();
1463 
1465  void createJoinCaches();
1466 
1471  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1472 
1474  QVariant minimumValue( int index );
1475 
1477  QVariant maximumValue( int index );
1478 
1479  /* Set the blending mode used for rendering each feature */
1480  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1481  /* Returns the current blending mode for features */
1482  QPainter::CompositionMode featureBlendMode() const;
1483 
1484  /* Set the transparency for the vector layer */
1485  void setLayerTransparency( int layerTransparency );
1486  /* Returns the current transparency for the vector layer */
1487  int layerTransparency() const;
1488 
1489  QString metadata() override;
1490 
1492  inline QgsGeometryCache* cache() { return mCache; }
1493 
1497  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1501  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1502 
1507  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1508 
1509  public slots:
1517  void select( const QgsFeatureId &featureId );
1518 
1526  void select( const QgsFeatureIds& featureIds );
1527 
1535  void deselect( const QgsFeatureId featureId );
1536 
1544  void deselect( const QgsFeatureIds& featureIds );
1545 
1551  void removeSelection();
1552 
1556  virtual void updateExtents();
1557 
1559  void checkJoinLayerRemove( QString theLayerId );
1560 
1561  protected slots:
1562  void invalidateSymbolCountedFlag();
1563 
1564  signals:
1565 
1573  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1574 
1576  void selectionChanged();
1577 
1579  void layerModified();
1580 
1582  void beforeModifiedCheck() const;
1583 
1585  void editingStarted();
1586 
1588  void editingStopped();
1589 
1591  void beforeCommitChanges();
1592 
1594  void beforeRollBack();
1595 
1604  void attributeAdded( int idx );
1613  void attributeDeleted( int idx );
1614  void featureAdded( QgsFeatureId fid );
1615  void featureDeleted( QgsFeatureId fid );
1620  void updatedFields();
1621  void layerDeleted();
1622 
1623  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1624  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom );
1625 
1627  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1628  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1629  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1630  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1631  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1632  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1633 
1634  void saveLayerToProject();
1635 
1637  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1638 
1640  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1641 
1643  void layerTransparencyChanged( int layerTransparency );
1644 
1650  void editCommandStarted( const QString& text );
1651 
1657  void editCommandEnded();
1658 
1664  void editCommandDestroyed();
1665 
1675  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1676 
1686  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1687 
1688  private slots:
1689  void onRelationsLoaded();
1690  void onJoinedFieldsChanged();
1691 
1692  protected:
1694  void setExtent( const QgsRectangle &rect ) override;
1695 
1696  private: // Private methods
1697 
1699  QgsVectorLayer( const QgsVectorLayer & rhs );
1700 
1702  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1703 
1708  bool setDataProvider( QString const & provider );
1709 
1711  QgsFeatureId findFreeId();
1712 
1721  void snapToGeometry( const QgsPoint& startPoint,
1722  QgsFeatureId featureId,
1723  QgsGeometry* geom,
1724  double sqrSnappingTolerance,
1725  QMultiMap<double, QgsSnappingResult>& snappingResults,
1726  QgsSnapper::SnappingType snap_to ) const;
1727 
1729  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1730 
1732  void readSldLabeling( const QDomNode& node );
1733 
1734  private: // Private attributes
1735 
1737  QgsVectorDataProvider *mDataProvider;
1738 
1740  QString mDisplayField;
1741 
1743  QString mDisplayExpression;
1744 
1746  QString mProviderKey;
1747 
1749  QgsAttributeAction* mActions;
1750 
1752  bool mReadOnly;
1753 
1758  QgsFeatureIds mSelectedFeatureIds;
1759 
1761  QgsFields mUpdatedFields;
1762 
1764  QMap< QString, QString > mAttributeAliasMap;
1765 
1767  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
1768 
1770  QSet<QString> mExcludeAttributesWMS;
1772  QSet<QString> mExcludeAttributesWFS;
1773 
1775  QList< TabData > mTabs;
1776 
1778  QGis::WkbType mWkbType;
1779 
1781  QgsFeatureRendererV2 *mRendererV2;
1782 
1784  QgsVectorSimplifyMethod mSimplifyMethod;
1785 
1787  QgsLabel *mLabel;
1788 
1790  bool mLabelOn;
1791 
1793  bool mLabelFontNotFoundNotified;
1794 
1796  QPainter::CompositionMode mFeatureBlendMode;
1797 
1799  int mLayerTransparency;
1800 
1802  bool mVertexMarkerOnlyForSelection;
1803 
1804  QStringList mCommitErrors;
1805 
1806  QMap< QString, bool> mFieldEditables;
1807  QMap< QString, bool> mLabelOnTop;
1808 
1809  QMap<QString, QString> mEditorWidgetV2Types;
1810  QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs;
1811 
1813  EditorLayout mEditorLayout;
1814 
1815  QString mEditForm, mEditFormInit;
1816 
1819  QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress;
1820 
1821  //annotation form for this layer
1822  QString mAnnotationForm;
1823 
1825  QgsGeometryCache* mCache;
1826 
1828  QgsVectorLayerEditBuffer* mEditBuffer;
1830 
1831  //stores information about joined layers
1832  QgsVectorLayerJoinBuffer* mJoinBuffer;
1833 
1835  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
1836 
1837  //diagram rendering object. 0 if diagram drawing is disabled
1838  QgsDiagramRendererV2* mDiagramRenderer;
1839 
1840  //stores infos about diagram placement (placement type, priority, position distance)
1841  QgsDiagramLayerSettings *mDiagramLayerSettings;
1842 
1843  bool mValidExtent;
1844  bool mLazyExtent;
1845 
1846  // Features in renderer classes counted
1847  bool mSymbolFeatureCounted;
1848 
1849  // Feature counts for each renderer symbol
1850  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
1851 
1853 };
1854 
1855 #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:315
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:317
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:322
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:172
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:113
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:33
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:312
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:30
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