anatomist  5.1.2
3D neuroimaging data viewer
attDescr.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_ATTDESR_H
36 #define ANAQT_BROWSER_ATTDESR_H
37 
38 
40 #include <QPixmap>
41 
42 class Tree;
44 class QTreeWidgetItem;
45 
46 
47 namespace anatomist
48 {
49 
53  class AttDescr
54  {
55  public:
56  typedef void (*Helper)( QObjectBrowserWidget*,
57  const carto::GenericObject &,
58  const std::string &, std::string & output );
59  typedef void (*ListHelper)( QObjectBrowserWidget*,
60  const carto::GenericObject &,
61  const std::string &, QTreeWidgetItem* parent,
62  const AttDescr* ad, bool regist );
63  typedef std::map<std::string, Helper> HelperSet;
64  typedef std::map<std::string, ListHelper> ListHelperSet;
65 
67  virtual ~AttDescr();
68 
69  void describeAttributes( QObjectBrowserWidget* br, QTreeWidgetItem* parent,
70  const carto::GenericObject *ao,
71  bool regist = true,
72  bool checkexisting = true ) const;
73 
75  const carto::GenericObject* ao,
76  const std::string & semantic,
77  const std::string & type ) const;
79  const carto::GenericObject* ao,
80  const std::string & semantic,
81  const std::string & type, QTreeWidgetItem* parent,
82  bool regist = true, bool checkexisting = true ) const;
83  std::string objectName( const carto::GenericObject* ao ) const;
84 
85  void setSyntax( const carto::SyntaxSet & s );
86  void addSyntax( const carto::SyntaxSet & s );
87  void setHelpers( const HelperSet & help );
88  void addHelpers( const HelperSet & help );
89  void setListHelpers( const ListHelperSet & help );
90  void addListHelpers( const ListHelperSet & help );
91  const carto::SyntaxSet & syntaxSet() const { return( syntax ); }
92  const HelperSet & helperSet() const { return( helpers ); }
93  const ListHelperSet & listHelperSet() const { return( listHelpers ); }
94 
95  void describeTree( QObjectBrowserWidget* br, const Tree* tr,
96  QTreeWidgetItem* parent, bool regist = true ) const;
99  QTreeWidgetItem* parent, bool regist ) const;
102  const Tree* tr,
103  QTreeWidgetItem* parent ) const;
104  static void printError( QTreeWidgetItem* parent,
105  const std::string & semantic );
106 
108  const carto::GenericObject &,
109  const std::string &,
110  QTreeWidgetItem* parent, const AttDescr* gvw,
111  bool regist = true );
112  virtual void initHelpers();
113 
114  static AttDescr* descr() { return( _theAttDescr ); }
115  static QPixmap rgbPixmap( const QColor & col );
116 
117  protected:
120  const carto::GenericObject &,
121  const std::string &, std::string & output );
123  const carto::GenericObject &,
124  const std::string &, std::string & output );
126  const carto::GenericObject &,
127  const std::string &, std::string & output );
129  const carto::GenericObject &,
130  const std::string &, std::string & output );
132  const carto::GenericObject &,
133  const std::string &, std::string & output );
135  const carto::GenericObject &,
136  const std::string &, std::string & output );
138  const carto::GenericObject &,
139  const std::string &, std::string & output );
141  const carto::GenericObject &,
142  const std::string &, std::string & output );
144  const carto::GenericObject &,
145  const std::string &,
146  std::string & output );
147 
149 
153  };
154 
155 }
156 
157 #endif
Specialized QTreeWidget class for AObjects / GenericObjects / attributes visualization / selection / ...
Attributed object descriptor.
Definition: attDescr.h:54
static void printFloatVector(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
void setListHelpers(const ListHelperSet &help)
const carto::SyntaxSet & syntaxSet() const
Definition: attDescr.h:91
ListHelperSet listHelpers
Definition: attDescr.h:152
void addHelpers(const HelperSet &help)
static void printDoubleVector(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
void describeAttributes(QObjectBrowserWidget *br, QTreeWidgetItem *parent, const carto::GenericObject *ao, bool regist=true, bool checkexisting=true) const
static void printDouble(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
void printAttribute(QObjectBrowserWidget *br, const carto::GenericObject *ao, const std::string &semantic, const std::string &type, QTreeWidgetItem *parent, bool regist=true, bool checkexisting=true) const
void setSyntax(const carto::SyntaxSet &s)
const HelperSet & helperSet() const
Definition: attDescr.h:92
static AttDescr * descr()
Definition: attDescr.h:114
void describeTreeInside(QObjectBrowserWidget *br, const Tree *tr, QTreeWidgetItem *parent, bool regist) const
does not recreate the base tree
std::map< std::string, Helper > HelperSet
Definition: attDescr.h:63
static void printIntVector(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
static void printStringVectorPtr(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
void addListHelpers(const ListHelperSet &help)
static void printInt(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
Helpers.
static void printError(QTreeWidgetItem *parent, const std::string &semantic)
static void printFloat(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
static QPixmap rgbPixmap(const QColor &col)
void(* ListHelper)(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, QTreeWidgetItem *parent, const AttDescr *ad, bool regist)
Definition: attDescr.h:59
void addSyntax(const carto::SyntaxSet &s)
void(* Helper)(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
Definition: attDescr.h:56
void setHelpers(const HelperSet &help)
std::string printAttribute(QObjectBrowserWidget *br, const carto::GenericObject *ao, const std::string &semantic, const std::string &type) const
static void printStringVector(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
const ListHelperSet & listHelperSet() const
Definition: attDescr.h:93
std::map< std::string, ListHelper > ListHelperSet
Definition: attDescr.h:64
static void treeListHelper(QObjectBrowserWidget *br, const carto::GenericObject &, const std::string &, QTreeWidgetItem *parent, const AttDescr *gvw, bool regist=true)
static void printString(QObjectBrowserWidget *, const carto::GenericObject &, const std::string &, std::string &output)
HelperSet helpers
Definition: attDescr.h:151
void describeUnregisteredTreeInside(QObjectBrowserWidget *br, const Tree *tr, QTreeWidgetItem *parent) const
does not recreate the base tree
std::string objectName(const carto::GenericObject *ao) const
carto::SyntaxSet syntax
Definition: attDescr.h:150
void describeTree(QObjectBrowserWidget *br, const Tree *tr, QTreeWidgetItem *parent, bool regist=true) const
static AttDescr * _theAttDescr
Definition: attDescr.h:148
virtual void initHelpers()
std::map< std::string, Syntax > SyntaxSet