USGS

Isis 3.0 Object Programmers' Reference

Home

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