QgsVectorLayer Class Reference
[Core]

#include <qgsvectorlayer.h>

Inheritance diagram for QgsVectorLayer:

Inheritance graph
[legend]
Collaboration diagram for QgsVectorLayer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Vector layer backed by a data source provider.

Definition at line 57 of file qgsvectorlayer.h.

Public Types

enum  EditType {
  LineEdit, UniqueValues, UniqueValuesEditable, ValueMap,
  Classification, EditRange, SliderRange, FileName
}

Public Slots

void select (int featureId, bool emitSignal=TRUE)
 Select feature by its ID, optionally emit signal selectionChanged().
void deselect (int featureId, bool emitSignal=TRUE)
 Deselect feature by its ID, optionally emit signal selectionChanged().
void removeSelection (bool emitSignal=TRUE)
 Clear selection.
void triggerRepaint ()
virtual void updateExtents ()
 Update the extents for the layer.

Signals

void selectionChanged ()
 This signal is emited when selection was changed.
void layerModified (bool onlyGeometry)
 This signal is emitted when modifications has been done on layer.
void editingStarted ()
void editingStopped ()
void attributeAdded (int idx)
void attributeDeleted (int idx)
void featureDeleted (int fid)
void layerDeleted ()
void attributeValueChanged (int fid, int idx, const QVariant &)

Public Member Functions

 QgsVectorLayer (QString path=0, QString baseName=0, QString providerLib=0, bool loadDefaultStyleFlag=true)
 Constructor.
virtual ~QgsVectorLayer ()
 Destructor.
QString storageType () const
 Returns the permanent storage type for this layer as a friendly name.
QString capabilitiesString () const
 Capabilities for this layer in a friendly format.
QString dataComment () const
 Returns a comment for the data in the layer.
void setDisplayField (QString fldName=0)
 Set the primary display field to be used in the identify results dialog.
const QString displayField () const
 Returns the primary display field name used in the identify results dialog.
QgsVectorDataProviderdataProvider ()
 Returns the data provider.
const QgsVectorDataProviderdataProvider () const
 Returns the data provider in a const-correct manner.
void setProviderEncoding (const QString &encoding)
 Sets the textencoding of the data provider.
void setCoordinateSystem ()
 Setup the coordinate system tranformation for the layer.
QgsLabellabel ()
 Get the label object associated with this layer.
const QgsLabellabel () const
QgsAttributeActionactions ()
int selectedFeatureCount ()
 The number of features that are selected in this layer.
void select (QgsRectangle &rect, bool lock)
 Select features found within the search rectangle (in layer's coordinates).
void invertSelection ()
 Select not selected features and deselect selected ones.
void invertSelectionInRectangle (QgsRectangle &rect)
 Invert selection of features found within the search rectangle (in layer's coordinates).
QgsFeatureList selectedFeatures ()
 Get a copy of the user-selected features.
const QgsFeatureIdsselectedFeaturesIds () const
 Return reference to identifiers of selected features.
void setSelectedFeatures (const QgsFeatureIds &ids)
 Change selection to the new set of features.
QgsRectangle boundingBoxOfSelected ()
 Returns the bounding box of the selected features.
bool copySymbologySettings (const QgsMapLayer &other)
 Copies the symbology settings from another layer.
bool hasCompatibleSymbology (const QgsMapLayer &other) const
 Returns true if this layer can be in the same symbology group with another layer.
const QgsRendererrenderer () const
 Returns a pointer to the renderer.
void setRenderer (QgsRenderer *r)
 Sets the renderer.
QGis::GeometryType geometryType () const
 Returns point, line or polygon.
QGis::WkbType wkbType () const
 Returns the WKBType or WKBUnknown in case of error.
QString providerType () const
 Return the provider type for this layer.
virtual bool readXml (QDomNode &layer_node)
 reads vector layer specific state from project file Dom node.
virtual bool writeXml (QDomNode &layer_node, QDomDocument &doc)
 write vector layer specific state to project file Dom node.
bool readSymbology (const QDomNode &node, QString &errorMessage)
 Read the symbology for the current layer from the Dom node supplied.
bool writeSymbology (QDomNode &, QDomDocument &doc, QString &errorMessage) const
 Write the symbology for the layer into the docment provided.
virtual long featureCount () const
 Number of features in the layer.
virtual long updateFeatureCount () const
 Update the feature count.
virtual void setSubsetString (QString subset)
 Set the string (typically sql) used to define a subset of the layer.
virtual QString subsetString ()
 Get the string (typically sql) used to define a subset of the layer.
void select (QgsAttributeList fetchAttributes, QgsRectangle rect=QgsRectangle(), bool fetchGeometry=true, bool useIntersect=false)
bool nextFeature (QgsFeature &feature)
bool featureAtId (int featureId, QgsFeature &f, bool fetchGeometries=true, bool fetchAttributes=true)
 Gets the feature at the given feature id.
bool addFeature (QgsFeature &f, bool alsoUpdateExtent=TRUE)
 Adds a feature.
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.
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.
bool deleteVertex (int atFeatureId, int atVertex)
 Deletes a vertex from a feature.
bool deleteSelectedFeatures ()
 Deletes the selected features.
int addRing (const QList< QgsPoint > &ring)
 Adds a ring to polygon/multipolygon features.
int addIsland (const QList< QgsPoint > &ring)
 Adds a new island polygon to a multipolygon feature.
int translateFeature (int featureId, double dx, double dy)
 Translates feature by dx, dy.
int splitFeatures (const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
 Splits features cut by the given line.
int removePolygonIntersections (QgsGeometry *geom)
 Changes the specified geometry such that it has no intersections with other polygon (or multipolygon) geometries in this vector layer.
int addTopologicalPoints (QgsGeometry *geom)
 Adds topological points for every vertex of the geometry.
int addTopologicalPoints (const QgsPoint &p)
 Adds a vertex to segments which intersect point p but don't already have a vertex there.
int insertSegmentVerticesForSnap (const QList< QgsSnappingResult > &snapResults)
 Inserts vertices to the snapped segments.
void enableLabels (bool on)
 Set labels on.
bool hasLabelsEnabled (void) const
 Label is on.
virtual bool isEditable () const
 Returns true if the provider is in editing mode.
virtual bool isModified () const
 Returns true if the provider has been modified since the last commit.
bool snapPoint (QgsPoint &point, double tolerance)
 Snaps a point to the closest vertex if there is one within the snapping tolerance.
int snapWithContext (const QgsPoint &startPoint, double snappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to)
 Snaps to segment or vertex within given tolerance.
bool draw (QgsRenderContext &rendererContext)
 Draws the layer.
void drawLabels (QgsRenderContext &rendererContext)
 Draws the layer labels using coordinate transformation.
const QgsFieldMappendingFields () const
 returns field list in the to-be-committed state
QgsAttributeList pendingAllAttributesList ()
 returns list of attributes
int pendingFeatureCount ()
 returns feature count after commit
void setModified (bool modified=TRUE, bool onlyGeometryWasModified=FALSE)
 Sets whether some features are modified or not.
bool startEditing ()
 Make layer editable.
bool changeAttributeValue (int fid, int field, QVariant value, bool emitSignal=true)
 changed an attribute value (but does not commit it
bool addAttribute (QString name, QString type)
 add an attribute field (but does not commit it) returns the field index or -1 in case of failure
bool deleteAttribute (int attr)
 delete an attribute field (but does not commit it)
bool addFeatures (QgsFeatureList features, bool makeSelected=TRUE)
 Insert a copy of the given features into the layer (but does not commit it).
bool deleteFeature (int fid)
 delete a feature from the layer (but does not commit it)
bool commitChanges ()
 Attempts to commit any changes to disk.
const QStringList & commitErrors ()
bool rollBack ()
 Stop editing and discard the edits.
EditType editType (int idx)
 get edit type
void setEditType (int idx, EditType edit)
 set edit type
QMap< QString, QVariant > & valueMap (int idx)
 access value map
RangeDatarange (int idx)
 access range

Private Types

enum  VertexMarkerType { SemiTransparentCircle, Cross }

Private Member Functions

 QgsVectorLayer (QgsVectorLayer const &rhs)
 vector layers are not copyable
QgsVectorLayeroperator= (QgsVectorLayer const &rhs)
 vector layers are not copyable
bool setDataProvider (QString const &provider)
 bind layer to a specific data provider
void drawFeature (QPainter *p, QgsFeature &fet, const QgsMapToPixel *cXf, const QgsCoordinateTransform *ct, QImage *marker, double widthScale, double markerScaleFactor, bool drawingToEditingCanvas)
 Draws features.
void transformPoint (double &x, double &y, const QgsMapToPixel *mtp, const QgsCoordinateTransform *ct)
 Convenience function to transform the given point.
void transformPoints (std::vector< double > &x, std::vector< double > &y, std::vector< double > &z, const QgsMapToPixel *mtp, const QgsCoordinateTransform *ct)
unsigned char * drawLineString (unsigned char *WKBlinestring, QPainter *p, const QgsMapToPixel *mtp, const QgsCoordinateTransform *ct, bool drawingToEditingCanvas)
 Draw the linestring as given in the WKB format.
unsigned char * drawPolygon (unsigned char *WKBpolygon, QPainter *p, const QgsMapToPixel *mtp, const QgsCoordinateTransform *ct, bool drawingToEditingCanvas)
 Draw the polygon as given in the WKB format.
int findFreeId ()
 Goes through all features and finds a free id (e.g.
void deleteCachedGeometries ()
 Deletes the geometries in mCachedGeometries.
void drawVertexMarker (int x, int y, QPainter &p, QgsVectorLayer::VertexMarkerType type)
 Draws a vertex symbol at (screen) coordinates x, y.
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.
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.
QgsVectorLayer::VertexMarkerType currentVertexMarkerType ()
 Reads vertex marker type from settings.
void updateFeatureAttributes (QgsFeature &f)
 Update feature with uncommited attribute updates.
void updateFeatureGeometry (QgsFeature &f)
 Update feature with uncommited geometry updates.

Private Attributes

int mUpdateThreshold
 Update threshold for drawing features as they are read.
QgsVectorDataProvidermDataProvider
 Pointer to data provider derived from the abastract base class QgsDataProvider.
QString mDisplayField
 index of the primary label field
QString mProviderKey
 Data provider key.
QgsAttributeActionmActions
 The user-defined actions that are accessed from the Identify Results dialog box.
bool mEditable
 Flag indicating whether the layer is in editing mode or not.
bool mModified
 Flag indicating whether the layer has been modified since the last commit.
QgsGeometryMap mCachedGeometries
 cache of the committed geometries retrieved *for the current display*
QgsFeatureIds mSelectedFeatureIds
 Set holding the feature IDs that are activated.
QgsFeatureIds mDeletedFeatureIds
 Deleted feature IDs which are not commited.
QgsFeatureList mAddedFeatures
 New features which are not commited.
QgsChangedAttributesMap mChangedAttributeValues
 Changed attributes values which are not commited.
QgsAttributeIds mDeletedAttributeIds
 deleted attributes fields which are not commited
QgsAttributeIds mAddedAttributeIds
 added attributes fields which are not commited
QgsGeometryMap mChangedGeometries
 Changed geometries which are not commited.
QgsFieldMap mUpdatedFields
 field map to commit
int mMaxUpdatedIndex
 max field index
int mWkbType
 Geometry type as defined in enum WkbType (qgis.h).
QgsRenderermRenderer
 Renderer object which holds the information about how to display the features.
QgsLabelmLabel
 Label.
bool mLabelOn
 Display labels.
QStringList mCommitErrors
QMap< QString, EditTypemEditTypes
QMap< QString, QMap< QString,
QVariant > > 
mValueMaps
QMap< QString, RangeDatamRanges
bool mFetching
QgsRectangle mFetchRect
QgsAttributeList mFetchAttributes
bool mFetchGeometry
QSet< int > mFetchConsidered
QgsGeometryMap::iterator mFetchChangedGeomIt
QgsFeatureList::iterator mFetchAddedFeaturesIt

Classes

struct  RangeData


Member Enumeration Documentation

enum QgsVectorLayer::EditType

Enumerator:
LineEdit 
UniqueValues 
UniqueValuesEditable 
ValueMap 
Classification 
EditRange 
SliderRange 
FileName 

Definition at line 62 of file qgsvectorlayer.h.

enum QgsVectorLayer::VertexMarkerType [private]

Enumerator:
SemiTransparentCircle 
Cross 

Definition at line 465 of file qgsvectorlayer.h.


Constructor & Destructor Documentation

QgsVectorLayer::QgsVectorLayer ( QString  path = 0,
QString  baseName = 0,
QString  providerLib = 0,
bool  loadDefaultStyleFlag = true 
)

Constructor.

Definition at line 88 of file qgsvectorlayer.cpp.

References geometryType(), QgsMapLayer::loadDefaultStyle(), mActions, mProviderKey, QgsMapLayer::mValid, renderer(), setCoordinateSystem(), setDataProvider(), and setRenderer().

QgsVectorLayer::~QgsVectorLayer (  )  [virtual]

Destructor.

Definition at line 148 of file qgsvectorlayer.cpp.

References deleteCachedGeometries(), layerDeleted(), mActions, mDataProvider, mLabel, mRenderer, QgsMapLayer::mValid, and QgsDebugMsg.

QgsVectorLayer::QgsVectorLayer ( QgsVectorLayer const &  rhs  )  [private]

vector layers are not copyable


Member Function Documentation

QString QgsVectorLayer::storageType (  )  const

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

Definition at line 171 of file qgsvectorlayer.cpp.

References mDataProvider, and QgsVectorDataProvider::storageType().

QString QgsVectorLayer::capabilitiesString (  )  const

Capabilities for this layer in a friendly format.

Definition at line 181 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::capabilitiesString(), and mDataProvider.

QString QgsVectorLayer::dataComment (  )  const

Returns a comment for the data in the layer.

Definition at line 190 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::dataComment(), and mDataProvider.

void QgsVectorLayer::setDisplayField ( QString  fldName = 0  ) 

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

Definition at line 208 of file qgsvectorlayer.cpp.

References mDisplayField, pendingFields(), and QgsDebugMsg.

Referenced by readSymbology(), and setDataProvider().

const QString QgsVectorLayer::displayField (  )  const

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

Definition at line 3478 of file qgsvectorlayer.cpp.

References mDisplayField.

Referenced by writeSymbology().

QgsVectorDataProvider * QgsVectorLayer::dataProvider (  ) 

Returns the data provider.

Definition at line 914 of file qgsvectorlayer.cpp.

References mDataProvider.

Referenced by QgsLegendModel::addVectorLayerItems(), nextFeature(), QgsUniqueValueRenderer::readXML(), QgsGraduatedSymbolRenderer::readXML(), QgsContinuousColorRenderer::readXML(), QgsProjectFileTransform::transform0110to1000(), QgsVectorFileWriter::writeAsShapefile(), QgsUniqueValueRenderer::writeXML(), QgsGraduatedSymbolRenderer::writeXML(), and QgsContinuousColorRenderer::writeXML().

const QgsVectorDataProvider * QgsVectorLayer::dataProvider (  )  const

Returns the data provider in a const-correct manner.

Definition at line 919 of file qgsvectorlayer.cpp.

References mDataProvider.

void QgsVectorLayer::setProviderEncoding ( const QString &  encoding  ) 

Sets the textencoding of the data provider.

Definition at line 924 of file qgsvectorlayer.cpp.

References mDataProvider, and QgsVectorDataProvider::setEncoding().

void QgsVectorLayer::setCoordinateSystem (  ) 

Setup the coordinate system tranformation for the layer.

Definition at line 3424 of file qgsvectorlayer.cpp.

References QgsDataProvider::crs(), QgsCoordinateReferenceSystem::isValid(), QgsMapLayer::mCRS, mDataProvider, QgsDebugMsg, and QgsCoordinateReferenceSystem::validate().

Referenced by QgsVectorLayer().

QgsLabel * QgsVectorLayer::label (  ) 

Get the label object associated with this layer.

Definition at line 1997 of file qgsvectorlayer.cpp.

References mLabel.

Referenced by drawLabels(), readSymbology(), QgsQuickPrint::scaleTextLabels(), and writeSymbology().

const QgsLabel * QgsVectorLayer::label (  )  const

Definition at line 2002 of file qgsvectorlayer.cpp.

References mLabel.

QgsAttributeAction* QgsVectorLayer::actions (  )  [inline]

Definition at line 124 of file qgsvectorlayer.h.

int QgsVectorLayer::selectedFeatureCount (  ) 

The number of features that are selected in this layer.

Definition at line 2941 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds.

void QgsVectorLayer::select ( QgsRectangle rect,
bool  lock 
)

Select features found within the search rectangle (in layer's coordinates).

Definition at line 833 of file qgsvectorlayer.cpp.

References QgsFeature::id(), nextFeature(), QgsRectangle::normalize(), removeSelection(), and selectionChanged().

Referenced by addRing(), boundingBoxOfSelected(), draw(), drawLabels(), invertSelection(), invertSelectionInRectangle(), removePolygonIntersections(), snapWithContext(), splitFeatures(), and updateExtents().

void QgsVectorLayer::invertSelection (  ) 

Select not selected features and deselect selected ones.

Definition at line 855 of file qgsvectorlayer.cpp.

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

void QgsVectorLayer::invertSelectionInRectangle ( QgsRectangle rect  ) 

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

Definition at line 878 of file qgsvectorlayer.cpp.

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

QgsFeatureList QgsVectorLayer::selectedFeatures (  ) 

Get a copy of the user-selected features.

Definition at line 2952 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::attributeIndexes(), QgsVectorDataProvider::featureAtId(), mAddedFeatures, mDataProvider, mSelectedFeatureIds, updateFeatureAttributes(), and updateFeatureGeometry().

Referenced by splitFeatures().

const QgsFeatureIds & QgsVectorLayer::selectedFeaturesIds (  )  const

Return reference to identifiers of selected features.

Definition at line 2946 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds.

Referenced by splitFeatures(), and QgsVectorFileWriter::writeAsShapefile().

void QgsVectorLayer::setSelectedFeatures ( const QgsFeatureIds ids  ) 

Change selection to the new set of features.

Definition at line 2934 of file qgsvectorlayer.cpp.

References mSelectedFeatureIds, and selectionChanged().

QgsRectangle QgsVectorLayer::boundingBoxOfSelected (  ) 

Returns the bounding box of the selected features.

If there is no selection, QgsRectangle(0,0,0,0) is returned

Definition at line 1006 of file qgsvectorlayer.cpp.

References QgsGeometry::boundingBox(), QgsRectangle::combineExtentWith(), QgsFeature::geometry(), QgsRectangle::height(), QgsFeature::id(), mSelectedFeatureIds, nextFeature(), select(), QgsRectangle::set(), QgsRectangle::setMinimal(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

Referenced by QgsMapCanvas::zoomToSelected().

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 3038 of file qgsvectorlayer.cpp.

References QgsRenderer::clone(), and mRenderer.

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 3066 of file qgsvectorlayer.cpp.

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

const QgsRenderer * QgsVectorLayer::renderer (  )  const

Returns a pointer to the renderer.

Definition at line 933 of file qgsvectorlayer.cpp.

References mRenderer.

Referenced by QgsLegendModel::addVectorLayerItems(), QgsQuickPrint::printMap(), QgsVectorLayer(), readSymbology(), QgsQuickPrint::scalePointSymbols(), QgsLegendModel::updateVectorClassificationItem(), and writeSymbology().

void QgsVectorLayer::setRenderer ( QgsRenderer r  ) 

Sets the renderer.

If a renderer is already present, it is deleted

Definition at line 938 of file qgsvectorlayer.cpp.

References mRenderer.

Referenced by QgsVectorLayer(), QgsUniqueValueRenderer::readXML(), QgsSingleSymbolRenderer::readXML(), QgsGraduatedSymbolRenderer::readXML(), and QgsContinuousColorRenderer::readXML().

QGis::GeometryType QgsVectorLayer::geometryType (  )  const

Returns point, line or polygon.

Definition at line 947 of file qgsvectorlayer.cpp.

References QgsLogger::debug(), QgsVectorDataProvider::geometryType(), QGis::Line, mDataProvider, QGis::Point, QGis::Polygon, QgsDebugMsg, QgsMapLayer::type(), QGis::UnknownGeometry, QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, and QGis::WKBPolygon25D.

Referenced by QgsVectorLayer(), readSymbology(), QgsUniqueValueRenderer::readXML(), QgsSingleSymbolRenderer::readXML(), QgsGraduatedSymbolRenderer::readXML(), QgsContinuousColorRenderer::readXML(), and snapToGeometry().

QGis::WkbType QgsVectorLayer::wkbType (  )  const

Returns the WKBType or WKBUnknown in case of error.

Definition at line 1001 of file qgsvectorlayer.cpp.

References mWkbType.

Referenced by addTopologicalPoints(), drawFeature(), drawLineString(), and drawPolygon().

QString QgsVectorLayer::providerType (  )  const

Return the provider type for this layer.

Definition at line 200 of file qgsvectorlayer.cpp.

References mProviderKey.

Referenced by writeXml().

bool QgsVectorLayer::readXml ( QDomNode &  layer_node  )  [virtual]

reads vector layer specific state from project file Dom node.

Note:
Called by QgsMapLayer::readXML().

Reimplemented from QgsMapLayer.

Definition at line 2051 of file qgsvectorlayer.cpp.

References mDataProvider, QgsMapLayer::mDataSource, mProviderKey, QgsMapLayer::mValid, QgsDebugMsg, readSymbology(), setDataProvider(), and QgsVectorDataProvider::setEncoding().

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 2193 of file qgsvectorlayer.cpp.

References providerType(), QGis::qgisVectorGeometryType, QgsDebugMsg, QgsMapLayer::type(), and writeSymbology().

bool QgsVectorLayer::readSymbology ( const QDomNode &  node,
QString &  errorMessage 
) [virtual]

Read the symbology for the current layer from the Dom node supplied.

Parameters:
QDomNode node that will contain the symbology definition for this layer.
errorMessage reference to string that will be updated with any error messages
Returns:
true in case of success.

Implements QgsMapLayer.

Definition at line 2229 of file qgsvectorlayer.cpp.

References EditRange, editType(), enableLabels(), geometryType(), hasLabelsEnabled(), label(), mActions, mEditTypes, mLabel, mRanges, mRenderer, mValueMaps, QgsMapLayer::name(), QgsDebugMsg, QgsLabel::readXML(), QgsRenderer::readXML(), QgsAttributeAction::readXML(), renderer(), setDisplayField(), QgsLabel::setMaxScale(), QgsLabel::setMinScale(), QgsLabel::setScaleBasedVisibility(), SliderRange, and ValueMap.

Referenced by readXml().

bool QgsVectorLayer::writeSymbology ( QDomNode &  ,
QDomDocument &  doc,
QString &  errorMessage 
) const [virtual]

Write the symbology for the layer into the docment provided.

Parameters:
QDomNode the node that will have the style element added to it.
QDomDocument the document that will have the QDomNode added.
errorMessage reference to string that will be updated with any error messages
Returns:
true in case of success.

Implements QgsMapLayer.

Definition at line 2357 of file qgsvectorlayer.cpp.

References QgsRenderer::classificationAttributes(), displayField(), EditRange, QgsVectorDataProvider::fields(), hasLabelsEnabled(), label(), QgsLabel::labelField(), mActions, mDataProvider, mEditTypes, mRanges, mRenderer, mValueMaps, QgsMapLayer::name(), QgsDebugMsg, renderer(), SliderRange, QgsLabel::Text, ValueMap, QgsLabel::writeXML(), QgsRenderer::writeXML(), and QgsAttributeAction::writeXML().

Referenced by writeXml().

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 1062 of file qgsvectorlayer.cpp.

References QgsVectorDataProvider::featureCount(), mDataProvider, and QgsLogger::warning().

Referenced by draw(), and drawLabels().

long QgsVectorLayer::updateFeatureCount (  )  const [virtual]

Update the feature count.

Returns:
long containing the number of features in the datasource

Definition at line 1073 of file qgsvectorlayer.cpp.

References mDataProvider, QgsVectorDataProvider::updateFeatureCount(), and QgsLogger::warning().

Referenced by draw().

void QgsVectorLayer::setSubsetString ( QString  subset  )  [virtual]

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

Parameters:
subset&