mpWindow Class Reference

#include <mathplot.h>

Inheritance diagram for mpWindow:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 mpWindow ()
 mpWindow (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int flags=0)
 ~mpWindow ()
wxMenu * GetPopupMenu ()
void setType (int t)
int getType ()
void setMaxScrX (int maxX)
void setMaxScrY (int maxY)
double getMaxScrX ()
double getMaxScrY ()
float getZoomFactor ()
void setMinScrX (int minX)
void setMinScrY (int minY)
double getMinScrX ()
double getMinScrY ()
int getClickedX ()
int getClickedY ()
int getOffsetPixelsX ()
int getOffsetPixelsY ()
void setOffsetPixelX (int offX)
void setOffsetPixelY (int offY)
int getOffsetX ()
int getOffsetY ()
void setOffsetX (int offX)
void setOffsetY (int offY)
void setRealGuideX (int newX_realGuide)
int getRealGuideX ()
void setRealGuideY (int newY_realGuide)
int getRealGuideY ()
bool drawGuideLines ()
bool AddLayer (mpLayer *layer)
void DelLayer (mpLayer *layer)
double GetScaleX (void) const
double GetScaleY (void) const
double GetPosX (void) const
double GetPosY (void) const
int GetScrX (void) const
int GetScrY (void) const
void SetScaleX (double scaleX)
void SetScaleY (double scaleY)
void SetPosX (double posX)
void SetPosY (double posY)
void SetPos (double posX, double posY)
void LockAspect (bool enable=TRUE)
bool IsAspectLocked ()
void Fit ()
void ZoomIn ()
void ZoomOut ()
void UpdateAll ()

Protected Member Functions

void Refresh (bool eraseBackground=true, const wxRect *rect=NULL)
void OnPaint (wxPaintEvent &event)
 Paint handler, will plot all attached layers.
void OnSize (wxSizeEvent &event)
 Size handler, will update scroll bar sizes.
void OnScroll2 (wxScrollWinEvent &event)
 Scroll handler, will move canvas.
void OnShowPopupMenu (wxMouseEvent &event)
 Mouse handler, will show context menu.
void OnCenter (wxCommandEvent &event)
 Context menu handler.
void OnFit (wxCommandEvent &event)
 Context menu handler.
void OnZoomIn (wxCommandEvent &event)
 Context menu handler.
void OnZoomOut (wxCommandEvent &event)
 Context menu handler.
void OnLockAspect (wxCommandEvent &event)
 Context menu handler.
bool UpdateBBox ()
 Recalculate global layer bounding box.

Protected Attributes

wxList m_layers
 List of attached plot layers.
wxMenu m_popmenu
 Canvas' context menu.
bool m_lockaspect
 Scale aspect is locked or not.
double m_minX
 Global layer bounding box, left border incl.
double m_maxX
 Global layer bounding box, right border incl.
double m_minY
 Global layer bounding box, bottom border incl.
double m_maxY
 Global layer bounding box, top border incl.
double m_scaleX
 Current view's X scale.
double m_scaleY
 Current view's Y scale.
double m_posX
 Current view's X position.
double m_posY
 Current view's Y position.
int m_scrX
 Current view's X dimension.
int m_scrY
 Current view's Y dimension.
int m_clickedX
 Last mouse click X position, for centering and zooming the view.
int m_clickedY
 Last mouse click Y position, for centering and zooming the view.
int maxScrX
int maxScrY
int minScrX
int minScrY
float zoomFactor
int offsetPixelX
int offsetPixelY
int offsetX
int offsetY
int real_guideLine_X
int real_guideLine_Y
bool drawGuides
int type

Private Attributes

wxBitmap * _bitmap_functions


Detailed Description

Canvas for plotting mpLayer implementations.

This class defines a zoomable and moveable 2D plot canvas. Any number of mpLayer implementations (scale rulers, function plots, ...) can be attached using mpWindow::AddLayer.

The canvas window provides a context menu with actions for navigating the view. The context menu can be retrieved with mpWindow::GetPopupMenu, e.g. for extending it externally.

Definition at line 425 of file mathplot.h.


Constructor & Destructor Documentation

mpWindow::mpWindow (  )  [inline]

Definition at line 428 of file mathplot.h.

00428 {}

mpWindow::mpWindow ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
int  flags = 0 
)

Definition at line 394 of file mathplot.cxx.

References mpID_LINE_GUIDES.

00395 : wxScrolledWindow( parent, id, pos, size, flag, wxT("wxPlotter") )
00396 {
00397         m_scaleX = m_scaleY = 1.0;
00398         m_posX   = m_posY   = 0;
00399         m_scrX   = m_scrY   = 64;
00400         m_minX   = m_minY   = 0;
00401         m_maxX   = m_maxY   = 0;
00402         maxScrX = maxScrY   = 200;
00403         minScrX = minScrY   = 0;
00404         m_clickedX =  0;
00405         m_clickedY = 5000;
00406         m_lockaspect = FALSE;
00407         offsetX = offsetY = 0;
00408         offsetPixelX = offsetPixelY= 0;
00409 
00410         real_guideLine_X = -1;
00411         real_guideLine_Y = -1;
00412         drawGuides = true;
00413         type=1;
00414 
00415         m_popmenu.Append( mpID_CENTER,     _("Center"),      _("Center plot view to this position"));
00416         m_popmenu.Append( mpID_FIT,        _("Fit"),         _("Set plot view to show all items"));
00417         m_popmenu.Append( mpID_ZOOM_IN,    _("Zoom in"),     _("Zoom in plot view."));
00418         m_popmenu.Append( mpID_ZOOM_OUT,   _("Zoom out"),    _("Zoom out plot view."));
00419         m_popmenu.AppendCheckItem( mpID_LOCKASPECT, _("Lock aspect"), _("Lock horizontal and vertical zoom aspect."));
00420 
00421         m_popmenu.AppendCheckItem( mpID_LINE_GUIDES, _("Turn off guide lines"), _("Enables/Disables the guide lines"));
00422 
00423         m_layers.DeleteContents(TRUE);
00424         SetBackgroundColour( *wxWHITE );
00425         EnableScrolling(FALSE, FALSE);
00426         SetSizeHints(128, 128);
00427         
00428         //_bitmap_functions= new wxBitmap(700,800);
00429 
00430         UpdateAll();
00431 }

mpWindow::~mpWindow (  ) 

Definition at line 433 of file mathplot.cxx.

00434 {
00435 }


Member Function Documentation

bool mpWindow::AddLayer ( mpLayer layer  ) 

Add a plot layer to the canvas.

Parameters:
layer Pointer to layer. The mpLayer object will get under control of mpWindow, i.e. it will be delete'd on mpWindow destruction
Return values:
TRUE Success
FALSE Failure due to out of memory.

Definition at line 542 of file mathplot.cxx.

References m_layers, and UpdateAll().

Referenced by pPlotterWindow::addFunction(), pPlotterWindow::onLoad(), and pPlotterWindow::onStartDrawing().

00543 {
00544         bool ret = m_layers.Append( layer) != NULL;
00545         UpdateAll();
00546         return ret;
00547 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mpWindow::DelLayer ( mpLayer layer  ) 

Remove a plot layer from the canvas.

Parameters:
layer Pointer to layer. The mpLayer object will be destructed using delete.

Definition at line 549 of file mathplot.cxx.

References m_layers, and UpdateAll().

Referenced by pPlotterWindow::onStartDrawing(), and pPlotterWindow::onStopDrawing().

00550 {
00551         m_layers.DeleteObject( layer);
00552         UpdateAll();
00553 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool mpWindow::drawGuideLines (  ) 

Reimplemented in pPlotterWindow.

Definition at line 744 of file mathplot.cxx.

References drawGuides.

Referenced by pPlotterLayer::drawLineToMousePoint().

00745         {
00746                 return drawGuides;
00747         }       

Here is the caller graph for this function:

void mpWindow::Fit (  ) 

Set view to fit global bounding box of all plot layers and refresh display. Scale and position will be set to a show all attached mpLayers. The X/Y scale aspect lock is taken into account.

Definition at line 437 of file mathplot.cxx.

References m_lockaspect, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, m_scaleY, UpdateAll(), and UpdateBBox().

Referenced by OnFit().

00438 {
00439         if (UpdateBBox())
00440         {
00441                 int cx, cy;
00442                 GetClientSize( &cx, &cy);
00443                 
00444                 double d;
00445                 d = m_maxX - m_minX;
00446                 if (d!=0)
00447                 {
00448                         m_scaleX = cx/d;
00449                         m_posX = m_minX + d/2;
00450                 }
00451                 d = m_maxY - m_minY;
00452                 if (d!=0)
00453                 {
00454                         m_scaleY = cy/d;
00455                         m_posY = m_minY + d/2;
00456                 }
00457 
00458                 if (m_lockaspect)
00459                 {
00460                         double s = (m_scaleX + m_scaleY)/2;
00461                         m_scaleX = s;
00462                         m_scaleY = s;
00463                 }
00464 
00465                 UpdateAll();
00466         }
00467 }

Here is the call graph for this function:

Here is the caller graph for this function:

int mpWindow::getClickedX (  )  [inline]

Get the x-clicked by the user

Returns:
m_clickedX

Definition at line 535 of file mathplot.h.

00536         {
00537                 return m_clickedX;
00538         }

int mpWindow::getClickedY (  )  [inline]

Get the y-clicked by the user

Returns:
m_clickedY

Definition at line 544 of file mathplot.h.

00545         {
00546                 return m_clickedY;
00547         }

double mpWindow::getMaxScrX (  )  [inline]

Get maximum value in x

Returns:
maxScrX

Definition at line 480 of file mathplot.h.

Referenced by pPlotter::onStartChange_Bar(), pPlotterScaleX::Plot(), and pPlotter::pPlotter().

00481         {
00482                 return maxScrX;
00483         }

Here is the caller graph for this function:

double mpWindow::getMaxScrY (  )  [inline]

Get maximum value in y

Returns:
maxScrY

Definition at line 487 of file mathplot.h.

Referenced by pPlotterScaleY::Plot().

00488         {
00489                 return maxScrY;
00490         }

Here is the caller graph for this function:

double mpWindow::getMinScrX (  )  [inline]

Get miniimum value in x

Returns:
minScrX

Definition at line 519 of file mathplot.h.

Referenced by pPlotter::onEndChange_Bar(), and pPlotterScaleX::Plot().

00520         {
00521                 return minScrX;
00522         }

Here is the caller graph for this function:

double mpWindow::getMinScrY (  )  [inline]

Get minimum value in y

Returns:
minScrY

Definition at line 526 of file mathplot.h.

Referenced by pPlotterScaleY::Plot().

00527         {
00528                 return minScrY;
00529         }

Here is the caller graph for this function:

int mpWindow::getOffsetPixelsX (  )  [inline]

Gets the x-offset of the zoom in pixels

Definition at line 553 of file mathplot.h.

Referenced by pPlotterScaleX::Plot().

00554         {
00555                 return offsetPixelX;
00556         }       

Here is the caller graph for this function:

int mpWindow::getOffsetPixelsY (  )  [inline]

Gets the offset of the zoom in pixels

Definition at line 562 of file mathplot.h.

Referenced by pPlotterScaleY::Plot().

00563         {
00564                 return offsetPixelY;
00565         }

Here is the caller graph for this function:

int mpWindow::getOffsetX (  )  [inline]

Gets the x-offset of the zoom

Definition at line 584 of file mathplot.h.

Referenced by pPlotterScaleX::Plot().

00585         {
00586                 return offsetX;
00587         }       

Here is the caller graph for this function:

int mpWindow::getOffsetY (  )  [inline]

Gets the offset of the zoom

Definition at line 592 of file mathplot.h.

Referenced by pPlotterScaleY::Plot().

00593         {
00594                 return offsetY;
00595         }

Here is the caller graph for this function:

wxMenu* mpWindow::GetPopupMenu (  )  [inline]

Get reference to context menu of the plot canvas.

Returns:
Pointer to menu. The menu can be modified.

Definition at line 438 of file mathplot.h.

00438 { return &m_popmenu; }

double mpWindow::GetPosX ( void   )  const [inline]

Get current view's X position. See rules for coordinate transformation

Returns:
X Position in layer coordinate system, that corresponds to the center point of the view.

Definition at line 708 of file mathplot.h.

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

00708 { return m_posX; }

Here is the caller graph for this function:

double mpWindow::GetPosY ( void   )  const [inline]

Get current view's Y position. See rules for coordinate transformation

Returns:
Y Position in layer coordinate system, that corresponds to the center point of the view.

Definition at line 714 of file mathplot.h.

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

00714 { return m_posY; }

Here is the caller graph for this function:

int mpWindow::getRealGuideX (  )  [inline]

Definition at line 626 of file mathplot.h.

Referenced by pPlotterLayer::Plot().

00627         {
00628                 return real_guideLine_X;
00629         }       

Here is the caller graph for this function:

int mpWindow::getRealGuideY (  )  [inline]

Definition at line 646 of file mathplot.h.

Referenced by pPlotterLayer::Plot().

00647         {
00648                 return real_guideLine_Y;
00649         }               

Here is the caller graph for this function:

double mpWindow::GetScaleX ( void   )  const [inline]

Get current view's X scale. See rules for coordinate transformation

Returns:
Scale

Definition at line 696 of file mathplot.h.

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

00696 { return m_scaleX; }

Here is the caller graph for this function:

double mpWindow::GetScaleY ( void   )  const [inline]

Get current view's Y scale. See rules for coordinate transformation

Returns:
Scale

Definition at line 702 of file mathplot.h.

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

00702 { return m_scaleY; }

Here is the caller graph for this function:

int mpWindow::GetScrX ( void   )  const [inline]

Get current view's X dimension in device context units. Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer implementations should rely on the value returned by the function. See rules for coordinate transformation

Returns:
X dimension.

Definition at line 722 of file mathplot.h.

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

00722 { return m_scrX; }

Here is the caller graph for this function:

int mpWindow::GetScrY ( void   )  const [inline]

Get current view's Y dimension in device context units. Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer implementations should rely on the value returned by the function. See rules for coordinate transformation

Returns:
Y dimension.

Definition at line 730 of file mathplot.h.

Referenced by pPlotterScaleY::Plot(), mpScaleY::Plot(), mpFXY::Plot(), and mpFY::Plot().

00730 { return m_scrY; }

Here is the caller graph for this function:

int mpWindow::getType (  )  [inline]

Definition at line 453 of file mathplot.h.

Referenced by pPlotter::update().

00454         {
00455                 return type;
00456         }

Here is the caller graph for this function:

float mpWindow::getZoomFactor (  )  [inline]

Definition at line 494 of file mathplot.h.

Referenced by pPlotterScaleY::Plot(), and pPlotterScaleX::Plot().

00495         {
00496                 return zoomFactor;
00497         }

Here is the caller graph for this function:

bool mpWindow::IsAspectLocked (  )  [inline]

Checks whether the X/Y scale aspect is locked.

Return values:
TRUE Locked
FALSE Unlocked

Definition at line 770 of file mathplot.h.

00770 { return m_lockaspect; }

void mpWindow::LockAspect ( bool  enable = TRUE  ) 

Enable or disable X/Y scale aspect locking for the view.

Note:
Explicit calls to mpWindow::SetScaleX and mpWindow::SetScaleY will set an unlocked apect, but any other action changing the view scale will lock the aspect again.

Definition at line 483 of file mathplot.cxx.

References m_lockaspect, m_popmenu, m_scaleX, m_scaleY, mpID_LOCKASPECT, and UpdateAll().

Referenced by OnLockAspect().

00484 {
00485         m_lockaspect = enable;
00486 
00487         m_popmenu.Check(mpID_LOCKASPECT, enable);
00488 
00489         if (m_lockaspect)
00490         {
00491                 double s = (m_scaleX + m_scaleY)/2;
00492                 m_scaleX = s;
00493                 m_scaleY = s;
00494         }
00495 
00496         UpdateAll();
00497 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mpWindow::OnCenter ( wxCommandEvent &  event  )  [protected]

Context menu handler.

Definition at line 516 of file mathplot.cxx.

References m_clickedX, m_clickedY, m_posX, m_posY, m_scaleX, m_scaleY, and SetPos().

00517 {
00518         int cx, cy;
00519         GetClientSize(&cx, &cy);
00520         SetPos( (double)(m_clickedX-cx/2) / m_scaleX + m_posX, (double)(cy/2-m_clickedY) / m_scaleY + m_posY);
00521 }

Here is the call graph for this function:

void mpWindow::OnFit ( wxCommandEvent &  event  )  [protected]

Context menu handler.

Definition at line 511 of file mathplot.cxx.

References Fit().

00512 {
00513         Fit();
00514 }

Here is the call graph for this function:

void mpWindow::OnLockAspect ( wxCommandEvent &  event  )  [protected]

Context menu handler.

Definition at line 506 of file mathplot.cxx.

References LockAspect(), m_popmenu, and mpID_LOCKASPECT.

00507 {
00508         LockAspect( !m_popmenu.IsChecked(mpID_LOCKASPECT) );
00509 }

Here is the call graph for this function:

void mpWindow::OnPaint ( wxPaintEvent &  event  )  [protected]

Paint handler, will plot all attached layers.

Definition at line 561 of file mathplot.cxx.

References _bitmap_functions, m_layers, m_scrX, and m_scrY.

00562 {
00563         wxPaintDC dc(this);
00564         dc.GetSize(&m_scrX, &m_scrY);
00565 printf("EED mpWindow::OnPaint %d %d\n",m_scrX,m_scrY);
00566 
00567         //m_scrX=200;
00568         //m_scrY=200;
00569 
00570         wxMemoryDC temp_dc;
00571         //_bitmap_functions->SetWidth(m_scrX);
00572         //_bitmap_functions->SetHeight(m_scrY);
00573         _bitmap_functions=new wxBitmap(m_scrX,m_scrY);
00574         temp_dc.SelectObject(*_bitmap_functions);
00575 
00576         // Background
00577         //      wxColour colourParent =  wxColour(255,0,0);
00578         temp_dc.SetBrush(wxBrush( *wxWHITE_BRUSH  ) );
00579         temp_dc.SetPen(wxPen( *wxBLACK_PEN  ));
00580         temp_dc.DrawRectangle(0,0,m_scrX,m_scrY);
00581         
00582 
00583         wxNode *node = m_layers.GetFirst();
00584         while (node)
00585         {
00586                 ((mpLayer*)node->GetData())->Plot( temp_dc, *this);
00587                 node = node->GetNext();
00588         }
00589         
00590         //dc.SetDeviceOrigin(70,40);
00591         //dc.SetAxisOrientation(false,true);
00592         temp_dc.SetAxisOrientation(true,false);
00593         
00594         //EED 14mai2009
00595         //dc.Blit(0,0, m_scrX, m_scrY, &temp_dc,-70,-m_scrY+40);
00596         
00597         temp_dc.SetDeviceOrigin(0,0);
00598         dc.Blit(0,0, m_scrX, m_scrY, &temp_dc,0,0);
00599         
00600         
00601         delete _bitmap_functions; 
00602         //_bitmap_functions
00603         //dc.SetAxisOrientation(false,true);
00604 
00605 
00606 }

void mpWindow::OnScroll2 ( wxScrollWinEvent &  event  )  [protected]

Scroll handler, will move canvas.

Definition at line 651 of file mathplot.cxx.

References GetScaleX(), GetScaleY(), m_maxY, m_minX, SetPosX(), and SetPosY().

00652 {
00653         int width, height;
00654         GetClientSize( &width, &height);
00655         int px, py;
00656         GetViewStart( &px, &py);
00657 
00658         if (event.GetOrientation() == wxHORIZONTAL)
00659         {
00660                 SetPosX( (double)px / GetScaleX() + m_minX + (double)(width>>1)/GetScaleX());
00661         }
00662         else
00663         {
00664                 SetPosY( m_maxY - (double)py / GetScaleY() - (double)(height>>1)/GetScaleY());
00665         }
00666         event.Skip();
00667 }

Here is the call graph for this function:

void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event  )  [protected]

Mouse handler, will show context menu.

Definition at line 499 of file mathplot.cxx.

References m_clickedX, m_clickedY, and m_popmenu.

00500 {
00501         m_clickedX = event.GetX();
00502         m_clickedY = event.GetY();
00503         PopupMenu( &m_popmenu, event.GetX(), event.GetY());
00504 }

void mpWindow::OnSize ( wxSizeEvent &  event  )  [protected]

Size handler, will update scroll bar sizes.

Definition at line 537 of file mathplot.cxx.

References UpdateAll().

00538 {
00539         UpdateAll();
00540 }

Here is the call graph for this function:

void mpWindow::OnZoomIn ( wxCommandEvent &  event  )  [protected]

Context menu handler.

Definition at line 523 of file mathplot.cxx.

References m_clickedX, m_clickedY, m_posX, m_posY, m_scaleX, m_scaleY, and ZoomIn().

00524 {
00525         int cx, cy;
00526         GetClientSize(&cx, &cy);
00527         m_posX = (double)(m_clickedX-cx/2) / m_scaleX + m_posX;
00528         m_posY = (double)(cy/2-m_clickedY) / m_scaleY + m_posY;
00529         ZoomIn();
00530 }

Here is the call graph for this function:

void mpWindow::OnZoomOut ( wxCommandEvent &  event  )  [protected]

Context menu handler.

Definition at line 532 of file mathplot.cxx.

References ZoomOut().

00533 {
00534         ZoomOut();
00535 }

Here is the call graph for this function:

void mpWindow::Refresh ( bool  eraseBackground = true,
const wxRect *  rect = NULL 
) [protected]

Definition at line 555 of file mathplot.cxx.

Referenced by UpdateAll().

00556 {
00557         wxScrolledWindow::Refresh(false);
00558 }

Here is the caller graph for this function:

void mpWindow::setMaxScrX ( int  maxX  )  [inline]

set the max value in the x axis

Parameters:
maxX 

Definition at line 463 of file mathplot.h.

Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), pPlotterWindow::onStartDrawing(), and pPlotterWindow::setActualScales().

00464         {
00465                 maxScrX=maxX;
00466         }

Here is the caller graph for this function:

void mpWindow::setMaxScrY ( int  maxY  )  [inline]

set the max value in the y axis

Parameters:
maxY 

Definition at line 471 of file mathplot.h.

Referenced by pPlotterWindow::onStartDrawing(), and pPlotterWindow::setActualScales().

00472         {
00473                 maxScrY=maxY;
00474         }

Here is the caller graph for this function:

void mpWindow::setMinScrX ( int  minX  )  [inline]

set the min value in the x axis

Parameters:
minX 

Definition at line 502 of file mathplot.h.

Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), and pPlotterWindow::setActualScales().

00503         {
00504                 minScrX=minX;
00505         }

Here is the caller graph for this function:

void mpWindow::setMinScrY ( int  minY  )  [inline]

set the min value in the y axis

Parameters:
minY 

Definition at line 510 of file mathplot.h.

Referenced by pPlotterWindow::setActualScales().

00511         {
00512                 minScrY=minY;
00513         }

Here is the caller graph for this function:

void mpWindow::setOffsetPixelX ( int  offX  )  [inline]

Set the x-offset of the zoom

Definition at line 569 of file mathplot.h.

Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().

00570         {
00571                 offsetPixelX=offX;
00572         }

Here is the caller graph for this function:

void mpWindow::setOffsetPixelY ( int  offY  )  [inline]

Set the y-offset of the zoom

Definition at line 576 of file mathplot.h.

Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().

00577         {
00578                 offsetPixelY=offY;
00579         }       

Here is the caller graph for this function:

void mpWindow::setOffsetX ( int  offX  )  [inline]

Set the x-offset of the zoom

Definition at line 599 of file mathplot.h.

Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().

00600         {
00601                 offsetX=offX;
00602         }

Here is the caller graph for this function:

void mpWindow::setOffsetY ( int  offY  )  [inline]

Set the y-offset of the zoom

Definition at line 606 of file mathplot.h.

Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().

00607         {
00608                 offsetY=offY;
00609         }       

Here is the caller graph for this function:

void mpWindow::SetPos ( double  posX,
double  posY 
) [inline]

Set current view's X and Y position and refresh display.

Parameters:
posX New position that corresponds to the center point of the view.
posY New position that corresponds to the center point of the view.

Definition at line 757 of file mathplot.h.

Referenced by OnCenter().

00757 { m_posX=posX; m_posY=posY; UpdateAll(); }

Here is the caller graph for this function:

void mpWindow::SetPosX ( double  posX  )  [inline]

Set current view's X position and refresh display.

Parameters:
posX New position that corresponds to the center point of the view.

Definition at line 746 of file mathplot.h.

Referenced by OnScroll2().

00746 { m_posX=posX; UpdateAll(); }

Here is the caller graph for this function:

void mpWindow::SetPosY ( double  posY  )  [inline]

Set current view's Y position and refresh display.

Parameters:
posY New position that corresponds to the center point of the view.

Definition at line 751 of file mathplot.h.

Referenced by OnScroll2().

00751 { m_posY=posY; UpdateAll(); }

Here is the caller graph for this function:

void mpWindow::setRealGuideX ( int  newX_realGuide  )  [inline]

Definition at line 615 of file mathplot.h.

Referenced by pPlotter::onActualChange_Bar(), pPlotter::onColorBar(), pPlotter::onMoved_ColorPoint(), and pPlotter::onSelectionEnd().

00616         {               
00617                 real_guideLine_X = newX_realGuide;      
00618                 if(real_guideLine_X!=-1)
00619                         UpdateAll();
00620         }

Here is the caller graph for this function:

void mpWindow::setRealGuideY ( int  newY_realGuide  )  [inline]

Definition at line 635 of file mathplot.h.

00636         {               
00637                 real_guideLine_Y = newY_realGuide;      
00638                 if(real_guideLine_Y!=-1)
00639                         UpdateAll();
00640         }

void mpWindow::SetScaleX ( double  scaleX  )  [inline]

Set current view's X scale and refresh display.

Parameters:
scaleX New scale, must not be 0.

Definition at line 736 of file mathplot.h.

Referenced by pPlotterLayer::Plot().

00736 { if (scaleX!=0) m_scaleX=scaleX; /*UpdateAll();*/ }

Here is the caller graph for this function:

void mpWindow::SetScaleY ( double  scaleY  )  [inline]

Set current view's Y scale and refresh display.

Parameters:
scaleY New scale, must not be 0.

Definition at line 741 of file mathplot.h.

Referenced by pPlotterLayer::Plot().

00741 { if (scaleY!=0) m_scaleY=scaleY; /*UpdateAll();*/ }

Here is the caller graph for this function:

void mpWindow::setType ( int  t  )  [inline]

Definition at line 446 of file mathplot.h.

Referenced by pPlotter::setType().

00447         {
00448                 type=t;
00449         }

Here is the caller graph for this function:

void mpWindow::UpdateAll (  ) 

Refresh display

Definition at line 699 of file mathplot.cxx.

References Refresh(), and UpdateBBox().

Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::addFunction(), pPlotterWindow::addFunctionToMove(), AddLayer(), DelLayer(), Fit(), LockAspect(), pPlotter::onActualChange_Bar(), pPlotterWindow::onAddNewPoint(), pPlotterWindow::onAddPoint(), pPlotterWindow::onChangeActual(), pPlotterWindow::onChangeColor(), pPlotter::onColorBar(), pPlotterWindow::onDeletePoint(), pPlotterWindow::OnGuideLines(), pPlotterWindow::onLine(), pPlotterWindow::onLoad(), pPlotterWindow::onMouseMove(), pPlotter::onMoved_ColorPoint(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), pPlotterWindow::onNoShowPoints(), pPlotter::onSelectionEnd(), pPlotterWindow::onShowPoints(), OnSize(), pPlotterWindow::onSplinePoints(), pPlotterWindow::onStopDrawing(), pPlotter::update(), ZoomIn(), and ZoomOut().

00700 {
00701         if (UpdateBBox())
00702         {
00703                 int cx, cy;
00704                 GetClientSize( &cx, &cy);
00705 printf("EED mpWindow::UpdateAll %d %d\n",cx,cy);
00706 
00707                 //const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx
00708                 //const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx
00709                 //const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx
00710                 //const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx
00711                 //SetScrollbars( 1, 1, sx, sy, px, py);
00712         }
00713 
00714         FitInside();
00715         Refresh( false );
00716 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool mpWindow::UpdateBBox (  )  [protected]

Recalculate global layer bounding box.

Definition at line 669 of file mathplot.cxx.

References mpLayer::GetMaxX(), mpLayer::GetMaxY(), mpLayer::GetMinX(), mpLayer::GetMinY(), mpLayer::HasBBox(), m_layers, m_maxX, m_maxY, m_minX, and m_minY.

Referenced by Fit(), and UpdateAll().

00670 {
00671         bool first = TRUE;
00672 
00673         wxNode *node = m_layers.GetFirst();
00674 
00675         while(node)
00676         {
00677                 mpLayer* f = (mpLayer*)node->GetData();
00678 
00679                 if (f->HasBBox())
00680                 {
00681                         if (first)
00682                         {
00683                                 first = FALSE;
00684                                 m_minX = f->GetMinX(); m_maxX=f->GetMaxX();
00685                                 m_minY = f->GetMinY(); m_maxY=f->GetMaxY();
00686                         }
00687                         else
00688                         {
00689                                 if (f->GetMinX()<m_minX) m_minX=f->GetMinX(); if (f->GetMaxX()>m_maxX) m_maxX=f->GetMaxX();
00690                                 if (f->GetMinY()<m_minY) m_minY=f->GetMinY(); if (f->GetMaxY()>m_maxY) m_maxY=f->GetMaxY();
00691                         }
00692                 }
00693                 node = node->GetNext();
00694         }
00695 
00696         return first == FALSE;
00697 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mpWindow::ZoomIn (  ) 

Zoom into current view and refresh display

Definition at line 469 of file mathplot.cxx.

References m_scaleX, m_scaleY, and UpdateAll().

Referenced by OnZoomIn().

00470 {
00471         m_scaleX = m_scaleX * 2;
00472         m_scaleY = m_scaleY * 2;
00473         UpdateAll();
00474 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mpWindow::ZoomOut (  ) 

Zoom out current view and refresh display

Definition at line 476 of file mathplot.cxx.

References m_scaleX, m_scaleY, and UpdateAll().

Referenced by OnZoomOut().

00477 {
00478         m_scaleX = m_scaleX / 2;
00479         m_scaleY = m_scaleY / 2;
00480         UpdateAll();
00481 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

wxBitmap* mpWindow::_bitmap_functions [private]

Definition at line 882 of file mathplot.h.

Referenced by OnPaint().

bool mpWindow::drawGuides [protected]

Definition at line 872 of file mathplot.h.

Referenced by drawGuideLines(), and pPlotterWindow::OnGuideLines().

int mpWindow::m_clickedX [protected]

Last mouse click X position, for centering and zooming the view.

Definition at line 817 of file mathplot.h.

Referenced by pPlotterWindow::onAddNewPoint(), OnCenter(), pPlotterWindow::onDeletePoint(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), OnShowPopupMenu(), and OnZoomIn().

int mpWindow::m_clickedY [protected]

Last mouse click Y position, for centering and zooming the view.

Definition at line 818 of file mathplot.h.

Referenced by pPlotterWindow::onAddNewPoint(), OnCenter(), pPlotterWindow::onDeletePoint(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), OnShowPopupMenu(), and OnZoomIn().

wxList mpWindow::m_layers [protected]

List of attached plot layers.

Definition at line 803 of file mathplot.h.

Referenced by AddLayer(), DelLayer(), OnPaint(), and UpdateBBox().

bool mpWindow::m_lockaspect [protected]

Scale aspect is locked or not.

Definition at line 805 of file mathplot.h.

Referenced by Fit(), and LockAspect().

double mpWindow::m_maxX [protected]

Global layer bounding box, right border incl.

Definition at line 808 of file mathplot.h.

Referenced by Fit(), and UpdateBBox().

double mpWindow::m_maxY [protected]

Global layer bounding box, top border incl.

Definition at line 810 of file mathplot.h.

Referenced by Fit(), OnScroll2(), and UpdateBBox().

double mpWindow::m_minX [protected]

Global layer bounding box, left border incl.

Definition at line 807 of file mathplot.h.

Referenced by Fit(), OnScroll2(), and UpdateBBox().

double mpWindow::m_minY [protected]

Global layer bounding box, bottom border incl.

Definition at line 809 of file mathplot.h.

Referenced by Fit(), and UpdateBBox().

wxMenu mpWindow::m_popmenu [protected]

double mpWindow::m_posX [protected]

Current view's X position.

Definition at line 813 of file mathplot.h.

Referenced by Fit(), OnCenter(), and OnZoomIn().

double mpWindow::m_posY [protected]

Current view's Y position.

Definition at line 814 of file mathplot.h.

Referenced by Fit(), OnCenter(), and OnZoomIn().

double mpWindow::m_scaleX [protected]

double mpWindow::m_scaleY [protected]

int mpWindow::m_scrX [protected]

int mpWindow::m_scrY [protected]

int mpWindow::maxScrX [protected]

int mpWindow::maxScrY [protected]

the max value in the y axis

Definition at line 831 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), and pPlotterWindow::onStartDrawing().

int mpWindow::minScrX [protected]

int mpWindow::minScrY [protected]

the min value in the y axis

Definition at line 840 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), and pPlotterWindow::onStartDrawing().

int mpWindow::offsetPixelX [protected]

offset in pixels where the user has clicked before changing the scale (in the actual function)

Definition at line 852 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint().

int mpWindow::offsetPixelY [protected]

Definition at line 853 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint().

int mpWindow::offsetX [protected]

Definition at line 857 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint().

int mpWindow::offsetY [protected]

Definition at line 858 of file mathplot.h.

Referenced by pPlotterWindow::getRealPoint().

int mpWindow::real_guideLine_X [protected]

Definition at line 863 of file mathplot.h.

int mpWindow::real_guideLine_Y [protected]

Definition at line 867 of file mathplot.h.

int mpWindow::type [protected]

float mpWindow::zoomFactor [protected]


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