Isis 3 Programmer Reference
QnetPointIdFilter.cpp
1#include "QnetPointIdFilter.h"
2
3#include <QGridLayout>
4#include <QLabel>
5#include <QLineEdit>
6#include <QMessageBox>
7#include <QRegExp>
8
9#include "ControlNet.h"
10#include "ControlPoint.h"
11#include "QnetNavTool.h"
12#include "SerialNumberList.h"
13
14using namespace std;
15
16namespace Isis {
29 QWidget *parent) : QnetFilter(navTool, parent) {
30 m_pointIdEdit = NULL;
31
32 // Create the components for the filter window
33 QLabel *label = new QLabel("Filter by Point ID (Wildcard)");
34 m_pointIdEdit = new QLineEdit;
35
36 // Create the layout and add the components to it
37 QVBoxLayout *vertLayout = new QVBoxLayout;
38 vertLayout->addWidget(label);
39 vertLayout->addWidget(m_pointIdEdit);
40 vertLayout->addStretch();
41 this->setLayout(vertLayout);
42 }
43
55
56 // Make sure there is a control net loaded
57 if (controlNet() == NULL) {
58 QMessageBox::information((QWidget *)parent(),
59 "Error", "No points to filter");
60 return;
61 }
62
63 // Make sure the user has entered a regular expression for filtering
64 QRegExp rx(m_pointIdEdit->text().trimmed());
65 rx.setPatternSyntax(QRegExp::Wildcard);
66 if (rx.isEmpty()) {
67 QMessageBox::information((QWidget *)parent(),
68 "Error", "Enter search string");
69 return;
70 }
71
72
73 // Loop through each value of the filtered points list checking
74 // the types of each control measure for each of the control points
75 // Loop in reverse order since removal list of elements affects index number
76 for (int i = filteredPoints().size() - 1; i >= 0; i--) {
77
78 QString cNetId = (*controlNet())[filteredPoints()[i]]->GetId();
79 if (rx.indexIn(QString(cNetId)) != -1) {
80 continue;
81 }
82 else
83 filteredPoints().removeAt(i);
84 }
85
86 // Tell the navtool a list has been filtered and it needs to update
87 emit filteredListModified();
88 return;
89 }
90}
Qnet Navigation Tool.
QnetPointIdFilter(QnetNavTool *navTool, QWidget *parent=0)
Contructor for the Cube Image filter.
virtual void filter()
Filters a list of images looking for cube names using the regular expression entered.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.