anatomist  4.7.0
3D neuroimaging data viewer
qObjBrowserWid.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANAQT_BROWSER_QOBJBROWSERWID_H
36 #define ANAQT_BROWSER_QOBJBROWSERWID_H
37 
38 
41 
42 class Graph;
43 
44 
45 namespace anatomist
46 {
47  class AObject;
48  class Hierarchy;
49 }
50 
51 
56 {
57  Q_OBJECT
58 
59 public:
60  typedef void (*ObjectHelper)( QObjectBrowserWidget*,
61  anatomist::AObject* object,
62  QTreeWidgetItem* parent );
64  typedef std::map<int, ObjectHelper> ObjectHelperSet;
65  enum ItemType
66  {
71  OTHER
72  };
74  struct ItemDescr
75  {
79  std::string att;
96 
97  };
98 
99  QObjectBrowserWidget( QWidget* parent, const char* name );
100  virtual ~QObjectBrowserWidget();
101 
102  virtual void clear();
104  virtual void registerObject( anatomist::AObject* object,
105  bool temporaryObject = false,
106  int position = -1,
107  bool showDetailsUponRegister = false );
109  virtual void unregisterObject( anatomist::AObject* object );
111  virtual void updateObject( anatomist::AObject* obj );
113  virtual void registerObject( carto::GenericObject* object );
115  virtual void unregisterObject( carto::GenericObject* object );
117  virtual void updateObject( carto::GenericObject* obj );
119  virtual void unregisterItem( QTreeWidgetItem* item )
120  { removeItem( item ); delete item; }
121  const std::map<QTreeWidgetItem *, anatomist::AObject *> & aObjects() const
122  { return( _aobjects ); }
123  const std::map<QTreeWidgetItem *, carto::GenericObject *>
124  & gObjects() const
125  { return( _gobjects ); }
126  const std::map<QTreeWidgetItem *, ItemType> & types() const
127  { return( _itemTypes ); }
128  ItemType typeOf( QTreeWidgetItem * item ) const;
129  virtual void describeAObject( anatomist::AObject* obj,
130  QTreeWidgetItem* parent );
131  virtual QTreeWidgetItem* insertObject( QTreeWidgetItem* parent,
132  anatomist::AObject* obj );
133  virtual void registerAttribute( QTreeWidgetItem* item );
134  virtual void registerAObject( QTreeWidgetItem* item, anatomist::AObject* obj );
135  virtual void registerGObject( QTreeWidgetItem* item,
136  carto::GenericObject* obj );
138  QTreeWidgetItem* itemFor( const anatomist::AObject* obj );
140  QTreeWidgetItem* itemFor( QTreeWidgetItem* parent,
141  const anatomist::AObject* obj );
143  QTreeWidgetItem* itemFor( const carto::GenericObject* ao );
145  QTreeWidgetItem* itemFor( QTreeWidgetItem* parent,
146  const carto::GenericObject* ao,
147  bool regist = true );
149  QTreeWidgetItem* itemFor( QTreeWidgetItem* parent, ItemType type,
150  const std::string & firstfield, bool regist = true );
152  QTreeWidgetItem* itemFor( QTreeWidgetItem* parent,
153  const std::string & firstfield );
155  void whatIs( QTreeWidgetItem* item, ItemDescr & descr ) const;
156 
157  static ObjectHelperSet objectHelpers;
158 
159 public slots:
160 
161 signals:
162 
163 protected:
164  virtual QTreeWidgetItem* insertObject( anatomist::AObject* obj );
165  virtual void removeObject( QTreeWidgetItem* parent, anatomist::AObject* obj );
168  virtual void removeItem( QTreeWidgetItem* item );
169  virtual void decorateItem( QTreeWidgetItem* item, anatomist::AObject* obj );
170  static void describeGraph( QObjectBrowserWidget* br,
171  anatomist::AObject* obj,
172  QTreeWidgetItem* parent );
173  static void describeHierarchy( QObjectBrowserWidget* br,
174  anatomist::AObject* obj,
175  QTreeWidgetItem* parent );
176  virtual void keyPressEvent( QKeyEvent* ev );
177 
178  std::map<QTreeWidgetItem *, ItemType> _itemTypes;
179  std::map<QTreeWidgetItem *, anatomist::AObject *> _aobjects;
180  std::map<QTreeWidgetItem *, carto::GenericObject *> _gobjects;
182 
183 private:
184 };
185 
186 
187 #endif
anatomist::AObject * tobj
Top parent Anatomist object (if any)
Base Anatomist object (abstract)
Definition: Object.h:95
virtual void unregisterItem(QTreeWidgetItem *item)
Removes the given item and its children.
ItemType ttype
Top parent type (or OTHER)
ItemType ptype
Direct parent type (OTHER if none)
carto::GenericObject * tao
Top parent attributed object (if any)
static ObjectHelperSet objectHelpers
#define slots
Specialized QTreeWidget class for AObjects / GenericObjects / attributes visualization / selection / ...
carto::GenericObject * ao
Attributed object (if any)
carto::GenericObject * pao
Direct parent attributed object (if any)
anatomist::AObject * obj
Anatomist object (if any)
std::map< int, ObjectHelper > ObjectHelperSet
map type to descriptor function
std::string att
Attribute name (if any)
std::map< QTreeWidgetItem *, carto::GenericObject * > _gobjects
Structure used for item description.
const std::map< QTreeWidgetItem *, anatomist::AObject * > & aObjects() const
const std::map< QTreeWidgetItem *, carto::GenericObject * > & gObjects() const
anatomist::AObject * pobj
Direct parent Anatomist object (if any)
std::map< QTreeWidgetItem *, ItemType > _itemTypes
std::map< QTreeWidgetItem *, anatomist::AObject * > _aobjects
const std::map< QTreeWidgetItem *, ItemType > & types() const