7 #ifndef __FWDATA_MESH_HPP__ 8 #define __FWDATA_MESH_HPP__ 10 #include "fwData/Array.hpp" 11 #include "fwData/config.hpp" 12 #include "fwData/Exception.hpp" 13 #include "fwData/factory/new.hpp" 17 #include <boost/multi_array.hpp> 19 fwCampAutoDeclareDataMacro((
fwData)(Mesh), FWDATA_API);
81 typedef std::map< std::string, ::fwData::Array::sptr > ArrayMapType;
82 typedef std::uint64_t Id;
101 typedef float PointValueType;
102 typedef std::uint8_t ColorValueType;
103 typedef float NormalValueType;
104 typedef float TexCoordValueType;
105 typedef Id CellValueType;
106 typedef Id CellDataOffsetType;
107 typedef std::uint8_t CellTypes;
109 typedef boost::multi_array_ref<PointValueType, 2> PointsMultiArrayType;
110 typedef boost::multi_array_ref<CellTypes, 1> CellTypesMultiArrayType;
111 typedef boost::multi_array_ref<CellValueType, 1> CellDataMultiArrayType;
112 typedef boost::multi_array_ref<CellDataOffsetType, 1> CellDataOffsetsMultiArrayType;
113 typedef boost::multi_array_ref<ColorValueType, 2> PointColorsMultiArrayType;
114 typedef boost::multi_array_ref<ColorValueType, 2> CellColorsMultiArrayType;
115 typedef boost::multi_array_ref<NormalValueType, 2> PointNormalsMultiArrayType;
116 typedef boost::multi_array_ref<NormalValueType, 2> CellNormalsMultiArrayType;
117 typedef boost::multi_array_ref<TexCoordValueType, 2> PointTexCoordsMultiArrayType;
118 typedef boost::multi_array_ref<TexCoordValueType, 2> CellTexCoordsMultiArrayType;
120 typedef boost::const_multi_array_ref<PointValueType, 2> ConstPointsMultiArrayType;
121 typedef boost::const_multi_array_ref<CellTypes, 1> ConstCellTypesMultiArrayType;
122 typedef boost::const_multi_array_ref<CellValueType, 1> ConstCellDataMultiArrayType;
123 typedef boost::const_multi_array_ref<CellDataOffsetType, 1> ConstCellDataOffsetsMultiArrayType;
124 typedef boost::const_multi_array_ref<ColorValueType, 2> ConstPointColorsMultiArrayType;
125 typedef boost::const_multi_array_ref<ColorValueType, 2> ConstCellColorsMultiArrayType;
126 typedef boost::const_multi_array_ref<NormalValueType, 2> ConstPointNormalsMultiArrayType;
127 typedef boost::const_multi_array_ref<NormalValueType, 2> ConstCellNormalsMultiArrayType;
128 typedef boost::const_multi_array_ref<TexCoordValueType, 2> ConstPointTexCoordsMultiArrayType;
129 typedef boost::const_multi_array_ref<TexCoordValueType, 2> ConstCellTexCoordsMultiArrayType;
138 FWDATA_API
virtual ~
Mesh();
141 FWDATA_API
void shallowCopy(
const Object::csptr& _source )
override;
144 FWDATA_API
void cachedDeepCopy(
const Object::csptr& _source, DeepCopyCacheType& cache)
override;
160 FWDATA_API
size_t allocate(
size_t nbPts,
size_t nbCells,
size_t nbCellsData = 0);
163 FWDATA_API
size_t allocatePointNormals();
166 FWDATA_API
size_t allocatePointColors(ColorArrayTypes t);
169 FWDATA_API
size_t allocatePointTexCoords();
172 FWDATA_API
size_t allocateCellNormals();
175 FWDATA_API
size_t allocateCellColors(ColorArrayTypes t);
178 FWDATA_API
size_t allocateCellTexCoords();
193 FWDATA_API
bool adjustAllocatedMemory();
196 FWDATA_API
void setPointsArray (const ::fwData::Array::sptr& array);
198 FWDATA_API
void setCellTypesArray (const ::fwData::Array::sptr& array);
200 FWDATA_API
void setCellDataArray (const ::fwData::Array::sptr& array);
202 FWDATA_API
void setCellDataOffsetsArray (const ::fwData::Array::sptr& array);
204 FWDATA_API
void setPointColorsArray (const ::fwData::Array::sptr& array);
206 FWDATA_API
void setCellColorsArray (const ::fwData::Array::sptr& array);
208 FWDATA_API
void setPointNormalsArray (const ::fwData::Array::sptr& array);
210 FWDATA_API
void setCellNormalsArray (const ::fwData::Array::sptr& array);
212 FWDATA_API
void setPointTexCoordsArray (const ::fwData::Array::sptr& array);
214 FWDATA_API
void setCellTexCoordsArray (const ::fwData::Array::sptr& array);
217 FWDATA_API ::fwData::Array::sptr getPointsArray ()
const;
219 FWDATA_API ::fwData::Array::sptr getCellTypesArray ()
const;
221 FWDATA_API ::fwData::Array::sptr getCellDataArray ()
const;
223 FWDATA_API ::fwData::Array::sptr getCellDataOffsetsArray ()
const;
225 FWDATA_API ::fwData::Array::sptr getPointColorsArray ()
const;
227 FWDATA_API ::fwData::Array::sptr getCellColorsArray ()
const;
229 FWDATA_API ::fwData::Array::sptr getPointNormalsArray ()
const;
231 FWDATA_API ::fwData::Array::sptr getCellNormalsArray ()
const;
233 FWDATA_API ::fwData::Array::sptr getPointTexCoordsArray ()
const;
235 FWDATA_API ::fwData::Array::sptr getCellTexCoordsArray ()
const;
241 FWDATA_API
void clearPoints();
247 FWDATA_API
void clearCells();
252 FWDATA_API
void clear();
255 FWDATA_API
void clearPointNormals();
257 FWDATA_API
void clearPointColors();
259 FWDATA_API
void clearPointTexCoords();
261 FWDATA_API
void clearCellNormals();
263 FWDATA_API
void clearCellColors();
265 FWDATA_API
void clearCellTexCoords();
268 FWDATA_API
void setNumberOfPoints(Id nb);
271 FWDATA_API Id getNumberOfPoints()
const;
274 FWDATA_API
void setNumberOfCells(Id nb);
277 FWDATA_API Id getNumberOfCells()
const;
280 FWDATA_API
void setCellDataSize(Id nb);
283 FWDATA_API Id getCellDataSize()
const;
290 FWDATA_API
size_t getDataSizeInBytes()
const;
298 FWDATA_API
size_t getAllocatedSizeInBytes()
const;
301 FWDATA_API
void addDataArray(
const std::string& name, ::fwData::Array::sptr array);
304 FWDATA_API ::fwData::Array::sptr getDataArray(
const std::string& name)
const;
307 FWDATA_API
void removeDataArray(
const std::string& name);
310 FWDATA_API std::vector<std::string> getDataArrayNames()
const;
368 FWDATA_API
void initArrays();
463 #endif // __FWDATA_MESH_HPP__ ::fwCom::Signal< void() > VertexModifiedSignalType
Type of signal when vertex are modified.
Id m_cellsDataSize
Number of point index defined for mesh (size of m_cellData)
::fwData::Array::sptr m_pointNormals
Mesh point array : 3-components 1-dimension uint8_t array, size = m_nbPoints.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_NORMALS_MODIFIED_SIG
Key in m_signals map of signal m_sigPointNormalsModified.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
This file defines fwCore base macros.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_COLORS_MODIFIED_SIG
Key in m_signals map of signal m_sigCellColorsModified.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_NORMALS_MODIFIED_SIG
Key in m_signals map of signal m_sigCellNormalsModified.
::fwData::Array::sptr m_cellDataOffsets
Cell data offsets array : 1-components 1-dimension uint64 array, size = m_nbCells.
::fwData::Array::sptr m_cellTexCoords
Mesh texCoord array : 2-components 1-dimension float array, size = m_nbCells.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_TEX_COORDS_MODIFIED_SIG
Key in m_signals map of signal m_sigPointTexCoorddModified.
::fwCom::Signal< void() > PointTexCoordsModifiedSignalType
Type of signal when point tex coords are modified.
Id m_nbCells
Number of cells defined for the mesh.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
::fwData::Array::sptr m_pointColors
point colors array : 3 or 4-components 1-dimension float array, size = m_nbPoints.
::fwCom::Signal< void() > CellNormalsModifiedSignalType
Type of signal when cell normals are modified.
::fwCom::Signal< void() > PointNormalsModifiedSignalType
Type of signal when point normals are modified.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_TEX_COORDS_MODIFIED_SIG
Key in m_signals map of signal m_sigCellTexCoorddModified.
Base class for each data object.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VERTEX_MODIFIED_SIG
Key in m_signals map of signal m_sigVertexModified.
::fwCom::Signal< void() > CellColorsModifiedSignalType
Type of signal when cell colors are modified.
::fwData::Array::sptr m_pointTexCoords
Mesh texCoord array : 2-components 1-dimension float array, size = m_nbPoints.
Id m_nbPoints
Number of points defined for the mesh.
::fwData::Array::sptr m_cellData
Cell data array : 1-components 1-dimension uint64 array, size = m_cellsDataSize.
ArrayMapType m_arrayMap
Array map where you can add few additional arrays registered thanks to a key to perform/conserve some...
Contains the representation of the data objects used in the framework.
::fwData::Array::sptr m_points
Mesh point array : 3-components 1-dimension float array, size = m_nbPoints x 3.
::fwData::Array::sptr m_cellNormals
Mesh point array : 3-components 1-dimension float array, size = m_nbCells.
::fwCom::Signal< void() > PointColorsModifiedSignalType
Type of signal when point colors are modified.
Data holding a geometric structure composed of points, lines, triangles, quads or polygons...
::fwData::Array::sptr m_cellColors
Mesh point array : 3 or 4-components 1-dimension uint8_t array, size = m_nbCells. ...
::fwData::Array::sptr m_cellTypes
Cell types array : 1-components 1-dimension uint8 array, size = m_nbCells.
::fwCom::Signal< void() > CellTexCoordsModifiedSignalType
Type of signal when cell tex coords are modified.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_COLORS_MODIFIED_SIG
Key in m_signals map of signal m_sigPointColorsModified.