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