7 #include "CmdMediator.h" 8 #include "DocumentModelDigitizeCurve.h" 9 #include "DocumentSerialize.h" 12 #include <QTextStream> 13 #include <QXmlStreamWriter> 16 const bool DEFAULT_CURSOR_STANDARD_CROSS =
true;
17 const int DEFAULT_CURSOR_INNER_RADIUS = 5;
18 const int DEFAULT_CURSOR_LINE_WIDTH = 2;
19 const CursorSize DEFAULT_CURSOR_SIZE = CURSOR_SIZE_32;
22 m_cursorStandardCross (DEFAULT_CURSOR_STANDARD_CROSS),
23 m_cursorInnerRadius (DEFAULT_CURSOR_INNER_RADIUS),
24 m_cursorLineWidth (DEFAULT_CURSOR_LINE_WIDTH),
25 m_cursorSize (DEFAULT_CURSOR_SIZE)
33 m_cursorSize (document.modelDigitizeCurve().
cursorSize())
57 return m_cursorInnerRadius;
62 return m_cursorLineWidth;
72 return m_cursorStandardCross;
77 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelDigitizeCurve::loadXml";
81 QXmlStreamAttributes attributes = reader.attributes();
83 if (attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS) &&
84 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH) &&
85 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE) &&
86 attributes.hasAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS)) {
89 QString standardCrossValue = attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS).toString();
91 setCursorInnerRadius (attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS).toInt());
92 setCursorLineWidth (attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH).toInt());
93 setCursorSize ((CursorSize) attributes.value(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE).toInt());
97 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
98 (reader.name() != DOCUMENT_SERIALIZE_DIGITIZE_CURVE)){
99 loadNextFromReader(reader);
100 if (reader.atEnd()) {
108 reader.raiseError (QObject::tr (
"Cannot read digitize curve data"));
113 QTextStream &str)
const 115 str << indentation <<
"DocumentModelDigitizeCurve\n";
117 indentation += INDENTATION_DELTA;
119 str << indentation <<
"cursorStandardCross=" << (m_cursorStandardCross ?
"true" :
"false") <<
"\n";
120 str << indentation <<
"cursorInnerRadius=" << m_cursorInnerRadius <<
"\n";
121 str << indentation <<
"cursorSize=" << m_cursorSize <<
"\n";
122 str << indentation <<
"cursorLineWidth=" << m_cursorLineWidth <<
"\n";
127 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelDigitizeCurve::saveXml";
129 writer.writeStartElement(DOCUMENT_SERIALIZE_DIGITIZE_CURVE);
130 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_INNER_RADIUS, QString::number (m_cursorInnerRadius));
131 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_LINE_WIDTH, QString::number (m_cursorLineWidth));
132 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_SIZE, QString::number (m_cursorSize));
133 writer.writeAttribute(DOCUMENT_SERIALIZE_DIGITIZE_CURVE_CURSOR_STANDARD_CROSS, m_cursorStandardCross ?
134 DOCUMENT_SERIALIZE_BOOL_TRUE :
135 DOCUMENT_SERIALIZE_BOOL_FALSE);
136 writer.writeEndElement();
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
CursorSize cursorSize() const
Get method for cursor size.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setCursorLineWidth(int lineWidth)
Set method for cursor line width.
void setCursorSize(CursorSize cursorSize)
Set method for cursor size.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
void setCursorInnerRadius(int innerRadius)
Set method for cursor inner radius.
Storage of one imported image and the data attached to that image.
int cursorInnerRadius() const
Get method for cursor inner radius.
bool cursorStandardCross() const
Get method for cursor type.
int cursorLineWidth() const
Get method for cursor line width.
DocumentModelDigitizeCurve & operator=(const DocumentModelDigitizeCurve &other)
Assignment constructor.
DocumentModelDigitizeCurve()
Default constructor.
void setCursorStandardCross(bool cursorStandardCross)
Set method for cursor type.