Isis 3 Programmer Reference
QnetPointMeasureFilter.cpp
1#include "QnetPointMeasureFilter.h"
2
3#include <QCheckBox>
4#include <QGridLayout>
5#include <QGroupBox>
6#include <QMessageBox>
7#include <QRadioButton>
8
9#include "QnetNavTool.h"
10#include "ControlMeasure.h"
11#include "ControlNet.h"
12#include "ControlPoint.h"
13#include "SerialNumberList.h"
14
15using namespace std;
16
17namespace Isis {
32 QnetFilter(navTool, parent) {
33 m_measureType = NULL;
34 m_candidate = NULL;
35 m_manual = NULL;
36 m_registeredPixel = NULL;
37 m_registeredSubPixel = NULL;
38 m_ignoreStatus = NULL;
39 m_ignored = NULL;
40 m_notIgnored = NULL;
41 m_editLockStatus = NULL;
42 m_editLocked = NULL;
43 m_notEditLocked = NULL;
44
45 // Create the components for the filter window
46 m_measureType = new QGroupBox("Filter by Measure Type(s)");
47 m_measureType->setCheckable(true);
48 m_measureType->setChecked(false);
49 m_candidate = new QCheckBox("Candidate");
50 m_manual = new QCheckBox("Manual");
51 m_registeredPixel = new QCheckBox("RegisteredPixel");
52 m_registeredSubPixel = new QCheckBox("RegisteredSubPixel");
53
54 m_ignoreStatus = new QGroupBox("Filter by Ignore Status");
55 m_ignoreStatus->setCheckable(true);
56 m_ignoreStatus->setChecked(false);
57 m_ignored = new QRadioButton("Ignored");
58 m_notIgnored = new QRadioButton("Not Ignored");
59
60 m_editLockStatus = new QGroupBox("Filter by Edit Lock Status");
61 m_editLockStatus->setCheckable(true);
62 m_editLockStatus->setChecked(false);
63 m_editLocked = new QRadioButton("Edit Locked");
64 m_notEditLocked = new QRadioButton("Not Edit Locked");
65
66 QVBoxLayout *typeLayout = new QVBoxLayout();
67 typeLayout->addWidget(m_candidate);
68 typeLayout->addWidget(m_manual);
69 typeLayout->addWidget(m_registeredPixel);
70 typeLayout->addWidget(m_registeredSubPixel);
71 typeLayout->addStretch(1);
72 m_measureType->setLayout(typeLayout);
73
74 QVBoxLayout *ignoreLayout = new QVBoxLayout();
75 ignoreLayout->addWidget(m_ignored);
76 ignoreLayout->addWidget(m_notIgnored);
77 m_ignoreStatus->setLayout(ignoreLayout);
78
79 QVBoxLayout *lockLayout = new QVBoxLayout();
80 lockLayout->addWidget(m_editLocked);
81 lockLayout->addWidget(m_notEditLocked);
82 m_editLockStatus->setLayout(lockLayout);
83
84 QVBoxLayout *statusLayout = new QVBoxLayout();
85 statusLayout->addWidget(m_ignoreStatus);
86 statusLayout->addWidget(m_editLockStatus);
87
88 QHBoxLayout *layout = new QHBoxLayout();
89 layout->addWidget(m_measureType);
90 layout->addLayout(statusLayout);
91
92 this->setLayout(layout);
93 }
94
95
96
115 // Make sure there is a control net loaded to filter
116 if (controlNet() == NULL) {
117 QMessageBox::information((QWidget *)parent(),
118 "Error", "No points to filter");
119 return;
120 }
121
122 // Make sure they selected at least one type to filter for
123 if (!m_measureType->isChecked() && !m_ignoreStatus->isChecked() &&
124 !m_editLockStatus->isChecked()) {
125 QMessageBox::information((QWidget *)parent(), "Input Erro",
126 "You must select at least one measure property to filter");
127 return;
128 }
129 // if Filter by Measure Type is selected but no Measure Type is checked, throw error
130 if ((m_measureType->isChecked()) &&
131 !(m_candidate->isChecked() || m_manual->isChecked() ||
132 m_registeredPixel->isChecked() || m_registeredSubPixel->isChecked())) {
133 QMessageBox::information((QWidget *)parent(), "Input Error",
134 "Filter by Measure Type is selected. You must choose at least one "
135 "Measure Type to filter");
136 return;
137 }
138
139
140 // Loop through each value of the filtered points list
141 // checking the types of each control measure for each
142 // of the control points. If no measures match, we remove
143 // it from the filtered list
144 // Loop in reverse order since removal list of elements affects index number
145 for (int i = filteredPoints().size() - 1; i >= 0; i--) {
146 ControlPoint &cp = *(*controlNet())[filteredPoints()[i]];
147 int numMeasNotMatching = 0;
148 for (int j = 0; j < cp.GetNumMeasures(); j++) {
149 // While keep is true, keep testing for next filter option
150 bool keep = true;
151 if (m_measureType->isChecked() && !MeasureTypeMatched(cp[j]->GetType())) {
152 keep = false;
153 }
154// ????? Not sure why this code was here, was introduced for binary, but
155// it does not work. TODO: GET RID OF???
156// // Is this a reference measure
157// bool reference = cp.IsReferenceExplicit() &&
158// ((QString(cp[j]->GetCubeSerialNumber()) == cp.GetReferenceSN()));
159// if (!MeasureTypeMatched(cp[j]->GetType()) && !reference) keep = false;
160
161 if (keep && m_ignoreStatus->isChecked()) {
162 if (m_ignored->isChecked() && !cp[j]->IsIgnored()) keep = false;
163 if (m_notIgnored->isChecked() && cp[j]->IsIgnored()) keep = false;
164 }
165
166 if (keep && m_editLockStatus->isChecked()) {
167 if (m_editLocked->isChecked() && !cp[j]->IsEditLocked()) keep = false;
168 if (m_notEditLocked->isChecked()&& cp[j]->IsEditLocked()) keep = false;
169 }
170
171 // if this measure doesn't match any of the checked values, increment
172 if (!keep) numMeasNotMatching++;
173 }
174
175 int numMeasures = cp.GetNumMeasures();
176
177 // if no measures match the checked values,
178 // remove this point from the filter list
179 if (numMeasNotMatching == numMeasures) {
180 filteredPoints().removeAt(i);
181 }
182 }
183
184 // Tell the navtool that a list has been filtered and it needs to update
185 emit filteredListModified();
186 return;
187 }
188
205 if (m_candidate->isChecked() && cmType == ControlMeasure::Candidate) {
206 return true;;
207 }
208 if (m_manual->isChecked() && cmType == ControlMeasure::Manual) {
209 return true;;
210 }
211 if (m_registeredPixel->isChecked() && cmType == ControlMeasure::RegisteredPixel) {
212 return true;;
213 }
214 if (m_registeredSubPixel->isChecked() && cmType == ControlMeasure::RegisteredSubPixel) {
215 return true;;
216 }
217 return false;
218 }
219
220}
@ Manual
Hand Measured (e.g., qnet)
@ Candidate
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
@ RegisteredSubPixel
Registered to sub-pixel (e.g., pointreg)
@ RegisteredPixel
Registered to whole pixel (e.g.,pointreg)
A single control point.
Qnet Navigation Tool.
bool MeasureTypeMatched(int cmType)
Returns whether the measure type passed in matches a type selected by the user.
virtual void filter()
Filters a list of points for points that have at least one measure of the selected type(s).
QnetPointMeasureFilter(QnetNavTool *navTool, QWidget *parent=0)
Contructor for the Point Measure filter.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.