inlib  1.2.0
Public Member Functions
inlib::sg::style_colormap Class Reference
Inheritance diagram for inlib::sg::style_colormap:
Inheritance graph
[legend]
Collaboration diagram for inlib::sg::style_colormap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool get_color (unsigned int a_index, colorf &a_col) const
bool get_color (const std::string &a_s, colorf &a_col) const
bool get_string_color (unsigned int a_index, std::string &a_s) const

Detailed Description

Definition at line 34 of file style_colormap.


Member Function Documentation

bool inlib::sg::style_colormap::get_color ( unsigned int  a_index,
colorf a_col 
) const [inline]

Definition at line 36 of file style_colormap.

                                                           {
    if(a_index>=size()) {
      a_col.set_value(0.5F,0.5F,0.5F);
      return false;
    }
    a_col = (*this)[a_index].second;
    return true;
  }
bool inlib::sg::style_colormap::get_color ( const std::string &  a_s,
colorf a_col 
) const [inline]

Definition at line 44 of file style_colormap.

                                                           {
    std::vector<style_color>::const_iterator it;
    for(it=begin();it!=end();++it) {
      if((*it).first==a_s) {
        a_col = (*it).second;
        return true;
      }
    }
    //we do not set a_col to something.
    return false;
  }
bool inlib::sg::style_colormap::get_string_color ( unsigned int  a_index,
std::string &  a_s 
) const [inline]

Definition at line 55 of file style_colormap.

                                                                  {
    if(a_index>=size()) {a_s.clear();return false;}
    colorf c = (*this)[a_index].second;
    char ss[192]; //3*64 = 192
#ifdef WIN32
    _snprintf(ss,sizeof(ss),"%g %g %g",c[0],c[1],c[2]);
#else
    ::snprintf(ss,sizeof(ss),"%g %g %g",c[0],c[1],c[2]);
#endif
    a_s = std::string(ss);  
    return true;
  }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines