3 #include "AbstractTreeItem.h" 8 #include <QFontMetrics> 16 #include "AbstractTableModel.h" 17 #include "TableColumn.h" 21 AbstractTreeItem::AbstractTreeItem(AbstractTreeItem *parent) : m_parentItem(
27 m_nextVisibleItem = NULL;
32 AbstractTreeItem::~AbstractTreeItem() {
33 m_nextVisibleItem = NULL;
38 AbstractTreeItem *AbstractTreeItem::parent()
const {
43 void AbstractTreeItem::setParent(AbstractTreeItem *newParent) {
44 m_parentItem = newParent;
48 int AbstractTreeItem::row()
const {
52 rowIndex = m_parentItem->indexOf(const_cast< AbstractTreeItem * >(
this));
58 QString AbstractTreeItem::getFormattedData()
const {
59 return catchNull(getData());
63 QString AbstractTreeItem::getFormattedData(QString columnTitle)
const {
64 return catchNull(getData(columnTitle));
68 AbstractTreeItem *AbstractTreeItem::getNextVisiblePeer()
const {
69 return m_nextVisibleItem;
73 void AbstractTreeItem::setNextVisiblePeer(AbstractTreeItem *next) {
74 m_nextVisibleItem = next;
78 bool AbstractTreeItem::hasPoint(ControlPoint *point)
const {
81 for (
int i = 0; !found && i < childCount(); i++)
82 found = childAt(i)->hasPoint(point);
88 bool AbstractTreeItem::hasMeasure(ControlMeasure *measure)
const {
91 for (
int i = 0; !found && i < childCount(); i++)
92 found = childAt(i)->hasMeasure(measure);
98 bool AbstractTreeItem::hasImage(QString imageSerial)
const {
101 for (
int i = 0; !found && i < childCount(); i++) {
102 found = childAt(i)->hasImage(imageSerial);
109 void AbstractTreeItem::setExpanded(
bool newState) {
110 m_expanded = newState;
113 bool AbstractTreeItem::isExpanded()
const {
118 void AbstractTreeItem::setSelected(
bool newState) {
119 m_selected = newState;
123 void AbstractTreeItem::setSelectable(
bool newSelectable) {
124 m_selectable = newSelectable;
128 bool AbstractTreeItem::isSelected()
const {
133 bool AbstractTreeItem::isSelectable()
const {
138 void AbstractTreeItem::setVisible(
bool newState) {
139 m_visible = newState;
143 bool AbstractTreeItem::isVisible()
const {
148 int AbstractTreeItem::getDataWidth()
const {
149 if (m_dataWidth == 0) {
150 IString msg =
"Children of AbstractTreeItem must call setDataWidth " 151 "with a non-zero width";
159 int AbstractTreeItem::getDepth()
const {
162 AbstractTreeItem *item = parent();
166 item = item->parent();
173 void AbstractTreeItem::setLastVisibleFilteredItem(AbstractTreeItem *item) {
174 IString msg =
"This tree item does not keep track of visible filtered " 180 const AbstractTreeItem *
181 AbstractTreeItem::getLastVisibleFilteredItem()
const {
186 void AbstractTreeItem::calcDataWidth(
int avgCharWidth) {
187 if (avgCharWidth <= 0) {
188 IString msg =
"calcDataWidth() expects a positive non-zero value.";
192 m_dataWidth = (avgCharWidth + 1) * getFormattedData().size();
196 QString AbstractTreeItem::catchNull(QVariant data) {
199 if (data.type() == QVariant::Double) {
200 double dblData = data.toDouble();
203 if (dblData !=
Null) {
205 result = locale.toString(dblData,
'f');
209 result = data.toString();
216 double AbstractTreeItem::catchNull(QString str) {
218 if (str.toLower() !=
"null") {
220 d = locale.toDouble(str);
const double Null
Value for an Isis Null pixel.
This error is for when a programmer made an API call that was illegal.
#define _FILEINFO_
Macro for the filename and line number.
Namespace for ISIS/Bullet specific routines.