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

Model for DlgSettingsPointMatch and CmdSettingsPointMatch. More...

#include <DocumentModelPointMatch.h>

Inheritance diagram for DocumentModelPointMatch:
Inheritance graph
Collaboration diagram for DocumentModelPointMatch:
Collaboration graph

Public Member Functions

 DocumentModelPointMatch ()
 Default constructor. More...
 
 DocumentModelPointMatch (const Document &document)
 Initial constructor from Document. More...
 
 DocumentModelPointMatch (const DocumentModelPointMatch &other)
 Copy constructor. More...
 
DocumentModelPointMatchoperator= (const DocumentModelPointMatch &other)
 Assignment constructor. More...
 
virtual void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. More...
 
double maxPointSize () const
 Get method for max point size. More...
 
ColorPalette paletteColorAccepted () const
 Get method for accepted color. More...
 
ColorPalette paletteColorCandidate () const
 Get method for candidate color. More...
 
ColorPalette paletteColorRejected () const
 Get method for rejected color. 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 setMaxPointSize (double maxPointSize)
 Set method for max point size. More...
 
void setPaletteColorAccepted (ColorPalette paletteColorAccepted)
 Set method for accepted color. More...
 
void setPaletteColorCandidate (ColorPalette paletteColorCandidate)
 Set method for candidate color. More...
 
void setPaletteColorRejected (ColorPalette paletteColorRejected)
 Set method for rejected color. More...
 
- Public Member Functions inherited from DocumentModelAbstractBase
 DocumentModelAbstractBase ()
 Single constructor. More...
 
virtual ~DocumentModelAbstractBase ()
 Single destructor. More...
 

Additional Inherited Members

Detailed Description

Model for DlgSettingsPointMatch and CmdSettingsPointMatch.

Definition at line 17 of file DocumentModelPointMatch.h.

Constructor & Destructor Documentation

◆ DocumentModelPointMatch() [1/3]

DocumentModelPointMatch::DocumentModelPointMatch ( )

Default constructor.

Definition at line 22 of file DocumentModelPointMatch.cpp.

22  :
23  m_minPointSeparation (DEFAULT_MIN_POINT_SEPARATION),
24  m_maxPointSize (DEFAULT_MAX_POINT_SIZE),
25  m_paletteColorAccepted (DEFAULT_COLOR_ACCEPTED),
26  m_paletteColorCandidate (DEFAULT_COLOR_CANDIDATE),
27  m_paletteColorRejected (DEFAULT_COLOR_REJECTED)
28 {
29 }
const double DEFAULT_MIN_POINT_SEPARATION
const ColorPalette DEFAULT_COLOR_CANDIDATE
const ColorPalette DEFAULT_COLOR_ACCEPTED
const double DEFAULT_MAX_POINT_SIZE
const ColorPalette DEFAULT_COLOR_REJECTED

◆ DocumentModelPointMatch() [2/3]

DocumentModelPointMatch::DocumentModelPointMatch ( const Document document)

Initial constructor from Document.

Definition at line 31 of file DocumentModelPointMatch.cpp.

31  :
32  m_maxPointSize (document.modelPointMatch().maxPointSize()),
33  m_paletteColorAccepted (document.modelPointMatch().paletteColorAccepted()),
34  m_paletteColorCandidate (document.modelPointMatch().paletteColorCandidate()),
35  m_paletteColorRejected (document.modelPointMatch().paletteColorRejected())
36 {
37 }
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
Definition: Document.cpp:744
ColorPalette paletteColorCandidate() const
Get method for candidate color.
ColorPalette paletteColorAccepted() const
Get method for accepted color.
ColorPalette paletteColorRejected() const
Get method for rejected color.
double maxPointSize() const
Get method for max point size.

◆ DocumentModelPointMatch() [3/3]

DocumentModelPointMatch::DocumentModelPointMatch ( const DocumentModelPointMatch other)

Copy constructor.

Definition at line 39 of file DocumentModelPointMatch.cpp.

39  :
40  m_maxPointSize (other.maxPointSize()),
41  m_paletteColorAccepted (other.paletteColorAccepted()),
42  m_paletteColorCandidate (other.paletteColorCandidate()),
43  m_paletteColorRejected (other.paletteColorRejected())
44 {
45 }
ColorPalette paletteColorCandidate() const
Get method for candidate color.
ColorPalette paletteColorAccepted() const
Get method for accepted color.
ColorPalette paletteColorRejected() const
Get method for rejected color.
double maxPointSize() const
Get method for max point size.

Member Function Documentation

◆ loadXml()

void DocumentModelPointMatch::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 57 of file DocumentModelPointMatch.cpp.

58 {
59  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelPointMatch::loadXml";
60 
61  bool success = true;
62 
63  QXmlStreamAttributes attributes = reader.attributes();
64 
65  if (attributes.hasAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE) &&
66  attributes.hasAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED) &&
67  attributes.hasAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE) &&
68  attributes.hasAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED)) {
69 
70  setMaxPointSize (attributes.value(DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE).toDouble());
71  setPaletteColorAccepted (static_cast<ColorPalette> (attributes.value(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED).toInt()));
72  setPaletteColorCandidate (static_cast<ColorPalette> (attributes.value(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE).toInt()));
73  setPaletteColorRejected (static_cast<ColorPalette> (attributes.value(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED).toInt()));
74 
75  // Read until end of this subtree
76  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
77  (reader.name() != DOCUMENT_SERIALIZE_POINT_MATCH)){
78  loadNextFromReader(reader);
79  if (reader.atEnd()) {
80  success = false;
81  break;
82  }
83  }
84  }
85 
86  if (!success) {
87  reader.raiseError (QObject::tr ("Cannot read point match data"));
88  }
89 }
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
const QString DOCUMENT_SERIALIZE_POINT_MATCH
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED
void setPaletteColorCandidate(ColorPalette paletteColorCandidate)
Set method for candidate color.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE
void setMaxPointSize(double maxPointSize)
Set method for max point size.
void setPaletteColorRejected(ColorPalette paletteColorRejected)
Set method for rejected color.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE
void setPaletteColorAccepted(ColorPalette paletteColorAccepted)
Set method for accepted color.

◆ maxPointSize()

double DocumentModelPointMatch::maxPointSize ( ) const

Get method for max point size.

Definition at line 91 of file DocumentModelPointMatch.cpp.

92 {
93  return m_maxPointSize;
94 }

◆ operator=()

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

Assignment constructor.

Definition at line 47 of file DocumentModelPointMatch.cpp.

48 {
49  m_maxPointSize = other.maxPointSize();
50  m_paletteColorAccepted = other.paletteColorAccepted();
51  m_paletteColorCandidate = other.paletteColorCandidate();
52  m_paletteColorRejected = other.paletteColorRejected();
53 
54  return *this;
55 }
ColorPalette paletteColorCandidate() const
Get method for candidate color.
ColorPalette paletteColorAccepted() const
Get method for accepted color.
ColorPalette paletteColorRejected() const
Get method for rejected color.
double maxPointSize() const
Get method for max point size.

◆ paletteColorAccepted()

ColorPalette DocumentModelPointMatch::paletteColorAccepted ( ) const

Get method for accepted color.

Definition at line 96 of file DocumentModelPointMatch.cpp.

97 {
98  return m_paletteColorAccepted;
99 }

◆ paletteColorCandidate()

ColorPalette DocumentModelPointMatch::paletteColorCandidate ( ) const

Get method for candidate color.

Definition at line 101 of file DocumentModelPointMatch.cpp.

102 {
103  return m_paletteColorCandidate;
104 }

◆ paletteColorRejected()

ColorPalette DocumentModelPointMatch::paletteColorRejected ( ) const

Get method for rejected color.

Definition at line 106 of file DocumentModelPointMatch.cpp.

107 {
108  return m_paletteColorRejected;
109 }

◆ printStream()

void DocumentModelPointMatch::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 111 of file DocumentModelPointMatch.cpp.

113 {
114  str << indentation << "DocumentModelPointMatch\n";
115 
116  indentation += INDENTATION_DELTA;
117 
118  str << indentation << "minPointSeparation=" << m_minPointSeparation << "\n";
119  str << indentation << "maxPointSize=" << m_maxPointSize << "\n";
120  str << indentation << "colorAccepted=" << colorPaletteToString (m_paletteColorAccepted) << "\n";
121  str << indentation << "colorCandidate=" << colorPaletteToString (m_paletteColorCandidate) << "\n";
122  str << indentation << "colorRejected=" << colorPaletteToString (m_paletteColorRejected) << "\n";
123 }
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
const QString INDENTATION_DELTA

◆ saveXml()

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

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 125 of file DocumentModelPointMatch.cpp.

126 {
127  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelPointMatch::saveXml";
128 
129  writer.writeStartElement(DOCUMENT_SERIALIZE_POINT_MATCH);
130  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE, QString::number (m_maxPointSize));
131  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED, QString::number (m_paletteColorAccepted));
132  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED_STRING, colorPaletteToString (m_paletteColorAccepted));
133  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE, QString::number (m_paletteColorCandidate));
134  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE_STRING, colorPaletteToString (m_paletteColorCandidate));
135  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED, QString::number (m_paletteColorRejected));
136  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED_STRING, colorPaletteToString (m_paletteColorRejected));
137  writer.writeEndElement();
138 }
const QString DOCUMENT_SERIALIZE_POINT_MATCH
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE_STRING
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED_STRING
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED_STRING

◆ setMaxPointSize()

void DocumentModelPointMatch::setMaxPointSize ( double  maxPointSize)

Set method for max point size.

Definition at line 140 of file DocumentModelPointMatch.cpp.

141 {
142  m_maxPointSize = maxPointSize;
143 }
double maxPointSize() const
Get method for max point size.

◆ setPaletteColorAccepted()

void DocumentModelPointMatch::setPaletteColorAccepted ( ColorPalette  paletteColorAccepted)

Set method for accepted color.

Definition at line 145 of file DocumentModelPointMatch.cpp.

146 {
147  m_paletteColorAccepted = paletteColorAccepted;
148 }
ColorPalette paletteColorAccepted() const
Get method for accepted color.

◆ setPaletteColorCandidate()

void DocumentModelPointMatch::setPaletteColorCandidate ( ColorPalette  paletteColorCandidate)

Set method for candidate color.

Definition at line 150 of file DocumentModelPointMatch.cpp.

151 {
152  m_paletteColorCandidate = paletteColorCandidate;
153 }
ColorPalette paletteColorCandidate() const
Get method for candidate color.

◆ setPaletteColorRejected()

void DocumentModelPointMatch::setPaletteColorRejected ( ColorPalette  paletteColorRejected)

Set method for rejected color.

Definition at line 155 of file DocumentModelPointMatch.cpp.

156 {
157  m_paletteColorRejected = paletteColorRejected;
158 }
ColorPalette paletteColorRejected() const
Get method for rejected color.

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