fw4spl
io/fwVtkIO/include/fwVtkIO/helper/Mesh.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwVtkIO/config.hpp"
10 
11 #include <fwData/Mesh.hpp>
12 
13 #include <vtkPolyData.h>
14 #include <vtkSmartPointer.h>
15 #include <vtkUnstructuredGrid.h>
16 
17 namespace fwVtkIO
18 {
19 
20 namespace helper
21 {
22 
26 class FWVTKIO_CLASS_API Mesh
27 {
28 
29 public:
30 
37  FWVTKIO_API static void fromVTKMesh( vtkSmartPointer<vtkPolyData> _polyData, ::fwData::Mesh::sptr _mesh );
45  FWVTKIO_API static void fromVTKGrid(vtkSmartPointer<vtkUnstructuredGrid> grid, ::fwData::Mesh::sptr mesh);
46 
53  FWVTKIO_API static void toVTKGrid( const ::fwData::Mesh::csptr& mesh, vtkSmartPointer<vtkUnstructuredGrid> grid);
54 
61  FWVTKIO_API static void toVTKMesh( const ::fwData::Mesh::csptr& _mesh, vtkSmartPointer<vtkPolyData> _polyData);
62 
74  FWVTKIO_API static void updatePolyDataPoints(vtkSmartPointer<vtkPolyData> polyDataDst,
75  const ::fwData::Mesh::csptr& meshSrc );
76 
86  FWVTKIO_API static void updatePolyDataPointColor(vtkSmartPointer<vtkPolyData> polyDataDst,
87  const ::fwData::Mesh::csptr& meshSrc);
88 
98  FWVTKIO_API static void updatePolyDataCellColor(vtkSmartPointer<vtkPolyData> polyDataDst,
99  const ::fwData::Mesh::csptr& meshSrc );
100 
110  FWVTKIO_API static void updatePolyDataPointNormals(vtkSmartPointer<vtkPolyData> polyDataDst,
111  const ::fwData::Mesh::csptr& meshSrc);
112 
122  FWVTKIO_API static void updatePolyDataCellNormals(vtkSmartPointer<vtkPolyData> polyDataDst,
123  const ::fwData::Mesh::csptr& meshSrc);
124 
132  FWVTKIO_API static void updatePolyDataPointTexCoords(
133  vtkSmartPointer<vtkPolyData> polyDataDst, const ::fwData::Mesh::csptr& meshSrc);
134 
142  FWVTKIO_API static void updatePolyDataCellTexCoords(
143  vtkSmartPointer<vtkPolyData> polyDataDst, const ::fwData::Mesh::csptr& meshSrc);
144 
156  FWVTKIO_API static void updateGridPoints(
157  vtkSmartPointer<vtkUnstructuredGrid> gridDst,
158  const ::fwData::Mesh::csptr& meshSrc );
159 
169  FWVTKIO_API static void updateGridPointColor(
170  vtkSmartPointer<vtkUnstructuredGrid> gridDst,
171  const ::fwData::Mesh::csptr& meshSrc);
172 
182  FWVTKIO_API static void updateGridCellColor(
183  vtkSmartPointer<vtkUnstructuredGrid> gridDst,
184  const ::fwData::Mesh::csptr& meshSrc );
185 
195  FWVTKIO_API static void updateGridPointNormals(
196  vtkSmartPointer<vtkUnstructuredGrid> gridDst,
197  const ::fwData::Mesh::csptr& meshSrc);
198 
208  FWVTKIO_API static void updateGridCellNormals(
209  vtkSmartPointer<vtkUnstructuredGrid> gridDst,
210  const ::fwData::Mesh::csptr& meshSrc);
211 
221  FWVTKIO_API static void updateGridPointTexCoords(
222  vtkSmartPointer<vtkUnstructuredGrid> gridDst, const ::fwData::Mesh::csptr& meshSrc);
223 
233  FWVTKIO_API static void updateGridCellTexCoords(
234  vtkSmartPointer<vtkUnstructuredGrid> gridDst, const ::fwData::Mesh::csptr& meshSrc);
235 
241  FWVTKIO_API static double computeVolume( const ::fwData::Mesh::csptr& mesh );
242 
243 };
244 
245 } // namespace helper
246 } // namespace fwVtkIO
Helper to manage vtkPolyData and fwData::Mesh.