Isis 3 Programmer Reference
QnetPointGoodnessFilter.cpp
1#include "QnetPointGoodnessFilter.h"
2
3#include <QCheckBox>
4#include <QGridLayout>
5#include <QLabel>
6#include <QLineEdit>
7#include <QMessageBox>
8
9#include "QnetNavTool.h"
10
11#include "ControlMeasure.h"
12#include "ControlMeasureLogData.h"
13#include "ControlNet.h"
14#include "ControlPoint.h"
15#include "SerialNumberList.h"
16#include "SpecialPixel.h"
17
18using namespace std;
19
20namespace Isis {
35 QWidget *parent) : QnetFilter(navTool, parent) {
36 m_lessThanCB = NULL;
37 m_greaterThanCB = NULL;
38 m_maxValueEdit = NULL;
39 m_minValueEdit = NULL;
40
41 // Create the components for the filter window
42 m_lessThanCB = new QCheckBox("Less than ");
43 m_maxValueEdit = new QLineEdit();
44 m_greaterThanCB = new QCheckBox("Greater than ");
45 m_minValueEdit = new QLineEdit();
46 QLabel *pad = new QLabel;
47
48 m_lessThanCB->setChecked(false);
49 m_maxValueEdit->setEnabled(false);
50 m_greaterThanCB->setChecked(false);
51 m_minValueEdit->setEnabled(false);
52
53 connect(m_lessThanCB,SIGNAL(clicked()),this,SLOT(clearEdit()));
54 connect(m_greaterThanCB,SIGNAL(clicked()),this,SLOT(clearEdit()));
55
56 // Create the layout and add the components to it
57 QGridLayout *gridLayout = new QGridLayout();
58 //gridLayout->addWidget(label,0,0,1,2);
59 gridLayout->addWidget(m_lessThanCB,1,0,1,2);
60 gridLayout->addWidget(m_maxValueEdit,2,0);
61 gridLayout->addWidget(m_greaterThanCB,3,0,1,2);
62 gridLayout->addWidget(m_minValueEdit,4,0);
63 gridLayout->addWidget(pad,5,0);
64 gridLayout->setRowStretch(5,50);
65 this->setLayout(gridLayout);
66 }
67
83 // Make sure there is a control net loaded
84 if (controlNet() == NULL) {
85 QMessageBox::information((QWidget *)parent(),
86 "Error","No points to filter");
87 return;
88 }
89
90 // Make sure the user entered a value to use in the filtering
91 if (m_lessThanCB->isChecked() && m_maxValueEdit->text() == "") {
92 QMessageBox::information((QWidget *)parent(),
93 "Error","Maximum Goodness of Fit value must be entered");
94 return;
95 }
96 if (m_greaterThanCB->isChecked() && m_minValueEdit->text() == "") {
97 QMessageBox::information((QWidget *)parent(),
98 "Error","Minimum Goodness of Fit value must be entered");
99 return;
100 }
101
102 // Get the user entered filtering value
103 double maxValue = m_maxValueEdit->text().toDouble();
104 double minValue = m_minValueEdit->text().toDouble();
105
106 // Loop through each value of the filtered points list
107 // Loop in reverse order since removal list of elements affects index number
108 for (int i = filteredPoints().size()-1; i >= 0; i--) {
109 ControlPoint &cp = *(*controlNet())[filteredPoints()[i]];
110 int numMeasOutsideRange = 0;
111 // Loop through each measure of the point at this index of the control net
112 for (int j = 0; j < cp.GetNumMeasures(); j++) {
113
114 double goodnessOfFit = cp[j]->GetLogData(
115 ControlMeasureLogData::GoodnessOfFit).GetNumericalValue();
116 if (goodnessOfFit == Null) {
117 numMeasOutsideRange++;
118 }
119 else if (m_lessThanCB->isChecked() && m_greaterThanCB->isChecked()) {
120 if (goodnessOfFit < maxValue && goodnessOfFit > minValue) break;
121 else numMeasOutsideRange++;
122 }
123 else if (m_lessThanCB->isChecked()) {
124 if (goodnessOfFit < maxValue) break;
125 else numMeasOutsideRange++;
126 }
127 else if (m_greaterThanCB->isChecked()) {
128 if (goodnessOfFit > minValue) break;
129 else numMeasOutsideRange++;
130 }
131 }
132 // if no measures are within the range, remove from filter list
133 if (cp.GetNumMeasures() == numMeasOutsideRange) {
134 filteredPoints().removeAt(i);
135 }
136 }
137
138 // Tell the navtool that a list has been filtered and it needs to update
139 emit filteredListModified();
140 return;
141 }
154
155 if (m_lessThanCB->isChecked()) {
156 m_maxValueEdit->setEnabled(true);
157 }
158 else {
159 m_maxValueEdit->clear();
160 m_maxValueEdit->setEnabled(false);
161 }
162 if (m_greaterThanCB->isChecked()) {
163 m_minValueEdit->setEnabled(true);
164 }
165 else {
166 m_minValueEdit->clear();
167 m_minValueEdit->setEnabled(false);
168 }
169 }
170}
@ GoodnessOfFit
GoodnessOfFit is pointreg information for reference measures.
A single control point.
Qnet Navigation Tool.
void clearEdit()
Clears and disables the corresponding line edit if the "less than" or "greater than" checkBox is "un...
QnetPointGoodnessFilter(QnetNavTool *navTool, QWidget *parent=0)
Contructor for the Point Goodness of Fit filter.
virtual void filter()
Method overwrites parent method.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
const double Null
Value for an Isis Null pixel.
Namespace for the standard library.