mirror of https://github.com/CGAL/cgal
Change API
This commit is contained in:
parent
5139da74c5
commit
9dc71d3a61
|
|
@ -133,6 +133,7 @@ Optimizer_thread* cgal_code_optimization(Scene_c3t3_item& c3t3_item,
|
|||
if ( NULL != sm_item )
|
||||
{
|
||||
const_cast<Scene_surface_mesh_item*>(sm_item)->setItemIsMulticolor(true);
|
||||
const_cast<Scene_surface_mesh_item*>(sm_item)->computeItemColorVectorAutomatically(true);
|
||||
// Build domain
|
||||
const SMesh* smesh = sm_item->face_graph();
|
||||
if ( NULL == smesh )
|
||||
|
|
|
|||
|
|
@ -97,8 +97,11 @@ private:
|
|||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
item->face_graph()->collect_garbage();
|
||||
item->color_vector().clear();
|
||||
if(!item->hasPatchIds())
|
||||
if(!item->hasPatchIds()){
|
||||
item->setItemIsMulticolor(true);
|
||||
item->computeItemColorVectorAutomatically(true);
|
||||
}
|
||||
|
||||
typedef boost::property_map<FaceGraph,CGAL::face_patch_id_t<int> >::type PatchIDMap;
|
||||
FaceGraph* fg =item->face_graph();
|
||||
boost::property_map<FaceGraph, boost::vertex_index_t>::type
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dial
|
|||
.vertex_incident_patches_map(vip));
|
||||
//update item
|
||||
item->setItemIsMulticolor(true);
|
||||
item->computeItemColorVectorAutomatically(true);
|
||||
item->invalidateOpenGLBuffers();
|
||||
|
||||
// update scene
|
||||
|
|
|
|||
|
|
@ -473,7 +473,16 @@ public Q_SLOTS:
|
|||
}
|
||||
selection_item->polyhedron_item()->setColor(
|
||||
selection_item->polyhedron_item()->color());
|
||||
selection_item->polyhedron_item()->setItemIsMulticolor(fpmap_valid);
|
||||
if(fpmap_valid)
|
||||
{
|
||||
selection_item->polyhedron_item()->setItemIsMulticolor(true);
|
||||
selection_item->polyhedron_item()->computeItemColorVectorAutomatically(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_item->polyhedron_item()->setItemIsMulticolor(false);
|
||||
}
|
||||
|
||||
selection_item->polyhedron_item()->polyhedron()->collect_garbage();
|
||||
//fix constrained_edges_map
|
||||
for(int i=0; i< nE; ++i)
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedCom
|
|||
typedef boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||
|
||||
selection_item->polyhedron_item()->setItemIsMulticolor(true);
|
||||
selection_item->polyhedron_item()->computeItemColorVectorAutomatically(true);
|
||||
FaceGraph& pmesh = *(selection_item->polyhedron());
|
||||
|
||||
boost::property_map<FaceGraph, boost::face_index_t>::type fim
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment()
|
|||
|
||||
}
|
||||
item_segmentation->setItemIsMulticolor(true);
|
||||
item_segmentation->computeItemColorVectorAutomatically(true);
|
||||
item_segmentation->setProperty("NbPatchIds", nb_segment); //for join_and_split plugin
|
||||
item_segmentation->invalidateOpenGLBuffers();
|
||||
scene->addItem(item_segmentation);
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ void Polyhedron_demo_mesh_plane_detection_plugin::colorize_segmentation(
|
|||
std::vector<QColor>& color_vector)
|
||||
{
|
||||
item->setItemIsMulticolor(true);
|
||||
item->computeItemColorVectorAutomatically(true);
|
||||
SMesh* sm = item->face_graph();
|
||||
color_vector.clear();
|
||||
std::size_t max_segment = 0;
|
||||
|
|
|
|||
|
|
@ -377,7 +377,8 @@ void Polyhedron_demo_mesh_segmentation_plugin::colorize_sdf(
|
|||
}
|
||||
put(pidmap, *facet_it, static_cast<int>(patch_id));
|
||||
}
|
||||
item->setItemIsMulticolor(true, false);
|
||||
item->setItemIsMulticolor(true);
|
||||
item->computeItemColorVectorAutomatically(false);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -407,6 +408,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::colorize_segmentation(
|
|||
color_vector.push_back(aColor);
|
||||
}
|
||||
item->setItemIsMulticolor(true);
|
||||
item->computeItemColorVectorAutomatically(true);
|
||||
item->setProperty("NbPatchIds", static_cast<int>(max_segment + 1)); //for join_and_split plugin
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -793,6 +793,7 @@ public:
|
|||
|
||||
void setItemIsMulticolor(bool b) {
|
||||
poly_item->setItemIsMulticolor(b);
|
||||
poly_item->computeItemColorVectorAutomatically(b);
|
||||
}
|
||||
|
||||
void selection_changed(bool b);
|
||||
|
|
|
|||
|
|
@ -1381,9 +1381,8 @@ bool Scene_surface_mesh_item::intersect_face(double orig_x,
|
|||
return false;
|
||||
|
||||
}
|
||||
void Scene_surface_mesh_item::setItemIsMulticolor(bool b, bool recompute_colors)
|
||||
void Scene_surface_mesh_item::setItemIsMulticolor(bool b)
|
||||
{
|
||||
this->setProperty("recompute_colors",recompute_colors);
|
||||
if(b)
|
||||
{
|
||||
d->fpatch_id_map = d->smesh_->add_property_map<face_descriptor,int>("f:patch_id", 1).first;
|
||||
|
|
@ -2219,3 +2218,8 @@ void Scene_surface_mesh_item::copyProperties(Scene_item *item)
|
|||
int value = sm_item->alphaSlider()->value();
|
||||
alphaSlider()->setValue(value);
|
||||
}
|
||||
|
||||
void Scene_surface_mesh_item::computeItemColorVectorAutomatically(bool b)
|
||||
{
|
||||
this->setProperty("recompute_colors",b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,11 +68,14 @@ public:
|
|||
|
||||
QMenu* contextMenu() Q_DECL_OVERRIDE;
|
||||
|
||||
//first bool to set property, second to disable the recomputation of the colors_ vector
|
||||
//to scale on min_patch value. For example, the Mesh_segmentation_plugin computes the colors_
|
||||
// vector itself, so it must set recompute_colors to false to avoid having it ovewritten
|
||||
void setItemIsMulticolor(bool);
|
||||
//to be called before invalidate() to enable or disable the recomputation
|
||||
//of the colors_ vector to scale on min_patch value.
|
||||
// For example, the Mesh_segmentation_plugin computes the colors_
|
||||
// vector itself, so it must set recompute_colors to false to avoid
|
||||
// having it ovewritten
|
||||
// in the code of this item.
|
||||
void setItemIsMulticolor(bool, bool recompute_colors = true);
|
||||
void computeItemColorVectorAutomatically(bool);
|
||||
bool isItemMulticolor();
|
||||
bool hasPatchIds();
|
||||
Vertex_selection_map vertex_selection_map();
|
||||
|
|
|
|||
Loading…
Reference in New Issue