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 double marginToInvertedUserX(double x) const
Converts from view coordinate to data conordiate, take into account the inversion of x axes...
virtual bool isTextPlotter() const
Return true if it's a text plotter.
QPixmap m_pixmap
A QPixmap used for buffer the plot.
virtual float userToMarginX(double x) const
Converts the user X coordinate into the margin X coordinate.
double getHeight() const
A shortcut to get size.height.
A singleton class to draw the border with knobies around the selected display.
fill(const QColor &fillColor=Qt::white)
virtual double marginToUserX(double x) const
Converts from view coordinate to data coordinate, without taking into account transforms or scaling...
virtual void fillPickedPoint(double x, double y, std::vector< double > &picked) const
Fills the picked point vector.
QtView(PlotterBase *plotter)
The constructor.
drawPolyline(const QPointArray &a, int index=0, int npoints=-1)
hippodraw::PlotterBase class interface.
double getY() const
A shortcut to get origin.Y.
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
virtual ~QtView()
The required virtual destructor.
virtual void setPageWidth(int upage_w)
Set the page width.
void prepareMarginRect()
Prepares the margin rectangle.
double getWidth() const
A shortcut to get size.width.
virtual Rect getDrawRect() const
Overrides virtual function of ViewBase.
int toCanvasY(double dy) const
Converts coordinate from view space to canvas space.
int toViewX(double datX) const
Converts the data space coordinate X to the view space coordinate X.
virtual void drawShape(QPainter &)
Overrides pure virtual function of QCanvasPolygonalItem.
virtual void drawSelf()
Draws itself.
PyArray_TYPES type(numeric::array arr)
void setDrawRect(const QRect &rect)
Sets the drawing rectangle in the paint device space.
bool m_is_drawing
A flag set true when drawing has stared.
setSize(int width, int height)
void updateDrawRect()
Updates the drawing rectangle in the paint device space.
virtual float userToInvertedMarginX(double x) const
Converts the user X coordinate into the inverted X coordinate.
virtual void update(const Observable *)
Responds to Observable update message.
virtual double getAspectRatio() const
Get the aspect ratio.
drawPixmap(int x, int y, const QPixmap &pixmap, int sx=0, int sy=0, int sw=-1, int sh=-1)
virtual void draw(QPainter &)
Re-Implements the inherited function from QCanvasPoygonalItem.
PlotterBase * m_plotter
The plotter object used by this view.
bool m_crosshairs
A flag indicating if cross-hairs should be drawn.
int toViewY(double datY) const
Converts the data space coordinate Y to the view space coordinate Y.
void drawMethod(const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2)
Draws in the view using the specified method.
intp size(numeric::array arr)
The base class for the PlotterBase hierarchy.
virtual float userToInvertedMarginY(double y) const
Converts the user Y coordinate into the top-left based margin Y coordinate.
void draw()
Does the actual drawing in the view.
void drawWithPixmap(QPainter &painter)
Does the drawing with QPixmap cache instead of directly to paint device.
drawLineSegments(const QPointArray &a, int index=0, int nlines=-1)
DrawBorder class interface.
void ensureOffScrSize(int osw, int osh)
Used by the double buffering done in method draw.
Rect m_margin_rect
The rectangle area in which the projected points are plotted.
virtual double marginToInvertedUserY(double y) const
Converts from inverted view coordinate to data coordinate, without taking into account transforms or ...
The class of derived from ViewBase for drawing to the screen and PostScript generation using Qt toolk...
translate(double dx, double dy)
bool m_filled
A flag indicating if the buffer pixmap has been filled.
Class representing a rectangle.
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
void setView(ViewBase *view)
Sets the View object.
begin(const QPaintDevice *pd, bool unclipped=FALSE)
static DrawBorder * instance()
Returns the pointer to the singleton instance.
void drawViewMethod(const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2)
Draws in the view using the specified method.
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 ...
int toCanvasX(double dx) const
Converts coordinate from view space to canvas space.
QPainter * m_painter
The current Qt QPainter object.
hippodraw::QtView class interface
double getX() const
A shortcut to get origin.X.