Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
QgsVectorLayer Class Reference

Vector layer backed by a data source provider. More...

#include <qgsvectorlayer.h>

Inheritance diagram for QgsVectorLayer:
Inheritance graph
[legend]
Collaboration diagram for QgsVectorLayer:
Collaboration graph
[legend]

Classes

struct  RangeData
 

Public Types

enum  EditType {
  LineEdit, UniqueValues, UniqueValuesEditable, ValueMap,
  Classification, EditRange, SliderRange, CheckBox,
  FileName, Enumeration, Immutable, Hidden,
  TextEdit, Calendar, DialRange
}
 
enum  VertexMarkerType { SemiTransparentCircle, Cross, NoMarker }
 Editing vertex markers. More...
 
- Public Types inherited from QgsMapLayer
enum  LayerType { VectorLayer, RasterLayer, PluginLayer }
 Layers enum defining the types of layers that can be added to a map. More...
 

Public Slots

void select (int featureId, bool emitSignal=true)
 Select feature by its ID, optionally emit signal selectionChanged() More...
 
void deselect (int featureId, bool emitSignal=true)
 Deselect feature by its ID, optionally emit signal selectionChanged() More...
 
void removeSelection (bool emitSignal=true)
 Clear selection. More...
 
void triggerRepaint ()
 
virtual void updateExtents ()
 Update the extents for the layer. More...
 
void checkJoinLayerRemove (QString theLayerId)
 Check if there is a join with a layer that will be removed. More...
 
- Public Slots inherited from QgsMapLayer
virtual void invalidTransformInput ()
 Event handler for when a coordinate transform fails due to bad vertex error. More...
 
void setMinimumScale (float theMinScale)
 Accessor and mutator for the minimum scale member. More...
 
float minimumScale ()
 
void setMaximumScale (float theMaxScale)
 Accessor and mutator for the maximum scale member. More...
 
float maximumScale ()
 
void toggleScaleBasedVisibility (bool theVisibilityFlag)
 Accessor and mutator for the scale based visilibility flag. More...
 
bool hasScaleBasedVisibility ()
 
void clearCacheImage ()
 Clear cached image added in 1.5. More...
 
virtual QDateTime timestamp () const
 Time stamp of data source in the moment when data/metadata were loaded by provider. More...
 

Signals

void selectionChanged ()
 This signal is emited when selection was changed. More...
 
void layerModified (bool onlyGeometry)
 This signal is emitted when modifications has been done on layer. More...
 
void editingStarted ()
 
void editingStopped ()
 
void attributeAdded (int idx)
 
void attributeDeleted (int idx)
 
void featureAdded (int fid)
 
void featureDeleted (int fid)
 
void layerDeleted ()
 
void attributeValueChanged (int fid, int idx, const QVariant &)
 
void committedAttributesDeleted (const QString &layerId, const QgsAttributeIds &deletedAttributeIds)
 Signals emitted after committing changes. More...
 
void committedAttributesAdded (const QString &layerId, const QList< QgsField > &addedAttributes)
 
void committedFeaturesAdded (const QString &layerId, const QgsFeatureList &addedFeatures)
 
void committedFeaturesRemoved (const QString &layerId, const QgsFeatureIds &deletedFeatureIds)
 
void committedAttributeValuesChanges (const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues)
 
void committedGeometriesChanges (const QString &layerId, const QgsGeometryMap &changedGeometries)
 
- Signals inherited from QgsMapLayer
void drawingProgress (int theProgress, int theTotalSteps)
 Emit a signal to notify of a progress event. More...
 
void statusChanged (QString theStatus)
 Emit a signal with status (e.g. More...
 
void layerNameChanged ()
 Emit a signal that the layer name has been changed. More...
 
void layerCrsChanged ()
 Emit a signal that layer's CRS has been reset added in 1.4. More...
 
void repaintRequested ()
 This signal should be connected with the slot QgsMapCanvas::refresh() More...
 
void screenUpdateRequested ()
 The layer emits this signal when a screen update is requested. More...
 
void recalculateExtents ()
 This is used to send a request that any mapcanvas using this layer update its extents. More...
 
void dataChanged ()
 data of layer changed added in 1.5 More...
 

Public Member Functions

 QgsVectorLayer (QString path=QString::null, QString baseName=QString::null, QString providerLib=QString::null, bool loadDefaultStyleFlag=true)
 Constructor. More...
 
virtual ~QgsVectorLayer ()
 Destructor. More...
 
QString storageType () const
 Returns the permanent storage type for this layer as a friendly name. More...
 
QString capabilitiesString () const
 Capabilities for this layer in a friendly format. More...
 
QString dataComment () const
 Returns a comment for the data in the layer. More...
 
void setDisplayField (QString fldName="")
 Set the primary display field to be used in the identify results dialog. More...
 
const QString displayField () const
 Returns the primary display field name used in the identify results dialog. More...
 
QgsVectorDataProviderdataProvider ()
 Returns the data provider. More...
 
const QgsVectorDataProviderdataProvider () const
 Returns the data provider in a const-correct manner. More...
 
void setProviderEncoding (const QString &encoding)
 Sets the textencoding of the data provider. More...
 
void setCoordinateSystem ()
 Setup the coordinate system tranformation for the layer. More...
 
void addJoin (QgsVectorJoinInfo joinInfo)
 Joins another vector layer to this layer. More...
 
void removeJoin (const QString &joinLayerId)
 Removes a vector layer join. More...
 
const QList< QgsVectorJoinInfo > & vectorJoins () const
 
QgsLabellabel ()
 Get the label object associated with this layer. More...
 
const QgsLabellabel () const
 
QgsAttributeActionactions ()
 
int selectedFeatureCount ()
 The number of features that are selected in this layer. More...
 
void select (QgsRectangle &rect, bool lock)
 Select features found within the search rectangle (in layer's coordinates) More...
 
void invertSelection ()
 Select not selected features and deselect selected ones. More...
 
void invertSelectionInRectangle (QgsRectangle &rect)
 Invert selection of features found within the search rectangle (in layer's coordinates) More...
 
QgsFeatureList selectedFeatures ()
 Get a copy of the user-selected features. More...
 
const QgsFeatureIdsselectedFeaturesIds () const
 Return reference to identifiers of selected features. More...
 
void setSelectedFeatures (const QgsFeatureIds &ids)
 Change selection to the new set of features. More...
 
QgsRectangle boundingBoxOfSelected ()
 Returns the bounding box of the selected features. More...
 
bool copySymbologySettings (const QgsMapLayer &other)
 Copies the symbology settings from another layer. More...
 
bool hasCompatibleSymbology (const QgsMapLayer &other) const
 Returns true if this layer can be in the same symbology group with another layer. More...
 
const QgsRendererrenderer () const
 Returns a pointer to the renderer. More...
 
void setRenderer (QgsRenderer *r)
 Sets the renderer. More...
 
void setDiagramRenderer (QgsDiagramRendererV2 *r)
 Sets diagram rendering object (takes ownership) More...
 
const QgsDiagramRendererV2diagramRenderer () const
 
void setDiagramLayerSettings (const QgsDiagramLayerSettings &s)
 
const QgsDiagramLayerSettingsdiagramLayerSettings () const
 
QgsFeatureRendererV2rendererV2 ()
 Return renderer V2. More...
 
void setRendererV2 (QgsFeatureRendererV2 *r)
 Set renderer V2. More...
 
bool isUsingRendererV2 ()
 Return whether using renderer V2. More...
 
void setUsingRendererV2 (bool usingRendererV2)
 set whether to use renderer V2 for drawing. More...
 
void drawRendererV2 (QgsRenderContext &rendererContext, bool labeling)
 Draw layer with renderer V2. More...
 
void drawRendererV2Levels (QgsRenderContext &rendererContext, bool labeling)
 Draw layer with renderer V2 using symbol levels. More...
 
QGis::GeometryType geometryType () const
 Returns point, line or polygon. More...
 
bool hasGeometryType () const
 Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry. More...
 
QGis::WkbType wkbType () const
 Returns the WKBType or WKBUnknown in case of error. More...
 
QString providerType () const
 Return the provider type for this layer. More...
 
virtual bool readXml (QDomNode &layer_node)
 reads vector layer specific state from project file Dom node. More...
 
virtual bool writeXml (QDomNode &layer_node, QDomDocument &doc)
 write vector layer specific state to project file Dom node. More...
 
bool readSymbology (const QDomNode &node, QString &errorMessage)
 Read the symbology for the current layer from the Dom node supplied. More...
 
bool writeSymbology (QDomNode &node, QDomDocument &doc, QString &errorMessage) const
 Write the symbology for the layer into the docment provided. More...
 
virtual long featureCount () const
 Number of features in the layer. More...
 
virtual long updateFeatureCount () const
 This function does nothing useful, it's kept only for compatibility. More...
 
virtual bool setSubsetString (QString subset)
 Set the string (typically sql) used to define a subset of the layer. More...
 
virtual QString subsetString ()
 Get the string (typically sql) used to define a subset of the layer. More...
 
void select (QgsAttributeList fetchAttributes, QgsRectangle rect=QgsRectangle(), bool fetchGeometry=true, bool useIntersect=false)
 Select features with or without attributes in a given window. More...
 
bool nextFeature (QgsFeature &feature)
 fetch a feature (after select) More...
 
bool featureAtId (int featureId, QgsFeature &f, bool fetchGeometries=true, bool fetchAttributes=true)
 Gets the feature at the given feature id. More...
 
bool addFeature (QgsFeature &f, bool alsoUpdateExtent=true)
 Adds a feature. More...
 
bool insertVertex (double x, double y, int atFeatureId, int beforeVertex)
 Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries. More...
 
bool moveVertex (double x, double y, int atFeatureId, int atVertex)
 Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates. More...
 
bool deleteVertex (int atFeatureId, int atVertex)
 Deletes a vertex from a feature. More...
 
bool deleteSelectedFeatures ()
 Deletes the selected features. More...
 
int addRing (const QList< QgsPoint > &ring)
 Adds a ring to polygon/multipolygon features. More...
 
int addIsland (const QList< QgsPoint > &ring)
 Adds a new island polygon to a multipolygon feature. More...
 
int translateFeature (int featureId, double dx, double dy)
 Translates feature by dx, dy. More...
 
int splitFeatures (const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
 Splits features cut by the given line. More...
 
int removePolygonIntersections (QgsGeometry *geom)
 Changes the specified geometry such that it has no intersections with other polygon (or multipolygon) geometries in this vector layer. More...
 
int addTopologicalPoints (QgsGeometry *geom)
 Adds topological points for every vertex of the geometry. More...
 
int addTopologicalPoints (const QgsPoint &p)
 Adds a vertex to segments which intersect point p but don't already have a vertex there. More...
 
int insertSegmentVerticesForSnap (const QList< QgsSnappingResult > &snapResults)
 Inserts vertices to the snapped segments. More...
 
void enableLabels (bool on)
 Set labels on. More...
 
bool hasLabelsEnabled (void) const
 Label is on. More...
 
virtual bool isEditable () const
 Returns true if the provider is in editing mode. More...
 
virtual bool isReadOnly () const
 Returns true if the provider is in read-only mode. More...
 
virtual bool isModified () const
 Returns true if the provider has been modified since the last commit. More...
 
bool snapPoint (QgsPoint &point, double tolerance)
 Snaps a point to the closest vertex if there is one within the snapping tolerance. More...
 
int snapWithContext (const QgsPoint &startPoint, double snappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to)
 Snaps to segment or vertex within given tolerance. More...
 
virtual void reload ()
 Synchronises with changes in the datasource. More...
 
bool draw (QgsRenderContext &rendererContext)
 Draws the layer. More...
 
void drawLabels (QgsRenderContext &rendererContext)
 Draws the layer labels using coordinate transformation. More...
 
const QgsFieldMappendingFields () const
 returns field list in the to-be-committed state More...
 
QgsAttributeList pendingAllAttributesList ()
 returns list of attributes More...
 
int pendingFeatureCount ()
 returns feature count after commit More...
 
bool setReadOnly (bool readonly=true)
 Make layer read-only (editing disabled) or not. More...
 
void setModified (bool modified=true, bool onlyGeometryWasModified=false)
 Sets whether some features are modified or not. More...
 
bool startEditing ()
 Make layer editable. More...
 
bool changeGeometry (int fid, QgsGeometry *geom)
 change feature's geometry More...
 
bool changeAttributeValue (int fid, int field, QVariant value, bool emitSignal=true)
 changed an attribute value (but does not commit it) More...
 
bool addAttribute (const QgsField &field)
 add an attribute field (but does not commit it) returns true if the field was added More...
 
Q_DECL_DEPRECATED bool addAttribute (QString name, QString type)
 add an attribute field (but does not commit it) returns true if the field was added More...
 
void addAttributeAlias (int attIndex, QString aliasString)
 Sets an alias (a display name) for attributes to display in dialogs. More...
 
QString attributeAlias (int attributeIndex) const
 Returns the alias of an attribute name or an empty string if there is no alias. More...
 
QString attributeDisplayName (int attributeIndex) const
 Convenience function that returns the attribute alias if defined or the field name else. More...
 
bool deleteAttribute (int attr)
 delete an attribute field (but does not commit it) More...
 
bool addFeatures (QgsFeatureList features, bool makeSelected=true)
 Insert a copy of the given features into the layer (but does not commit it) More...
 
bool deleteFeature (int fid)
 delete a feature from the layer (but does not commit it) More...
 
bool commitChanges ()
 Attempts to commit any changes to disk. More...
 
const QStringList & commitErrors ()
 
bool rollBack ()
 Stop editing and discard the edits. More...
 
EditType editType (int idx)
 get edit type More...
 
void setEditType (int idx, EditType edit)
 set edit type More...
 
void setCheckedState (int idx, QString checked, QString notChecked)
 set string representing 'true' for a checkbox (added in 1.4) More...
 
QPair< QString, QString > checkedState (int idx)
 return string representing 'true' for a checkbox (added in 1.4) More...
 
QString editForm ()
 get edit form (added in 1.4) More...
 
void setEditForm (QString ui)
 set edit form (added in 1.4) More...
 
QString annotationForm () const
 get annotation form (added in 1.5) More...
 
void setAnnotationForm (const QString &ui)
 set annotation form for layer (added in 1.5) More...
 
QString editFormInit ()
 get python function for edit form initialization (added in 1.4) More...
 
void setEditFormInit (QString function)
 set python function for edit form initialization (added in 1.4) More...
 
QMap< QString, QVariant > & valueMap (int idx)
 access value map More...
 
RangeDatarange (int idx)
 access range More...
 
void addOverlay (QgsVectorOverlay *overlay)
 Adds a new overlay to this class. More...
 
void removeOverlay (const QString &typeName)
 Removes all overlays of a given type. More...
 
void vectorOverlays (QList< QgsVectorOverlay * > &overlayList)
 Returns pointers to the overlays of this layer. More...
 
QgsVectorOverlayfindOverlayByType (const QString &typeName)
 Returns the (first) overlay of a type, e.g. More...
 
void beginEditCommand (QString text)
 Create edit command for undo/redo operations. More...
 
void endEditCommand ()
 Finish edit command and add it to undo/redo stack. More...
 
void destroyEditCommand ()
 Destroy active command and reverts all changes in it. More...
 
void undoEditCommand (QgsUndoCommand *cmd)
 Execute undo operation. More...
 
void redoEditCommand (QgsUndoCommand *cmd)
 Execute redo operation. More...
 
int fieldNameIndex (const QString &fieldName) const
 Returns the index of a field name or -1 if the field does not exist. More...
 
void updateFieldMap ()
 Assembles mUpdatedFields considering provider fields, joined fields and added fields. More...
 
void createJoinCaches ()
 Caches joined attributes if required (and not already done) More...
 
void uniqueValues (int index, QList< QVariant > &uniqueValues, int limit=-1)
 Returns unique values for column. More...
 
QVariant minimumValue (int index)
 Returns minimum value for an attribute column or invalid variant in case of error. More...
 
QVariant maximumValue (int index)
 Returns maximum value for an attribute column or invalid variant in case of error. More...
 
- Public Member Functions inherited from QgsMapLayer
 QgsMapLayer (QgsMapLayer::LayerType type=VectorLayer, QString lyrname=QString::null, QString source=QString::null)
 Constructor. More...
 
virtual ~QgsMapLayer ()
 Destructor. More...
 
QgsMapLayer::LayerType type () const
 Get the type of the layer. More...
 
QString id () const
 Get this layer's unique ID, this ID is used to access this layer from map layer registry. More...
 
Q_DECL_DEPRECATED QString getLayerID () const
 Get this layer's unique ID, this ID is used to access this layer from map layer registry. More...
 
void setLayerName (const QString &name)
 Set the display name of the layer. More...
 
QString const & name () const
 Get the display name of the layer. More...
 
QgsRectangle extent () const
 Return the extent of the layer as a QRect. More...
 
bool isValid ()
 
QString publicSource () const
 
QString const & source () const
 Returns the source for the layer. More...
 
virtual QStringList subLayers ()
 Returns the sublayers of this layer (Useful for providers that manage their own layers, such as WMS) More...
 
virtual void setLayerOrder (QStringList layers)
 Reorders the previously selected sublayers of this layer from bottom to top (Useful for providers that manage their own layers, such as WMS) More...
 
virtual void setSubLayerVisibility (QString name, bool vis)
 Set the visibility of the given sublayer name. More...
 
bool readXML (QDomNode &layer_node)
 sets state from Dom document More...
 
bool writeXML (QDomNode &layer_node, QDomDocument &document)
 stores state in Dom node More...
 
void setCustomProperty (const QString &key, const QVariant &value)
 Set a custom property for layer. More...
 
QVariant customProperty (const QString &value, const QVariant &defaultValue=QVariant()) const
 Read a custom property from layer. More...
 
void removeCustomProperty (const QString &key)
 Remove a custom property from layer. More...
 
unsigned int getTransparency ()
 Accessor for transparency level. More...
 
void setTransparency (unsigned int)
 Mutator for transparency level. More...
 
virtual QString lastErrorTitle ()
 If an operation returns 0 (e.g. More...
 
virtual QString lastError ()
 If an operation returns 0 (e.g. More...
 
const
QgsCoordinateReferenceSystem
crs ()
 Returns layer's spatial reference system. More...
 
Q_DECL_DEPRECATED const
QgsCoordinateReferenceSystem
srs ()
 Returns layer's spatial reference system. More...
 
void setCrs (const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
 Sets layer's spatial reference system. More...
 
virtual QString loadDefaultStyle (bool &theResultFlag)
 Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More...
 
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 the users style table in their personal qgis.db) More...
 
virtual bool loadNamedStyleFromDb (const QString db, const QString theURI, QString &qml)
 
virtual QString saveDefaultStyle (bool &theResultFlag)
 Save the properties of this layer as the default style (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More...
 
virtual QString saveNamedStyle (const QString theURI, bool &theResultFlag)
 Save the properties of this layer as a named style (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More...
 
QUndoStack * undoStack ()
 Return pointer to layer's undo stack. More...
 
QImage * cacheImage ()
 Get the QImage used for caching render operations. More...
 
void setCacheImage (QImage *thepImage)
 Set the QImage used for caching render operations. More...
 

Static Public Member Functions

static void drawVertexMarker (double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
 Draws a vertex symbol at (screen) coordinates x, y. More...
 
- Static Public Member Functions inherited from QgsMapLayer
static QString capitaliseLayerName (const QString name)
 A convenience function to capitalise the layer name. More...
 

Private Member Functions

 QgsVectorLayer (QgsVectorLayer const &rhs)
 vector layers are not copyable More...
 
QgsVectorLayeroperator= (QgsVectorLayer const &rhs)
 vector layers are not copyable More...
 
bool setDataProvider (QString const &provider)
 bind layer to a specific data provider More...
 
void drawFeature (QgsRenderContext &renderContext, QgsFeature &fet, QImage *marker)
 Draws features. More...
 
void transformPoint (double &x, double &y, const QgsMapToPixel *mtp, const QgsCoordinateTransform *ct)
 Convenience function to transform the given point. More...
 
void transformPoints (std::vector< double > &x, std::vector< double > &y, std::vector< double > &z, QgsRenderContext &renderContext)
 
unsigned char * drawLineString (unsigned char *WKBlinestring, QgsRenderContext &renderContext)
 Draw the linestring as given in the WKB format. More...
 
unsigned char * drawPolygon (unsigned char *WKBpolygon, QgsRenderContext &renderContext)
 Draw the polygon as given in the WKB format. More...
 
int findFreeId ()
 Goes through all features and finds a free id (e.g. More...
 
void deleteCachedGeometries ()
 Deletes the geometries in mCachedGeometries. More...
 
void snapToGeometry (const QgsPoint &startPoint, int featureId, QgsGeometry *geom, double sqrSnappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to) const
 Snaps to a geometry and adds the result to the multimap if it is within the snapping result. More...
 
int boundingBoxFromPointList (const QList< QgsPoint > &list, double &xmin, double &ymin, double &xmax, double &ymax) const
 Little helper function that gives bounding box from a list of points. More...
 
void updateFeatureAttributes (QgsFeature &f, bool all=false)
 Update feature with uncommited attribute updates and joined attributes. More...
 
void addJoinedFeatureAttributes (QgsFeature &f, const QgsVectorJoinInfo &joinInfo, const QString &joinFieldName, const QVariant &joinValue, const QgsAttributeList &attributes, int attributeIndexOffset)
 Adds joined attributes to a feature. More...
 
void updateFeatureGeometry (QgsFeature &f)
 Update feature with uncommited geometry updates. More...
 
void editGeometryChange (int featureId, QgsGeometry &geometry)
 Record changed geometry, store in active command (if any) More...
 
void editFeatureAdd (QgsFeature &feature)
 Record added feature, store in active command (if any) More...
 
void editFeatureDelete (int featureId)
 Record deleted feature, store in active command (if any) More...
 
void editAttributeChange (int featureId, int field, QVariant value)
 Record changed attribute, store in active command (if any) More...
 
void stopRendererV2 (QgsRenderContext &rendererContext, QgsSingleSymbolRendererV2 *selRenderer)
 Stop version 2 renderer and selected renderer (if required) More...
 
void updateAttributeMapIndex (QgsAttributeMap &map, int oldIndex, int newIndex) const
 Updates an index in an attribute map to a new value (usually necessary because of a join operation) More...
 
void prepareLabelingAndDiagrams (QgsRenderContext &rendererContext, QgsAttributeList &attributes, bool &labeling)
 Registers label and diagram layer. More...
 

Static Private Member Functions

static
QgsVectorLayer::VertexMarkerType 
currentVertexMarkerType ()
 Reads vertex marker type from settings. More...
 
static int currentVertexMarkerSize ()
 Reads vertex marker size from settings. More...
 

Private Attributes

int mUpdateThreshold
 Update threshold for drawing features as they are read. More...
 
QgsVectorDataProvidermDataProvider
 Pointer to data provider derived from the abastract base class QgsDataProvider. More...
 
QString mDisplayField
 index of the primary label field More...
 
QString mProviderKey
 Data provider key. More...
 
QgsAttributeActionmActions
 The user-defined actions that are accessed from the Identify Results dialog box. More...
 
bool mEditable
 Flag indicating whether the layer is in editing mode or not. More...
 
bool mReadOnly
 Flag indicating whether the layer is in read-only mode (editing disabled) or not. More...
 
bool mModified
 Flag indicating whether the layer has been modified since the last commit. More...
 
QgsGeometryMap mCachedGeometries
 cache of the committed geometries retrieved for the current display More...
 
QgsRectangle mCachedGeometriesRect
 extent for which there are cached geometries More...
 
QgsFeatureIds mSelectedFeatureIds
 Set holding the feature IDs that are activated. More...
 
QgsFeatureIds mDeletedFeatureIds
 Deleted feature IDs which are not commited. More...
 
QgsFeatureList mAddedFeatures
 New features which are not commited. More...
 
QgsChangedAttributesMap mChangedAttributeValues
 Changed attributes values which are not commited. More...
 
QgsAttributeIds mDeletedAttributeIds
 deleted attributes fields which are not commited More...
 
QgsAttributeIds mAddedAttributeIds
 added attributes fields which are not commited More...
 
QgsGeometryMap mChangedGeometries
 Changed geometries which are not commited. More...
 
QgsFieldMap mUpdatedFields
 field map to commit More...
 
QMap< QString, QString > mAttributeAliasMap
 Map that stores the aliases for attributes. More...
 
int mMaxUpdatedIndex
 max field index More...
 
int mWkbType
 Geometry type as defined in enum WkbType (qgis.h) More...
 
QgsUndoCommandmActiveCommand
 
QgsRenderermRenderer
 Renderer object which holds the information about how to display the features. More...
 
QgsFeatureRendererV2mRendererV2
 Renderer V2. More...
 
bool mUsingRendererV2
 whether to use V1 or V2 renderer More...
 
QgsLabelmLabel
 Label. More...
 
bool mLabelOn
 Display labels. More...
 
QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType
 The current type of editing marker. More...
 
int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 
bool mVertexMarkerOnlyForSelection
 Flag if the vertex markers should be drawn only for selection (true) or for all features (false) More...
 
QList< QgsVectorOverlay * > mOverlays
 List of overlays. More...
 
QStringList mCommitErrors
 
QMap< QString, EditTypemEditTypes
 
QMap< QString, QMap< QString,
QVariant > > 
mValueMaps
 
QMap< QString, RangeDatamRanges
 
QMap< QString, QPair< QString,
QString > > 
mCheckedStates
 
QString mEditForm
 
QString mEditFormInit
 
QString mAnnotationForm
 
bool mFetching
 
QgsRectangle mFetchRect
 
QgsAttributeList mFetchAttributes
 
QgsAttributeList mFetchProvAttributes
 
bool mFetchGeometry
 
QSet< int > mFetchConsidered
 
QgsGeometryMap::iterator mFetchChangedGeomIt
 
QgsFeatureList::iterator mFetchAddedFeaturesIt
 
QgsVectorLayerJoinBuffermJoinBuffer
 
QgsDiagramRendererV2mDiagramRenderer
 
QgsDiagramLayerSettingsmDiagramLayerSettings
 

Additional Inherited Members

- Protected Member Functions inherited from QgsMapLayer
void setValid (bool valid)
 set whether layer is valid or not - should be used in constructor. More...
 
void readCustomProperties (const QDomNode &layerNode, const QString &keyStartsWith="")
 Read custom properties from project file. More...
 
void writeCustomProperties (QDomNode &layerNode, QDomDocument &doc) const
 Write custom properties to project file. More...
 
void connectNotify (const char *signal)
 debugging member - invoked when a connect() is made to this object More...
 
- Protected Attributes inherited from QgsMapLayer
unsigned int mTransparencyLevel
 Transparency level for this layer should be 0-255 (255 being opaque) More...
 
QgsRectangle mLayerExtent
 Extent of the layer. More...
 
bool mValid
 Indicates if the layer is valid and can be drawn. More...
 
QString mDataSource
 data source description string, varies by layer type More...
 
QString mLayerName
 Name of the layer - used for display. More...
 
QgsCoordinateReferenceSystemmCRS
 layer's Spatial reference system More...
 

Detailed Description

Vector layer backed by a data source provider.

Definition at line 87 of file qgsvectorlayer.h.

Member Enumeration Documentation

Enumerator
LineEdit 
UniqueValues 
UniqueValuesEditable 
ValueMap 
Classification 
EditRange 
SliderRange 
CheckBox 
FileName 
Enumeration 
Immutable 
Hidden 
TextEdit 
Calendar 
DialRange 

Definition at line 92 of file qgsvectorlayer.h.

Editing vertex markers.

Note
public from version 1.4
Enumerator
SemiTransparentCircle 
Cross 
NoMarker 

Definition at line 636 of file qgsvectorlayer.h.

Constructor & Destructor Documentation

QgsVectorLayer::QgsVectorLayer ( QString  path = QString::null,
QString  baseName = QString::null,
QString  providerLib = QString::null,
bool  loadDefaultStyleFlag = true 
)
QgsVectorLayer::~QgsVectorLayer ( )
virtual
QgsVectorLayer::QgsVectorLayer ( QgsVectorLayer const &  rhs)
private

vector layers are not copyable

Member Function Documentation

QgsAttributeAction* QgsVectorLayer::actions ( )
inline

Definition at line 173 of file qgsvectorlayer.h.

bool QgsVectorLayer::addAttribute ( const QgsField field)

add an attribute field (but does not commit it) returns true if the field was added

Note
added in version 1.2

Definition at line 3322 of file qgsvectorlayer.cpp.

References attributeAdded(), isEditable(), mActiveCommand, mAddedAttributeIds, mDataProvider, mMaxUpdatedIndex, mUpdatedFields, QgsField::name(), setModified(), QgsUndoCommand::storeAttributeAdd(), and QgsVectorDataProvider::supportedType().

Referenced by addAttribute().

bool QgsVectorLayer::addAttribute ( QString  name,
QString  type 
)

add an attribute field (but does not commit it) returns true if the field was added

Deprecated:

Definition at line 3356 of file qgsvectorlayer.cpp.

References addAttribute(), mDataProvider, QgsVectorDataProvider::nativeTypes(), and QgsMapLayer::type().

void QgsVectorLayer::addAttributeAlias ( int  attIndex,
QString  aliasString 
)

Sets an alias (a display name) for attributes to display in dialogs.

Note
added in version 1.2

Definition at line 3367 of file qgsvectorlayer.cpp.

References layerModified(), mAttributeAliasMap, QgsMapLayer::name(), and pendingFields().

bool QgsVectorLayer::addFeature ( QgsFeature f,
bool  alsoUpdateExtent = true 
)

Adds a feature.

Parameters
ffeature to add
alsoUpdateExtentIf True, will also go to the effort of e.g. updating the extents.
Returns
True in case of success and False in case of error

Definition at line 1899 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::capabilities(), editFeatureAdd(), featureAdded(), QgsFeature::geometry(), QgsFeature::id(), isEditable(), mCachedGeometries, mDataProvider, QgsDebugMsg, QgsFeature::setFeatureId(), setModified(), and updateExtents().

Referenced by addFeatures().

bool QgsVectorLayer::addFeatures ( QgsFeatureList  features,
bool  makeSelected = true 
)

Insert a copy of the given features into the layer (but does not commit it)

Definition at line 3867 of file qgsvectorlayer.cpp.

References addFeature(), QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::capabilities(), isEditable(), mDataProvider, mSelectedFeatureIds, selectionChanged(), QgsMapLayer::setCacheImage(), and updateExtents().

Referenced by splitFeatures().

int QgsVectorLayer::addIsland ( const QList< QgsPoint > &  ring)

Adds a new island polygon to a multipolygon feature.

Returns
0 in case of success, 1 if selected feature is not multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring not disjoint with existing rings, 4 if no feature was selected, 5 if several features are selected, 6 if selected geometry not found

Definition at line 2135 of file qgsvectorlayer.cpp.

References QgsGeometry::addIsland(), editGeometryChange(), featureAtId(), QgsFeature::geometryAndOwnership(), hasGeometryType(), mAddedFeatures, mCachedGeometries, mChangedGeometries, mSelectedFeatureIds, QgsDebugMsg, and setModified().

void QgsVectorLayer::addJoin ( QgsVectorJoinInfo  joinInfo)

Joins another vector layer to this layer.

Parameters
joinInfojoin object containing join layer id, target and source field
Note
added in 1.7

Definition at line 4920 of file qgsvectorlayer.cpp.

References QgsVectorLayerJoinBuffer::addJoin(), mJoinBuffer, and updateFieldMap().

void QgsVectorLayer::addJoinedFeatureAttributes ( QgsFeature f,
const QgsVectorJoinInfo joinInfo,
const QString &  joinFieldName,
const QVariant &  joinValue,
const QgsAttributeList attributes,
int  attributeIndexOffset 
)
private

Adds joined attributes to a feature.

Parameters
fthe feature to add the attributes
joinInfovector join
joinFieldNamename of the (source) join Field
joinValuelookup value for join
attributes(join layer) attribute indices to add
attributeIndexOffsetindex offset to get from join layer attribute index to layer index

Definition at line 1560 of file qgsvectorlayer.cpp.

References QgsFeature::addAttribute(), QgsFeature::attributeMap(), QgsVectorJoinInfo::cachedAttributes, dataProvider(), QgsMapLayerRegistry::instance(), QgsVectorJoinInfo::joinLayerId, QgsMapLayerRegistry::mapLayer(), nextFeature(), select(), QgsDataProvider::setSubsetString(), QgsDataProvider::subsetString(), and subsetString().

void QgsVectorLayer::addOverlay ( QgsVectorOverlay overlay)

Adds a new overlay to this class.

QgsVectorLayer takes ownership of the object

Note
this method was added in version 1.1

Definition at line 4499 of file qgsvectorlayer.cpp.

References mOverlays.

int QgsVectorLayer::addRing ( const QList< QgsPoint > &  ring)

Adds a ring to polygon/multipolygon features.

Returns
0 in case of success, 1 problem with feature type, 2 ring not closed, 3 ring not valid, 4 ring crosses existing rings, 5 no feature found where ring can be inserted

Definition at line 2098 of file qgsvectorlayer.cpp.

References QgsGeometry::addRing(), boundingBoxFromPointList(), editGeometryChange(), QgsFeature::geometry(), hasGeometryType(), QgsFeature::id(), nextFeature(), select(), setModified(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), and QgsRectangle::setYMinimum().

int QgsVectorLayer::addTopologicalPoints ( QgsGeometry geom)

Adds topological points for every vertex of the geometry.

Parameters
geomthe geometry where each vertex is added to segments of other features
Note
geom is not going to be modified by the function
Returns
0 in case of success
See Also
addTopologicalPoints

Definition at line 2417 of file qgsvectorlayer.cpp.

References QgsGeometry::asMultiPolygon(), QgsGeometry::asMultiPolyline(), QgsGeometry::asPolygon(), QgsGeometry::asPolyline(), hasGeometryType(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPolygon, QGis::WKBPolygon25D, QgsGeometry::wkbType(), and wkbType().

Referenced by splitFeatures().

int QgsVectorLayer::addTopologicalPoints ( const QgsPoint p)

Adds a vertex to segments which intersect point p but don't already have a vertex there.

If a feature already has a vertex at position p, no additional vertex is inserted. This method is useful for topological editing.

Parameters
pposition of the vertex
Returns
0 in case of success

Definition at line 2524 of file qgsvectorlayer.cpp.

References QGis::Feet, hasGeometryType(), insertSegmentVerticesForSnap(), QgsCoordinateReferenceSystem::mapUnits(), QgsMapLayer::mCRS, QGis::Meters, QgsSnapper::SnapToSegment, QgsSnapper::SnapToVertex, and snapWithContext().

QString QgsVectorLayer::annotationForm ( ) const
inline

get annotation form (added in 1.5)

Definition at line 573 of file qgsvectorlayer.h.

Referenced by QgsFormAnnotationItem::QgsFormAnnotationItem().

void QgsVectorLayer::attributeAdded ( int  idx)
signal
QString QgsVectorLayer::attributeAlias ( int  attributeIndex) const

Returns the alias of an attribute name or an empty string if there is no alias.

Note
added in version 1.2

Definition at line 3378 of file qgsvectorlayer.cpp.

References mAttributeAliasMap, QgsMapLayer::name(), and pendingFields().

Referenced by attributeDisplayName(), and QgsComposerAttributeTable::initializeAliasMap().

void QgsVectorLayer::attributeDeleted ( int  idx)
signal
QString QgsVectorLayer::attributeDisplayName ( int  attributeIndex) const

Convenience function that returns the attribute alias if defined or the field name else.

Note
added in version 1.2

Definition at line 3388 of file qgsvectorlayer.cpp.

References attributeAlias(), and pendingFields().

Referenced by QgsLegendModel::addVectorLayerItems(), and QgsAttributeAction::expandAction().

void QgsVectorLayer::attributeValueChanged ( int  fid,
int  idx,
const QVariant &   
)
signal
void QgsVectorLayer::beginEditCommand ( QString  text)

Create edit command for undo/redo operations.

Parameters
texttext which is to be displayed in undo window

Definition at line 4641 of file qgsvectorlayer.cpp.

References mActiveCommand.

int QgsVectorLayer::boundingBoxFromPointList ( const QList< QgsPoint > &  list,
double &  xmin,
double &  ymin,
double &  xmax,
double &  ymax 
) const
private

Little helper function that gives bounding box from a list of points.

Returns
0 in case of success

Definition at line 4138 of file qgsvectorlayer.cpp.

References MathUtils::max().

Referenced by addRing(), and splitFeatures().

QgsRectangle QgsVectorLayer::boundingBoxOfSelected ( )
QString QgsVectorLayer::capabilitiesString ( ) const

Capabilities for this layer in a friendly format.

Definition at line 218 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::capabilitiesString(), and mDataProvider.

bool QgsVectorLayer::changeAttributeValue ( int  fid,
int  field,
QVariant  value,
bool  emitSignal = true 
)

changed an attribute value (but does not commit it)

Definition at line 3308 of file qgsvectorlayer.cpp.

References attributeValueChanged(), editAttributeChange(), isEditable(), and setModified().

bool QgsVectorLayer::changeGeometry ( int  fid,
QgsGeometry geom 
)

change feature's geometry

Note
added in version 1.2

Definition at line 3294 of file qgsvectorlayer.cpp.

References editGeometryChange(), hasGeometryType(), mCachedGeometries, mDataProvider, mEditable, and setModified().

QPair< QString, QString > QgsVectorLayer::checkedState ( int  idx)

return string representing 'true' for a checkbox (added in 1.4)

Definition at line 4897 of file qgsvectorlayer.cpp.

References mCheckedStates, QgsMapLayer::name(), and pendingFields().

Referenced by QgsAttributeEditor::retrieveValue(), and QgsAttributeEditor::setValue().

void QgsVectorLayer::checkJoinLayerRemove ( QString  theLayerId)
slot

Check if there is a join with a layer that will be removed.

Note
added in 1.7

Definition at line 4926 of file qgsvectorlayer.cpp.

References removeJoin().

Referenced by QgsVectorLayer().

bool QgsVectorLayer::commitChanges ( )

Attempts to commit any changes to disk.

Returns the result of the attempt. If a commit fails, the in-memory changes are left alone.

This allows editing to continue if the commit failed on e.g. a disallowed value in a Postgres database - the user can re-edit and try again.

The commits occur in distinct stages, (add attributes, add features, change attribute values, change geometries, delete features, delete attributes) so if a stage fails, it's difficult to roll back cleanly. Therefore any error message also includes which stage failed so that the user has some chance of repairing the damage cleanly.

Definition at line 3466 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::AddAttributes, QgsVectorDataProvider::addAttributes(), QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::addFeatures(), QgsVectorDataProvider::capabilities(), QgsVectorDataProvider::ChangeAttributeValues, QgsVectorDataProvider::changeAttributeValues(), QgsVectorDataProvider::ChangeGeometries, QgsVectorDataProvider::changeGeometryValues(), committedAttributesAdded(), committedAttributesDeleted(), committedAttributeValuesChanges(), committedFeaturesAdded(), committedFeaturesRemoved(), committedGeometriesChanges(), QgsVectorDataProvider::DeleteAttributes, QgsVectorDataProvider::deleteAttributes(), deleteCachedGeometries(), QgsVectorDataProvider::DeleteFeatures, QgsVectorDataProvider::deleteFeatures(), editingStopped(), QgsVectorDataProvider::fields(), QgsFeature::id(), isEditable(), mAddedAttributeIds, mAddedFeatures, mChangedAttributeValues, mChangedGeometries, mCommitErrors, mDataProvider, mDeletedAttributeIds, mDeletedFeatureIds, mEditable, mUpdatedFields, QgsMapLayer::name(), QgsDebugMsg, QgsMapLayer::setCacheImage(), QgsFeature::setGeometry(), setModified(), QgsMapLayer::undoStack(), QgsDataProvider::updateExtents(), and updateFieldMap().

const QStringList & QgsVectorLayer::commitErrors ( )

Definition at line 3761 of file qgsvectorlayer.cpp.

References mCommitErrors.

void QgsVectorLayer::committedAttributesAdded ( const QString &  layerId,
const QList< QgsField > &  addedAttributes 
)
signal

Referenced by commitChanges().

void QgsVectorLayer::committedAttributesDeleted ( const QString &  layerId,
const QgsAttributeIds deletedAttributeIds 
)
signal

Signals emitted after committing changes.

Note
added in v1.6

Referenced by commitChanges().

void QgsVectorLayer::committedAttributeValuesChanges ( const QString &  layerId,
const QgsChangedAttributesMap changedAttributesValues 
)
signal

Referenced by commitChanges().

void QgsVectorLayer::committedFeaturesAdded ( const QString &  layerId,
const QgsFeatureList addedFeatures 
)
signal

Referenced by commitChanges().

void QgsVectorLayer::committedFeaturesRemoved ( const QString &  layerId,
const QgsFeatureIds deletedFeatureIds 
)
signal

Referenced by commitChanges().

void QgsVectorLayer::committedGeometriesChanges ( const QString &  layerId,
const QgsGeometryMap changedGeometries 
)
signal

Referenced by commitChanges().

bool QgsVectorLayer::copySymbologySettings ( const QgsMapLayer other)
virtual

Copies the symbology settings from another layer.

Returns true in case of success

Implements QgsMapLayer.

Definition at line 3913 of file qgsvectorlayer.cpp.

References QgsRenderer::clone(), hasGeometryType(), and mRenderer.

void QgsVectorLayer::createJoinCaches ( )

Caches joined attributes if required (and not already done)

Note
added in 1.7

Definition at line 5005 of file qgsvectorlayer.cpp.

References QgsVectorLayerJoinBuffer::containsJoins(), QgsVectorLayerJoinBuffer::createJoinCaches(), and mJoinBuffer.

int QgsVectorLayer::currentVertexMarkerSize ( )
staticprivate

Reads vertex marker size from settings.

Definition at line 4191 of file qgsvectorlayer.cpp.

Referenced by draw(), and drawRendererV2Levels().

QgsVectorLayer::VertexMarkerType QgsVectorLayer::currentVertexMarkerType ( )
staticprivate

Reads vertex marker type from settings.

Definition at line 4173 of file qgsvectorlayer.cpp.

References Cross, NoMarker, and SemiTransparentCircle.

Referenced by draw(), and drawRendererV2Levels().

QString QgsVectorLayer::dataComment ( ) const

Returns a comment for the data in the layer.

Definition at line 227 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::dataComment(), and mDataProvider.

QgsVectorDataProvider * QgsVectorLayer::dataProvider ( )
const QgsVectorDataProvider * QgsVectorLayer::dataProvider ( ) const

Returns the data provider in a const-correct manner.

Definition at line 1286 of file qgsvectorlayer.cpp.

References mDataProvider.

bool QgsVectorLayer::deleteAttribute ( int  attr)
void QgsVectorLayer::deleteCachedGeometries ( )
private

Deletes the geometries in mCachedGeometries.

Definition at line 1134 of file qgsvectorlayer.cpp.

References mCachedGeometries, and mCachedGeometriesRect.

Referenced by commitChanges(), draw(), rollBack(), and ~QgsVectorLayer().

bool QgsVectorLayer::deleteFeature ( int  fid)

delete a feature from the layer (but does not commit it)

Definition at line 3431 of file qgsvectorlayer.cpp.

References editFeatureDelete(), featureDeleted(), isEditable(), mDeletedFeatureIds, mSelectedFeatureIds, and setModified().

Referenced by deleteSelectedFeatures().

bool QgsVectorLayer::deleteSelectedFeatures ( )
bool QgsVectorLayer::deleteVertex ( int  atFeatureId,
int  atVertex 
)
void QgsVectorLayer::deselect ( int  featureId,
bool  emitSignal = true 
)
slot

Deselect feature by its ID, optionally emit signal selectionChanged()

Definition at line 1170 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds, selectionChanged(), and QgsMapLayer::setCacheImage().

Referenced by invertSelectionInRectangle().

void QgsVectorLayer::destroyEditCommand ( )

Destroy active command and reverts all changes in it.

Definition at line 4659 of file qgsvectorlayer.cpp.

References mActiveCommand, and undoEditCommand().

const QgsDiagramLayerSettings* QgsVectorLayer::diagramLayerSettings ( ) const
inline

Definition at line 216 of file qgsvectorlayer.h.

const QgsDiagramRendererV2* QgsVectorLayer::diagramRenderer ( ) const
inline

Definition at line 213 of file qgsvectorlayer.h.

const QString QgsVectorLayer::displayField ( ) const

Returns the primary display field name used in the identify results dialog.

Definition at line 4390 of file qgsvectorlayer.cpp.

References mDisplayField.

Referenced by writeSymbology().

bool QgsVectorLayer::draw ( QgsRenderContext rendererContext)
virtual
void QgsVectorLayer::drawFeature ( QgsRenderContext renderContext,
QgsFeature fet,
QImage *  marker 
)
private
void QgsVectorLayer::drawLabels ( QgsRenderContext rendererContext)
virtual
unsigned char * QgsVectorLayer::drawLineString ( unsigned char *  WKBlinestring,
QgsRenderContext renderContext 
)
private
unsigned char * QgsVectorLayer::drawPolygon ( unsigned char *  WKBpolygon,
QgsRenderContext renderContext 
)
private
void QgsVectorLayer::drawRendererV2 ( QgsRenderContext rendererContext,
bool  labeling 
)
void QgsVectorLayer::drawRendererV2Levels ( QgsRenderContext rendererContext,
bool  labeling 
)
void QgsVectorLayer::drawVertexMarker ( double  x,
double  y,
QPainter &  p,
QgsVectorLayer::VertexMarkerType  type,
int  vertexSize 
)
static

Draws a vertex symbol at (screen) coordinates x, y.

(Useful to assist vertex editing.)

Note
public and static from version 1.4

Definition at line 1141 of file qgsvectorlayer.cpp.

References Cross, and SemiTransparentCircle.

Referenced by drawLineString(), drawPolygon(), and QgsFeatureRendererV2::renderVertexMarker().

void QgsVectorLayer::editAttributeChange ( int  featureId,
int  field,
QVariant  value 
)
private

Record changed attribute, store in active command (if any)

Definition at line 4587 of file qgsvectorlayer.cpp.

References mActiveCommand, mAddedFeatures, mChangedAttributeValues, and QgsUndoCommand::storeAttributeChange().

Referenced by changeAttributeValue().

void QgsVectorLayer::editFeatureAdd ( QgsFeature feature)
private

Record added feature, store in active command (if any)

Definition at line 4569 of file qgsvectorlayer.cpp.

References mActiveCommand, mAddedFeatures, and QgsUndoCommand::storeFeatureAdd().

Referenced by addFeature().

void QgsVectorLayer::editFeatureDelete ( int  featureId)
private

Record deleted feature, store in active command (if any)

Definition at line 4578 of file qgsvectorlayer.cpp.

References mActiveCommand, mDeletedFeatureIds, and QgsUndoCommand::storeFeatureDelete().

Referenced by deleteFeature().

QString QgsVectorLayer::editForm ( )

get edit form (added in 1.4)

Definition at line 4442 of file qgsvectorlayer.cpp.

References mEditForm.

QString QgsVectorLayer::editFormInit ( )

get python function for edit form initialization (added in 1.4)

Definition at line 4457 of file qgsvectorlayer.cpp.

References mEditFormInit.

void QgsVectorLayer::editGeometryChange ( int  featureId,
QgsGeometry geometry 
)
private

Record changed geometry, store in active command (if any)

Definition at line 4559 of file qgsvectorlayer.cpp.

References mActiveCommand, mChangedGeometries, and QgsUndoCommand::storeGeometryChange().

Referenced by addIsland(), addRing(), changeGeometry(), deleteVertex(), insertVertex(), moveVertex(), splitFeatures(), and translateFeature().

void QgsVectorLayer::editingStarted ( )
signal

Referenced by startEditing().

void QgsVectorLayer::editingStopped ( )
signal

Referenced by commitChanges(), and rollBack().

QgsVectorLayer::EditType QgsVectorLayer::editType ( int  idx)
void QgsVectorLayer::enableLabels ( bool  on)

Set labels on.

Definition at line 2591 of file qgsvectorlayer.cpp.

References mLabelOn.

Referenced by readSymbology().

void QgsVectorLayer::endEditCommand ( )

Finish edit command and add it to undo/redo stack.

Definition at line 4649 of file qgsvectorlayer.cpp.

References mActiveCommand, and QgsMapLayer::undoStack().

void QgsVectorLayer::featureAdded ( int  fid)
signal
bool QgsVectorLayer::featureAtId ( int  featureId,
QgsFeature f,
bool  fetchGeometries = true,
bool  fetchAttributes = true 
)
long QgsVectorLayer::featureCount ( ) const
virtual

Number of features in the layer.

This is necessary if features are added/deleted or the layer has been subsetted. If the data provider chooses not to support this feature, the total number of features can be returned.

Returns
long containing number of features

Definition at line 1430 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::featureCount(), mDataProvider, and QgsDebugMsg.

Referenced by QgsGeometryAnalyzer::buffer(), QgsGeometryAnalyzer::centroids(), QgsGeometryAnalyzer::convexHull(), QgsSearchQueryBuilder::countRecords(), QgsGeometryAnalyzer::dissolve(), draw(), drawLabels(), drawRendererV2(), drawRendererV2Levels(), QgsOverlayAnalyzer::intersection(), and QgsGeometryAnalyzer::simplify().

void QgsVectorLayer::featureDeleted ( int  fid)
signal
int QgsVectorLayer::fieldNameIndex ( const QString &  fieldName) const
int QgsVectorLayer::findFreeId ( )
private

Goes through all features and finds a free id (e.g.

to give it temporarily to a not-commited feature)

QgsVectorOverlay * QgsVectorLayer::findOverlayByType ( const QString &  typeName)

Returns the (first) overlay of a type, e.g.

diagram or label

Note
this method was added in version 1.1

Definition at line 4520 of file qgsvectorlayer.cpp.

References mOverlays.

QGis::GeometryType QgsVectorLayer::geometryType ( ) const
bool QgsVectorLayer::hasCompatibleSymbology ( const QgsMapLayer other) const
virtual

Returns true if this layer can be in the same symbology group with another layer.

Implements QgsMapLayer.

Definition at line 3944 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::fields(), mDataProvider, QgsMapLayer::name(), and QgsMapLayer::type().

bool QgsVectorLayer::hasGeometryType ( ) const
bool QgsVectorLayer::hasLabelsEnabled ( void  ) const

Label is on.

Definition at line 2596 of file qgsvectorlayer.cpp.

References mLabelOn.

Referenced by readSymbology(), and writeSymbology().

int QgsVectorLayer::insertSegmentVerticesForSnap ( const QList< QgsSnappingResult > &  snapResults)

Inserts vertices to the snapped segments.

This is useful for topological editing if snap to segment is enabled.

Parameters
snapResultsresults collected from the snapping operation
Returns
0 in case of success

Definition at line 4115 of file qgsvectorlayer.cpp.

References hasGeometryType(), insertVertex(), QgsPoint::x(), and QgsPoint::y().

Referenced by addTopologicalPoints().

bool QgsVectorLayer::insertVertex ( double  x,
double  y,
int  atFeatureId,
int  beforeVertex 
)

Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature Not meaningful for Point geometries.

Definition at line 1945 of file qgsvectorlayer.cpp.

References editGeometryChange(), hasGeometryType(), QgsGeometry::insertVertex(), mCachedGeometries, mChangedGeometries, mDataProvider, mEditable, and setModified().

Referenced by insertSegmentVerticesForSnap().

void QgsVectorLayer::invertSelection ( )

Select not selected features and deselect selected ones.

Definition at line 1208 of file qgsvectorlayer.cpp.

References QgsFeature::id(), mSelectedFeatureIds, nextFeature(), removeSelection(), select(), selectionChanged(), and QgsMapLayer::setCacheImage().

void QgsVectorLayer::invertSelectionInRectangle ( QgsRectangle rect)

Invert selection of features found within the search rectangle (in layer's coordinates)

Definition at line 1234 of file qgsvectorlayer.cpp.

References deselect(), QgsFeature::id(), mSelectedFeatureIds, nextFeature(), QgsRectangle::normalize(), select(), selectionChanged(), and QgsMapLayer::setCacheImage().

bool QgsVectorLayer::isEditable ( ) const
virtual
bool QgsVectorLayer::isModified ( ) const
virtual

Returns true if the provider has been modified since the last commit.

Definition at line 4415 of file qgsvectorlayer.cpp.

References mModified.

Referenced by rollBack().

bool QgsVectorLayer::isReadOnly ( ) const
virtual

Returns true if the provider is in read-only mode.

Note
added in 1.6

Definition at line 4400 of file qgsvectorlayer.cpp.

References mReadOnly.

bool QgsVectorLayer::isUsingRendererV2 ( )

Return whether using renderer V2.

Note
added in 1.4

Definition at line 4546 of file qgsvectorlayer.cpp.

References mUsingRendererV2.

Referenced by QgsLegendModel::addLayer(), QgsSymbologyV2Conversion::rendererV1toV2(), QgsSymbologyV2Conversion::rendererV2toV1(), and QgsLegendModel::updateLayer().

QgsLabel * QgsVectorLayer::label ( )

Get the label object associated with this layer.

Definition at line 2581 of file qgsvectorlayer.cpp.

References mLabel.

Referenced by QgsQuickPrint::scaleTextLabels().

const QgsLabel * QgsVectorLayer::label ( ) const

Definition at line 2586 of file qgsvectorlayer.cpp.

References mLabel.

void QgsVectorLayer::layerDeleted ( )
signal

Referenced by ~QgsVectorLayer().

void QgsVectorLayer::layerModified ( bool  onlyGeometry)
signal

This signal is emitted when modifications has been done on layer.

Referenced by addAttributeAlias(), and setModified().

QVariant QgsVectorLayer::maximumValue ( int  index)
QVariant QgsVectorLayer::minimumValue ( int  index)
bool QgsVectorLayer::moveVertex ( double  x,
double  y,
int  atFeatureId,
int  atVertex 
)

Moves the vertex at the given position number, ring and item (first number is index 0), and feature to the given coordinates.

Definition at line 1984 of file qgsvectorlayer.cpp.

References editGeometryChange(), hasGeometryType(), mCachedGeometries, mChangedGeometries, mDataProvider, mEditable, QgsGeometry::moveVertex(), and setModified().

bool QgsVectorLayer::nextFeature ( QgsFeature feature)

fetch a feature (after select)

Parameters
featurebuffer to read the feature into
Returns
true, if a feature was fetched, false, if there are no more features

Definition at line 1698 of file qgsvectorlayer.cpp.

References QgsFeature::attributeMap(), dataProvider(), QgsVectorDataProvider::featureAtId(), QgsFeature::id(), QgsRectangle::isEmpty(), mAddedFeatures, mChangedGeometries, mDataProvider, mEditable, mFetchAddedFeaturesIt, mFetchAttributes, mFetchChangedGeomIt, mFetchConsidered, mFetchGeometry, mFetching, mFetchProvAttributes, mFetchRect, QgsDebugMsg, QgsFeature::setAttributeMap(), QgsFeature::setFeatureId(), QgsFeature::setGeometry(), QgsFeature::setValid(), and updateFeatureAttributes().

Referenced by QgsVectorLayerJoinBuffer::addJoinedFeatureAttributes(), addJoinedFeatureAttributes(), addRing(), boundingBoxOfSelected(), QgsGeometryAnalyzer::buffer(), QgsVectorLayerJoinBuffer::cacheJoinLayer(), QgsGeometryAnalyzer::centroids(), QgsGeometryAnalyzer::convexHull(), QgsSearchQueryBuilder::countRecords(), QgsGraduatedSymbolRendererV2::createRenderer(), QgsGeometryAnalyzer::dissolve(), draw(), drawLabels(), drawRendererV2(), drawRendererV2Levels(), QgsComposerAttributeTable::getFeatureAttributes(), QgsSearchQueryBuilder::getFieldValues(), QgsOverlayAnalyzer::intersection(), invertSelection(), invertSelectionInRectangle(), maximumValue(), minimumValue(), removePolygonIntersections(), select(), QgsFormAnnotationItem::setFeatureForMapPosition(), QgsGeometryAnalyzer::simplify(), snapWithContext(), splitFeatures(), uniqueValues(), updateExtents(), and QgsVectorFileWriter::writeAsVectorFormat().

QgsVectorLayer& QgsVectorLayer::operator= ( QgsVectorLayer const &  rhs)
private

vector layers are not copyable

QgsAttributeList QgsVectorLayer::pendingAllAttributesList ( )
int QgsVectorLayer::pendingFeatureCount ( )

returns feature count after commit

Definition at line 3459 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::featureCount(), mAddedFeatures, mDataProvider, and mDeletedFeatureIds.

const QgsFieldMap & QgsVectorLayer::pendingFields ( ) const
void QgsVectorLayer::prepareLabelingAndDiagrams ( QgsRenderContext rendererContext,
QgsAttributeList attributes,
bool &  labeling 
)
private

Registers label and diagram layer.

Parameters
rendererContextrender context
attributesattributes needed for labeling and diagrams will be added to the list
labelingout: true if there will be labeling (ng) for this layer

Definition at line 5204 of file qgsvectorlayer.cpp.

References QgsLabelingEngineInterface::addDiagramLayer(), QgsDiagramRendererV2::diagramAttributes(), QgsRenderContext::labelingEngine(), mDiagramLayerSettings, mDiagramRenderer, QgsLabelingEngineInterface::prepareLayer(), QgsDiagramLayerSettings::renderer, QgsDiagramLayerSettings::xPosColumn, and QgsDiagramLayerSettings::yPosColumn.

Referenced by draw().

QString QgsVectorLayer::providerType ( ) const

Return the provider type for this layer.

Definition at line 237 of file qgsvectorlayer.cpp.

References mProviderKey.

Referenced by QgsMapLayer::saveNamedStyle(), QgsMapLayer::writeXML(), and writeXml().

QgsVectorLayer::RangeData & QgsVectorLayer::range ( int  idx)

access range

Definition at line 4483 of file qgsvectorlayer.cpp.

References mRanges, pendingFields(), and QgsDebugMsg.

Referenced by QgsAttributeEditor::createAttributeEditor().

bool QgsVectorLayer::readSymbology ( const QDomNode &  node,
QString &  errorMessage 
)
virtual
bool QgsVectorLayer::readXml ( QDomNode &  layer_node)
virtual
void QgsVectorLayer::redoEditCommand ( QgsUndoCommand cmd)
void QgsVectorLayer::reload ( )
virtual

Synchronises with changes in the datasource.

Note
added in version 1.6

Reimplemented from QgsMapLayer.

Definition at line 941 of file qgsvectorlayer.cpp.

References mDataProvider, and QgsDataProvider::reloadData().

void QgsVectorLayer::removeJoin ( const QString &  joinLayerId)

Removes a vector layer join.

Note
added in 1.7

Definition at line 4931 of file qgsvectorlayer.cpp.

References mJoinBuffer, QgsVectorLayerJoinBuffer::removeJoin(), and updateFieldMap().

Referenced by checkJoinLayerRemove().

void QgsVectorLayer::removeOverlay ( const QString &  typeName)

Removes all overlays of a given type.

Note
this method was added in version 1.1

Definition at line 4504 of file qgsvectorlayer.cpp.

References mOverlays.

int QgsVectorLayer::removePolygonIntersections ( QgsGeometry geom)

Changes the specified geometry such that it has no intersections with other polygon (or multipolygon) geometries in this vector layer.

Parameters
geomgeometry to modify
Returns
0 in case of success

Definition at line 2382 of file qgsvectorlayer.cpp.

References QgsGeometry::boundingBox(), QgsFeature::geometry(), hasGeometryType(), QgsGeometry::makeDifference(), nextFeature(), QGis::Polygon, select(), and QgsGeometry::type().

Referenced by QgsGeometry::avoidIntersections().

void QgsVectorLayer::removeSelection ( bool  emitSignal = true)
slot

Clear selection.

Definition at line 1260 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds, selectionChanged(), and QgsMapLayer::setCacheImage().

Referenced by invertSelection(), and select().

const QgsRenderer * QgsVectorLayer::renderer ( ) const
QgsFeatureRendererV2 * QgsVectorLayer::rendererV2 ( )

Return renderer V2.

Note
added in 1.4

Definition at line 4534 of file qgsvectorlayer.cpp.

References mRendererV2.

Referenced by QgsLegendModel::addVectorLayerItemsV2(), QgsAttributeEditor::createAttributeEditor(), and QgsSymbologyV2Conversion::rendererV2toV1().

bool QgsVectorLayer::rollBack ( )
void QgsVectorLayer::select ( QgsRectangle rect,
bool  lock 
)
void QgsVectorLayer::select ( QgsAttributeList  fetchAttributes,
QgsRectangle  rect = QgsRectangle(),
bool  fetchGeometry = true,
bool  useIntersect = false 
)

Select features with or without attributes in a given window.

Parameters
fetchAttributesindizes of attributes to fetch
rectwindow (QgsRectangle() for all)
fetchGeometryfetch features with geometry
useIntersectfetch only features that actually intersect the window (not just the bounding box)

Definition at line 1634 of file qgsvectorlayer.cpp.

References QgsVectorLayerJoinBuffer::containsJoins(), QgsVectorDataProvider::fields(), mAddedFeatures, QgsVectorLayerJoinBuffer::maximumIndex(), mChangedGeometries, mDataProvider, mDeletedFeatureIds, mEditable, mFetchAddedFeaturesIt, mFetchAttributes, mFetchChangedGeomIt, mFetchConsidered, mFetchGeometry, mFetching, mFetchProvAttributes, mFetchRect, mJoinBuffer, QgsVectorLayerJoinBuffer::select(), and QgsVectorDataProvider::select().

void QgsVectorLayer::select ( int  featureId,
bool  emitSignal = true 
)
slot

Select feature by its ID, optionally emit signal selectionChanged()

Definition at line 1157 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds, selectionChanged(), and QgsMapLayer::setCacheImage().

int QgsVectorLayer::selectedFeatureCount ( )

The number of features that are selected in this layer.

Definition at line 3812 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds.

Referenced by QgsMapCanvas::zoomToSelected().

QgsFeatureList QgsVectorLayer::selectedFeatures ( )
const QgsFeatureIds & QgsVectorLayer::selectedFeaturesIds ( ) const
void QgsVectorLayer::selectionChanged ( )
signal
void QgsVectorLayer::setAnnotationForm ( const QString &  ui)

set annotation form for layer (added in 1.5)

Definition at line 4452 of file qgsvectorlayer.cpp.

References mAnnotationForm.

void QgsVectorLayer::setCheckedState ( int  idx,
QString  checked,
QString  notChecked 
)

set string representing 'true' for a checkbox (added in 1.4)

Definition at line 4890 of file qgsvectorlayer.cpp.

References mCheckedStates, QgsMapLayer::name(), and pendingFields().

void QgsVectorLayer::setCoordinateSystem ( )
bool QgsVectorLayer::setDataProvider ( QString const &  provider)
private
void QgsVectorLayer::setDiagramLayerSettings ( const QgsDiagramLayerSettings s)

Definition at line 5250 of file qgsvectorlayer.cpp.

References mDiagramLayerSettings.

void QgsVectorLayer::setDiagramRenderer ( QgsDiagramRendererV2 r)

Sets diagram rendering object (takes ownership)

Definition at line 1317 of file qgsvectorlayer.cpp.

References mDiagramRenderer.

void QgsVectorLayer::setDisplayField ( QString  fldName = "")

Set the primary display field to be used in the identify results dialog.

sets the preferred display field based on some fuzzy logic

Definition at line 245 of file qgsvectorlayer.cpp.

References hasGeometryType(), mDisplayField, pendingFields(), and QgsDebugMsg.

Referenced by readSymbology(), and setDataProvider().

void QgsVectorLayer::setEditForm ( QString  ui)

set edit form (added in 1.4)

Definition at line 4447 of file qgsvectorlayer.cpp.

References mEditForm.

void QgsVectorLayer::setEditFormInit ( QString  function)

set python function for edit form initialization (added in 1.4)

Definition at line 4462 of file qgsvectorlayer.cpp.

References mEditFormInit.

void QgsVectorLayer::setEditType ( int  idx,
EditType  edit 
)

set edit type

Definition at line 4435 of file qgsvectorlayer.cpp.

References mEditTypes, QgsMapLayer::name(), pendingFields(), and QgsMapLayer::type().

void QgsVectorLayer::setModified ( bool  modified = true,
bool  onlyGeometryWasModified = false 
)
void QgsVectorLayer::setProviderEncoding ( const QString &  encoding)

Sets the textencoding of the data provider.

Definition at line 1291 of file qgsvectorlayer.cpp.

References mDataProvider, and QgsVectorDataProvider::setEncoding().

bool QgsVectorLayer::setReadOnly ( bool  readonly = true)

Make layer read-only (editing disabled) or not.

Returns
false if the layer is in editing yet
Note
added in 1.6

Definition at line 4405 of file qgsvectorlayer.cpp.

References mEditable, and mReadOnly.

void QgsVectorLayer::setRenderer ( QgsRenderer r)
void QgsVectorLayer::setRendererV2 ( QgsFeatureRendererV2 r)

Set renderer V2.

Note
added in 1.4

Definition at line 4538 of file qgsvectorlayer.cpp.

References hasGeometryType(), and mRendererV2.

Referenced by QgsVectorLayer(), readSymbology(), QgsSymbologyV2Conversion::rendererV1toV2(), and QgsSymbologyV2Conversion::rendererV2toV1().

void QgsVectorLayer::setSelectedFeatures ( const QgsFeatureIds ids)

Change selection to the new set of features.

Definition at line 3801 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds, selectionChanged(), and QgsMapLayer::setCacheImage().

bool QgsVectorLayer::setSubsetString ( QString  subset)
virtual

Set the string (typically sql) used to define a subset of the layer.

Parameters
subsetThe subset string. This may be the where clause of a sql statement or other defintion string specific to the underlying dataprovider and data store.
Returns
true, when setting the subset string was successful, false otherwise (added in 1.4)

Definition at line 1507 of file qgsvectorlayer.cpp.

References QgsDataProvider::dataSourceUri(), mDataProvider, QgsMapLayer::mDataSource, QgsDebugMsg, QgsMapLayer::setCacheImage(), QgsDataProvider::setSubsetString(), and updateExtents().

void QgsVectorLayer::setUsingRendererV2 ( bool  usingRendererV2)

set whether to use renderer V2 for drawing.

Note
added in 1.4

Definition at line 4550 of file qgsvectorlayer.cpp.

References hasGeometryType(), and mUsingRendererV2.

Referenced by QgsVectorLayer(), readSymbology(), QgsSymbologyV2Conversion::rendererV1toV2(), and QgsSymbologyV2Conversion::rendererV2toV1().

bool QgsVectorLayer::snapPoint ( QgsPoint point,
double  tolerance 
)

Snaps a point to the closest vertex if there is one within the snapping tolerance.

Parameters
pointThe point which is set to the position of a vertex if there is one within the snapping tolerance. If there is no point within this tolerance, point is left unchanged.
toleranceThe snapping tolerance
Returns
true if point has been snapped, false if no vertex within search tolerance

Definition at line 3981 of file qgsvectorlayer.cpp.

References hasGeometryType(), QgsPoint::setX(), QgsPoint::setY(), QgsSnapper::SnapToVertex, and snapWithContext().

void QgsVectorLayer::snapToGeometry ( const QgsPoint startPoint,
int  featureId,
QgsGeometry geom,
double  sqrSnappingTolerance,
QMultiMap< double, QgsSnappingResult > &  snappingResults,
QgsSnapper::SnappingType  snap_to 
) const
private

Snaps to a geometry and adds the result to the multimap if it is within the snapping result.

Parameters
startPointstart point of the snap
featureIdid of feature
geomgeometry to snap
sqrSnappingTolerancesquared search tolerance of the snap
snappingResultslist to which the result is appended
snap_tosnap to vertex or to segment

Definition at line 4055 of file qgsvectorlayer.cpp.

References QgsSnappingResult::afterVertex, QgsSnappingResult::afterVertexNr, QgsSnappingResult::beforeVertex, QgsSnappingResult::beforeVertexNr, QgsGeometry::closestSegmentWithContext(), QgsGeometry::closestVertex(), geometryType(), QgsSnappingResult::layer, QGis::Point, QgsSnappingResult::snappedAtGeometry, QgsSnappingResult::snappedVertex, QgsSnappingResult::snappedVertexNr, QgsSnapper::SnapToSegment, QgsSnapper::SnapToVertex, QgsSnapper::SnapToVertexAndSegment, and QgsGeometry::vertexAt().

Referenced by snapWithContext().

int QgsVectorLayer::snapWithContext ( const QgsPoint startPoint,
double  snappingTolerance,
QMultiMap< double, QgsSnappingResult > &  snappingResults,
QgsSnapper::SnappingType  snap_to 
)

Snaps to segment or vertex within given tolerance.

Parameters
startPointpoint to snap (in layer coordinates)
snappingTolerancedistance tolerance for snapping
snappingResultssnapping results. Key is the distance between startPoint and snapping target
snap_toto segment / to vertex
Returns
0 in case of success

Definition at line 4006 of file qgsvectorlayer.cpp.

References QgsGeometry::boundingBox(), QgsRectangle::contains(), QgsFeature::geometry(), hasGeometryType(), QgsFeature::id(), QgsRectangle::intersects(), mCachedGeometries, mCachedGeometriesRect, mDataProvider, nextFeature(), select(), snapToGeometry(), QgsPoint::x(), and QgsPoint::y().

Referenced by addTopologicalPoints(), and snapPoint().

int QgsVectorLayer::splitFeatures ( const QList< QgsPoint > &  splitLine,
bool  topologicalEditing = false 
)
bool QgsVectorLayer::startEditing ( )
void QgsVectorLayer::stopRendererV2 ( QgsRenderContext rendererContext,
QgsSingleSymbolRendererV2 selRenderer 
)
private

Stop version 2 renderer and selected renderer (if required)

Definition at line 5182 of file qgsvectorlayer.cpp.

References mRendererV2, QgsSingleSymbolRendererV2::stopRender(), and QgsFeatureRendererV2::stopRender().

Referenced by drawRendererV2Levels().

QString QgsVectorLayer::storageType ( ) const

Returns the permanent storage type for this layer as a friendly name.

Definition at line 208 of file qgsvectorlayer.cpp.

References mDataProvider, and QgsVectorDataProvider::storageType().

QString QgsVectorLayer::subsetString ( )
virtual

Get the string (typically sql) used to define a subset of the layer.

Returns
The subset string or QString::null if not implemented by the provider

Definition at line 1497 of file qgsvectorlayer.cpp.

References mDataProvider, QgsDebugMsg, and QgsDataProvider::subsetString().

Referenced by addJoinedFeatureAttributes().

void QgsVectorLayer::transformPoint ( double &  x,
double &  y,
const QgsMapToPixel mtp,
const QgsCoordinateTransform ct 
)
inlineprivate

Convenience function to transform the given point.

Definition at line 4359 of file qgsvectorlayer.cpp.

References QgsMapToPixel::transformInPlace(), and QgsCoordinateTransform::transformInPlace().

Referenced by drawFeature().

void QgsVectorLayer::transformPoints ( std::vector< double > &  x,
std::vector< double > &  y,
std::vector< double > &  z,
QgsRenderContext renderContext 
)
inlineprivate
int QgsVectorLayer::translateFeature ( int  featureId,
double  dx,
double  dy 
)

Translates feature by dx, dy.

Parameters
featureIdid of the feature to translate
dxtranslation of x-coordinate
dytranslation of y-coordinate
Returns
0 in case of success

Definition at line 2212 of file qgsvectorlayer.cpp.

References editGeometryChange(), QgsVectorDataProvider::featureAtId(), QgsFeature::geometry(), hasGeometryType(), mAddedFeatures, mCachedGeometries, mChangedGeometries, mDataProvider, setModified(), and QgsGeometry::translate().

void QgsVectorLayer::triggerRepaint ( )
slot
void QgsVectorLayer::undoEditCommand ( QgsUndoCommand cmd)
void QgsVectorLayer::uniqueValues ( int  index,
QList< QVariant > &  uniqueValues,
int  limit = -1 
)
void QgsVectorLayer::updateAttributeMapIndex ( QgsAttributeMap map,
int  oldIndex,
int  newIndex 
) const
private

Updates an index in an attribute map to a new value (usually necessary because of a join operation)

Definition at line 5192 of file qgsvectorlayer.cpp.

Referenced by updateFieldMap().

void QgsVectorLayer::updateExtents ( )
virtualslot
void QgsVectorLayer::updateFeatureAttributes ( QgsFeature f,
bool  all = false 
)
private
long QgsVectorLayer::updateFeatureCount ( ) const
virtual

This function does nothing useful, it's kept only for compatibility.

Todo:
to be removed

Definition at line 1441 of file qgsvectorlayer.cpp.

void QgsVectorLayer::updateFeatureGeometry ( QgsFeature f)
private

Update feature with uncommited geometry updates.

Definition at line 1627 of file qgsvectorlayer.cpp.

References QgsFeature::id(), mChangedGeometries, and QgsFeature::setGeometry().

Referenced by selectedFeatures().

void QgsVectorLayer::updateFieldMap ( )
QMap< QString, QVariant > & QgsVectorLayer::valueMap ( int  idx)

access value map

Definition at line 4467 of file qgsvectorlayer.cpp.

References mValueMaps, pendingFields(), and QgsDebugMsg.

Referenced by QgsAttributeEditor::createAttributeEditor().

const QList< QgsVectorJoinInfo > & QgsVectorLayer::vectorJoins ( ) const
Note
added in 1.7

Definition at line 4937 of file qgsvectorlayer.cpp.

References mJoinBuffer, and QgsVectorLayerJoinBuffer::vectorJoins().

Referenced by QgsProject::_getMapLayers().

void QgsVectorLayer::vectorOverlays ( QList< QgsVectorOverlay * > &  overlayList)

Returns pointers to the overlays of this layer.

Note
this method was added in version 1.1

Definition at line 4515 of file qgsvectorlayer.cpp.

References mOverlays.

Referenced by QgsMapRenderer::render().

QGis::WkbType QgsVectorLayer::wkbType ( ) const

Returns the WKBType or WKBUnknown in case of error.

Definition at line 1380 of file qgsvectorlayer.cpp.

References mWkbType.

Referenced by addTopologicalPoints(), drawFeature(), drawLineString(), drawPolygon(), and QgsVectorFileWriter::writeAsVectorFormat().

bool QgsVectorLayer::writeSymbology ( QDomNode &  node,
QDomDocument &  doc,
QString &  errorMessage 
) const
virtual
bool QgsVectorLayer::writeXml ( QDomNode &  layer_node,
QDomDocument &  doc 
)
virtual

write vector layer specific state to project file Dom node.

Note
Called by QgsMapLayer::writeXML().

Reimplemented from QgsMapLayer.

Definition at line 2813 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::encoding(), geometryType(), mDataProvider, mJoinBuffer, providerType(), QGis::qgisVectorGeometryType, QgsDebugMsg, writeSymbology(), and QgsVectorLayerJoinBuffer::writeXml().

Member Data Documentation

QgsAttributeAction* QgsVectorLayer::mActions
private

The user-defined actions that are accessed from the Identify Results dialog box.

Definition at line 838 of file qgsvectorlayer.h.

Referenced by QgsVectorLayer(), readSymbology(), writeSymbology(), and ~QgsVectorLayer().

QgsUndoCommand* QgsVectorLayer::mActiveCommand
private
QgsAttributeIds QgsVectorLayer::mAddedAttributeIds
private

added attributes fields which are not commited

Definition at line 879 of file qgsvectorlayer.h.

Referenced by addAttribute(), commitChanges(), deleteAttribute(), redoEditCommand(), rollBack(), startEditing(), undoEditCommand(), and updateFieldMap().

QgsFeatureList QgsVectorLayer::mAddedFeatures
private

New features which are not commited.

Note a feature can be added and then changed, therefore the details here can be overridden by mChangedAttributeValues and mChangedGeometries.

Definition at line 870 of file qgsvectorlayer.h.

Referenced by addIsland(), commitChanges(), editAttributeChange(), editFeatureAdd(), featureAtId(), maximumValue(), minimumValue(), nextFeature(), pendingFeatureCount(), redoEditCommand(), rollBack(), select(), selectedFeatures(), translateFeature(), undoEditCommand(), uniqueValues(), updateExtents(), and updateFieldMap().

QString QgsVectorLayer::mAnnotationForm
private

Definition at line 934 of file qgsvectorlayer.h.

Referenced by readSymbology(), setAnnotationForm(), and writeSymbology().

QMap< QString, QString > QgsVectorLayer::mAttributeAliasMap
private

Map that stores the aliases for attributes.

Key is the attribute name and value the alias for that attribute

Definition at line 888 of file qgsvectorlayer.h.

Referenced by addAttributeAlias(), attributeAlias(), readSymbology(), and writeSymbology().

QgsGeometryMap QgsVectorLayer::mCachedGeometries
private
QgsRectangle QgsVectorLayer::mCachedGeometriesRect
private

extent for which there are cached geometries

Definition at line 853 of file qgsvectorlayer.h.

Referenced by deleteCachedGeometries(), draw(), and snapWithContext().

QgsChangedAttributesMap QgsVectorLayer::mChangedAttributeValues
private
QgsGeometryMap QgsVectorLayer::mChangedGeometries
private
QMap< QString, QPair<QString, QString> > QgsVectorLayer::mCheckedStates
private

Definition at line 930 of file qgsvectorlayer.h.

Referenced by checkedState(), readSymbology(), setCheckedState(), and writeSymbology().

QStringList QgsVectorLayer::mCommitErrors
private

Definition at line 925 of file qgsvectorlayer.h.

Referenced by commitChanges(), and commitErrors().

int QgsVectorLayer::mCurrentVertexMarkerSize
private

The current size of editing marker.

Definition at line 917 of file qgsvectorlayer.h.

Referenced by draw(), drawLineString(), and drawPolygon().

QgsVectorLayer::VertexMarkerType QgsVectorLayer::mCurrentVertexMarkerType
private

The current type of editing marker.

Definition at line 914 of file qgsvectorlayer.h.

Referenced by draw(), drawLineString(), and drawPolygon().

QgsVectorDataProvider* QgsVectorLayer::mDataProvider
private
QgsAttributeIds QgsVectorLayer::mDeletedAttributeIds
private

deleted attributes fields which are not commited

Definition at line 876 of file qgsvectorlayer.h.

Referenced by commitChanges(), deleteAttribute(), maximumValue(), minimumValue(), redoEditCommand(), rollBack(), startEditing(), undoEditCommand(), uniqueValues(), and updateFieldMap().

QgsFeatureIds QgsVectorLayer::mDeletedFeatureIds
private

Deleted feature IDs which are not commited.

Note a feature can be added and then deleted again before the change is committed - in that case the added feature would be removed from mAddedFeatures only and not entered here.

Definition at line 865 of file qgsvectorlayer.h.

Referenced by commitChanges(), deleteFeature(), editFeatureDelete(), featureAtId(), maximumValue(), minimumValue(), pendingFeatureCount(), redoEditCommand(), select(), undoEditCommand(), uniqueValues(), and updateExtents().

QgsDiagramLayerSettings* QgsVectorLayer::mDiagramLayerSettings
private
QgsDiagramRendererV2* QgsVectorLayer::mDiagramRenderer
private
QString QgsVectorLayer::mDisplayField
private

index of the primary label field

Definition at line 832 of file qgsvectorlayer.h.

Referenced by displayField(), and setDisplayField().

bool QgsVectorLayer::mEditable
private
QString QgsVectorLayer::mEditForm
private

Definition at line 932 of file qgsvectorlayer.h.

Referenced by editForm(), readSymbology(), setEditForm(), and writeSymbology().

QString QgsVectorLayer::mEditFormInit
private

Definition at line 932 of file qgsvectorlayer.h.

Referenced by editFormInit(), readSymbology(), setEditFormInit(), and writeSymbology().

QMap< QString, EditType > QgsVectorLayer::mEditTypes
private

Definition at line 927 of file qgsvectorlayer.h.

Referenced by editType(), readSymbology(), setEditType(), and writeSymbology().

QgsFeatureList::iterator QgsVectorLayer::mFetchAddedFeaturesIt
private

Definition at line 944 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

QgsAttributeList QgsVectorLayer::mFetchAttributes
private

Definition at line 938 of file qgsvectorlayer.h.

Referenced by nextFeature(), select(), selectedFeatures(), and updateFeatureAttributes().

QgsGeometryMap::iterator QgsVectorLayer::mFetchChangedGeomIt
private

Definition at line 943 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

QSet<int> QgsVectorLayer::mFetchConsidered
private

Definition at line 942 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

bool QgsVectorLayer::mFetchGeometry
private

Definition at line 940 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

bool QgsVectorLayer::mFetching
private

Definition at line 936 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

QgsAttributeList QgsVectorLayer::mFetchProvAttributes
private

Definition at line 939 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

QgsRectangle QgsVectorLayer::mFetchRect
private

Definition at line 937 of file qgsvectorlayer.h.

Referenced by nextFeature(), and select().

QgsVectorLayerJoinBuffer* QgsVectorLayer::mJoinBuffer
private
QgsLabel* QgsVectorLayer::mLabel
private
bool QgsVectorLayer::mLabelOn
private

Display labels.

Definition at line 911 of file qgsvectorlayer.h.

Referenced by drawLabels(), enableLabels(), hasLabelsEnabled(), and setDataProvider().

int QgsVectorLayer::mMaxUpdatedIndex
private

max field index

Definition at line 891 of file qgsvectorlayer.h.

Referenced by addAttribute(), startEditing(), and updateFieldMap().

bool QgsVectorLayer::mModified
private

Flag indicating whether the layer has been modified since the last commit.

Definition at line 847 of file qgsvectorlayer.h.

Referenced by isModified(), and setModified().

QList<QgsVectorOverlay*> QgsVectorLayer::mOverlays
private

List of overlays.

Vector overlays will be rendered on top of all maplayers

Definition at line 923 of file qgsvectorlayer.h.

Referenced by addOverlay(), findOverlayByType(), removeOverlay(), vectorOverlays(), writeSymbology(), and ~QgsVectorLayer().

QString QgsVectorLayer::mProviderKey
private

Data provider key.

Definition at line 835 of file qgsvectorlayer.h.

Referenced by providerType(), QgsVectorLayer(), readXml(), and setDataProvider().

QMap< QString, RangeData > QgsVectorLayer::mRanges
private

Definition at line 929 of file qgsvectorlayer.h.

Referenced by range(), readSymbology(), and writeSymbology().

bool QgsVectorLayer::mReadOnly
private

Flag indicating whether the layer is in read-only mode (editing disabled) or not.

Definition at line 844 of file qgsvectorlayer.h.

Referenced by isReadOnly(), setReadOnly(), and startEditing().

QgsRenderer* QgsVectorLayer::mRenderer
private

Renderer object which holds the information about how to display the features.

Definition at line 899 of file qgsvectorlayer.h.

Referenced by copySymbologySettings(), draw(), drawLabels(), drawLineString(), drawPolygon(), readSymbology(), renderer(), setRenderer(), writeSymbology(), and ~QgsVectorLayer().

QgsFeatureRendererV2* QgsVectorLayer::mRendererV2
private
QgsFeatureIds QgsVectorLayer::mSelectedFeatureIds
private

Set holding the feature IDs that are activated.

Note that if a feature subsequently gets deleted (i.e. by its addition to mDeletedFeatureIds), it always needs to be removed from mSelectedFeatureIds as well.

Definition at line 859 of file qgsvectorlayer.h.

Referenced by addFeatures(), addIsland(), boundingBoxOfSelected(), deleteFeature(), deleteSelectedFeatures(), deselect(), draw(), drawLabels(), drawRendererV2(), drawRendererV2Levels(), invertSelection(), invertSelectionInRectangle(), removeSelection(), select(), selectedFeatureCount(), selectedFeatures(), selectedFeaturesIds(), and setSelectedFeatures().

QgsFieldMap QgsVectorLayer::mUpdatedFields
private
int QgsVectorLayer::mUpdateThreshold
private

Update threshold for drawing features as they are read.

A value of zero indicates that no features will be drawn until all have been read

Definition at line 826 of file qgsvectorlayer.h.

Referenced by draw(), and drawRendererV2().

bool QgsVectorLayer::mUsingRendererV2
private

whether to use V1 or V2 renderer

Definition at line 905 of file qgsvectorlayer.h.

Referenced by draw(), isUsingRendererV2(), QgsVectorLayer(), setUsingRendererV2(), and writeSymbology().

QMap< QString, QMap<QString, QVariant> > QgsVectorLayer::mValueMaps
private

Definition at line 928 of file qgsvectorlayer.h.

Referenced by readSymbology(), valueMap(), and writeSymbology().

bool QgsVectorLayer::mVertexMarkerOnlyForSelection
private

Flag if the vertex markers should be drawn only for selection (true) or for all features (false)

Definition at line 920 of file qgsvectorlayer.h.

Referenced by draw().

int QgsVectorLayer::mWkbType
private

Geometry type as defined in enum WkbType (qgis.h)

Definition at line 894 of file qgsvectorlayer.h.

Referenced by setDataProvider(), and wkbType().


The documentation for this class was generated from the following files: