/* * Label.hh * * Created on: 25 nov. 2013 * Author: CS */ #ifndef LABEL_HH_ #define LABEL_HH_ #include "Font.hh" #include "Color.hh" #include #include namespace plot { typedef std::vector LabelRowInfo; class Label { public: static const std::string DELIMITER; Label() : _color(0, 0, 0), _font(Font("", 0)) { } Label(Font font) : _color(0, 0, 0), _font(font) { } Label(Font font, Color color) : _color(color), _font(font) { } Label(const Label& label) : _text(label._text), _color(label._color), _font(label._font) { } virtual ~Label() { } const Font& getFont() const { return _font; } void setFont(const Font& font) { _font = font; } /** * @brief Determine number of line that compose label. */ static LabelRowInfo getRowNumber(Label const& pLegend); /** * Label text. */ std::string _text; /** * Text color */ Color _color; /** * Dumps label properties, used for test. */ void dump(std::ostream& out, std::string& prefix); private: /** * Label font name and size. */ Font _font; }; inline std::ostream& operator <<(std::ostream& out, Label& label) { out << "[LABEL]" << std::endl; out << "label.text=" << label._text; out << "label.color=" << label._color; std::string prefix = "label"; Font font = label.getFont(); font.dump(out, prefix); return out; } } /* namespace plot */ #endif /* LABEL_HH_ */