#include <qsaxes.h>
Inheritance diagram for QSAxes:
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 QSData * | child (int index) const |
int | plotCount () const |
void | plotAdd (QSPlot *p) |
void | plotInsert (int beforePos, QSPlot *p) |
void | plotRemove (QSPlot *p) |
void | plotDelete (QSPlot *p) |
QSPlot * | plot (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) |
QSAxis * | axisOfType (int axisType) const |
QSAxis * | axis (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) |
QSCAxesShadow * | shadowObject () |
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 () |
QSDrv * | run_gDriver () const |
double | run_dpi () const |
const QSProjection * | proj () 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 |
QSDrv * | m_drv |
bool | m_bkg_handler |
bool | m_axes_only |
bool | m_really_fast |
bool | m_blocking |
bool | m_transparent |
QSCAxesShadow * | m_shadow_object |
bool | m_transformation_rect |
bool | m_draw_in_background |
const QSProjection * | m_proj |
int | m_curr_dataset_nr |
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() .
|
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. |
|
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() . |
|
Current state.
|
|
Constructor. |
|
Destructor. |
|
This function is called in 'start()' before drawing starts. Default implementation does nothing. Reimplemented in QSAxes2D. |
|
Returns the auto-updates setting. |
|
Return an axes only setting. |
|
Returns an axis at the index 'index'. Axes are numbered from 0 ( at the back ) to axisCount()-1 ( at the front ). |
|
Adds a new axis to the list. Emits sigChildAdded(). The newly constructed axis object should be immediately added to the child list. |
|
Returns a total number of child axes. |
|
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 |
|
Returns the current index of the given axis. |
|
Adds a new axis to the list. Emits sigChildAdded(). The newly constructed axis object should be immediately added to the child list. |
|
Lowers the given axis. Emits sigChildOrder. |
|
Returns axis of a given type. Returned axis is always first axis found ( with the lowest index ). axisType has type of QSAxis::AxisType. |
|
Raises the given axis. Emits sigChildOrder. |
|
Called when all ranges are calculated. Default implementation emits 'sigRangesValid' Reimplemented in QSAxes2D. |
|
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 |
|
Reorderes the given axis. Emits sigChildOrder. |
|
Moves the given axis to the back. Emits sigChildDOrder. |
|
Moves the given axis to the front. Emits sigChildOrder. |
|
Returns the current background color. |
|
Calculates canvas area from canvasPosMM() and canvasSizeMM() |
|
Returns canvas position. Result valid only during drawing - see state . |
|
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. |
|
See canvasToNormalizedX() |
|
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()' |
|
See canvasToNormalizedX() |
|
Returns a child object - it is a joined list of child axes and child plots. Reimplemented from QSData. |
|
The same as axisCount()+plotCount(). Reimplemented from QSData. |
|
Reimplemented from QObject |
|
Returns true if a last plot drawing operation was complete or false if was stopped before end. |
|
Reimplemented. Emits sigDataChanged() and ( see setAutoUpdates() ) sigUpdate(). Reimplemented from QSData. |
|
Reimplemented. Calls stop(). Reimplemented from QSData. |
|
From data to screen coordinates. See also 'initMappings()' |
|
From data to screen coordinates. See also 'initMappings()' |
|
Draws an axis. It is reimplemented in QSAxes2D and QSAxes3D Reimplemented in QSAxes2D. |
|
Draws an axis grid. It is reimplemented in QSAxes2D and QSAxes3D Reimplemented in QSAxes2D. |
|
See 'setDrawInBackground()' |
|
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. |
|
Emits sigUpdate |
|
This function is called in 'stop()' after drawing stops. Default implementation does nothing. Reimplemented in QSAxes2D. |
|
Returns size of the axes in mm. |
|
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. |
|
Restores all axes and datasets. Reimplemented from QSGraphicalData. Reimplemented in QSAxes2D. |
|
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. |
|
See canvasToNormalizedX() |
|
See canvasToNormalizedX() |
|
See canvasToNormalizedX() |
|
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. |
|
Paints (fast )simplified version of this object Reimplemented in QSAxes3D. |
|
Reimplemented. Emits ( see setAutoUpdates() ) sigUpdate(). Reimplemented from QSGraphicalData. |
|
Reimplemented. Calls stop(). Reimplemented from QSGraphicalData. |
|
Returns a plot at the index 'index'. Plots are numbered from 0 ( at the back ) to plotCount()-1 ( at the front ). |
|
Adds a new plot to the list. Emits sigChildAdded(). The newly constructed object should be immediately added to the child list. |
|
Returns a total number of child plots. |
|
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. |
|
Returns the current index of the given plot. |
|
Adds a new plot to the list. Emits sigChildAdded(). The newly constructed object should be immediately added to the child list. |
|
Lowers the given object. Emits sigChildOrder. |
|
Raises the given object. Emits sigChildOrder. |
|
Removes a dataset from the dataset list but doesn't delete it. Emits sigChildRemoved ( all child datasets are deleted in destructor however ). |
|
Reorderes the given object. Emits sigChildOrder. |
|
Moves the given object to the back. Emits sigChildDOrder. |
|
Moves the given object to the front. Emits sigChildOrder. |
|
Info about the given point Reimplemented in QSAxes2D. |
|
Returns position of the axes on the page in mm. |
|
Returns a projection used by this axis object. |
|
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 ). |
|
Saves all axes and datasets. Reimplemented from QSGraphicalData. Reimplemented in QSAxes2D. |
|
Controls if method 'updatePlot()' will be called automatically after any parameter ( by set... method ) or data ( setMatrix... ) changes. |
|
Draws only axes ( not datasets ) -fast mode. |
|
Sets the background color. |
|
Sets the canvas rectangle to be painted. There is no 'paremetersChanged()' or any other notification ! |
|
This is only a hint. You must pass 'blocking' value each time tou call paintPlot or drawPlot |
|
Turn on a spectial mode of fitting to canvas rect. There is no 'paremetersChanged()' or any other notification. |
|
Sets height in 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) ) |
|
Sets the view properties |
|
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. |
|
Sets width in mm. |
|
Sets x position |
|
Sets y position |
|
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. |
|
Emitted after any data change in child plots and an axes object itself. |
|
Emitted when draw ends, after graphics has been closed. |
|
After all ranges and transforms are calculated |
|
Emitted when draw ends but before graphics is closed. |
|
Returns size of the axes in mm. |
|
Starts redrawing process. |
|
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()'. |
|
Stops drawing immediately. Reimplemented in QSAxes2D. |
|
Returns size of the axes in mm. |
|
Returns position of the axes on the page in mm. |
|
Returns position of the axes on the page in mm. |