- return i->second;
-
- GL::Color best_color;
- float best_score = 0;
- for(unsigned j=0; (j<100 && best_score<1); ++j)
- {
- GL::Color color = generate_color(number<1024);
-
- float score = 2;
- for(i=ports.begin(); i!=ports.end(); ++i)
- {
- const GL::Color &other = i->second.get_color();
- float dr = color.r-other.r;
- float dg = color.g-other.g;
- float db = color.b-other.b;
- score = min(score, dr*dr+dg*dg+db*db);
- }
- if(score>best_score)
- {
- best_score = score;
- best_color = color;
- }
- }
- best_color.a = 0.4f;
- i = ports.insert(map<unsigned, Port>::value_type(number, Port(number, best_color))).first;
- return i->second;
-}
-
-void NetVis::key_press(unsigned key, unsigned, wchar_t)
-{
- if(key==46)
- draw_labels = !draw_labels;
- else if(key==56)
- {
- blend = !blend;
- GL::set(GL_BLEND, blend);
- }