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
39 #endif // FEVV_USE_CGAL
42 #endif // FEVV_USE_OPENMESH
45 #endif // FEVV_USE_AIF
50 template<
typename MeshT >
70 std::cout <<
"use existing vertex-color map" << std::endl;
75 std::cout <<
"create vertex-color map" << std::endl;
82 std::cout <<
"using edge color property map" << std::endl;
88 std::cout <<
"create vertex-color map" << std::endl;
97 std::cout <<
"use existing vertex-normal map" << std::endl;
102 std::cout <<
"create vertex-normal map" << std::endl;
114 #if(FEVV_USE_QT5) // see at the end of .cpp for QT4
115 Q_PLUGIN_METADATA(IID
"ProgressiveCompressionPlugin")
139 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
144 template<
typename HalfedgeGraph >
147 std::cout <<
"Asking to ProgressiveCompression mesh ! " << std::endl;
150 using VertexColorMap =
152 HalfedgeGraph >::pmap_type;
156 using VertexNormalMap =
158 HalfedgeGraph >::pmap_type;
159 VertexNormalMap v_nm;
174 auto pm =
get(boost::vertex_point, *_mesh);
179 std::string filepath =
"";
198 "progressive_compression_original_mesh_after_preprocess_plugin.off");
200 catch (std::exception& e) {
207 *pmaps_bag = clean_pmaps_bag;
209 std::string message(
"Progressive compression completed.\n\n");
210 message.append(result);
211 QMessageBox::information(0,
"", QString::fromStdString(message));
214 template<
typename HalfedgeGraph >
216 HalfedgeGraph *_mesh,
221 std::string pred =
"";
222 std::string metr =
"";
223 std::string vkept =
"";
224 std::string filepath =
"";
225 std::string batch_string =
"";
226 if(dialog.exec() == QDialog::Accepted)
233 _batch_stop = FEVV::Filters::BATCH_CONDITION::ALL_EDGES;
235 if(pred.compare(
"Butterfly") == 0)
239 else if(pred.compare(
"Delta") == 0)
241 _predictor = FEVV::Filters::PREDICTION_TYPE::DELTA;
243 else if (pred.compare(
"Position") == 0)
245 _predictor = FEVV::Filters::PREDICTION_TYPE::POSITION;
249 if(metr.compare(
"QEM") == 0)
253 else if(metr.compare(
"Volume Preserving") == 0)
257 else if(metr.compare(
"EdgeLength") == 0)
259 _metric = FEVV::Filters::METRIC_TYPE::EDGE_LENGTH;
262 if(batch_string.compare(
"All Edges") == 0)
264 _batch_stop = FEVV::Filters::BATCH_CONDITION::ALL_EDGES;
266 else if(batch_string.compare(
"Reach Threshold") == 0)
271 _operator = FEVV::Filters::VKEPT_POSITION::MIDPOINT;
272 if(vkept.compare(
"MidPoint") == 0)
274 _operator = FEVV::Filters::VKEPT_POSITION::MIDPOINT;
276 else if(vkept.compare(
"Halfedge") == 0)
278 _operator = FEVV::Filters::VKEPT_POSITION::HALFEDGE;
303 #ifdef FEVV_USE_OPENMESH
304 #if 0 // Works with CGAL AABB, no solution available for OpenMesh yet
309 applyHG< MeshOpenMesh >(_adapter, _mesh, pmaps_bag);
316 void apply(BaseAdapterVisu *_adapter,
320 applyHG< MeshLCC >(_adapter, _mesh, pmaps_bag);
323 void apply(BaseAdapterVisu *_adapter,
327 applyHG< MeshSurface >(_adapter, _mesh, pmaps_bag);
330 void apply(BaseAdapterVisu *_adapter,
334 applyHG< MeshPolyhedron >(_adapter, _mesh, pmaps_bag);
339 #if 0 // halfedge iteration is not compatible with AIF yet (halfedge_iterator type cannot be exported)
341 void apply(BaseAdapterVisu *_adapter,
345 applyHG< MeshAIF >(_adapter, _mesh, pmaps_bag);
352 return QStringList() <<
"ProgressiveCompressionPlugin";
virtual bool isInit() const
Filters::PREDICTION_TYPE _predictor
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
ProgressiveCompressionPlugin()=default
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
Filters::METRIC_TYPE _metric
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)
This class is intended to provide some standard message boxes to all plugins.
Filters::BATCH_CONDITION _batch_stop
Filters::VKEPT_POSITION _operator
virtual Viewer * getViewer()
void process(HalfedgeGraph *_mesh, FEVV::PMapsContainer *pmaps_bag)
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...
~ProgressiveCompressionPlugin()=default
void onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Interfaces for plugins These interfaces will be used for different plugins.
void getParameters(int &quantiz, int &nb_batches, int &min_vertices, std::string &metric, std::string &vkept, std::string &predictor, std::string &filepath, std::string &batchstop)
void set_mesh_and_properties(MeshT &m, FEVV::PMapsContainer &pmaps_bag, typename FEVV::PMap_traits< FEVV::vertex_color_t, MeshT >::pmap_type &v_cm, typename FEVV::PMap_traits< FEVV::edge_color_t, MeshT >::pmap_type &e_cm, typename FEVV::PMap_traits< FEVV::face_normal_t, MeshT >::pmap_type &, typename FEVV::PMap_traits< FEVV::vertex_normal_t, MeshT >::pmap_type &v_nm)
void applyHG(BaseAdapterVisu *_adapter, HalfedgeGraph *_mesh, FEVV::PMapsContainer *pmaps_bag)
bool Generic_plugin(const QString &) override
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
void progressive_compression_filter(HalfedgeGraph &g, PointMap &pm, FEVV::Filters::Uniform_quantization< HalfedgeGraph, PointMap > &pq, VertexColorMap &v_cm, EdgeColorMap &e_cm, const GeometryTraits >, FEVV::Filters::Error_metric< HalfedgeGraph, PointMap > *EM, const FEVV::Filters::Kept_position< HalfedgeGraph, PointMap > *KP, FEVV::Filters::Predictor< HalfedgeGraph, PointMap > *predict, int nb_q_bits, int nb_max_batches, int nb_min_vertices, FEVV::Filters::BATCH_CONDITION batch_condition, draco::EncoderBuffer &buffer, const std::string &measure_path, bool preprocess=true, bool dequantiz=false, bool save_preprocess=false, const std::string &output_file_path_save_preprocess="", bool allow_duplicates=false)
Takes a mesh g, applies batches of simplification until either the number of max batches or the minim...
QStringList Generic_plugins() const override
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
virtual void apply(BaseAdapterVisu *, void *, FEVV::PMapsContainer *) override
void addParameters(BaseWindow *_window) override
Parameters contains the compression parameters except the stopping criteria.
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
@ QEM_3D
do not use a local metric (not implemented in this release)
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)
FEVV::DataStructures::AIF::AIFMesh MeshAIF