anatomist  5.1.2
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 );
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 
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 );
171  anatomist::AObject* obj,
172  QTreeWidgetItem* parent );
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
#define slots
Specialized QTreeWidget class for AObjects / GenericObjects / attributes visualization / selection / ...
QTreeWidgetItem * itemFor(QTreeWidgetItem *parent, const std::string &firstfield)
Local search for string.
virtual QTreeWidgetItem * insertObject(QTreeWidgetItem *parent, anatomist::AObject *obj)
const std::map< QTreeWidgetItem *, carto::GenericObject * > & gObjects() const
std::map< int, ObjectHelper > ObjectHelperSet
map type to descriptor function
virtual void decorateItem(QTreeWidgetItem *item, anatomist::AObject *obj)
virtual void keyPressEvent(QKeyEvent *ev)
virtual ~QObjectBrowserWidget()
virtual void registerObject(anatomist::AObject *object, bool temporaryObject=false, int position=-1, bool showDetailsUponRegister=false)
Add an AObject to the objects.
std::map< QTreeWidgetItem *, ItemType > _itemTypes
virtual void registerAttribute(QTreeWidgetItem *item)
const std::map< QTreeWidgetItem *, ItemType > & types() const
static ObjectHelperSet objectHelpers
void(* ObjectHelper)(QObjectBrowserWidget *, anatomist::AObject *object, QTreeWidgetItem *parent)
virtual void updateObject(anatomist::AObject *obj)
Updates an object contents (after a change)
virtual void removeItem(QTreeWidgetItem *item)
Only removes the item reference and its children in the internal list, does not destroy the QTreeWidg...
QTreeWidgetItem * itemFor(const anatomist::AObject *obj)
Query for list view items: global search for AObject.
ItemType typeOf(QTreeWidgetItem *item) const
virtual void registerObject(carto::GenericObject *object)
Add an GenericObject to the objects.
virtual void updateObject(carto::GenericObject *obj)
Updates an GenericObject contents (after a change)
void whatIs(QTreeWidgetItem *item, ItemDescr &descr) const
Description of the given item.
QTreeWidgetItem * itemFor(QTreeWidgetItem *parent, const anatomist::AObject *obj)
Local search for AObject.
virtual void registerGObject(QTreeWidgetItem *item, carto::GenericObject *obj)
virtual void removeObject(QTreeWidgetItem *parent, anatomist::AObject *obj)
virtual void describeAObject(anatomist::AObject *obj, QTreeWidgetItem *parent)
virtual QTreeWidgetItem * insertObject(anatomist::AObject *obj)
static void describeGraph(QObjectBrowserWidget *br, anatomist::AObject *obj, QTreeWidgetItem *parent)
QTreeWidgetItem * itemFor(const carto::GenericObject *ao)
Global search for GenericObject.
virtual void clear()
const std::map< QTreeWidgetItem *, anatomist::AObject * > & aObjects() const
QObjectBrowserWidget(QWidget *parent, const char *name)
virtual void registerAObject(QTreeWidgetItem *item, anatomist::AObject *obj)
virtual void unregisterObject(carto::GenericObject *object)
Remove an GenericObject from the objects.
std::map< QTreeWidgetItem *, anatomist::AObject * > _aobjects
QTreeWidgetItem * itemFor(QTreeWidgetItem *parent, const carto::GenericObject *ao, bool regist=true)
Local search for GenericObject.
static void describeHierarchy(QObjectBrowserWidget *br, anatomist::AObject *obj, QTreeWidgetItem *parent)
QTreeWidgetItem * itemFor(QTreeWidgetItem *parent, ItemType type, const std::string &firstfield, bool regist=true)
Local search for type/string.
virtual void unregisterObject(anatomist::AObject *object)
Remove an AObject from the objects.
virtual void unregisterItem(QTreeWidgetItem *item)
Removes the given item and its children.
std::map< QTreeWidgetItem *, carto::GenericObject * > _gobjects
Base Anatomist object (abstract)
Definition: Object.h:96
Structure used for item description.
anatomist::AObject * tobj
Top parent Anatomist object (if any)
std::string att
Attribute name (if any)
anatomist::AObject * pobj
Direct parent Anatomist object (if any)
carto::GenericObject * ao
Attributed object (if any)
carto::GenericObject * tao
Top parent attributed object (if any)
ItemType ptype
Direct parent type (OTHER if none)
anatomist::AObject * obj
Anatomist object (if any)
ItemType ttype
Top parent type (or OTHER)
carto::GenericObject * pao
Direct parent attributed object (if any)