From b85a292ce06475d560bfa1195b63a8bfe211f22d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 11 Jul 2012 14:15:27 -0500 Subject: Add 0.2.7 release of qwtplot3d for future TQt3 conversion and use --- lib/tqwtplot3d/include/qwt3d_label.h | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/tqwtplot3d/include/qwt3d_label.h (limited to 'lib/tqwtplot3d/include/qwt3d_label.h') diff --git a/lib/tqwtplot3d/include/qwt3d_label.h b/lib/tqwtplot3d/include/qwt3d_label.h new file mode 100644 index 0000000..debff42 --- /dev/null +++ b/lib/tqwtplot3d/include/qwt3d_label.h @@ -0,0 +1,80 @@ +#ifndef __LABELPIXMAP_H__ +#define __LABELPIXMAP_H__ + +#include +#include +#include +#include +#include + +#include "qwt3d_drawable.h" + +namespace Qwt3D +{ + +//! A Qt string or an output device dependent string +class QWT3D_EXPORT Label : public Drawable +{ + +public: + + Label(); + //! Construct label and initialize with font + Label(const QString & family, int pointSize, int weight = QFont::Normal, bool italic = false); + + //! Sets the labels font + void setFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false); + + void adjust(int gap); //!< Fine tunes label; + double gap() const {return gap_;} //!< Returns the gap caused by adjust(); + void setPosition(Qwt3D::Triple pos, ANCHOR a = BottomLeft); //!< Sets the labels position + void setRelPosition(Tuple rpos, ANCHOR a); //!< Sets the labels position relative to screen + Qwt3D::Triple first() const { return beg_;} //!< Receives bottom left label position + Qwt3D::Triple second() const { return end_;} //!< Receives top right label position + ANCHOR anchor() const { return anchor_; } //!< Defines an anchor point for the labels surrounding rectangle + virtual void setColor(double r, double g, double b, double a = 1); + virtual void setColor(Qwt3D::RGBA rgba); + + /*! + \brief Sets the labels string + For unicode labeling ( QChar(0x3c0) etc.) please look at www.unicode.org. + */ + void setString(QString const& s); + void draw(); //!< Actual drawing + + /** + \brief Decides about use of PDF standard fonts for PDF output + If true, Label can use one of the PDF standard fonts (unprecise positioning for now), + otherwise it dumps pixmaps in the PDF stream (poor quality) + */ + static void useDeviceFonts(bool val); + + +private: + + Qwt3D::Triple beg_, end_, pos_; + QPixmap pm_; + QImage buf_, tex_; + QFont font_; + QString text_; + + ANCHOR anchor_; + + void init(); + void init(const QString & family, int pointSize, int weight = QFont::Normal, bool italic = false); + void update(); //!< Enforces an update of the internal pixmap + void convert2screen(); + double width() const; + double height() const; + + int gap_; + + bool flagforupdate_; + + static bool devicefonts_; + +}; + +} // ns + +#endif -- cgit v1.2.3