Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

QSAxes Class Reference

Base graph object. More...

#include <qsaxes.h>

Inheritance diagram for QSAxes:

Inheritance graph
[legend]
List of all members.

Public Types

enum  InternalState { Waiting = 0, Busy }
enum  CoordinateSystem { mmCoord, normCoord, worldCoord, dataCoord }
enum  ElementCategory {
  GeneralCategory, AxisCategory, GridCategory, DatasetCategory,
  UnknownCategory
}

Signals

void sigDataChanged (QSGraphicalData *b, int channel)
void sigUpdate ()
void sigRangesValid ()
void sigUserDraw (QSDrv *drv, bool blocking, bool transparent)
void sigDrawEnds ()

Public Methods

 QSAxes (QObject *parent, const QSProjection *proj, const char *name=0)
virtual ~QSAxes ()
InternalState state () const
virtual void stop ()
bool complete () const
void setPosMM (const QSPt2f &pos_mm)
void setXPosMM (double x_mm)
void setYPosMM (double y_mm)
void setSizeMM (const QSPt2f &size_mm)
void setWidthMM (double w_mm)
void setHeightMM (double h_mm)
QSPt2f posMM () const
double xPosMM () const
double yPosMM () const
QSPt2f sizeMM () const
double widthMM () const
double heightMM () const
QSRectf calculateCanvasRect (double dpi=72.0)
void setCanvasRect (const QSRectf &r)
QSRectf canvasRect () const
void setFitToCanvasRect (bool enabled)
bool fitToCanvasRect () const
void setDrawInBackground (bool enabled)
bool drawInBackground () const
void setAxesOnly (bool enabled)
bool axesOnly () const
void setBackground (const QSGFill &fill)
QSGFill background () const
virtual void rememberCurrentView (int index)
virtual void setRememberedView (int index)
virtual void initMappings (QSDrv *drv)
double canvasToNormalizedX (double value) const
double canvasToNormalizedY (double value) const
QSPt2f canvasToNormalized (const QSPt2f &pos) const
double normalizedXToCanvas (double value) const
double normalizedYToCanvas (double value) const
QSPt2f normalizedToCanvas (const QSPt2f &pos) const
QSPt2f dataToCanvas (const QSPt3f &pos, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis) const
QSPt2f dataToCanvas (const QSPt2f &pos, QSAxis *xAxis, QSAxis *yAxis) const
virtual QSPt3f mixedToCanvas (const QSPt3f &pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis) const=0
virtual QSPt3f canvasToMixed (const QSPt3f &pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis) const=0
void setAutoUpdates (bool enabled)
bool autoUpdates () const
virtual int childCount () const
virtual QSDatachild (int index) const
int plotCount () const
void plotAdd (QSPlot *p)
void plotInsert (int beforePos, QSPlot *p)
void plotRemove (QSPlot *p)
void plotDelete (QSPlot *p)
QSPlotplot (int index) const
int plotIndex (QSPlot *o) const
void plotToFront (QSPlot *o)
void plotToBack (QSPlot *o)
void plotRaise (QSPlot *o)
void plotLower (QSPlot *o)
void plotReorder (int position, QSPlot *o)
int axisCount () const
void axisAdd (QSAxis *axis)
void axisInsert (int position, QSAxis *axis)
bool axisRemove (QSAxis *axis)
bool axisDelete (QSAxis *axis)
QSAxisaxisOfType (int axisType) const
QSAxisaxis (int index) const
int axisIndex (QSAxis *axis) const
void axisToFront (QSAxis *axis)
void axisToBack (QSAxis *axis)
void axisRaise (QSAxis *axis)
void axisLower (QSAxis *axis)
void axisReorder (int position, QSAxis *axis)
QSCAxesShadowshadowObject ()
virtual QString posInfo (QSPt2f &pos)
virtual void paintPlot (QPainter *p, double dpi=72.0, bool blocking=true, bool transparent=true)=0
virtual void drawPlot (QSDrv *drv, bool blocking=true, bool transparent=true)=0
virtual void paintSkeleton (QPainter *p, double dpi=72.0, bool reallyFast=false)
void forceUpdate ()
QSDrvrun_gDriver () const
double run_dpi () const
const QSProjectionproj () const
void set_background_property (const QString &value)
QString background_property () const
virtual void loadStateFromStream (QDataStream &stream, QSObjectFactory *factory)
virtual void saveStateToStream (QDataStream &stream, QSObjectFactory *factory)

Protected Methods

virtual void dataChanging (QSData *object, int channel=-1)
virtual void dataChanged (QSData *object, int channel=-1)
virtual void parametersChanging ()
virtual void parametersChanged ()
virtual void start (QSDrv *drv, bool blocking, bool transparent)
virtual void axisRangesCalculated ()
virtual void allocRuntimeData ()
virtual void freeRuntimeData ()
virtual void drawAxis (QSAxis *)
virtual void drawGrid (QSAxis *, bool)
virtual void childEvent (QChildEvent *)

Protected Attributes

QSAxes::margins_t m_m
InternalState m_internal_state
QSGFill m_bckg_fill
QSPt2f m_csize
QSPt2f m_cpos
QSPt2f m_pos_mm
QSPt2f m_size_mm
double m_curr_dpi
QSDrvm_drv
bool m_bkg_handler
bool m_axes_only
bool m_really_fast
bool m_blocking
bool m_transparent
QSCAxesShadowm_shadow_object
bool m_transformation_rect
bool m_draw_in_background
const QSProjectionm_proj
int m_curr_dataset_nr

Detailed Description

Base graph object.

Base class for all axes.Generaly it holds a list of axes and datasets.There can be any number of axes in this object. They are avaliable as a simple list without further interpretation. Axes also implements QSCObject ( canvas object ) interface, so can be added to the canvas. Warning: It does not inherit QSCObject ( problem with multiple inheritance ) directly, you must create such object with shadowObject() method. This object can repaint itself using a given painter or driver. It takes much time to repaint a graph if it contains many datapoints, so it can be repainted in the background see paint() ( 'blocking' argument ), state(), stop(). sigDrawEnds() When it state changes and it needs redrawing it notify it using sigUpdate() .

Author:
Kamil Dobkowski


Member Enumeration Documentation

enum QSAxes::CoordinateSystem
 

See mixedToCanvas() , canvasToMixed(). When data point is to be drawn its coordinates are first mapped to world coordinate system using QSPlot::defaultAxis() and QSAxis::dataToWorld(). Notice that each dataset can use a different set of axes. World coorinate system is a simple (1,1) square for QSAxes2D, and (1,1,1) cube for QSAxes3D. Next if point is 'outside' axes ( has coordinates lower than 0.0 or greater than 1.0 ) is trown out, see proj() and QSProjection::clipPoint2(). If it is visible its coordinates are mapped to canvas ( screen ) coordinates using proj() and QSProjection::world2DToCanvas() and the point is drawn on the screen. You can next map canvas coordinates to mm's ( it is a matter of a dpi scale factor ). There are also normCoordinates, but they are rarely used.

enum QSAxes::ElementCategory
 

Element category ( used by QSDrvHitTest ). You can find out which element is currently drawn using QSDrv::currentElement(), of course you will be able to call this function only if drawing is done in the background. See state() .

enum QSAxes::InternalState
 

Current state.

See also:
state


Constructor & Destructor Documentation

QSAxes::QSAxes QObject *    parent,
const QSProjection   proj,
const char *    name = 0
 

Constructor.

virtual QSAxes::~QSAxes   [virtual]
 

Destructor.


Member Function Documentation

virtual void QSAxes::allocRuntimeData   [inline, protected, virtual]
 

This function is called in 'start()' before drawing starts. Default implementation does nothing.

Reimplemented in QSAxes2D.

bool QSAxes::autoUpdates   const [inline]
 

Returns the auto-updates setting.

bool QSAxes::axesOnly   const [inline]
 

Return an axes only setting.

QSAxis* QSAxes::axis int    index const
 

Returns an axis at the index 'index'. Axes are numbered from 0 ( at the back ) to axisCount()-1 ( at the front ).

void QSAxes::axisAdd QSAxis   axis
 

Adds a new axis to the list. Emits sigChildAdded(). The newly constructed axis object should be immediately added to the child list.

int QSAxes::axisCount   const
 

Returns a total number of child axes.

bool QSAxes::axisDelete QSAxis   axis
 

Removes and deletes an axis from the axis list You can't remove an axis if it is the last axis of the given type ( there always must be at least a one X,Y,V,Z axis present ). Operation is silently ignored in the case, and function returns false;. Emits sigChildRemoved

int QSAxes::axisIndex QSAxis   axis const
 

Returns the current index of the given axis.

void QSAxes::axisInsert int    position,
QSAxis   axis
 

Adds a new axis to the list. Emits sigChildAdded(). The newly constructed axis object should be immediately added to the child list.

void QSAxes::axisLower QSAxis   axis
 

Lowers the given axis. Emits sigChildOrder.

QSAxis* QSAxes::axisOfType int    axisType const
 

Returns axis of a given type. Returned axis is always first axis found ( with the lowest index ). axisType has type of QSAxis::AxisType.

void QSAxes::axisRaise QSAxis   axis
 

Raises the given axis. Emits sigChildOrder.

virtual void QSAxes::axisRangesCalculated   [inline, protected, virtual]
 

Called when all ranges are calculated. Default implementation emits 'sigRangesValid'

Reimplemented in QSAxes2D.

bool QSAxes::axisRemove QSAxis   axis
 

Removes an axis from the axis list but doesn't delete it ( all child axes are deleted in destructor however ). You can't remove an axis if it is the last axis of the given type ( there always must be at least a one X,Y,V,Z axis present ). Operation is silently ignored in the case, and function returns false;. Emits sigChildRemoved

void QSAxes::axisReorder int    position,
QSAxis   axis
 

Reorderes the given axis. Emits sigChildOrder.

void QSAxes::axisToBack QSAxis   axis
 

Moves the given axis to the back. Emits sigChildDOrder.

void QSAxes::axisToFront QSAxis   axis
 

Moves the given axis to the front. Emits sigChildOrder.

QSGFill QSAxes::background   const
 

Returns the current background color.

QSRectf QSAxes::calculateCanvasRect double    dpi = 72.0
 

Calculates canvas area from canvasPosMM() and canvasSizeMM()

QSRectf QSAxes::canvasRect   const [inline]
 

Returns canvas position. Result valid only during drawing - see state .

virtual QSPt3f QSAxes::canvasToMixed const QSPt3f   pos,
CoordinateSystem    out_coords[3],
double    dpi,
QSAxis   xAxis,
QSAxis   yAxis,
QSAxis   zAxis
const [pure virtual]
 

From canvas to mixed coordinates. In out_coords parameter you can request which coordinate system should be used for each output coordinate. Not all combinations of CoordinateSystems are allowed in all cases. See CoordinateSystem .

Implemented in QSAxes2D.

QSPt2f QSAxes::canvasToNormalized const QSPt2f   pos const
 

See canvasToNormalizedX()

double QSAxes::canvasToNormalizedX double    value const
 

Canvas coordinates are on-screen pixels coordinates. See 'canvasPos()' and 'canvasSize()'. Normalized coordinates maps canvas coordinates to <0,1> rectangle. Example: canvasToNormalized(canvasPos()) returns ( 0.0, 0.0 ) point. See also 'initMappings()'

double QSAxes::canvasToNormalizedY double    value const
 

See canvasToNormalizedX()

virtual QSData* QSAxes::child int    index const [virtual]
 

Returns a child object - it is a joined list of child axes and child plots.

Reimplemented from QSData.

virtual int QSAxes::childCount   const [virtual]
 

The same as axisCount()+plotCount().

Reimplemented from QSData.

virtual void QSAxes::childEvent QChildEvent *    [protected, virtual]
 

Reimplemented from QObject

bool QSAxes::complete   const [inline]
 

Returns true if a last plot drawing operation was complete or false if was stopped before end.

virtual void QSAxes::dataChanged QSData   object,
int    channel = -1
[protected, virtual]
 

Reimplemented. Emits sigDataChanged() and ( see setAutoUpdates() ) sigUpdate().

Reimplemented from QSData.

virtual void QSAxes::dataChanging QSData   object,
int    channel = -1
[protected, virtual]
 

Reimplemented. Calls stop().

Reimplemented from QSData.

QSPt2f QSAxes::dataToCanvas const QSPt2f   pos,
QSAxis   xAxis,
QSAxis   yAxis
const
 

From data to screen coordinates. See also 'initMappings()'

QSPt2f QSAxes::dataToCanvas const QSPt3f   pos,
QSAxis   xAxis,
QSAxis   yAxis,
QSAxis   zAxis
const
 

From data to screen coordinates. See also 'initMappings()'

virtual void QSAxes::drawAxis QSAxis   [inline, protected, virtual]
 

Draws an axis. It is reimplemented in QSAxes2D and QSAxes3D

Reimplemented in QSAxes2D.

virtual void QSAxes::drawGrid QSAxis  ,
bool   
[inline, protected, virtual]
 

Draws an axis grid. It is reimplemented in QSAxes2D and QSAxes3D

Reimplemented in QSAxes2D.

bool QSAxes::drawInBackground   const [inline]
 

See 'setDrawInBackground()'

virtual void QSAxes::drawPlot QSDrv   drv,
bool    blocking = true,
bool    transparent = true
[pure virtual]
 

Paints the plot with the given driver, 'drv->dpi' is used to calculate a pixel-height of points and fonts. If blocking is true, this function returns after drawing ends ( may take a while ). If blocking is false driver is copied using QSDrv::copy(), this function returns immediately, drawing is continued in a timer event

Implemented in QSAxes2D.

void QSAxes::forceUpdate   [inline]
 

Emits sigUpdate

virtual void QSAxes::freeRuntimeData   [inline, protected, virtual]
 

This function is called in 'stop()' after drawing stops. Default implementation does nothing.

Reimplemented in QSAxes2D.

double QSAxes::heightMM   const [inline]
 

Returns size of the axes in mm.

virtual void QSAxes::initMappings QSDrv   drv [virtual]
 

Triggers transformation update after you modified 'setCanvasRect', datasets, axes etc. It is called also when redrawing, so there is no need to call it by hand.

Reimplemented in QSAxes2D.

virtual void QSAxes::loadStateFromStream QDataStream &    stream,
QSObjectFactory   factory
[virtual]
 

Restores all axes and datasets.

Reimplemented from QSGraphicalData.

Reimplemented in QSAxes2D.

virtual QSPt3f QSAxes::mixedToCanvas const QSPt3f   pos,
CoordinateSystem    in_coords[3],
double    dpi,
QSAxis   xAxis,
QSAxis   yAxis,
QSAxis   zAxis
const [pure virtual]
 

From mixed type coordinates to canvas. Not all combinations of CoordinateSystems are allowed in all cases. In in_coords parameter you can describe which coordinate system is used for each point coordinate. See CoordinateSystem .

Implemented in QSAxes2D.

QSPt2f QSAxes::normalizedToCanvas const QSPt2f   pos const
 

See canvasToNormalizedX()

double QSAxes::normalizedXToCanvas double    value const
 

See canvasToNormalizedX()

double QSAxes::normalizedYToCanvas double    value const
 

See canvasToNormalizedX()

virtual void QSAxes::paintPlot QPainter *    p,
double    dpi = 72.0,
bool    blocking = true,
bool    transparent = true
[pure virtual]
 

Paints the plot to the given painter, 'dpi' is used to calculate a pixel-height of points and fonts. If blocking is true, this function returns after drawing ends ( may take a while ). If blocking is false driver is copied using QSDrv::copy(), this function returns immediately, drawing is continued in a timer event

Implemented in QSAxes2D.

virtual void QSAxes::paintSkeleton QPainter *    p,
double    dpi = 72.0,
bool    reallyFast = false
[virtual]
 

Paints (fast )simplified version of this object

Reimplemented in QSAxes3D.

virtual void QSAxes::parametersChanged   [protected, virtual]
 

Reimplemented. Emits ( see setAutoUpdates() ) sigUpdate().

Reimplemented from QSGraphicalData.

virtual void QSAxes::parametersChanging   [protected, virtual]
 

Reimplemented. Calls stop().

Reimplemented from QSGraphicalData.

QSPlot* QSAxes::plot int    index const
 

Returns a plot at the index 'index'. Plots are numbered from 0 ( at the back ) to plotCount()-1 ( at the front ).

void QSAxes::plotAdd QSPlot   p
 

Adds a new plot to the list. Emits sigChildAdded(). The newly constructed object should be immediately added to the child list.

int QSAxes::plotCount   const
 

Returns a total number of child plots.

void QSAxes::plotDelete QSPlot   p
 

Removes and deletes a dataset from the dataset list. Emits sigChildRemoved It doesn't remove it nor deletes it if it is not found on the child list.

int QSAxes::plotIndex QSPlot   o const
 

Returns the current index of the given plot.

void QSAxes::plotInsert int    beforePos,
QSPlot   p
 

Adds a new plot to the list. Emits sigChildAdded(). The newly constructed object should be immediately added to the child list.

void QSAxes::plotLower QSPlot   o
 

Lowers the given object. Emits sigChildOrder.

void QSAxes::plotRaise QSPlot   o
 

Raises the given object. Emits sigChildOrder.

void QSAxes::plotRemove QSPlot   p
 

Removes a dataset from the dataset list but doesn't delete it. Emits sigChildRemoved ( all child datasets are deleted in destructor however ).

void QSAxes::plotReorder int    position,
QSPlot   o
 

Reorderes the given object. Emits sigChildOrder.

void QSAxes::plotToBack QSPlot   o
 

Moves the given object to the back. Emits sigChildDOrder.

void QSAxes::plotToFront QSPlot   o
 

Moves the given object to the front. Emits sigChildOrder.

virtual QString QSAxes::posInfo QSPt2f   pos [virtual]
 

Info about the given point

Reimplemented in QSAxes2D.

QSPt2f QSAxes::posMM   const [inline]
 

Returns position of the axes on the page in mm.

const QSProjection* QSAxes::proj   const [inline]
 

Returns a projection used by this axis object.

virtual void QSAxes::rememberCurrentView int    index [virtual]
 

Remembered view contains such parameters as axis min ,axis max, axis scale, axis reversed. Up to three different views can be remembered ( index must be in 0-2 ).

virtual void QSAxes::saveStateToStream QDataStream &    stream,
QSObjectFactory   factory
[virtual]
 

Saves all axes and datasets.

Reimplemented from QSGraphicalData.

Reimplemented in QSAxes2D.

void QSAxes::setAutoUpdates bool    enabled
 

Controls if method 'updatePlot()' will be called automatically after any parameter ( by set... method ) or data ( setMatrix... ) changes.

void QSAxes::setAxesOnly bool    enabled
 

Draws only axes ( not datasets ) -fast mode.

void QSAxes::setBackground const QSGFill   fill
 

Sets the background color.

void QSAxes::setCanvasRect const QSRectf   r
 

Sets the canvas rectangle to be painted. There is no 'paremetersChanged()' or any other notification !

void QSAxes::setDrawInBackground bool    enabled
 

This is only a hint. You must pass 'blocking' value each time tou call paintPlot or drawPlot

void QSAxes::setFitToCanvasRect bool    enabled
 

Turn on a spectial mode of fitting to canvas rect. There is no 'paremetersChanged()' or any other notification.

void QSAxes::setHeightMM double    h_mm
 

Sets height in mm

void QSAxes::setPosMM const QSPt2f   pos_mm
 

Set position on a page in mm. This is not used by this class. It is only a useful hint. If you want to set the paint area basing on this parameter you must call setCanvasRect instead: QSCShadowObject uses this properties to find its size. Example: setCanvasRect( calculateCanvasRect(dpi) )

virtual void QSAxes::setRememberedView int    index [virtual]
 

Sets the view properties

void QSAxes::setSizeMM const QSPt2f   size_mm
 

Sets size of the axes on a page in mm. This is not used by this class It is only a useful hint.If you want to set the paint area you must call setCanvasRect instead. Example: setCanvasRect( calculateCanvasRect(dpi) ) QSCShadowObject uses this properties to calculate its size.

void QSAxes::setWidthMM double    w_mm
 

Sets width in mm.

void QSAxes::setXPosMM double    x_mm
 

Sets x position

void QSAxes::setYPosMM double    y_mm
 

Sets y position

QSCAxesShadow* QSAxes::shadowObject  
 

Returns a shadow object. It has the same position and size as axes. When this position is changed by object->setBox a position and size of this object is updated ( see 'posMM()' and 'sizeMM()' ). Do not delete it.

void QSAxes::sigDataChanged QSGraphicalData   b,
int    channel
[signal]
 

Emitted after any data change in child plots and an axes object itself.

void QSAxes::sigDrawEnds   [signal]
 

Emitted when draw ends, after graphics has been closed.

void QSAxes::sigRangesValid   [signal]
 

After all ranges and transforms are calculated

void QSAxes::sigUserDraw QSDrv   drv,
bool    blocking,
bool    transparent
[signal]
 

Emitted when draw ends but before graphics is closed.

QSPt2f QSAxes::sizeMM   const [inline]
 

Returns size of the axes in mm.

virtual void QSAxes::start QSDrv   drv,
bool    blocking,
bool    transparent
[protected, virtual]
 

Starts redrawing process.

InternalState QSAxes::state   const [inline]
 

Returns the current state. Drawing - means that work is in progress at the moment (. using background handler callback ). Waiting - work is finished. You can stop drawing at any time by calling 'stop()'.

virtual void QSAxes::stop   [virtual]
 

Stops drawing immediately.

Reimplemented in QSAxes2D.

double QSAxes::widthMM   const [inline]
 

Returns size of the axes in mm.

double QSAxes::xPosMM   const [inline]
 

Returns position of the axes on the page in mm.

double QSAxes::yPosMM   const [inline]
 

Returns position of the axes on the page in mm.


The documentation for this class was generated from the following file:
Generated on Mon Mar 18 19:16:35 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002