#include <mathplot.h>
Public Member Functions | |
mpScaleX (wxString name=wxT("X")) | |
virtual void | Plot (wxDC &dc, mpWindow &w) |
virtual bool | HasBBox () |
virtual double | GetMinX () |
virtual double | GetMaxX () |
virtual double | GetMinY () |
virtual double | GetMaxY () |
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 implementing a x-scale ruler. The ruler is fixed at Y=0 in the coordinate system. A label is plottet at the bottom-right hand of the ruler. The scale numbering automatically adjusts to view and zoom factor.
Definition at line 362 of file mathplot.h.
mpScaleX::mpScaleX | ( | wxString | name = wxT("X") |
) |
name | Label to plot by the ruler |
Definition at line 249 of file mathplot.cxx.
const wxFont& mpLayer::GetFont | ( | ) | const [inline, inherited] |
Get font set for this layer.
Definition at line 175 of file mathplot.h.
00175 { return m_font; }
virtual double mpLayer::GetMaxX | ( | ) | [inline, virtual, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
Get inclusive bottom border of bounding box.
Definition at line 125 of file mathplot.h.
Referenced by mpWindow::UpdateBBox().
wxString mpLayer::GetName | ( | ) | const [inline, inherited] |
const wxPen& mpLayer::GetPen | ( | ) | const [inline, inherited] |
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, inherited] |
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 mpScaleX::HasBBox | ( | ) | [inline, virtual] |
Check whether this layer has a bounding box. This implementation returns FALSE thus making the ruler invisible to the plot layer bounding box calculation by mpWindow.
Reimplemented from mpLayer.
Definition at line 377 of file mathplot.h.
void mpScaleX::Plot | ( | wxDC & | dc, | |
mpWindow & | w | |||
) | [virtual] |
Layer plot handler. This implementation will plot the ruler adjusted to the visible area.
Implements mpLayer.
Definition at line 261 of file mathplot.cxx.
References mpWindow::GetPosX(), mpWindow::GetPosY(), mpWindow::GetScaleX(), mpWindow::GetScaleY(), mpWindow::GetScrX(), mpLayer::m_font, mpLayer::m_name, mpLayer::m_pen, and mpLN10.
00262 { 00263 dc.SetPen( m_pen); 00264 dc.SetFont( m_font); 00265 00266 const int orgy = (int)(w.GetPosY() * w.GetScaleY()); 00267 const int extend = w.GetScrX()/2; 00268 00269 dc.DrawLine( -extend, orgy, extend, orgy); 00270 00271 const double dig = floor( log( 128.0 / w.GetScaleX() ) / mpLN10 ); 00272 const double step = exp( mpLN10 * dig); 00273 const double end = w.GetPosX() + (double)extend / w.GetScaleX(); 00274 00275 wxCoord tx, ty; 00276 wxString s; 00277 wxString fmt; 00278 int tmp = (int)dig; 00279 if (tmp>=1) 00280 { 00281 fmt = wxT("%.f"); 00282 } 00283 else 00284 { 00285 tmp=8-tmp; 00286 fmt.Printf(wxT("%%.%df"), tmp >= -1 ? 2 : -tmp); 00287 } 00288 00289 double n = floor( (w.GetPosX() - (double)extend / w.GetScaleX()) / step ) * step ; 00290 00291 tmp=-65535; 00292 for (;n < end; n += step) 00293 { 00294 const int p = (int)((n - w.GetPosX()) * w.GetScaleX()); 00295 dc.DrawLine( p, orgy, p, orgy+4); 00296 00297 s.Printf(fmt, n); 00298 dc.GetTextExtent(s, &tx, &ty); 00299 if ((p-tx/2-tmp) > 64) 00300 { 00301 dc.DrawText( s, p-tx/2, orgy+4); 00302 tmp=p+tx/2; 00303 } 00304 } 00305 00306 dc.GetTextExtent(m_name, &tx, &ty); 00307 dc.DrawText( m_name, extend - tx - 4, orgy + 4 + ty); 00308 }
void mpLayer::SetFont | ( | wxFont & | font | ) | [inline, inherited] |
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, inherited] |
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, inherited] |
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, inherited] |
Layer's font.
Definition at line 206 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), pPlotterScaleX::Plot(), mpScaleY::Plot(), Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
wxString mpLayer::m_name [protected, inherited] |
Layer's name.
Definition at line 208 of file mathplot.h.
Referenced by mpScaleY::Plot(), Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
wxPen mpLayer::m_pen [protected, inherited] |
Layer's pen.
Definition at line 207 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), pPlotterScaleX::Plot(), pPlotterLayer::Plot(), mpScaleY::Plot(), Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().