import.h 6.32 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

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

/**
 * 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
78
/**
79
 * import a volumetric mesh
80
 * @param map the map in which the function imports the mesh
Pierre Kraemer's avatar
Pierre Kraemer committed
81
 * @param filename
82
 * @param attrNames attribute names
Pierre Kraemer's avatar
Pierre Kraemer committed
83
 * @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
Thomas's avatar
Thomas committed
84
 * @return a boolean indicating if import was successful
Pierre Kraemer's avatar
Pierre Kraemer committed
85
 */
86
template <typename PFP>
87
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
88

89
/**
Thomas's avatar
Thomas committed
90
 * import a mesh and extrude it
91
 * @param map the map in which the function imports the mesh
Pierre Kraemer's avatar
Pierre Kraemer committed
92
 * @param filename
93
 * @param attrNames attribute names
Pierre Kraemer's avatar
Pierre Kraemer committed
94
 * @param mergeCloseVertices a boolean indicating if close vertices should be merged during import
Thomas's avatar
Thomas committed
95
 * @return a boolean indicating if import was successful
96
 */
97
template <typename PFP>
98 99 100 101
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
102

Pierre Kraemer's avatar
Pierre Kraemer committed
103 104 105 106
/*
 * TODO a transformer en utilisant un MeshTableVolume.
 */
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
107
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
108

109 110 111
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
112
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
113
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
114

115 116 117
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
118
template <typename PFP>
119
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
120

Sylvain Thery's avatar
Sylvain Thery committed
121 122 123 124 125 126
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
127 128 129
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
130 131 132
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
133 134 135 136 137 138
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
139

Sylvain Thery's avatar
Sylvain Thery committed
140

141 142 143 144
} // Import

} // Volume

Pierre Kraemer's avatar
Pierre Kraemer committed
145

Pierre Kraemer's avatar
Pierre Kraemer committed
146
} // namespace Algo
Pierre Kraemer's avatar
Pierre Kraemer committed
147

Pierre Kraemer's avatar
Pierre Kraemer committed
148
} // namespace CGoGN
Pierre Kraemer's avatar
Pierre Kraemer committed
149 150 151 152 153

#include "Algo/Import/importMesh.hpp"
//#include "Algo/Import/importObjTex.hpp"
#include "Algo/Import/importObjEle.hpp"
#include "Algo/Import/importTet.hpp"
154
#include "Algo/Import/importMoka.hpp"
Pierre Kraemer's avatar
Pierre Kraemer committed
155
#include "Algo/Import/importTs.hpp"
156
#include "Algo/Import/importNodeEle.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
157 158
#include "Algo/Import/importMSH.hpp"
#include "Algo/Import/importVTU.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
159
#include "Algo/Import/importNAS.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
160
#include "Algo/Import/importVBGZ.hpp"
Sylvain Thery's avatar
Sylvain Thery committed
161
#include "Algo/Import/importTetmesh.hpp"
Pierre Kraemer's avatar
Pierre Kraemer committed
162

Lionel Untereiner's avatar
Lionel Untereiner committed
163 164
#include "Algo/Import/importChoupi.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
165
#endif