QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  QgsFeatureIds fids;
50  fids << featureRequest.filterFid();
51  featureIterator = QgsFeatureIterator( new QgsCachedFeatureIterator( C, featureRequest, fids ) );
52  return true;
53  }
54  }
55 
56  return false;
57 }
58