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 "pPlotterScaleX.h"
31 // ----------------------------------------------------------------------------
32 // WX headers inclusion.
33 // For compilers that support precompilation, includes <wx/wx.h>.
34 // ----------------------------------------------------------------------------
40 //----------------------------------------------------------------------------
41 // Class implementation
42 //----------------------------------------------------------------------------
43 #define mpLN10 2.3025850929940456840179914546844
45 IMPLEMENT_CLASS(pPlotterScaleX, pPlotterLayer)
46 //----------------------------------------------------------------------------
48 //----------------------------------------------------------------------------
49 pPlotterScaleX::pPlotterScaleX(wxString aName,int flags)
52 SetFont(*wxSMALL_FONT);
53 SetPen(*wxGREY_PEN);*/
54 wxFont ff( *wxSMALL_FONT);
55 wxPen pp( *wxGREY_PEN);
60 void pPlotterScaleX::Plot(wxDC& dc, mpWindow& w)
72 float min=(float)w.getMinScrX();
73 float max=(float)w.getMaxScrX();
74 float scrX=(float)w.GetScrX()-100;
75 double scaleX=(scrX/(max-min))*w.getZoomFactor();
76 int offsetpx=w.getOffsetPixelsX();
77 int offsetX=w.getOffsetX();
82 //const int orgy = w.GetScrY()-40;
83 // dc.SetDeviceOrigin(70,orgy);
84 // dc.SetAxisOrientation(true,true); //EED MacOx ???
87 //dc.SetDeviceOrigin(70,orgy);
88 dc.SetDeviceOrigin(70,0);
89 //dc.SetAxisOrientation(true,false);
90 double sizedc = dc.GetSize().GetY()-orgy;
92 //const int extend = w.GetScrX()-100; //JPRx
96 dc.DrawLine(0,GetYTranslated(sizedc, 0),(max-min)*scaleX,GetYTranslated(sizedc, 0));
109 float step=(max-min)/divisions;
111 //drawing the axe with the numbers
115 //drawing the first line
116 dc.DrawLine(0,GetYTranslated(sizedc, 0),0,GetYTranslated(sizedc, -10));
117 s.Printf(_T("%d"),(int)(min));
118 dc.DrawText(s,(wxCoord)0,GetYTranslated(sizedc, (wxCoord)-20));
120 for(float i=0;i<=(max);i+=step)
123 int p=(i-min-offsetX)*scaleX+offsetpx;
126 dc.DrawLine(p,0,p,-10);
127 s.Printf(_T("%d"),(int)(i));
128 dc.DrawText(s,(wxCoord)p,GetYTranslated(sizedc, (wxCoord)-20));
131 //drawing the last line
132 int p=(max-min-offsetX)*scaleX+offsetpx;
133 dc.DrawLine(p,GetYTranslated(sizedc, 0),p,GetYTranslated(sizedc, -10));
134 s.Printf(_T("%d"),(int)(max));
135 dc.DrawText(s,(wxCoord)p,GetYTranslated(sizedc, (wxCoord)-20));