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