Commit 6ebaafcbc6b67d77fb3caf4865b976e887e102ab
1 parent
8454014c
removed reject distance
Showing
1 changed file
with
0 additions
and
54 deletions
openbr/plugins/distance/reject.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 Sets Distance to -FLOAT_MAX if a target Template has/doesn't have a key. | |
| 25 | - * \author Scott Klum \cite sklum | |
| 26 | - */ | |
| 27 | -class RejectDistance : public UntrainableDistance | |
| 28 | -{ | |
| 29 | - Q_OBJECT | |
| 30 | - | |
| 31 | - Q_PROPERTY(QStringList keys READ get_keys WRITE set_keys RESET reset_keys STORED false) | |
| 32 | - BR_PROPERTY(QStringList, keys, QStringList()) | |
| 33 | - Q_PROPERTY(bool rejectIfContains READ get_rejectIfContains WRITE set_rejectIfContains RESET reset_rejectIfContains STORED false) | |
| 34 | - BR_PROPERTY(bool, rejectIfContains, false) | |
| 35 | - | |
| 36 | - float compare(const Template &a, const Template &b) const | |
| 37 | - { | |
| 38 | - // We don't look at the query | |
| 39 | - (void) b; | |
| 40 | - | |
| 41 | - foreach (const QString &key, keys) | |
| 42 | - if ((rejectIfContains && a.file.contains(key)) || (!rejectIfContains && !a.file.contains(key))) | |
| 43 | - return -std::numeric_limits<float>::max(); | |
| 44 | - | |
| 45 | - return 0; | |
| 46 | - } | |
| 47 | -}; | |
| 48 | - | |
| 49 | - | |
| 50 | -BR_REGISTER(Distance, RejectDistance) | |
| 51 | - | |
| 52 | -} // namespace br | |
| 53 | - | |
| 54 | -#include "distance/reject.moc" |