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" 31 PointTableModel::PointTableModel(AbstractTreeModel *model) :
32 AbstractTableModel(model, new PointTableDelegate) {
33 connect(model, SIGNAL(filterCountsChanged(
int,
int)),
34 this, SIGNAL(filterCountsChanged(
int,
int)));
42 PointTableModel::~PointTableModel() {
48 return getSortedItems(start, end, AbstractTreeModel::PointItems);
53 AbstractTreeItem *item1, AbstractTreeItem *item2) {
54 return getSortedItems(item1, item2, AbstractTreeModel::PointItems);
58 int PointTableModel::getVisibleRowCount()
const {
59 return getDataModel()->getVisibleItemCount(AbstractTreeModel::PointItems,
65 return getDataModel()->getSelectedItems(AbstractTreeModel::PointItems,
70 QString PointTableModel::getWarningMessage(AbstractTreeItem
const *row,
71 TableColumn
const *column, QString valueToSave)
const {
72 return getPointWarningMessage(row, column, valueToSave);
76 void PointTableModel::setGlobalSelection(
bool selected) {
77 return getDataModel()->setGlobalSelection(selected,
78 AbstractTreeModel::AllItems);
82 int PointTableModel::indexOfVisibleItem(
83 AbstractTreeItem
const *item)
const {
84 return getDataModel()->indexOfVisibleItem(item,
85 AbstractTreeModel::PointItems,
90 QString PointTableModel::getPointWarningMessage(
91 AbstractTreeItem
const *row, TableColumn
const *column,
92 QString valueToSave) {
93 QString colTitle = column->getTitle();
94 AbstractPointItem::Column colType =
95 AbstractPointItem::getColumn(colTitle);
100 case AbstractPointItem::EditLock:
101 if (valueToSave.toLower() ==
"no" &&
102 row->getFormattedData(colTitle).toLower() ==
"yes") {
103 warningText =
"Are you sure you want to unlock control point [" +
104 row->getFormattedData() +
"] for editing?";
107 case AbstractPointItem::APrioriSPLatSigma:
108 case AbstractPointItem::APrioriSPLonSigma:
109 case AbstractPointItem::APrioriSPRadiusSigma: {
110 ASSERT(row->getPointerType() == AbstractTreeItem::Point);
111 ControlPoint *point = (ControlPoint *) row->getPointer();
114 bool latSigmaValid = (point->GetAprioriSurfacePoint().
115 GetLatSigmaDistance().isValid());
116 bool lonSigmaValid = (point->GetAprioriSurfacePoint().
117 GetLonSigmaDistance().isValid());
118 bool radiusSigmaValid = (point->GetAprioriSurfacePoint().
119 GetLocalRadiusSigma().isValid());
121 if (!latSigmaValid && !lonSigmaValid && !radiusSigmaValid &&
122 valueToSave.toLower() !=
"null") {
123 warningText =
"The sigma values are currently null. The other " 124 "sigmas will be set to 10,000, which currently represents " 125 "'free'. Is this okay?";
129 case AbstractPointItem::APrioriSPLat:
130 case AbstractPointItem::APrioriSPLon:
131 case AbstractPointItem::APrioriSPRadius: {
132 ASSERT(row->getPointerType() == AbstractTreeItem::Point);
133 ControlPoint *point = (ControlPoint *) row->getPointer();
136 bool latValid = (point->GetAprioriSurfacePoint().
137 GetLatitude().isValid());
138 bool lonValid = (point->GetAprioriSurfacePoint().
139 GetLongitude().isValid());
140 bool radiusValid = (point->GetAprioriSurfacePoint().
141 GetLocalRadius().isValid());
143 if (!latValid && !lonValid && !radiusValid &&
144 valueToSave.toLower() !=
"null") {
145 warningText =
"Some of the a priori surface point values are " 146 "currently null. The surface point lat and lon will be set " 147 "to 0 if they are null, and the radius will be set to " 148 "10,000 if it is null. Is this okay?";
161 void PointTableModel::handleTreeSelectionChanged(
163 AbstractTableModel::handleTreeSelectionChanged(
164 newlySelectedItems, AbstractTreeItem::Point);
167 foreach (AbstractTreeItem * item, newlySelectedItems) {
168 if (item->getPointerType() == AbstractTreeItem::Measure) {
169 measureParentItems.append(item->parent());
173 if (measureParentItems.size()) {
174 AbstractTableModel::handleTreeSelectionChanged(
175 measureParentItems, AbstractTreeItem::Point);
180 TableColumnList *PointTableModel::createColumns() {
181 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.
Namespace for ISIS/Bullet specific routines.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.