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