mpScaleY Class Reference

#include <mathplot.h>

Inheritance diagram for mpScaleY:

Inheritance graph
[legend]
Collaboration diagram for mpScaleY:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 mpScaleY (wxString name=wxT("Y"))
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)

Protected Attributes

wxFont m_font
 Layer's font.
wxPen m_pen
 Layer's pen.
wxString m_name
 Layer's name.


Detailed Description

Plot layer implementing a y-scale ruler. The ruler is fixed at X=0 in the coordinate system. A label is plottet at the top-right hand of the ruler. The scale numbering automatically adjusts to view and zoom factor.

Definition at line 379 of file mathplot.h.


Constructor & Destructor Documentation

mpScaleY::mpScaleY ( wxString  name = wxT("Y")  ) 

Parameters:
name Label to plot by the ruler

Definition at line 312 of file mathplot.cxx.

00313 { 
00314         SetName(name);/*
00315         SetFont(*wxSMALL_FONT);
00316         SetPen(*wxGREY_PEN);*/
00317         wxFont ff( *wxSMALL_FONT);
00318         wxPen pp( *wxGREY_PEN);
00319         SetPen( pp );
00320         SetFont( ff );
00321 }


Member Function Documentation

const wxFont& mpLayer::GetFont (  )  const [inline, inherited]

Get font set for this layer.

Returns:
Font

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.

Returns:
Value

Definition at line 120 of file mathplot.h.

Referenced by mpWindow::UpdateBBox().

00120 { return  1.0; }

Here is the caller graph for this function:

virtual double mpLayer::GetMaxY (  )  [inline, virtual, inherited]

Get inclusive top border of bounding box.

Returns:
Value

Definition at line 130 of file mathplot.h.

Referenced by mpWindow::UpdateBBox().

00130 { return  1.0; }

Here is the caller graph for this function:

virtual double mpLayer::GetMinX (  )  [inline, virtual, inherited]

Get inclusive left border of bounding box.

Returns:
Value

Definition at line 115 of file mathplot.h.

Referenced by mpWindow::UpdateBBox().

00115 { return -1.0; }

Here is the caller graph for this function:

virtual double mpLayer::GetMinY (  )  [inline, virtual, inherited]

Get inclusive bottom border of bounding box.

Returns:
Value

Definition at line 125 of file mathplot.h.

Referenced by mpWindow::UpdateBBox().

00125 { return -1.0; }

Here is the caller graph for this function:

wxString mpLayer::GetName (  )  const [inline, inherited]

Get layer name.

Returns:
Name

Definition at line 170 of file mathplot.h.

00170 { return m_name; }

const wxPen& mpLayer::GetPen (  )  const [inline, inherited]

Get pen set for this layer.

Returns:
Pen

Definition at line 180 of file mathplot.h.

00180 { return m_pen;  }

virtual bool mpScaleY::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 394 of file mathplot.h.

00394 { return FALSE; }

void mpScaleY::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 323 of file mathplot.cxx.

References mpWindow::GetPosX(), mpWindow::GetPosY(), mpWindow::GetScaleX(), mpWindow::GetScaleY(), mpWindow::GetScrY(), mpLayer::m_font, mpLayer::m_name, mpLayer::m_pen, and mpLN10.

00324 {
00325         dc.SetPen( m_pen);
00326         dc.SetFont( m_font);
00327 
00328         const int orgx   = -(int)(w.GetPosX() * w.GetScaleX());
00329         const int extend = w.GetScrY()/2;
00330 
00331         dc.DrawLine( orgx, -extend, orgx, extend);
00332 
00333         const double dig  = floor( log( 128.0 / w.GetScaleY() ) / mpLN10 );
00334         const double step = exp( mpLN10 * dig);
00335         const double end  = w.GetPosY() + (double)extend / w.GetScaleY();
00336 
00337         wxCoord tx, ty;
00338         wxString s;
00339         wxString fmt;
00340         int tmp = (int)dig;
00341         if (tmp>=1)
00342         {
00343                 fmt = wxT("%.f");
00344         }
00345         else
00346         {
00347                 tmp=8-tmp;
00348                 fmt.Printf(wxT("%%.%df"), tmp >= -1 ? 2 : -tmp);
00349         }
00350 
00351         double n = floor( (w.GetPosY() - (double)extend / w.GetScaleY()) / step ) * step ;
00352 
00353         tmp=65536;
00354         for (;n < end; n += step)
00355         {
00356                 const int p = (int)((w.GetPosY() - n) * w.GetScaleY());
00357                 dc.DrawLine( orgx, p, orgx+4, p);
00358 
00359                 s.Printf(fmt, n);
00360                 dc.GetTextExtent(s, &tx, &ty);
00361                 if ((tmp-p+ty/2) > 32)
00362                 {
00363                         dc.DrawText( s, orgx+4, p-ty/2);
00364                         tmp=p-ty/2;
00365                 }
00366         }
00367 
00368         dc.GetTextExtent(m_name, &tx, &ty);
00369         dc.DrawText( m_name, orgx-tx-4, -extend + ty + 4);
00370 }

Here is the call graph for this function:

void mpLayer::SetFont ( wxFont &  font  )  [inline, inherited]

Set layer font

Parameters:
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

Parameters:
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

Parameters:
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;  }

Here is the caller graph for this function:


Member Data Documentation

wxFont mpLayer::m_font [protected, inherited]

wxString mpLayer::m_name [protected, inherited]

Layer's name.

Definition at line 200 of file mathplot.h.

Referenced by Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().

wxPen mpLayer::m_pen [protected, inherited]


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

Generated on Fri Jun 12 00:08:46 2009 for creaMaracasVisu by  doxygen 1.5.7.1