Ticket #2773 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

filter evaluate method should accept a feature

Reported by: tschaub Owned by:
Priority: minor Milestone: 2.10 Release
Component: Filter Version: 2.9
Keywords: Cc:
State: Complete

Description

Currently, the evaluate method on filters is inconsistent. Comparison filters expect feature attributes (or any other object). Spatial filters expect a feature (as do fid filters). This makes it so logical filters don't work (you can't evaluate a logical filter that contains a spatial filter and a comparison filter).

The evaluate method should accept features.

Attachments

2773.patch Download (13.3 KB) - added by tschaub 3 years ago.
evaluate features

Change History

Changed 3 years ago by tschaub

evaluate features

Changed 3 years ago by tschaub

  • state set to Review

By making comparison filters accept a feature in the evaluate method, we get consistency. Logical filters pass on whatever they get. Comparison filters accept either a feature or a context object for backwards compatibility. Logical filters can now be used with comparison and spatial filters.

Tests pass. Thanks for any review.

Changed 3 years ago by ahocevar

  • state changed from Review to Commit

Good catch. I have no idea how this could remain undiscovered for such a long time. Thanks for the extended test coverage and code optimizations that accompany this patch. Great work - please commit.

Changed 3 years ago by tschaub

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10596]) Making consistent the evaluate method of filters. The evaluate method accepts vector features, making possible logical filters that combine spatial and comparison filters. r=ahocevar (closes #2773)

Note: See TracTickets for help on using tickets.