// $Id: fgl_starplot.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_starplot // ~~~~~~~~~ // **** Project : QtLibs/FGL - plotting in Qt // ~~~~~~~~~ // **** Classes : fgl::StarPlot // ~~~~~~~~~ // // (C) E. Krissinel 2012-2014 // // ================================================================= // #ifndef FGL_STARPLOT_H #define FGL_STARPLOT_H #include #include #include #include #include namespace fgl { class Scene; class StarData; /// This is class for 2D plot. The plot may have several frames /// in case of broken axes class StarPlot { public: StarPlot (); ~StarPlot(); void clear(); inline void setFont ( const QFont & f ) { font = f; } inline void setAxisColor ( const QColor & c ) { axisColor = c; } inline void setTextColor ( const QColor & c ) { textColor = c; } inline void setLineWidth ( const qreal lw ) { lineWidth = lw; } inline void setCharSize ( const qreal cs ) { charSize = cs; } inline QFont getFont () { return font; } inline QColor getAxisColor () { return axisColor; } inline QColor getTextColor () { return textColor; } inline qreal getLineWidth () { return lineWidth; } inline qreal getCharSize () { return charSize; } inline QRectF getBoundingRect() { return boundingRect; } inline void setTitles ( const QStringList & t ) { title = t; } /// Adds star data set to the plot and returns dataset pointer. StarData *addData ( const qreal *v, const int npoints ); StarData *addData ( const QVector & v ); /// Builds plot (not for external use). void makePlot ( Scene *scene ); /// Paints plot data (curves etc). void paintData ( QPainter *painter, Scene *scene ); protected: QStringList title; //!< list of beam titles QList sdata; //!< list of datasets QVector x; //!< list of beam x's QVector y; //!< list of beam y's qreal sx; //!< logical x-coordinate of plot qreal sy; //!< logical y-coordinate of plot qreal sSize; //!< logical screen dimension QRectF boundingRect; //!< bounding screen rect of the plot private: QFont font; QColor axisColor; QColor textColor; QPen pen; qreal x0,y0,radius; qreal lineWidth; // relative to 1.0 qreal charSize; // relative to 1.0 qreal lwf_major; // line width factor for beams qreal lwf_minor; // line width factor for levels qreal csf_major; // char size factor for beam titles qreal csf_minor; // char size factor for plot levels qreal tshift; // title shift in terms of char width int nbeams; }; } #endif // FGL_STARPLOT_H