Home

Download

Features

Screenshots

Handbook

Browse Source

Authors

SourceForge.net Logo
Hosted by SourceForge.net

OSI Certified


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Search  

BasicGraph Class Reference

Paints basic features for a graph such as grid, axis, scale, and handles converting between actually pixel coordinates and the desired coordinates considering the scale and origin. More...

#include <basicgraph.h>

Inheritance diagram for BasicGraph:

Inheritance graph
[legend]
Collaboration diagram for BasicGraph:

Collaboration graph
[legend]
List of all members.

Public Slots

int setAScale (double d)
int setRScale (double d)
void setGrid (bool)
void setAxis (bool)
void setGridNum (bool)
void setScale (bool)
void setXZoomFactor (int)
void setYZoomFactor (int)
void setAxisColor (const QColor &)
void setGridColor (const QColor &)
void setBackgroundColor (const QColor &)
void setScaleColor (const QColor &)
void zoomIn ()
void zoomOut ()
void setAxisWidth (int)
void zoomStd ()
void zoomBox ()

Signals

void dimensionsChanged (const GraphEvent &)
void activeCoordinateChanged (const QString &, const QString &=QString(), const QString &=QString())
void infoMessageReady (const QString &)

Public Methods

 BasicGraph (QWidget *parent=0, const char *name=0)
virtual ~BasicGraph ()
virtual void load_key (const char *key, const char *value)
QColor axisColor () const
QColor gridColor () const
QColor backgroundColor () const
QColor scaleColor () const
virtual void print (QPrinter *)
 Prints graph as is.

int setXMin (double xMin)
 Sets the minimum x bounds.

int setXMax (double xMax)
 Sets the maximum x bounds.

int setXScale (double xScale)
 Sets the scale on the x direction.

int setYMin (double yMin)
 Sets the minimum y bounds.

int setYMax (double yMax)
 Sets the maximum y bounds.

int setYScale (double yScale)
 Sets the scale on the x direction.

double getXMin () const
double getXMax () const
double getYMin () const
double getYMax () const
double getXScale () const
double getYScale () const
double getRScale () const
double getAScale () const
bool getAxisState () const
bool getGridState () const
bool getScaleState () const
int getXZoomFactor () const
int getYZoomFactor () const
double getMouseX () const
double getMouseY () const
QPoint getMousePoint () const
int setRange (double xMin, double xMax, double yMin, double yMax)
 Sets the x and y minimum and maximum bounds all in one call.

virtual void setSnapToGrid (bool b)
virtual bool isSnapToGrid () const
virtual void installMathFunctions ()
 Implement this function to install any MathFunction's to a specific class.

virtual int execMathFunction (const char *id)
void offscreenResize (int width, int height)
 Resizes the on- and off-screen buffer of the graph.


Protected Methods

void setMouseX (double x_coordiniate, bool snapToGrid=true)
 Sets the x-coordinate at which you wish the graph to think the mouse is at to the value in "x_coordinate".

void setMouseY (double y_coordiniate, bool snapToGrid=true)
 Sets the y-coordinate at which you wish the graph to think the mouse is at to the value in "y_coordinate".

virtual void drawAfterAxis (QPainter *)
virtual double snapIntervalX () const
virtual double snapIntervalY () const
virtual double startSnap () const
virtual void updateCoords ()
void paint (QPainter *)
void setCoordinateStyle (int i)
double toGraphXCoord (double) const
double toGraphYCoord (double) const
int toPixelXCoord (double) const
int toPixelYCoord (double) const
void updateGraph ()
void emitDimensionsChanged ()
void paintEvent (QPaintEvent *)
void resizeEvent (QResizeEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void mousePressEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)

Protected Attributes

double xMin
double xMax
double xScale2
double yMin
double yMax
double yScale2
double xScale
double yScale
double mouseX
double mouseY
int xZoom
int yZoom
int axisWidth
QFont graphFont
QFont scaleFont
QPainter * p
QPixmap * buffer

Friends

class MathFunction

Detailed Description

Paints basic features for a graph such as grid, axis, scale, and handles converting between actually pixel coordinates and the desired coordinates considering the scale and origin.

Author:
Fungmeista

Definition at line 46 of file basicgraph.h.


Member Function Documentation

QColor BasicGraph::axisColor   const [virtual]
 

Returns :
Color of the axis.

Implements CommonGraph.

Definition at line 587 of file basicgraph.cpp.

QColor BasicGraph::backgroundColor   const [virtual]
 

Returns :
Color of the background.

Implements CommonGraph.

Definition at line 597 of file basicgraph.cpp.

Referenced by StatPlotGraph::print(), and ExpressionGraph::print().

double BasicGraph::getAScale   const [inline]
 

Returns :
Scale of the angle.

Definition at line 114 of file basicgraph.h.

References getYScale().

bool BasicGraph::getAxisState   const [inline, virtual]
 

Returns :
Whether of not the axis is turned on.

Implements CommonGraph.

Definition at line 117 of file basicgraph.h.

bool BasicGraph::getGridState   const [inline, virtual]
 

Returns :
Whether of not the grid is turned on.

Implements CommonGraph.

Definition at line 120 of file basicgraph.h.

double BasicGraph::getMouseX   const [inline]
 

Returns :
The x coordinate of where the active point is over the graph. This is usually the x coordinate of the mouse over the graph. An exception could be when tracing a function.

Definition at line 134 of file basicgraph.h.

double BasicGraph::getMouseY   const [inline]
 

Returns :
The x coordinate of where the active point is over the graph. This is usually the x coordinate of the mouse over the graph. An exception could be when tracing a function.

Definition at line 139 of file basicgraph.h.

double BasicGraph::getRScale   const [inline]
 

Returns :
Scale of the radius.

Definition at line 111 of file basicgraph.h.

References getXScale().

bool BasicGraph::getScaleState   const [inline, virtual]
 

Returns :
Whether of not the labeling of the scale is turned on.

Implements CommonGraph.

Definition at line 123 of file basicgraph.h.

double BasicGraph::getXMax   const [inline]
 

Returns :
Maximum x bounds

Definition at line 96 of file basicgraph.h.

double BasicGraph::getXMin   const [inline]
 

Returns :
Minimum x bounds

Definition at line 93 of file basicgraph.h.

double BasicGraph::getXScale   const [inline]
 

Returns :
Scale on the x direction.

Definition at line 105 of file basicgraph.h.

Referenced by getRScale().

int BasicGraph::getXZoomFactor   const [virtual]
 

Returns :
Factor of zoom in the x direction which is used in a call to zoomIn() or zoomOut().

Implements CommonGraph.

Definition at line 607 of file basicgraph.cpp.

double BasicGraph::getYMax   const [inline]
 

Returns :
Maximum x bounds

Definition at line 102 of file basicgraph.h.

double BasicGraph::getYMin   const [inline]
 

Returns :
Minimum y bounds

Definition at line 99 of file basicgraph.h.

double BasicGraph::getYScale   const [inline]
 

Returns :
Scale on the y direction.

Definition at line 108 of file basicgraph.h.

Referenced by getAScale().

int BasicGraph::getYZoomFactor   const [virtual]
 

Returns :
Factor of zoom in the y direction which is used in a call to zoomIn() or zoomOut().

Implements CommonGraph.

Definition at line 612 of file basicgraph.cpp.

QColor BasicGraph::gridColor   const [virtual]
 

Returns :
Color of the grid.

Implements CommonGraph.

Definition at line 592 of file basicgraph.cpp.

void BasicGraph::installMathFunctions   [virtual]
 

Implement this function to install any MathFunction's to a specific class.

A math function should be added by calling addMathFunction( MathFunction*, const char * id ) Example: addMathFunction(new DistanceMathFunction(this), "Distance");

Reimplemented from MathFunctionImplementor.

Reimplemented in FunctionGraph, and ParametricGraph.

Definition at line 733 of file basicgraph.cpp.

References MathFunctionImplementor::addMathFunction().

Referenced by ParametricGraph::installMathFunctions(), and FunctionGraph::installMathFunctions().

void BasicGraph::offscreenResize int    width,
int    height
 

Resizes the on- and off-screen buffer of the graph.

Call this, as opposed to resize(), when the graph needs to be resized, but is not currently shown. This essentially forces a resizeEvent(), as a resizeEvent() will not be called when the graph is not visible.

Definition at line 321 of file basicgraph.cpp.

void BasicGraph::print QPrinter *    [virtual]
 

Prints graph as is.

A printer setup dialog will be opened.

Implements CommonGraph.

Reimplemented in ExpressionGraph, and StatPlotGraph.

Definition at line 661 of file basicgraph.cpp.

QColor BasicGraph::scaleColor   const [virtual]
 

Returns :
Color of the scale.

Implements CommonGraph.

Definition at line 602 of file basicgraph.cpp.

void BasicGraph::setMouseX double    x_coordiniate,
bool    snapToGrid = true
[protected]
 

Sets the x-coordinate at which you wish the graph to think the mouse is at to the value in "x_coordinate".

The second argument can optionally be given and this is a boolean which overrides the global option of whether or not to snap to the grid.

Definition at line 683 of file basicgraph.cpp.

void BasicGraph::setMouseY double    y_coordiniate,
bool    snapToGrid = true
[protected]
 

Sets the y-coordinate at which you wish the graph to think the mouse is at to the value in "y_coordinate".

The second argument can optionally be given and this is a boolean which overrides whether the global option to snap to the grid.

Definition at line 708 of file basicgraph.cpp.

int BasicGraph::setRange double    xMin,
double    xMax,
double    yMin,
double    yMax
 

Sets the x and y minimum and maximum bounds all in one call.

This is equivalent to calling each seperate setXMin, setXMax, etc. function except calling this function will only update the graph once.

Definition at line 441 of file basicgraph.cpp.

int BasicGraph::setXScale double    xScale
 

Sets the scale on the x direction.

This is the distance that the grid is spaced in the x direction and the spacing of the x scale.

Definition at line 480 of file basicgraph.cpp.

int BasicGraph::setYScale double    yScale
 

Sets the scale on the x direction.

This is the distance that the grid is spaced in the x direction and the spacing of the x scale.

Definition at line 516 of file basicgraph.cpp.


The documentation for this class was generated from the following files: