Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
LineStyle Class Reference

Details for a specific Line. More...

#include <LineStyle.h>

Collaboration diagram for LineStyle:
Collaboration graph

Public Member Functions

 LineStyle ()
 Default constructor only for use when this class is being stored by a container that requires the default constructor.
 
 LineStyle (unsigned int width, ColorPalette paletteColor, CurveConnectAs curveConnectAs)
 Normal constructor.
 
 LineStyle (const LineStyle &other)
 Copy constructor.
 
LineStyleoperator= (const LineStyle &other)
 Assignment operator.
 
CurveConnectAs curveConnectAs () const
 Get method for connect type.
 
void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. Returns the curve name.
 
ColorPalette paletteColor () const
 Line color.
 
void printStream (QString indentation, QTextStream &str) const
 Debugging method that supports print method of this class and printStream method of some other class(es)
 
void saveXml (QXmlStreamWriter &writer) const
 Serialize to stream.
 
void setCurveConnectAs (CurveConnectAs curveConnectAs)
 Set connect as.
 
void setPaletteColor (ColorPalette paletteColor)
 Set method for line color.
 
void setWidth (int width)
 Set width of line.
 
unsigned int width () const
 Width of line.
 

Static Public Member Functions

static LineStyle defaultAxesCurve ()
 Initial default for axes curve.
 
static LineStyle defaultGraphCurve (int index)
 Initial default for index'th graph curve.
 

Detailed Description

Details for a specific Line.

Definition at line 19 of file LineStyle.h.

Constructor & Destructor Documentation

◆ LineStyle() [1/3]

LineStyle::LineStyle ( )

Default constructor only for use when this class is being stored by a container that requires the default constructor.

Definition at line 26 of file LineStyle.cpp.

27{
30 m_width = settings.value (SETTINGS_CURVE_LINE_WIDTH,
32 m_paletteColor = static_cast<ColorPalette> (settings.value (SETTINGS_CURVE_LINE_COLOR,
34 m_curveConnectAs = static_cast<CurveConnectAs> (settings.value (SETTINGS_CURVE_LINE_CONNECT_AS,
36}
ColorPalette
CurveConnectAs
const int INNER_RADIUS_MIN
const int DEFAULT_LINE_WIDTH_AXES
Definition LineStyle.cpp:23
const CurveConnectAs DEFAULT_LINE_CONNECT_AS_AXES
Definition LineStyle.cpp:21
const ColorPalette DEFAULT_LINE_COLOR_AXES
Definition LineStyle.cpp:19
const QString SETTINGS_ENGAUGE
const QString SETTINGS_GROUP_CURVE_AXES
const QString SETTINGS_CURVE_LINE_WIDTH
const QString SETTINGS_CURVE_LINE_CONNECT_AS
const QString SETTINGS_CURVE_LINE_COLOR
const QString SETTINGS_DIGITIZER

◆ LineStyle() [2/3]

LineStyle::LineStyle ( unsigned int width,
ColorPalette paletteColor,
CurveConnectAs curveConnectAs )

Normal constructor.

Definition at line 38 of file LineStyle.cpp.

40 :
41 m_width (width),
42 m_paletteColor (paletteColor),
43 m_curveConnectAs (curveConnectAs)
44{
45}
CurveConnectAs curveConnectAs() const
Get method for connect type.
Definition LineStyle.cpp:63
unsigned int width() const
Width of line.
ColorPalette paletteColor() const
Line color.

◆ LineStyle() [3/3]

LineStyle::LineStyle ( const LineStyle & other)

Copy constructor.

Definition at line 47 of file LineStyle.cpp.

47 :
48 m_width (other.width ()),
49 m_paletteColor (other.paletteColor()),
50 m_curveConnectAs (other.curveConnectAs())
51{
52}

Member Function Documentation

◆ curveConnectAs()

CurveConnectAs LineStyle::curveConnectAs ( ) const

Get method for connect type.

Definition at line 63 of file LineStyle.cpp.

64{
65 return m_curveConnectAs;
66}

◆ defaultAxesCurve()

LineStyle LineStyle::defaultAxesCurve ( )
static

Initial default for axes curve.

Definition at line 68 of file LineStyle.cpp.

69{
78
79 return LineStyle (unsigned (width),
80 color,
81 connectAs);
82}
LineStyle()
Default constructor only for use when this class is being stored by a container that requires the def...
Definition LineStyle.cpp:26

◆ defaultGraphCurve()

LineStyle LineStyle::defaultGraphCurve ( int index)
static

Initial default for index'th graph curve.

Definition at line 84 of file LineStyle.cpp.

85{
87 int indexOneBased = index + 1;
89
91 settings.beginGroup (groupName);
98
99 return LineStyle (unsigned (width),
100 color,
101 connectAs);
102}
const CurveConnectAs DEFAULT_LINE_CONNECT_AS_GRAPH
Definition LineStyle.cpp:22
const ColorPalette DEFAULT_LINE_COLOR_GRAPH
Definition LineStyle.cpp:20
const int DEFAULT_LINE_WIDTH_GRAPH
Definition LineStyle.cpp:24
Manage storage and retrieval of the settings for the curves.
QString groupNameForNthCurve(int indexOneBased) const
Return the group name, that appears in the settings file/registry, for the specified curve index.

◆ loadXml()

void LineStyle::loadXml ( QXmlStreamReader & reader)

Load model from serialized xml. Returns the curve name.

Definition at line 104 of file LineStyle.cpp.

105{
106 LOG4CPP_INFO_S ((*mainCat)) << "LineStyle::loadXml";
107
109
113
117
118 // Read until end of this subtree
119 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
122 }
123 } else {
124 reader.raiseError (QObject::tr ("Cannot read line style data"));
125 }
126}
const QString DOCUMENT_SERIALIZE_LINE_STYLE
const QString DOCUMENT_SERIALIZE_LINE_STYLE_WIDTH
const QString DOCUMENT_SERIALIZE_LINE_STYLE_COLOR
const QString DOCUMENT_SERIALIZE_LINE_STYLE_CONNECT_AS
log4cpp::Category * mainCat
Definition Logger.cpp:14
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition Xml.cpp:14
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
void setWidth(int width)
Set width of line.
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ operator=()

LineStyle & LineStyle::operator= ( const LineStyle & other)

Assignment operator.

Definition at line 54 of file LineStyle.cpp.

55{
56 m_width = other.width ();
57 m_paletteColor = other.paletteColor();
58 m_curveConnectAs = other.curveConnectAs();
59
60 return *this;
61}

◆ paletteColor()

ColorPalette LineStyle::paletteColor ( ) const

Line color.

Definition at line 128 of file LineStyle.cpp.

129{
130 return m_paletteColor;
131}

◆ printStream()

void LineStyle::printStream ( QString indentation,
QTextStream & str ) const

Debugging method that supports print method of this class and printStream method of some other class(es)

Definition at line 133 of file LineStyle.cpp.

135{
136 str << indentation << "LineStyle\n";
137
139
140 str << indentation << "width=" << m_width << "\n";
141 str << indentation << "color=" << colorPaletteToString (m_paletteColor) << "\n";
142 str << indentation << "curveConnectAs=" << curveConnectAsToString (m_curveConnectAs) << "\n";
143}
QString colorPaletteToString(ColorPalette colorPalette)
QString curveConnectAsToString(CurveConnectAs curveConnectAs)
const QString INDENTATION_DELTA

◆ saveXml()

void LineStyle::saveXml ( QXmlStreamWriter & writer) const

Serialize to stream.

Definition at line 145 of file LineStyle.cpp.

146{
147 LOG4CPP_INFO_S ((*mainCat)) << "LineStyle::saveXml";
148
149 writer.writeStartElement(DOCUMENT_SERIALIZE_LINE_STYLE);
150 writer.writeAttribute (DOCUMENT_SERIALIZE_LINE_STYLE_WIDTH, QString::number(m_width));
151 writer.writeAttribute (DOCUMENT_SERIALIZE_LINE_STYLE_COLOR, QString::number (m_paletteColor));
153 writer.writeAttribute (DOCUMENT_SERIALIZE_LINE_STYLE_CONNECT_AS, QString::number (m_curveConnectAs));
155 writer.writeEndElement();
156}
const QString DOCUMENT_SERIALIZE_LINE_STYLE_COLOR_STRING
const QString DOCUMENT_SERIALIZE_LINE_STYLE_CONNECT_AS_STRING

◆ setCurveConnectAs()

void LineStyle::setCurveConnectAs ( CurveConnectAs curveConnectAs)

Set connect as.

Definition at line 158 of file LineStyle.cpp.

159{
160 m_curveConnectAs = curveConnectAs;
161}

◆ setPaletteColor()

void LineStyle::setPaletteColor ( ColorPalette paletteColor)

Set method for line color.

Definition at line 163 of file LineStyle.cpp.

164{
165 m_paletteColor = paletteColor;
166}

◆ setWidth()

void LineStyle::setWidth ( int width)

Set width of line.

Definition at line 168 of file LineStyle.cpp.

169{
170 m_width = unsigned (width);
171}

◆ width()

unsigned int LineStyle::width ( ) const

Width of line.

Definition at line 173 of file LineStyle.cpp.

174{
175 return m_width;
176}

The documentation for this class was generated from the following files: