00001
00002
00014 #ifndef _QtView_H_
00015 #define _QtView_H_
00016
00017 #include "QtViewImp.h"
00018
00019 #if QT_VERSION < 0x040000
00020 #include <qcanvas.h>
00021 #else
00022 #include <q3canvas.h>
00023 #endif
00024
00025 #include <qpixmap.h>
00026
00027 class Action;
00028
00040 #if QT_VERSION < 0x040000
00041 class MDL_QTHIPPOPLOT_API QtView : public QtViewImp, public QCanvasRectangle
00042 #else
00043 class MDL_QTHIPPOPLOT_API QtView : public QtViewImp, public Q3CanvasRectangle
00044 #endif
00045
00046 {
00047 private:
00048
00051 QPixmap m_pixmap;
00052
00054 int m_upage_w;
00055
00058 bool m_filled;
00059
00062 bool m_crosshairs;
00063
00066 bool m_is_drawing;
00067
00069 int toCanvasX ( double dx ) const;
00070
00072 int toCanvasY ( double dy ) const;
00073
00079 void transformAndFill ( QPointArray & array,
00080 const std::vector < double > & x,
00081 const std::vector < double > & y,
00082 int (QtView::* xfunc ) ( double ) const,
00083 int (QtView::* yfunc ) ( double ) const );
00084
00091 void drawWithPixmap ( QPainter & painter );
00092
00095 void drawMethod ( const std::vector< double > & x,
00096 const std::vector< double > & y,
00097 int opt1,
00098 int opt2 );
00099
00106 void drawViewMethod ( const std::vector< double > & x,
00107 const std::vector< double > & y,
00108 int opt1,
00109 int opt2 );
00110
00116 void ensureOffScrSize ( int osw, int osh );
00117
00118 public:
00119
00123 QtView ( PlotterBase * plotter );
00124
00126 QtView ( const QtView & );
00127
00129 virtual ~QtView ();
00130
00135 virtual void draw ( QPainter & );
00136
00138 virtual void drawShape ( QPainter & );
00139
00144 virtual void update ( const Observable * );
00145
00152 virtual void setShowCrossHairs ( bool flag );
00153
00155 virtual HippoRectangle getDrawRect () const;
00156
00158 void setDrawRect ( const QRect & rect );
00159
00161 virtual void setDrawRect ( float x, float y, float width, float height );
00162
00163 virtual void initPlot ( double transform_aspect_ratio );
00164
00166 virtual void endPlot ();
00167
00169 int toViewX ( double datX ) const;
00170
00172 int toViewY ( double datY ) const;
00173
00174 virtual void fillPickedPoint ( double x, double y,
00175 std::vector < double > & picked ) const;
00176
00179 virtual void setPageWidth( int upage_w );
00180 };
00181
00182 #endif // _QtView_H_