Isis 3 Programmer Reference
QnetPointJigsawErrorFilter.cpp
1#include "QnetPointJigsawErrorFilter.h"
2
3#include <QCheckBox>
4#include <QGridLayout>
5#include <QLabel>
6#include <QLineEdit>
7#include <QMessageBox>
8
9#include "ControlNet.h"
10#include "ControlMeasure.h"
11#include "ControlPoint.h"
12#include "QnetNavTool.h"
13#include "SerialNumberList.h"
14#include "Statistics.h"
15
16namespace Isis {
35 QWidget *parent) : QnetFilter(navTool, parent) {
36 m_lessThanCB = NULL;
37 m_greaterThanCB = NULL;
38 m_lessErrorEdit = NULL;
39 m_greaterErrorEdit = NULL;
40
41 // Create the components for the filter window
42 QLabel *label = new QLabel("Filter bundle-adjustment error");
43 m_lessThanCB = new QCheckBox("Less than (undercontrolled)");
44 m_lessErrorEdit = new QLineEdit();
45 m_greaterThanCB = new QCheckBox("Greater than (overcontrolled)");
46 m_greaterErrorEdit = new QLineEdit();
47 QLabel *pixels = new QLabel("pixels");
48 QLabel *pad = new QLabel();
49
50 m_lessThanCB->setChecked(false);
51 m_lessErrorEdit->setEnabled(false);
52 m_greaterThanCB->setChecked(true);
53 m_greaterErrorEdit->setEnabled(true);
54
55 connect(m_lessThanCB, SIGNAL(clicked()), this, SLOT(clearEdit()));
56 connect(m_greaterThanCB, SIGNAL(clicked()), this, SLOT(clearEdit()));
57
58 // Create the layout and add the components to it
59 QGridLayout *gridLayout = new QGridLayout();
60 gridLayout->addWidget(label, 0, 0, 1, 2);
61 gridLayout->addWidget(m_lessThanCB, 1, 0, 1, 2);
62 gridLayout->addWidget(m_lessErrorEdit, 2, 0);
63 gridLayout->addWidget(pixels, 2, 1);
64 gridLayout->addWidget(m_greaterThanCB, 3, 0, 1, 2);
65 gridLayout->addWidget(m_greaterErrorEdit, 4, 0);
66 gridLayout->addWidget(pixels, 4, 1);
67 gridLayout->addWidget(pad, 5, 0);
68 gridLayout->setRowStretch(5, 50);
69 this->setLayout(gridLayout);
70 }
71
93 // Make sure we have a list of control points to filter
94 if (controlNet() == NULL) {
95 QMessageBox::information((QWidget *)parent(),
96 "Error", "No points to filter");
97 return;
98 }
99
100 // Make sure the user entered a value to use in the filtering
101 double lessNum = -1.;
102 if (m_lessThanCB->isChecked() && m_lessErrorEdit->text() == "") {
103 QMessageBox::information((QWidget *)parent(),
104 "Error", "Error value must be entered");
105 return;
106 }
107 double greaterNum = -1.;
108 if (m_greaterThanCB->isChecked() && m_greaterErrorEdit->text() == "") {
109 QMessageBox::information((QWidget *)parent(),
110 "Error", "Error value must be entered");
111 return;
112 }
113
114 // Get the user entered filtering value
115 lessNum = m_lessErrorEdit->text().toDouble();
116 greaterNum = m_greaterErrorEdit->text().toDouble();
117
118 QMultiMap <double, int> pointMap;
119 // Loop through each value of the filtered points list comparing the error of its
120 // corresponding point with error with the user entered value and remove it from
121 // the filtered list if it is outside the filtering range
122 // Loop in reverse order since removal list of elements affects index number
123 for (int i = filteredPoints().size() - 1; i >= 0; i--) {
124 ControlPoint &cp = *(*controlNet())[filteredPoints()[i]];
126 if (m_lessThanCB->isChecked() && m_greaterThanCB->isChecked()) {
127 if (maxResidual < lessNum && maxResidual > greaterNum) {
128 pointMap.insert(maxResidual, filteredPoints()[i]);
129 continue;
130 }
131 else
132 filteredPoints().removeAt(i);
133 }
134 else if (m_lessThanCB->isChecked()) {
135 if (maxResidual < lessNum) {
136 pointMap.insert(maxResidual, filteredPoints()[i]);
137 continue;
138 }
139 else
140 filteredPoints().removeAt(i);
141 }
142 else if (m_greaterThanCB->isChecked()) {
143 if (maxResidual > greaterNum) {
144 pointMap.insert(maxResidual, filteredPoints()[i]);
145 continue;
146 }
147 else
148 filteredPoints().removeAt(i);
149 }
150 }
151
152 int filteredIndex = 0;
153 QMultiMap<double, int>::const_iterator i = pointMap.constEnd();
154 while (i != pointMap.constBegin()) {
155 --i;
156 filteredPoints()[filteredIndex] = i.value();
157 filteredIndex++;
158 }
159 // Tell the navtool that a list has been filtered and it needs to update
160 emit filteredListModified();
161 return;
162 }
163
164
178
179 if (m_lessThanCB->isChecked()) {
180 m_lessErrorEdit->setEnabled(true);
181 }
182 else {
183 m_lessErrorEdit->clear();
184 m_lessErrorEdit->setEnabled(false);
185 }
186 if (m_greaterThanCB->isChecked()) {
187 m_greaterErrorEdit->setEnabled(true);
188 }
189 else {
190 m_greaterErrorEdit->clear();
191 m_greaterErrorEdit->setEnabled(false);
192 }
193 }
194}
double GetResidualMagnitude() const
Return Residual magnitude.
A single control point.
Statistics GetStatistic(double(ControlMeasure::*statFunc)() const) const
This function will call a given method on every control measure that this point has.
Qnet Navigation Tool.
void clearEdit()
Clears and disables the corresponding line edit if the "less than" or "greater than" checkBox is "unc...
virtual void filter()
Filters a list of points for points that have less than or greater than the entered bundle adjust err...
QnetPointJigsawErrorFilter(QnetNavTool *navTool, QWidget *parent=0)
Contructor for the Point Error filter.
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16