Commit f67af1ff4232c5e5a261e58e4080bdaf1e6b9589
1 parent
4a58b240
remove reorderpoints
Showing
1 changed file
with
0 additions
and
57 deletions
openbr/plugins/metadata/reorderpoints.cpp deleted
| 1 | -#include <openbr/plugins/openbr_internal.h> | ||
| 2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
| 3 | - * Copyright 2012 The MITRE Corporation * | ||
| 4 | - * * | ||
| 5 | - * Licensed under the Apache License, Version 2.0 (the "License"); * | ||
| 6 | - * you may not use this file except in compliance with the License. * | ||
| 7 | - * You may obtain a copy of the License at * | ||
| 8 | - * * | ||
| 9 | - * http://www.apache.org/licenses/LICENSE-2.0 * | ||
| 10 | - * * | ||
| 11 | - * Unless required by applicable law or agreed to in writing, software * | ||
| 12 | - * distributed under the License is distributed on an "AS IS" BASIS, * | ||
| 13 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
| 14 | - * See the License for the specific language governing permissions and * | ||
| 15 | - * limitations under the License. * | ||
| 16 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
| 17 | - | ||
| 18 | -#include <openbr/core/common.h> | ||
| 19 | - | ||
| 20 | -namespace br | ||
| 21 | -{ | ||
| 22 | - | ||
| 23 | -/*! | ||
| 24 | - * \ingroup transforms | ||
| 25 | - * \brief Reorder the points such that points[from[i]] becomes points[to[i]] and | ||
| 26 | - * vice versa | ||
| 27 | - * \author Scott Klum \cite sklum | ||
| 28 | - */ | ||
| 29 | -class ReorderPointsTransform : public UntrainableMetadataTransform | ||
| 30 | -{ | ||
| 31 | - Q_OBJECT | ||
| 32 | - | ||
| 33 | - Q_PROPERTY(QList<int> from READ get_from WRITE set_from RESET reset_from STORED false) | ||
| 34 | - Q_PROPERTY(QList<int> to READ get_to WRITE set_to RESET reset_to STORED false) | ||
| 35 | - BR_PROPERTY(QList<int>, from, QList<int>()) | ||
| 36 | - BR_PROPERTY(QList<int>, to, QList<int>()) | ||
| 37 | - | ||
| 38 | - void projectMetadata(const File &src, File &dst) const | ||
| 39 | - { | ||
| 40 | - if (from.size() == to.size()) { | ||
| 41 | - QList<QPointF> points = src.points(); | ||
| 42 | - int size = src.points().size(); | ||
| 43 | - if (!points.contains(QPointF(-1,-1)) && Common::Max(from) < size && Common::Max(to) < size) { | ||
| 44 | - for (int i=0; i<from.size(); i++) { | ||
| 45 | - std::swap(points[from[i]],points[to[i]]); | ||
| 46 | - } | ||
| 47 | - dst.setPoints(points); | ||
| 48 | - } | ||
| 49 | - } else qFatal("Inconsistent sizes for to and from index lists."); | ||
| 50 | - } | ||
| 51 | -}; | ||
| 52 | - | ||
| 53 | -BR_REGISTER(Transform, ReorderPointsTransform) | ||
| 54 | - | ||
| 55 | -} // namespace br | ||
| 56 | - | ||
| 57 | -#include "metadata/reorderpoints.moc" |