QGIS API Documentation  2.2.0-Valmiera
 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  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 
40 class QgsAttributeAction;
42 class QgsEditorWidgetWrapper;
43 class QgsFeatureRequest;
44 class QgsGeometry;
45 class QgsGeometryVertexIndex;
46 class QgsLabel;
47 class QgsMapToPixel;
48 class QgsRectangle;
49 class QgsRelation;
50 class QgsRelationManager;
53 class QgsRectangle;
58 class QgsGeometryCache;
60 class QgsSymbolV2;
62 
63 typedef QList<int> QgsAttributeList;
64 typedef QSet<int> QgsAttributeIds;
65 
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 
97 {
98  public:
99  QgsAttributeEditorContainer( QString name, QObject *parent )
100  : QgsAttributeEditorElement( AeTypeContainer, name, parent ) {}
101 
103 
104  virtual QDomElement toDomElement( QDomDocument& doc ) const;
105  virtual void addChildElement( QgsAttributeEditorElement *widget );
106  virtual bool isGroupBox() const { return true; }
107  QList<QgsAttributeEditorElement*> children() const { return mChildren; }
108  virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditorType type ) const;
109 
110  private:
111  QList<QgsAttributeEditorElement*> mChildren;
112 };
113 
116 {
117  public:
118  QgsAttributeEditorField( QString name , int idx, QObject *parent )
119  : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx ) {}
120 
122 
123  virtual QDomElement toDomElement( QDomDocument& doc ) const;
124  int idx() const { return mIdx; }
125 
126  private:
127  int mIdx;
128 };
129 
132 {
133  public:
134  QgsAttributeEditorRelation( QString name, const QString &relationId, QObject *parent )
135  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
136  , mRelationId( relationId ) {}
137 
138  QgsAttributeEditorRelation( QString name, const QgsRelation& relation, QObject *parent )
139  : QgsAttributeEditorElement( AeTypeRelation, name, parent )
140  , mRelationId( relation.id() )
141  , mRelation( relation ) {}
142 
144 
145  virtual QDomElement toDomElement( QDomDocument& doc ) const;
146  const QgsRelation& relation() const { return mRelation; }
147 
154  bool init( QgsRelationManager *relManager );
155 
156  private:
157  QString mRelationId;
159 };
160 
162 struct CORE_EXPORT QgsVectorJoinInfo
163 {
167  QString joinLayerId;
169  QString joinFieldName;
175  QHash< QString, QgsAttributes> cachedAttributes;
176 
181 };
182 
451 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
452 {
453  Q_OBJECT
454 
455  public:
458  {
459  GeneratedLayout = 0,
460  TabLayout = 1,
461  UiFileLayout = 2
462  };
463 
464  enum EditType
465  {
487  };
488 
492  {
493  SuppressDefault = 0, // use the application-wide setting
494  SuppressOn = 1,
495  SuppressOff = 2
496  };
497 
498  struct RangeData
499  {
501  RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
502  : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
503 
504  QVariant mMin;
505  QVariant mMax;
506  QVariant mStep;
507  };
508 
510  {
512  ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
513  bool allowMulti = false,
514  QString filterExpression = QString::null )
515  : mLayer( layer )
516  , mKey( key )
517  , mValue( value )
518  , mFilterExpression( filterExpression )
519  , mAllowNull( allowNull )
520  , mOrderByValue( orderByValue )
521  , mAllowMulti( allowMulti )
522  {}
523 
524  QString mLayer;
525  QString mKey;
526  QString mValue;
530  bool mAllowMulti; /* allow selection of multiple keys @added in 1.9 */
531  };
532 
533  struct GroupData
534  {
536  GroupData( QString name , QList<QString> fields )
537  : mName( name ), mFields( fields ) {}
538  QString mName;
539  QList<QString> mFields;
540  };
541 
542  struct TabData
543  {
544  TabData() {}
545  TabData( QString name , QList<QString> fields , QList<GroupData> groups )
546  : mName( name ), mFields( fields ), mGroups( groups ) {}
547  QString mName;
548  QList<QString> mFields;
549  QList<GroupData> mGroups;
550  };
551 
565  QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
566  QString providerLib = QString::null, bool loadDefaultStyleFlag = true );
567 
569  virtual ~QgsVectorLayer();
570 
572  QString storageType() const;
573 
575  QString capabilitiesString() const;
576 
578  QString dataComment() const;
579 
581  void setDisplayField( QString fldName = "" );
582 
584  const QString displayField() const;
585 
593  void setDisplayExpression( const QString &displayExpression );
594 
603  const QString displayExpression();
604 
606  QgsVectorDataProvider* dataProvider();
607 
611  const QgsVectorDataProvider* dataProvider() const;
612 
614  void setProviderEncoding( const QString& encoding );
615 
617  void setCoordinateSystem();
618 
622  void addJoin( const QgsVectorJoinInfo& joinInfo );
623 
626  void removeJoin( const QString& joinLayerId );
627 
629  const QList< QgsVectorJoinInfo >& vectorJoins() const;
630 
632  QgsLabel *label();
633 
634  const QgsLabel *label() const;
635 
636  QgsAttributeAction *actions() { return mActions; }
637 
643  int selectedFeatureCount();
644 
653  void select( QgsRectangle & rect, bool addToSelection );
654 
666  void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
667 
669  void invertSelection();
670 
672  void selectAll();
673 
675  QgsFeatureIds allFeatureIds();
676 
684  void invertSelectionInRectangle( QgsRectangle & rect );
685 
693  QgsFeatureList selectedFeatures();
694 
701  const QgsFeatureIds &selectedFeaturesIds() const;
702 
710  void setSelectedFeatures( const QgsFeatureIds &ids );
711 
713  QgsRectangle boundingBoxOfSelected();
714 
716  void setDiagramRenderer( QgsDiagramRendererV2* r );
717  const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }
718 
719  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
720  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
721 
724  QgsFeatureRendererV2* rendererV2();
728  void setRendererV2( QgsFeatureRendererV2* r );
729 
733  void drawRendererV2( QgsFeatureIterator &fit, QgsRenderContext& rendererContext, bool labeling );
734 
738  void drawRendererV2Levels( QgsFeatureIterator &fit, QgsRenderContext& rendererContext, bool labeling );
739 
741  QGis::GeometryType geometryType() const;
742 
746  bool hasGeometryType() const;
747 
749  QGis::WkbType wkbType() const;
750 
752  QString providerType() const;
753 
757  virtual bool readXml( const QDomNode& layer_node );
758 
762  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );
763 
772  virtual void saveStyleToDatabase( QString name, QString description,
773  bool useAsDefault, QString uiFileContent,
774  QString &msgError );
775 
784  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
785  QStringList &descriptions, QString &msgError );
786 
790  virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
791 
798  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
799 
804  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag );
805 
806  virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
807 
812  QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
813 
819  bool readSymbology( const QDomNode& node, QString& errorMessage );
820 
827  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
828 
829  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
830  bool readSld( const QDomNode& node, QString& errorMessage );
831 
839  virtual long featureCount() const;
840 
847  long featureCount( QgsSymbolV2* symbol );
848 
854  bool countSymbolFeatures( bool showProgress = true );
855 
863  virtual bool setSubsetString( QString subset );
864 
869  virtual QString subsetString();
870 
874  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );
875 
881  bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
882 
890  bool updateFeature( QgsFeature &f );
891 
896  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
897 
902  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
903 
906  bool deleteVertex( QgsFeatureId atFeatureId, int atVertex );
907 
911  bool deleteSelectedFeatures();
912 
922  int addRing( const QList<QgsPoint>& ring );
923 
934  int addPart( const QList<QgsPoint>& ring );
935 
941  int translateFeature( QgsFeatureId featureId, double dx, double dy );
942 
950  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
951 
959  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
960 
969  Q_DECL_DEPRECATED int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignoreFeatures = QgsFeatureIds() );
970 
976  int addTopologicalPoints( QgsGeometry* geom );
977 
985  int addTopologicalPoints( const QgsPoint& p );
986 
992  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
993 
995  void enableLabels( bool on );
996 
998  bool hasLabelsEnabled() const;
999 
1001  virtual bool isEditable() const;
1002 
1006  virtual bool isReadOnly() const;
1007 
1009  virtual bool isModified() const;
1010 
1017  bool snapPoint( QgsPoint& point, double tolerance );
1018 
1026  int snapWithContext( const QgsPoint& startPoint,
1027  double snappingTolerance,
1028  QMultiMap < double, QgsSnappingResult > &snappingResults,
1029  QgsSnapper::SnappingType snap_to );
1030 
1033  virtual void reload();
1034 
1038  bool draw( QgsRenderContext& rendererContext );
1039 
1041  void drawLabels( QgsRenderContext& rendererContext );
1042 
1044  QgsRectangle extent();
1045 
1047  const QgsFields &pendingFields() const;
1048 
1050  QgsAttributeList pendingAllAttributesList();
1051 
1055  QgsAttributeList pendingPkAttributesList();
1056 
1058  int pendingFeatureCount();
1059 
1064  bool setReadOnly( bool readonly = true );
1065 
1067  bool startEditing();
1068 
1071  bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
1072 
1079  Q_DECL_DEPRECATED bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal );
1080 
1091  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1092 
1096  bool addAttribute( const QgsField &field );
1097 
1102  void addAttributeAlias( int attIndex, QString aliasString );
1103 
1108  void addAttributeEditorWidget( QgsAttributeEditorElement* data );
1109 
1117  const QString editorWidgetV2( int fieldIdx );
1118 
1126  const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx );
1127 
1132  QList< QgsAttributeEditorElement* > &attributeEditorElements();
1137  void clearAttributeEditorWidgets();
1138 
1143  QString attributeAlias( int attributeIndex ) const;
1144 
1149  QString attributeDisplayName( int attributeIndex ) const;
1150 
1151  const QMap< QString, QString >& attributeAliases() const { return mAttributeAliasMap; }
1152 
1153  const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttributesWMS; }
1154  void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1155 
1156  const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttributesWFS; }
1157  void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1158 
1160  bool deleteAttribute( int attr );
1161 
1169  bool deleteAttributes( QList<int> attrs );
1170 
1172  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1173 
1175  bool deleteFeature( QgsFeatureId fid );
1176 
1192  bool commitChanges();
1193  const QStringList &commitErrors();
1194 
1198  bool rollBack( bool deleteBuffer = true );
1199 
1201  EditType editType( int idx );
1202 
1204  void setEditType( int idx, EditType edit );
1205 
1207  EditorLayout editorLayout();
1208 
1210  void setEditorLayout( EditorLayout editorLayout );
1211 
1212  void setEditorWidgetV2( int attrIdx, const QString& widgetType );
1213 
1214  void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant>& config );
1215 
1217  void setCheckedState( int idx, QString checked, QString notChecked );
1218 
1223  QPair<QString, QString> checkedState( int idx );
1224 
1226  QString editForm();
1227 
1229  void setEditForm( QString ui );
1230 
1233  QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return mFeatureFormSuppress; }
1234 
1237  void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mFeatureFormSuppress = s; }
1238 
1240  QString annotationForm() const { return mAnnotationForm; }
1241 
1243  void setAnnotationForm( const QString& ui );
1244 
1246  QString editFormInit();
1247 
1249  void setEditFormInit( QString function );
1250 
1252  QMap<QString, QVariant> &valueMap( int idx );
1253 
1255  RangeData &range( int idx );
1256 
1260  ValueRelationData &valueRelation( int idx );
1261 
1268  QList<QgsRelation> referencingRelations( int idx );
1269 
1273  QString &dateFormat( int idx );
1274 
1278  QSize &widgetSize( int idx );
1279 
1283  bool fieldEditable( int idx );
1284 
1288  bool labelOnTop( int idx );
1289 
1293  void setFieldEditable( int idx, bool editable );
1294 
1298  void setLabelOnTop( int idx, bool onTop );
1299 
1301  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1302 
1307  void beginEditCommand( QString text );
1308 
1310  void endEditCommand();
1311 
1313  void destroyEditCommand();
1314 
1318  int fieldNameIndex( const QString& fieldName ) const;
1319 
1323  {
1326  NoMarker /* added in version 1.1 */
1327  };
1328 
1331  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1332 
1335  void updateFields();
1336 
1339  void createJoinCaches();
1340 
1346  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
1347 
1350  QVariant minimumValue( int index );
1351 
1354  QVariant maximumValue( int index );
1355 
1356  /* Set the blending mode used for rendering each feature
1357  * @note added in 2.0
1358  */
1359  void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
1360  /* Returns the current blending mode for features
1361  * @note added in 2.0
1362  */
1363  QPainter::CompositionMode featureBlendMode() const;
1364 
1365  /* Set the transparency for the vector layer
1366  * @note added in 2.0
1367  */
1368  void setLayerTransparency( int layerTransparency );
1369  /* Returns the current transparency for the vector layer
1370  * @note added in 2.0
1371  */
1372  int layerTransparency() const;
1373 
1374  QString metadata();
1375 
1377  inline QgsGeometryCache* cache() { return mCache; }
1378 
1382  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1386  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1387 
1392  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1393 
1394  public slots:
1402  void select( const QgsFeatureId &featureId );
1403 
1411  void select( const QgsFeatureIds& featureIds );
1412 
1420  void deselect( const QgsFeatureId featureId );
1421 
1429  void deselect( const QgsFeatureIds& featureIds );
1430 
1436  void removeSelection();
1437 
1438  void triggerRepaint();
1439 
1443  virtual void updateExtents();
1444 
1447  void checkJoinLayerRemove( QString theLayerId );
1448 
1453  virtual void onCacheImageDelete();
1454 
1455  protected slots:
1456  void invalidateSymbolCountedFlag();
1457 
1458  signals:
1459 
1467  void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );
1468 
1470  void selectionChanged();
1471 
1473  void layerModified();
1474 
1476  void editingStarted();
1477 
1479  void editingStopped();
1480 
1482  void beforeCommitChanges();
1483 
1485  void beforeRollBack();
1486 
1495  void attributeAdded( int idx );
1504  void attributeDeleted( int idx );
1505  void featureAdded( QgsFeatureId fid ); // added in 1.7
1506  void featureDeleted( QgsFeatureId fid );
1513  void updatedFields();
1514  void layerDeleted();
1515 
1516  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & );
1517  void geometryChanged( QgsFeatureId fid, QgsGeometry &geom ); // added in 1.9
1518 
1521  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1522  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1523  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1524  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1525  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1526  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1527 
1528  void saveLayerToProject();
1529 
1533  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1534 
1536  void rendererChanged();
1537 
1539  void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
1540 
1542  void layerTransparencyChanged( int layerTransparency );
1543 
1549  void editCommandStarted( const QString& text );
1550 
1556  void editCommandEnded();
1557 
1563  void editCommandDestroyed();
1564 
1565  private slots:
1566  void onRelationsLoaded();
1567 
1568  protected:
1570  void setExtent( const QgsRectangle &rect );
1571 
1572  private: // Private methods
1573 
1575  QgsVectorLayer( const QgsVectorLayer & rhs );
1576 
1578  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1579 
1584  bool setDataProvider( QString const & provider );
1585 
1587  QgsFeatureId findFreeId();
1588 
1597  void snapToGeometry( const QgsPoint& startPoint,
1598  QgsFeatureId featureId,
1599  QgsGeometry* geom,
1600  double sqrSnappingTolerance,
1601  QMultiMap<double, QgsSnappingResult>& snappingResults,
1602  QgsSnapper::SnappingType snap_to ) const;
1603 
1605  static QgsVectorLayer::VertexMarkerType currentVertexMarkerType();
1606 
1608  static int currentVertexMarkerSize();
1609 
1611  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1612 
1614  void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbolRendererV2* selRenderer );
1615 
1620  void prepareLabelingAndDiagrams( QgsRenderContext& rendererContext, QgsAttributeList& attributes, bool& labeling );
1621 
1623  void readSldLabeling( const QDomNode& node );
1624 
1625  private: // Private attributes
1626 
1631 
1637 
1640 
1642 
1644  QString mDisplayField;
1645 
1648 
1650  QString mProviderKey;
1651 
1654 
1657 
1663 
1666 
1668  QMap< QString, QString > mAttributeAliasMap;
1669 
1671  QList< QgsAttributeEditorElement* > mAttributeEditorElements;
1672 
1674  QSet<QString> mExcludeAttributesWMS;
1676  QSet<QString> mExcludeAttributesWFS;
1677 
1679  QList< TabData > mTabs;
1680 
1683 
1686 
1689 
1692 
1694  bool mLabelOn;
1695 
1698 
1700  QPainter::CompositionMode mFeatureBlendMode;
1701 
1704 
1707 
1710 
1713 
1714  QStringList mCommitErrors;
1715 
1716  QMap< QString, EditType > mEditTypes;
1717  QMap< QString, bool> mFieldEditables;
1718  QMap< QString, bool> mLabelOnTop;
1719  QMap< QString, QMap<QString, QVariant> > mValueMaps;
1720  QMap< QString, RangeData > mRanges;
1721  QMap< QString, QPair<QString, QString> > mCheckedStates;
1722  QMap< QString, ValueRelationData > mValueRelations;
1723  QMap< QString, QString> mDateFormats;
1724  QMap< QString, QSize> mWidgetSize;
1725 
1726  QMap<int, QString> mEditorWidgetV2Types;
1727  QMap<int, QMap<QString, QVariant> > mEditorWidgetV2Configs;
1728 
1731 
1732  QString mEditForm, mEditFormInit;
1733 
1737 
1738  //annotation form for this layer
1740 
1743 
1747 
1748  //stores information about joined layers
1750 
1751  //diagram rendering object. 0 if diagram drawing is disabled
1753 
1754  //stores infos about diagram placement (placement type, priority, position distance)
1756 
1759 
1760  // Features in renderer classes counted
1762 
1763  // Feature counts for each renderer symbol
1764  QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap;
1765 
1767 
1769 };
1770 
1771 #endif
virtual bool isEditable() const
True if the layer can be edited.
EditorLayout mEditorLayout
Defines the default layout to use for the attribute editor (Drag and drop, UI File, Generated)
int mWkbType
Geometry type as defined in enum WkbType (qgis.h)
Wrapper for iterator of features from vector data provider or vector layer.
QString annotationForm() const
get annotation form (added in 1.5)
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:320
static unsigned index
int mCurrentVertexMarkerSize
The current size of editing marker.
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:45
QSet< QString > mExcludeAttributesWFS
Attributes which are not published in WFS.
QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress
Type of feature form suppression after feature creation.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
QgsVectorDataProvider * mDataProvider
Pointer to data provider derived from the abastract base class QgsDataProvider.
QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType
The current type of editing marker.
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.
GeometryType
Definition: qgis.h:155
virtual bool isGroupBox() const
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:322
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:327
QList< QgsAttributeEditorElement * > mAttributeEditorElements
Stores a list of attribute editor elements (Each holding a tree structure for a tab in the attribute ...
void setExcludeAttributesWMS(const QSet< QString > &att)
QgsFeatureRendererV2 * mRendererV2
Renderer object which holds the information about how to display the features.
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.
QString mDisplayExpression
the preview expression used to generate a human readable preview string for features ...
Container of fields for a vector layer.
Definition: qgsfield.h:162
bool mEnableBackbuffer
Enables backbuffering for the map window.
WkbType
Used for symbology operations.
Definition: qgis.h:53
QMap< QString, bool > mFieldEditables
virtual ~QgsAttributeEditorElement()
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:114
const QgsDiagramLayerSettings * diagramLayerSettings() const
QStringList mCommitErrors
QgsAttributeEditorField(QString name, int idx, QObject *parent)
TabData(QString name, QList< QString > fields, QList< GroupData > groups)
bool mVertexMarkerOnlyForSelection
Flag if the vertex markers should be drawn only for selection (true) or for all features (false) ...
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
QgsFeatureIterator mProviderIterator
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.
QString mAnnotationForm
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:65
QList< QgsAttributeEditorElement * > mChildren
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
bool mLabelFontNotFoundNotified
Whether 'labeling font not found' has be shown for this layer (only show once in QgsMessageBar, on first rendering)
QgsGeometryCache * mCache
cache for some vector layer data - currently only geometries for faster editing
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.
QMap< int, QString > mEditorWidgetV2Types
const QSet< QString > & excludeAttributesWFS() const
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QList< int > QgsAttributeList
AttributeEditorType type() const
QgsVectorSimplifyMethod mSimplifyMethod
Simplification object which holds the information about how to simplify the features for fast renderi...
QgsDiagramLayerSettings * mDiagramLayerSettings
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:29
QMap< QgsSymbolV2 *, long > mSymbolFeatureCountMap
const QMap< QString, QString > & attributeAliases() const
QMap< QString, QPair< QString, QString > > mCheckedStates
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point geometry.
Definition: qgspoint.h:63
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:341
QMap< QString, QString > mAttributeAliasMap
Map that stores the aliases for attributes.
QList< TabData > mTabs
Map that stores the tab for attributes in the edit form.
QList< QgsAttributeEditorElement * > children() const
QgsVectorLayerEditBuffer * mEditBuffer
stores information about uncommitted changes to layer
QgsMapLayer & operator=(QgsMapLayer const &)
private assign operator - QgsMapLayer not copyable
QMap< QString, RangeData > mRanges
QList< QString > mFields
A class to render labels.
Definition: qgslabel.h:52
QMap< QString, EditType > mEditTypes
uuid generator - readonly and automatically intialized
QgsDiagramRendererV2 * mDiagramRenderer
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)
QString mDisplayField
index of the primary label field
QMap< QString, QSize > mWidgetSize
QgsRenderContext * mCurrentRendererContext
virtual QDomElement toDomElement(QDomDocument &doc) const =0
QSet< QString > mExcludeAttributesWMS
Attributes which are not published in WMS.
QMap< QString, ValueRelationData > mValueRelations
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
QMap< QString, QMap< QString, QVariant > > mValueMaps
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:317
bool mLabelOn
Display labels.
QgsVectorLayerJoinBuffer * mJoinBuffer
virtual void onCacheImageDelete()
Is called when the cache image is being deleted.
Definition: qgsmaplayer.h:374
GroupData(QString name, QList< QString > fields)
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...
QMap< QString, QString > mDateFormats
QgsAttributeEditorRelation(QString name, const QgsRelation &relation, QObject *parent)
Class for doing transforms between two map coordinate systems.
QMap< QString, bool > mLabelOnTop
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
void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
int mLayerTransparency
Layer transparency.
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)
QgsLabel * mLabel
Label.
QSet< int > QgsAttributeIds
QMap< int, QMap< QString, QVariant > > mEditorWidgetV2Configs
QgsAttributeEditorContainer(QString name, QObject *parent)
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
QList< int > QgsAttributeList
QgsFields mUpdatedFields
field map to commit
int mUpdateThreshold
Update threshold for drawing features as they are read.
QPainter::CompositionMode mFeatureBlendMode
Blend mode for features.
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
modularized edit widgets
bool mReadOnly
Flag indicating whether the layer is in read-only mode (editing disabled) or not. ...
QgsFeatureIds mSelectedFeatureIds
Set holding the feature IDs that are activated.
QString joinLayerId
Source layer.
value map from an table
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
QString mProviderKey
Data provider key.
QgsAttributeAction * mActions
The user-defined actions that are accessed from the Identify Results dialog box.
QList< GroupData > mGroups