Engauge Digitizer  2
Public Member Functions | List of all members
CurveStyle Class Reference

Container for LineStyle and PointStyle for one Curve. More...

#include <CurveStyle.h>

Collaboration diagram for CurveStyle:
Collaboration graph

Public Member Functions

 CurveStyle ()
 Default constructor. More...
 
 CurveStyle (const LineStyle &lineStyle, const PointStyle &pointStyle)
 Constructor with styles. More...
 
LineStyle lineStyle () const
 Get method for LineStyle. More...
 
QString loadXml (QXmlStreamReader &reader)
 Load from serialized xml. Returns the curve name. More...
 
PointStyle pointStyle () const
 Get method for PointStyle. More...
 
void printStream (QString indentation, QTextStream &str) const
 Debugging method that supports print method of this class and printStream method of some other class(es) More...
 
void saveXml (QXmlStreamWriter &writer, const QString &curveName) const
 Serialize to xml. More...
 
void setLineColor (ColorPalette lineColor)
 Set method for line color in specified curve. More...
 
void setLineConnectAs (CurveConnectAs curveConnectAs)
 Set method for connect as method for lines in specified curve. More...
 
void setLineStyle (const LineStyle &lineStyle)
 Set method for LineStyle. More...
 
void setLineWidth (int width)
 Set method for line width in specified curve. More...
 
void setPointColor (ColorPalette curveColor)
 Set method curve point color in specified curve. More...
 
void setPointLineWidth (int width)
 Set method for curve point perimeter line width. More...
 
void setPointRadius (int radius)
 Set method for curve point radius. More...
 
void setPointShape (PointShape shape)
 Set method for curve point shape in specified curve. More...
 
void setPointStyle (const PointStyle &pointStyle)
 Set method for PointStyle. More...
 

Detailed Description

Container for LineStyle and PointStyle for one Curve.

Definition at line 17 of file CurveStyle.h.

Constructor & Destructor Documentation

◆ CurveStyle() [1/2]

CurveStyle::CurveStyle ( )

Default constructor.

Definition at line 14 of file CurveStyle.cpp.

16 {

◆ CurveStyle() [2/2]

CurveStyle::CurveStyle ( const LineStyle lineStyle,
const PointStyle pointStyle 
)

Constructor with styles.

Definition at line 18 of file CurveStyle.cpp.

20  :
21  m_pointStyle (pointStyle),
22  m_lineStyle (lineStyle)
23 {

Member Function Documentation

◆ lineStyle()

LineStyle CurveStyle::lineStyle ( ) const

Get method for LineStyle.

Definition at line 25 of file CurveStyle.cpp.

27 {
28  return m_lineStyle;

◆ loadXml()

QString CurveStyle::loadXml ( QXmlStreamReader &  reader)

Load from serialized xml. Returns the curve name.

Definition at line 30 of file CurveStyle.cpp.

32 {
33  LOG4CPP_INFO_S ((*mainCat)) << "CurveStyle::loadXml";
34 
35  bool success = true;
36  QString curveName;
37 
38  QXmlStreamAttributes attributes = reader.attributes();
39 
40  if (attributes.hasAttribute(DOCUMENT_SERIALIZE_CURVE_NAME)) {
41 
42  curveName = attributes.value (DOCUMENT_SERIALIZE_CURVE_NAME).toString();
43 
44  // Read until end of this subtree
45  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
46  (reader.name() != DOCUMENT_SERIALIZE_POINT_STYLE)){
47  loadNextFromReader(reader);
48 
49  if (reader.atEnd()) {
50  success = false;
51  break;
52  }
53 
54  if ((reader.tokenType() == QXmlStreamReader::StartElement) &&
55  (reader.name() == DOCUMENT_SERIALIZE_LINE_STYLE)) {
56 
57  m_lineStyle.loadXml (reader);
58 
59  } else if ((reader.tokenType() == QXmlStreamReader::StartElement) &
60  (reader.name() == DOCUMENT_SERIALIZE_POINT_STYLE)) {
61 
62  m_pointStyle.loadXml (reader);
63 
64  }
65  }
66  }
67 
68  if (!success) {
69  reader.raiseError (QObject::tr ("Cannot read curve style data"));
70  }
71 
72  return curveName;

◆ pointStyle()

PointStyle CurveStyle::pointStyle ( ) const

Get method for PointStyle.

Definition at line 74 of file CurveStyle.cpp.

76 {
77  return m_pointStyle;

◆ printStream()

void CurveStyle::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 79 of file CurveStyle.cpp.

82 {
83  str << indentation << "CurveStyle\n";
84 
85  indentation += INDENTATION_DELTA;
86 
87  m_pointStyle.printStream (indentation,
88  str);
89  m_lineStyle.printStream (indentation,
90  str);

◆ saveXml()

void CurveStyle::saveXml ( QXmlStreamWriter &  writer,
const QString &  curveName 
) const

Serialize to xml.

Definition at line 92 of file CurveStyle.cpp.

95 {
96  LOG4CPP_INFO_S ((*mainCat)) << "CurveStyle::saveXml";
97 
98  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE_STYLE);
99  writer.writeAttribute (DOCUMENT_SERIALIZE_CURVE_NAME, curveName);
100  m_lineStyle.saveXml (writer);
101  m_pointStyle.saveXml (writer);
102  writer.writeEndElement();

◆ setLineColor()

void CurveStyle::setLineColor ( ColorPalette  lineColor)

Set method for line color in specified curve.

Definition at line 104 of file CurveStyle.cpp.

106 {
107  m_lineStyle.setPaletteColor(lineColor);

◆ setLineConnectAs()

void CurveStyle::setLineConnectAs ( CurveConnectAs  curveConnectAs)

Set method for connect as method for lines in specified curve.

Definition at line 109 of file CurveStyle.cpp.

111 {
112  m_lineStyle.setCurveConnectAs(curveConnectAs);

◆ setLineStyle()

void CurveStyle::setLineStyle ( const LineStyle lineStyle)

Set method for LineStyle.

Definition at line 114 of file CurveStyle.cpp.

116 {
117  m_lineStyle = lineStyle;

◆ setLineWidth()

void CurveStyle::setLineWidth ( int  width)

Set method for line width in specified curve.

Definition at line 119 of file CurveStyle.cpp.

121 {
122  m_lineStyle.setWidth(width);

◆ setPointColor()

void CurveStyle::setPointColor ( ColorPalette  curveColor)

Set method curve point color in specified curve.

Definition at line 124 of file CurveStyle.cpp.

126 {
127  m_pointStyle.setPaletteColor(curveColor);

◆ setPointLineWidth()

void CurveStyle::setPointLineWidth ( int  width)

Set method for curve point perimeter line width.

Definition at line 129 of file CurveStyle.cpp.

131 {
132  m_pointStyle.setLineWidth(width);

◆ setPointRadius()

void CurveStyle::setPointRadius ( int  radius)

Set method for curve point radius.

Definition at line 134 of file CurveStyle.cpp.

136 {
137  m_pointStyle.setRadius(radius);

◆ setPointShape()

void CurveStyle::setPointShape ( PointShape  shape)

Set method for curve point shape in specified curve.

Definition at line 139 of file CurveStyle.cpp.

141 {
142  m_pointStyle.setShape(shape);

◆ setPointStyle()

void CurveStyle::setPointStyle ( const PointStyle pointStyle)

Set method for PointStyle.

Definition at line 144 of file CurveStyle.cpp.

146 {
147  m_pointStyle = pointStyle;

The documentation for this class was generated from the following files:
DOCUMENT_SERIALIZE_POINT_STYLE
const QString DOCUMENT_SERIALIZE_POINT_STYLE
PointStyle::setRadius
void setRadius(unsigned int radius)
Set method for point radius.
Definition: PointStyle.cpp:305
PointStyle::setShape
void setShape(PointShape shape)
Set method for point shape.
Definition: PointStyle.cpp:310
CurveStyle::lineStyle
LineStyle lineStyle() const
Get method for LineStyle.
Definition: CurveStyle.cpp:25
PointStyle::printStream
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: PointStyle.cpp:263
PointStyle::setLineWidth
void setLineWidth(int width)
Set method for line width.
Definition: PointStyle.cpp:295
DOCUMENT_SERIALIZE_CURVE_NAME
const QString DOCUMENT_SERIALIZE_CURVE_NAME
LineStyle::loadXml
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
Definition: LineStyle.cpp:104
PointStyle::setPaletteColor
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
Definition: PointStyle.cpp:300
DOCUMENT_SERIALIZE_LINE_STYLE
const QString DOCUMENT_SERIALIZE_LINE_STYLE
PointStyle::loadXml
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
Definition: PointStyle.cpp:129
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
LineStyle::saveXml
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: LineStyle.cpp:145
CurveStyle::pointStyle
PointStyle pointStyle() const
Get method for PointStyle.
Definition: CurveStyle.cpp:74
LineStyle::setCurveConnectAs
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
Definition: LineStyle.cpp:158
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
PointStyle::saveXml
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: PointStyle.cpp:281
INDENTATION_DELTA
const QString INDENTATION_DELTA
LineStyle::setWidth
void setWidth(int width)
Set width of line.
Definition: LineStyle.cpp:168
LineStyle::setPaletteColor
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
Definition: LineStyle.cpp:163
DOCUMENT_SERIALIZE_CURVE_STYLE
const QString DOCUMENT_SERIALIZE_CURVE_STYLE
loadNextFromReader
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
LineStyle::printStream
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: LineStyle.cpp:133