1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 //----------------------------------------------------------------------------
27 // Class definition include
28 //----------------------------------------------------------------------------
29 #include "pPlotterScaleY.h"
31 // ----------------------------------------------------------------------------
32 // WX headers inclusion.
33 // For compilers that support precompilation, includes <wx/wx.h>.
34 // ----------------------------------------------------------------------------
40 //----------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------
44 #define mpLN10 2.3025850929940456840179914546844
46 IMPLEMENT_CLASS(pPlotterScaleY, pPlotterLayer)
47 //----------------------------------------------------------------------------
49 //----------------------------------------------------------------------------
50 pPlotterScaleY::pPlotterScaleY(wxString aName,int flags) {
53 SetFont(*wxSMALL_FONT);
54 SetPen(*wxGREY_PEN);*/
55 wxFont ff( *wxSMALL_FONT);
56 wxPen pp( *wxGREY_PEN);
61 void pPlotterScaleY::Plot(wxDC& dc, mpWindow& w)
70 float min= (float)w.getMinScrY();
71 float max=(float)w.getMaxScrY();
72 float scrY=(float)w.GetScrY()-50;
73 double scaleY=(scrY/(max-min))*w.getZoomFactor();
74 int offsetpy=w.getOffsetPixelsY();
75 int offsetY=w.getOffsetY();
81 // const int orgy = w.GetScrY()-40;
82 // dc.SetDeviceOrigin(70,orgy);
83 // dc.SetAxisOrientation(true,true); //EED MacOx ???
86 //dc.SetDeviceOrigin(70,orgy);
87 dc.SetDeviceOrigin(70,0);
88 double sizedc = dc.GetSize().GetY()-orgy;
89 //dc.SetAxisOrientation(true,false);
91 // const int extend = w.GetScrY()-50; //EED
94 dc.DrawLine( 0,GetYTranslated(sizedc, 0), 0, GetYTranslated(sizedc, (max-min)*scaleY));
107 float step=(max-min)/divisions;
110 //drawing the axe with the numbers
112 //drawing the first line
113 dc.DrawLine(0,GetYTranslated(sizedc, 0),-10,GetYTranslated(sizedc, 0));
114 s.Printf(_T("%d"),(int)(min));
115 dc.DrawText(s,(wxCoord)-20,GetYTranslated(sizedc, (wxCoord)0));
118 for(float i=0;i<=(max);i+=step)
121 int p=(i-min-offsetY)*scaleY+offsetpy;
124 dc.DrawLine(0,GetYTranslated(sizedc, p),-10,GetYTranslated(sizedc, p));
125 s.Printf(_T("%d"),(int)(i));
126 dc.DrawText(s,(wxCoord)-20,GetYTranslated(sizedc, (wxCoord)p));
129 //drawing the last line
130 int p=(max-min-offsetY)*scaleY+offsetpy;
131 dc.DrawLine(0,GetYTranslated(sizedc, p),-10,GetYTranslated(sizedc, p));
132 s.Printf(_T("%d"),(int)(max));
133 dc.DrawText(s,(wxCoord)-20,GetYTranslated(sizedc, (wxCoord)p));