mirror of https://github.com/CGAL/cgal
Misc minor changes
This commit is contained in:
parent
f138943e73
commit
954daa05a4
|
|
@ -91,8 +91,8 @@ public:
|
||||||
Navigation()
|
Navigation()
|
||||||
:CGAL::Qt::GraphicsViewNavigation(),
|
:CGAL::Qt::GraphicsViewNavigation(),
|
||||||
prev_pos(QPoint(0,0))
|
prev_pos(QPoint(0,0))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *ev)
|
bool eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
|
|
@ -211,8 +211,7 @@ public :
|
||||||
components(components),
|
components(components),
|
||||||
m_borders(uv_borders),
|
m_borders(uv_borders),
|
||||||
m_current_component(0)
|
m_current_component(0)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
~UVItem()
|
~UVItem()
|
||||||
{
|
{
|
||||||
|
|
@ -225,6 +224,7 @@ public :
|
||||||
{
|
{
|
||||||
return bounding_rect;
|
return bounding_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString item_name()const{ return texMesh_name; }
|
QString item_name()const{ return texMesh_name; }
|
||||||
void set_item_name(QString s){ texMesh_name = s;}
|
void set_item_name(QString s){ texMesh_name = s;}
|
||||||
|
|
||||||
|
|
@ -249,9 +249,11 @@ public :
|
||||||
painter->drawLine(pt_C, pt_A);
|
painter->drawLine(pt_C, pt_A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int number_of_components()const{return components->size();}
|
int number_of_components()const{return components->size();}
|
||||||
int current_component()const{return m_current_component;}
|
int current_component()const{return m_current_component;}
|
||||||
void set_current_component(int n){m_current_component = n;}
|
void set_current_component(int n){m_current_component = n;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Textured_polyhedron* texMesh;
|
Textured_polyhedron* texMesh;
|
||||||
QString texMesh_name;
|
QString texMesh_name;
|
||||||
|
|
@ -262,6 +264,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace CGAL::Three;
|
using namespace CGAL::Three;
|
||||||
|
|
||||||
class Polyhedron_demo_parameterization_plugin :
|
class Polyhedron_demo_parameterization_plugin :
|
||||||
public QObject,
|
public QObject,
|
||||||
public Polyhedron_demo_plugin_helper
|
public Polyhedron_demo_plugin_helper
|
||||||
|
|
@ -272,7 +275,8 @@ class Polyhedron_demo_parameterization_plugin :
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// used by Polyhedron_demo_plugin_helper
|
// used by Polyhedron_demo_plugin_helper
|
||||||
QList<QAction*> actions() const {
|
QList<QAction*> actions() const
|
||||||
|
{
|
||||||
return _actions;
|
return _actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -322,10 +326,10 @@ public:
|
||||||
addDockWidget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
current_uv_item = NULL;
|
current_uv_item = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool applicable(QAction*) const {
|
bool applicable(QAction*) const
|
||||||
|
{
|
||||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,6 +337,7 @@ public:
|
||||||
{
|
{
|
||||||
dock_widget->hide();
|
dock_widget->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void on_actionMVC_triggered();
|
void on_actionMVC_triggered();
|
||||||
void on_actionDCP_triggered();
|
void on_actionDCP_triggered();
|
||||||
|
|
@ -342,11 +347,14 @@ public Q_SLOTS:
|
||||||
void on_actionOTE_triggered();
|
void on_actionOTE_triggered();
|
||||||
void on_prevButton_pressed();
|
void on_prevButton_pressed();
|
||||||
void on_nextButton_pressed();
|
void on_nextButton_pressed();
|
||||||
|
|
||||||
void replacePolyline()
|
void replacePolyline()
|
||||||
{
|
{
|
||||||
if(current_uv_item)
|
if(current_uv_item)
|
||||||
qobject_cast<Scene_textured_polyhedron_item*>(projections.key(current_uv_item))->add_border_edges(std::vector<float>(0));
|
qobject_cast<Scene_textured_polyhedron_item*>(projections.key(current_uv_item))->add_border_edges(std::vector<float>(0));
|
||||||
|
|
||||||
int id = scene->mainSelectionIndex();
|
int id = scene->mainSelectionIndex();
|
||||||
|
|
||||||
Q_FOREACH(UVItem* pl, projections)
|
Q_FOREACH(UVItem* pl, projections)
|
||||||
{
|
{
|
||||||
if(pl==NULL || pl != projections[scene->item(id)])
|
if(pl==NULL || pl != projections[scene->item(id)])
|
||||||
|
|
@ -354,6 +362,7 @@ public Q_SLOTS:
|
||||||
current_uv_item = pl;
|
current_uv_item = pl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!current_uv_item)
|
if(!current_uv_item)
|
||||||
{
|
{
|
||||||
dock_widget->setWindowTitle(tr("UVMapping"));
|
dock_widget->setWindowTitle(tr("UVMapping"));
|
||||||
|
|
@ -363,6 +372,7 @@ public Q_SLOTS:
|
||||||
{
|
{
|
||||||
if(!graphics_scene->items().empty())
|
if(!graphics_scene->items().empty())
|
||||||
graphics_scene->removeItem(graphics_scene->items().first());
|
graphics_scene->removeItem(graphics_scene->items().first());
|
||||||
|
|
||||||
graphics_scene->addItem(current_uv_item);
|
graphics_scene->addItem(current_uv_item);
|
||||||
ui_widget.graphicsView->fitInView(current_uv_item->boundingRect(), Qt::KeepAspectRatio);
|
ui_widget.graphicsView->fitInView(current_uv_item->boundingRect(), Qt::KeepAspectRatio);
|
||||||
ui_widget.component_numberLabel->setText(QString("Component : %1/%2").arg(current_uv_item->current_component()+1).arg(current_uv_item->number_of_components()));
|
ui_widget.component_numberLabel->setText(QString("Component : %1/%2").arg(current_uv_item->current_component()+1).arg(current_uv_item->number_of_components()));
|
||||||
|
|
@ -371,6 +381,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyPolyline(CGAL::Three::Scene_item* item)
|
void destroyPolyline(CGAL::Three::Scene_item* item)
|
||||||
{
|
{
|
||||||
Q_FOREACH(UVItem* pli, projections)
|
Q_FOREACH(UVItem* pli, projections)
|
||||||
|
|
@ -382,6 +393,7 @@ public Q_SLOTS:
|
||||||
projections.remove(item);
|
projections.remove(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(projections.empty() || projections.first() == NULL)
|
if(projections.empty() || projections.first() == NULL)
|
||||||
{
|
{
|
||||||
current_uv_item = NULL;
|
current_uv_item = NULL;
|
||||||
|
|
@ -444,13 +456,12 @@ void Polyhedron_demo_parameterization_plugin::on_nextButton_pressed()
|
||||||
ui_widget.component_numberLabel->setText(QString("Component : %1/%2").arg(current_uv_item->current_component()+1).arg(current_uv_item->number_of_components()));
|
ui_widget.component_numberLabel->setText(QString("Component : %1/%2").arg(current_uv_item->current_component()+1).arg(current_uv_item->number_of_components()));
|
||||||
replacePolyline();
|
replacePolyline();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterization_method method)
|
void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterization_method method)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get active polyhedron
|
// get active polyhedron
|
||||||
const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
|
const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||||
Scene_polyhedron_item* poly_item =
|
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
|
||||||
qobject_cast<Scene_polyhedron_item*>(scene->item(index));
|
|
||||||
if(!poly_item)
|
if(!poly_item)
|
||||||
{
|
{
|
||||||
messages->error("Selected item is not of the right type.");
|
messages->error("Selected item is not of the right type.");
|
||||||
|
|
@ -463,6 +474,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
||||||
messages->error("Selected item has no valid polyhedron.");
|
messages->error("Selected item has no valid polyhedron.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMesh->normalize_border();
|
pMesh->normalize_border();
|
||||||
Scene_polyhedron_selection_item* sel_item = NULL;
|
Scene_polyhedron_selection_item* sel_item = NULL;
|
||||||
bool is_seamed = false;
|
bool is_seamed = false;
|
||||||
|
|
@ -477,17 +489,20 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
||||||
continue;
|
continue;
|
||||||
is_seamed = true;
|
is_seamed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Two property maps to store the seam edges and vertices
|
// Two property maps to store the seam edges and vertices
|
||||||
Seam_edge_uhm seam_edge_uhm(false);
|
Seam_edge_uhm seam_edge_uhm(false);
|
||||||
Seam_edge_pmap seam_edge_pm(seam_edge_uhm);
|
Seam_edge_pmap seam_edge_pm(seam_edge_uhm);
|
||||||
|
|
||||||
Seam_vertex_uhm seam_vertex_uhm(false);
|
Seam_vertex_uhm seam_vertex_uhm(false);
|
||||||
Seam_vertex_pmap seam_vertex_pm(seam_vertex_uhm);
|
Seam_vertex_pmap seam_vertex_pm(seam_vertex_uhm);
|
||||||
|
|
||||||
if(!is_seamed && pMesh->is_closed())
|
if(!is_seamed && pMesh->is_closed())
|
||||||
{
|
{
|
||||||
messages->error("The selected mesh has no border and is not seamed.");
|
messages->error("The selected mesh has no (real or virtual) border.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
|
|
@ -530,7 +545,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
qDebug()<<sel_item->selected_edges.size()<<", "<<seam_edges.size();
|
qDebug() << sel_item->selected_edges.size() << ", " << seam_edges.size();
|
||||||
//fill seam mesh pmaps
|
//fill seam mesh pmaps
|
||||||
BOOST_FOREACH(T_edge_descriptor ed, seam_edges)
|
BOOST_FOREACH(T_edge_descriptor ed, seam_edges)
|
||||||
{
|
{
|
||||||
|
|
@ -827,6 +842,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
||||||
{
|
{
|
||||||
components->at(fccmap[bfit]).insert(tfit);
|
components->at(fccmap[bfit]).insert(tfit);
|
||||||
}
|
}
|
||||||
|
|
||||||
UVItem *projection
|
UVItem *projection
|
||||||
= new UVItem(tpMesh, components, uv_borders, QRectF(min, max));
|
= new UVItem(tpMesh, components, uv_borders, QRectF(min, max));
|
||||||
projection->set_item_name(new_item_name);
|
projection->set_item_name(new_item_name);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||||
#include <CGAL/boost/graph/properties.h>
|
#include <CGAL/boost/graph/properties.h>
|
||||||
|
|
||||||
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ public:
|
||||||
|
|
||||||
cone = cmit->first;
|
cone = cmit->first;
|
||||||
cone_index = get(vimap, cone);
|
cone_index = get(vimap, cone);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -576,6 +577,8 @@ public:
|
||||||
std::ofstream matoutBf("matrices/vectorB.dat");
|
std::ofstream matoutBf("matrices/vectorB.dat");
|
||||||
matoutBf.precision(20);
|
matoutBf.precision(20);
|
||||||
matoutBf << Bf << std::endl;
|
matoutBf << Bf << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGAL::Timer task_timer;
|
CGAL::Timer task_timer;
|
||||||
|
|
@ -608,6 +611,7 @@ public:
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
/// Flattens the mesh to one of the orbifolds. In the end, the
|
/// Flattens the mesh to one of the orbifolds. In the end, the
|
||||||
/// position of each vertex is stored in the property map `uvmap`.
|
/// position of each vertex is stored in the property map `uvmap`.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Surface_mesh_parameterization {
|
||||||
|
|
||||||
enum Cone_type
|
enum Cone_type
|
||||||
{
|
{
|
||||||
Unique_cone,
|
Unique_cone = 0,
|
||||||
Duplicated_cone
|
Duplicated_cone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <CGAL/Surface_mesh_parameterization/LSCM_parameterizer_3.h>
|
#include <CGAL/Surface_mesh_parameterization/LSCM_parameterizer_3.h>
|
||||||
#include <CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h>
|
#include <CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h>
|
||||||
#include <CGAL/Surface_mesh_parameterization/MVC_post_processor_3.h>
|
#include <CGAL/Surface_mesh_parameterization/MVC_post_processor_3.h>
|
||||||
|
#include <CGAL/Surface_mesh_parameterization/Orbital_Tutte_parameterizer_3.h>
|
||||||
|
|
||||||
#include <CGAL/Surface_mesh_parameterization/parameterize.h>
|
#include <CGAL/Surface_mesh_parameterization/parameterize.h>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue