[Qgis-developer] [Python] QgsFeatureIterator for geometryless PostgreSQL-Layer
Jürgen E. Fischer
jef at norbit.de
Fri Apr 12 01:33:16 PDT 2013
Hi Martin,
On Fri, 12. Apr 2013 at 09:51:15 +0200, Martin Dobias wrote:
> On Fri, Apr 12, 2013 at 9:25 AM, Jürgen E. <jef at norbit.de> wrote:
> > Hi Martin,
> >
> > On Thu, 11. Apr 2013 at 22:30:57 +0200, Martin Dobias wrote:
> >> I have a feeling that we should call that a bug: the NoGeometry flag
> >> tells that it is not necessary to fetch geometry... so even if the
> >> flag is not set, the feature should be fetched.
> >
> > Ok, then it's also misleading. Should we rename NoGeometry to WithoutGeometry
> > while we still can?
>
> Yes, we could do that. Or maybe IgnoreGeometry?
>
> Recently I have been wondering whether it would not be better to
> actually stop using flags and replace them by usual getter/setter
> functions. My main concern is the setSubsetOfAttributes() function: it
> also sets the flag, so the users may end up with a weird behavior,
> e.g.:
> QgsFeatureRequest().setSubsetOfAttributes( ["name","type"], fields
> ).setFlags( NoGeometry )
> That would fetch all attributes... because the setFlags overrides the
> previously set SubsetOfAttributes flag.
Yes, I've also thought about that, but somehow missed to speak up - but IIRC
(;)) I migrated everything accordingly.
Given that the flags need qualification it's even shorter to use the
getter/setters API-wise.
> Also, the way how things are done right now, providers need to
> implement fetching of attributes in this way (pseudo-code):
> if using subset of attributes:
> for each attribute from subset:
> fetch attribute
> else:
> for each attribute from provider:
> fetch attribute
> This is quite annoying, we should probably have a simple array where
> each value would indicate whether to fetch attribute with that index
> or not (by default all values would be true). The fetching would be
> simplified to:
> for each attribute from provider:
> if attribute should be fetched:
> fetch attribute
> What do you think? :-)
Don't they just all do:
subsetOfAttributes ? mRequest.subsetOfAttributes() : P->attributeIndexes()
Can't we move that to a requestedAttributes() in QgsAbstractFeatureIterator and
just iterate over the result?
BTW what about parallel iterators? I suppose there were problems and thats why
you added the "active iterators" - do you recall which providers were affected
and how?
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
committ(ed|ing) to Quantum GIS IRC: jef on FreeNode
--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
More information about the Qgis-developer
mailing list