import.h 6.81 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23 24 25 26 27
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __IMPORT_H__
#define __IMPORT_H__

28 29 30 31
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/cellmarker.h"
#include "Topology/generic/dartmarker.h"

Pierre Kraemer's avatar
Pierre Kraemer committed
32 33 34 35 36 37 38 39
#include "Algo/Import/import2tables.h"

namespace CGoGN
{

namespace Algo
{

40 41 42
namespace Surface
{

Pierre Kraemer's avatar
Pierre Kraemer committed
43 44 45 46 47 48
namespace Import 
{

/**
* import a mesh
* @param map the map in which the function imports the mesh
Pierre Kraemer's avatar
Pierre Kraemer committed
49
* @param filename
50
* @param attrNames attribute names
Pierre Kraemer's avatar
Pierre Kraemer committed
51
* @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
Thomas's avatar
Thomas committed
52
* @return a boolean indicating if import was successful
Pierre Kraemer's avatar
Pierre Kraemer committed
53 54
*/
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
55
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, bool mergeCloseVertices = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
56

Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59 60 61 62 63 64 65 66
/**
* import a voxellisation
* @param map the map in which the function imports the mesh
* @param voxellisation
* @param attrNames attribute names
* @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
* @return a boolean indicating if import was successful
*/
template <typename PFP>
bool importVoxellisation(typename PFP::MAP& map, Algo::Surface::Modelisation::Voxellisation& voxellisation, std::vector<std::string>& attrNames, bool mergeCloseVertices=false);
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86

/**
 * import a Choupi file
 * @param map
 * @param filename
 * @return
 */
template <typename PFP>
bool importChoupi(const std::string& filename, const std::vector<typename PFP::VEC3>& tabV, const std::vector<unsigned int>& tabE);

} // namespace Import

} // Surface


namespace Volume
{
namespace Import
{

Pierre Kraemer's avatar
Pierre Kraemer committed
87
/**
88
 * import a volumetric mesh
89
 * @param map the map in which the function imports the mesh
Pierre Kraemer's avatar
Pierre Kraemer committed
90
 * @param filename
91
 * @param attrNames attribute names
Pierre Kraemer's avatar
Pierre Kraemer committed
92
 * @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
Thomas's avatar
Thomas committed
93
 * @return a boolean indicating if import was successful
Pierre Kraemer's avatar
Pierre Kraemer committed
94
 */
95
template <typename PFP>
96
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, bool mergeCloseVertices = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
97

98
/**
Thomas's avatar
Thomas committed
99
 * import a mesh and extrude it
100
 * @param map the map in which the function imports the mesh
Pierre Kraemer's avatar
Pierre Kraemer committed
101
 * @param filename
102
 * @param attrNames attribute names
Pierre Kraemer's avatar
Pierre Kraemer committed
103
 * @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
Thomas's avatar
Thomas committed
104
 * @return a boolean indicating if import was successful
105
 */
106
template <typename PFP>
107 108 109 110
bool importMeshToExtrude(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, float scale = 5.0f, unsigned int nbStage = 1);

template <typename PFP>
bool importMeshSAsV(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames);
Pierre Kraemer's avatar
Pierre Kraemer committed
111

Pierre Kraemer's avatar
Pierre Kraemer committed
112 113 114 115
/*
 * TODO a transformer en utilisant un MeshTableVolume.
 */
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
116
bool importOFFWithELERegions(typename PFP::MAP& the_map, const std::string& filenameOFF, const std::string& filenameELE, std::vector<std::string>& attrNames);
Pierre Kraemer's avatar
Pierre Kraemer committed
117

118 119 120
template <typename PFP>
bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenameNode, const std::string& filenameELE, std::vector<std::string>& attrNames);

Pierre Kraemer's avatar
Pierre Kraemer committed
121
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
122
bool importTet(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
Pierre Kraemer's avatar
Pierre Kraemer committed
123

124 125 126
template <typename PFP>
bool importMoka(typename PFP::MAP& the_gmap, const std::string& filename, std::vector<std::string>& attrNames);

Pierre Kraemer's avatar
Pierre Kraemer committed
127
template <typename PFP>
128
bool importTs(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
Pierre Kraemer's avatar
Pierre Kraemer committed
129

Sylvain Thery's avatar
Sylvain Thery committed
130 131 132 133 134 135
template <typename PFP>
bool importMSH(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

template <typename PFP>
bool importVTU(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

Sylvain Thery's avatar
Sylvain Thery committed
136 137 138
template <typename PFP>
bool importNAS(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

Sylvain Thery's avatar
Sylvain Thery committed
139 140 141
template <typename PFP>
bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

Sylvain Thery's avatar
Sylvain Thery committed
142 143 144 145 146 147
template <typename PFP>
bool importTetmesh(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

template <typename PFP>
bool importOVM(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);

Sylvain Thery's avatar
Sylvain Thery committed
148

Sylvain Thery's avatar
Sylvain Thery committed
149

150 151 152 153
} // Import

} // Volume

Pierre Kraemer's avatar
Pierre Kraemer committed
154

Pierre Kraemer's avatar
Pierre Kraemer committed
155
} // namespace Algo
Pierre Kraemer's avatar
Pierre Kraemer committed
156

Pierre Kraemer's avatar
Pierre Kraemer committed
157
} // namespace CGoGN
Pierre Kraemer's avatar
Pierre Kraemer committed
158 159 160 161 162

#include "Algo/Import/importMesh.hpp"
//#include "Algo/Import/importObjTex.hpp"
#include "Algo/Import/importObjEle.hpp"
#include "Algo/Import/importTet.hpp"
163
#include "Algo/Import/importMoka.hpp"
Pierre Kraemer's avatar
Pierre Kraemer committed
164
#include "Algo/Import/importTs.hpp"
165
#include "Algo/Import/importNodeEle.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
166 167
#include "Algo/Import/importMSH.hpp"
#include "Algo/Import/importVTU.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
168
#include "Algo/Import/importNAS.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
169
#include "Algo/Import/importVBGZ.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
170
#include "Algo/Import/importTetmesh.hpp"
Pierre Kraemer's avatar
Pierre Kraemer committed
171

Lionel Untereiner's avatar
Lionel Untereiner committed
172 173
#include "Algo/Import/importChoupi.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
174
#endif