QtView.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _QtView_H_
15 #define _QtView_H_
16 
17 #include "QtViewImp.h"
18 
19 #if QT_VERSION < 0x040000
20 #include <qcanvas.h>
21 #else
22 #include <q3canvas.h>
23 #endif
24 
25 #include <qpixmap.h>
26 
27 namespace hippodraw {
28 
40 #if QT_VERSION < 0x040000
42 #else
43 class MDL_QTHIPPOPLOT_API QtView : public QtViewImp, public Q3CanvasRectangle
44 #endif
45 
46 {
47 private:
48 
52 
54  int m_upage_w;
55 
58  bool m_filled;
59 
63 
67 
68 
70  int toCanvasX ( double dx ) const;
71 
73  int toCanvasY ( double dy ) const;
74 
81 #if QT_VERSION < 0x040000
82  void transformAndFill ( QPointArray & array,
83 #else
84  void transformAndFill ( QPolygon & array,
85 #endif
86  const std::vector < double > & x,
87  const std::vector < double > & y,
88  int (QtView::* xfunc ) ( double ) const,
89  int (QtView::* yfunc ) ( double ) const );
90 
97  void drawWithPixmap ( QPainter & painter );
100  void drawMethod ( const std::vector< double > & x,
101  const std::vector< double > & y,
102  int opt1,
103  int opt2 );
104 
111  void drawViewMethod ( const std::vector< double > & x,
112  const std::vector< double > & y,
113  int opt1,
114  int opt2 );
115 
121  void ensureOffScrSize ( int osw, int osh );
122 
123 public:
124 
128  QtView ( PlotterBase * plotter );
129 
131  QtView ( const QtView & );
132 
134  virtual ~QtView ();
135 
140  virtual void draw ( QPainter & );
141 
143  virtual void drawShape ( QPainter & );
144 
149  virtual void update ( const Observable * );
150 
157  virtual void setShowCrossHairs ( bool flag );
158 
161  virtual Rect getDrawRect () const;
162 
163 
167  void updateDrawRect ();
168 
170  void setDrawRect ( const QRect & rect );
171 
173  void setDrawRect ( Rect & rect );
174 
176  virtual void setDrawRect ( float x, float y, float width, float height );
177 
179  int toViewX ( double datX ) const;
180 
182  int toViewY ( double datY ) const;
183 
184 
185  virtual void fillPickedPoint ( double x, double y,
186  std::vector < double > & picked ) const;
187 
190  virtual void setPageWidth( int upage_w );
191 
192  /* Test if the plotter of this view is a text plotter */
193  bool isTextView() const;
194 };
195 
196 } // namespace hippodraw
197 
198 #endif // _QtView_H_
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
Definition: Observable.h:39
hippodraw::QtViewImp class interface
#define MDL_QTHIPPOPLOT_API
Definition: libqthippo.h:36
bool m_filled
A flag indicating if the buffer pixmap has been filled.
Definition: QtView.h:58
QPixmap m_pixmap
A QPixmap used for buffer the plot.
Definition: QtView.h:51
The class of derived from ViewBase for drawing to the screen and PostScript generation using Qt toolk...
Definition: QtViewImp.h:47
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
Class representing a rectangle.
Definition: Rectangle.h:34
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
Definition: QtView.h:41
int m_upage_w
Page width.
Definition: QtView.h:54
bool m_crosshairs
A flag indicating if cross-hairs should be drawn.
Definition: QtView.h:62
bool m_is_drawing
A flag set true when drawing has stared.
Definition: QtView.h:66

Generated for HippoDraw Class Library by doxygen