Commit f72a4fb41e5d7db3623fd991ae58bb2595b17058

Authored by Josh Klontz
1 parent e1581134

removed filter distance

openbr/plugins/distance/filter.cpp deleted
1   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2   - * Copyright 2012 The MITRE Corporation *
3   - * *
4   - * Licensed under the Apache License, Version 2.0 (the "License"); *
5   - * you may not use this file except in compliance with the License. *
6   - * You may obtain a copy of the License at *
7   - * *
8   - * http://www.apache.org/licenses/LICENSE-2.0 *
9   - * *
10   - * Unless required by applicable law or agreed to in writing, software *
11   - * distributed under the License is distributed on an "AS IS" BASIS, *
12   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13   - * See the License for the specific language governing permissions and *
14   - * limitations under the License. *
15   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16   -
17   -#include <openbr/plugins/openbr_internal.h>
18   -
19   -namespace br
20   -{
21   -
22   -/*!
23   - * \ingroup distances
24   - * \brief Checks target metadata against filters.
25   - * \author Josh Klontz \cite jklontz
26   - */
27   -class FilterDistance : public UntrainableDistance
28   -{
29   - Q_OBJECT
30   -
31   - float compare(const Template &a, const Template &b) const
32   - {
33   - (void) b; // Query template isn't checked
34   - foreach (const QString &key, Globals->filters.keys()) {
35   - bool keep = false;
36   - const QString metadata = a.file.get<QString>(key, "");
37   - if (Globals->filters[key].isEmpty()) continue;
38   - if (metadata.isEmpty()) return -std::numeric_limits<float>::max();
39   - foreach (const QString &value, Globals->filters[key]) {
40   - if (metadata == value) {
41   - keep = true;
42   - break;
43   - }
44   - }
45   - if (!keep) return -std::numeric_limits<float>::max();
46   - }
47   - return 0;
48   - }
49   -};
50   -
51   -BR_REGISTER(Distance, FilterDistance)
52   -
53   -} // namespace br
54   -
55   -#include "distance/filter.moc"