7 #include "CmdMediator.h" 8 #include "DocumentModelSegments.h" 9 #include "DocumentSerialize.h" 12 #include <QTextStream> 13 #include <QXmlStreamWriter> 16 const double DEFAULT_POINT_SEPARATION = 25;
17 const double DEFAULT_MIN_LENGTH = 2;
18 const double DEFAULT_LINE_WIDTH = 4;
19 const ColorPalette DEFAULT_LINE_COLOR (COLOR_PALETTE_GREEN);
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)
32 m_minLength (document.modelSegments().
minLength()),
33 m_fillCorners (document.modelSegments().
fillCorners()),
34 m_lineWidth (document.modelSegments().
lineWidth()),
35 m_lineColor (document.modelSegments().
lineColor())
76 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelSegments::loadXml";
81 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
82 (reader.name() != DOCUMENT_SERIALIZE_SEGMENTS)){
83 loadNextFromReader(reader);
91 reader.raiseError(QObject::tr (
"Cannot read segment data"));
102 return m_pointSeparation;
106 QTextStream &str)
const 108 str << indentation <<
"DocumentModelSegments\n";
110 indentation += INDENTATION_DELTA;
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";
121 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelSegments::saveXml";
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 ?
127 DOCUMENT_SERIALIZE_BOOL_TRUE :
128 DOCUMENT_SERIALIZE_BOOL_FALSE);
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();
double pointSeparation() const
Get method for point separation.
void setLineColor(ColorPalette lineColor)
Set method for line color.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setMinLength(double minLength)
Set method for min length.
double lineWidth() const
Get method for line width.
double minLength() const
Get method for min length.
bool fillCorners() const
Get method for fill corners.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
void setLineWidth(double lineWidth)
Set method for line width.
void setFillCorners(bool fillCorners)
Set method for fill corners.
Storage of one imported image and the data attached to that image.
DocumentModelSegments()
Default constructor.
DocumentModelSegments & operator=(const DocumentModelSegments &other)
Assignment constructor.
ColorPalette lineColor() const
Get method for line color.
Model for DlgSettingsSegments and CmdSettingsSegments.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setPointSeparation(double pointSeparation)
Set method for point separation.