3 #include "PointTableModel.h"
10 #include <QStringList>
22 #include "AbstractTableDelegate.h"
23 #include "AbstractPointItem.h"
24 #include "TableColumn.h"
25 #include "TableColumnList.h"
26 #include "PointTableDelegate.h"
27 #include "AbstractTreeModel.h"
32 PointTableModel::PointTableModel(AbstractTreeModel *model) :
33 AbstractTableModel(model, new PointTableDelegate) {
34 connect(model, SIGNAL(filterCountsChanged(
int,
int)),
35 this, SIGNAL(filterCountsChanged(
int,
int)));
43 PointTableModel::~PointTableModel() {
49 return getSortedItems(start, end, AbstractTreeModel::PointItems);
54 AbstractTreeItem *item1, AbstractTreeItem *item2) {
55 return getSortedItems(item1, item2, AbstractTreeModel::PointItems);
59 int PointTableModel::getVisibleRowCount()
const {
60 return getDataModel()->getVisibleItemCount(AbstractTreeModel::PointItems,
66 return getDataModel()->getSelectedItems(AbstractTreeModel::PointItems,
71 QString PointTableModel::getWarningMessage(AbstractTreeItem
const *row,
72 TableColumn
const *column, QString valueToSave)
const {
73 return getPointWarningMessage(row, column, valueToSave);
77 void PointTableModel::setGlobalSelection(
bool selected) {
78 return getDataModel()->setGlobalSelection(selected,
79 AbstractTreeModel::AllItems);
83 int PointTableModel::indexOfVisibleItem(
84 AbstractTreeItem
const *item)
const {
85 return getDataModel()->indexOfVisibleItem(item,
86 AbstractTreeModel::PointItems,
91 QString PointTableModel::getPointWarningMessage(
92 AbstractTreeItem
const *row, TableColumn
const *column,
93 QString valueToSave) {
94 QString colTitle = column->getTitle();
95 AbstractPointItem::Column colType =
96 AbstractPointItem::getColumn(colTitle);
101 case AbstractPointItem::EditLock:
102 if (valueToSave.toLower() ==
"no" &&
103 row->getFormattedData(colTitle).toLower() ==
"yes") {
104 warningText =
"Are you sure you want to unlock control point [" +
105 row->getFormattedData() +
"] for editing?";
108 case AbstractPointItem::APrioriSPLatSigma:
109 case AbstractPointItem::APrioriSPLonSigma:
110 case AbstractPointItem::APrioriSPRadiusSigma: {
111 ASSERT(row->getPointerType() == AbstractTreeItem::Point);
112 ControlPoint *point = (ControlPoint *) row->getPointer();
115 bool latSigmaValid = (point->GetAprioriSurfacePoint().
116 GetLatSigmaDistance().isValid());
117 bool lonSigmaValid = (point->GetAprioriSurfacePoint().
118 GetLonSigmaDistance().isValid());
119 bool radiusSigmaValid = (point->GetAprioriSurfacePoint().
120 GetLocalRadiusSigma().isValid());
122 if (!latSigmaValid && !lonSigmaValid && !radiusSigmaValid &&
123 valueToSave.toLower() !=
"null") {
124 warningText =
"The sigma values are currently null. The other "
125 "sigmas will be set to 10,000, which currently represents "
126 "'free'. Is this okay?";
130 case AbstractPointItem::APrioriSPLat:
131 case AbstractPointItem::APrioriSPLon:
132 case AbstractPointItem::APrioriSPRadius: {
133 ASSERT(row->getPointerType() == AbstractTreeItem::Point);
134 ControlPoint *point = (ControlPoint *) row->getPointer();
137 bool latValid = (point->GetAprioriSurfacePoint().
138 GetLatitude().isValid());
139 bool lonValid = (point->GetAprioriSurfacePoint().
140 GetLongitude().isValid());
141 bool radiusValid = (point->GetAprioriSurfacePoint().
142 GetLocalRadius().isValid());
144 if (!latValid && !lonValid && !radiusValid &&
145 valueToSave.toLower() !=
"null") {
146 warningText =
"Some of the a priori surface point values are "
147 "currently null. The surface point lat and lon will be set "
148 "to 0 if they are null, and the radius will be set to "
149 "10,000 if it is null. Is this okay?";
162 void PointTableModel::handleTreeSelectionChanged(
164 AbstractTableModel::handleTreeSelectionChanged(
165 newlySelectedItems, AbstractTreeItem::Point);
168 foreach (AbstractTreeItem * item, newlySelectedItems) {
169 if (item->getPointerType() == AbstractTreeItem::Measure) {
170 measureParentItems.append(item->parent());
174 if (measureParentItems.size()) {
175 AbstractTableModel::handleTreeSelectionChanged(
176 measureParentItems, AbstractTreeItem::Point);
181 TableColumnList *PointTableModel::createColumns() {
182 return AbstractPointItem::createColumns();
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.