mpFXY Class Reference

#include <mathplot.h>

Inheritance diagram for mpFXY:
Inheritance graph
[legend]
Collaboration diagram for mpFXY:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mpFXY (wxString name=wxEmptyString, int flags=0x00)
virtual void Rewind ()=0
virtual bool GetNextXY (double &x, double &y)=0
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

int m_flags
 Holds label alignment.
wxFont m_font
 Layer's font.
wxPen m_pen
 Layer's pen.
wxString m_name
 Layer's name.

Detailed Description

Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y. Locus argument N is assumed to be in range 0 .. MAX_N, and implicitely derived by enumrating all locus values. Override mpFXY::Rewind and mpFXY::GetNextXY to implement a locus. Optionally implement a constructor and pass a name (label) and a label alignment to the constructor mpFXY::mpFXY. If the layer name is empty, no label will be plotted.

Definition at line 316 of file mathplot.h.


Constructor & Destructor Documentation

mpFXY::mpFXY ( wxString  name = wxEmptyString,
int  flags = 0x00 
)
Parameters:
name Label
flags Label alignment, pass one of mpALIGN_NE, mpALIGN_NW, mpALIGN_SW, mpALIGN_SE.

Definition at line 166 of file mathplot.cxx.

00167 { 
00168         SetName(name);
00169         m_flags = flags; 
00170 }


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

virtual bool mpFXY::GetNextXY ( double &  x,
double &  y 
) [pure virtual]

Get locus value for next N. Override this function in your implementation.

Parameters:
x Returns X value
y Returns Y value

Referenced by Plot().

Here is the caller graph for this function:

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

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().

00201                                                   {
00202                 return -y+sizey;
00203         }

Here is the caller graph for this function:

virtual bool mpLayer::HasBBox (  )  [inline, virtual, inherited]

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.

Return values:
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().

00110 { return TRUE; }

Here is the caller graph for this function:

void mpFXY::Plot ( wxDC &  dc,
mpWindow w 
) [virtual]

Layer plot handler. This implementation will plot the locus in the visible area and put a label according to the aligment specified.

Implements mpLayer.

Definition at line 172 of file mathplot.cxx.

References GetNextXY(), mpWindow::GetPosX(), mpWindow::GetPosY(), mpWindow::GetScaleX(), mpWindow::GetScaleY(), mpWindow::GetScrX(), mpWindow::GetScrY(), m_flags, mpLayer::m_font, mpLayer::m_name, mpLayer::m_pen, mpALIGN_NE, mpALIGN_NW, mpALIGN_SW, mpALIGNMASK, and Rewind().

00173 {
00174         dc.SetPen( m_pen);
00175 
00176         double x, y;
00177         Rewind();
00178 
00179         // for some reason DrawPoint does not use the current pen,
00180         // so we use DrawLine for fat pens
00181 
00182         if (m_pen.GetWidth() <= 1) 
00183         {
00184                 while (GetNextXY(x, y))
00185                 {
00186                         dc.DrawPoint( (wxCoord) ((x - w.GetPosX()) * w.GetScaleX()) ,
00187                                 (wxCoord) ((w.GetPosY() - y) * w.GetScaleY()) );
00188                 }
00189         }
00190         else
00191         {
00192                 while (GetNextXY(x, y))
00193                 {
00194                         wxCoord cx = (wxCoord) ((x - w.GetPosX()) * w.GetScaleX());
00195                         wxCoord cy = (wxCoord) ((w.GetPosY() - y) * w.GetScaleY());
00196                         dc.DrawLine(cx, cy, cx, cy);
00197                 }
00198         }
00199 
00200         if (!m_name.IsEmpty())
00201         {
00202                 dc.SetFont(m_font);
00203 
00204                 wxCoord tx, ty;
00205                 dc.GetTextExtent(m_name, &tx, &ty);
00206 
00207                 // xxx implement else ... if (!HasBBox())
00208                 {
00209                         const int sx = w.GetScrX()>>1;
00210                         const int sy = w.GetScrY()>>1;
00211 
00212                         if ((m_flags & mpALIGNMASK) == mpALIGN_NE)
00213                         {
00214                                 tx = sx - tx - 8;
00215                                 ty = -sy + 8;
00216                         }
00217                         else if ((m_flags & mpALIGNMASK) == mpALIGN_NW)
00218                         {
00219                                 tx = -sx + 8;
00220                                 ty = -sy + 8;
00221                         }
00222                         else if ((m_flags & mpALIGNMASK) == mpALIGN_SW)
00223                         {
00224                                 tx = -sx + 8;
00225                                 ty = sy - 8 - ty;
00226                         }
00227                         else
00228                         {
00229                                 tx = sx - tx - 8;
00230                                 ty = sy - 8 - ty;
00231                         }
00232                 }
00233                 //else
00234                 //{
00235                 //}
00236 
00237                 dc.DrawText( m_name, tx, ty);
00238         }
00239 }

Here is the call graph for this function:

virtual void mpFXY::Rewind (  )  [pure virtual]

Rewind value enumeration with mpFXY::GetNextXY. Override this function in your implementation.

Referenced by Plot().

Here is the caller 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

int mpFXY::m_flags [protected]

Holds label alignment.

Definition at line 343 of file mathplot.h.

Referenced by Plot().

wxFont mpLayer::m_font [protected, inherited]
wxString mpLayer::m_name [protected, inherited]

Layer's name.

Definition at line 208 of file mathplot.h.

Referenced by mpScaleY::Plot(), mpScaleX::Plot(), 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 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1