#include <mathplot.h>
Public Member Functions | |
mpLayer () | |
virtual bool | HasBBox () |
virtual double | GetMinX () |
virtual double | GetMaxX () |
virtual double | GetMinY () |
virtual double | GetMaxY () |
virtual void | Plot (wxDC &dc, mpWindow &w)=0 |
wxString | GetName () const |
const wxFont & | GetFont () const |
const wxPen & | GetPen () const |
void | SetName (wxString name) |
void | SetFont (wxFont &font) |
void | SetPen (wxPen &pen) |
int | GetYTranslated (double sizey, double y) |
Protected Attributes | |
wxFont | m_font |
Layer's font. | |
wxPen | m_pen |
Layer's pen. | |
wxString | m_name |
Layer's name. |
Plot layer, abstract base class. Any number of mpLayer implementations can be attached to mpWindow. Examples for mpLayer implementations are function graphs, or scale rulers.
For convenience mpLayer defines a name, a font (wxFont), and a pen (wxPen) as class members. These may or may not be used by implementations.
Definition at line 98 of file mathplot.h.
mpLayer::mpLayer | ( | ) |
Definition at line 53 of file mathplot.cxx.
const wxFont& mpLayer::GetFont | ( | ) | const [inline] |
Get font set for this layer.
Definition at line 175 of file mathplot.h.
00175 { return m_font; }
virtual double mpLayer::GetMaxX | ( | ) | [inline, virtual] |
Get inclusive right border of bounding box.
Definition at line 120 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
virtual double mpLayer::GetMaxY | ( | ) | [inline, virtual] |
Get inclusive top border of bounding box.
Definition at line 130 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
virtual double mpLayer::GetMinX | ( | ) | [inline, virtual] |
Get inclusive left border of bounding box.
Definition at line 115 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
virtual double mpLayer::GetMinY | ( | ) | [inline, virtual] |
Get inclusive bottom border of bounding box.
Definition at line 125 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
wxString mpLayer::GetName | ( | ) | const [inline] |
const wxPen& mpLayer::GetPen | ( | ) | const [inline] |
Get pen set for this layer.
Definition at line 180 of file mathplot.h.
00180 { return m_pen; }
int mpLayer::GetYTranslated | ( | double | sizey, | |
double | y | |||
) | [inline] |
Get the translation of the Y coordinate acoording to the new orientation of the axis du to the problem identified in MACOS with the funtion 'SetAxisOrientation'
Definition at line 201 of file mathplot.h.
Referenced by pPlotterLayer::draw(), pPlotterLayer::drawFunction(), pPlotterLayer::drawPoints(), pPlotterLayer::drawSplineCurve(), pPlotterScaleY::Plot(), pPlotterScaleX::Plot(), pPlotterLayer::Plot(), and mpScaleY::Plot().
virtual bool mpLayer::HasBBox | ( | ) | [inline, virtual] |
Check whether this layer has a bounding box. The default implementation returns TRUE. Overide and return FALSE if your mpLayer implementation should be ignored by the calculation of the global bounding box for all layers in a mpWindow.
TRUE | Has bounding box | |
FALSE | Has not bounding box |
Reimplemented in mpScaleX, mpScaleY, pPlotterScaleX, and pPlotterScaleY.
Definition at line 110 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
virtual void mpLayer::Plot | ( | wxDC & | dc, | |
mpWindow & | w | |||
) | [pure virtual] |
Plot given view of layer to the given device context. An implementation of this function has to transform layer coordinates to wxDC coordinates based on the view parameters retrievable from the mpWindow passed in w. The passed device context dc has its coordinate origin set to the center of the visible area. The coordinate orientation is as show in the following picture:
+--------------------------------------------------+ | | | | | (wxDC origin 0,0) | | x-------------> acending X | | | | | | | | V ascending Y | +--------------------------------------------------+
Note that Y ascends in downward direction, whereas the usual vertical orientation for mathematical plots is vice versa. Thus Y-orientation will be swapped usually, when transforming between wxDC and mpLayer coordinates.
Rules for transformation between mpLayer and wxDC coordinates
dc_X = (layer_X - mpWindow::GetPosX()) * mpWindow::GetScaleX() dc_Y = (mpWindow::GetPosY() - layer_Y) * mpWindow::GetScaleY() // swapping Y-orientation layer_X = (dc_X / mpWindow::GetScaleX()) + mpWindow::GetPosX() // scale guaranted to be not 0 layer_Y = mpWindow::GetPosY() - (dc_Y / mpWindow::GetScaleY()) // swapping Y-orientation
dc | Device context to plot to. | |
w | View to plot. The visible area can be retrieved from this object. |
Implemented in mpFX, mpFY, mpFXY, mpScaleX, pPlotterLayer, pPlotterScaleX, and pPlotterScaleY.
void mpLayer::SetFont | ( | wxFont & | font | ) | [inline] |
Set layer font
font | Font, will be copied to internal class member |
Definition at line 190 of file mathplot.h.
00190 { m_font = font; }
void mpLayer::SetName | ( | wxString | name | ) | [inline] |
Set layer name
name | Name, will be copied to internal class member |
Definition at line 185 of file mathplot.h.
00185 { m_name = name; }
void mpLayer::SetPen | ( | wxPen & | pen | ) | [inline] |
Set layer pen
pen | Pen, will be copied to internal class member |
Definition at line 195 of file mathplot.h.
Referenced by HistogramWidget::drawHistogram(), Histogram::drawHistogram(), HistogramWidget::drawTransferenceFunction(), pPlotterWindow::onChangeColor(), pPlotterWindow::onLoad(), and pPlotterWindow::onStartDrawing().
00195 { m_pen = pen; }
wxFont mpLayer::m_font [protected] |
Layer's font.
Definition at line 206 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), pPlotterScaleX::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
wxString mpLayer::m_name [protected] |
Layer's name.
Definition at line 208 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
wxPen mpLayer::m_pen [protected] |
Layer's pen.
Definition at line 207 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), pPlotterScaleX::Plot(), pPlotterLayer::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().