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 16 of file DocumentModelPointMatch.h.

Constructor & Destructor Documentation

◆ DocumentModelPointMatch() [1/3]

DocumentModelPointMatch::DocumentModelPointMatch ( )

Default constructor.

Definition at line 21 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 {

◆ DocumentModelPointMatch() [2/3]

DocumentModelPointMatch::DocumentModelPointMatch ( const Document document)

Initial constructor from Document.

Definition at line 30 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 {

◆ DocumentModelPointMatch() [3/3]

DocumentModelPointMatch::DocumentModelPointMatch ( const DocumentModelPointMatch other)

Copy constructor.

Definition at line 38 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 {

Member Function Documentation

◆ loadXml()

void DocumentModelPointMatch::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 56 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  }

◆ maxPointSize()

double DocumentModelPointMatch::maxPointSize ( ) const

Get method for max point size.

Definition at line 90 of file DocumentModelPointMatch.cpp.

92 {
93  return m_maxPointSize;

◆ operator=()

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

Assignment constructor.

Definition at line 46 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;

◆ paletteColorAccepted()

ColorPalette DocumentModelPointMatch::paletteColorAccepted ( ) const

Get method for accepted color.

Definition at line 95 of file DocumentModelPointMatch.cpp.

97 {
98  return m_paletteColorAccepted;

◆ paletteColorCandidate()

ColorPalette DocumentModelPointMatch::paletteColorCandidate ( ) const

Get method for candidate color.

Definition at line 100 of file DocumentModelPointMatch.cpp.

102 {
103  return m_paletteColorCandidate;

◆ paletteColorRejected()

ColorPalette DocumentModelPointMatch::paletteColorRejected ( ) const

Get method for rejected color.

Definition at line 105 of file DocumentModelPointMatch.cpp.

107 {
108  return m_paletteColorRejected;

◆ 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 110 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";

◆ saveXml()

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

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 124 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();

◆ setMaxPointSize()

void DocumentModelPointMatch::setMaxPointSize ( double  maxPointSize)

Set method for max point size.

Definition at line 139 of file DocumentModelPointMatch.cpp.

141 {
142  m_maxPointSize = maxPointSize;

◆ setPaletteColorAccepted()

void DocumentModelPointMatch::setPaletteColorAccepted ( ColorPalette  paletteColorAccepted)

Set method for accepted color.

Definition at line 144 of file DocumentModelPointMatch.cpp.

146 {
147  m_paletteColorAccepted = paletteColorAccepted;

◆ setPaletteColorCandidate()

void DocumentModelPointMatch::setPaletteColorCandidate ( ColorPalette  paletteColorCandidate)

Set method for candidate color.

Definition at line 149 of file DocumentModelPointMatch.cpp.

151 {
152  m_paletteColorCandidate = paletteColorCandidate;

◆ setPaletteColorRejected()

void DocumentModelPointMatch::setPaletteColorRejected ( ColorPalette  paletteColorRejected)

Set method for rejected color.

Definition at line 154 of file DocumentModelPointMatch.cpp.

156 {
157  m_paletteColorRejected = paletteColorRejected;

The documentation for this class was generated from the following files:
DocumentModelPointMatch::paletteColorAccepted
ColorPalette paletteColorAccepted() const
Get method for accepted color.
Definition: DocumentModelPointMatch.cpp:95
DOCUMENT_SERIALIZE_POINT_MATCH
const QString DOCUMENT_SERIALIZE_POINT_MATCH
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED_STRING
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED_STRING
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED_STRING
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_ACCEPTED_STRING
DEFAULT_COLOR_ACCEPTED
const ColorPalette DEFAULT_COLOR_ACCEPTED
Definition: DocumentModelPointMatch.cpp:17
DocumentModelPointMatch::maxPointSize
double maxPointSize() const
Get method for max point size.
Definition: DocumentModelPointMatch.cpp:90
DocumentModelPointMatch::setMaxPointSize
void setMaxPointSize(double maxPointSize)
Set method for max point size.
Definition: DocumentModelPointMatch.cpp:139
DEFAULT_MIN_POINT_SEPARATION
const double DEFAULT_MIN_POINT_SEPARATION
Definition: DocumentModelPointMatch.cpp:15
DEFAULT_COLOR_CANDIDATE
const ColorPalette DEFAULT_COLOR_CANDIDATE
Definition: DocumentModelPointMatch.cpp:18
DocumentModelPointMatch::paletteColorRejected
ColorPalette paletteColorRejected() const
Get method for rejected color.
Definition: DocumentModelPointMatch.cpp:105
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_REJECTED
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
DocumentModelPointMatch::setPaletteColorCandidate
void setPaletteColorCandidate(ColorPalette paletteColorCandidate)
Set method for candidate color.
Definition: DocumentModelPointMatch.cpp:149
Document::modelPointMatch
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
Definition: Document.cpp:744
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
DEFAULT_COLOR_REJECTED
const ColorPalette DEFAULT_COLOR_REJECTED
Definition: DocumentModelPointMatch.cpp:19
DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE
const QString DOCUMENT_SERIALIZE_POINT_MATCH_POINT_SIZE
colorPaletteToString
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
INDENTATION_DELTA
const QString INDENTATION_DELTA
DEFAULT_MAX_POINT_SIZE
const double DEFAULT_MAX_POINT_SIZE
Definition: DocumentModelPointMatch.cpp:16
DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE_STRING
const QString DOCUMENT_SERIALIZE_POINT_MATCH_COLOR_CANDIDATE_STRING
DocumentModelPointMatch::paletteColorCandidate
ColorPalette paletteColorCandidate() const
Get method for candidate color.
Definition: DocumentModelPointMatch.cpp:100
loadNextFromReader
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
DocumentModelPointMatch::setPaletteColorAccepted
void setPaletteColorAccepted(ColorPalette paletteColorAccepted)
Set method for accepted color.
Definition: DocumentModelPointMatch.cpp:144
DocumentModelPointMatch::setPaletteColorRejected
void setPaletteColorRejected(ColorPalette paletteColorRejected)
Set method for rejected color.
Definition: DocumentModelPointMatch.cpp:154