QPAnnotation.h
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 #ifndef QPANNOTATION_H_
00028 #define QPANNOTATION_H_
00029
00030 #ifdef AIPS_HAS_QWT
00031
00032 #include <graphics/GenericPlotter/PlotAnnotation.h>
00033 #include <casaqt/QwtPlotter/QPPlotItem.qo.h>
00034
00035 #include <qwt_text.h>
00036
00037 namespace casa {
00038
00039
00040 class QPCanvas;
00041
00042
00043 class QPAnnotation : public QPPlotItem, public PlotAnnotation {
00044 public:
00045
00046
00047
00048 static const String CLASS_NAME;
00049
00050
00051
00052
00053
00054 QPAnnotation(const String& text, const PlotCoordinate& coord);
00055
00056
00057
00058 QPAnnotation(const String& text, const PlotCoordinate& coord,
00059 const PlotFont& font, int orientation = 0);
00060
00061
00062 QPAnnotation(const PlotAnnotation& copy);
00063
00064
00065 ~QPAnnotation();
00066
00067
00068
00069 using PlotAnnotation::setFont;
00070 using PlotAnnotation::setOutline;
00071 using PlotAnnotation::setBackground;
00072
00073
00074
00075
00076
00077 bool isValid() const { return true; }
00078
00079
00080
00081
00082
00083 QwtDoubleRect boundingRect() const;
00084
00085
00086 QWidget* legendItem() const;
00087
00088
00089
00090
00091
00092 String text() const;
00093
00094
00095 void setText(const String& newText);
00096
00097
00098 PlotFontPtr font() const;
00099
00100
00101 void setFont(const PlotFont& font);
00102
00103
00104 int orientation() const;
00105
00106
00107 void setOrientation(int orientation);
00108
00109
00110 PlotCoordinate coordinate() const;
00111
00112
00113 void setCoordinate(const PlotCoordinate& coord);
00114
00115
00116 bool outlineShown() const;
00117
00118
00119 void setOutlineShown(bool show = true);
00120
00121
00122 PlotLinePtr outline() const;
00123
00124
00125 void setOutline(const PlotLine& line);
00126
00127
00128 PlotAreaFillPtr background() const;
00129
00130
00131 void setBackground(const PlotAreaFill& area);
00132
00133
00134
00135
00136
00137
00138 QwtText& asQwtText();
00139 const QwtText& asQwtText() const;
00140
00141
00142 protected:
00143
00144 const String& className() const { return CLASS_NAME; }
00145
00146
00147 #if QWT_VERSION >= 0x060000
00148 void draw_(QPainter* painter, const QwtScaleMap& xMap,
00149 const QwtScaleMap& yMap, const QRectF& canvasRect,
00150 unsigned int drawIndex, unsigned int drawCount) const;
00151 #else
00152 void draw_(QPainter* painter, const QwtScaleMap& xMap,
00153 const QwtScaleMap& yMap, const QRect& canvasRect,
00154 unsigned int drawIndex, unsigned int drawCount) const;
00155 #endif
00156
00157 private:
00158
00159 QPen getLabelPen() const;
00160 void setPen(QwtText text, QPen pen) const;
00161
00162 QwtText m_label;
00163 PlotCoordinate m_coord;
00164 int m_orient;
00165 };
00166
00167 }
00168
00169 #endif
00170
00171 #endif