anatomist 6.0.4
3D neuroimaging data viewer
texsurface.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 ANA_SURFACE_TEXSURFACE_H
36#define ANA_SURFACE_TEXSURFACE_H
37
38
40
41
42namespace anatomist
43{
44
45 class ATexSurface;
47
48
51 {
52 public:
53 friend class ATexSurface;
58 virtual BaseIterator *clone() const;
59 virtual bool operator != ( const BaseIterator & ) const;
60 virtual bool operator != ( const ATexSurfaceIterator & ) const;
61 virtual bool operator != ( const const_ATexSurfaceIterator & ) const;
62 virtual AObject *operator * () const;
65
66 protected:
69 int _no;
70 };
71
72
96
97
99class ATexSurface : public GLMObject
100{
101public:
103 virtual ~ATexSurface();
104
105 virtual int MType() const { return( AObject::TEXSURFACE ); }
106
107 virtual size_t size() const { return( 2 ); }
108 virtual iterator begin();
109 virtual const_iterator begin() const;
110 virtual iterator end();
111 virtual const_iterator end() const;
112 virtual const_iterator find( const AObject * ) const;
113
114 virtual bool CanRemove( AObject* ) { return( false ); }
115
116 virtual void update(const Observable* observable, void* arg);
117
118 virtual bool Is2DObject() { return _surf->Is2DObject(); }
119 virtual bool Is3DObject() { return true; }
120
121 virtual bool boundingBox( std::vector<float> & bmin,
122 std::vector<float> & bmax ) const;
123
124 AObject* surface() { return( _surf.get() ); }
125 const AObject* surface() const { return( _surf.get() ); }
126 AObject* texture() { return( _tex.get() ); }
127 const AObject* texture() const { return( _tex.get() ); }
128 virtual void setShaderParameters(const Shader &shader, const ViewState & state) const;
129
130 virtual Tree* optionTree() const;
132
133protected:
136
137private:
139 virtual void insert( AObject * ) {}
141 virtual void erase( iterator & ) {}
142};
143
144
145// Code
146
148{
149 return( x.operator != ( *this ) );
150}
151
152
153inline bool
155{
156 return( x.operator != ( *this ) );
157}
158
159
160inline bool
162{
163 return( _surf != x._surf || _tex != x._tex || _no != x._no );
164}
165
166
167inline bool
168const_ATexSurfaceIterator::operator !=
169( const const_ATexSurfaceIterator & x ) const
170{
171 return( _surf != x._surf || _tex != x._tex || _no != x._no );
172}
173
174
175inline bool
177{
178 return(true);
179}
180
181
182inline bool
184{
185 return(true);
186}
187
188
190{
191 AObject *res=NULL;
192 if (_no == 0) res = _surf.get();
193 if (_no == 1) res = _tex.get();
194
195 return( res );
196}
197
199{
200 AObject *res=NULL;
201 if (_no == 0) res = _surf.get();
202 if (_no == 1) res = _tex.get();
203
204 return( res );
205}
206
208{
209 ++_no;
210 return( *this );
211}
212
213
215{
216 ++_no;
217 return( *this );
218}
219
220
222{
223 --_no;
224 return( *this );
225}
226
227
229{
230 --_no;
231 return( *this );
232}
233
234
235
237{
238 return( new ATexSurfaceIterator( *this ) );
239}
240
241
243{
244 return( new const_ATexSurfaceIterator( *this ) );
245}
246
247
248}
249
250
251#endif
T * iterator
Base Anatomist object (abstract)
Definition Object.h:97
Textured surface iterator.
Definition texsurface.h:51
carto::rc_ptr< AObject > _tex
Definition texsurface.h:68
carto::rc_ptr< AObject > _surf
Definition texsurface.h:67
virtual ATexSurfaceIterator & operator++()
Definition texsurface.h:207
virtual bool operator!=(const BaseIterator &) const
Definition texsurface.h:147
virtual AObject * operator*() const
Definition texsurface.h:189
ATexSurfaceIterator(AObject *, AObject *, int)
ATexSurfaceIterator(carto::rc_ptr< AObject >, carto::rc_ptr< AObject >, int)
virtual BaseIterator * clone() const
Definition texsurface.h:236
ATexSurfaceIterator(const ATexSurfaceIterator &)
virtual ATexSurfaceIterator & operator--()
Definition texsurface.h:221
Fusion object merging a triangulation and a texture object.
Definition texsurface.h:100
const AObject * surface() const
Definition texsurface.h:125
virtual const_iterator begin() const
virtual iterator end()
virtual bool boundingBox(std::vector< float > &bmin, std::vector< float > &bmax) const
Fills bmin and bmax with the N-D bounding box extrema in the object's referential coordinates.
carto::rc_ptr< AObject > _tex
Definition texsurface.h:135
carto::rc_ptr< AObject > _surf
Definition texsurface.h:134
virtual void setShaderParameters(const Shader &shader, const ViewState &state) const
virtual bool CanRemove(AObject *)
Definition texsurface.h:114
static Tree * _optionTree
Definition texsurface.h:131
virtual const_iterator end() const
ATexSurface(AObject *surface, AObject *texture)
virtual size_t size() const
Definition texsurface.h:107
virtual bool Is3DObject()
Can be display in 3D windows.
Definition texsurface.h:119
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual int MType() const
Precise type of multi-object.
Definition texsurface.h:105
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
virtual const_iterator find(const AObject *) const
virtual iterator begin()
virtual bool Is2DObject()
Can be display in 2D windows.
Definition texsurface.h:118
const AObject * texture() const
Definition texsurface.h:127
AIterator const_iterator
Definition MObject.h:239
AIterator iterator
Definition MObject.h:238
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition Observable.h:68
Textured surface const_iterator.
Definition texsurface.h:75
virtual AObject * operator*() const
Definition texsurface.h:198
virtual bool operator!=(const BaseIterator &) const
Definition texsurface.h:154
carto::rc_ptr< AObject > _surf
Definition texsurface.h:92
const_ATexSurfaceIterator(const const_ATexSurfaceIterator &)
virtual const_ATexSurfaceIterator & operator++()
Definition texsurface.h:214
carto::rc_ptr< AObject > _tex
Definition texsurface.h:93
virtual const_ATexSurfaceIterator & operator--()
Definition texsurface.h:228
virtual BaseIterator * clone() const
Definition texsurface.h:242
const_ATexSurfaceIterator(carto::rc_ptr< AObject >, carto::rc_ptr< AObject >, int)
const_ATexSurfaceIterator(AObject *, AObject *, int)
ViewState holds information about how a view wants to see an object.
Definition viewstate.h:67