Public Member Functions | Protected Attributes

mitk::ColorSequenceCycleH Class Reference

Creates a list of around 36 different colors, where one is easily distinguished from the preceding one. More...

#include <mitkColorSequenceCycleH.h>

Inheritance diagram for mitk::ColorSequenceCycleH:
Inheritance graph
[legend]
Collaboration diagram for mitk::ColorSequenceCycleH:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ColorSequenceCycleH ()
virtual ~ColorSequenceCycleH ()
virtual Color GetNextColor ()
 Return another color.
virtual void GoToBegin ()
 Rewind to first color.
virtual void ChangeHueValueByCycleSteps (int steps)
 Increase the used Hue value. This can be done by steps ( = steps * 60 increase of Hue ) or absolute ( 0.0 < Hue < 360.0). Can also be used to decrease the Hue; Values < 0 are cropped to 0. Note: This does not change the other values, i.e. the color cycle. Therefor, the method can just be used to skip steps (i.e. colors) in a cycle. Use SetColorCycle if you want to change other values.
virtual void ChangeHueValueByAbsoluteNumber (float number)
virtual void SetColorCycle (unsigned short cycle)
 Set the color cycle. The color cycle has to be an integer value between 0 and 5 (see class description for an explanation). Use this in combination with the hue value cahnge to generate your dream colors...

Protected Attributes

float color_h
float color_s
float color_v
unsigned short color_cycle

Detailed Description

Creates a list of around 36 different colors, where one is easily distinguished from the preceding one.

The list of colors starts with a fully saturated, full valued red (Hue = 0 = 360). After that the sequence is generated like this:

Finally repeat colors.

Definition at line 39 of file mitkColorSequenceCycleH.h.


Constructor & Destructor Documentation

mitk::ColorSequenceCycleH::ColorSequenceCycleH (  )

Definition at line 23 of file mitkColorSequenceCycleH.cpp.

References color_cycle, color_h, color_s, and color_v.

{
  color_h = -60.0; // after the first increase this will yield red
  color_s = 1.0;  // full saturation
  color_v = 1.0; // full value
  color_cycle = 0;
}
mitk::ColorSequenceCycleH::~ColorSequenceCycleH (  ) [virtual]

Definition at line 31 of file mitkColorSequenceCycleH.cpp.

{
  // nothing to do
}

Member Function Documentation

void mitk::ColorSequenceCycleH::ChangeHueValueByAbsoluteNumber ( float  number ) [virtual]

Definition at line 110 of file mitkColorSequenceCycleH.cpp.

References color_h.

{
  color_h += number;
}
void mitk::ColorSequenceCycleH::ChangeHueValueByCycleSteps ( int  steps ) [virtual]

Increase the used Hue value. This can be done by steps ( = steps * 60 increase of Hue ) or absolute ( 0.0 < Hue < 360.0). Can also be used to decrease the Hue; Values < 0 are cropped to 0. Note: This does not change the other values, i.e. the color cycle. Therefor, the method can just be used to skip steps (i.e. colors) in a cycle. Use SetColorCycle if you want to change other values.

Definition at line 105 of file mitkColorSequenceCycleH.cpp.

References color_h.

{
  color_h += (float)(steps*60.0);
}
Color mitk::ColorSequenceCycleH::GetNextColor (  ) [virtual]

Return another color.

Implements mitk::ColorSequence.

Definition at line 36 of file mitkColorSequenceCycleH.cpp.

References color_cycle, color_h, color_s, color_v, and mitk::ColorConversions::Hsv2Rgb().

Referenced by SetColorCycle().

{
  color_h += 60.0;
  if ( color_h < 0.0 ) color_h = 0.0; 

  if (color_h >= 360.0)
  {
    if ( color_cycle == 0 )
    {
      color_h = 30.0;
      color_s = 1.0;
      color_v = 1.0;
      color_cycle = 1;
    }
    else if (color_cycle == 1)
    {
      color_h = 0.0;
      color_s = 0.5;
      color_v = 1.0;
      color_cycle = 2;
    }
    else if (color_cycle == 2)
    {
      color_h = 30.0;
      color_s = 0.5;
      color_v = 1.0;
      color_cycle = 3;
    }
    else if (color_cycle == 3)
    {
      color_h = 0.0;
      color_s = 1.0;
      color_v = 0.5;
      color_cycle = 4;
    }
    else if (color_cycle == 4)
    {
      color_h = 30.0;
      color_s = 1.0;
      color_v = 0.5;
      color_cycle = 5;
    }
    else if (color_cycle == 5)
    {
      color_h = 0.0;
      color_s = 1.0;
      color_v = 1.0;
      color_cycle = 0;
    }
  }

  // convert to rgb
  float r, g, b;
  ColorConversions::Hsv2Rgb(color_h, color_s, color_v, r, g, b);
  
  Color returnColor;
  returnColor.Set(r, g, b);
  
  return returnColor;
}
void mitk::ColorSequenceCycleH::GoToBegin (  ) [virtual]

Rewind to first color.

Implements mitk::ColorSequence.

Definition at line 97 of file mitkColorSequenceCycleH.cpp.

References color_cycle, color_h, color_s, and color_v.

{
  color_h = -60.0; // after the first increase this will yield red
  color_s = 1.0;  // full saturation
  color_v = 1.0; // full value
  color_cycle = 0;
}
void mitk::ColorSequenceCycleH::SetColorCycle ( unsigned short  cycle ) [virtual]

Set the color cycle. The color cycle has to be an integer value between 0 and 5 (see class description for an explanation). Use this in combination with the hue value cahnge to generate your dream colors...

Definition at line 115 of file mitkColorSequenceCycleH.cpp.

References color_cycle, color_h, and GetNextColor().

{
if ( cycle > 5 ) cycle = 5;
color_cycle = cycle;
color_h = 360.0;
this->GetNextColor();

}

Member Data Documentation

unsigned short mitk::ColorSequenceCycleH::color_cycle [protected]

Definition at line 80 of file mitkColorSequenceCycleH.h.

Referenced by ColorSequenceCycleH(), GetNextColor(), and GoToBegin().

Definition at line 81 of file mitkColorSequenceCycleH.h.

Referenced by ColorSequenceCycleH(), GetNextColor(), and GoToBegin().


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