mirror of https://github.com/CGAL/cgal
Merge pull request #7970 from MaelRL/CGAL-Demo_bugs-GF
Fix some demo bugs
This commit is contained in:
commit
a70e9202f2
|
|
@ -1102,7 +1102,7 @@ void MainWindow::open(QString filename)
|
|||
if ( dfs_it==default_plugin_selection.end() )
|
||||
{
|
||||
// collect all io_plugins and offer them to load if the file extension match one name filter
|
||||
// also collect all available plugin in case of a no extension match
|
||||
// also collect all available plugins in case of a no extension match
|
||||
for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : io_plugins) {
|
||||
if ( file_matches_filter(io_plugin->loadNameFilters(), filename.toLower()) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce
|
|||
t.stop();
|
||||
std::cerr << "Reading took " << t.time() << " sec." << std::endl;
|
||||
if(name_and_color.first.size() == 0){
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
} else {
|
||||
item->setName(name_and_color.first.c_str());
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ save(QFileInfo fileinfo,QList<CGAL::Three::Scene_item*>& items)
|
|||
std::ofstream out(fileinfo.filePath().toUtf8());
|
||||
out.precision (std::numeric_limits<double>::digits10 + 2);
|
||||
SMesh* poly = const_cast<SMesh*>(sm_item->polyhedron());
|
||||
CGAL::IO::write_GOCAD(out, qPrintable(fileinfo.baseName()), *poly);
|
||||
CGAL::IO::write_GOCAD(out, qPrintable(fileinfo.completeBaseName()), *poly);
|
||||
items.pop_front();
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) {
|
|||
|
||||
// Try to read .nef3 in a polyhedron
|
||||
Scene_nef_polyhedron_item* item = new Scene_nef_polyhedron_item();
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
if(fileinfo.size() == 0)
|
||||
{
|
||||
CGAL::Three::Three::warning( tr("The file you are trying to load is empty."));
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) {
|
|||
return nullptr;
|
||||
}
|
||||
Scene_surface_mesh_item* item = new Scene_surface_mesh_item();
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
if(item->load_obj(in))
|
||||
return item;
|
||||
//if not polygonmesh load in soup
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
|
|||
return QList<Scene_item*>()<<item;
|
||||
}
|
||||
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(item);
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
|
|||
}
|
||||
Scene_polylines_item* item = new Scene_polylines_item;
|
||||
item->polylines = polylines;
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
item->setColor(Qt::black);
|
||||
item->setProperty("polylines metadata", polylines_metadata);
|
||||
std::cerr << "Number of polylines in item: " << item->polylines.size() << std::endl;
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ public:
|
|||
|| (is_polygon_mesh && is_polyline)
|
||||
|| (is_c3t3 && is_polyline) )
|
||||
{
|
||||
group = new Scene_group_item(fileinfo.baseName());
|
||||
group = new Scene_group_item(fileinfo.completeBaseName());
|
||||
}
|
||||
|
||||
if(is_polygon_mesh)
|
||||
|
|
@ -372,12 +372,12 @@ public:
|
|||
if(poly_item) {
|
||||
if(group)
|
||||
{
|
||||
poly_item->setName(QString("%1_faces").arg(fileinfo.baseName()));
|
||||
poly_item->setName(QString("%1_faces").arg(fileinfo.completeBaseName()));
|
||||
CGAL::Three::Three::scene()->addItem(poly_item);
|
||||
CGAL::Three::Three::scene()->changeGroup(poly_item, group);
|
||||
}
|
||||
else{
|
||||
poly_item->setName(fileinfo.baseName());
|
||||
poly_item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(poly_item);
|
||||
|
|
@ -484,12 +484,12 @@ public:
|
|||
c3t3_item->resetCutPlane();
|
||||
if(group)
|
||||
{
|
||||
c3t3_item->setName(QString("%1_tetrahedra").arg(fileinfo.baseName()));
|
||||
c3t3_item->setName(QString("%1_tetrahedra").arg(fileinfo.completeBaseName()));
|
||||
CGAL::Three::Three::scene()->addItem(c3t3_item);
|
||||
CGAL::Three::Three::scene()->changeGroup(c3t3_item, group);
|
||||
}
|
||||
else{
|
||||
c3t3_item->setName(fileinfo.baseName());
|
||||
c3t3_item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(c3t3_item);
|
||||
|
|
@ -506,12 +506,12 @@ public:
|
|||
polyline_item->polylines.push_back(segment);
|
||||
if(group)
|
||||
{
|
||||
polyline_item->setName(QString("%1_lines").arg(fileinfo.baseName()));
|
||||
polyline_item->setName(QString("%1_lines").arg(fileinfo.completeBaseName()));
|
||||
CGAL::Three::Three::scene()->addItem(polyline_item);
|
||||
CGAL::Three::Three::scene()->changeGroup(polyline_item, group);
|
||||
}
|
||||
else{
|
||||
polyline_item->setName(fileinfo.baseName());
|
||||
polyline_item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(polyline_item);
|
||||
|
|
@ -537,7 +537,7 @@ public:
|
|||
double* p = data->GetPoint(i);
|
||||
point_item->point_set()->insert(Point_3(p[0], p[1], p[2]));
|
||||
}
|
||||
point_item->setName(fileinfo.baseName());
|
||||
point_item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(point_item);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) {
|
|||
|
||||
Scene_polylines_item* item = new Scene_polylines_item;
|
||||
item->polylines = polylines;
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
item->setColor(Qt::black);
|
||||
std::cerr << "Number of polylines in item: " << item->polylines.size() << std::endl;
|
||||
item->invalidateOpenGLBuffers();
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load(
|
|||
}
|
||||
if(fileinfo.suffix().toLower() == "cgal")
|
||||
{
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
|
||||
if(item->load_binary(in)) {
|
||||
if(add_to_scene){
|
||||
|
|
@ -134,7 +134,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load(
|
|||
in.open(fileinfo.filePath().toUtf8(), std::ios_base::in);//not binary
|
||||
CGAL_assertion(!(!in));
|
||||
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
item->set_valid(false);
|
||||
|
||||
if(CGAL::SMDS_3::build_triangulation_from_file(in, item->c3t3().triangulation(),
|
||||
|
|
@ -165,7 +165,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load(
|
|||
CGAL_assertion(!(!in));
|
||||
}
|
||||
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
|
||||
if (CGAL::IO::read_AVIZO_TETRA(in, item->c3t3().triangulation()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ save(const Scene_c3t3_item& c3t3_item, const QFileInfo& fileInfo)
|
|||
rib_file.precision(8);
|
||||
|
||||
// Header
|
||||
QString basename = fileInfo.baseName();
|
||||
QString basename = fileInfo.completeBaseName();
|
||||
write_header(qPrintable(basename), rib_file);
|
||||
|
||||
// Lights
|
||||
|
|
|
|||
|
|
@ -1356,7 +1356,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
|
|||
{
|
||||
//Create planes
|
||||
image_item = new Scene_image_item(image,0, true);
|
||||
image_item->setName(fileinfo.baseName());
|
||||
image_item->setName(fileinfo.completeBaseName());
|
||||
msgBox.setText("Planes created : 0/3");
|
||||
msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
msgBox.show();
|
||||
|
|
@ -1367,7 +1367,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
|
|||
{
|
||||
image_item = new Scene_image_item(image,voxel_scale, false);
|
||||
}
|
||||
image_item->setName(fileinfo.baseName());
|
||||
image_item->setName(fileinfo.completeBaseName());
|
||||
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(image_item);
|
||||
|
|
@ -1456,7 +1456,7 @@ bool Io_image_plugin::loadDirectory(const QString& dirname,
|
|||
{
|
||||
// Create planes
|
||||
image_item = new Scene_image_item(image,125, true);
|
||||
image_item->setName(fileinfo.baseName());
|
||||
image_item->setName(fileinfo.completeBaseName());
|
||||
msgBox.setText("Planes created : 0/3");
|
||||
msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
msgBox.show();
|
||||
|
|
@ -1470,7 +1470,7 @@ bool Io_image_plugin::loadDirectory(const QString& dirname,
|
|||
int voxel_scale = ui.precisionList->currentIndex() + 1;
|
||||
|
||||
image_item = new Scene_image_item(image,voxel_scale, false);
|
||||
image_item->setName(fileinfo.baseName());
|
||||
image_item->setName(fileinfo.completeBaseName());
|
||||
scene->addItem(image_item);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,8 +182,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_t
|
|||
if (poly_item)
|
||||
{
|
||||
std::size_t nbv =
|
||||
CGAL::Polygon_mesh_processing::remove_isolated_vertices(
|
||||
*poly_item->polyhedron());
|
||||
CGAL::Polygon_mesh_processing::remove_isolated_vertices(*poly_item->polyhedron());
|
||||
CGAL::Three::Three::information(tr(" %1 isolated vertices have been removed.")
|
||||
.arg(nbv));
|
||||
poly_item->setNbIsolatedvertices(0);
|
||||
|
|
@ -369,13 +368,16 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered()
|
|||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
Item* poly_item =
|
||||
qobject_cast<Item*>(scene->item(index));
|
||||
Item* poly_item = qobject_cast<Item*>(scene->item(index));
|
||||
if (poly_item)
|
||||
{
|
||||
if(! CGAL::is_triangle_mesh(*poly_item->polyhedron())) {
|
||||
CGAL::Three::Three::error(QString("The mesh must have triangle faces"));
|
||||
return;
|
||||
}
|
||||
|
||||
std::size_t nbv = faces(*poly_item->polyhedron()).size();
|
||||
CGAL::Polygon_mesh_processing::remove_degenerate_faces(
|
||||
*poly_item->polyhedron());
|
||||
CGAL::Polygon_mesh_processing::remove_degenerate_faces(*poly_item->polyhedron());
|
||||
nbv -= faces(*poly_item->polyhedron()).size();
|
||||
poly_item->invalidateOpenGLBuffers();
|
||||
Q_EMIT poly_item->itemChanged();
|
||||
|
|
@ -395,10 +397,14 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_tr
|
|||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
Item* poly_item =
|
||||
qobject_cast<Item*>(scene->item(index));
|
||||
Item* poly_item = qobject_cast<Item*>(scene->item(index));
|
||||
if (poly_item)
|
||||
{
|
||||
if(! CGAL::is_triangle_mesh(*poly_item->polyhedron())) {
|
||||
CGAL::Three::Three::error(QString("The mesh must have triangle faces"));
|
||||
return;
|
||||
}
|
||||
|
||||
bool solved =
|
||||
CGAL::Polygon_mesh_processing::experimental::remove_self_intersections(
|
||||
*poly_item->polyhedron(), CGAL::parameters::preserve_genus(false));
|
||||
|
|
@ -420,10 +426,10 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_
|
|||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
Item* poly_item =
|
||||
qobject_cast<Item*>(scene->item(index));
|
||||
Item* poly_item = qobject_cast<Item*>(scene->item(index));
|
||||
if (poly_item)
|
||||
{
|
||||
CGAL::Polygon_mesh_processing::triangulate_faces(*poly_item->polyhedron());
|
||||
try{
|
||||
CGAL::Polygon_mesh_processing::experimental::autorefine(*poly_item->polyhedron());
|
||||
}
|
||||
|
|
@ -519,10 +525,10 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered(
|
|||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfIntersections_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
Item* poly_item =
|
||||
qobject_cast<Item*>(scene->item(index));
|
||||
Item* poly_item = qobject_cast<Item*>(scene->item(index));
|
||||
if (poly_item)
|
||||
{
|
||||
CGAL::Polygon_mesh_processing::triangulate_faces(*poly_item->polyhedron());
|
||||
try{
|
||||
bool solved =
|
||||
CGAL::Polygon_mesh_processing::experimental::
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public:
|
|||
ok = false;
|
||||
return QList<Scene_item*>();
|
||||
}
|
||||
item->setName(fileinfo.baseName());
|
||||
item->setName(fileinfo.completeBaseName());
|
||||
ok = true;
|
||||
if(add_to_scene)
|
||||
CGAL::Three::Three::scene()->addItem(item);
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ public:
|
|||
ui_widget.projection_checkBox->setChecked(true);
|
||||
|
||||
ui_widget.area_smoothing_checkBox->setChecked(false);
|
||||
#ifndef CGAL_PMP_USE_CERES_SOLVER
|
||||
ui_widget.area_smoothing_checkBox->setDisabled(true);
|
||||
#endif
|
||||
ui_widget.flip_checkBox->setChecked(true);
|
||||
ui_widget.flip_checkBox->setDisabled(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue