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

Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay. More...

#include <DocumentModelGridDisplay.h>

Inheritance diagram for DocumentModelGridDisplay:
Inheritance graph
Collaboration diagram for DocumentModelGridDisplay:
Collaboration graph

Public Member Functions

 DocumentModelGridDisplay ()
 Default constructor. More...
 
 DocumentModelGridDisplay (const Document &document)
 Initial constructor from Document. More...
 
 DocumentModelGridDisplay (const DocumentModelGridDisplay &other)
 Copy constructor. More...
 
DocumentModelGridDisplayoperator= (const DocumentModelGridDisplay &other)
 Assignment constructor. More...
 
unsigned int countX () const
 Get method for x grid line count. More...
 
unsigned int countY () const
 Get method for y grid line count. More...
 
GridCoordDisable disableX () const
 Get method for x grid line disabled variable. More...
 
GridCoordDisable disableY () const
 Get method for y grid line disabled variable. More...
 
virtual void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. More...
 
ColorPalette paletteColor () const
 Get method for 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 setCountX (unsigned int countX)
 Set method for x grid line count. More...
 
void setCountY (unsigned int countY)
 Set method for y grid line count. More...
 
void setDisableX (GridCoordDisable disableX)
 Set method for x grid line disabled variable. More...
 
void setDisableY (GridCoordDisable disableY)
 Set method for y grid line disabled variable. More...
 
void setPaletteColor (ColorPalette paletteColor)
 Set method for color. More...
 
void setStable (bool stable)
 Set method for stable flag. More...
 
void setStartX (double startX)
 Set method for x grid line lower bound (inclusive). More...
 
void setStartY (double yStart)
 Set method for y grid line lower bound (inclusive). More...
 
void setStepX (double stepX)
 Set method for x grid line increment. More...
 
void setStepY (double yStep)
 Set method for y grid line increment. More...
 
void setStopX (double stopX)
 Set method for x grid line upper bound (inclusive). More...
 
void setStopY (double yStop)
 Set method for y grid line upper bound (inclusive). More...
 
bool stable () const
 Get method for stable flag. More...
 
double startX () const
 Get method for x grid line lower bound (inclusive). More...
 
double startY () const
 Get method for y grid line lower bound (inclusive). More...
 
double stepX () const
 Get method for x grid line increment. More...
 
double stepY () const
 Get method for y grid line increment. More...
 
double stopX () const
 Get method for x grid line upper bound (inclusive). More...
 
double stopY () const
 Get method for y grid line upper bound (inclusive). More...
 
- Public Member Functions inherited from DocumentModelAbstractBase
 DocumentModelAbstractBase ()
 Single constructor. More...
 
virtual ~DocumentModelAbstractBase ()
 Single destructor. More...
 

Additional Inherited Members

virtual void loadXml (QXmlStreamReader &reader)=0
 Load model from serialized xml. More...
 
virtual void saveXml (QXmlStreamWriter &writer) const =0
 Save entire model as xml into stream. More...
 

Detailed Description

Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.

Definition at line 18 of file DocumentModelGridDisplay.h.

Constructor & Destructor Documentation

◆ DocumentModelGridDisplay() [1/3]

DocumentModelGridDisplay::DocumentModelGridDisplay ( )

Default constructor.

Definition at line 20 of file DocumentModelGridDisplay.cpp.

20 :
21 m_stable (false),
22 m_disableX (GRID_COORD_DISABLE_COUNT),
23 m_countX (2),
24 m_startX (0.0),
25 m_stepX (1.0),
26 m_stopX (1.0),
27 m_disableY (GRID_COORD_DISABLE_COUNT),
28 m_countY (2),
29 m_startY (0.0),
30 m_stepY (1.0),
31 m_stopY (1.0),
32 m_paletteColor (DEFAULT_COLOR)
33{
34}
const ColorPalette DEFAULT_COLOR
@ GRID_COORD_DISABLE_COUNT

◆ DocumentModelGridDisplay() [2/3]

DocumentModelGridDisplay::DocumentModelGridDisplay ( const Document document)

Initial constructor from Document.

Definition at line 36 of file DocumentModelGridDisplay.cpp.

36 :
37 m_stable (document.modelGridDisplay().stable()),
38 m_disableX (document.modelGridDisplay().disableX()),
39 m_countX (document.modelGridDisplay().countX()),
40 m_startX (document.modelGridDisplay().startX()),
41 m_stepX (document.modelGridDisplay().stepX()),
42 m_stopX (document.modelGridDisplay().stopX()),
43 m_disableY (document.modelGridDisplay().disableY()),
44 m_countY (document.modelGridDisplay().countY()),
45 m_startY (document.modelGridDisplay().startY()),
46 m_stepY (document.modelGridDisplay().stepY()),
47 m_stopY (document.modelGridDisplay().stopY()),
48 m_paletteColor (document.modelGridDisplay().paletteColor())
49{
50}
GridCoordDisable disableY() const
Get method for y grid line disabled variable.
unsigned int countX() const
Get method for x grid line count.
double startX() const
Get method for x grid line lower bound (inclusive).
GridCoordDisable disableX() const
Get method for x grid line disabled variable.
unsigned int countY() const
Get method for y grid line count.
double stepX() const
Get method for x grid line increment.
double stopX() const
Get method for x grid line upper bound (inclusive).
double stopY() const
Get method for y grid line upper bound (inclusive).
bool stable() const
Get method for stable flag.
ColorPalette paletteColor() const
Get method for color.
double stepY() const
Get method for y grid line increment.
double startY() const
Get method for y grid line lower bound (inclusive).
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
Definition: Document.cpp:730

◆ DocumentModelGridDisplay() [3/3]

DocumentModelGridDisplay::DocumentModelGridDisplay ( const DocumentModelGridDisplay other)

Copy constructor.

Definition at line 52 of file DocumentModelGridDisplay.cpp.

52 :
53 m_stable(other.stable()),
54 m_disableX (other.disableX()),
55 m_countX (other.countX()),
56 m_startX (other.startX()),
57 m_stepX (other.stepX()),
58 m_stopX (other.stopX()),
59 m_disableY (other.disableY()),
60 m_countY (other.countY()),
61 m_startY (other.startY()),
62 m_stepY (other.stepY()),
63 m_stopY (other.stopY()),
64 m_paletteColor (other.paletteColor())
65{
66}

Member Function Documentation

◆ countX()

unsigned int DocumentModelGridDisplay::countX ( ) const

Get method for x grid line count.

Definition at line 86 of file DocumentModelGridDisplay.cpp.

87{
88 return m_countX;
89}

◆ countY()

unsigned int DocumentModelGridDisplay::countY ( ) const

Get method for y grid line count.

Definition at line 91 of file DocumentModelGridDisplay.cpp.

92{
93 return m_countY;
94}

◆ disableX()

GridCoordDisable DocumentModelGridDisplay::disableX ( ) const

Get method for x grid line disabled variable.

Definition at line 96 of file DocumentModelGridDisplay.cpp.

97{
98 return m_disableX;
99}

◆ disableY()

GridCoordDisable DocumentModelGridDisplay::disableY ( ) const

Get method for y grid line disabled variable.

Definition at line 101 of file DocumentModelGridDisplay.cpp.

102{
103 return m_disableY;
104}

◆ loadXml()

void DocumentModelGridDisplay::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 106 of file DocumentModelGridDisplay.cpp.

107{
108 LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelGridDisplay::loadXml";
109
110 bool success = true;
111
112 QXmlStreamAttributes attributes = reader.attributes();
113
114 if (attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STABLE) &&
115 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_X) &&
116 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_X) &&
117 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_X) &&
118 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_X) &&
119 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_X) &&
120 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_Y) &&
121 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_Y) &&
122 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_Y) &&
123 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_Y) &&
124 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_Y) &&
125 attributes.hasAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR)) {
126
127 // Boolean values
128 QString stableValue = attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_STABLE).toString();
129
131 setDisableX (static_cast<GridCoordDisable> (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_X).toInt()));
132 setCountX (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_X).toUInt());
133 setStartX (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_X).toDouble());
134 setStepX (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_X).toDouble());
135 setStopX (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_X).toDouble());
136 setDisableY (static_cast<GridCoordDisable> (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_Y).toUInt()));
137 setCountY (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_Y).toUInt());
138 setStartY (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_Y).toDouble());
139 setStepY (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_Y).toDouble());
140 setStopY (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_Y).toDouble());
141 setPaletteColor (static_cast<ColorPalette> (attributes.value(DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR).toInt()));
142
143 // Read until end of this subtree
144 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
145 (reader.name() != DOCUMENT_SERIALIZE_GRID_DISPLAY)){
146 loadNextFromReader(reader);
147 if (reader.atEnd()) {
148 success = false;
149 break;
150 }
151 }
152 }
153
154 if (!success) {
155 reader.raiseError (QObject::tr ("Cannot read grid display data"));
156 }
157}
ColorPalette
Definition: ColorPalette.h:12
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_Y
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_Y
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_STABLE
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_START_Y
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_Y
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_X
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_Y
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_X
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_X
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_START_X
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_X
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
GridCoordDisable
log4cpp::Category * mainCat
Definition: Logger.cpp:14
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
void setPaletteColor(ColorPalette paletteColor)
Set method for color.
void setStepX(double stepX)
Set method for x grid line increment.
void setStepY(double yStep)
Set method for y grid line increment.
void setStopX(double stopX)
Set method for x grid line upper bound (inclusive).
void setDisableX(GridCoordDisable disableX)
Set method for x grid line disabled variable.
void setStopY(double yStop)
Set method for y grid line upper bound (inclusive).
void setDisableY(GridCoordDisable disableY)
Set method for y grid line disabled variable.
void setCountX(unsigned int countX)
Set method for x grid line count.
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
void setStable(bool stable)
Set method for stable flag.
void setStartY(double yStart)
Set method for y grid line lower bound (inclusive).
void setCountY(unsigned int countY)
Set method for y grid line count.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18

◆ operator=()

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

Assignment constructor.

Definition at line 68 of file DocumentModelGridDisplay.cpp.

69{
70 m_stable = other.stable();
71 m_disableX = other.disableX();
72 m_countX = other.countX();
73 m_startX = other.startX();
74 m_stepX = other.stepX();
75 m_stopX = other.stopX();
76 m_disableY = other.disableY();
77 m_countY = other.countY();
78 m_startY = other.startY();
79 m_stepY = other.stepY();
80 m_stopY = other.stopY();
81 m_paletteColor = other.paletteColor();
82
83 return *this;
84}

◆ paletteColor()

ColorPalette DocumentModelGridDisplay::paletteColor ( ) const

Get method for color.

Definition at line 159 of file DocumentModelGridDisplay.cpp.

160{
161 return m_paletteColor;
162}

◆ printStream()

void DocumentModelGridDisplay::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 164 of file DocumentModelGridDisplay.cpp.

166{
167 str << indentation << "DocumentModelGridDisplay\n";
168
169 indentation += INDENTATION_DELTA;
170
171 str << indentation << "stable=" << (m_stable ? "true" : "false") << "\n";
172 str << indentation << "disableX=" << m_disableX << "\n";
173 str << indentation << "countX=" << m_countX << "\n";
174 str << indentation << "startX=" << m_startX << "\n";
175 str << indentation << "stepX=" << m_stepX << "\n";
176 str << indentation << "stopX=" << m_stopX << "\n";
177 str << indentation << "disableY=" << m_disableY << "\n";
178 str << indentation << "countY=" << m_countY << "\n";
179 str << indentation << "startY=" << m_startY << "\n";
180 str << indentation << "stepY=" << m_stepY << "\n";
181 str << indentation << "stopY=" << m_stopY << "\n";
182 str << indentation << "color=" << colorPaletteToString (m_paletteColor) << "\n";
183}
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
const QString INDENTATION_DELTA

◆ saveXml()

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

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 185 of file DocumentModelGridDisplay.cpp.

186{
187 LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelGridDisplay::saveXml";
188
189 writer.writeStartElement(DOCUMENT_SERIALIZE_GRID_DISPLAY);
190 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STABLE, m_stable ?
193 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_X, QString::number (m_disableX));
194 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_X, QString::number (m_countX));
195 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_X, QString::number (m_startX));
196 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_X, QString::number (m_stepX));
197 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_X, QString::number (m_stopX));
198 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_DISABLE_Y, QString::number (m_disableY));
199 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COUNT_Y, QString::number (m_countY));
200 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_START_Y, QString::number (m_startY));
201 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STEP_Y, QString::number (m_stepY));
202 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_STOP_Y, QString::number (m_stopY));
203 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR, QString::number (m_paletteColor));
204 writer.writeAttribute(DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR_STRING, colorPaletteToString (m_paletteColor));
205 writer.writeEndElement();
206}
const QString DOCUMENT_SERIALIZE_GRID_DISPLAY_COLOR_STRING
const QString DOCUMENT_SERIALIZE_BOOL_FALSE

◆ setCountX()

void DocumentModelGridDisplay::setCountX ( unsigned int  countX)

Set method for x grid line count.

Definition at line 208 of file DocumentModelGridDisplay.cpp.

209{
210 m_countX = countX;
211}

◆ setCountY()

void DocumentModelGridDisplay::setCountY ( unsigned int  countY)

Set method for y grid line count.

Definition at line 213 of file DocumentModelGridDisplay.cpp.

214{
215 m_countY = countY;
216}

◆ setDisableX()

void DocumentModelGridDisplay::setDisableX ( GridCoordDisable  disableX)

Set method for x grid line disabled variable.

Definition at line 218 of file DocumentModelGridDisplay.cpp.

219{
220 m_disableX = disableX;
221}

◆ setDisableY()

void DocumentModelGridDisplay::setDisableY ( GridCoordDisable  disableY)

Set method for y grid line disabled variable.

Definition at line 223 of file DocumentModelGridDisplay.cpp.

224{
225 m_disableY = disableY;
226}

◆ setPaletteColor()

void DocumentModelGridDisplay::setPaletteColor ( ColorPalette  paletteColor)

Set method for color.

Definition at line 228 of file DocumentModelGridDisplay.cpp.

229{
230 m_paletteColor = paletteColor;
231}

◆ setStable()

void DocumentModelGridDisplay::setStable ( bool  stable)

Set method for stable flag.

Definition at line 233 of file DocumentModelGridDisplay.cpp.

234{
235 m_stable = stable;
236}

◆ setStartX()

void DocumentModelGridDisplay::setStartX ( double  startX)

Set method for x grid line lower bound (inclusive).

Definition at line 238 of file DocumentModelGridDisplay.cpp.

239{
240 m_startX = startX;
241}

◆ setStartY()

void DocumentModelGridDisplay::setStartY ( double  yStart)

Set method for y grid line lower bound (inclusive).

Definition at line 243 of file DocumentModelGridDisplay.cpp.

244{
245 m_startY = startY;
246}

◆ setStepX()

void DocumentModelGridDisplay::setStepX ( double  stepX)

Set method for x grid line increment.

Definition at line 248 of file DocumentModelGridDisplay.cpp.

249{
250 m_stepX = stepX;
251}

◆ setStepY()

void DocumentModelGridDisplay::setStepY ( double  yStep)

Set method for y grid line increment.

Definition at line 253 of file DocumentModelGridDisplay.cpp.

254{
255 m_stepY = stepY;
256}

◆ setStopX()

void DocumentModelGridDisplay::setStopX ( double  stopX)

Set method for x grid line upper bound (inclusive).

Definition at line 258 of file DocumentModelGridDisplay.cpp.

259{
260 m_stopX = stopX;
261}

◆ setStopY()

void DocumentModelGridDisplay::setStopY ( double  yStop)

Set method for y grid line upper bound (inclusive).

Definition at line 263 of file DocumentModelGridDisplay.cpp.

264{
265 m_stopY = stopY;
266}

◆ stable()

bool DocumentModelGridDisplay::stable ( ) const

Get method for stable flag.

The flag is false to let the settings get automatically updated, until the user selects settings - at which point the stable flag is set to true

Definition at line 268 of file DocumentModelGridDisplay.cpp.

269{
270 return m_stable;
271}

◆ startX()

double DocumentModelGridDisplay::startX ( ) const

Get method for x grid line lower bound (inclusive).

Definition at line 273 of file DocumentModelGridDisplay.cpp.

274{
275 return m_startX;
276}

◆ startY()

double DocumentModelGridDisplay::startY ( ) const

Get method for y grid line lower bound (inclusive).

Definition at line 278 of file DocumentModelGridDisplay.cpp.

279{
280 return m_startY;
281}

◆ stepX()

double DocumentModelGridDisplay::stepX ( ) const

Get method for x grid line increment.

Definition at line 283 of file DocumentModelGridDisplay.cpp.

284{
285 return m_stepX;
286}

◆ stepY()

double DocumentModelGridDisplay::stepY ( ) const

Get method for y grid line increment.

Definition at line 288 of file DocumentModelGridDisplay.cpp.

289{
290 return m_stepY;
291}

◆ stopX()

double DocumentModelGridDisplay::stopX ( ) const

Get method for x grid line upper bound (inclusive).

Definition at line 293 of file DocumentModelGridDisplay.cpp.

294{
295 return m_stopX;
296}

◆ stopY()

double DocumentModelGridDisplay::stopY ( ) const

Get method for y grid line upper bound (inclusive).

Definition at line 298 of file DocumentModelGridDisplay.cpp.

299{
300 return m_stopY;
301}

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