Isis 3 Programmer Reference
CnetEditorWidget.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "CnetEditorWidget.h"
10
11#include <QAction>
12#include <QActionGroup>
13#include <QApplication>
14#include <QBoxLayout>
15#include <QByteArray>
16#include <QCloseEvent>
17#include <QDebug>
18#include <QGroupBox>
19#include <QHBoxLayout>
20#include <QHeaderView>
21#include <QItemSelection>
22#include <QMenu>
23#include <QMessageBox>
24#include <QModelIndex>
25#include <QScrollArea>
26#include <QScrollBar>
27#include <QSettings>
28#include <QSplitter>
29#include <QString>
30#include <QStringList>
31#include <QTime>
32#include <QTimer>
33#include <QToolBar>
34#include <QVBoxLayout>
35#include <QWhatsThis>
36#include <QtXml>
37
38#include "AbstractMeasureItem.h"
39#include "AbstractPointItem.h"
40#include "AbstractTreeItem.h"
41#include "CnetDisplayProperties.h"
42#include "CnetEditorSortConfigDialog.h"
43#include "Control.h"
44#include "ControlMeasure.h"
45#include "ControlNet.h"
46#include "ControlPoint.h"
47#include "FileName.h"
48#include "FilterWidget.h"
49#include "IException.h"
50#include "ImageImageTreeModel.h"
51#include "ImagePointTreeModel.h"
52#include "MeasureTableModel.h"
53#include "PointMeasureTreeModel.h"
54#include "PointTableModel.h"
55#include "Project.h"
56#include "TableView.h"
57#include "TableViewHeader.h"
58#include "TreeView.h"
59
60
61namespace Isis {
62
63//**************************************************************
64//**************************************************************
65//**************************************************************
66
67 const QString CnetEditorWidget::VERSION = "0.1";
68
69//**************************************************************
70//**************************************************************
71//**************************************************************
72
73
74 CnetEditorWidget::CnetEditorWidget(Control *control, QString pathForSettings) {
75 nullify();
76
77 m_workingVersion = new QString;
78 m_menuActions = new QMap< QAction *, QList< QString > >;
79 m_toolBarActions = new QMap< QString, QList< QAction * > >;
80
81 m_updatingSelection = false;
82
83 m_sortDialog = NULL;
84
86 connect(CnetDisplayProperties::getInstance(), SIGNAL(compositionFinished()),
87 this, SLOT(rebuildModels()));
88
89 connect(this, SIGNAL(cnetModified()), this, SLOT(setCnetModified()));
90 m_settingsPath = new QString(pathForSettings);
91
92 QBoxLayout *mainLayout = createMainLayout();
93 setLayout(mainLayout);
94
96
98
100
101 installEventFilter(this);
102 }
103
104
109
111
112 delete m_workingVersion;
113 m_workingVersion = NULL;
114
115 delete m_settingsPath;
116 m_settingsPath = NULL;
117
118 delete m_pointTreeView;
119 m_pointTreeView = NULL;
120
121 delete m_imageTreeView;
122 m_imageTreeView = NULL;
123
126
127 delete m_pointTableView;
128 m_pointTableView = NULL;
129
130 delete m_measureTableView;
131 m_measureTableView = NULL;
132
133 delete m_pointFilterWidget;
134 m_pointFilterWidget = NULL;
135
138
141
142 delete m_menuActions;
143 m_menuActions = NULL;
144
145 delete m_toolBarActions;
146 m_toolBarActions = NULL;
147
148 m_pointTableBox = NULL;
149 m_measureTableBox = NULL;
150 m_mainSplitter = NULL;
151
152 // TODO: null all member widgets!
153
154 delete m_pointModel;
155 m_pointModel = NULL;
156
157 delete m_imageModel;
158 m_imageModel = NULL;
159
160 delete m_connectionModel;
161 m_connectionModel = NULL;
162
163 delete m_sortDialog;
164 m_sortDialog = NULL;
165 }
166
167
172 m_pointTreeView = NULL;
173 m_imageTreeView = NULL;
175
176 m_pointModel = NULL;
177 m_imageModel = NULL;
178 m_connectionModel = NULL;
179
180 m_pointTableModel = NULL;
181 m_measureTableModel = NULL;
182
183 m_pointTableBox = NULL;
184 m_measureTableBox = NULL;
185
186 m_pointTableView = NULL;
187 m_measureTableView = NULL;
188
189 m_mainSplitter = NULL;
190
191 m_menuActions = NULL;
192 m_toolBarActions = NULL;
193
194 m_filterArea = NULL;
195
196 m_pointFilterWidget = NULL;
199
200 m_control = NULL;
201 m_settingsPath = NULL;
202 m_workingVersion = NULL;
203
204 m_sortDialog = NULL;
205 }
206
207
213 void CnetEditorWidget::rebuildModels(QList<AbstractTreeItem *> itemsToDelete) {
214 m_pointModel->stopWorking();
215 m_imageModel->stopWorking();
216 m_connectionModel->stopWorking();
217
218 bool ignoreAll = false;
219 foreach (AbstractTreeItem * item, itemsToDelete) {
220 try {
221 item->deleteSource();
222 }
223 catch (IException &e) {
224 QString message = e.what();
225
226 if (!ignoreAll) {
227 if (item == itemsToDelete.last()) {
228 QMessageBox::warning(
229 this, "Failed to delete row", message, QMessageBox::Ok);
230 }
231 else {
232 message += "\n\nOkay to continue?";
233
234 QMessageBox::StandardButton status = QMessageBox::warning(
235 this, "Failed to delete row", message, QMessageBox::Yes |
236 QMessageBox::YesToAll | QMessageBox::No);
237
238 if (status == QMessageBox::YesToAll)
239 ignoreAll = true;
240 else if (status == QMessageBox::No)
241 break;
242 }
243 }
244 }
245 }
246
247 m_pointModel->rebuildItems();
248 m_imageModel->rebuildItems();
249 m_connectionModel->rebuildItems();
250 }
251
252
260
261 connect(m_pointTreeView, SIGNAL(activated()),
262 m_imageTreeView, SLOT(deactivate()));
263 connect(m_pointTreeView, SIGNAL(activated()),
264 m_connectionTreeView, SLOT(deactivate()));
265
266 connect(m_imageTreeView, SIGNAL(activated()),
267 m_pointTreeView, SLOT(deactivate()));
268 connect(m_imageTreeView, SIGNAL(activated()),
269 m_connectionTreeView, SLOT(deactivate()));
270
271 connect(m_connectionTreeView, SIGNAL(activated()),
272 m_pointTreeView, SLOT(deactivate()));
273 connect(m_connectionTreeView, SIGNAL(activated()),
274 m_imageTreeView, SLOT(deactivate()));
275
277
279 m_pointTableBox = new QGroupBox(tr("Control Point Table"));
280 QHBoxLayout *pointTableLayout = new QHBoxLayout;
281 pointTableLayout->addWidget(m_pointTableView);
282 m_pointTableBox->setLayout(pointTableLayout);
283
285 m_measureTableBox = new QGroupBox(tr("Control Measure Table"));
286 QHBoxLayout *measureTableLayout = new QHBoxLayout;
287 measureTableLayout->addWidget(m_measureTableView);
288 m_measureTableBox->setLayout(measureTableLayout);
289
290 m_mainSplitter = new QSplitter(Qt::Vertical);
293
294 QBoxLayout *mainLayout = new QHBoxLayout;
295 mainLayout->addWidget(m_mainSplitter);
296
297 return mainLayout;
298 }
299
300
305
306 QAction *freezeTablesAct = new QAction(QIcon(
307 FileName("$ISISROOT/appdata/images/icons/ice.png").expanded()),
308 tr("&Freeze Tables"), this);
309 freezeTablesAct->setCheckable(true);
310 freezeTablesAct->setToolTip(tr("Freeze tables (filters will not take "
311 "effect until unfrozen)"));
312 freezeTablesAct->setStatusTip(tr("Freeze tables (filters will not take "
313 "effect until unfrozen)"));
314 freezeTablesAct->setWhatsThis(tr("<html>When frozen, the contents of the "
315 "tables will be locked. Current filters will not be applied to the "
316 "tables until they are unfrozen.</html>"));
317 connect(freezeTablesAct, SIGNAL(toggled(bool)),
318 this, SLOT(setTablesFrozen(bool)));
319 QList< QString > freezeTablesLocation;
320 freezeTablesLocation.append(tr("&Tables"));
321 m_menuActions->insert(freezeTablesAct, freezeTablesLocation);
322
323 QAction *configureSortAct = new QAction(QIcon(
324 FileName("$ISISROOT/appdata/images/icons/sort.png").expanded()),
325 tr("&Sorting Options..."), this);
326 QString configureSortToolTipText = tr("Configure table sorting options");
327 configureSortAct->setToolTip(configureSortToolTipText);
328 configureSortAct->setStatusTip(configureSortToolTipText);
329 configureSortAct->setWhatsThis(tr("<html>Click here to configure options "
330 "related to the sorting of table columns.</html>"));
331 connect(configureSortAct, SIGNAL(triggered()),
332 this, SLOT(configSorting()));
333 QList< QString > configureSortLocation;
334 configureSortLocation.append(tr("&Tables"));
335 m_menuActions->insert(configureSortAct, configureSortLocation);
336
337 QAction *xyzDisplayAct = new QAction(QIcon(FileName("$ISISROOT/appdata/images/icons/xyz.png").expanded()),
338 tr("&X,Y,Z"), this);
339 xyzDisplayAct->setCheckable(true);
340 xyzDisplayAct->setChecked(false);
341 QString configureXYZDisplayToolTipText = tr("X,Y,Z Coordinate Display");
342 xyzDisplayAct->setToolTip(configureXYZDisplayToolTipText);
343 xyzDisplayAct->setStatusTip(configureXYZDisplayToolTipText);
344 xyzDisplayAct->setWhatsThis(tr("<html>Click here to select coordinate display in : "
345 "X, Y, Z</html>"));
346 connect(xyzDisplayAct, SIGNAL(triggered()),
347 this, SLOT(setXYZCoordinateDisplay()));
348 QList< QString > xyzDisplayLocation;
349 xyzDisplayLocation.append(tr("&Coordinate Display"));
350 QActionGroup *coordDisplayGroup = new QActionGroup(this);
351 coordDisplayGroup->addAction(xyzDisplayAct);
352 m_menuActions->insert(xyzDisplayAct, xyzDisplayLocation);
353
354 QAction *latLonRadiusDisplayAct
355 = new QAction(QIcon(FileName("$ISISROOT/appdata/images/icons/latlonrad.png").expanded()),
356 tr("&Lat,Lon,Radius"), this);
357 latLonRadiusDisplayAct->setCheckable(true);
358 latLonRadiusDisplayAct->setChecked(true);
359 QString configureLatLonRadiusDisplayToolTipText = tr("Lat,Lon,Radius Coordinate Display");
360 latLonRadiusDisplayAct->setToolTip(configureLatLonRadiusDisplayToolTipText);
361 latLonRadiusDisplayAct->setStatusTip(configureLatLonRadiusDisplayToolTipText);
362 latLonRadiusDisplayAct->setWhatsThis(tr("<html>Click here to select coordinate display in : "
363 "latitude, longitude, radius</html>"));
364 connect(latLonRadiusDisplayAct, SIGNAL(triggered()),
366 QList< QString > latLonRadiusDisplayLocation;
367 latLonRadiusDisplayLocation.append(tr("&Coordinate Display"));
368 coordDisplayGroup->addAction(latLonRadiusDisplayAct);
369 m_menuActions->insert(latLonRadiusDisplayAct, latLonRadiusDisplayLocation);
370
371 QAction *whatsThisAct = QWhatsThis::createAction(this);
372 QList< QString > whatsThisLocation;
373 whatsThisLocation.append(tr("&Help"));
374 m_menuActions->insert(whatsThisAct, whatsThisLocation);
375
376 QList< QAction * > tbActionList;
377 tbActionList.append(freezeTablesAct);
378 tbActionList.append(configureSortAct);
379 tbActionList.append(latLonRadiusDisplayAct);
380 tbActionList.append(xyzDisplayAct);
381 m_toolBarActions->insert("settingsToolBar", tbActionList);
382 }
383
384
394
395
405
406
416
417
422
423 FilterWidget *pointFilter = new FilterWidget("Points and Measures");
424 if (m_pointModel) {
425 m_pointModel->setFilter(pointFilter);
426 }
427
428 QHBoxLayout *pointFilterLayout = new QHBoxLayout;
429 pointFilterLayout->addWidget(pointFilter);
430 QWidget *pointArea = new QWidget;
431 pointArea->setLayout(pointFilterLayout);
432 QScrollArea *pointFilterScrollArea = new QScrollArea;
433 pointFilterScrollArea->setWidget(pointArea);
434 pointFilterScrollArea->setWidgetResizable(true);
435 m_pointFilterWidget = pointFilterScrollArea;
436
437 FilterWidget *serialFilter = new FilterWidget("Images and Points");
438 if (m_imageModel) {
439 m_imageModel->setFilter(serialFilter);
440 }
441
442 QHBoxLayout *serialFilterLayout = new QHBoxLayout;
443 serialFilterLayout->addWidget(serialFilter);
444 QWidget *serialArea = new QWidget;
445 serialArea->setLayout(serialFilterLayout);
446 QScrollArea *serialFilterScrollArea = new QScrollArea;
447 serialFilterScrollArea->setWidget(serialArea);
448 serialFilterScrollArea->setWidgetResizable(true);
449 m_serialFilterWidget = serialFilterScrollArea;
450
451 FilterWidget *connectionFilter = new FilterWidget("Connections");
452 if (m_connectionModel) {
453 m_connectionModel->setFilter(connectionFilter);
454 }
455
456 QHBoxLayout *connectionFilterLayout = new QHBoxLayout;
457 connectionFilterLayout->addWidget(connectionFilter);
458 QWidget *connectionArea = new QWidget;
459 connectionArea->setLayout(connectionFilterLayout);
460 QScrollArea *connectionFilterScrollArea = new QScrollArea;
461 connectionFilterScrollArea->setWidget(connectionArea);
462 connectionFilterScrollArea->setWidgetResizable(true);
463 m_connectionFilterWidget = connectionFilterScrollArea;
464 }
465
466
472
473 connect(this, SIGNAL(coordinateDisplayTypeChanged()),
474 m_pointTableModel, SLOT(resetColumnHeaders()));
475
477 "m_pointTableView");
478 m_pointTableView->setWhatsThis("<html>Each row in the table is a control "
479 "point. Each column in the table is an attribute of a control "
480 "point.<br/><br/>Cells that are gray are not editable.</html>");
481 connect(m_pointTableView, SIGNAL(modelDataChanged()),
482 this, SIGNAL(cnetModified()));
483
484 connect(m_pointTreeView, SIGNAL(selectionChanged()),
485 m_pointTableView, SLOT(handleModelSelectionChanged()));
486 connect(m_pointTableView, SIGNAL(selectionChanged()),
487 m_pointTreeView, SLOT(handleModelSelectionChanged()));
488
489 connect(m_pointTableView,
490 SIGNAL(rebuildModels(QList< AbstractTreeItem * >)),
491 this,
492 SLOT(rebuildModels(QList< AbstractTreeItem * >)));
493
494 connect(m_pointTableView, SIGNAL(filterCountsChanged(int, int)),
495 this, SLOT(handlePointTableFilterCountsChanged(int, int)));
496
497 connect(m_pointTableView, SIGNAL(editControlPoint(ControlPoint *, QString)),
498 this, SIGNAL(editControlPoint(ControlPoint *, QString)));
499
500 for (int i = 0; i < AbstractPointItem::COLS; i++) {
501 QAction *act = new QAction(
502 AbstractPointItem::getColumnName((AbstractPointItem::Column) i), this);
503 act->setCheckable(true);
504 connect(act, SIGNAL(toggled(bool)), this, SLOT(pointColToggled()));
505 m_pointTableView->getHorizontalHeader()->addAction(act);
506 }
507
508 m_pointTableView->getHorizontalHeader()->setContextMenuPolicy(
509 Qt::ActionsContextMenu);
510 }
511
512
519 "m_measureTableView");
520 m_measureTableView->setWhatsThis("<html>Each row in the table is a control "
521 "measure. Each column in the table is an attribute of a control "
522 "measure.<br/><br/>Rows with bold text are reference measures. "
523 "Cells that are gray are not editable.</html>");
524 connect(m_pointTableView,
525 SIGNAL(tableSelectionChanged(QList< AbstractTreeItem * >)),
527 SLOT(handleTreeSelectionChanged(QList<AbstractTreeItem *>)));
528
529 connect(m_measureTableView,
530 SIGNAL(tableSelectionChanged(QList< AbstractTreeItem * >)),
532 SLOT(handleTreeSelectionChanged(QList< AbstractTreeItem * >)));
533
534
535 connect(m_measureTableView, SIGNAL(modelDataChanged()),
536 this, SIGNAL(cnetModified()));
537 connect(m_pointTreeView, SIGNAL(selectionChanged()),
538 m_measureTableView, SLOT(handleModelSelectionChanged()));
539 connect(m_measureTableView, SIGNAL(selectionChanged()),
540 m_pointTreeView, SLOT(handleModelSelectionChanged()));
541 connect(m_measureTableView,
542 SIGNAL(rebuildModels(QList< AbstractTreeItem * >)),
543 this,
544 SLOT(rebuildModels(QList< AbstractTreeItem * >)));
545
546 connect(m_measureTableView, SIGNAL(filterCountsChanged(int, int)),
547 this, SLOT(handleMeasureTableFilterCountsChanged(int, int)));
548
549 connect(m_measureTableView, SIGNAL(editControlPoint(ControlPoint *, QString)),
550 this, SIGNAL(editControlPoint(ControlPoint *, QString)));
551
552 for (int i = 0; i < AbstractMeasureItem::COLS; i++) {
553 QAction *act = new QAction(AbstractMeasureItem::getColumnName(
554 (AbstractMeasureItem::Column) i), this);
555 act->setCheckable(true);
556 connect(act, SIGNAL(toggled(bool)), this, SLOT(measureColToggled()));
557 m_measureTableView->getHorizontalHeader()->addAction(act);
558 }
559
560 m_measureTableView->getHorizontalHeader()->setContextMenuPolicy(
561 Qt::ActionsContextMenu);
562 }
563
564
569 rebuildModels(QList< AbstractTreeItem * >());
570 }
571
572
577 QList< QAction * > actions =
579
580 for (int i = 0; i < actions.size(); i++) {
581 m_pointTableView->setColumnVisible(actions[i]->text(),
582 actions[i]->isChecked());
583 }
584 }
585
586
591 QList< QAction * > actions =
593 for (int i = 0; i < actions.size(); i++)
594 m_measureTableView->setColumnVisible(actions[i]->text(),
595 actions[i]->isChecked());
596 }
597
598
609 int visibleRows, int totalRows) {
610 handleTableFilterCountsChanged(visibleRows, totalRows, m_pointTableBox,
611 "Control Point Table");
612 }
613
614
625 int visibleRows, int totalRows) {
627 "Control Measure Table");
628 }
629
630
640 int visibleRows, int totalRows, QGroupBox *box, QString initialText) {
641 if (box) {
642 QString newTitle = initialText + " (";
643 if (visibleRows > -1)
644 newTitle += QString::number(visibleRows);
645 else
646 newTitle += "???";
647
648 newTitle += " / " + QString::number(totalRows) + ")";
649
650 box->setTitle(newTitle);
651 }
652 }
653
654
659 if (*m_workingVersion == "") {
660 *m_workingVersion = "0.1";
661 }
662
665 }
666
667
672
673 QSettings settings(*m_settingsPath, QSettings::NativeFormat);
674 *m_workingVersion = settings.value("version", "").toString();
675
676 m_mainSplitter->restoreState(settings.value("mainSplitter").toByteArray());
677
678 QString key;
679
680 QList< QAction * > actions =
682 for (int i = 0; i < actions.size(); i++) {
683 key = m_measureTableView->objectName() + " " +
684 AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
685 key.replace(" ", "_");
686 actions[i]->setChecked(settings.value(key, true).toBool());
687 }
688
689 actions = m_pointTableView->getHorizontalHeader()->actions();
690 for (int i = 0; i < actions.size(); i++) {
691 key = m_pointTableView->objectName() + " " +
692 AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
693 key.replace(" ", "_");
694 actions[i]->setChecked(settings.value(key, true).toBool());
695 }
696
697 // Restore sorting configuration settings.
699 settings.value("measureTableSortingEnabled", true).toBool());
701 settings.value("measureTableSortLimit", 500000).toInt());
703 settings.value("pointTableSortingEnabled", true).toBool());
705 settings.value("pointTableSortLimit", 100000).toInt());
706 }
707
708
713
714 QSettings settings(*m_settingsPath, QSettings::NativeFormat);
715 settings.setValue("version", VERSION);
716 settings.setValue("mainSplitter", m_mainSplitter->saveState());
717
718 QString key;
719
720 QList< QAction * > actions =
722 for (int i = 0; i < actions.size(); i++) {
723 key = m_measureTableView->objectName() + " " +
724 AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
725 key.replace(" ", "_");
726 settings.setValue(key, actions[i]->isChecked());
727 }
728
729 actions = m_pointTableView->getHorizontalHeader()->actions();
730 for (int i = 0; i < actions.size(); i++) {
731 key = m_pointTableView->objectName() + " " +
732 AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
733 key.replace(" ", "_");
734 settings.setValue(key, actions[i]->isChecked());
735 }
736
737 // Write sorting configuration settings.
738 settings.setValue("measureTableSortingEnabled",
740 settings.setValue("measureTableSortLimit",
742 settings.setValue("pointTableSortingEnabled",
744 settings.setValue("pointTableSortLimit",
746 }
747
748
757
758
767
768
777
778
787
788
797
798
807
808
817
818
827
828
837
838
847
848
857
858
864 QMap< QAction *, QList< QString > > CnetEditorWidget::menuActions() {
865 return *m_menuActions;
866 }
867
868
874 QMap< QString, QList< QAction * > > CnetEditorWidget::toolBarActions() {
875 return *m_toolBarActions;
876 }
877
878
885 ControlNet *filteredCnet = new ControlNet(*(m_control->controlNet()));
886
887 QList<AbstractTreeItem *> networkItems = m_pointModel->getItems(0, -1,
888 AbstractTreeModel::MeasureItems | AbstractTreeModel::PointItems, true);
889
890 // Iterate through our copy of the cnet, deleting anything that doesn't
891 // exactly match our networkItems.
892 for (int pointIndex = filteredCnet->GetNumPoints() - 1;
893 pointIndex >= 0;
894 pointIndex--) {
895 if (networkItems.isEmpty()) {
896 ControlPoint *cp = filteredCnet->GetPoint(pointIndex);
897 cp->SetEditLock(false);
898
899 for (int measureIndex = 0;
900 measureIndex < cp->GetNumMeasures();
901 measureIndex++) {
902 cp->GetMeasure(measureIndex)->SetEditLock(false);
903 }
904
905 filteredCnet->DeletePoint(cp);
906 }
907 else if (networkItems.last()->getPointerType() ==
908 AbstractTreeItem::Point) {
909 ControlPoint *networkItemsCp =
910 (ControlPoint *)networkItems.last()->getPointer();
911 ControlPoint *cp = filteredCnet->GetPoint(pointIndex);
912 if (cp->GetId() != networkItemsCp->GetId()) {
913 cp->SetEditLock(false);
914
915 for (int measureIndex = 0;
916 measureIndex < cp->GetNumMeasures();
917 measureIndex++) {
918 cp->GetMeasure(measureIndex)->SetEditLock(false);
919 }
920
921 filteredCnet->DeletePoint(cp);
922 }
923 else {
924 networkItems.removeLast();
925 }
926 }
927 else if (networkItems.last()->getPointerType() ==
928 AbstractTreeItem::Measure) {
929 ControlPoint *cp = filteredCnet->GetPoint(pointIndex);
930 ControlMeasure *networkItemsCm =
931 (ControlMeasure *)networkItems.last()->getPointer();
932
933 if (cp->GetId() != networkItemsCm->Parent()->GetId()) {
934 cp->SetEditLock(false);
935
936 for (int measureIndex = 0;
937 measureIndex < cp->GetNumMeasures();
938 measureIndex++) {
939 cp->GetMeasure(measureIndex)->SetEditLock(false);
940 }
941
942 filteredCnet->DeletePoint(cp);
943 }
944 else {
945 // Our CP stays, figure out which CMs stay.
946 for (int measureIndex = cp->GetNumMeasures() - 1;
947 networkItemsCm && measureIndex >= 0;
948 measureIndex--) {
949 ControlMeasure *cm = cp->GetMeasure(measureIndex);
950 if (cm->GetCubeSerialNumber() !=
951 networkItemsCm->GetCubeSerialNumber()) {
952 cm->SetEditLock(false);
953 cp->Delete(cm);
954 }
955 else {
956 networkItems.removeLast();
957 networkItemsCm = NULL;
958
959 if (networkItems.last()->getPointerType() ==
960 AbstractTreeItem::Measure) {
961 networkItemsCm =
962 (ControlMeasure *)networkItems.last()->getPointer();
963 }
964 }
965 }
966
967 // We still need to verify the copied CP at this index... although
968 // nothing should go wrong, we know things do go wrong so do
969 // the verify instead of just tossing the last networkItems item.
970 pointIndex++;
971 }
972 }
973 }
974
975 return filteredCnet;
976 }
977
978
985 return m_measureTableModel->sortingIsEnabled();
986 }
987
988
995 return m_measureTableModel->sortLimit();
996 }
997
998
1005 return m_pointTableModel->sortingIsEnabled();
1006 }
1007
1008
1015 return m_pointTableModel->sortLimit();
1016 }
1017
1018
1025 m_measureTableModel->setSortingEnabled(enabled);
1026 }
1027
1028
1035 m_measureTableModel->setSortLimit(limit);
1036 }
1037
1038
1045 m_pointTableModel->setSortingEnabled(enabled);
1046 }
1047
1048
1055 m_pointTableModel->setSortLimit(limit);
1056 }
1057
1058
1064 if (!m_sortDialog) {
1066 }
1067 m_sortDialog->show();
1068 }
1069
1070
1077 CnetDisplayProperties *displayProperties = CnetDisplayProperties::getInstance();
1078
1079 if (displayProperties->coordinateDisplayType() == CnetDisplayProperties::LatLonRadius) {
1080 return;
1081 }
1082
1083 displayProperties->setCoordinateDisplayType(CnetDisplayProperties::LatLonRadius);
1084 emit(coordinateDisplayTypeChanged());
1085 m_pointModel->rebuildItems();
1086 }
1087
1088
1095 CnetDisplayProperties *displayProperties = CnetDisplayProperties::getInstance();
1096
1097 if (displayProperties->coordinateDisplayType() == CnetDisplayProperties::XYZ) {
1098 return;
1099 }
1100
1101 displayProperties->setCoordinateDisplayType(CnetDisplayProperties::XYZ);
1102 emit(coordinateDisplayTypeChanged());
1103 m_pointModel->rebuildItems();
1104 }
1105
1106
1112 void CnetEditorWidget::setTablesFrozen(bool freezeTables) {
1113 if (freezeTables) {
1114 m_connectionModel->setFrozen(true);
1115 m_imageModel->setFrozen(true);
1116 m_pointModel->setFrozen(true);
1117 }
1118 else {
1119 m_pointModel->setFrozen(false);
1120 m_imageModel->setFrozen(false);
1121 m_connectionModel->setFrozen(false);
1122 }
1123 }
1124
1125
1132}
Translates the tree model into a table model.
Base class for an item in the tree.
Handles how control networks should be displayed to the user.
void setCoordinateDisplayType(enum coordinateDisplayType coordDisplay)
Sets the coordinate display type (0 = LatLonRadius, 1 = XYZ).
coordinateDisplayType
Returns coordinate display type (0 = LatLonRadius, 1 = XYZ).
Configure user's sorting settings for the cneteditor widget.
void createSerialTreeView()
Creates the serial tree and adds it to the model.
Control * m_control
Control for this widget.
virtual ~CnetEditorWidget()
Destructor.
QWidget * m_connectionFilterWidget
Connection filter widget.
int pointTableSortLimit() const
Returns the sorting limit for the point table.
void setPointTableSortLimit(int limit)
Sets the point table sorting limit.
TreeView * m_connectionTreeView
Connection tree view.
static const QString VERSION
Version.
void setCnetModified()
Connected to cnetModified().
void createMeasureTableView()
Creates the measure table and adds it to the widget.
QString * m_settingsPath
Path to read/write settings.
TreeView * m_imageTreeView
Image tree view.
QWidget * serialFilterWidget()
Returns the serial filter widget.
QGroupBox * m_pointTableBox
Point table box.
AbstractTableModel * measureTableModel()
Returns the measure table model.
void setMeasureTableSortLimit(int limit)
Sets the measure table sorting limit.
bool m_updatingSelection
Updates selection.
void rebuildModels()
Rebuilds the models.
QMap< QString, QList< QAction * > > toolBarActions()
Returns the tool bar actions.
ControlNet * control()
Returns the control network.
QWidget * connectionTreeView()
Returns the connection tree view.
void createConnectionTreeView()
Creates the connection tree and adds it to the model.
void pointColToggled()
Toggles the point column.
void handleMeasureTableFilterCountsChanged(int visibleRows, int totalRows)
Handles measure table filter changes.
AbstractTableModel * pointTableModel()
Returns the point table model.
ControlNet * filteredNetwork() const
Returns the filtered control net.
QWidget * connectionFilterWidget()
Returns the connection filter widget.
void writeSettings()
Writes the configuration settings used.
void setTablesFrozen(bool)
Sets if the tables are frozen.
void readSettings()
Reads the working version settings stored at the settings path.
PointTableModel * m_pointTableModel
Point table model.
void createPointTableView()
Creates the point table and adds it to the widget.
QGroupBox * m_measureTableBox
Measure table box.
void createPointTreeView()
Creates the point tree view and adds it to the model.
QSplitter * m_mainSplitter
Splitter.
void handlePointTableFilterCountsChanged(int visibleRows, int totalRows)
Handles point table filter changes.
MeasureTableModel * m_measureTableModel
Measure table model.
void handleTableFilterCountsChanged(int visibleRows, int totalRows, QGroupBox *box, QString initialText)
Handles any table filter changes.
void setXYZCoordinateDisplay()
Set control point coordinate display type to X,Y,Z.
void upgradeVersion()
Upgrades the working version number.
int measureTableSortLimit() const
Returns the sorting limit for the measure table.
QScrollArea * m_filterArea
Scroll area for filters.
void setPointTableSortingEnabled(bool enabled)
Sets if the point table can be sorted.
CnetEditorSortConfigDialog * m_sortDialog
Sorting dialog.
QWidget * m_pointFilterWidget
Point filter widget.
TableView * pointTableView()
Returns the point table view.
void nullify()
Sets all member variables to NULL.
QBoxLayout * createMainLayout()
Creates the layout of the widget.
void createFilterArea()
Creates filter widgets.
QMap< QAction *, QList< QString > > * m_menuActions
QMap of menu actions.
void createActions()
Creates the menus, and options for the widget.
QMap< QAction *, QList< QString > > menuActions()
Returns the menu actions.
TableView * measureTableView()
Returns the measure table view.
TreeView * m_pointTreeView
Point tree view.
void setMeasureTableSortingEnabled(bool enabled)
Sets if the measure table can be sorted.
QWidget * serialTreeView()
Returns the serial tree view.
TableView * m_pointTableView
Point table view.
QWidget * pointTreeView()
Returns the point tree view.
void setLatLonRadiusCoordinateDisplay()
Set control point coordinate display type to latitude, longitude, radius.
QWidget * m_serialFilterWidget
Serial filter widget.
QString * m_workingVersion
Working version.
bool measureTableSortingEnabled() const
Returns true if the measure table can be sorted.
void configSorting()
Configures the sorting dialog.
ImageImageTreeModel * m_connectionModel
Connection tree model.
bool pointTableSortingEnabled() const
Returns true if the point table can be sorted.
void measureColToggled()
Toggles the measure column.
TableView * m_measureTableView
Measure table view.
QWidget * pointFilterWidget()
Returns the point filter widget.
PointMeasureTreeModel * m_pointModel
Point tree model.
ImagePointTreeModel * m_imageModel
Image tree model.
QMap< QString, QList< QAction * > > * m_toolBarActions
QMap of tool bar actions.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
Definition Control.cpp:130
void setModified(bool modified=true)
@description Sets the modification state of this control.
Definition Control.cpp:221
a control measurement
a control network
Definition ControlNet.h:258
A single control point.
Status SetEditLock(bool editLock)
Set the EditLock state.
File name manipulation and expansion.
Definition FileName.h:100
This widget contains filtering capabilities for a single filter type.
Isis exception class.
Definition IException.h:91
Tree model for images and images.
Tree model for images and control points.
Table model for control measures.
Tree model for control points and control measures.
Table model for control points.
TableViewHeader * getHorizontalHeader()
Returns the horizontal header.
void setColumnVisible(QString, bool)
Sets the specified column visible or invisible.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16