QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgscacheindexfeatureid.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgscacheindexfeatureid.cpp
3  --------------------------------------
4  Date : 13.2.2013
5  Copyright : (C) 2013 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgscacheindexfeatureid.h"
17 #include "qgsfeaturerequest.h"
19 #include "qgsvectorlayercache.h"
20 
23  , C( cachedVectorLayer )
24 {
25 
26 }
27 
29 {
30  Q_UNUSED( fid )
31 }
32 
34 {
35 }
36 
38 {
39  Q_UNUSED( featureRequest )
40  Q_UNUSED( fids )
41 }
42 
43 bool QgsCacheIndexFeatureId::getCacheIterator( QgsFeatureIterator &featureIterator, const QgsFeatureRequest &featureRequest )
44 {
45  if ( featureRequest.filterType() == QgsFeatureRequest::FilterFid )
46  {
47  if ( C->isFidCached( featureRequest.filterFid() ) )
48  {
49  featureIterator = QgsFeatureIterator( new QgsCachedFeatureIterator( C, featureRequest ) );
50  return true;
51  }
52  }
53 
54  return false;
55 }
56 
Wrapper for iterator of features from vector data provider or vector layer.
Filter using feature ID.
virtual void flushFeature(const QgsFeatureId fid) override
Is called, whenever a feature is removed from the cache.
bool isFidCached(const QgsFeatureId fid)
Check if a certain feature id is cached.
QgsCacheIndexFeatureId(QgsVectorLayerCache *)
virtual void requestCompleted(QgsFeatureRequest featureRequest, QgsFeatureIds fids) override
Implement this method to update the the indices, in case you need information contained by the reques...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
FilterType filterType() const
This class caches features of a given QgsVectorLayer.
const QgsFeatureId & filterFid() const
Abstract base class for cache indices.
Definition: qgscacheindex.h:29
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Delivers features from the cache.
virtual void flush() override
Sometimes, the whole cache changes its state and its easier to just withdraw everything.
virtual bool getCacheIterator(QgsFeatureIterator &featureIterator, const QgsFeatureRequest &featureRequest) override
Is called, when a feature request is issued on a cached layer.