The gdalheaders API uses the
following (pseudo-code) schemes for feature access.
The different feature loops, see https://github.com/dis-organization/dirigible/issues/5
ALL
Get all the feature thingys.
double nFeature = gdalheaders::force_layer_feature_count(poLayer);
List/Vector out (nFeature);
double ii = 0;
while( (poFeature = poLayer->GetNextFeature()) != NULL ) {
out[ii] = poFeature-><something>;
OGRFeature::DestroyFeature(poFeature);
ii++;
}
IJ
Get a subset of feature thingys i:j - their positional index.
For c(0, 0)
get the first feature, for
c(0, n - 1)
get all of them. For c(0, -1)
that
is a special case, there are no features.
ListVector out(ij[1] - ij[0] + 1);
double cnt = 0;
double ii = 0;
while( (poFeature = poLayer->GetNextFeature()) != NULL ) {
if (ii == ij[0] || (ii > ij[0] && ii <= ij[1])) {
out[cnt] = poFeature-><something>;
cnt++;
}
ii++;
OGRFeature::DestroyFeature(poFeature);
}
IA
Get a subset of feature things, arbitrary i (in order) -
their positional index
ListVector out(ia.length());
double ii = 0;
double cnt = 0;
while( (poFeature = poLayer->GetNextFeature()) != NULL ) {
if (ii == ia[cnt]) {
out[cnt] = poFeature-><something>;
cnt++;
}
ii++;
OGRFeature::DestroyFeature(poFeature);
}
FA
Get a subset of feature thingys arbitrary FID (order
irrelevant) - their FID unique names
List out(fa.length());
for (double ii = 0; ii < fa.length(); ii++) {
GIntBig feature_id = (GIntBig)fa[ii];
poFeature = poLayer->GetFeature(feature_id);