QtView.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
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 namespace hippodraw {
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 
00068 
00070   int toCanvasX ( double dx ) const;
00071 
00073   int toCanvasY ( double dy ) const;
00074 
00081 #if QT_VERSION < 0x040000
00082   void transformAndFill ( QPointArray & array, 
00083 #else
00084   void transformAndFill ( QPolygon & array, 
00085 #endif
00086                           const std::vector < double > & x,
00087                           const std::vector < double > & y,
00088                           int (QtView::* xfunc ) ( double ) const,
00089                           int (QtView::* yfunc ) ( double ) const );
00090 
00097   void drawWithPixmap ( QPainter & painter );
00100   void drawMethod ( const std::vector< double > & x,
00101                     const std::vector< double > & y,
00102                     int opt1, 
00103                     int opt2 );
00104 
00111   void drawViewMethod ( const std::vector< double > & x,
00112                         const std::vector< double > & y,
00113                         int opt1, 
00114                         int opt2 );
00115 
00121   void ensureOffScrSize ( int osw, int osh );
00122 
00123 public:
00124 
00128   QtView ( PlotterBase * plotter );
00129 
00131   QtView ( const QtView & );
00132 
00134   virtual ~QtView ();
00135 
00140   virtual void draw ( QPainter & );
00141 
00143   virtual void drawShape ( QPainter & );
00144 
00149   virtual void update ( const Observable * );
00150 
00157   virtual void setShowCrossHairs ( bool flag );
00158 
00161   virtual Rect getDrawRect () const;
00162 
00163 
00167   void updateDrawRect ();
00168   
00170   void setDrawRect ( const QRect & rect );
00171 
00173   void setDrawRect ( Rect & rect );
00174 
00176   virtual void setDrawRect ( float x, float y, float width, float height );
00177 
00179   int toViewX ( double datX ) const;
00180 
00182   int toViewY ( double datY ) const;
00183 
00184 
00185   virtual void fillPickedPoint ( double x, double y, 
00186                                  std::vector < double > & picked ) const;
00187   
00190   virtual void setPageWidth( int upage_w );
00191 
00192   /* Test if the plotter of this view is a text plotter */
00193   bool isTextView() const;                
00194 };
00195 
00196 } // namespace hippodraw
00197 
00198 #endif // _QtView_H_

Generated for HippoDraw Class Library by doxygen