AbstractExtendedVisualizer.cpp
Go to the documentation of this file.
1 
19 
20 namespace Visualization {
21 
23  {
24  }
25 
27  {
28  }
29 
30  void AbstractExtendedVisualizer::setColors(const std_msgs::ColorRGBA& pFirstColor,
31  const std_msgs::ColorRGBA& pSecondColor,
32  const std_msgs::ColorRGBA& pThirdColor)
33  {
34  // All color parameter values of the first color must be in [0,1].
35  if((pFirstColor.r < 0.0f || pFirstColor.r > 1.0f) || (pFirstColor.g < 0.0f || pFirstColor.g > 1.0f) || (pFirstColor.b < 0.0f || pFirstColor.b > 1.0f) || (pFirstColor.a < 0.0f || pFirstColor.a > 1.0f))
36  throw std::out_of_range("First ring color contains no valid color information.");
37 
38  // All color parameter values of the second color must be in [0,1].
39  if((pSecondColor.r < 0.0f || pSecondColor.r > 1.0f) || (pSecondColor.g < 0.0f || pSecondColor.g > 1.0f) || (pSecondColor.b < 0.0f || pSecondColor.b > 1.0f) || (pSecondColor.a < 0.0f || pSecondColor.a > 1.0f))
40  throw std::out_of_range("Second ring color contains no valid color information.");
41 
42  // All color parameter values of the second color must be in [0,1].
43  if((pThirdColor.r < 0.0f || pThirdColor.r > 1.0f) || (pThirdColor.g < 0.0f || pThirdColor.g > 1.0f) || (pThirdColor.b < 0.0f || pThirdColor.b > 1.0f) || (pThirdColor.a < 0.0f || pThirdColor.a > 1.0f))
44  throw std::out_of_range("Third ring color contains no valid color information.");
45 
46  // Add the colors to the list.
47  mColors.push_back(pFirstColor);
48  mColors.push_back(pSecondColor);
49  mColors.push_back(pThirdColor);
50  }
51 
52  void AbstractExtendedVisualizer::setScaleFactor(const double pScaleFactor)
53  {
54  mScaleFactor = pScaleFactor;
55  }
56 
57  const std_msgs::ColorRGBA AbstractExtendedVisualizer::getColor(unsigned int pNumber)
58  {
59  if(pNumber > (mColors.size() - 1))
60  throw std::out_of_range("Unable to access a color. Index out of range.");
61 
62  return mColors[pNumber];
63  }
64 
66  {
67  return mScaleFactor;
68  }
69 
70 }
std::vector< std_msgs::ColorRGBA > mColors
const std_msgs::ColorRGBA getColor(unsigned int pNumber)
void setColors(const std_msgs::ColorRGBA &pFirstColor, const std_msgs::ColorRGBA &pSecondColor, const std_msgs::ColorRGBA &pThirdColor)


asr_psm_visualizations
Author(s): Gehrung Joachim, Meißner Pascal
autogenerated on Sat Nov 9 2019 03:49:12