// $Id: fgl_xydata.h $ // ================================================================= // This code is distributed under the terms and conditions of the // CCP4 Program Suite Licence Agreement as 'Part 2' (Annex 2) // software. A copy of the CCP4 licence can be obtained by writing // to CCP4, Research Complex at Harwell, Rutherford Appleton // Laboratory, Didcot OX11 0FA, UK, or from // http://www.ccp4.ac.uk/ccp4license.php. // ================================================================= // // 29.08.13 <-- Date of Last Modification. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ---------------------------------------------------------------- // // **** Module : fgl_xydata // ~~~~~~~~~ // **** Project : QtLibs/FGL - plotting in Qt // ~~~~~~~~~ // **** Classes : fgl::XYData // ~~~~~~~~~ // // (C) E. Krissinel 2012-2013 // // ================================================================= // #ifndef FGL_XYDATA_H #define FGL_XYDATA_H #include #include QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE namespace fgl { class Scene; class XYFrame; class XYData { public: enum Style { None,Circles,Spots,Haircomb }; XYData (); ~XYData(); void clear(); void setXY ( const qreal *xvector, const qreal *yvector, const int npoints ); inline void setXY ( const QVector & vx, const QVector & vy ) { x = vx; y = vy; } inline void setX ( const QVector & vx ) { x = vx; } inline void setY ( const QVector & vy ) { y = vy; } inline void addXY ( const qreal xpoint, const qreal ypoint ) { x.append(xpoint); y.append(ypoint); } inline void setLineWidth ( const qreal lw ) { lineWidth = lw; } inline void setCustomStyle( const Style s ) { customStyle = s; } inline void setCustomSize ( const qreal cs ) { customSize = cs; } inline QVector & getX() { return x; } inline QVector & getY() { return y; } inline qreal getXMin() { return xMin; } inline qreal getXMax() { return xMax; } inline qreal getYMin() { return yMin; } inline qreal getYMax() { return yMax; } inline QPen & getPen() { return pen; } inline qreal getLineWidth() { return lineWidth; } inline qreal getCustomSize() { return customSize; } inline Style getCustomStyle() { return customStyle; } inline int size() { return x.size(); } void calcRange(); inline void setYMin ( const qreal ymin ) { yMin = ymin; } inline void setYMax ( const qreal ymax ) { yMax = ymax; } void preparePainter ( QPainter *painter ); void paintFeature ( const qreal x, const qreal y, QPainter *painter, const qreal xmin, const qreal xmax, const qreal ymin, const qreal ymax ); void paintData ( QPainter *painter, Scene *scene, XYFrame *frame, const qreal xmin, const qreal xmax, const qreal ymin, const qreal ymax ); protected: QVector x; //!< x-nodes QVector y; //!< y-nodes qreal xMin; //!< minimal x qreal xMax; //!< maximal x qreal yMin; //!< minimal y qreal yMax; //!< maximal y QPen pen; //!< pen properties Style customStyle; //!< custom pen features qreal lineWidth; //!< relative line width qreal customSize; //!< relative size of custom pen features }; } #endif // FGL_XYDATA_H