/** * @RDE_HEADER@ * TextStyle * $Id$ * $HeadURL$ * $Author$ */ #pragma once // Own #include "situation_map_types.h" #include // Qt #include //---------------------------------------------------------------------------- namespace SituationMap { /*! \brief Horizontal alignment for text. */ enum class HorizontalAlignment { Left, Center, Right, Justify // ??? }; /*! \brief Vertical alignment for text. */ enum class VerticalAlignment { Bottom, Middle, Top, BaseLine }; /** * @brief The TextStyle class contains text parameter like color, size, font.... * * The default TextSymbol size is 15.0. * The default TextSymbol color is black. * The default TextSymbol horizontal alignment is left. * The default TextSymbol vertical alignment is bottom. */ class SITUATIONMAP_EXPORT TextStyle final { public: /*! \name Construction, Destruction */ //@{ /** * @brief Constructor */ TextStyle() = default; /** * @brief Constructor */ explicit TextStyle(const QColor &textColor); /** * @brief Constructor */ TextStyle(const QColor &textColor, float size); /** * @brief Destructor */ ~TextStyle() = default; //@} /** \name Parameters * Set and get methods for the different parameters. */ //@{ QColor textColor() const; void setTextColor(const QColor &textColor); float size() const; void setSize(float size); float angle() const; void setAngle(float angleDegree); const QString &fontFamily() const; void setFontFamily(const QString &fontFamily); bool bold() const; void setBold(bool bold); bool italic() const; void setItalic(bool italic); bool underline() const; void setUnderline(bool underline); bool strikeThrough() const; void setStrikeThrough(bool strikeThrough); float textOutlineWidth() const; void setTextOutlineWidth(float textOutlineWidth); QColor textOutlineColor() const; void setTextOutlineColor(const QColor &textOutlineColor); QColor backgroundColor() const; void setBackgroundColor(const QColor &backgroundColor); HorizontalAlignment horizontalAlignment() const; void setHorizontalAlignment(const HorizontalAlignment &horizontalAlignment); VerticalAlignment verticalAlignment() const; void setVerticalAlignment(const VerticalAlignment &verticalAlignment); bool antiAliased() const; void setAntiAliased(bool antiAliased); //@} /** * @brief operator== Compare two objects * @param other to be compared with * @return true if identical, otherwise false. */ bool operator==(const TextStyle &other) const { return ((this->m_textColor == other.m_textColor) && (this->m_size == other.m_size) && (this->m_angle == other.m_angle) && (this->m_fontFamily == other.m_fontFamily) && (this->m_bold == other.m_bold) && (this->m_italic == other.m_italic) && (this->m_underline == other.m_underline) && (this->m_strikeThrough == other.m_strikeThrough) && (this->m_textOutlineWidth == other.m_textOutlineWidth) && (this->m_textOutlineColor == other.m_textOutlineColor) && (this->m_backgroundColor == other.m_backgroundColor) && (this->m_horizontalAlignment == other.m_horizontalAlignment) && (this->m_verticalAlignment == other.m_verticalAlignment) && (this->m_antiAliased == other.m_antiAliased) ); } /** * @brief operator!= Compare two objects * @param other to be compared with * @return true if NOT identical, otherwise false. */ bool operator!=(const TextStyle &other) const { return !(*this == other); } private: QColor m_textColor = Qt::black; float m_size = 15.0; float m_angle = 0.0; // degree QString m_fontFamily; bool m_bold = false; bool m_italic = false; bool m_underline = false; bool m_strikeThrough = false; float m_textOutlineWidth = -1; QColor m_textOutlineColor; QColor m_backgroundColor; // Invalid is intended // Alignment HorizontalAlignment m_horizontalAlignment = HorizontalAlignment::Left; VerticalAlignment m_verticalAlignment = VerticalAlignment::Bottom; bool m_antiAliased = true; // Esri 10.2.5: antiAlias = true }; //----------------------------------------------------------------------------- // output operator: //----------------------------------------------------------------------------- SITUATIONMAP_EXPORT std::ostream &operator<< (std::ostream &stream, const TextStyle &value); } // namespace SituationMap