QGIS API Documentation
2.0.1-Dufour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
qgsfeaturerequest.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfeaturerequest.cpp
3
---------------------
4
begin : Mai 2012
5
copyright : (C) 2012 by Martin Dobias
6
email : wonder dot sk at gmail dot com
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
#include "
qgsfeaturerequest.h
"
16
17
#include "
qgsfield.h
"
18
19
#include <QStringList>
20
21
QgsFeatureRequest::QgsFeatureRequest
()
22
: mFilter( FilterNone )
23
, mFlags( 0 )
24
{
25
}
26
27
QgsFeatureRequest::QgsFeatureRequest
(
QgsFeatureId
fid )
28
: mFilter( FilterFid )
29
, mFilterFid( fid )
30
, mFlags( 0 )
31
{
32
}
33
34
QgsFeatureRequest::QgsFeatureRequest
(
const
QgsRectangle
& rect )
35
: mFilter( FilterRect )
36
, mFilterRect( rect )
37
, mFlags( 0 )
38
{
39
}
40
41
QgsFeatureRequest::QgsFeatureRequest
(
const
QgsFeatureRequest
&rh )
42
{
43
mFlags
= rh.
mFlags
;
44
mFilter
= rh.
mFilter
;
45
mFilterRect
= rh.
mFilterRect
;
46
mFilterFid
= rh.
mFilterFid
;
47
mAttrs
= rh.
mAttrs
;
48
}
49
50
51
QgsFeatureRequest
&
QgsFeatureRequest::setFilterRect
(
const
QgsRectangle
& rect )
52
{
53
mFilter
=
FilterRect
;
54
mFilterRect
= rect;
55
return
*
this
;
56
}
57
58
QgsFeatureRequest
&
QgsFeatureRequest::setFilterFid
(
QgsFeatureId
fid )
59
{
60
mFilter
=
FilterFid
;
61
mFilterFid
= fid;
62
return
*
this
;
63
}
64
65
QgsFeatureRequest
&
QgsFeatureRequest::setFlags
( QgsFeatureRequest::Flags flags )
66
{
67
mFlags
=
flags
;
68
return
*
this
;
69
}
70
71
QgsFeatureRequest
&
QgsFeatureRequest::setSubsetOfAttributes
(
const
QgsAttributeList
& attrs )
72
{
73
mFlags
|=
SubsetOfAttributes
;
74
mAttrs
= attrs;
75
return
*
this
;
76
}
77
78
79
QgsFeatureRequest
&
QgsFeatureRequest::setSubsetOfAttributes
(
const
QStringList& attrNames,
const
QgsFields
& fields )
80
{
81
mFlags
|=
SubsetOfAttributes
;
82
mAttrs
.clear();
83
84
for
(
int
idx = 0; idx < fields.
count
(); ++idx )
85
{
86
if
( attrNames.contains( fields[idx].name() ) )
87
mAttrs
.append( idx );
88
}
89
90
return
*
this
;
91
}
Generated on Tue Sep 24 2013 14:41:46 for QGIS API Documentation by
1.8.1.2