#include <mathplot.h>
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 () |
int | GetYTranslated (wxSize size, double y) |
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 |
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 433 of file mathplot.h.
mpWindow::mpWindow | ( | ) | [inline] |
Definition at line 436 of file mathplot.h.
mpWindow::mpWindow | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
int | flags = 0 | |||
) |
Definition at line 396 of file mathplot.cxx.
References mpID_LINE_GUIDES.
00397 : wxScrolledWindow( parent, id, wxDefaultPosition, wxDefaultSize, flag, wxT("wxPlotter") ) 00398 { 00399 m_scaleX = m_scaleY = 1.0; 00400 m_posX = m_posY = 0; 00401 m_scrX = m_scrY = 64; 00402 m_minX = m_minY = 0; 00403 m_maxX = m_maxY = 0; 00404 maxScrX = maxScrY = 200; 00405 minScrX = minScrY = 0; 00406 m_clickedX = 0; 00407 m_clickedY = 5000; 00408 m_lockaspect = FALSE; 00409 offsetX = offsetY = 0; 00410 offsetPixelX = offsetPixelY= 0; 00411 _bitmap_functions=NULL; 00412 00413 real_guideLine_X = -1; 00414 real_guideLine_Y = -1; 00415 drawGuides = true; 00416 type=1; 00417 00418 m_popmenu.Append( mpID_CENTER, _("Center"), _("Center plot view to this position")); 00419 m_popmenu.Append( mpID_FIT, _("Fit"), _("Set plot view to show all items")); 00420 m_popmenu.Append( mpID_ZOOM_IN, _("Zoom in"), _("Zoom in plot view.")); 00421 m_popmenu.Append( mpID_ZOOM_OUT, _("Zoom out"), _("Zoom out plot view.")); 00422 m_popmenu.AppendCheckItem( mpID_LOCKASPECT, _("Lock aspect"), _("Lock horizontal and vertical zoom aspect.")); 00423 00424 m_popmenu.AppendCheckItem( mpID_LINE_GUIDES, _("Turn off guide lines"), _("Enables/Disables the guide lines")); 00425 00426 m_layers.DeleteContents(TRUE); 00427 SetBackgroundColour( *wxWHITE ); 00428 EnableScrolling(FALSE, FALSE); 00429 SetSizeHints(128, 128); 00430 00431 //_bitmap_functions= new wxBitmap(700,800); 00432 00433 UpdateAll(); 00434 }
mpWindow::~mpWindow | ( | ) |
Definition at line 436 of file mathplot.cxx.
bool mpWindow::AddLayer | ( | mpLayer * | layer | ) |
Add a plot layer to the canvas.
layer | Pointer to layer. The mpLayer object will get under control of mpWindow, i.e. it will be delete'd on mpWindow destruction |
TRUE | Success | |
FALSE | Failure due to out of memory. |
Definition at line 545 of file mathplot.cxx.
References m_layers, and UpdateAll().
Referenced by pPlotterWindow::addFunction(), pPlotterWindow::onLoad(), and pPlotterWindow::onStartDrawing().
00546 { 00547 bool ret = m_layers.Append( layer) != NULL; 00548 UpdateAll(); 00549 return ret; 00550 }
void mpWindow::DelLayer | ( | mpLayer * | layer | ) |
Remove a plot layer from the canvas.
layer | Pointer to layer. The mpLayer object will be destructed using delete. |
Definition at line 552 of file mathplot.cxx.
References m_layers, and UpdateAll().
Referenced by pPlotterWindow::onStartDrawing(), and pPlotterWindow::onStopDrawing().
bool mpWindow::drawGuideLines | ( | ) |
Reimplemented in pPlotterWindow.
Definition at line 747 of file mathplot.cxx.
References drawGuides.
Referenced by pPlotterLayer::drawLineToMousePoint().
00748 { 00749 return drawGuides; 00750 }
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 440 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().
00441 { 00442 if (UpdateBBox()) 00443 { 00444 int cx, cy; 00445 GetClientSize( &cx, &cy); 00446 00447 double d; 00448 d = m_maxX - m_minX; 00449 if (d!=0) 00450 { 00451 m_scaleX = cx/d; 00452 m_posX = m_minX + d/2; 00453 } 00454 d = m_maxY - m_minY; 00455 if (d!=0) 00456 { 00457 m_scaleY = cy/d; 00458 m_posY = m_minY + d/2; 00459 } 00460 00461 if (m_lockaspect) 00462 { 00463 double s = (m_scaleX + m_scaleY)/2; 00464 m_scaleX = s; 00465 m_scaleY = s; 00466 } 00467 00468 UpdateAll(); 00469 } 00470 }
int mpWindow::getClickedX | ( | ) | [inline] |
Get the x-clicked by the user
Definition at line 543 of file mathplot.h.
00544 { 00545 return m_clickedX; 00546 }
int mpWindow::getClickedY | ( | ) | [inline] |
Get the y-clicked by the user
Definition at line 552 of file mathplot.h.
00553 { 00554 return m_clickedY; 00555 }
double mpWindow::getMaxScrX | ( | ) | [inline] |
Get maximum value in x
Definition at line 488 of file mathplot.h.
Referenced by pPlotter::onStartChange_Bar(), pPlotterScaleX::Plot(), and pPlotter::pPlotter().
00489 { 00490 return maxScrX; 00491 }
double mpWindow::getMaxScrY | ( | ) | [inline] |
Get maximum value in y
Definition at line 495 of file mathplot.h.
Referenced by pPlotterScaleY::Plot().
00496 { 00497 return maxScrY; 00498 }
double mpWindow::getMinScrX | ( | ) | [inline] |
Get miniimum value in x
Definition at line 527 of file mathplot.h.
Referenced by pPlotter::onEndChange_Bar(), and pPlotterScaleX::Plot().
00528 { 00529 return minScrX; 00530 }
double mpWindow::getMinScrY | ( | ) | [inline] |
Get minimum value in y
Definition at line 534 of file mathplot.h.
Referenced by pPlotterScaleY::Plot().
00535 { 00536 return minScrY; 00537 }
int mpWindow::getOffsetPixelsX | ( | ) | [inline] |
Gets the x-offset of the zoom in pixels
Definition at line 561 of file mathplot.h.
Referenced by pPlotterScaleX::Plot().
00562 { 00563 return offsetPixelX; 00564 }
int mpWindow::getOffsetPixelsY | ( | ) | [inline] |
Gets the offset of the zoom in pixels
Definition at line 570 of file mathplot.h.
Referenced by pPlotterScaleY::Plot().
00571 { 00572 return offsetPixelY; 00573 }
int mpWindow::getOffsetX | ( | ) | [inline] |
Gets the x-offset of the zoom
Definition at line 592 of file mathplot.h.
Referenced by pPlotterScaleX::Plot().
00593 { 00594 return offsetX; 00595 }
int mpWindow::getOffsetY | ( | ) | [inline] |
Gets the offset of the zoom
Definition at line 600 of file mathplot.h.
Referenced by pPlotterScaleY::Plot().
00601 { 00602 return offsetY; 00603 }
wxMenu* mpWindow::GetPopupMenu | ( | ) | [inline] |
Get reference to context menu of the plot canvas.
Definition at line 446 of file mathplot.h.
00446 { return &m_popmenu; }
double mpWindow::GetPosX | ( | void | ) | const [inline] |
Get current view's X position. See rules for coordinate transformation
Definition at line 716 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
00716 { return m_posX; }
double mpWindow::GetPosY | ( | void | ) | const [inline] |
Get current view's Y position. See rules for coordinate transformation
Definition at line 722 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
00722 { return m_posY; }
int mpWindow::getRealGuideX | ( | ) | [inline] |
Definition at line 634 of file mathplot.h.
Referenced by pPlotterLayer::Plot().
00635 { 00636 return real_guideLine_X; 00637 }
int mpWindow::getRealGuideY | ( | ) | [inline] |
Definition at line 654 of file mathplot.h.
Referenced by pPlotterLayer::Plot().
00655 { 00656 return real_guideLine_Y; 00657 }
double mpWindow::GetScaleX | ( | void | ) | const [inline] |
Get current view's X scale. See rules for coordinate transformation
Definition at line 704 of file mathplot.h.
Referenced by OnScroll2(), mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
00704 { return m_scaleX; }
double mpWindow::GetScaleY | ( | void | ) | const [inline] |
Get current view's Y scale. See rules for coordinate transformation
Definition at line 710 of file mathplot.h.
Referenced by OnScroll2(), mpScaleY::Plot(), mpScaleX::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
00710 { return m_scaleY; }
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
Definition at line 730 of file mathplot.h.
Referenced by pPlotterScaleX::Plot(), mpScaleX::Plot(), mpFXY::Plot(), and mpFX::Plot().
00730 { return m_scrX; }
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
Definition at line 738 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), mpScaleY::Plot(), mpFXY::Plot(), and mpFY::Plot().
00738 { return m_scrY; }
int mpWindow::getType | ( | ) | [inline] |
Definition at line 461 of file mathplot.h.
Referenced by pPlotter::update().
00462 { 00463 return type; 00464 }
int mpWindow::GetYTranslated | ( | wxSize | size, | |
double | y | |||
) | [inline] |
Get the translation of the Y coordinate
Definition at line 798 of file mathplot.h.
float mpWindow::getZoomFactor | ( | ) | [inline] |
Definition at line 502 of file mathplot.h.
Referenced by pPlotterScaleY::Plot(), and pPlotterScaleX::Plot().
00503 { 00504 return zoomFactor; 00505 }
bool mpWindow::IsAspectLocked | ( | ) | [inline] |
Checks whether the X/Y scale aspect is locked.
TRUE | Locked | |
FALSE | Unlocked |
Definition at line 778 of file mathplot.h.
00778 { return m_lockaspect; }
void mpWindow::LockAspect | ( | bool | enable = TRUE |
) |
Enable or disable X/Y scale aspect locking for the view.
Definition at line 486 of file mathplot.cxx.
References m_lockaspect, m_popmenu, m_scaleX, m_scaleY, mpID_LOCKASPECT, and UpdateAll().
Referenced by OnLockAspect().
00487 { 00488 m_lockaspect = enable; 00489 00490 m_popmenu.Check(mpID_LOCKASPECT, enable); 00491 00492 if (m_lockaspect) 00493 { 00494 double s = (m_scaleX + m_scaleY)/2; 00495 m_scaleX = s; 00496 m_scaleY = s; 00497 } 00498 00499 UpdateAll(); 00500 }
void mpWindow::OnCenter | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
Definition at line 519 of file mathplot.cxx.
References m_clickedX, m_clickedY, m_posX, m_posY, m_scaleX, m_scaleY, and SetPos().
00520 { 00521 int cx, cy; 00522 GetClientSize(&cx, &cy); 00523 SetPos( (double)(m_clickedX-cx/2) / m_scaleX + m_posX, (double)(cy/2-m_clickedY) / m_scaleY + m_posY); 00524 }
void mpWindow::OnFit | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
Definition at line 514 of file mathplot.cxx.
References Fit().
00515 { 00516 Fit(); 00517 }
void mpWindow::OnLockAspect | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
Definition at line 509 of file mathplot.cxx.
References LockAspect(), m_popmenu, and mpID_LOCKASPECT.
00510 { 00511 LockAspect( !m_popmenu.IsChecked(mpID_LOCKASPECT) ); 00512 }
void mpWindow::OnPaint | ( | wxPaintEvent & | event | ) | [protected] |
Paint handler, will plot all attached layers.
Definition at line 564 of file mathplot.cxx.
References _bitmap_functions, m_layers, m_scrX, and m_scrY.
00565 { 00566 wxPaintDC dc(this); 00567 dc.GetSize(&m_scrX, &m_scrY); 00568 printf("EED mpWindow::OnPaint %d %d\n",m_scrX,m_scrY); 00569 00570 //m_scrX=200; 00571 //m_scrY=200; 00572 00573 wxMemoryDC temp_dc; 00574 //_bitmap_functions->SetWidth(m_scrX); 00575 //_bitmap_functions->SetHeight(m_scrY); 00576 _bitmap_functions=new wxBitmap(m_scrX,m_scrY); 00577 temp_dc.SelectObject(*_bitmap_functions); 00578 00579 // Background 00580 // wxColour colourParent = wxColour(255,0,0); 00581 temp_dc.SetBrush(wxBrush( *wxWHITE_BRUSH ) ); 00582 temp_dc.SetPen(wxPen( *wxBLACK_PEN )); 00583 temp_dc.DrawRectangle(0,0,m_scrX,m_scrY); 00584 00585 00586 wxNode *node = m_layers.GetFirst(); 00587 while (node) 00588 { 00589 ((mpLayer*)node->GetData())->Plot( temp_dc, *this); 00590 node = node->GetNext(); 00591 } 00592 00593 //dc.SetDeviceOrigin(70,40); 00594 //dc.SetAxisOrientation(false,true); 00595 //temp_dc.SetAxisOrientation(true,false); 00596 00597 //EED 14mai2009 00598 //dc.Blit(0,0, m_scrX, m_scrY, &temp_dc,-70,-m_scrY+40); 00599 00600 temp_dc.SetDeviceOrigin(0,0); 00601 dc.Blit(0,0, m_scrX, m_scrY, &temp_dc,0,0); 00602 00603 00604 delete _bitmap_functions; 00605 //_bitmap_functions 00606 //dc.SetAxisOrientation(false,true); 00607 00608 00609 }
void mpWindow::OnScroll2 | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll handler, will move canvas.
Definition at line 654 of file mathplot.cxx.
References GetScaleX(), GetScaleY(), m_maxY, m_minX, SetPosX(), and SetPosY().
00655 { 00656 int width, height; 00657 GetClientSize( &width, &height); 00658 int px, py; 00659 GetViewStart( &px, &py); 00660 00661 if (event.GetOrientation() == wxHORIZONTAL) 00662 { 00663 SetPosX( (double)px / GetScaleX() + m_minX + (double)(width>>1)/GetScaleX()); 00664 } 00665 else 00666 { 00667 SetPosY( m_maxY - (double)py / GetScaleY() - (double)(height>>1)/GetScaleY()); 00668 } 00669 event.Skip(); 00670 }
void mpWindow::OnShowPopupMenu | ( | wxMouseEvent & | event | ) | [protected] |
Mouse handler, will show context menu.
Definition at line 502 of file mathplot.cxx.
References m_clickedX, m_clickedY, and m_popmenu.
00503 { 00504 m_clickedX = event.GetX(); 00505 m_clickedY = event.GetY(); 00506 PopupMenu( &m_popmenu, event.GetX(), event.GetY()); 00507 }
void mpWindow::OnSize | ( | wxSizeEvent & | event | ) | [protected] |
Size handler, will update scroll bar sizes.
Definition at line 540 of file mathplot.cxx.
References UpdateAll().
00541 { 00542 UpdateAll(); 00543 }
void mpWindow::OnZoomIn | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
Definition at line 526 of file mathplot.cxx.
References m_clickedX, m_clickedY, m_posX, m_posY, m_scaleX, m_scaleY, and ZoomIn().
00527 { 00528 int cx, cy; 00529 GetClientSize(&cx, &cy); 00530 m_posX = (double)(m_clickedX-cx/2) / m_scaleX + m_posX; 00531 m_posY = (double)(cy/2-m_clickedY) / m_scaleY + m_posY; 00532 ZoomIn(); 00533 }
void mpWindow::OnZoomOut | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
Definition at line 535 of file mathplot.cxx.
References ZoomOut().
00536 { 00537 ZoomOut(); 00538 }
void mpWindow::Refresh | ( | bool | eraseBackground = true , |
|
const wxRect * | rect = NULL | |||
) | [protected] |
Definition at line 558 of file mathplot.cxx.
Referenced by UpdateAll().
00559 { 00560 wxScrolledWindow::Refresh(false); 00561 }
void mpWindow::setMaxScrX | ( | int | maxX | ) | [inline] |
set the max value in the x axis
maxX |
Definition at line 471 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), pPlotterWindow::onStartDrawing(), and pPlotterWindow::setActualScales().
00472 { 00473 maxScrX=maxX; 00474 }
void mpWindow::setMaxScrY | ( | int | maxY | ) | [inline] |
set the max value in the y axis
maxY |
Definition at line 479 of file mathplot.h.
Referenced by pPlotterWindow::onStartDrawing(), and pPlotterWindow::setActualScales().
00480 { 00481 maxScrY=maxY; 00482 }
void mpWindow::setMinScrX | ( | int | minX | ) | [inline] |
set the min value in the x axis
minX |
Definition at line 510 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), and pPlotterWindow::setActualScales().
00511 { 00512 minScrX=minX; 00513 }
void mpWindow::setMinScrY | ( | int | minY | ) | [inline] |
set the min value in the y axis
minY |
Definition at line 518 of file mathplot.h.
Referenced by pPlotterWindow::setActualScales().
00519 { 00520 minScrY=minY; 00521 }
void mpWindow::setOffsetPixelX | ( | int | offX | ) | [inline] |
Set the x-offset of the zoom
Definition at line 577 of file mathplot.h.
Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().
00578 { 00579 offsetPixelX=offX; 00580 }
void mpWindow::setOffsetPixelY | ( | int | offY | ) | [inline] |
Set the y-offset of the zoom
Definition at line 584 of file mathplot.h.
Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().
00585 { 00586 offsetPixelY=offY; 00587 }
void mpWindow::setOffsetX | ( | int | offX | ) | [inline] |
Set the x-offset of the zoom
Definition at line 607 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::moveFunctions(), pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().
00608 { 00609 offsetX=offX; 00610 }
void mpWindow::setOffsetY | ( | int | offY | ) | [inline] |
Set the y-offset of the zoom
Definition at line 614 of file mathplot.h.
Referenced by pPlotterWindow::onChangeActual(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), and pPlotterWindow::onStartDrawing().
00615 { 00616 offsetY=offY; 00617 }
void mpWindow::SetPos | ( | double | posX, | |
double | posY | |||
) | [inline] |
Set current view's X and Y position and refresh display.
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 765 of file mathplot.h.
Referenced by OnCenter().
void mpWindow::SetPosX | ( | double | posX | ) | [inline] |
Set current view's X position and refresh display.
posX | New position that corresponds to the center point of the view. |
Definition at line 754 of file mathplot.h.
Referenced by OnScroll2().
void mpWindow::SetPosY | ( | double | posY | ) | [inline] |
Set current view's Y position and refresh display.
posY | New position that corresponds to the center point of the view. |
Definition at line 759 of file mathplot.h.
Referenced by OnScroll2().
void mpWindow::setRealGuideX | ( | int | newX_realGuide | ) | [inline] |
Definition at line 623 of file mathplot.h.
Referenced by pPlotter::onActualChange_Bar(), pPlotter::onColorBar(), pPlotter::onMoved_ColorPoint(), and pPlotter::onSelectionEnd().
00624 { 00625 real_guideLine_X = newX_realGuide; 00626 if(real_guideLine_X!=-1) 00627 UpdateAll(); 00628 }
void mpWindow::setRealGuideY | ( | int | newY_realGuide | ) | [inline] |
Definition at line 643 of file mathplot.h.
00644 { 00645 real_guideLine_Y = newY_realGuide; 00646 if(real_guideLine_Y!=-1) 00647 UpdateAll(); 00648 }
void mpWindow::SetScaleX | ( | double | scaleX | ) | [inline] |
Set current view's X scale and refresh display.
scaleX | New scale, must not be 0. |
Definition at line 744 of file mathplot.h.
Referenced by pPlotterLayer::Plot().
00744 { if (scaleX!=0) m_scaleX=scaleX; /*UpdateAll();*/ }
void mpWindow::SetScaleY | ( | double | scaleY | ) | [inline] |
Set current view's Y scale and refresh display.
scaleY | New scale, must not be 0. |
Definition at line 749 of file mathplot.h.
Referenced by pPlotterLayer::Plot().
00749 { if (scaleY!=0) m_scaleY=scaleY; /*UpdateAll();*/ }
void mpWindow::setType | ( | int | t | ) | [inline] |
Definition at line 454 of file mathplot.h.
Referenced by pPlotter::setType().
00455 { 00456 type=t; 00457 }
void mpWindow::UpdateAll | ( | ) |
Refresh display
Definition at line 702 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().
00703 { 00704 if (UpdateBBox()) 00705 { 00706 int cx, cy; 00707 GetClientSize( &cx, &cy); 00708 printf("EED mpWindow::UpdateAll %d %d\n",cx,cy); 00709 00710 //const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx 00711 //const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx 00712 //const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx 00713 //const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx 00714 //SetScrollbars( 1, 1, sx, sy, px, py); 00715 } 00716 00717 FitInside(); 00718 Refresh( false ); 00719 }
bool mpWindow::UpdateBBox | ( | ) | [protected] |
Recalculate global layer bounding box.
Definition at line 672 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().
00673 { 00674 bool first = TRUE; 00675 00676 wxNode *node = m_layers.GetFirst(); 00677 00678 while(node) 00679 { 00680 mpLayer* f = (mpLayer*)node->GetData(); 00681 00682 if (f->HasBBox()) 00683 { 00684 if (first) 00685 { 00686 first = FALSE; 00687 m_minX = f->GetMinX(); m_maxX=f->GetMaxX(); 00688 m_minY = f->GetMinY(); m_maxY=f->GetMaxY(); 00689 } 00690 else 00691 { 00692 if (f->GetMinX()<m_minX) m_minX=f->GetMinX(); if (f->GetMaxX()>m_maxX) m_maxX=f->GetMaxX(); 00693 if (f->GetMinY()<m_minY) m_minY=f->GetMinY(); if (f->GetMaxY()>m_maxY) m_maxY=f->GetMaxY(); 00694 } 00695 } 00696 node = node->GetNext(); 00697 } 00698 00699 return first == FALSE; 00700 }
void mpWindow::ZoomIn | ( | ) |
Zoom into current view and refresh display
Definition at line 472 of file mathplot.cxx.
References m_scaleX, m_scaleY, and UpdateAll().
Referenced by OnZoomIn().
void mpWindow::ZoomOut | ( | ) |
Zoom out current view and refresh display
Definition at line 479 of file mathplot.cxx.
References m_scaleX, m_scaleY, and UpdateAll().
Referenced by OnZoomOut().
wxBitmap* mpWindow::_bitmap_functions [private] |
Definition at line 897 of file mathplot.h.
Referenced by OnPaint().
bool mpWindow::drawGuides [protected] |
Definition at line 887 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 832 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 833 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 818 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 820 of file mathplot.h.
Referenced by Fit(), and LockAspect().
double mpWindow::m_maxX [protected] |
Global layer bounding box, right border incl.
Definition at line 823 of file mathplot.h.
Referenced by Fit(), and UpdateBBox().
double mpWindow::m_maxY [protected] |
Global layer bounding box, top border incl.
Definition at line 825 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 822 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 824 of file mathplot.h.
Referenced by Fit(), and UpdateBBox().
wxMenu mpWindow::m_popmenu [protected] |
Canvas' context menu.
Definition at line 819 of file mathplot.h.
Referenced by pPlotterWindow::InitFunctionForVectors(), LockAspect(), pPlotterWindow::moveFunctions(), pPlotterWindow::onChangeActual(), pPlotterWindow::OnGuideLines(), pPlotterWindow::onLine(), pPlotterWindow::onLoad(), OnLockAspect(), pPlotterWindow::onMoveFunction(), pPlotterWindow::onNoShowPoints(), pPlotterWindow::onShowPoints(), OnShowPopupMenu(), pPlotterWindow::onSplinePoints(), pPlotterWindow::onStartDrawing(), pPlotterWindow::onStopDrawing(), and pPlotterWindow::setPopUpMenu().
double mpWindow::m_posX [protected] |
Current view's X position.
Definition at line 828 of file mathplot.h.
Referenced by Fit(), OnCenter(), and OnZoomIn().
double mpWindow::m_posY [protected] |
Current view's Y position.
Definition at line 829 of file mathplot.h.
Referenced by Fit(), OnCenter(), and OnZoomIn().
double mpWindow::m_scaleX [protected] |
Current view's X scale.
Definition at line 826 of file mathplot.h.
Referenced by Fit(), pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), LockAspect(), OnCenter(), OnZoomIn(), pPlotterWindow::setActualScales(), ZoomIn(), and ZoomOut().
double mpWindow::m_scaleY [protected] |
Current view's Y scale.
Definition at line 827 of file mathplot.h.
Referenced by Fit(), pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), LockAspect(), OnCenter(), OnZoomIn(), pPlotterWindow::setActualScales(), ZoomIn(), and ZoomOut().
int mpWindow::m_scrX [protected] |
Current view's X dimension.
Definition at line 830 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::InitFunctionForVectors(), pPlotterWindow::onChangeActual(), pPlotterWindow::onMouseMove(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), OnPaint(), and pPlotterWindow::setActualScales().
int mpWindow::m_scrY [protected] |
Current view's Y dimension.
Definition at line 831 of file mathplot.h.
Referenced by pPlotterWindow::InitFunctionForVectors(), pPlotterWindow::onAddNewPoint(), pPlotterWindow::onAddPoint(), pPlotterWindow::onChangeActual(), pPlotterWindow::onDeletePoint(), pPlotterWindow::onMouseMove(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), OnPaint(), and pPlotterWindow::setActualScales().
int mpWindow::maxScrX [protected] |
the max value in the x axis
Definition at line 841 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), and pPlotterWindow::onStartDrawing().
int mpWindow::maxScrY [protected] |
the max value in the y axis
Definition at line 846 of file mathplot.h.
Referenced by pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), and pPlotterWindow::onStartDrawing().
int mpWindow::minScrX [protected] |
the min value in the x axis
Definition at line 850 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::getRealPoint(), pPlotterWindow::InitFunctionForVectors(), and pPlotterWindow::onStartDrawing().
int mpWindow::minScrY [protected] |
the min value in the y axis
Definition at line 855 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 867 of file mathplot.h.
Referenced by pPlotterWindow::getRealPoint().
int mpWindow::offsetPixelY [protected] |
Definition at line 868 of file mathplot.h.
Referenced by pPlotterWindow::getRealPoint().
int mpWindow::offsetX [protected] |
Definition at line 872 of file mathplot.h.
Referenced by pPlotterWindow::getRealPoint().
int mpWindow::offsetY [protected] |
Definition at line 873 of file mathplot.h.
Referenced by pPlotterWindow::getRealPoint().
int mpWindow::real_guideLine_X [protected] |
Definition at line 878 of file mathplot.h.
int mpWindow::real_guideLine_Y [protected] |
Definition at line 882 of file mathplot.h.
int mpWindow::type [protected] |
Definition at line 893 of file mathplot.h.
Referenced by pPlotterWindow::InitFunctionForVectors(), pPlotterWindow::moveFunctions(), pPlotterWindow::onChangeActual(), and pPlotterWindow::onMouseMove().
float mpWindow::zoomFactor [protected] |
Definition at line 860 of file mathplot.h.
Referenced by pPlotterWindow::actualizeViewRange(), pPlotterWindow::onChangeActual(), pPlotterWindow::onLoad(), pPlotterWindow::onMyZoomIn(), pPlotterWindow::onMyZoomOut(), pPlotterWindow::onStartDrawing(), and pPlotterWindow::setActualScales().