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
"CompressionValencePlugin")
67 void init()
override {
init(
"compressed_mesh.p3d",
false, 10, 100); }
69 void init(
const std::string &_p3dFilePath,
70 bool _with_adaptative_quantization,
71 int _quantization_bits,
92 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
97 template<
typename HalfedgeGraph >
100 std::cout <<
"Asking to apply CompressionValence filter ! " << std::endl;
107 std::cout <<
"Compression Valence Plugin DBG infos" << std::endl;
108 std::cout <<
" * p3dFilePath=" <<
p3dFilePath << std::endl;
109 std::cout <<
" * with_compression=" << with_compression << std::endl;
112 std::cout <<
" * max_vertices=" <<
max_vertices << std::endl;
116 auto pm =
get(boost::vertex_point, *_mesh);
119 using VertexColorMap =
121 HalfedgeGraph >::pmap_type;
123 VertexColorMap *v_cm_ptr =
nullptr;
127 std::cout <<
"Compression Valence filter: using vertex color property map"
133 std::cout <<
"Compression Valence filter: no vertex color property map "
134 "found, ignoring color"
142 HalfedgeGraph *mesh_copy =
new HalfedgeGraph;
146 VertexColorMap *v_cm_copy_ptr =
nullptr;
147 if(v_cm_ptr !=
nullptr)
149 v_cm_copy_ptr =
new VertexColorMap;
154 if(v_cm_copy_ptr !=
nullptr)
162 typename boost::property_map< HalfedgeGraph,
163 boost::vertex_point_t >::type;
165 copy_mesh(*_mesh, v_cm_ptr, *mesh_copy, v_cm_copy_ptr);
182 if(v_cm_ptr !=
nullptr)
187 *pmaps_bag = clean_pmaps_bag;
189 std::string message(
"Compression completed.\n\n");
190 message.append(result);
191 QMessageBox::information(0,
"", QString::fromStdString(message));
194 template<
typename HalfedgeGraph >
196 HalfedgeGraph *_mesh,
205 if(dial1.exec() == QDialog::Accepted)
242 "original_mesh_copied");
256 #ifdef FEVV_USE_OPENMESH
261 applyHG< MeshOpenMesh >(_adapter, _mesh, pmaps_bag);
266 void apply(BaseAdapterVisu *_adapter,
270 applyHG< MeshLCC >(_adapter, _mesh, pmaps_bag);
273 void apply(BaseAdapterVisu *_adapter,
277 applyHG< MeshSurface >(_adapter, _mesh, pmaps_bag);
280 void apply(BaseAdapterVisu *_adapter,
284 applyHG< MeshPolyhedron >(_adapter, _mesh, pmaps_bag);
289 #if 0 //TODO-elo restore when Compression Valence compiles with AIF
290 void apply(BaseAdapterVisu *_adapter,
295 applyHG<MeshAIF>(_adapter, _mesh, pmaps_bag);
303 return QStringList() <<
"CompressionValencePlugin";
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)
std::string compression_valence(HalfedgeGraph &g, PointMap *pm, VertexColorMap *v_cm, const std::string &input_filename, const std::string &output_filename, bool with_compression, bool with_adaptative_quantization, int max_vertices, int quantiz_bits, const GeometryTraits &)
Compress the input mesh using the Compression Valence algorithm.
void getCompressionValenceParams(std::string &p3dFilePath, bool &with_adaptative_quantization, int &quantization_bits, int &max_vertices)
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
void applyHG(BaseAdapterVisu *_adapter, HalfedgeGraph *_mesh, FEVV::PMapsContainer *pmaps_bag)
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, CGALLCCTraits, CGALItem > MeshLCC
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
~CompressionValencePlugin()=default
This class is intended to provide some standard message boxes to all plugins.
virtual Viewer * getViewer()
void setCompressionValenceParams(const std::string &p3dFilePath, bool with_adaptative_quantization, int quantization_bits, int max_verticesdouble)
CGAL::Surface_mesh< CGALPoint > MeshSurface
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.)
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 onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Interfaces for plugins These interfaces will be used for different plugins.
bool Generic_plugin(const QString &) override
CompressionValencePlugin()=default
void process(HalfedgeGraph *_mesh, FEVV::PMapsContainer *pmaps_bag)
FEVV::PMapsContainer * pmaps_bag_copy
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
virtual void apply(BaseAdapterVisu *, void *, FEVV::PMapsContainer *) override
QStringList Generic_plugins() const override
void init(const std::string &_p3dFilePath, bool _with_adaptative_quantization, int _quantization_bits, int _max_vertices)
void centerMesh(HalfedgeGraph *_g)
void addParameters(BaseWindow *_window) override
static void copy_mesh(const HalfedgeGraph &_pMesh, const VertexColorMap *_v_cm, HalfedgeGraph &mesh_copy, VertexColorMap *v_cm_copy)
Copy the current mesh and vertex-color map to a new mesh and vertex-color map. If v_cm_copy == nullpt...
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
FEVV::DataStructures::AIF::AIFMesh MeshAIF
bool with_adaptative_quantization