Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NAMELINELAYER_H
00030 #define NAMELINELAYER_H
00031
00032 #include "LineLayer.h"
00033 #include "NameLine.h"
00034
00035 namespace SciFigs {
00036
00037 class NameLineLayerProperties;
00038
00039 class SCIFIGS_EXPORT NameLineLayer : public LineLayer
00040 {
00041 Q_OBJECT
00042 Q_PROPERTY(bool showNames READ isShowNames WRITE setShowNames SCRIPTABLE true)
00043 Q_PROPERTY(QString font READ fontString WRITE setFontString SCRIPTABLE true)
00044 public:
00045 NameLineLayer(AxisWindow * parent=0);
00046 ~NameLineLayer();
00047
00048 virtual const QString& xml_tagName() const {return xmlNameLineLayerTag;}
00049 static const QString xmlNameLineLayerTag;
00050
00051 void setNames(int i, QVector<QString> * names);
00052
00053 bool isShowNames() const {return _showNames;}
00054 void setShowNames(bool b) {_showNames=b;}
00055
00056 QString fontString() const {return _textFont.toString();}
00057 void setFontString(QString fs) {_textFont.fromString(fs);}
00058
00059 virtual bool hasProperties() {return true;}
00060 virtual void addProperties(PropertyProxy * pp);
00061 virtual void removeProperties(PropertyProxy * pp);
00062 virtual void properties(PropertyWidget * w) const;
00063 virtual void setProperty(uint wid, int pid, QVariant val);
00064
00065 inline AbstractNameLine * addLine();
00066 inline AbstractNameLine * addLine(const Pen& pen, const Symbol& sym);
00067
00068 inline AbstractNameLine * line(int i);
00069 inline const AbstractNameLine * line(int i) const;
00070
00071 virtual Legend legend() const;
00072 virtual void setLegend(Legend legend);
00073 protected:
00074 virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00075 virtual void paintText(const LayerPainterRequest& lp, double dotpercm);
00076
00077 bool _showNames;
00078 QFont _textFont;
00079
00080 static uint _tab;
00081 private:
00082 inline void drawLabel(QPainter& p, const QPainterPath& name, const Angle& angle, const QRectF& r, int baseLine) const;
00083 QList<QPainterPath> _textPaths;
00084 mutable QMutex _textPathsMutex;
00085 };
00086
00087 inline AbstractNameLine * NameLineLayer::addLine()
00088 {
00089 return static_cast<AbstractNameLine *>(LineLayer::addLine());
00090 }
00091
00092 inline AbstractNameLine * NameLineLayer::addLine(const Pen& pen, const Symbol& sym)
00093 {
00094 return static_cast<AbstractNameLine *>(LineLayer::addLine(pen, sym) );
00095 }
00096
00097 inline AbstractNameLine * NameLineLayer::line(int i)
00098 {
00099 return static_cast<AbstractNameLine *>(LineLayer::line(i) );
00100 }
00101
00102 inline const AbstractNameLine * NameLineLayer::line(int i) const
00103 {
00104 return static_cast<const AbstractNameLine *>(LineLayer::line(i) );
00105 }
00106
00107 }
00108
00109 #endif // NAMELINELAYER_H