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

Model for DlgSettingsSegments and CmdSettingsSegments. More...

#include <DocumentModelSegments.h>

Inheritance diagram for DocumentModelSegments:
Inheritance graph
Collaboration diagram for DocumentModelSegments:
Collaboration graph

Public Member Functions

 DocumentModelSegments ()
 Default constructor. More...
 
 DocumentModelSegments (const Document &document)
 Initial constructor from Document. More...
 
 DocumentModelSegments (const DocumentModelSegments &other)
 Copy constructor. More...
 
DocumentModelSegmentsoperator= (const DocumentModelSegments &other)
 Assignment constructor. More...
 
bool fillCorners () const
 Get method for fill corners. More...
 
ColorPalette lineColor () const
 Get method for line color. More...
 
double lineWidth () const
 Get method for line width. More...
 
virtual void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. More...
 
double minLength () const
 Get method for min length. More...
 
double pointSeparation () const
 Get method for point separation. 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...
 
virtual void saveXml (QXmlStreamWriter &writer) const
 Save entire model as xml into stream. More...
 
void setFillCorners (bool fillCorners)
 Set method for fill corners. More...
 
void setLineColor (ColorPalette lineColor)
 Set method for line color. More...
 
void setLineWidth (double lineWidth)
 Set method for line width. More...
 
void setMinLength (double minLength)
 Set method for min length. More...
 
void setPointSeparation (double pointSeparation)
 Set method for point separation. More...
 
- Public Member Functions inherited from DocumentModelAbstractBase
 DocumentModelAbstractBase ()
 Single constructor. More...
 
virtual ~DocumentModelAbstractBase ()
 Single destructor. More...
 

Additional Inherited Members

Detailed Description

Model for DlgSettingsSegments and CmdSettingsSegments.

Definition at line 17 of file DocumentModelSegments.h.

Constructor & Destructor Documentation

◆ DocumentModelSegments() [1/3]

DocumentModelSegments::DocumentModelSegments ( )

Default constructor.

Definition at line 21 of file DocumentModelSegments.cpp.

21  :
22  m_pointSeparation (DEFAULT_POINT_SEPARATION),
23  m_minLength (DEFAULT_MIN_LENGTH),
24  m_fillCorners (false),
25  m_lineWidth (DEFAULT_LINE_WIDTH),
26  m_lineColor (DEFAULT_LINE_COLOR)
27 {
28 }
const double DEFAULT_POINT_SEPARATION
const double DEFAULT_LINE_WIDTH
const ColorPalette DEFAULT_LINE_COLOR(COLOR_PALETTE_GREEN)
const double DEFAULT_MIN_LENGTH

◆ DocumentModelSegments() [2/3]

DocumentModelSegments::DocumentModelSegments ( const Document document)

Initial constructor from Document.

Definition at line 30 of file DocumentModelSegments.cpp.

30  :
31  m_pointSeparation (document.modelSegments().pointSeparation()),
32  m_minLength (document.modelSegments().minLength()),
33  m_fillCorners (document.modelSegments().fillCorners()),
34  m_lineWidth (document.modelSegments().lineWidth()),
35  m_lineColor (document.modelSegments().lineColor())
36 {
37 }
double pointSeparation() const
Get method for point separation.
double lineWidth() const
Get method for line width.
double minLength() const
Get method for min length.
bool fillCorners() const
Get method for fill corners.
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Definition: Document.cpp:751
ColorPalette lineColor() const
Get method for line color.

◆ DocumentModelSegments() [3/3]

DocumentModelSegments::DocumentModelSegments ( const DocumentModelSegments other)

Copy constructor.

Definition at line 39 of file DocumentModelSegments.cpp.

39  :
40  m_pointSeparation (other.pointSeparation()),
41  m_minLength (other.minLength()),
42  m_fillCorners (other.fillCorners ()),
43  m_lineWidth (other.lineWidth()),
44  m_lineColor (other.lineColor())
45 {
46 }
double pointSeparation() const
Get method for point separation.
double lineWidth() const
Get method for line width.
double minLength() const
Get method for min length.
bool fillCorners() const
Get method for fill corners.
ColorPalette lineColor() const
Get method for line color.

Member Function Documentation

◆ fillCorners()

bool DocumentModelSegments::fillCorners ( ) const

Get method for fill corners.

Definition at line 59 of file DocumentModelSegments.cpp.

60 {
61  return m_fillCorners;
62 }

◆ lineColor()

ColorPalette DocumentModelSegments::lineColor ( ) const

Get method for line color.

Definition at line 64 of file DocumentModelSegments.cpp.

65 {
66  return m_lineColor;
67 }

◆ lineWidth()

double DocumentModelSegments::lineWidth ( ) const

Get method for line width.

Definition at line 69 of file DocumentModelSegments.cpp.

70 {
71  return m_lineWidth;
72 }

◆ loadXml()

void DocumentModelSegments::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 74 of file DocumentModelSegments.cpp.

75 {
76  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelSegments::loadXml";
77 
78  bool success = true;
79 
80  // Read until end of this subtree
81  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
82  (reader.name() != DOCUMENT_SERIALIZE_SEGMENTS)){
83  loadNextFromReader(reader);
84  if (reader.atEnd()) {
85  success = false;
86  break;
87  }
88  }
89 
90  if (!success) {
91  reader.raiseError(QObject::tr ("Cannot read segment data"));
92  }
93 }
const QString DOCUMENT_SERIALIZE_SEGMENTS
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ minLength()

double DocumentModelSegments::minLength ( ) const

Get method for min length.

Definition at line 95 of file DocumentModelSegments.cpp.

96 {
97  return m_minLength;
98 }

◆ operator=()

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

Assignment constructor.

Definition at line 48 of file DocumentModelSegments.cpp.

49 {
50  m_pointSeparation = other.pointSeparation();
51  m_minLength = other.minLength();
52  m_fillCorners = other.fillCorners ();
53  m_lineWidth = other.lineWidth();
54  m_lineColor = other.lineColor();
55 
56  return *this;
57 }
double pointSeparation() const
Get method for point separation.
double lineWidth() const
Get method for line width.
double minLength() const
Get method for min length.
bool fillCorners() const
Get method for fill corners.
ColorPalette lineColor() const
Get method for line color.

◆ pointSeparation()

double DocumentModelSegments::pointSeparation ( ) const

Get method for point separation.

Definition at line 100 of file DocumentModelSegments.cpp.

101 {
102  return m_pointSeparation;
103 }

◆ printStream()

void DocumentModelSegments::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 105 of file DocumentModelSegments.cpp.

107 {
108  str << indentation << "DocumentModelSegments\n";
109 
110  indentation += INDENTATION_DELTA;
111 
112  str << indentation << "pointSeparation=" << m_pointSeparation << "\n";
113  str << indentation << "minLength=" << m_minLength << "\n";
114  str << indentation << "fillCorners=" << (m_fillCorners ? "true" : "false") << "\n";
115  str << indentation << "lineWidth=" << m_lineWidth << "\n";
116  str << indentation << "lineColor=" << colorPaletteToString (m_lineColor) << "\n";
117 }
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
const QString INDENTATION_DELTA

◆ saveXml()

void DocumentModelSegments::saveXml ( QXmlStreamWriter &  writer) const
virtual

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 119 of file DocumentModelSegments.cpp.

120 {
121  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelSegments::saveXml";
122 
123  writer.writeStartElement(DOCUMENT_SERIALIZE_SEGMENTS);
124  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_POINT_SEPARATION, QString::number (m_pointSeparation));
125  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_MIN_LENGTH, QString::number (m_minLength));
126  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_FILL_CORNERS, m_fillCorners ?
129  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_LINE_WIDTH, QString::number (m_lineWidth));
130  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_LINE_COLOR, QString::number (m_lineColor));
131  writer.writeAttribute(DOCUMENT_SERIALIZE_SEGMENTS_LINE_COLOR_STRING, colorPaletteToString (m_lineColor));
132  writer.writeEndElement();
133 }
const QString DOCUMENT_SERIALIZE_SEGMENTS
const QString DOCUMENT_SERIALIZE_SEGMENTS_POINT_SEPARATION
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
const QString DOCUMENT_SERIALIZE_SEGMENTS_LINE_WIDTH
const QString DOCUMENT_SERIALIZE_SEGMENTS_LINE_COLOR
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
const QString DOCUMENT_SERIALIZE_SEGMENTS_FILL_CORNERS
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_SEGMENTS_MIN_LENGTH
const QString DOCUMENT_SERIALIZE_SEGMENTS_LINE_COLOR_STRING

◆ setFillCorners()

void DocumentModelSegments::setFillCorners ( bool  fillCorners)

Set method for fill corners.

Definition at line 135 of file DocumentModelSegments.cpp.

136 {
137  m_fillCorners = fillCorners;
138 }
bool fillCorners() const
Get method for fill corners.

◆ setLineColor()

void DocumentModelSegments::setLineColor ( ColorPalette  lineColor)

Set method for line color.

Definition at line 140 of file DocumentModelSegments.cpp.

141 {
142  m_lineColor = lineColor;
143 }
ColorPalette lineColor() const
Get method for line color.

◆ setLineWidth()

void DocumentModelSegments::setLineWidth ( double  lineWidth)

Set method for line width.

Definition at line 145 of file DocumentModelSegments.cpp.

146 {
147  m_lineWidth = lineWidth;
148 }
double lineWidth() const
Get method for line width.

◆ setMinLength()

void DocumentModelSegments::setMinLength ( double  minLength)

Set method for min length.

Definition at line 150 of file DocumentModelSegments.cpp.

151 {
152  m_minLength = minLength;
153 }
double minLength() const
Get method for min length.

◆ setPointSeparation()

void DocumentModelSegments::setPointSeparation ( double  pointSeparation)

Set method for point separation.

Definition at line 155 of file DocumentModelSegments.cpp.

156 {
157  m_pointSeparation = pointSeparation;
158 }
double pointSeparation() const
Get method for point separation.

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