Go to the documentation of this file.
14 #ifndef _SCL_SECURE_NO_WARNINGS
15 #define _SCL_SECURE_NO_WARNINGS
21 #include <QStringList>
24 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
38 #endif // FEVV_USE_CGAL
39 #ifdef FEVV_USE_OPENMESH
41 #endif // FEVV_USE_OPENMESH
44 #endif // FEVV_USE_AIF
56 #if(FEVV_USE_QT5) // see at the end of .cpp for QT4
57 Q_PLUGIN_METADATA(IID
"DecompressionValencePlugin")
67 void init()
override {
init(
"example.p3d", -1,
true,
false); }
69 void init(
const std::string &_p3dFilePath,
72 bool _write_intermediate_meshes)
95 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
100 template<
typename HalfedgeGraph >
103 std::cout <<
"Asking to apply DecompressionValence filter on file '"
108 std::cout <<
"Decompression Valence Plugin DBG infos" << std::endl;
109 std::cout <<
" * p3dFilePath=" <<
p3dFilePath << std::endl;
110 std::cout <<
" * write_info=" <<
write_info << std::endl;
116 auto pm =
get(boost::vertex_point, *_mesh);
119 using VertexColorMap =
121 HalfedgeGraph >::pmap_type;
125 std::vector< HalfedgeGraph * > *intermediate_meshes =
nullptr;
126 std::vector< VertexColorMap * > *intermediate_vertexColorMaps =
nullptr;
129 intermediate_meshes =
new std::vector< HalfedgeGraph * >;
130 intermediate_vertexColorMaps =
new std::vector< VertexColorMap * >;
145 intermediate_vertexColorMaps,
152 *pmaps_bag = new_pmaps_bag;
158 catch(std::runtime_error &e)
160 std::cout << e.what() << std::endl;
165 static_cast< void *
>(intermediate_vertexColorMaps);
167 std::string message(
"Decompression completed.\n\n");
168 message.append(result);
169 QMessageBox::information(0,
"", QString::fromStdString(message));
173 template<
typename HalfedgeGraph >
183 if(dial1.exec() == QDialog::Accepted)
193 auto mesh =
new HalfedgeGraph;
204 using VertexColorMap =
206 HalfedgeGraph >::pmap_type;
215 auto intermediate_meshes =
216 static_cast< std::vector< HalfedgeGraph * > *
>(
218 auto intermediate_vertexColorMaps =
219 static_cast< std::vector< VertexColorMap * > *
>(
225 for(
int i = intermediate_meshes->size() - 1; i >=0; i--)
227 HalfedgeGraph *mesh_i = (*intermediate_meshes)[i];
228 VertexColorMap *v_cm_i = (*intermediate_vertexColorMaps)[i];
242 std::string(
"level") + std::to_string(i));
246 delete(intermediate_meshes);
248 delete(intermediate_vertexColorMaps);
270 apply(_adapter,
static_cast< void *
>(
nullptr),
nullptr);
273 void apply(BaseAdapterVisu *_adapter,
277 apply(_adapter,
static_cast< void *
>(
nullptr),
nullptr);
280 void apply(BaseAdapterVisu *_adapter,
284 apply(_adapter,
static_cast< void *
>(
nullptr),
nullptr);
289 #ifdef FEVV_USE_OPENMESH
290 void apply(BaseAdapterVisu *_adapter,
294 apply(_adapter,
static_cast< void *
>(
nullptr),
nullptr);
300 void apply(BaseAdapterVisu *_adapter,
304 apply(_adapter,
static_cast< void *
>(
nullptr),
nullptr);
316 if(mesh_type ==
"NONE")
321 if(mesh_type ==
"POLYHEDRON")
323 applyHG< MeshPolyhedron >(_adapter);
325 else if(mesh_type ==
"SURFACEMESH")
327 applyHG< MeshSurface >(_adapter);
329 else if(mesh_type ==
"LCC")
331 applyHG< MeshLCC >(_adapter);
333 else if(mesh_type ==
"CGALPOINTSET")
335 QMessageBox::information(
339 "Decompression Valence filter is not yet compatible with CGALPointSet!"));
343 #ifdef FEVV_USE_OPENMESH
344 if(mesh_type ==
"OPENMESH")
346 applyHG< MeshOpenMesh >(_adapter);
351 if(mesh_type ==
"AIF")
353 QMessageBox::information(
357 "Decompression Valence filter is not yet compatible with AIF!"));
362 if(mesh_type ==
"PCLPOINTCLOUD")
364 QMessageBox::information(
368 "Decompression Valence filter is not yet compatible with PCLPointCloud!"));
376 return QStringList() <<
"DecompressionValencePlugin";
virtual bool isInit() const
void activate_time_mode()
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
bool write_intermediate_meshes
void * intermediate_vertexColorMaps_void
~DecompressionValencePlugin()=default
void setDecompressionValenceParams(const std::string &p3dFilePath, int stop_level, bool write_info, bool write_intermediate_meshes, bool display_intermediate_meshes)
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, CGALLCCTraits, CGALItem > MeshLCC
void init(const std::string &_p3dFilePath, int _stop_level, bool _write_info, bool _write_intermediate_meshes)
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
void applyHG(BaseAdapterVisu *_adapter)
bool Generic_plugin(const QString &) override
This class is intended to provide some standard message boxes to all plugins.
virtual Viewer * getViewer()
void apply(BaseAdapterVisu *_adapter, void *, FEVV::PMapsContainer *) override
CGAL::Surface_mesh< CGALPoint > MeshSurface
DecompressionValencePlugin()=default
SimpleWindow is a specialization of QMainWindow. This class the Main Window.
std::map< std::string, boost::any > PMapsContainer
void draw_or_redraw_mesh(HalfedgeGraph *_g, PMapsContainer *_pmaps, bool _redraw=false, bool _recomputeNT_if_redraw=false, std::string _mesh_filename=std::string(""), bool _recreateOSGobj_if_redraw=true, float _step=0.)
void getDecompressionValenceParams(std::string &p3dFilePath, int &stop_level, bool &write_info, bool &write_intermediate_meshes, bool &display_intermediate_meshes)
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
SimpleViewer is a specialization of osgViewer::CompositeViewer. This class is a widget where we are a...
void addParameters(BaseWindow *_window) override
void onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Interfaces for plugins These interfaces will be used for different plugins.
void process(HalfedgeGraph *&_mesh, FEVV::PMapsContainer *&pmaps_bag)
std::string decompression_valence(HalfedgeGraph &g, PointMap *pm, VertexColorMap *v_cm, const std::string &input_filename, bool &has_color, bool do_write_info, std::vector< HalfedgeGraph * > *intermediate_meshes, std::vector< VertexColorMap * > *intermediate_vertex_color_maps, int stop_level, bool do_write_intermediate_meshes, const GeometryTraits &)
Uncompress a mesh compressed with Compression Valence algorithm.
QStringList Generic_plugins() const override
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
bool keep_intermediate_meshes
void * intermediate_meshes_void
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
FEVV::DataStructures::AIF::AIFMesh MeshAIF
std::string chooseDatastructureMsgBox(void)