#include <qgsvectorlayer.h>
Inheritance diagram for QgsVectorLayer:


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. | |
| QgsVectorDataProvider * | dataProvider () |
| Returns the data provider. | |
| const QgsVectorDataProvider * | dataProvider () 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. | |
| QgsLabel * | label () |
| Get the label object associated with this layer. | |
| const QgsLabel * | label () const |
| QgsAttributeAction * | actions () |
| 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 QgsFeatureIds & | selectedFeaturesIds () 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 QgsRenderer * | renderer () 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 QgsFieldMap & | pendingFields () 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 | |
| RangeData & | range (int idx) |
| access range | |
Private Types | |
| enum | VertexMarkerType { SemiTransparentCircle, Cross } |
Private Member Functions | |
| QgsVectorLayer (QgsVectorLayer const &rhs) | |
| vector layers are not copyable | |
| QgsVectorLayer & | operator= (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. | |
| QgsVectorDataProvider * | mDataProvider |
| Pointer to data provider derived from the abastract base class QgsDataProvider. | |
| QString | mDisplayField |
| index of the primary label field | |
| QString | mProviderKey |
| Data provider key. | |
| QgsAttributeAction * | mActions |
| 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). | |
| QgsRenderer * | mRenderer |
| Renderer object which holds the information about how to display the features. | |
| QgsLabel * | mLabel |
| Label. | |
| bool | mLabelOn |
| Display labels. | |
| QStringList | mCommitErrors |
| QMap< QString, EditType > | mEditTypes |
| QMap< QString, QMap< QString, QVariant > > | mValueMaps |
| QMap< QString, RangeData > | mRanges |
| bool | mFetching |
| QgsRectangle | mFetchRect |
| QgsAttributeList | mFetchAttributes |
| bool | mFetchGeometry |
| QSet< int > | mFetchConsidered |
| QgsGeometryMap::iterator | mFetchChangedGeomIt |
| QgsFeatureList::iterator | mFetchAddedFeaturesIt |
Classes | |
| struct | RangeData |
| LineEdit | |
| UniqueValues | |
| UniqueValuesEditable | |
| ValueMap | |
| Classification | |
| EditRange | |
| SliderRange | |
| FileName |
Definition at line 62 of file qgsvectorlayer.h.
enum QgsVectorLayer::VertexMarkerType [private] |
| 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
| 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 3495 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 3441 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 2014 of file qgsvectorlayer.cpp.
References mLabel.
Referenced by drawLabels(), readSymbology(), QgsQuickPrint::scaleTextLabels(), and writeSymbology().
| const QgsLabel * QgsVectorLayer::label | ( | ) | const |
| 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 2958 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 2969 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 2963 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 2951 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 3055 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 3083 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(), snapToGeometry(), and writeXml().
| 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.
Reimplemented from QgsMapLayer.
Definition at line 2068 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.
Reimplemented from QgsMapLayer.
Definition at line 2210 of file qgsvectorlayer.cpp.
References geometryType(), providerType(), QGis::qgisVectorGeometryType, QgsDebugMsg, and writeSymbology().
| bool QgsVectorLayer::readSymbology | ( | const QDomNode & | node, | |
| QString & | errorMessage | |||
| ) | [virtual] |
Read the symbology for the current layer from the Dom node supplied.
| QDomNode | node that will contain the symbology definition for this layer. | |
| errorMessage | reference to string that will be updated with any error messages |
Implements QgsMapLayer.
Definition at line 2246 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.
| 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 |
Implements QgsMapLayer.
Definition at line 2374 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.
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.
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.
| subset | The subset string. This may be the where clause of a sql statement or other defintion string specific to the underlying dataprovider and data store. |
Definition at line 1141 of file qgsvectorlayer.cpp.
References QgsDataProvider::dataSourceUri(), mDataProvider, QgsMapLayer::mDataSource, QgsDataProvider::setSubsetString(), updateExtents(), and QgsLogger::warning().
| QString QgsVectorLayer::subsetString | ( | ) | [virtual] |
Get the string (typically sql) used to define a subset of the layer.
Definition at line 1131 of file qgsvectorlayer.cpp.
References mDataProvider, QgsDataProvider::subsetString(), and QgsLogger::warning().
| void QgsVectorLayer::select | ( | QgsAttributeList | fetchAttributes, | |
| QgsRectangle | rect = QgsRectangle(), |
|||
| bool | fetchGeometry = true, |
|||
| bool | useIntersect = false | |||
| ) |
Definition at line 1187 of file qgsvectorlayer.cpp.
References mAddedAttributeIds, mAddedFeatures, mChangedGeometries, mDataProvider, mDeletedFeatureIds, mEditable, mFetchAddedFeaturesIt, mFetchAttributes, mFetchChangedGeomIt, mFetchConsidered, mFetchGeometry, mFetching, mFetchRect, mUpdatedFields, and QgsVectorDataProvider::select().
| bool QgsVectorLayer::nextFeature | ( | QgsFeature & | feature | ) |
Definition at line 1231 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::attributeIndexes(), QgsFeature::attributeMap(), dataProvider(), QgsVectorDataProvider::featureAtId(), QgsFeature::id(), QgsRectangle::isEmpty(), mAddedFeatures, mChangedGeometries, mDataProvider, mEditable, mFetchAddedFeaturesIt, mFetchAttributes, mFetchChangedGeomIt, mFetchConsidered, mFetchGeometry, mFetching, mFetchRect, QgsFeature::setAttributeMap(), QgsFeature::setFeatureId(), QgsFeature::setGeometry(), updateFeatureAttributes(), and QgsLogger::warning().
Referenced by addRing(), boundingBoxOfSelected(), draw(), drawLabels(), invertSelection(), invertSelectionInRectangle(), removePolygonIntersections(), select(), snapWithContext(), splitFeatures(), and updateExtents().
| bool QgsVectorLayer::featureAtId | ( | int | featureId, | |
| QgsFeature & | f, | |||
| bool | fetchGeometries = true, |
|||
| bool | fetchAttributes = true | |||
| ) |
Gets the feature at the given feature id.
Considers the changed, added, deleted and permanent features
Definition at line 1346 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::attributeIndexes(), QgsFeature::attributeMap(), QgsVectorDataProvider::featureAtId(), QgsFeature::id(), mAddedFeatures, mChangedGeometries, mDataProvider, mDeletedFeatureIds, QgsFeature::setAttributeMap(), QgsFeature::setFeatureId(), QgsFeature::setGeometry(), updateFeatureAttributes(), and QgsLogger::warning().
Referenced by addIsland().
| bool QgsVectorLayer::addFeature | ( | QgsFeature & | f, | |
| bool | alsoUpdateExtent = TRUE | |||
| ) |
Adds a feature.
| lastFeatureInBatch | If True, will also go to the effort of e.g. updating the extents. |
Definition at line 1427 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::capabilities(), isEditable(), mAddedFeatures, mDataProvider, QgsDebugMsg, QgsFeature::setFeatureId(), setModified(), and updateExtents().
Referenced by addFeatures().
| 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 1468 of file qgsvectorlayer.cpp.
References mCachedGeometries, mChangedGeometries, mDataProvider, mEditable, and setModified().
Referenced by insertSegmentVerticesForSnap().
| 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 1498 of file qgsvectorlayer.cpp.
References mCachedGeometries, mChangedGeometries, mDataProvider, mEditable, and setModified().
| bool QgsVectorLayer::deleteVertex | ( | int | atFeatureId, | |
| int | atVertex | |||
| ) |
Deletes a vertex from a feature.
Definition at line 1527 of file qgsvectorlayer.cpp.
References mCachedGeometries, mChangedGeometries, mDataProvider, mEditable, and setModified().
| bool QgsVectorLayer::deleteSelectedFeatures | ( | ) |
Deletes the selected features.
Definition at line 1556 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::capabilities(), deleteFeature(), QgsVectorDataProvider::DeleteFeatures, isEditable(), mDataProvider, mSelectedFeatureIds, selectionChanged(), triggerRepaint(), and updateExtents().
| int QgsVectorLayer::addRing | ( | const QList< QgsPoint > & | ring | ) |
Adds a ring to polygon/multipolygon features.
Definition at line 1585 of file qgsvectorlayer.cpp.
References QgsGeometry::addRing(), boundingBoxFromPointList(), QgsFeature::geometry(), QgsFeature::id(), mChangedGeometries, nextFeature(), select(), setModified(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), and QgsRectangle::setYMinimum().
| int QgsVectorLayer::addIsland | ( | const QList< QgsPoint > & | ring | ) |
Adds a new island polygon to a multipolygon feature.
Definition at line 1618 of file qgsvectorlayer.cpp.
References QgsGeometry::addIsland(), featureAtId(), QgsFeature::geometryAndOwnership(), mAddedFeatures, mCachedGeometries, mChangedGeometries, mSelectedFeatureIds, QgsDebugMsg, and setModified().
| int QgsVectorLayer::translateFeature | ( | int | featureId, | |
| double | dx, | |||
| double | dy | |||
| ) |
Translates feature by dx, dy.
| featureId | id of the feature to translate | |
| dx | translation of x-coordinate | |
| dy | translation of y-coordinate |
Definition at line 1684 of file qgsvectorlayer.cpp.
References mAddedFeatures, mCachedGeometries, mChangedGeometries, and setModified().
| int QgsVectorLayer::splitFeatures | ( | const QList< QgsPoint > & | splitLine, | |
| bool | topologicalEditing = false | |||
| ) |
Splits features cut by the given line.
| splitLine | line that splits the layer features | |
| topologicalEditing | true if topological editing is enabled |
Definition at line 1717 of file qgsvectorlayer.cpp.
References addFeatures(), addTopologicalPoints(), boundingBoxFromPointList(), QgsRectangle::height(), QgsRectangle::isEmpty(), mChangedGeometries, nextFeature(), pendingAllAttributesList(), select(), selectedFeatures(), selectedFeaturesIds(), QgsFeature::setAttributeMap(), QgsFeature::setGeometry(), setModified(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
| 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.
| geom | geometry to modify |
Definition at line 1824 of file qgsvectorlayer.cpp.
References QgsGeometry::boundingBox(), QgsFeature::geometry(), QgsGeometry::makeDifference(), nextFeature(), QGis::Polygon, select(), and QgsGeometry::type().
| int QgsVectorLayer::addTopologicalPoints | ( | QgsGeometry * | geom | ) |
Adds topological points for every vertex of the geometry.
| geom | the geometry where each vertex is added to segments of other features Note: geom is not going to be modified by the function |
Definition at line 1856 of file qgsvectorlayer.cpp.
References QgsGeometry::asMultiPolygon(), QgsGeometry::asMultiPolyline(), QgsGeometry::asPolygon(), QgsGeometry::asPolyline(), 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 usefull for topological editing.
| p | position of the vertex |
Definition at line 1960 of file qgsvectorlayer.cpp.
References QGis::Feet, insertSegmentVerticesForSnap(), QgsCoordinateReferenceSystem::mapUnits(), QgsMapLayer::mCRS, QGis::Meters, QgsSnapper::SnapToSegment, QgsSnapper::SnapToVertex, and snapWithContext().
| 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.
| snapResults | results collected from the snapping operation |
Definition at line 3229 of file qgsvectorlayer.cpp.
References insertVertex(), QgsPoint::x(), and QgsPoint::y().
Referenced by addTopologicalPoints().
| void QgsVectorLayer::enableLabels | ( | bool | on | ) |
Set labels on.
Definition at line 2024 of file qgsvectorlayer.cpp.
References mLabelOn.
Referenced by readSymbology().
| bool QgsVectorLayer::hasLabelsEnabled | ( | void | ) | const |
Label is on.
Definition at line 2029 of file qgsvectorlayer.cpp.
References mLabelOn.
Referenced by readSymbology(), and writeSymbology().
| bool QgsVectorLayer::isEditable | ( | ) | const [virtual] |
Returns true if the provider is in editing mode.
Implements QgsMapLayer.
Definition at line 3500 of file qgsvectorlayer.cpp.
References mDataProvider, and mEditable.
Referenced by addAttribute(), addFeature(), addFeatures(), changeAttributeValue(), commitChanges(), deleteAttribute(), deleteFeature(), deleteSelectedFeatures(), pendingAllAttributesList(), pendingFields(), and rollBack().
| bool QgsVectorLayer::isModified | ( | ) | const [virtual] |
Returns true if the provider has been modified since the last commit.
Definition at line 3505 of file qgsvectorlayer.cpp.
References mModified.
Referenced by rollBack().
| bool QgsVectorLayer::snapPoint | ( | QgsPoint & | point, | |
| double | tolerance | |||
| ) |
Snaps a point to the closest vertex if there is one within the snapping tolerance.
| point | The 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. | |
| tolerance | The snapping tolerance |
Definition at line 3120 of file qgsvectorlayer.cpp.
References QgsPoint::setX(), QgsPoint::setY(), QgsSnapper::SnapToVertex, and 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.
| startPoint | point to snap (in layer coordinates) | |
| snappingTolerance | distance tolerance for snapping | |
| snappingResults | snapping results. Key is the distance between startPoint and snapping target | |
| snap_to | to segment / to vertex |
Definition at line 3142 of file qgsvectorlayer.cpp.
References QgsFeature::geometry(), QgsFeature::id(), mDataProvider, nextFeature(), select(), snapToGeometry(), QgsPoint::x(), and QgsPoint::y().
Referenced by addTopologicalPoints(), and snapPoint().
| bool QgsVectorLayer::draw | ( | QgsRenderContext & | rendererContext | ) | [virtual] |
Draws the layer.
Reimplemented from QgsMapLayer.
Definition at line 675 of file qgsvectorlayer.cpp.
References QgsRenderer::classificationAttributes(), QgsRenderContext::coordinateTransform(), deleteCachedGeometries(), QgsRenderContext::drawEditingInformation(), drawFeature(), QgsMapLayer::drawingProgress(), QgsRenderContext::extent(), featureCount(), QgsFeature::geometry(), QgsFeature::id(), QgsRenderContext::mapToPixel(), mCachedGeometries, mEditable, mRenderer, mSelectedFeatureIds, mUpdateThreshold, nextFeature(), QgsRenderContext::painter(), pendingFeatureCount(), QgsRenderContext::rasterScaleFactor(), QgsRenderer::renderFeature(), QgsRenderContext::renderingStopped(), QgsRenderContext::scaleFactor(), QgsMapLayer::screenUpdateRequested(), select(), QgsFeature::typeName(), updateFeatureCount(), QgsLogger::warning(), and QgsException::what().
| void QgsVectorLayer::drawLabels | ( | QgsRenderContext & | rendererContext | ) | [virtual] |
Draws the layer labels using coordinate transformation.
Reimplemented from QgsMapLayer.
Definition at line 285 of file qgsvectorlayer.cpp.
References QgsLabel::addRequiredFields(), QgsRenderer::classificationAttributes(), QgsRenderContext::coordinateTransform(), QgsLogger::critical(), QgsLogger::debug(), QgsRenderContext::extent(), featureCount(), label(), QgsRenderContext::mapToPixel(), QgsLabel::maxScale(), mLabel, mLabelOn, mRenderer, mSelectedFeatureIds, nextFeature(), QgsRenderContext::painter(), QgsDebugMsg, QgsRenderContext::rasterScaleFactor(), QgsRenderContext::rendererScale(), QgsLabel::renderLabel(), QgsRenderContext::scaleFactor(), select(), and QgsRenderer::willRenderFeature().
| const QgsFieldMap & QgsVectorLayer::pendingFields | ( | ) | const |
returns field list in the to-be-committed state
Definition at line 2602 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::fields(), isEditable(), mDataProvider, and mUpdatedFields.
Referenced by QgsSymbol::appendField(), editType(), range(), QgsSymbol::readFieldName(), setDisplayField(), setEditType(), valueMap(), and QgsGraduatedSymbolRenderer::writeXML().
| QgsAttributeList QgsVectorLayer::pendingAllAttributesList | ( | ) |
returns list of attributes
Definition at line 2607 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::attributeIndexes(), isEditable(), mDataProvider, and mUpdatedFields.
Referenced by splitFeatures().
| int QgsVectorLayer::pendingFeatureCount | ( | ) |
returns feature count after commit
Definition at line 2612 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::featureCount(), mAddedFeatures, mDataProvider, and mDeletedFeatureIds.
Referenced by draw().
| void QgsVectorLayer::setModified | ( | bool | modified = TRUE, |
|
| bool | onlyGeometryWasModified = FALSE | |||
| ) |
Sets whether some features are modified or not.
Definition at line 3510 of file qgsvectorlayer.cpp.
References layerModified(), and mModified.
Referenced by addAttribute(), addFeature(), addIsland(), addRing(), changeAttributeValue(), commitChanges(), deleteAttribute(), deleteFeature(), deleteVertex(), insertVertex(), moveVertex(), rollBack(), splitFeatures(), and translateFeature().
| bool QgsVectorLayer::startEditing | ( | ) |
Make layer editable.
Definition at line 2034 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::capabilities(), QgsVectorDataProvider::EditingCapabilities, editingStarted(), QgsVectorDataProvider::fields(), mDataProvider, mEditable, mMaxUpdatedIndex, and mUpdatedFields.
| bool QgsVectorLayer::changeAttributeValue | ( | int | fid, | |
| int | field, | |||
| QVariant | value, | |||
| bool | emitSignal = true | |||
| ) |
changed an attribute value (but does not commit it
Definition at line 2500 of file qgsvectorlayer.cpp.
References attributeValueChanged(), isEditable(), mAddedFeatures, mChangedAttributeValues, and setModified().
| bool QgsVectorLayer::addAttribute | ( | QString | name, | |
| QString | type | |||
| ) |
add an attribute field (but does not commit it) returns the field index or -1 in case of failure
Definition at line 2536 of file qgsvectorlayer.cpp.
References attributeAdded(), isEditable(), mAddedAttributeIds, mDataProvider, mMaxUpdatedIndex, mUpdatedFields, setModified(), and QgsVectorDataProvider::supportedNativeTypes().
| bool QgsVectorLayer::deleteAttribute | ( | int | attr | ) |
delete an attribute field (but does not commit it)
Definition at line 2563 of file qgsvectorlayer.cpp.
References attributeDeleted(), QgsVectorDataProvider::fields(), isEditable(), mDataProvider, mDeletedAttributeIds, mUpdatedFields, and setModified().
| 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 3012 of file qgsvectorlayer.cpp.
References addFeature(), QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::capabilities(), isEditable(), mDataProvider, mSelectedFeatureIds, selectionChanged(), and updateExtents().
Referenced by splitFeatures().
| bool QgsVectorLayer::deleteFeature | ( | int | fid | ) |
delete a feature from the layer (but does not commit it)
Definition at line 2584 of file qgsvectorlayer.cpp.
References featureDeleted(), isEditable(), mDeletedFeatureIds, mSelectedFeatureIds, and setModified().
Referenced by deleteSelectedFeatures().
| 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 2619 of file qgsvectorlayer.cpp.
References QgsVectorDataProvider::addAttributes(), QgsVectorDataProvider::AddAttributes, QgsVectorDataProvider::addFeatures(), QgsVectorDataProvider::AddFeatures, QgsVectorDataProvider::capabilities(), QgsVectorDataProvider::changeAttributeValues(), QgsVectorDataProvider::ChangeAttributeValues, QgsVectorDataProvider::ChangeGeometries, QgsVectorDataProvider::changeGeometryValues(), QgsVectorDataProvider::deleteAttributes(), QgsVectorDataProvider::DeleteAttributes, deleteCachedGeometries(), QgsVectorDataProvider::deleteFeatures(), QgsVectorDataProvider::DeleteFeatures, editingStopped(), QgsVectorDataProvider::fields(), isEditable(), mAddedAttributeIds, mAddedFeatures, mChangedAttributeValues, mChangedGeometries, mCommitErrors, mDataProvider, mDeletedAttributeIds, mDeletedFeatureIds, mEditable, mMaxUpdatedIndex, mUpdatedFields, QgsMapLayer::name(), QgsDebugMsg, setModified(), triggerRepaint(), QgsDataProvider::updateExtents(), and QgsVectorDataProvider::updateFeatureCount().
| const QStringList & QgsVectorLayer::commitErrors | ( | ) |
| bool QgsVectorLayer::rollBack | ( | ) |
Stop editing and discard the edits.
Definition at line 2897 of file qgsvectorlayer.cpp.
References attributeAdded(), attributeDeleted(), deleteCachedGeometries(), editingStopped(), isEditable(), isModified(), mAddedAttributeIds, mAddedFeatures, mChangedAttributeValues, mChangedGeometries, mDeletedAttributeIds, mDeletedFeatureIds, mEditable, mMaxUpdatedIndex, mUpdatedFields, setModified(), and triggerRepaint().
| QgsVectorLayer::EditType QgsVectorLayer::editType | ( | int | idx | ) |
get edit type
Definition at line 3516 of file qgsvectorlayer.cpp.
References LineEdit, mEditTypes, QgsMapLayer::name(), and pendingFields().
Referenced by readSymbology().
| void QgsVectorLayer::setEditType | ( | int | idx, | |
| EditType | edit | |||
| ) |
set edit type
Definition at line 3525 of file qgsvectorlayer.cpp.
References mEditTypes, QgsMapLayer::name(), and pendingFields().
| QMap< QString, QVariant > & QgsVectorLayer::valueMap | ( | int | idx | ) |
access value map
Definition at line 3532 of file qgsvectorlayer.cpp.
References mValueMaps, pendingFields(), and QgsDebugMsg.
| QgsVectorLayer::RangeData & QgsVectorLayer::range | ( | int | idx | ) |
access range
Definition at line 3546 of file qgsvectorlayer.cpp.
References mRanges, pendingFields(), and QgsDebugMsg.
| void QgsVectorLayer::select | ( | int | featureId, | |
| bool | emitSignal = TRUE | |||
| ) | [slot] |
Select feature by its ID, optionally emit signal selectionChanged().
Definition at line 813 of file qgsvectorlayer.cpp.
References mSelectedFeatureIds, and selectionChanged().
| void QgsVectorLayer::deselect | ( | int | featureId, | |
| bool | emitSignal = TRUE | |||
| ) | [slot] |
Deselect feature by its ID, optionally emit signal selectionChanged().
Definition at line 823 of file qgsvectorlayer.cpp.
References mSelectedFeatureIds, and selectionChanged().
Referenced by invertSelectionInRectangle().
| void QgsVectorLayer::removeSelection | ( | bool | emitSignal = TRUE |
) | [slot] |
Clear selection.
Definition at line 901 of file qgsvectorlayer.cpp.
References mSelectedFeatureIds, and selectionChanged().
Referenced by invertSelection(), and select().
| void QgsVectorLayer::triggerRepaint | ( | ) | [slot] |
Definition at line 909 of file qgsvectorlayer.cpp.
References QgsMapLayer::repaintRequested().
Referenced by commitChanges(), deleteSelectedFeatures(), and rollBack().
| void QgsVectorLayer::updateExtents | ( | ) | [virtual, slot] |
Update the extents for the layer.
This is necessary if features are added/deleted or the layer has been subsetted.
Definition at line 1083 of file qgsvectorlayer.cpp.
References QgsGeometry::boundingBox(), QgsRectangle::combineExtentWith(), QgsDataProvider::extent(), QgsVectorDataProvider::featureCount(), QgsFeature::geometry(), mAddedFeatures, mChangedGeometries, mDataProvider, mDeletedFeatureIds, QgsMapLayer::mLayerExtent, nextFeature(), QgsMapLayer::recalculateExtents(), select(), QgsRectangle::setMinimal(), QgsLogger::warning(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by addFeature(), addFeatures(), deleteSelectedFeatures(), setDataProvider(), and setSubsetString().
| void QgsVectorLayer::selectionChanged | ( | ) | [signal] |
This signal is emited when selection was changed.
Referenced by addFeatures(), deleteSelectedFeatures(), deselect(), invertSelection(), invertSelectionInRectangle(), removeSelection(), select(), and setSelectedFeatures().
| void QgsVectorLayer::layerModified | ( | bool | onlyGeometry | ) | [signal] |
| void QgsVectorLayer::editingStarted | ( | ) | [signal] |
Referenced by startEditing().
| void QgsVectorLayer::editingStopped | ( | ) | [signal] |
Referenced by commitChanges(), and rollBack().
| void QgsVectorLayer::attributeAdded | ( | int | idx | ) | [signal] |
Referenced by addAttribute(), and rollBack().
| void QgsVectorLayer::attributeDeleted | ( | int | idx | ) | [signal] |
Referenced by deleteAttribute(), and rollBack().
| void QgsVectorLayer::featureDeleted | ( | int | fid | ) | [signal] |
Referenced by deleteFeature().
| void QgsVectorLayer::layerDeleted | ( | ) | [signal] |
Referenced by ~QgsVectorLayer().
| void QgsVectorLayer::attributeValueChanged | ( | int | fid, | |
| int | idx, | |||
| const QVariant & | ||||
| ) | [signal] |
Referenced by changeAttributeValue().
| QgsVectorLayer& QgsVectorLayer::operator= | ( | QgsVectorLayer const & | rhs | ) | [private] |
vector layers are not copyable
| bool QgsVectorLayer::setDataProvider | ( | QString const & | provider | ) | [private] |
bind layer to a specific data provider
| provider | should be "postgres", "ogr", or ?? |
Definition at line 2125 of file qgsvectorlayer.cpp.
References QgsProviderRegistry::instance(), QgsDataProvider::isValid(), mDataProvider, QgsMapLayer::mDataSource, mLabel, mLabelOn, QgsMapLayer::mLayerExtent, mProviderKey, QgsMapLayer::mValid, mWkbType, QgsMapLayer::name(), QgsDebugMsg, setDisplayField(), QgsMapLayer::setLayerName(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::toString(), updateExtents(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by QgsVectorLayer(), and readXml().
| void QgsVectorLayer::drawFeature | ( | QPainter * | p, | |
| QgsFeature & | fet, | |||
| const QgsMapToPixel * | cXf, | |||
| const QgsCoordinateTransform * | ct, | |||
| QImage * | marker, | |||
| double | widthScale, | |||
| double | markerScaleFactor, | |||
| bool | drawingToEditingCanvas | |||
| ) | [private] |
Draws features.
May cause projections exceptions to be generated (i.e., code that calls this function needs to catch them)
Definition at line 3298 of file qgsvectorlayer.cpp.
References QgsGeometry::asWkb(), drawLineString(), drawPolygon(), QgsFeature::geometry(), QgsClipper::MAX_X, QgsClipper::MAX_Y, QgsDebugMsg, transformPoint(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, QGis::WKBPolygon25D, QgsGeometry::wkbType(), and wkbType().
Referenced by draw().
| void QgsVectorLayer::transformPoint | ( | double & | x, | |
| double & | y, | |||
| const QgsMapToPixel * | mtp, | |||
| const QgsCoordinateTransform * | ct | |||
| ) | [inline, private] |
Convenience function to transform the given point.
Definition at line 3464 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, | |||
| const QgsMapToPixel * | mtp, | |||
| const QgsCoordinateTransform * | ct | |||
| ) | [inline, private] |
Definition at line 3481 of file qgsvectorlayer.cpp.
References QgsMapToPixel::transformInPlace(), and QgsCoordinateTransform::transformInPlace().
Referenced by drawLineString(), and drawPolygon().
| unsigned char * QgsVectorLayer::drawLineString | ( | unsigned char * | WKBlinestring, | |
| QPainter * | p, | |||
| const QgsMapToPixel * | mtp, | |||
| const QgsCoordinateTransform * | ct, | |||
| bool | drawingToEditingCanvas | |||
| ) | [private] |
Draw the linestring as given in the WKB format.
Returns a pointer to the byte after the end of the line string binary data stream (WKB).
Definition at line 338 of file qgsvectorlayer.cpp.
References currentVertexMarkerType(), drawVertexMarker(), QgsClipper::MAX_X, QgsClipper::MAX_Y, mEditable, mRenderer, QgsMapLayer::mTransparencyLevel, QgsDebugMsgLevel, transformPoints(), QgsClipper::trimFeature(), QgsRenderer::usesTransparency(), QGis::WKBLineString25D, and wkbType().
Referenced by drawFeature().
| unsigned char * QgsVectorLayer::drawPolygon | ( | unsigned char * | WKBpolygon, | |
| QPainter * | p, | |||
| const QgsMapToPixel * | mtp, | |||
| const QgsCoordinateTransform * | ct, | |||
| bool | drawingToEditingCanvas | |||
| ) | [private] |
Draw the polygon as given in the WKB format.
Returns a pointer to the byte after the end of the polygon binary data stream (WKB).
Definition at line 448 of file qgsvectorlayer.cpp.
References QgsClipper::MAX_X, QgsClipper::MAX_Y, QgsDebugMsg, transformPoints(), QgsClipper::trimFeature(), QGis::WKBPolygon25D, and wkbType().
Referenced by drawFeature().
| int QgsVectorLayer::findFreeId | ( | ) | [private] |
Goes through all features and finds a free id (e.g.
to give it temporarily to a not-commited feature)
| void QgsVectorLayer::deleteCachedGeometries | ( | ) | [private] |
Deletes the geometries in mCachedGeometries.
Definition at line 789 of file qgsvectorlayer.cpp.
References mCachedGeometries.
Referenced by commitChanges(), draw(), rollBack(), and ~QgsVectorLayer().
| void QgsVectorLayer::drawVertexMarker | ( | int | x, | |
| int | y, | |||
| QPainter & | p, | |||
| QgsVectorLayer::VertexMarkerType | type | |||
| ) | [private] |
Draws a vertex symbol at (screen) coordinates x, y.
(Useful to assist vertex editing.)
Definition at line 795 of file qgsvectorlayer.cpp.
References SemiTransparentCircle.
Referenced by drawLineString().
| 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.
| startPoint | start point of the snap | |
| geom | geometry to snap | |
| sqrSnappingTolerance | squared search tolerance of the snap | |
| snappingResult | list to which the result is appended | |
| snap_to | snap to vertex or to segment |
Definition at line 3169 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::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.
Definition at line 3249 of file qgsvectorlayer.cpp.
Referenced by addRing(), and splitFeatures().
| QgsVectorLayer::VertexMarkerType QgsVectorLayer::currentVertexMarkerType | ( | ) | [private] |
Reads vertex marker type from settings.
Definition at line 3284 of file qgsvectorlayer.cpp.
References Cross, and SemiTransparentCircle.
Referenced by drawLineString().
| void QgsVectorLayer::updateFeatureAttributes | ( | QgsFeature & | f | ) | [private] |
Update feature with uncommited attribute updates.
Definition at line 1155 of file qgsvectorlayer.cpp.
References QgsFeature::attributeMap(), QgsFeature::changeAttribute(), QgsFeature::deleteAttribute(), QgsFeature::id(), mChangedAttributeValues, mEditable, and mUpdatedFields.
Referenced by featureAtId(), nextFeature(), and selectedFeatures().
| void QgsVectorLayer::updateFeatureGeometry | ( | QgsFeature & | f | ) | [private] |
Update feature with uncommited geometry updates.
Definition at line 1180 of file qgsvectorlayer.cpp.
References QgsFeature::id(), mChangedGeometries, and QgsFeature::setGeometry().
Referenced by selectedFeatures().
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 557 of file qgsvectorlayer.h.
Referenced by draw().
Pointer to data provider derived from the abastract base class QgsDataProvider.
Definition at line 560 of file qgsvectorlayer.h.
Referenced by addAttribute(), addFeature(), addFeatures(), capabilitiesString(), commitChanges(), dataComment(), dataProvider(), deleteAttribute(), deleteSelectedFeatures(), deleteVertex(), featureAtId(), featureCount(), geometryType(), hasCompatibleSymbology(), insertVertex(), isEditable(), moveVertex(), nextFeature(), pendingAllAttributesList(), pendingFeatureCount(), pendingFields(), readXml(), select(), selectedFeatures(), setCoordinateSystem(), setDataProvider(), setProviderEncoding(), setSubsetString(), snapWithContext(), startEditing(), storageType(), subsetString(), updateExtents(), updateFeatureCount(), writeSymbology(), and ~QgsVectorLayer().
QString QgsVectorLayer::mDisplayField [private] |
index of the primary label field
Definition at line 563 of file qgsvectorlayer.h.
Referenced by displayField(), and setDisplayField().
QString QgsVectorLayer::mProviderKey [private] |
Data provider key.
Definition at line 566 of file qgsvectorlayer.h.
Referenced by providerType(), QgsVectorLayer(), readXml(), and setDataProvider().
QgsAttributeAction* QgsVectorLayer::mActions [private] |
The user-defined actions that are accessed from the Identify Results dialog box.
Definition at line 569 of file qgsvectorlayer.h.
Referenced by QgsVectorLayer(), readSymbology(), writeSymbology(), and ~QgsVectorLayer().
bool QgsVectorLayer::mEditable [private] |
Flag indicating whether the layer is in editing mode or not.
Definition at line 572 of file qgsvectorlayer.h.
Referenced by commitChanges(), deleteVertex(), draw(), drawLineString(), insertVertex(), isEditable(), moveVertex(), nextFeature(), rollBack(), select(), startEditing(), and updateFeatureAttributes().
bool QgsVectorLayer::mModified [private] |
Flag indicating whether the layer has been modified since the last commit.
Definition at line 575 of file qgsvectorlayer.h.
Referenced by isModified(), and setModified().
cache of the committed geometries retrieved *for the current display*
Definition at line 578 of file qgsvectorlayer.h.
Referenced by addIsland(), deleteCachedGeometries(), deleteVertex(), draw(), insertVertex(), moveVertex(), and translateFeature().
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 584 of file qgsvectorlayer.h.
Referenced by addFeatures(), addIsland(), boundingBoxOfSelected(), deleteFeature(), deleteSelectedFeatures(), deselect(), draw(), drawLabels(), invertSelection(), invertSelectionInRectangle(), removeSelection(), select(), selectedFeatureCount(), selectedFeatures(), selectedFeaturesIds(), and setSelectedFeatures().
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 590 of file qgsvectorlayer.h.
Referenced by commitChanges(), deleteFeature(), featureAtId(), pendingFeatureCount(), rollBack(), select(), and updateExtents().
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 595 of file qgsvectorlayer.h.
Referenced by addFeature(), addIsland(), changeAttributeValue(), commitChanges(), featureAtId(), nextFeature(), pendingFeatureCount(), rollBack(), select(), selectedFeatures(), translateFeature(), and updateExtents().
Changed attributes values which are not commited.
Definition at line 598 of file qgsvectorlayer.h.
Referenced by changeAttributeValue(), commitChanges(), rollBack(), and updateFeatureAttributes().
deleted attributes fields which are not commited
Definition at line 601 of file qgsvectorlayer.h.
Referenced by commitChanges(), deleteAttribute(), and rollBack().
added attributes fields which are not commited
Definition at line 604 of file qgsvectorlayer.h.
Referenced by addAttribute(), commitChanges(), rollBack(), and select().
Changed geometries which are not commited.
Definition at line 607 of file qgsvectorlayer.h.
Referenced by addIsland(), addRing(), commitChanges(), deleteVertex(), featureAtId(), insertVertex(), moveVertex(), nextFeature(), rollBack(), select(), splitFeatures(), translateFeature(), updateExtents(), and updateFeatureGeometry().
QgsFieldMap QgsVectorLayer::mUpdatedFields [private] |
field map to commit
Definition at line 610 of file qgsvectorlayer.h.
Referenced by addAttribute(), commitChanges(), deleteAttribute(), pendingAllAttributesList(), pendingFields(), rollBack(), select(), startEditing(), and updateFeatureAttributes().
int QgsVectorLayer::mMaxUpdatedIndex [private] |
max field index
Definition at line 613 of file qgsvectorlayer.h.
Referenced by addAttribute(), commitChanges(), rollBack(), and startEditing().
int QgsVectorLayer::mWkbType [private] |
Geometry type as defined in enum WkbType (qgis.h).
Definition at line 616 of file qgsvectorlayer.h.
Referenced by setDataProvider(), and wkbType().
QgsRenderer* QgsVectorLayer::mRenderer [private] |
Renderer object which holds the information about how to display the features.
Definition at line 619 of file qgsvectorlayer.h.
Referenced by copySymbologySettings(), draw(), drawLabels(), drawLineString(), readSymbology(), renderer(), setRenderer(), writeSymbology(), and ~QgsVectorLayer().
QgsLabel* QgsVectorLayer::mLabel [private] |
Label.
Definition at line 622 of file qgsvectorlayer.h.
Referenced by drawLabels(), label(), readSymbology(), setDataProvider(), and ~QgsVectorLayer().
bool QgsVectorLayer::mLabelOn [private] |
Display labels.
Definition at line 625 of file qgsvectorlayer.h.
Referenced by drawLabels(), enableLabels(), hasLabelsEnabled(), and setDataProvider().
QStringList QgsVectorLayer::mCommitErrors [private] |
QMap< QString, EditType > QgsVectorLayer::mEditTypes [private] |
Definition at line 629 of file qgsvectorlayer.h.
Referenced by editType(), readSymbology(), setEditType(), and writeSymbology().
QMap< QString, QMap<QString, QVariant> > QgsVectorLayer::mValueMaps [private] |
Definition at line 630 of file qgsvectorlayer.h.
Referenced by readSymbology(), valueMap(), and writeSymbology().
QMap< QString, RangeData > QgsVectorLayer::mRanges [private] |
Definition at line 631 of file qgsvectorlayer.h.
Referenced by range(), readSymbology(), and writeSymbology().
bool QgsVectorLayer::mFetching [private] |
QgsRectangle QgsVectorLayer::mFetchRect [private] |
bool QgsVectorLayer::mFetchGeometry [private] |
QSet<int> QgsVectorLayer::mFetchConsidered [private] |
QgsGeometryMap::iterator QgsVectorLayer::mFetchChangedGeomIt [private] |
QgsFeatureList::iterator QgsVectorLayer::mFetchAddedFeaturesIt [private] |
1.5.1