anatomist  5.1.2
3D neuroimaging data viewer
fusion2Dmesh.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 #ifndef ANA_SURFACE_FUSION2DMESH_H
35 #define ANA_SURFACE_FUSION2DMESH_H
36 
40 
41 namespace anatomist
42 {
46  class Fusion2DMesh : public ObjectVector, public Sliceable
47  {
48  public:
49  Fusion2DMesh( const std::vector<AObject *> & obj );
50  virtual ~Fusion2DMesh();
51 
52  virtual const GLComponent* glAPI() const
53  {
54  return this;
55  }
56  virtual GLComponent* glAPI()
57  {
58  return this;
59  }
60  virtual const Sliceable* sliceableAPI() const
61  {
62  return this;
63  }
65  {
66  return this;
67  }
68 
69  virtual bool Is2DObject()
70  {
71  return true;
72  }
73 
74  virtual bool render( PrimList &, const ViewState & );
75  virtual void update( const Observable *, void * );
76 
77  virtual const Material * glMaterial() const;
78  virtual unsigned glNumVertex( const ViewState & ) const;
79  virtual const GLfloat* glVertexArray( const ViewState & ) const;
80  virtual const GLfloat* glNormalArray( const ViewState & ) const;
81  virtual unsigned glPolygonSize( const ViewState & ) const;
82  virtual unsigned glNumPolygon( const ViewState & ) const;
83  virtual const GLuint* glPolygonArray( const ViewState & ) const;
84  virtual void glBeforeBodyGLL( const ViewState &, GLPrimitives & ) const;
85  virtual void glAfterBodyGLL( const ViewState &, GLPrimitives & ) const;
86  virtual std::vector<float> glMin2D() const;
87  virtual std::vector<float> glMax2D() const;
88  virtual const Referential * getReferential() const;
89  virtual void SetMaterial( const Material & );
90  virtual Material & GetMaterial();
91  virtual void setVoxelSize( const std::vector<float> & );
92  virtual std::vector<float> voxelSize() const;
93  virtual bool boundingBox2D( std::vector<float> & bmin,
94  std::vector<float> & bmax ) const
95  { return boundingBox( bmin, bmax ); }
96 
98  Point4df getPlane( const ViewState & ) const;
99 
102 
105 
106  private:
107  ASurface<2> * _mergedSurface;
108  std::vector<float> _voxelSize;
109  };
110 }
111 
112 #endif
Anatomist object which contains several meshes: it displays the mesh polygons that intersect the curr...
Definition: fusion2Dmesh.h:47
virtual const GLfloat * glVertexArray(const ViewState &) const
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
virtual const Material * glMaterial() const
void updateMergedSurface(const ViewState &)
Updates the merged surface according to the surface object list and the current plane.
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
Definition: fusion2Dmesh.h:93
virtual const Referential * getReferential() const
virtual void glAfterBodyGLL(const ViewState &, GLPrimitives &) const
GL list to execute after the body is rendered.
virtual bool Is2DObject()
Can be display in 2D windows.
Definition: fusion2Dmesh.h:69
virtual void update(const Observable *, void *)
This class is an Observer of each of the AObject it groups.
virtual std::vector< float > glMin2D() const
virtual void SetMaterial(const Material &)
virtual Sliceable * sliceableAPI()
Definition: fusion2Dmesh.h:64
virtual unsigned glNumPolygon(const ViewState &) const
virtual const GLComponent * glAPI() const
Definition: fusion2Dmesh.h:52
virtual const Sliceable * sliceableAPI() const
Definition: fusion2Dmesh.h:60
virtual const GLfloat * glNormalArray(const ViewState &) const
normals array (optional), default=0 (no normals, flat shaded faces)
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
virtual Material & GetMaterial()
Fusion2DMesh(const std::vector< AObject * > &obj)
virtual unsigned glPolygonSize(const ViewState &) const
number of vertices per polygon (default = 3: triangles)
bool needMergedSurfaceUpdate() const
Returns true if the merged surface needs to be updated and false otherwise.
virtual unsigned glNumVertex(const ViewState &) const
virtual std::vector< float > glMax2D() const
virtual const GLuint * glPolygonArray(const ViewState &) const
virtual void setVoxelSize(const std::vector< float > &)
Point4df getPlane(const ViewState &) const
Gets the current slice plane.
virtual void glBeforeBodyGLL(const ViewState &, GLPrimitives &) const
GL list to execute before the body is rendered.
virtual GLComponent * glAPI()
Definition: fusion2Dmesh.h:56
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition: glcomponent.h:67
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.
This class has to be rewritten, it's really really a shame.......
Definition: Material.h:48
it's a list, in fact...
Definition: objectVector.h:212
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
Referential: marker for transformations, with an associated color.
Definition: Referential.h:55
Sliceable objects can draw themselves in a 2D texture.
Definition: sliceable.h:59
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
std::list< RefGLItem > GLPrimitives
Definition: primitive.h:156
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67