remove display all ids and initialize ids displaying to false.

This commit is contained in:
Maxime Gimeno 2018-01-22 16:40:41 +01:00
parent 36ec70659f
commit 19af16022c
3 changed files with 19 additions and 53 deletions

View File

@ -121,10 +121,9 @@ struct Scene_polyhedron_item_priv{
nb_f_lines = 0;
is_multicolor = false;
no_flat = false;
vertices_displayed = true;
edges_displayed = true;
faces_displayed = true;
all_primitives_displayed = false;
vertices_displayed = false;
edges_displayed = false;
faces_displayed = false;
invalidate_stats();
CGAL::set_halfedgeds_items_id(*poly);
}
@ -189,7 +188,6 @@ struct Scene_polyhedron_item_priv{
mutable bool vertices_displayed;
mutable bool edges_displayed;
mutable bool faces_displayed;
mutable bool all_primitives_displayed;
mutable QList<double> text_ids;
mutable std::vector<TextItem*> targeted_id;
void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
@ -1142,13 +1140,6 @@ QMenu* Scene_polyhedron_item::contextMenu()
connect(actionPrintFaces, SIGNAL(triggered(bool)),
this, SLOT(showFaces(bool)));
QAction* actionPrintAll=
menu->addAction(tr("Display All Ids"));
actionPrintAll->setCheckable(true);
actionPrintAll->setObjectName("actionPrintAll");
connect(actionPrintAll, SIGNAL(triggered(bool)),
this, SLOT(showPrimitives(bool)));
QAction* actionZoomToId=
menu->addAction(tr("Zoom to Index"));
actionZoomToId->setObjectName("actionZoomToId");
@ -1212,8 +1203,6 @@ QMenu* Scene_polyhedron_item::contextMenu()
if(action) action->setChecked(d->edges_displayed);
action = menu->findChild<QAction*>("actionPrintFaces");
if(action) action->setChecked(d->faces_displayed);
action = menu->findChild<QAction*>("actionPrintAll");
if(action) action->setChecked(d->all_primitives_displayed);
return menu;
}
@ -1845,8 +1834,6 @@ CGAL::Three::Scene_item::Header_data Scene_polyhedron_item::header() const
void Scene_polyhedron_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
{
if(d->all_primitives_displayed)
return;
typedef Input_facets_AABB_tree Tree;
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
if(!aabb_tree)
@ -1871,8 +1858,7 @@ void Scene_polyhedron_item_priv::fillTargetedIds(const Polyhedron::Facet_handle&
textVItems,
textEItems,
textFItems,
&targeted_id,
&all_primitives_displayed);
&targeted_id);
if(vertices_displayed
@ -1928,8 +1914,7 @@ void Scene_polyhedron_item_priv::killIds()
textVItems,
textEItems,
textFItems,
&targeted_id,
&all_primitives_displayed);
&targeted_id);
}
void Scene_polyhedron_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
@ -1944,7 +1929,6 @@ void Scene_polyhedron_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
s3(printFaceIds(viewer));
if((s1 && s2 && s3))
{
d->all_primitives_displayed = true;
viewer->update();
}
return;
@ -2253,6 +2237,7 @@ void Scene_polyhedron_item::zoomToId()
tr("v0"), &ok);
if(!ok)
return;
CGAL::Three::Viewer_interface* viewer =
qobject_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first());
Point p;

View File

@ -88,10 +88,9 @@ struct Scene_surface_mesh_item_priv{
item = parent;
has_feature_edges = false;
invalidate_stats();
vertices_displayed = true;
edges_displayed = true;
faces_displayed = true;
all_primitives_displayed = false;
vertices_displayed = false;
edges_displayed = false;
faces_displayed = false;
}
Scene_surface_mesh_item_priv(SMesh* sm, Scene_surface_mesh_item *parent):
@ -100,10 +99,9 @@ struct Scene_surface_mesh_item_priv{
item = parent;
has_feature_edges = false;
invalidate_stats();
vertices_displayed = true;
edges_displayed = true;
faces_displayed = true;
all_primitives_displayed = false;
vertices_displayed = false;
edges_displayed = false;
faces_displayed = false;
}
~Scene_surface_mesh_item_priv()
@ -165,7 +163,6 @@ struct Scene_surface_mesh_item_priv{
mutable bool vertices_displayed;
mutable bool edges_displayed;
mutable bool faces_displayed;
mutable bool all_primitives_displayed;
mutable QList<double> text_ids;
mutable std::vector<TextItem*> targeted_id;
@ -1706,12 +1703,6 @@ QMenu* Scene_surface_mesh_item::contextMenu()
connect(actionPrintFaces, SIGNAL(triggered(bool)),
this, SLOT(showFaces(bool)));
QAction* actionPrintAll=
menu->addAction(tr("Display All Ids"));
actionPrintAll->setCheckable(true);
actionPrintAll->setObjectName("actionPrintAll");
connect(actionPrintAll, SIGNAL(triggered(bool)),
this, SLOT(showPrimitives(bool)));
QAction* actionZoomToId=
menu->addAction(tr("Zoom to Index"));
@ -1727,14 +1718,10 @@ QMenu* Scene_surface_mesh_item::contextMenu()
if(action) action->setChecked(d->edges_displayed);
action = menu->findChild<QAction*>("actionPrintFaces");
if(action) action->setChecked(d->faces_displayed);
action = menu->findChild<QAction*>("actionPrintAll");
if(action) action->setChecked(d->all_primitives_displayed);
return menu;
}
void Scene_surface_mesh_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
{
if(d->all_primitives_displayed)
return;
typedef Input_facets_AABB_tree Tree;
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
if(!aabb_tree)
@ -1759,8 +1746,7 @@ void Scene_surface_mesh_item_priv::fillTargetedIds(const face_descriptor &select
textVItems,
textEItems,
textFItems,
&targeted_id,
&all_primitives_displayed);
&targeted_id);
if(vertices_displayed
@ -1816,8 +1802,7 @@ void Scene_surface_mesh_item_priv::killIds()
textVItems,
textEItems,
textFItems,
&targeted_id,
&all_primitives_displayed);
&targeted_id);
}
void Scene_surface_mesh_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
@ -1832,7 +1817,6 @@ void Scene_surface_mesh_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
s3(printFaceIds(viewer));
if((s1 && s2 && s3))
{
d->all_primitives_displayed = true;
viewer->update();
}
return;
@ -1887,7 +1871,7 @@ void Scene_surface_mesh_item::showEdges(bool b)
if(d->textEItems->isEmpty())
{
d->edges_displayed = b;
printFaceIds(viewer);
printEdgeIds(viewer);
}
else
renderer->addTextList(d->textEItems);

View File

@ -85,8 +85,7 @@ void deleteIds(CGAL::Three::Viewer_interface* viewer,
TextListItem* vitems,
TextListItem* eitems,
TextListItem* fitems,
std::vector<TextItem*>* targeted_ids,
bool *all_primitives_displayed)
std::vector<TextItem*>* targeted_ids)
{
TextRenderer *renderer = viewer->textRenderer();
BOOST_FOREACH(TextItem* it, vitems->textList())
@ -102,7 +101,6 @@ void deleteIds(CGAL::Three::Viewer_interface* viewer,
fitems->clear();
renderer->removeTextList(fitems);
targeted_ids->clear();
*all_primitives_displayed = false;
viewer->update();
}
@ -175,8 +173,7 @@ void compute_displayed_ids(Mesh& mesh,
TextListItem* vitems,
TextListItem* eitems,
TextListItem* fitems,
std::vector<TextItem*>* targeted_ids,
bool *all_primitives_displayed)
std::vector<TextItem*>* targeted_ids)
{
typedef typename boost::graph_traits<Mesh>::face_descriptor face_descriptor;
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
@ -228,11 +225,11 @@ void compute_displayed_ids(Mesh& mesh,
if(text_item->position() == point)
{
//hide and stop
deleteIds(viewer, vitems, eitems, fitems, targeted_ids, all_primitives_displayed);
deleteIds(viewer, vitems, eitems, fitems, targeted_ids);
return;
}
}
deleteIds(viewer, vitems, eitems, fitems, targeted_ids, all_primitives_displayed);
deleteIds(viewer, vitems, eitems, fitems, targeted_ids);
// test the midpoint of edges of the closest face
BOOST_FOREACH(halfedge_descriptor e, halfedges_around_face(halfedge(selected_fh, mesh), mesh))
{