CategoryInfo.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*!
  2. * \file CategoryInfo.cpp
  3. * \brief
  4. * \author Gapchich Vladislav
  5. * \date 23/10/11
  6. */
  7. #include "vislearning/cbaselib/CategoryInfo.h"
  8. using namespace OBJREC;
  9. using namespace std;
  10. //! A constructor
  11. CategoryInfo::CategoryInfo()
  12. {
  13. category_name_.clear();
  14. id_ = -1;
  15. color_ = 0;
  16. is_main_ = 0;
  17. }
  18. //! A copy-constructur
  19. CategoryInfo::CategoryInfo(const CategoryInfo &copy)
  20. {
  21. category_name_ = copy.categoryName();
  22. color_ = copy.color();
  23. id_ = copy.id();
  24. is_main_ = copy.isMain();
  25. }
  26. //! A desctructor
  27. CategoryInfo::~CategoryInfo()
  28. {
  29. }
  30. //! Sets category name(label)
  31. /*!
  32. * \param[in] aCategoryName should not be empty otherwise member does nothing.
  33. */
  34. void
  35. CategoryInfo::setCategoryName(const std::string &aCategoryName)
  36. {
  37. if (aCategoryName.empty()) {
  38. return;
  39. /* NOTREACHED */
  40. }
  41. category_name_ = aCategoryName;
  42. }
  43. //! Sets category ID(label ID)
  44. /*!
  45. * \param[in] anID should not be negative otherwise id_ becomes -1
  46. */
  47. void
  48. CategoryInfo::setID(const int &anID)
  49. {
  50. if (anID < 0) {
  51. id_ = -1;
  52. return;
  53. /* NOTREACHED */
  54. }
  55. id_ = anID;
  56. }
  57. //! Sets the color of a category
  58. /*!
  59. * \param[in] aColor is unsigned in which can be translated into ARGB
  60. * like 0xAARRBBGG
  61. */
  62. void
  63. CategoryInfo::setColor(const unsigned int &aColor)
  64. {
  65. color_ = aColor;
  66. }
  67. //! Sets category priority
  68. /*!
  69. * \param[in] aMain is a flag indicating whether current label is main or not
  70. */
  71. void
  72. CategoryInfo::setMain(bool aMain)
  73. {
  74. is_main_ = aMain;
  75. }
  76. //! returns category name(label name)
  77. std::string
  78. CategoryInfo::categoryName() const
  79. {
  80. return category_name_;
  81. }
  82. //! returns category ID(label ID)
  83. int
  84. CategoryInfo::id() const
  85. {
  86. return id_;
  87. }
  88. //! \brief returns unsigned int indicating category color which can
  89. //! be translated into ARGB like 0xAARRBBGG
  90. unsigned int
  91. CategoryInfo::color() const
  92. {
  93. return color_;
  94. }
  95. //! returns is_main_ flag
  96. bool
  97. CategoryInfo::isMain() const
  98. {
  99. return is_main_;
  100. }
  101. /*
  102. *
  103. */