A XYColorPlot is a layer to draw dots of color (static) More...
#include <XYColorPlot.h>
Public Member Functions | |
void | setPointColors (QVector< QColor > *c) |
virtual const QString & | xml_tagName () const |
XYColorPlot (AxisWindow *parent=0) | |
~XYColorPlot () | |
Static Public Attributes | |
static const QString | xmlXYColorPlotTag = "XYColorPlot" |
Protected Member Functions | |
virtual void | paintData (const LayerPainterRequest &lp, QPainter &p, double dotpercm) const |
virtual bool | xml_setBinaryData (XML_SETBINARYDATA_ARGS) |
virtual void | xml_writeBinaryData (XML_WRITEBINARYDATA_ARGS) const |
Protected Attributes | |
QVector< QColor > * | _pointColor |
A XYColorPlot is a layer to draw dots of color (static)
SciFigs::XYColorPlot::XYColorPlot | ( | AxisWindow * | parent = 0 | ) |
References _pointColor, and TRACE.
: XYPlot(parent) { TRACE; _pointColor=0; }
References _pointColor, and TRACE.
{ TRACE; delete _pointColor; }
void SciFigs::XYColorPlot::paintData | ( | const LayerPainterRequest & | lp, |
QPainter & | p, | ||
double | dotpercm | ||
) | const [protected, virtual] |
Reimplemented from SciFigs::XYPlot.
References _pointColor, SciFigs::XYPlot::_symbol, SciFigs::XYPlot::count(), SciFigs::XYPlot::getPaintParam(), SciFigs::LayerPainterRequest::options(), SciFigs::GraphContentLayer::paint(), SciFigs::GraphContentOptions::r2sF(), SciFigs::LayerPainterRequest::terminated(), TRACE, SciFigs::GraphContentOptions::xVisMax(), SciFigs::GraphContentOptions::xVisMin(), SciFigs::GraphContentOptions::yVisMax(), and SciFigs::GraphContentOptions::yVisMin().
{ TRACE; const GraphContentOptions& gc=lp.options(); int count; double pointSize, halfPointSize; getPaintParam(count, pointSize, halfPointSize, dotpercm); for(int i=0; i<count; i++) { if(lp.terminated()) return; double x=(*_xData)[i]; if(x>gc.xVisMin() && x<gc.xVisMax()) { double y=(*_yData)[i]; if(y>gc.yVisMin() && y<gc.yVisMax()) { p.setBrush((*_pointColor)[i]); p.setPen((*_pointColor)[i]); Symbol::paint(_symbol, p, gc.r2sF(x, y), pointSize, halfPointSize); } } } }
void SciFigs::XYColorPlot::setPointColors | ( | QVector< QColor > * | c | ) |
References _pointColor, and TRACE.
{ TRACE; LayerLocker ll(this); delete _pointColor; _pointColor=c; }
bool SciFigs::XYColorPlot::xml_setBinaryData | ( | XML_SETBINARYDATA_ARGS | ) | [protected, virtual] |
This function must be re-implemented in all classes dealing with binary data that cannot be saved in an ASCII xml file (e.g. due to the amount of data).
See also xml_writeBinaryData().
The difference between xml_setBinaryData() and xml_setBinaryData200410() is detected by the type of tag at the beginning of each block if it can be read with QString ==> 200510, else try with a normal C string, if it match the current tag then execute xml_setBinaryData200411().
See also xml_setBinaryData200411() to maintain compatibility with previous versions of xml storages.
For the arguments of this function use Macro XML_SETBINARYDATA_ARGS.
Reimplemented from SciFigs::XYPlot.
References _pointColor, SciFigs::XYPlot::count(), SciFigs::XMLSciFigs::currentFileVersion(), TRACE, and SciFigs::XYPlot::xml_setBinaryData().
{ TRACE; if(XYPlot::xml_setBinaryData(s, context) && count()>0) { _pointColor=new QVector<QColor>; _pointColor->resize(count()); XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context); Version v(scifigsContext->currentFileVersion()); static const Version vRef(2, 3, 0, "20091117"); QVector<QColor>::iterator itc; if(v>vRef) { unsigned char col[4]; for(itc=_pointColor->begin();itc!=_pointColor->end();++itc) { s >> col[0]; s >> col[1]; s >> col[2]; s >> col[3]; (*itc).setRgb(col[0],col[1],col[2], col[3]); } } else { unsigned char col[3]; for(itc=_pointColor->begin();itc!=_pointColor->end();++itc) { s >> col[0]; s >> col[1]; s >> col[2]; (*itc).setRgb(col[0],col[1],col[2]); } } } return true; }
virtual const QString& SciFigs::XYColorPlot::xml_tagName | ( | ) | const [inline, virtual] |
Reimplemented from SciFigs::XYPlot.
{return xmlXYColorPlotTag;}
void SciFigs::XYColorPlot::xml_writeBinaryData | ( | XML_WRITEBINARYDATA_ARGS | ) | const [protected, virtual] |
This function must be re-implemented in all classes dealing with binary data that cannot be saved in an ASCII xml file (e.g. due to the amount of data).
The way binary data is stored drastically changed in November 2006 with the introduction of tar.gz structures for xml files. Each class willing to store binary data can automatically generate a new file (with an automatic file name) in the .tar.gz structure by sending bytes to s.
See also xml_setBinaryData().
For the arguments of this function use Macro XML_WRITEBINARYDATA_ARGS.
Reimplemented from SciFigs::XYPlot.
References _pointColor, and TRACE.
{ TRACE; XYPlot::xml_writeBinaryData(s, context); QVector<QColor>::iterator itc; for(itc=_pointColor->begin();itc!=_pointColor->end();++itc) { const QColor& c=*itc; s << (unsigned char)c.red(); s << (unsigned char)c.green(); s << (unsigned char)c.blue(); s << (unsigned char)c.alpha(); } }
QVector<QColor>* SciFigs::XYColorPlot::_pointColor [protected] |
Referenced by paintData(), setPointColors(), xml_setBinaryData(), xml_writeBinaryData(), XYColorPlot(), and ~XYColorPlot().
const QString SciFigs::XYColorPlot::xmlXYColorPlotTag = "XYColorPlot" [static] |