QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscachedfeatureiterator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscachedfeatureiterator.h
3  --------------------------------------
4  Date : 12.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 #ifndef QGSCACHEDFEATUREITERATOR_H
17 #define QGSCACHEDFEATUREITERATOR_H
18 
19 #include "qgsfeature.h"
20 #include "qgsfeatureiterator.h"
21 
23 
30 {
31  public:
43  QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest, QgsFeatureIds featureIds );
44 
52 
58  virtual bool rewind() override;
59 
65  virtual bool close() override;
66 
67  // QgsAbstractFeatureIterator interface
68  protected:
77  virtual bool fetchFeature( QgsFeature& f ) override;
78 
85  virtual bool nextFeatureFilterFids( QgsFeature& f ) override { return fetchFeature( f ); }
86 
87  private:
88  QgsFeatureIds mFeatureIds;
89  QgsVectorLayerCache* mVectorLayerCache;
90  QgsFeatureIds::ConstIterator mFeatureIdIterator;
91 };
92 
99 {
100  public:
108 
114  virtual bool rewind() override;
115 
121  virtual bool close() override;
122 
123  protected:
124 
133  virtual bool fetchFeature( QgsFeature& f ) override;
134 
135  private:
136  QgsFeatureIterator mFeatIt;
137  QgsVectorLayerCache* mVectorLayerCache;
138  QgsFeatureIds mFids;
139 };
140 #endif // QGSCACHEDFEATUREITERATOR_H