Isis Developer Reference
AbstractTreeItem.h
Go to the documentation of this file.
1 #ifndef AbstractTreeItem_H
2 #define AbstractTreeItem_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QObject>
13 
14 class QFontMetrics;
15 template< typename T > class QList;
16 class QString;
17 class QVariant;
18 
19 
20 namespace Isis {
21  class ControlPoint;
22  class ControlMeasure;
23 
39  class AbstractTreeItem : public QObject {
40 
41  Q_OBJECT
42 
43  public:
49  };
50 
51 
52  public:
54  virtual ~AbstractTreeItem();
55 
56  AbstractTreeItem *parent() const;
57  void setParent(AbstractTreeItem *newParent);
58 
59  int row() const;
60 
61  // These methods are designed to be implemented either by
62  // AbstractParentItem or AbstractLeafItem.
63  virtual void addChild(AbstractTreeItem *child) = 0;
65  virtual AbstractTreeItem *childAt(int row) const = 0;
66  virtual int childCount() const = 0;
67  virtual AbstractTreeItem *getFirstVisibleChild() const = 0;
68  virtual AbstractTreeItem *getLastVisibleChild() const = 0;
69  virtual int indexOf(AbstractTreeItem *child) const = 0;
70  virtual void setFirstVisibleChild(AbstractTreeItem *child) = 0;
71  virtual void setLastVisibleChild(AbstractTreeItem *child) = 0;
72 
73  // These methods are designed to be implemented either by
74  // AbstractPointItem, AbstractMeasureItem, AbstractSerialItem,
75  // or AbstractNullDataItem.
76  virtual QVariant getData() const = 0;
77  virtual QVariant getData(QString columnTitle) const = 0;
78  virtual void setData(QString const &columnTitle,
79  QString const &newData) = 0;
80  virtual bool isDataEditable(QString columnTitle) const = 0;
81  virtual void deleteSource() = 0;
82  virtual InternalPointerType getPointerType() const = 0;
83  virtual void *getPointer() const = 0;
84 
85  // There are things that every AbstractTreeItem can do.
86  virtual QString getFormattedData() const;
87  virtual QString getFormattedData(QString columnTitle) const;
88 
89  virtual bool hasMeasure(ControlMeasure *) const;
90  virtual bool hasImage(QString imageSerial) const;
91  virtual bool hasPoint(ControlPoint *) const;
92 
93  virtual AbstractTreeItem *getNextVisiblePeer() const;
94  virtual void setNextVisiblePeer(AbstractTreeItem *next);
95 
96  virtual void setExpanded(bool newState);
97  virtual bool isExpanded() const;
98 
99  virtual void setSelected(bool newState);
100  virtual void setSelectable(bool newSelectable);
101  virtual bool isSelected() const;
102  virtual bool isSelectable() const;
103 
104  virtual void setVisible(bool newState);
105  virtual bool isVisible() const;
106 
107  virtual int getDataWidth() const;
108  virtual int getDepth() const;
109 
110  virtual void setLastVisibleFilteredItem(AbstractTreeItem *item);
111  virtual const AbstractTreeItem *getLastVisibleFilteredItem() const;
112 
113  protected slots:
114  virtual void sourceDeleted() = 0;
115 
116  protected:
117  virtual void calcDataWidth(int avgCharWidth);
118  static double catchNull(QString);
119  static QString catchNull(QVariant);
120 
121 
122  // disable copying of this class
123  private:
125  AbstractTreeItem &operator=(AbstractTreeItem const &);
126 
127 
128  private:
129  AbstractTreeItem *m_nextVisibleItem;
130  AbstractTreeItem *m_parentItem;
131  bool m_expanded;
132  bool m_selectable;
133  bool m_selected;
134  bool m_visible;
135  int m_dataWidth;
136  };
137 }
138 
139 #endif
Isis::AbstractTreeItem::getData
virtual QVariant getData() const =0
Isis::AbstractTreeItem::Point
@ Point
Definition: AbstractTreeItem.h:46
Isis::AbstractTreeItem::setLastVisibleChild
virtual void setLastVisibleChild(AbstractTreeItem *child)=0
Isis::AbstractTreeItem::indexOf
virtual int indexOf(AbstractTreeItem *child) const =0
Isis::AbstractTreeItem::childAt
virtual AbstractTreeItem * childAt(int row) const =0
Isis::AbstractTreeItem::setFirstVisibleChild
virtual void setFirstVisibleChild(AbstractTreeItem *child)=0
Isis::AbstractTreeItem::getFirstVisibleChild
virtual AbstractTreeItem * getFirstVisibleChild() const =0
Isis::AbstractTreeItem::parent
AbstractTreeItem * parent() const
Definition: AbstractTreeItem.cpp:46
TableColumn.h
Isis::AbstractTreeItem::setSelectable
virtual void setSelectable(bool newSelectable)
Definition: AbstractTreeItem.cpp:131
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::AbstractTreeItem::hasImage
virtual bool hasImage(QString imageSerial) const
Definition: AbstractTreeItem.cpp:106
SpecialPixel.h
Isis::AbstractTreeItem::Measure
@ Measure
Definition: AbstractTreeItem.h:47
AbstractTableModel.h
Isis::AbstractTreeItem::~AbstractTreeItem
virtual ~AbstractTreeItem()
Definition: AbstractTreeItem.cpp:40
Isis::AbstractTreeItem::AbstractTreeItem
AbstractTreeItem(AbstractTreeItem *parent=0)
Definition: AbstractTreeItem.cpp:29
Isis::AbstractTreeItem::isSelectable
virtual bool isSelectable() const
Definition: AbstractTreeItem.cpp:141
Isis::AbstractTreeItem::getNextVisiblePeer
virtual AbstractTreeItem * getNextVisiblePeer() const
Definition: AbstractTreeItem.cpp:76
Isis::AbstractTreeItem::row
int row() const
Definition: AbstractTreeItem.cpp:56
Isis::AbstractTreeItem::hasPoint
virtual bool hasPoint(ControlPoint *) const
Definition: AbstractTreeItem.cpp:86
IString.h
Isis::AbstractTreeItem::setExpanded
virtual void setExpanded(bool newState)
Definition: AbstractTreeItem.cpp:117
Isis::AbstractTreeItem::setSelected
virtual void setSelected(bool newState)
Definition: AbstractTreeItem.cpp:126
Isis::AbstractTreeItem::isSelected
virtual bool isSelected() const
Definition: AbstractTreeItem.cpp:136
Isis::AbstractTreeItem::isDataEditable
virtual bool isDataEditable(QString columnTitle) const =0
Isis::ControlPoint
A single control point.
Definition: ControlPoint.h:354
Isis::AbstractTreeItem::setData
virtual void setData(QString const &columnTitle, QString const &newData)=0
Isis::Double
@ Double
Definition: PixelType.h:36
Isis::AbstractTreeItem::calcDataWidth
virtual void calcDataWidth(int avgCharWidth)
Definition: AbstractTreeItem.cpp:194
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::AbstractTreeItem::getLastVisibleChild
virtual AbstractTreeItem * getLastVisibleChild() const =0
AbstractTreeItem.h
Isis::AbstractTreeItem::getChildren
virtual QList< AbstractTreeItem * > getChildren() const =0
Isis::AbstractTreeItem::setVisible
virtual void setVisible(bool newState)
Definition: AbstractTreeItem.cpp:146
Isis::AbstractTreeItem::deleteSource
virtual void deleteSource()=0
Isis::AbstractTreeItem::getDataWidth
virtual int getDataWidth() const
Definition: AbstractTreeItem.cpp:156
Isis::AbstractTreeItem::setParent
void setParent(AbstractTreeItem *newParent)
Definition: AbstractTreeItem.cpp:51
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::AbstractTreeItem::addChild
virtual void addChild(AbstractTreeItem *child)=0
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::AbstractTreeItem::getFormattedData
virtual QString getFormattedData() const
Definition: AbstractTreeItem.cpp:66
Isis::AbstractTreeItem::isVisible
virtual bool isVisible() const
Definition: AbstractTreeItem.cpp:151
Isis::AbstractTreeItem::getData
virtual QVariant getData(QString columnTitle) const =0
Isis::AbstractTreeItem::getDepth
virtual int getDepth() const
Definition: AbstractTreeItem.cpp:167
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::AbstractTreeItem::None
@ None
Definition: AbstractTreeItem.h:45
Isis::AbstractTreeItem::catchNull
static double catchNull(QString)
Definition: AbstractTreeItem.cpp:224
Isis::AbstractTreeItem::hasMeasure
virtual bool hasMeasure(ControlMeasure *) const
Definition: AbstractTreeItem.cpp:96
Isis::AbstractTreeItem::getPointer
virtual void * getPointer() const =0
Isis::AbstractTreeItem::getLastVisibleFilteredItem
virtual const AbstractTreeItem * getLastVisibleFilteredItem() const
Definition: AbstractTreeItem.cpp:189
Isis::AbstractTreeItem::ImageAndNet
@ ImageAndNet
Definition: AbstractTreeItem.h:48
Isis::AbstractTreeItem::childCount
virtual int childCount() const =0
Isis::AbstractTreeItem::getPointerType
virtual InternalPointerType getPointerType() const =0
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::AbstractTreeItem::sourceDeleted
virtual void sourceDeleted()=0
QObject
Isis::AbstractTreeItem::setLastVisibleFilteredItem
virtual void setLastVisibleFilteredItem(AbstractTreeItem *item)
Definition: AbstractTreeItem.cpp:181
Isis::AbstractTreeItem::setNextVisiblePeer
virtual void setNextVisiblePeer(AbstractTreeItem *next)
Definition: AbstractTreeItem.cpp:81
IsisDebug.h
Isis::AbstractTreeItem
Base class for an item in the tree.
Definition: AbstractTreeItem.h:39
Isis::AbstractTreeItem::isExpanded
virtual bool isExpanded() const
Definition: AbstractTreeItem.cpp:121
Isis::AbstractTreeItem::InternalPointerType
InternalPointerType
Definition: AbstractTreeItem.h:44
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ControlMeasure
a control measurement
Definition: ControlMeasure.h:175