Isis 3 Programmer Reference
PointTypeFilter.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "PointTypeFilter.h"
10
11#include <QPair>
12#include <QString>
13#include <QStringList>
14
15#include "ControlMeasure.h"
16#include "ControlNet.h"
17#include "ControlPoint.h"
18#include "IString.h"
19
20
21namespace Isis {
22 PointTypeFilter::PointTypeFilter(
23 AbstractFilter::FilterEffectivenessFlag flag,
24 int minimumForSuccess) : AbstractMultipleChoiceFilter(flag, minimumForSuccess) {
25 QStringList options;
26 options << "Fixed" << "Constrained" << "Free";
27 createWidget(options);
28 }
29
30
31 PointTypeFilter::PointTypeFilter(const PointTypeFilter &other)
32 : AbstractMultipleChoiceFilter(other) {
33 }
34
35
36 PointTypeFilter::~PointTypeFilter() {
37 }
38
39
40 bool PointTypeFilter::evaluate(const QPair<QString, ControlNet *> *imageAndNet) const {
41 return evaluateImageFromPointFilter(imageAndNet);
42 }
43
44
45 bool PointTypeFilter::evaluate(const ControlPoint *point) const {
46 return ((QString) point->GetPointTypeString() == getCurrentChoice()) ^
47 !inclusive();
48 }
49
50
51 bool PointTypeFilter::evaluate(const ControlMeasure *) const {
52 return true;
53 }
54
55
56 AbstractFilter *PointTypeFilter::clone() const {
57 return new PointTypeFilter(*this);
58 }
59
60
61 QString PointTypeFilter::getImageDescription() const {
62 QString description = AbstractFilter::getImageDescription() + "point";
63
64 if (getMinForSuccess() != 1) {
65 description += "s ";
66 }
67 else {
68 description += " ";
69 }
70
71 description += "that ";
72
73 if (getMinForSuccess() == 1) {
74 description += "is ";
75 }
76 else {
77 description += "are ";
78 }
79
80 if (!inclusive()) {
81 description += "not ";
82 }
83
84 description += " of type " + getCurrentChoice();
85
86 return description;
87 }
88
89
90 QString PointTypeFilter::getPointDescription() const {
91 QString description = "are ";
92
93 if (!inclusive()) {
94 description += "not ";
95 }
96
97 description += "of type " + getCurrentChoice();
98
99 return description;
100 }
101}
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16