1 #include "CmdMediator.h"
2 #include "DocumentModelDigitizeCurve.h"
3 #include "DocumentSerialize.h"
6 #include <QXmlStreamWriter>
9 const bool DEFAULT_CURSOR_STANDARD_CROSS =
true;
10 const int DEFAULT_CURSOR_INNER_RADIUS = 5;
11 const int DEFAULT_CURSOR_LINE_WIDTH = 2;
12 const CursorSize DEFAULT_CURSOR_SIZE = CURSOR_SIZE_32;
15 m_cursorStandardCross (DEFAULT_CURSOR_STANDARD_CROSS),
16 m_cursorInnerRadius (DEFAULT_CURSOR_INNER_RADIUS),
17 m_cursorLineWidth (DEFAULT_CURSOR_LINE_WIDTH),
18 m_cursorSize (DEFAULT_CURSOR_SIZE)
23 m_cursorStandardCross (document.modelDigitizeCurve().cursorStandardCross()),
24 m_cursorInnerRadius (document.modelDigitizeCurve().cursorInnerRadius()),
25 m_cursorLineWidth (document.modelDigitizeCurve().cursorLineWidth()),
26 m_cursorSize (document.modelDigitizeCurve().cursorSize())
31 m_cursorStandardCross (other.cursorStandardCross()),
32 m_cursorInnerRadius (other.cursorInnerRadius()),
33 m_cursorLineWidth (other.cursorLineWidth()),
34 m_cursorSize (other.cursorSize ())
50 return m_cursorInnerRadius;
55 return m_cursorLineWidth;
65 return m_cursorStandardCross;
70 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelDigitizeCurve::loadXml";
74 QXmlStreamAttributes attributes = reader.attributes();
76 if (attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS) &&
77 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH) &&
78 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE) &&
79 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS)) {
82 QString standardCrossValue = attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS).toString();
84 setCursorInnerRadius (attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS).toInt());
85 setCursorLineWidth (attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH).toInt());
86 setCursorSize ((CursorSize) attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE).toInt());
90 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
91 (reader.name() != DOCUMENT_SERIALIZE_DIGITIZE_CURVE)){
92 loadNextFromReader(reader);
101 reader.raiseError (
"Cannot read digitize curve data");
106 QTextStream &str)
const
108 str << indentation <<
"DocumentModelDigitizeCurve\n";
110 indentation += INDENTATION_DELTA;
112 str << indentation <<
"cursorStandardCross=" << (m_cursorStandardCross ?
"true" :
"false") <<
"\n";
113 str << indentation <<
"cursorInnerRadius=" << m_cursorInnerRadius <<
"\n";
114 str << indentation <<
"cursorSize=" << m_cursorSize <<
"\n";
115 str << indentation <<
"cursorLineWidth=" << m_cursorLineWidth <<
"\n";
120 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelDigitizeCurve::saveXml";
122 writer.writeStartElement(DOCUMENT_SERIALIZE_DIGITIZE_CURVE);
123 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS, QString::number (m_cursorInnerRadius));
124 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH, QString::number (m_cursorLineWidth));
125 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE, QString::number (m_cursorSize));
126 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS, m_cursorStandardCross ?
127 DOCUMENT_SERIALIZE_BOOL_TRUE :
128 DOCUMENT_SERIALIZE_BOOL_FALSE);
129 writer.writeEndElement();
int cursorLineWidth() const
Get method for cursor line width.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setCursorLineWidth(int lineWidth)
Set method for cursor line width.
bool cursorStandardCross() const
Get method for cursor type.
void setCursorSize(CursorSize cursorSize)
Set method for cursor size.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
int cursorInnerRadius() const
Get method for cursor inner radius.
void setCursorInnerRadius(int innerRadius)
Set method for cursor inner radius.
Storage of one imported image and the data attached to that image.
CursorSize cursorSize() const
Get method for cursor size.
DocumentModelDigitizeCurve & operator=(const DocumentModelDigitizeCurve &other)
Assignment constructor.
DocumentModelDigitizeCurve()
Default constructor.
void setCursorStandardCross(bool cursorStandardCross)
Set method for cursor type.