From ab191399edb40dcc03b2f9a57a9f458b2e1bcabe Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 31 Aug 2021 14:36:32 -0600 Subject: [PATCH] removed metadata distance --- openbr/plugins/distance/metadata.cpp | 76 ---------------------------------------------------------------------------- 1 file changed, 0 insertions(+), 76 deletions(-) delete mode 100644 openbr/plugins/distance/metadata.cpp diff --git a/openbr/plugins/distance/metadata.cpp b/openbr/plugins/distance/metadata.cpp deleted file mode 100644 index 11660f7..0000000 --- a/openbr/plugins/distance/metadata.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright 2012 The MITRE Corporation * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -namespace br -{ - -/*! - * \ingroup distances - * \brief Checks target metadata against query metadata. - * \author Scott Klum \cite sklum - */ -class MetadataDistance : public UntrainableDistance -{ - Q_OBJECT - - Q_PROPERTY(QStringList filters READ get_filters WRITE set_filters RESET reset_filters STORED false) - BR_PROPERTY(QStringList, filters, QStringList()) - - float compare(const Template &a, const Template &b) const - { - foreach (const QString &key, filters) { - QString aValue = a.file.get(key, QString()); - QString bValue = b.file.get(key, QString()); - - // The query value may be a range. Let's check. - if (bValue.isEmpty()) bValue = QtUtils::toString(b.file.get(key, QPointF())); - - if (aValue.isEmpty() || bValue.isEmpty()) continue; - - bool keep = false; - bool ok; - - QPointF range = QtUtils::toPoint(bValue,&ok); - - if (ok) /* Range */ { - int value = range.x(); - int upperBound = range.y(); - - while (value <= upperBound) { - if (aValue == QString::number(value)) { - keep = true; - break; - } - value++; - } - } - else if (aValue == bValue) keep = true; - - if (!keep) return -std::numeric_limits::max(); - } - return 0; - } -}; - - -BR_REGISTER(Distance, MetadataDistance) - -} // namespace br - -#include "distance/metadata.moc" -- libgit2 0.21.4