add a way to not update automatically the color vector

(in case a plugin has fixed it)
This commit is contained in:
Sébastien Loriot 2012-08-03 13:20:30 +00:00
parent 2f6dae6bbb
commit 8fdfaaf041
2 changed files with 22 additions and 13 deletions

View File

@ -62,7 +62,8 @@ Scene_polyhedron_item::Scene_polyhedron_item()
poly(new Polyhedron),
show_only_feature_edges_m(false),
facet_picking_m(false),
erase_next_picked_facet_m(false)
erase_next_picked_facet_m(false),
plugin_has_set_color_vector_m(false)
{
//init();
}
@ -72,7 +73,8 @@ Scene_polyhedron_item::Scene_polyhedron_item(Polyhedron* const p)
poly(p),
show_only_feature_edges_m(false),
facet_picking_m(false),
erase_next_picked_facet_m(false)
erase_next_picked_facet_m(false),
plugin_has_set_color_vector_m(false)
{
init();
}
@ -82,7 +84,8 @@ Scene_polyhedron_item::Scene_polyhedron_item(const Polyhedron& p)
poly(new Polyhedron(p)),
show_only_feature_edges_m(false),
facet_picking_m(false),
erase_next_picked_facet_m(false)
erase_next_picked_facet_m(false),
plugin_has_set_color_vector_m(false)
{
init();
}
@ -108,17 +111,20 @@ init()
{
typedef Polyhedron::Facet_iterator Facet_iterator;
// Fill indices map and get max subdomain value
int max = 0;
for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
fit != end; ++fit)
if ( !plugin_has_set_color_vector_m )
{
max = (std::max)(max, fit->patch_id());
// Fill indices map and get max subdomain value
int max = 0;
for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
fit != end; ++fit)
{
max = (std::max)(max, fit->patch_id());
}
colors_.clear();
compute_color_map(this->color(), max + 1,
std::back_inserter(colors_));
}
colors_.clear();
compute_color_map(this->color(), max + 1,
std::back_inserter(colors_));
}

View File

@ -51,7 +51,8 @@ public:
bool isEmpty() const;
Bbox bbox() const;
std::vector<QColor>& color_vector() {return colors_;}
void set_color_vector_read_only(bool on_off) {plugin_has_set_color_vector_m=on_off;}
public slots:
virtual void changed();
void show_only_feature_edges(bool);
@ -85,6 +86,8 @@ private:
bool show_only_feature_edges_m;
bool facet_picking_m;
bool erase_next_picked_facet_m;
//the following variable is used to indicate if the color vector must not be automatically updated.
bool plugin_has_set_color_vector_m;
}; // end class Scene_polyhedron_item
#endif // SCENE_POLYHEDRON_ITEM_H