static const Color *create_named_color(std::string str){ toLowerI(str); static ColorMap cm; ColorMap::iterator it = cm.find(str); if(it != cm.end()) return &it->second; else return 0; }
int Color(ColorVector& colors) { int maxColorUsed = 0; //Reset all the colors for(ColorVertex* cVertex: adjacencyList) { cVertex->setColor(-1); } for(ColorVertex* cVertex: adjacencyList) { ColorMap cmap; for(Edge* edge: cVertex->edges) { cmap[((ColorVertex *)(edge->getVertex()))->getColor()] = true; } for(color_t color: colors) { if(cmap.find(color) == cmap.end()) { cout << color << endl; cVertex->setColor(color); if(color > maxColorUsed) { maxColorUsed = color; } break; } } } return maxColorUsed; }
// ---------------------------------------------------------------------------- // bool RGBWA::getColorByName( LPCSTR color_name, RGBWA& rgb ) { ColorMap::iterator it = predefinedColors.find( color_name ); if ( it == predefinedColors.end() ) return false; rgb = (*it).second; return true; }