Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 18 of file CurveStyle.h.

Constructor & Destructor Documentation

CurveStyle::CurveStyle ( )

Default constructor.

Definition at line 15 of file CurveStyle.cpp.

16 {
17 }
CurveStyle::CurveStyle ( const LineStyle lineStyle,
const PointStyle pointStyle 
)

Constructor with styles.

Definition at line 19 of file CurveStyle.cpp.

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

Member Function Documentation

LineStyle CurveStyle::lineStyle ( ) const

Get method for LineStyle.

Definition at line 26 of file CurveStyle.cpp.

27 {
28  return m_lineStyle;
29 }
QString CurveStyle::loadXml ( QXmlStreamReader &  reader)

Load from serialized xml. Returns the curve name.

Definition at line 31 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;
73 }
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
Definition: LineStyle.cpp:104
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
Definition: PointStyle.cpp:129
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_POINT_STYLE
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_LINE_STYLE
const QString DOCUMENT_SERIALIZE_CURVE_NAME
PointStyle CurveStyle::pointStyle ( ) const

Get method for PointStyle.

Definition at line 75 of file CurveStyle.cpp.

76 {
77  return m_pointStyle;
78 }
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 80 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);
91 }
const QString INDENTATION_DELTA
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
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
void CurveStyle::saveXml ( QXmlStreamWriter &  writer,
const QString &  curveName 
) const

Serialize to xml.

Definition at line 93 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();
103 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: PointStyle.cpp:281
const QString DOCUMENT_SERIALIZE_CURVE_STYLE
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: LineStyle.cpp:145
const QString DOCUMENT_SERIALIZE_CURVE_NAME
void CurveStyle::setLineColor ( ColorPalette  lineColor)

Set method for line color in specified curve.

Definition at line 105 of file CurveStyle.cpp.

106 {
107  m_lineStyle.setPaletteColor(lineColor);
108 }
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
Definition: LineStyle.cpp:163
void CurveStyle::setLineConnectAs ( CurveConnectAs  curveConnectAs)

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

Definition at line 110 of file CurveStyle.cpp.

111 {
112  m_lineStyle.setCurveConnectAs(curveConnectAs);
113 }
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
Definition: LineStyle.cpp:158
void CurveStyle::setLineStyle ( const LineStyle lineStyle)

Set method for LineStyle.

Definition at line 115 of file CurveStyle.cpp.

116 {
117  m_lineStyle = lineStyle;
118 }
LineStyle lineStyle() const
Get method for LineStyle.
Definition: CurveStyle.cpp:26
void CurveStyle::setLineWidth ( int  width)

Set method for line width in specified curve.

Definition at line 120 of file CurveStyle.cpp.

121 {
122  m_lineStyle.setWidth(width);
123 }
void setWidth(int width)
Set width of line.
Definition: LineStyle.cpp:168
void CurveStyle::setPointColor ( ColorPalette  curveColor)

Set method curve point color in specified curve.

Definition at line 125 of file CurveStyle.cpp.

126 {
127  m_pointStyle.setPaletteColor(curveColor);
128 }
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
Definition: PointStyle.cpp:300
void CurveStyle::setPointLineWidth ( int  width)

Set method for curve point perimeter line width.

Definition at line 130 of file CurveStyle.cpp.

131 {
132  m_pointStyle.setLineWidth(width);
133 }
void setLineWidth(int width)
Set method for line width.
Definition: PointStyle.cpp:295
void CurveStyle::setPointRadius ( int  radius)

Set method for curve point radius.

Definition at line 135 of file CurveStyle.cpp.

136 {
137  m_pointStyle.setRadius(radius);
138 }
void setRadius(unsigned int radius)
Set method for point radius.
Definition: PointStyle.cpp:305
void CurveStyle::setPointShape ( PointShape  shape)

Set method for curve point shape in specified curve.

Definition at line 140 of file CurveStyle.cpp.

141 {
142  m_pointStyle.setShape(shape);
143 }
void setShape(PointShape shape)
Set method for point shape.
Definition: PointStyle.cpp:310
void CurveStyle::setPointStyle ( const PointStyle pointStyle)

Set method for PointStyle.

Definition at line 145 of file CurveStyle.cpp.

146 {
147  m_pointStyle = pointStyle;
148 }
PointStyle pointStyle() const
Get method for PointStyle.
Definition: CurveStyle.cpp:75

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