Isis 3 Programmer Reference
QnetPointImagesFilter.cpp
1#include "QnetPointImagesFilter.h"
2
3#include <QGridLayout>
4#include <QLabel>
5#include <QLineEdit>
6#include <QMessageBox>
7#include <QRadioButton>
8
9#include "ControlNet.h"
10#include "ControlPoint.h"
11#include "QnetNavTool.h"
12#include "SerialNumberList.h"
13
14namespace Isis {
28 QWidget *parent) : QnetFilter(navTool, parent) {
29 m_lessThanRB = NULL;
30 m_greaterThanRB = NULL;
31 m_imageEdit = NULL;
32 // Create the components for the main window
33 QLabel *label = new QLabel("Filter by number of images in each point");
34 m_lessThanRB = new QRadioButton("Less than");
35 m_greaterThanRB = new QRadioButton("Greater than");
36 m_imageEdit = new QLineEdit();
37 QLabel *units = new QLabel("images");
38 m_lessThanRB->setChecked(true);
39 QLabel *pad = new QLabel();
40
41 // Create the layout and add the components to it
42 QGridLayout *gridLayout = new QGridLayout();
43 gridLayout->addWidget(label, 0, 0, 1, 2);
44 gridLayout->addWidget(m_lessThanRB, 1, 0, 1, 2);
45 gridLayout->addWidget(m_greaterThanRB, 2, 0, 1, 2);
46 gridLayout->addWidget(m_imageEdit, 3, 0);
47 gridLayout->addWidget(units, 3, 1);
48 gridLayout->addWidget(pad, 4, 0);
49 gridLayout->setRowStretch(4, 50);
50 setLayout(gridLayout);
51 }
52
67 // Make sure we have points to filter
68 if (controlNet() == NULL) {
69 QMessageBox::information((QWidget *)parent(),
70 "Error", "No points to filter");
71 return;
72 }
73
74 // Make sure the user has entered a value for the filtering
75 int num = -1;
76 if (m_imageEdit->text() == "") {
77 QMessageBox::information((QWidget *)parent(),
78 "Error", "Image filter value must be entered");
79 return;
80 }
81
82 // Get the user entered filter value
83 num = m_imageEdit->text().toInt();
84
85 // Loop through each value of the filtered points list the user
86 // entered value with the number of measures in the point and
87 // remove it from the list if it is outside the filtering value range
88 // Loop in reverse order since removal list of elements affects index number
89 for (int i = filteredPoints().size() - 1; i >= 0; i--) {
90 ControlPoint &cp = *(*controlNet())[filteredPoints()[i]];
91 if (m_lessThanRB->isChecked()) {
92 if (cp.GetNumMeasures() < num)
93 continue;
94 else
95 filteredPoints().removeAt(i);
96 }
97 else if (m_greaterThanRB->isChecked()) {
98 if (cp.GetNumMeasures() > num)
99 continue;
100 else
101 filteredPoints().removeAt(i);
102 }
103 }
104 // Tell the navtool that a list has been filtered and it needs to update
105 emit filteredListModified();
106 return;
107 }
108}
A single control point.
Qnet Navigation Tool.
virtual void filter()
Filters a list of points for points that have less than or greater than the entered number of images.
QnetPointImagesFilter(QnetNavTool *navTool, QWidget *parent=0)
Contructor for the Point Images filter.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16