mirror of https://github.com/CGAL/cgal
Update displayed ids when moving a point
This commit is contained in:
parent
825399a515
commit
261eb678b0
|
|
@ -2610,3 +2610,17 @@ CGAL::Three::Scene_item::Header_data Scene_polyhedron_selection_item::header() c
|
|||
data.titles.append(QString("Average"));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void Scene_polyhedron_selection_item::updateDisplayedIds(QEvent* e)
|
||||
{
|
||||
if(e->type() == QEvent::MouseButtonRelease )
|
||||
{
|
||||
QMouseEvent* mouse_event = static_cast<QMouseEvent*>(e);
|
||||
if((mouse_event->button() == Qt::RightButton || mouse_event->button() == Qt::MiddleButton)
|
||||
&& temp_selected_vertices.size() == 1) {
|
||||
fg_vertex_descriptor vh = *temp_selected_vertices.begin();
|
||||
poly_item->updateIds(vh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -799,6 +799,7 @@ public:
|
|||
}
|
||||
|
||||
void selection_changed(bool);
|
||||
void updateDisplayedIds(QEvent *e);
|
||||
|
||||
Q_SIGNALS:
|
||||
void updateInstructions(QString);
|
||||
|
|
@ -875,6 +876,8 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
updateDisplayedIds(gen_event);
|
||||
|
||||
if(!visible() || !k_ring_selector.state.shift_pressing) { return false; }
|
||||
if(gen_event->type() == QEvent::Wheel)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ struct Scene_surface_mesh_item_priv{
|
|||
<< GouraudPlusEdges
|
||||
<< Points;
|
||||
item->setProperty("classname", QString("surface_mesh"));
|
||||
ids_need_update = false;
|
||||
}
|
||||
|
||||
Scene_surface_mesh_item_priv(SMesh* sm, Scene_surface_mesh_item *parent):
|
||||
|
|
@ -168,7 +169,8 @@ struct Scene_surface_mesh_item_priv{
|
|||
<< Gouraud
|
||||
<< GouraudPlusEdges
|
||||
<< Points;
|
||||
item->setProperty("classname", QString("surface_mesh"));
|
||||
item->setProperty("classname", QString("surface_mesh"));\
|
||||
ids_need_update = false;
|
||||
}
|
||||
|
||||
~Scene_surface_mesh_item_priv()
|
||||
|
|
@ -224,7 +226,6 @@ struct Scene_surface_mesh_item_priv{
|
|||
mutable bool edges_displayed;
|
||||
mutable bool faces_displayed;
|
||||
mutable bool all_displayed;
|
||||
mutable QList<double> text_ids;
|
||||
mutable std::vector<TextItem*> targeted_id;
|
||||
|
||||
std::string comments;
|
||||
|
|
@ -239,7 +240,6 @@ struct Scene_surface_mesh_item_priv{
|
|||
mutable bool isinit;
|
||||
mutable std::vector<unsigned int> idx_data_;
|
||||
mutable std::size_t idx_data_size;
|
||||
mutable std::map<unsigned int, unsigned int> current_indices; //map im values to ghosts-free values
|
||||
mutable std::vector<unsigned int> idx_edge_data_;
|
||||
mutable std::size_t idx_edge_data_size;
|
||||
mutable std::vector<unsigned int> idx_feature_edge_data_;
|
||||
|
|
@ -267,6 +267,7 @@ struct Scene_surface_mesh_item_priv{
|
|||
bool has_nm_vertices;
|
||||
int genus;
|
||||
bool self_intersect;
|
||||
bool ids_need_update;
|
||||
mutable QSlider* alphaSlider;
|
||||
QList<RenderingMode> supported_rendering_modes;
|
||||
};
|
||||
|
|
@ -2017,6 +2018,7 @@ void Scene_surface_mesh_item_priv::fillTargetedIds(const face_descriptor &select
|
|||
CGAL::Three::Viewer_interface *viewer,
|
||||
const CGAL::qglviewer::Vec& offset)
|
||||
{
|
||||
all_displayed = false;
|
||||
compute_displayed_ids(*smesh_,
|
||||
viewer,
|
||||
selected_fh,
|
||||
|
|
@ -2369,9 +2371,31 @@ void Scene_surface_mesh_item::updateVertex(vertex_descriptor vh)
|
|||
getTriangleContainer(0)->getVbo(Tri::Smooth_normals),
|
||||
new_point,id);
|
||||
}
|
||||
d->ids_need_update = true;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Scene_surface_mesh_item::updateIds(vertex_descriptor vh)
|
||||
{
|
||||
if(d->ids_need_update &&
|
||||
(d->faces_displayed || d->vertices_displayed || d->edges_displayed))
|
||||
{
|
||||
invalidate_aabb_tree();
|
||||
|
||||
if(d->all_displayed)
|
||||
{
|
||||
d->killIds();
|
||||
d->all_displayed = true;
|
||||
::printVertexIds(*d->smesh_, d->textVItems);
|
||||
}
|
||||
else
|
||||
{
|
||||
d->fillTargetedIds(face(halfedge(vh, *d->smesh_), *d->smesh_),
|
||||
face_graph()->point(vh), CGAL::Three::Three::mainViewer(), CGAL::Three::Three::mainViewer()->offset());
|
||||
}
|
||||
d->ids_need_update = false;
|
||||
}
|
||||
invalidate_aabb_tree();
|
||||
redraw();
|
||||
}
|
||||
|
||||
void Scene_surface_mesh_item::switchToGouraudPlusEdge(bool b)
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ public:
|
|||
void computeElements() const Q_DECL_OVERRIDE;
|
||||
void initializeBuffers(CGAL::Three::Viewer_interface*)const Q_DECL_OVERRIDE;
|
||||
void updateVertex(vertex_descriptor vh);
|
||||
void updateIds(vertex_descriptor vh);
|
||||
void switchToGouraudPlusEdge(bool b); //replace flatPlusEdge by gouraudPlusEdge and ban Flat.
|
||||
Q_SIGNALS:
|
||||
void item_is_about_to_be_changed();
|
||||
|
|
|
|||
Loading…
Reference in New Issue