QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:317
virtual void requestCompleted(QgsFeatureRequest featureRequest, QgsFeatureIds fids)
Implement this method to update the the indices, in case you need information contained by the reques...
bool isFidCached(const QgsFeatureId fid)
Check if a certain feature id is cached.
QgsCacheIndexFeatureId(QgsVectorLayerCache *)
virtual void flushFeature(const QgsFeatureId fid)
Is called, whenever a feature is removed from the cache.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
FilterType filterType() const
virtual void flush()
Sometimes, the whole cache changes its state and its easier to just withdraw everything.
This class caches features of a given QgsVectorLayer.
const QgsFeatureId & filterFid() const
Abstract base class for cache indices.
Definition: qgscacheindex.h:29
virtual bool getCacheIterator(QgsFeatureIterator &featureIterator, const QgsFeatureRequest &featureRequest)
Is called, when a feature request is issued on a cached layer.
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Delivers features from the cache.