[Fwd: Re: [Qgis-developer] Better getNextFeature in vector providers]

Mateusz Łoskot mateusz at loskot.net
Sat Mar 18 07:11:37 EST 2006


Hi,
I'm forwarding my last post from today in this thread to the new list.
Mateusz
Cheers


-------- Original Message --------
Subject: Re: [Qgis-developer] Better getNextFeature in vector providers
Date: Sat, 18 Mar 2006 12:56:38 +0100
From: Mateusz Łoskot <mateusz at loskot.net>
To: qgis-developer at lists.sourceforge.net

Martin Dobias wrote:
> On 3/17/06, Mateusz Łoskot <mateusz at loskot.net> wrote:
> 
>>Possible option is:
>>
>>bool getNextFeature(QgsFeature& feature, bool getGeometry = true, bool
>>getAttributes = false);
>>
>>I mean, I'm a bit affraid of loosing control on how is QgsFeature coming
>>to getNextFeature call. What has* attributes it has set false/true, etc.
>>It's easier to keep control when using explicit function parameters.
> 
> 
> My intent was to get better readibility, as explained in reply to
> Radim. I think that adding and calling something like
> QgsFeature::clear() at start of getNextFeature could prepare that
> feature without having any problems. Or did you mean something other?
> 
> From my point of view I don't mind calling it as you and Radim
> proposed, this was just a new idea how it can be done.


My proposal is also another idea to discuss.
But I have to confess that I've not thought mych about this subject ;-)


>>>>Now, we can build attributes map (field index -> attribute)
>>>>
>>>>typedef std::map<int, FeatureAttribute> AttributesMap;
>>>>AttributesMap attributes_;
>>>
>>>
>>>Yes, however I think that std::vector will suffice. Or not?
>>
>>
>>Hmm, it depends, but I'd keep it as std::map.
>>I assume that:
>>1) I'd like to be able to store in AttributesMap *only* selected
>>attributes, but not all
>>2) AttributesMap is a kind of attributes index
>>3) AttributesMap is mainly queried for attributes by-field-index
>>
>>std::map is a tree structure. Indexes are usually a trees [2].
> 
> 
> (This is new to me. I always thought that maps are hash tables.)


std::map is (usually) a kind of balance tree:
http://www.ddj.com/documents/s=921/ddj9804e/


Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qgis-developer

-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Qgis-developer mailing list