14 #include "msdevstudio/MSconfig.h"
25 #if QT_VERSION < 0x040000
27 #include <QtGui/QPaintEngine>
35 using namespace hippodraw;
39 #
if QT_VERSION < 0x040000
42 Q3CanvasRectangle ( 0 ),
45 m_crosshairs ( false )
47 assert ( plotter != 0 );
73 int x = static_cast <
int > ( rectOrg.
getX () );
74 int y = static_cast <
int > ( rectOrg.
getY () );
80 int width = static_cast <
int > ( rect.getWidth () );
81 int height = static_cast <
int > ( rect.getHeight () );
84 isEnabled () == true ) {
101 0, 0, width, height );
122 const QColor color (
"black" );
126 #if QT_VERSION < 0x040000
128 dev -> isExtDev () ==
false ) {
132 QPaintEngine * pe = dev -> paintEngine ();
135 type != QPaintEngine::PostScript ) {
174 if ( display != 0 ) {
181 #if QT_VERSION < 0x040000
184 Q3CanvasItem::update ();
217 int iw =
static_cast< int > ( w );
218 int ih =
static_cast< int > ( h );
223 iw = static_cast <
int > ( new_width );
246 std::vector < double > & picked )
const
256 m_plotter -> fillPickedPointFrom ( xx, yy, picked );
262 return static_cast <
int > ( x() + dx );
267 return static_cast <
int > ( y() + dy );
272 #if QT_VERSION < 0x040000
275 transformAndFill ( QPolygon & array,
277 const std::vector< double > & x,
278 const std::vector< double > & y,
279 int (
QtView::* xfunc) (
double )
const,
280 int (
QtView::* yfunc) (
double )
const )
282 unsigned int size = x.size();
283 assert ( size == y.size() );
285 for (
unsigned int i = 0;
i <
size;
i++ ) {
286 int ix = (this->*xfunc) ( x[
i] );
287 int iy = (this->*yfunc) ( y[i] );
288 array.setPoint ( i , ix, iy );
296 const std::vector< double > & y,
300 unsigned int size = x.size();
301 assert ( size == y.size() );
303 #if QT_VERSION < 0x040000
306 QPolygon array ( size );
318 const std::vector < double > & y,
323 unsigned int size = x.size();
324 assert ( size == y.size() );
326 #if QT_VERSION < 0x040000
329 QPolygon array ( size );
virtual void setPageWidth(int upage_w)
Set the page width.
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
fill(const QColor &fillColor=Qt::white)
virtual void drawSelf()
Draws itself.
double getHeight() const
A shortcut to get size.height.
drawPolyline(const QPointArray &a, int index=0, int npoints=-1)
static DrawBorder * instance()
Returns the pointer to the singleton instance.
void draw()
Does the actual drawing in the view.
void updateDrawRect()
Updates the drawing rectangle in the paint device space.
QPainter * m_painter
The current Qt QPainter object.
void prepareMarginRect()
Prepares the margin rectangle.
virtual void update(const Observable *)
Responds to Observable update message.
virtual double getAspectRatio() const
Get the aspect ratio.
void drawWithPixmap(QPainter &painter)
Does the drawing with QPixmap cache instead of directly to paint device.
virtual float userToMarginX(double x) const
Converts the user X coordinate into the margin X coordinate.
void drawViewMethod(const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2)
Draws in the view using the specified method.
void ensureOffScrSize(int osw, int osh)
Used by the double buffering done in method draw.
void setView(ViewBase *view)
Sets the View object.
virtual void setShowCrossHairs(bool flag)
Sets display status of cross-hairs.
void transformAndFill(QPointArray &array, const std::vector< double > &x, const std::vector< double > &y, int(QtView::*xfunc)(double) const, int(QtView::*yfunc)(double) const )
Fills the array with QPoint objects whose coordinates are in the QPaintDevice space from the vectors ...
DrawBorder class interface.
setSize(int width, int height)
QtView(PlotterBase *plotter)
The constructor.
double getWidth() const
A shortcut to get size.width.
bool m_filled
A flag indicating if the buffer pixmap has been filled.
QPixmap m_pixmap
A QPixmap used for buffer the plot.
The class of derived from ViewBase for drawing to the screen and PostScript generation using Qt toolk...
The base class for the PlotterBase hierarchy.
virtual ~QtView()
The required virtual destructor.
PlotterBase * m_plotter
The plotter object used by this view.
drawPixmap(int x, int y, const QPixmap &pixmap, int sx=0, int sy=0, int sw=-1, int sh=-1)
PyArray_TYPES type(numeric::array arr)
virtual void drawShape(QPainter &)
Overrides pure virtual function of QCanvasPolygonalItem.
intp size(numeric::array arr)
virtual float userToInvertedMarginX(double x) const
Converts the user X coordinate into the inverted X coordinate.
virtual bool isTextPlotter() const
Return true if it's a text plotter.
Class representing a rectangle.
hippodraw::QtView class interface
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
virtual Rect getDrawRect() const
Overrides virtual function of ViewBase.
A singleton class to draw the border with knobies around the selected display.
drawLineSegments(const QPointArray &a, int index=0, int nlines=-1)
int toCanvasY(double dy) const
Converts coordinate from view space to canvas space.
virtual void draw(QPainter &)
Re-Implements the inherited function from QCanvasPoygonalItem.
Rect m_margin_rect
The rectangle area in which the projected points are plotted.
int toCanvasX(double dx) const
Converts coordinate from view space to canvas space.
virtual void fillPickedPoint(double x, double y, std::vector< double > &picked) const
Fills the picked point vector.
int toViewY(double datY) const
Converts the data space coordinate Y to the view space coordinate Y.
double getX() const
A shortcut to get origin.X.
void setDrawRect(const QRect &rect)
Sets the drawing rectangle in the paint device space.
translate(double dx, double dy)
virtual float userToInvertedMarginY(double y) const
Converts the user Y coordinate into the top-left based margin Y coordinate.
void drawMethod(const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2)
Draws in the view using the specified method.
virtual double marginToInvertedUserX(double x) const
Converts from view coordinate to data conordiate, take into account the inversion of x axes...
begin(const QPaintDevice *pd, bool unclipped=FALSE)
int toViewX(double datX) const
Converts the data space coordinate X to the view space coordinate X.
virtual double marginToUserX(double x) const
Converts from view coordinate to data coordinate, without taking into account transforms or scaling...
bool m_crosshairs
A flag indicating if cross-hairs should be drawn.
virtual double marginToInvertedUserY(double y) const
Converts from inverted view coordinate to data coordinate, without taking into account transforms or ...
bool m_is_drawing
A flag set true when drawing has stared.
double getY() const
A shortcut to get origin.Y.
hippodraw::PlotterBase class interface.