OGS
DataHolderLib Namespace Reference

Detailed Description

Classes

class  BoundaryCondition
 
class  ColorLookupTable
 
struct  ProcessVariable
 
class  FemCondition
 Base class for boundary conditions, initial conditions and source terms. More...
 
class  Project
 
class  SourceTerm
 Managing data associated with a source term. More...
 

Typedefs

using Color = std::array< unsigned char, 4 >
 

Enumerations

enum class  LUTType { NONE = 0 , LINEAR = 1 , EXPONENTIAL = 2 , SIGMOID = 3 }
 Interpolation methods. More...
 
enum class  BaseObjType { MESH = 0 , GEOMETRY = 1 }
 
enum class  ParameterType { NONE = 0 , CONSTANT , FUNCTION }
 

Functions

Color createColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
Color getRandomColor ()
 Returns a random RGB colour. More...
 
Color getColor (const std::string &id, std::map< std::string, Color > &colors)
 
Color getColor (const std::string &id, std::map< std::string, DataHolderLib::Color > &colors)
 

Typedef Documentation

◆ Color

using DataHolderLib::Color = typedef std::array<unsigned char, 4>

Definition at line 24 of file Color.h.

Enumeration Type Documentation

◆ BaseObjType

Enumerator
MESH 
GEOMETRY 

Definition at line 25 of file FemCondition.h.

◆ LUTType

Interpolation methods.

Enumerator
NONE 
LINEAR 
EXPONENTIAL 
SIGMOID 

Definition at line 23 of file ColorLookupTable.h.

23  {
24  NONE = 0,
25  LINEAR = 1,
26  EXPONENTIAL = 2,
27  SIGMOID = 3 // not yet implemented
28 };

◆ ParameterType

Enumerator
NONE 
CONSTANT 
FUNCTION 

Definition at line 31 of file FemCondition.h.

Function Documentation

◆ createColor()

Color DataHolderLib::createColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

Definition at line 21 of file Color.cpp.

25 {
26  return Color{{r, g, b, a}};
27 }
std::array< unsigned char, 4 > Color
Definition: Color.h:24
static const double r

References MathLib::r.

Referenced by getRandomColor(), and FileIO::XmlLutReader::readFromFile().

◆ getColor() [1/2]

Color DataHolderLib::getColor ( const std::string &  id,
std::map< std::string, Color > &  colors 
)

Definition at line 36 of file Color.cpp.

37 {
38  auto it = colors.find(id);
39 
40  if (it == end(colors))
41  {
42  WARN("Key '{:s}' not found in color lookup table.", id);
43  it = colors.insert({id, getRandomColor()}).first;
44  }
45 
46  return it->second;
47 }
void WARN(char const *fmt, Args const &... args)
Definition: Logging.h:37
Color getRandomColor()
Returns a random RGB colour.
Definition: Color.cpp:29

References getRandomColor(), and WARN().

Referenced by ColorPickerPushButton::mouseReleaseEvent(), and StratBar::paint().

◆ getColor() [2/2]

Color DataHolderLib::getColor ( const std::string &  id,
std::map< std::string, DataHolderLib::Color > &  colors 
)

Uses a color-lookup-table (in form of a map) to return a colour for a specified name. If the name is not in the colortable a new entry is created with the new name and a random colour.

◆ getRandomColor()

Color DataHolderLib::getRandomColor ( )

Returns a random RGB colour.

Definition at line 29 of file Color.cpp.

30 {
31  return createColor(static_cast<unsigned char>((rand() % 5) * 50),
32  static_cast<unsigned char>((rand() % 5) * 50),
33  static_cast<unsigned char>((rand() % 5) * 50));
34 }
Color createColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: Color.cpp:21

References createColor().

Referenced by VtkPointsSource::VtkPointsSource(), VtkPolylinesSource::VtkPolylinesSource(), VtkStationSource::VtkStationSource(), VtkSurfacesSource::VtkSurfacesSource(), DetailWindow::addList(), and getColor().