1 #include "NewControlPointDialog.h"
10 #include <QListWidget>
11 #include <QPushButton>
12 #include <QRadioButton>
40 QString defaultPointId,
43 m_controlNet = controlNet;
44 m_serialNumberList = serialNumberList;
48 m_subpixelRegisterButton = NULL;
53 m_ptIdLabel =
new QLabel(
"Point ID:");
54 m_ptIdEdit =
new QLineEdit;
55 m_ptIdLabel->setBuddy(m_ptIdEdit);
56 m_ptIdEdit->setText(defaultPointId);
57 m_ptIdEdit->selectAll();
58 connect(m_ptIdEdit, SIGNAL(textChanged(
const QString &)),
62 for (
int i=0; i<ControlPoint::PointTypeCount; i++) {
66 m_pointTypeCombo->setCurrentIndex(2);
67 QHBoxLayout *pointTypeLayout =
new QHBoxLayout;
68 QLabel *pointTypeLabel =
new QLabel(
"PointType:");
69 pointTypeLayout->addWidget(pointTypeLabel);
70 pointTypeLayout->addWidget(m_pointTypeCombo);
71 connect(m_pointTypeCombo, SIGNAL(currentIndexChanged(
int)),
this, SLOT(pointTypeChanged(
int)));
74 QHBoxLayout *m_groundSourceLayout =
new QHBoxLayout;
75 QLabel *groundSourceLabel =
new QLabel(
"Ground Source:");
76 m_groundSourceLayout->addWidget(groundSourceLabel);
77 m_groundSourceLayout->addWidget(m_groundSourceCombo);
78 m_groundSourceCombo->setVisible(
false);
80 m_subpixelRegisterButton =
new QRadioButton(
"Subpixel Register Measures");
81 m_subpixelRegisterButton->setChecked(
true);
82 m_subpixelRegisterButton->setToolTip(
"Each measure will be subpixel registered to the reference"
83 " as it is created.");
85 QLabel *listLabel =
new QLabel(
"Select Files:");
87 m_fileList =
new QListWidget;
88 m_fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
91 m_okButton =
new QPushButton(
"OK");
96 QPushButton *cancelButton =
new QPushButton(
"Cancel");
97 QHBoxLayout *buttonLayout =
new QHBoxLayout;
98 buttonLayout->addWidget(m_okButton);
99 buttonLayout->addWidget(cancelButton);
101 connect(m_okButton, SIGNAL(clicked()),
this, SLOT(accept()));
102 connect(cancelButton, SIGNAL(clicked()),
this, SLOT(reject()));
104 QHBoxLayout *ptIdLayout =
new QHBoxLayout;
105 ptIdLayout->addWidget(m_ptIdLabel);
106 ptIdLayout->addWidget(m_ptIdEdit);
108 QVBoxLayout *vLayout =
new QVBoxLayout;
109 vLayout->addLayout(ptIdLayout);
110 vLayout->addLayout(pointTypeLayout);
111 vLayout->addLayout(m_groundSourceLayout);
112 vLayout->addWidget(m_subpixelRegisterButton);
113 vLayout->addWidget(listLabel);
114 vLayout->addWidget(m_fileList);
115 vLayout->addLayout(buttonLayout);
118 setWindowTitle(
"Create New ControlPoint");
123 QString NewControlPointDialog::pointId()
const {
124 return m_ptIdEdit->text();
128 int NewControlPointDialog::pointType()
const {
129 return m_pointTypeCombo->currentIndex();
133 QStringList NewControlPointDialog::selectedFiles()
const {
136 foreach (QListWidgetItem *fileItem, m_fileList->selectedItems()) {
137 result.append(fileItem->text());
144 bool NewControlPointDialog::subpixelRegisterPoint() {
145 return m_subpixelRegisterButton->isChecked();
149 QString NewControlPointDialog::groundSource()
const {
150 return m_groundSourceCombo->currentText();
154 void NewControlPointDialog::pointTypeChanged(
int pointType) {
156 m_groundSourceCombo->setVisible(
true);
161 void NewControlPointDialog::setGroundSource(
QStringList groundFiles,
int numberShapesWithPoint) {
162 m_groundSourceCombo->addItems(groundFiles);
163 for (
int i = 0; i < numberShapesWithPoint; i++) {
164 m_groundSourceCombo->setItemData(i, QColor(Qt::red), Qt::ForegroundRole);
166 m_groundSourceCombo->insertSeparator(numberShapesWithPoint);
179 int bottomMostSelectedItemIndex = 0;
181 for (
int i = 0; i < m_serialNumberList->
size(); i++) {
184 QString label = m_serialNumberList->
fileName(i);
185 QListWidgetItem *item =
new QListWidgetItem(label);
191 if (pointFiles.contains(label)) {
192 m_fileList->insertItem(bottomMostSelectedItemIndex++, item);
193 item->setSelected(
true);
196 m_fileList->addItem(item);
209 m_okButton->setEnabled(!m_ptIdEdit->text().isEmpty() &&
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
bool ContainsPoint(QString pointId) const
int size() const
How many serial number / filename combos are in the list.
NewControlPointDialog(ControlNet *controlNet, SerialNumberList *serialNumberList, QString defaultPointId, QWidget *parent=0)
NewControlPointDialog constructor.
PointType
These are the valid 'types' of point.
QString fileName(const QString &sn)
Return a filename given a serial number.
void enableOkButton(const QString &text)
void setFiles(QStringList pointFiles)
Serial Number list generator.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.