scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Column.cpp
Go to the documentation of this file.
1 
11 
30 #include "core/column/Column.h"
33 #include "lib/XmlStreamReader.h"
34 #include <QIcon>
35 #include <QXmlStreamWriter>
36 #include <QtDebug>
37 
40 {
41  d_column_private = new Private(this, mode);
42  d_string_io = new ColumnStringIO(this);
44  outputFilter()->input(0,this);
47 }
48 
49 template <>
50 void Column::initPrivate(std::unique_ptr<QVector<qreal> > d, IntervalAttribute<bool> v)
51 {
53  (this, SciDAVis::TypeDouble, SciDAVis::Numeric, d.release(), v);
54 }
55 
56 template <>
57 void Column::initPrivate(std::unique_ptr<QStringList> d, IntervalAttribute<bool> v)
58 {
60  (this, SciDAVis::TypeQString, SciDAVis::Text, d.release(), v);
61 }
62 
63 template <>
64 void Column::initPrivate(std::unique_ptr<QList<QDateTime> > d, IntervalAttribute<bool> v)
65 {
67  (this, SciDAVis::TypeQDateTime, SciDAVis::DateTime, d.release(), v);
68 }
69 
71 {
72  d_string_io = new ColumnStringIO(this);
74  outputFilter()->input(0,this);
77 }
78 
80 {
81  delete d_string_io;
82  delete d_column_private;
83 }
84 
86 {
87  if(mode == columnMode()) return;
88  beginMacro(QObject::tr("%1: change column type").arg(name()));
89  AbstractSimpleFilter * old_input_filter = d_column_private->inputFilter();
90  AbstractSimpleFilter * old_output_filter = outputFilter();
91  exec(new ColumnSetModeCmd(d_column_private, mode, conversion_filter));
92  if (d_column_private->inputFilter() != old_input_filter)
93  {
94  removeChild(old_input_filter);
97  }
98  if (outputFilter() != old_output_filter)
99  {
100  removeChild(old_output_filter);
102  outputFilter()->input(0, this);
103  }
104  endMacro();
105 }
106 
107 
108 bool Column::copy(const AbstractColumn * other)
109 {
110  Q_CHECK_PTR(other);
111  if(other->dataType() != dataType()) return false;
113  return true;
114 }
115 
116 bool Column::copy(const AbstractColumn * source, int source_start, int dest_start, int num_rows)
117 {
118  Q_CHECK_PTR(source);
119  if(source->dataType() != dataType()) return false;
120  exec(new ColumnPartialCopyCmd(d_column_private, source, source_start, dest_start, num_rows));
121  return true;
122 }
123 
124 void Column::insertRows(int before, int count)
125 {
126  if(count > 0)
127  exec(new ColumnInsertEmptyRowsCmd(d_column_private, before, count));
128 }
129 
130 void Column::removeRows(int first, int count)
131 {
132  if(count > 0)
133  exec(new ColumnRemoveRowsCmd(d_column_private, first, count));
134 }
135 
137 {
138  if(pd != plotDesignation())
140 }
141 
143 {
145 }
146 
148 {
149  emit aboutToBeReplaced(this, replacement);
150 }
151 
153 {
155 }
156 
158 {
160 }
161 
162 void Column::setInvalid(Interval<int> i, bool invalid)
163 {
164  exec(new ColumnSetInvalidCmd(d_column_private, i, invalid));
165 }
166 
167 void Column::setInvalid(int row, bool invalid)
168 {
169  setInvalid(Interval<int>(row,row), invalid);
170 }
171 
173 {
175 }
176 
177 void Column::setMasked(int row, bool mask)
178 {
179  setMasked(Interval<int>(row,row), mask);
180 }
181 
182 void Column::setFormula(Interval<int> i, QString formula)
183 {
185 }
186 
187 void Column::setFormula(int row, QString formula)
188 {
189  setFormula(Interval<int>(row, row), formula);
190 }
191 
193 {
195 }
196 
197 void Column::setTextAt(int row, const QString& new_value)
198 {
199  exec(new ColumnSetTextCmd(d_column_private, row, new_value));
200 }
201 
202 void Column::replaceTexts(int first, const QStringList& new_values)
203 {
204  if (!new_values.isEmpty())
205  exec(new ColumnReplaceTextsCmd(d_column_private, first, new_values));
206 }
207 
208 void Column::setDateAt(int row, const QDate& new_value)
209 {
210  setDateTimeAt(row, QDateTime(new_value, timeAt(row)));
211 }
212 
213 void Column::setTimeAt(int row,const QTime& new_value)
214 {
215  setDateTimeAt(row, QDateTime(dateAt(row), new_value));
216 }
217 
218 void Column::setDateTimeAt(int row, const QDateTime& new_value)
219 {
220  exec(new ColumnSetDateTimeCmd(d_column_private, row, new_value));
221 }
222 
223 void Column::replaceDateTimes(int first, const QList<QDateTime>& new_values)
224 {
225  if (!new_values.isEmpty())
226  exec(new ColumnReplaceDateTimesCmd(d_column_private, first, new_values));
227 }
228 
229 void Column::setValueAt(int row, double new_value)
230 {
231  exec(new ColumnSetValueCmd(d_column_private, row, new_value));
232 }
233 
234 void Column::replaceValues(int first, const QVector<qreal>& new_values)
235 {
236  if (!new_values.isEmpty())
237  exec(new ColumnReplaceValuesCmd(d_column_private, first, new_values));
238 }
239 
240 QString Column::textAt(int row) const
241 {
242  return d_column_private->textAt(row);
243 }
244 
245 QDate Column::dateAt(int row) const
246 {
247  return d_column_private->dateAt(row);
248 }
249 
250 QTime Column::timeAt(int row) const
251 {
252  return d_column_private->timeAt(row);
253 }
254 
255 QDateTime Column::dateTimeAt(int row) const
256 {
257  return d_column_private->dateTimeAt(row);
258 }
259 
260 double Column::valueAt(int row) const
261 {
262  return d_column_private->valueAt(row);
263 }
264 
265 QIcon Column::icon() const
266 {
267  switch(dataType())
268  {
270  return QIcon(QPixmap(":/numerictype.png"));
272  return QIcon(QPixmap(":/texttype.png"));
274  return QIcon(QPixmap(":/datetype.png"));
275  }
276  return QIcon();
277 }
278 
279 void Column::save(QXmlStreamWriter * writer) const
280 {
281  writer->writeStartElement("column");
282  writeBasicAttributes(writer);
283  writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
284  writer->writeAttribute("mode", SciDAVis::enumValueToString(columnMode(), "ColumnMode"));
285  writer->writeAttribute("plot_designation", SciDAVis::enumValueToString(plotDesignation(), "PlotDesignation"));
286  writeCommentElement(writer);
287  writer->writeStartElement("input_filter");
288  d_column_private->inputFilter()->save(writer);
289  writer->writeEndElement();
290  writer->writeStartElement("output_filter");
291  outputFilter()->save(writer);
292  writer->writeEndElement();
293  QList< Interval<int> > masks = maskedIntervals();
294  foreach(Interval<int> interval, masks)
295  {
296  writer->writeStartElement("mask");
297  writer->writeAttribute("start_row", QString::number(interval.start()));
298  writer->writeAttribute("end_row", QString::number(interval.end()));
299  writer->writeEndElement();
300  }
301  QList< Interval<int> > formulas = formulaIntervals();
302  foreach(Interval<int> interval, formulas)
303  {
304  writer->writeStartElement("formula");
305  writer->writeAttribute("start_row", QString::number(interval.start()));
306  writer->writeAttribute("end_row", QString::number(interval.end()));
307  writer->writeCharacters(formula(interval.start()));
308  writer->writeEndElement();
309  }
310  int i;
311  switch(dataType())
312  {
314  for(i=0; i<rowCount(); i++)
315  {
316  writer->writeStartElement("row");
317  writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
318  writer->writeAttribute("index", QString::number(i));
319  writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
320  writer->writeCharacters(QString::number(valueAt(i), 'e', 16));
321  writer->writeEndElement();
322  }
323  break;
325  for(i=0; i<rowCount(); i++)
326  {
327  writer->writeStartElement("row");
328  writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
329  writer->writeAttribute("index", QString::number(i));
330  writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
331  writer->writeCharacters(textAt(i));
332  writer->writeEndElement();
333  }
334  break;
335 
337  for(i=0; i<rowCount(); i++)
338  {
339  writer->writeStartElement("row");
340  writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
341  writer->writeAttribute("index", QString::number(i));
342  writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
343 #if QT_VERSION < 0x040400 // avoid a bug in Qt < 4.4
344  QString str = dateTimeAt(i).toString("yyyy-dd-MM hh:mm:ss:zzz");
345  int should_be_length = 4;
346  int actual_length = dateTimeAt(i).toString("yyyy").length();
347  while (actual_length < should_be_length)
348  {
349  str.prepend("0");
350  actual_length++;
351  }
352  writer->writeCharacters(str);
353 #else
354  writer->writeCharacters(dateTimeAt(i).toString("yyyy-dd-MM hh:mm:ss:zzz"));
355 #endif
356  writer->writeEndElement();
357  }
358  break;
359  }
360  writer->writeEndElement(); // "column"
361 }
362 
363 
365 {
366  if(reader->isStartElement() && reader->name() == "column")
367  {
368  if (!readBasicAttributes(reader)) return false;
369 
370  QXmlStreamAttributes attribs = reader->attributes();
371  QString str;
372 
373  // read type
374  str = attribs.value(reader->namespaceUri().toString(), "type").toString();
375  if(str.isEmpty())
376  {
377  reader->raiseError(tr("column type missing"));
378  return false;
379  }
380  int type_code = SciDAVis::enumStringToValue(str, "ColumnDataType");
381  if(type_code == -1)
382  {
383  reader->raiseError(tr("column type invalid"));
384  return false;
385  }
386  // read mode
387  str = attribs.value(reader->namespaceUri().toString(), "mode").toString();
388  if(str.isEmpty())
389  {
390  reader->raiseError(tr("column mode missing"));
391  return false;
392  }
393  int mode_code = SciDAVis::enumStringToValue(str, "ColumnMode");
394  if(mode_code == -1)
395  {
396  reader->raiseError(tr("column mode invalid"));
397  return false;
398  }
400  if(type_code != int(dataType()))
401  {
402  reader->raiseError(tr("column type or mode invalid"));
403  return false;
404  }
405  // read plot designation
406  str = attribs.value(reader->namespaceUri().toString(), "plot_designation").toString();
407  int pd_code = SciDAVis::enumStringToValue(str, "PlotDesignation");
408  if(str.isEmpty())
410  else if(pd_code == -1)
411  {
412  reader->raiseError(tr("column plot designation invalid"));
413  return false;
414  }
415  else
417 
418  setComment("");
419  if (rowCount() > 0)
420  removeRows(0, rowCount());
421  clearValidity();
422  clearMasks();
423  clearFormulas();
424  // read child elements
425  while (!reader->atEnd())
426  {
427  reader->readNext();
428 
429  if (reader->isEndElement()) break;
430 
431  if (reader->isStartElement())
432  {
433  bool ret_val = true;
434  if (reader->name() == "comment")
435  ret_val = readCommentElement(reader);
436  else if(reader->name() == "input_filter")
437  ret_val = XmlReadInputFilter(reader);
438  else if(reader->name() == "output_filter")
439  ret_val = XmlReadOutputFilter(reader);
440  else if(reader->name() == "mask")
441  ret_val = XmlReadMask(reader);
442  else if(reader->name() == "formula")
443  ret_val = XmlReadFormula(reader);
444  else if(reader->name() == "row")
445  ret_val = XmlReadRow(reader);
446  else // unknown element
447  {
448  reader->raiseWarning(tr("unknown element '%1'").arg(reader->name().toString()));
449  if (!reader->skipToEndElement()) return false;
450  }
451  if(!ret_val)
452  return false;
453  }
454  }
455  }
456  else // no column element
457  reader->raiseError(tr("no column element found"));
458 
459  return !reader->error();
460 }
461 
463 {
464  Q_ASSERT(reader->isStartElement() && reader->name() == "input_filter");
465  if (!reader->skipToNextTag()) return false;
466  if (!d_column_private->inputFilter()->load(reader)) return false;
467  if (!reader->skipToNextTag()) return false;
468  Q_ASSERT(reader->isEndElement() && reader->name() == "input_filter");
469  return true;
470 }
471 
473 {
474  Q_ASSERT(reader->isStartElement() && reader->name() == "output_filter");
475  if (!reader->skipToNextTag()) return false;
476  if (!outputFilter()->load(reader)) return false;
477  if (!reader->skipToNextTag()) return false;
478  Q_ASSERT(reader->isEndElement() && reader->name() == "output_filter");
479  return true;
480 }
481 
483 {
484  Q_ASSERT(reader->isStartElement() && reader->name() == "mask");
485 
486  bool ok1, ok2;
487  int start, end;
488  start = reader->readAttributeInt("start_row", &ok1);
489  end = reader->readAttributeInt("end_row", &ok2);
490  if(!ok1 || !ok2)
491  {
492  reader->raiseError(tr("invalid or missing start or end row"));
493  return false;
494  }
495  setMasked(Interval<int>(start,end));
496  if (!reader->skipToEndElement()) return false;
497 
498  return true;
499 }
500 
502 {
503  Q_ASSERT(reader->isStartElement() && reader->name() == "formula");
504 
505  bool ok1, ok2;
506  int start, end;
507  start = reader->readAttributeInt("start_row", &ok1);
508  end = reader->readAttributeInt("end_row", &ok2);
509  if(!ok1 || !ok2)
510  {
511  reader->raiseError(tr("invalid or missing start or end row"));
512  return false;
513  }
514  setFormula(Interval<int>(start,end), reader->readElementText());
515 
516  return true;
517 }
518 
520 {
521  Q_ASSERT(reader->isStartElement() && reader->name() == "row");
522 
523  QString str;
524  int type_code;
525 
526  QXmlStreamAttributes attribs = reader->attributes();
527  // verfiy type
528  str = attribs.value(reader->namespaceUri().toString(), "type").toString();
529  type_code = SciDAVis::enumStringToValue(str, "ColumnDataType");
530  if(str.isEmpty() || type_code == -1 || type_code != int(dataType()))
531  {
532  reader->raiseError(tr("invalid or missing row type"));
533  return false;
534  }
535 
536  bool ok;
537  int index = reader->readAttributeInt("index", &ok);
538  if(!ok)
539  {
540  reader->raiseError(tr("invalid or missing row index"));
541  return false;
542  }
543 
544  str = reader->readElementText();
545  switch(dataType())
546  {
548  {
549  double value = str.toDouble(&ok);
550  if(!ok)
551  {
552  reader->raiseError(tr("invalid row value"));
553  return false;
554  }
555  setValueAt(index, value);
556  break;
557  }
559  setTextAt(index, str);
560  break;
561 
563  QDateTime date_time = QDateTime::fromString(str,"yyyy-dd-MM hh:mm:ss:zzz");
564  setDateTimeAt(index, date_time);
565  break;
566  }
567 
568  str = attribs.value(reader->namespaceUri().toString(), "invalid").toString();
569  if(str == "yes") setInvalid(index);
570 
571 
572  return true;
573 }
575 {
576  return d_column_private->dataType();
577 }
578 
580 {
581  return d_column_private->columnMode();
582 }
583 int Column::rowCount() const
584 {
585  return d_column_private->rowCount();
586 }
587 
589 {
591 }
592 
594 {
595  return d_column_private->outputFilter();
596 }
597 
598 bool Column::isInvalid(int row) const
599 {
600  return d_column_private->isInvalid(row);
601 }
602 
604 {
605  return d_column_private->isInvalid(i);
606 }
607 
608 QList< Interval<int> > Column::invalidIntervals() const
609 {
611 }
612 
613 bool Column::isMasked(int row) const
614 {
615  return d_column_private->isMasked(row);
616 }
617 
619 {
620  return d_column_private->isMasked(i);
621 }
622 
623 QList< Interval<int> > Column::maskedIntervals() const
624 {
626 }
627 
628 QString Column::formula(int row) const
629 {
630  return d_column_private->formula(row);
631 }
632 
633 QList< Interval<int> > Column::formulaIntervals() const
634 {
636 }
637 
639 {
640  emit dataChanged(this); // all cells must be repainted
641  emit aspectDescriptionChanged(this); // the icon for the type changed
642 }
643 
644 QString ColumnStringIO::textAt(int row) const
645 {
646  if (d_setting)
647  return d_to_set;
648  else
649  return d_owner->d_column_private->outputFilter()->output(0)->textAt(row);
650 }
651 
652 void ColumnStringIO::setTextAt(int row, const QString &value)
653 {
654  d_setting = true;
655  d_to_set = value;
656  d_owner->copy(d_owner->d_column_private->inputFilter()->output(0), 0, row, 1);
657  d_setting = false;
658  d_to_set.clear();
659 }
660 
662  if (other->columnMode() != SciDAVis::Text) return false;
663  d_owner->d_column_private->inputFilter()->input(0,other);
664  d_owner->copy(d_owner->d_column_private->inputFilter()->output(0));
665  d_owner->d_column_private->inputFilter()->input(0,this);
666  return true;
667 }
668 
669 bool ColumnStringIO::copy(const AbstractColumn *source, int source_start, int dest_start, int num_rows) {
670  if (source->columnMode() != SciDAVis::Text) return false;
671  d_owner->d_column_private->inputFilter()->input(0,source);
672  d_owner->copy(d_owner->d_column_private->inputFilter()->output(0), source_start, dest_start, num_rows);
673  d_owner->d_column_private->inputFilter()->input(0,this);
674  return true;
675 }
676 
677 void ColumnStringIO::replaceTexts(int start_row, const QStringList &texts) {
678  Column tmp("tmp", texts);
679  copy(&tmp, 0, start_row, texts.size());
680 }
ColumnClearCmd
Clear the column.
Definition: columncommands.h:302
Column::Private::outputFilter
AbstractSimpleFilter * outputFilter() const
Return the output filter (for data type -> string conversion)
Definition: ColumnPrivate.h:148
AbstractFilter::input
bool input(int port, const AbstractColumn *source)
Connect the provided data source to the specified input port.
Definition: AbstractFilter.cpp:31
ColumnStringIO::d_owner
Column * d_owner
Definition: Column.h:353
AbstractAspect::writeCommentElement
void writeCommentElement(QXmlStreamWriter *writer) const
Save the comment to XML.
Definition: AbstractAspect.cpp:52
Column::dateTimeAt
QDateTime dateTimeAt(int row) const override
Return the QDateTime in row 'row'.
Definition: Column.cpp:255
XmlStreamReader::skipToNextTag
bool skipToNextTag()
Go to the next start or end element tag.
Definition: XmlStreamReader.cpp:92
Column::Private::isMasked
bool isMasked(int row) const
Return whether a certain row is masked
Definition: ColumnPrivate.h:177
Column::outputFilter
AbstractSimpleFilter * outputFilter() const
Return the output filter (for data type -> string conversion)
Definition: Column.cpp:593
Column.h
Column::XmlReadInputFilter
bool XmlReadInputFilter(XmlStreamReader *reader)
Read XML input filter element.
Definition: Column.cpp:462
AbstractAspect::exec
void exec(QUndoCommand *command)
Execute the given command, pushing it on the undoStack() if available.
Definition: AbstractAspect.cpp:203
XmlStreamReader::raiseError
void raiseError(const QString &message=QString())
Definition: XmlStreamReader.cpp:80
SciDAVis::TypeQString
@ TypeQString
Definition: globals.h:79
Column::invalidIntervals
QList< Interval< int > > invalidIntervals() const override
Return all intervals of invalid rows.
Definition: Column.cpp:608
ColumnReplaceTextsCmd
Replace a range of strings in a string column.
Definition: columncommands.h:639
XmlStreamReader::readAttributeInt
int readAttributeInt(const QString &name, bool *ok)
Read an XML attribute and convert it to int.
Definition: XmlStreamReader.cpp:110
str
#define str(x)
Definition: PythonScripting.cpp:41
AbstractFilter
Base class for all analysis operations.
Definition: AbstractFilter.h:77
XmlStreamReader
XML stream parser that supports errors as well as warnings.
Definition: XmlStreamReader.h:42
Column::maskedIntervals
QList< Interval< int > > maskedIntervals() const override
Return all intervals of masked rows.
Definition: Column.cpp:623
AbstractAspect::setComment
void setComment(const QString &value)
Definition: AbstractAspect.cpp:265
SciDAVis::noDesignation
@ noDesignation
no plot designation
Definition: globals.h:56
ColumnStringIO::d_to_set
QString d_to_set
Definition: Column.h:355
SciDAVis::ColumnDataType
ColumnDataType
Column data type.
Definition: globals.h:77
Column
Aspect that manages a column.
Definition: Column.h:59
IntervalAttribute< bool >
A class representing an interval-based attribute (bool version)
Definition: IntervalAttribute.h:198
AbstractAspect::index
int index() const
Return my position in my parent's list of children.
Definition: AbstractAspect.h:137
ColumnStringIO::d_setting
bool d_setting
Definition: Column.h:354
ColumnSetInvalidCmd
Mark an interval of rows as invalid.
Definition: columncommands.h:399
ColumnClearMasksCmd
Clear validity information.
Definition: columncommands.h:369
Column::Private::dateTimeAt
QDateTime dateTimeAt(int row) const
Return the QDateTime in row 'row'.
Definition: ColumnPrivate.cpp:830
Column::Private::plotDesignation
SciDAVis::PlotDesignation plotDesignation() const
Return the column plot designation.
Definition: ColumnPrivate.h:138
Column::Private
friend class Private
Definition: Column.h:63
AbstractColumn::dataType
virtual SciDAVis::ColumnDataType dataType() const =0
Return the data type of the column.
toString
S toString(const QString &x)
Deal with conversion between QString and std::string/std::wstring in a generic way.
Column::setTimeAt
void setTimeAt(int row, const QTime &new_value)
Set the content of row 'row'.
Definition: Column.cpp:213
Column::timeAt
QTime timeAt(int row) const override
Return the time part of row 'row'.
Definition: Column.cpp:250
ColumnReplaceDateTimesCmd
Replace a range of date-times in a date-time column.
Definition: columncommands.h:715
Column::formulaIntervals
QList< Interval< int > > formulaIntervals() const override
Return the intervals that have associated formulas.
Definition: Column.cpp:633
AbstractColumn::columnMode
virtual SciDAVis::ColumnMode columnMode() const =0
Return the column mode.
Column::Private::dateAt
QDate dateAt(int row) const
Return the date part of row 'row'.
Definition: ColumnPrivate.cpp:820
Column::Private::inputFilter
AbstractSimpleFilter * inputFilter() const
Return the input filter (for string -> data type conversion)
Definition: ColumnPrivate.h:146
Column::Private::valueAt
double valueAt(int row) const
Return the double value in row 'row'.
Definition: ColumnPrivate.cpp:836
Column::replaceDateTimes
void replaceDateTimes(int first, const QList< QDateTime > &new_values) override
Replace a range of values.
Definition: Column.cpp:223
Column::clearValidity
void clearValidity() override
Clear all validity information.
Definition: Column.cpp:152
Column::setColumnMode
void setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0) override
Set the column mode.
Definition: Column.cpp:85
columncommands.h
Column::removeRows
void removeRows(int first, int count) override
Remove 'count' rows starting from row 'first'.
Definition: Column.cpp:130
Column::setPlotDesignation
void setPlotDesignation(SciDAVis::PlotDesignation pd)
Set the column plot designation.
Definition: Column.cpp:136
Column::setFormula
void setFormula(Interval< int > i, QString formula)
Set a formula string for an interval of rows.
Definition: Column.cpp:182
ColumnInsertEmptyRowsCmd
Insert empty rows.
Definition: columncommands.h:196
Column::Private::isInvalid
bool isInvalid(int row) const
Return whether a certain row contains an invalid value
Definition: ColumnPrivate.h:171
SciDAVis::ColumnMode
ColumnMode
The column mode (defines output and input filter for table columns)
Definition: globals.h:66
ColumnReplaceValuesCmd
Replace a range of doubles in a double column.
Definition: columncommands.h:677
XmlStreamReader::skipToEndElement
bool skipToEndElement()
Go to the end element tag of the current element.
Definition: XmlStreamReader.cpp:121
Column::isInvalid
bool isInvalid(int row) const override
Return whether a certain row contains an invalid value
Definition: Column.cpp:598
Column::d_string_io
ColumnStringIO * d_string_io
Definition: Column.h:320
SciDAVis::enumStringToValue
static int enumStringToValue(const QString &string, const QString &enum_name)
Definition: globals.cpp:192
Column::rowCount
int rowCount() const override
Return the data vector size.
Definition: Column.cpp:583
AbstractAspect::endMacro
void endMacro()
End the undo stack macro.
Definition: AbstractAspect.cpp:222
ColumnPrivate.h
AbstractAspect::beginMacro
void beginMacro(const QString &text)
Begin an undo stack macro (series of commands)
Definition: AbstractAspect.cpp:215
AbstractSimpleFilter::save
virtual void save(QXmlStreamWriter *writer) const
Save to XML.
Definition: AbstractSimpleFilter.cpp:125
ColumnStringIO::textAt
virtual QString textAt(int row) const
Return the content of row 'row'.
Definition: Column.cpp:644
ColumnSetDateTimeCmd
Set the value of a date-time cell.
Definition: columncommands.h:603
Column::d_column_private
Private * d_column_private
Pointer to the private data object.
Definition: Column.h:319
Column::clearFormulas
void clearFormulas() override
Clear all formulas.
Definition: Column.cpp:192
Column::clear
void clear() override
Clear the whole column.
Definition: Column.cpp:142
Column::load
bool load(XmlStreamReader *reader) override
Load the column from XML.
Definition: Column.cpp:364
AbstractAspect::name
QString name() const
Definition: AbstractAspect.cpp:229
Column::columnMode
SciDAVis::ColumnMode columnMode() const override
Return the column mode.
Definition: Column.cpp:579
AbstractAspect::readBasicAttributes
bool readBasicAttributes(XmlStreamReader *reader)
Load name, creation time and caption spec from XML.
Definition: AbstractAspect.cpp:77
Column::Private::dataType
SciDAVis::ColumnDataType dataType() const
Return the data type of the column.
Definition: ColumnPrivate.h:55
Column::setMasked
void setMasked(Interval< int > i, bool mask=true)
Set an interval masked.
Definition: Column.cpp:172
XmlStreamReader.h
Column::XmlReadFormula
bool XmlReadFormula(XmlStreamReader *reader)
Read XML formula element.
Definition: Column.cpp:501
Column::Private::invalidIntervals
QList< Interval< int > > invalidIntervals() const
Return all intervals of invalid rows.
Definition: ColumnPrivate.h:175
Column::insertRows
void insertRows(int before, int count) override
Insert some empty (or initialized with zero) rows.
Definition: Column.cpp:124
SciDAVis::Text
@ Text
column contains strings
Definition: globals.h:68
Column::init
void init()
Definition: Column.cpp:70
Column::isMasked
bool isMasked(int row) const override
Return whether a certain row is masked
Definition: Column.cpp:613
Column::dataType
SciDAVis::ColumnDataType dataType() const override
Return the data type of the column.
Definition: Column.cpp:574
Column::~Column
~Column()
Definition: Column.cpp:79
Column::XmlReadRow
bool XmlReadRow(XmlStreamReader *reader)
Read XML row element.
Definition: Column.cpp:519
ColumnSetPlotDesignationCmd
Sets a column's plot designation.
Definition: columncommands.h:272
ColumnSetTextCmd
Set the text for a string cell.
Definition: columncommands.h:531
Column::replaceValues
virtual void replaceValues(int first, const QVector< qreal > &new_values) override
Replace a range of values.
Definition: Column.cpp:234
AbstractAspect::aspectDescriptionChanged
void aspectDescriptionChanged(const AbstractAspect *aspect)
Emit this when the name, comment or caption spec changed.
SciDAVis::DateTime
@ DateTime
column contains dates and/or times
Definition: globals.h:71
AbstractAspect::writeBasicAttributes
void writeBasicAttributes(QXmlStreamWriter *writer) const
Save name, creation time and caption spec to XML.
Definition: AbstractAspect.cpp:70
Column::formula
QString formula(int row) const override
Return the formula associated with row 'row'
Definition: Column.cpp:628
SciDAVis::TypeDouble
@ TypeDouble
Definition: globals.h:78
AbstractAspect::removeChild
void removeChild(AbstractAspect *child, bool detach=false)
Remove the given Aspect from my list of children.
Definition: AbstractAspect.cpp:142
Column::Private::textAt
QString textAt(int row) const
Return the content of row 'row'.
Definition: ColumnPrivate.cpp:814
AbstractSimpleFilter::load
virtual bool load(XmlStreamReader *reader)
Load from XML.
Definition: AbstractSimpleFilter.cpp:135
Column::plotDesignation
SciDAVis::PlotDesignation plotDesignation() const override
Return the column plot designation.
Definition: Column.cpp:588
Column::notifyDisplayChange
void notifyDisplayChange()
Definition: Column.cpp:638
Column::Private::timeAt
QTime timeAt(int row) const
Return the time part of row 'row'.
Definition: ColumnPrivate.cpp:825
name
char * name()
Definition: exp_saturation.c:45
Column::Private::maskedIntervals
QList< Interval< int > > maskedIntervals() const
Return all intervals of masked rows.
Definition: ColumnPrivate.h:181
ColumnPartialCopyCmd
Copy parts of a column.
Definition: columncommands.h:138
Column::XmlReadMask
bool XmlReadMask(XmlStreamReader *reader)
Read XML mask element.
Definition: Column.cpp:482
AbstractColumn::aboutToBeReplaced
void aboutToBeReplaced(const AbstractColumn *source, const AbstractColumn *new_col)
The column will be replaced.
Column::Column
Column(const QString &name, SciDAVis::ColumnMode mode)
Ctor.
Definition: Column.cpp:38
Column::ColumnStringIO
friend class ColumnStringIO
Definition: Column.h:326
SciDAVis::PlotDesignation
PlotDesignation
Types of plot designations.
Definition: globals.h:55
Column::replaceTexts
void replaceTexts(int first, const QStringList &new_values) override
Replace a range of values.
Definition: Column.cpp:202
ColumnStringIO::setTextAt
virtual void setTextAt(int row, const QString &value)
Definition: Column.cpp:652
AbstractAspect::addChild
void addChild(AbstractAspect *child)
Add the given Aspect to my list of children.
Definition: AbstractAspect.cpp:114
Column::clearMasks
void clearMasks() override
Clear all masking information.
Definition: Column.cpp:157
Column::copy
bool copy(const AbstractColumn *other) override
Copy another column of the same type.
Definition: Column.cpp:108
ColumnSetFormulaCmd
Set the formula for a given interval.
Definition: columncommands.h:467
Column::dateAt
QDate dateAt(int row) const override
Return the date part of row 'row'.
Definition: Column.cpp:245
ColumnStringIO::replaceTexts
virtual void replaceTexts(int start_row, const QStringList &texts)
Set the content of row 'row'.
Definition: Column.cpp:677
ColumnRemoveRowsCmd
Definition: columncommands.h:226
ColumnFullCopyCmd
Copy a complete column.
Definition: columncommands.h:101
AbstractSimpleFilter
Simplified filter interface for filters with only one output port.
Definition: AbstractSimpleFilter.h:129
Column::XmlReadOutputFilter
bool XmlReadOutputFilter(XmlStreamReader *reader)
Read XML output filter element.
Definition: Column.cpp:472
SciDAVis::TypeQDateTime
@ TypeQDateTime
Definition: globals.h:80
Column::icon
virtual QIcon icon() const override
Return an icon to be used for decorating the views and table column headers.
Definition: Column.cpp:265
Column::notifyReplacement
void notifyReplacement(const AbstractColumn *replacement) override
This must be called before the column is replaced by another.
Definition: Column.cpp:147
SciDAVis::Numeric
@ Numeric
column contains doubles
Definition: globals.h:67
ColumnStringIO::copy
virtual bool copy(const AbstractColumn *other)
Copy another column of the same type.
Definition: Column.cpp:661
ColumnClearFormulasCmd
Clear all associated formulas.
Definition: columncommands.h:501
ColumnSetValueCmd
Set the value for a double cell.
Definition: columncommands.h:567
XmlStreamReader::raiseWarning
void raiseWarning(const QString &message=QString())
Definition: XmlStreamReader.cpp:86
Interval< int >
Column::Private::formulaIntervals
QList< Interval< int > > formulaIntervals() const
Return the intervals that have associated formulas.
Definition: ColumnPrivate.h:220
Column::save
void save(QXmlStreamWriter *writer) const override
Save the column as XML.
Definition: Column.cpp:279
Column::textAt
QString textAt(int row) const override
Return the content of row 'row'.
Definition: Column.cpp:240
ColumnSetModeCmd
Set the column mode.
Definition: columncommands.h:44
Column::valueAt
double valueAt(int row) const override
Return the double value in row 'row'.
Definition: Column.cpp:260
Column::setTextAt
void setTextAt(int row, const QString &new_value)
Set the content of row 'row'.
Definition: Column.cpp:197
Column::initPrivate
void initPrivate(std::unique_ptr< D >, IntervalAttribute< bool >)
AbstractColumn::dataChanged
void dataChanged(const AbstractColumn *source)
Data (including validity) of the column has changed.
Column::Private::formula
QString formula(int row) const
Return the formula associated with row 'row'
Definition: ColumnPrivate.h:207
SciDAVis::enumValueToString
static QString enumValueToString(int key, const QString &enum_name)
Definition: globals.cpp:184
AbstractAspect::readCommentElement
bool readCommentElement(XmlStreamReader *reader)
Load comment from an XML element.
Definition: AbstractAspect.cpp:61
Column::Private::rowCount
int rowCount() const
Return the data vector size.
Definition: ColumnPrivate.cpp:628
Column::setDateTimeAt
void setDateTimeAt(int row, const QDateTime &new_value)
Set the content of row 'row'.
Definition: Column.cpp:218
Column::Private::columnMode
SciDAVis::ColumnMode columnMode() const
Return the column mode.
Definition: ColumnPrivate.h:64
Column::setValueAt
void setValueAt(int row, double new_value)
Set the content of row 'row'.
Definition: Column.cpp:229
AbstractColumn
Interface definition for data with column logic.
Definition: AbstractColumn.h:82
ColumnClearValidityCmd
Clear validity information.
Definition: columncommands.h:339
Column::setDateAt
void setDateAt(int row, const QDate &new_value)
Set the content of row 'row'.
Definition: Column.cpp:208
ColumnSetMaskedCmd
Mark an interval of rows as masked.
Definition: columncommands.h:433
Column::setInvalid
void setInvalid(Interval< int > i, bool invalid=true)
Set an interval invalid or valid.
Definition: Column.cpp:162