FuncParmRep.cxx
Go to the documentation of this file.
1 
12 #include "FuncParmRep.h"
13 
14 #include "functions/FunctionBase.h"
15 #include "graphics/ViewBase.h"
16 #include "pattern/string_convert.h"
18 
19 using std::string;
20 using std::vector;
21 
22 using namespace hippodraw;
23 
25  : TextRepBase ( "Function Parameters" )
26 {
27 }
28 
30  : TextRepBase( rep )
31 {
32 }
33 
35 {
36  return new FuncParmRep( *this );
37 }
38 
39 void
42  ViewBase & view )
43 {
44  const FunctionProjector & projector
45  = dynamic_cast< const FunctionProjector & > ( proj );
46 
47  FunctionBase * function = projector.function ();
48 
49  string text = function -> name ();
50 
51  const vector < string > & parm_names = function->parmNames ();
52  const vector < double > & parm_values =function->getParameters ();
53 
54  for ( unsigned int i = 0; i < parm_names.size (); i++ ) {
55  text += "\n" + parm_names[i];
56  text += " = ";
57  text += String::convert ( parm_values[i] );
58  }
59 
60  view.drawText ( text, 5.0, 0., m_size, 0, 'l', 't', true, 0, & m_color );
61 }
unsigned int i
A base class for representations that draws a value as text.
Definition: TextRepBase.h:27
return rep
Definition: Inspector.cxx:3843
FuncParmRep()
The default constructor.
Definition: FuncParmRep.cxx:24
The namespace for conversion to string.
FuncParmRep class interface.
virtual RepBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
Definition: FuncParmRep.cxx:34
string convert(int i)
Converts an integer to a string.
Color m_color
The color of the representation.
Definition: RepBase.h:57
A Representation that draws the values of function parameters.
Definition: FuncParmRep.h:28
float m_size
The size of the representation.
Definition: RepBase.h:63
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
The abstract base class for views.
Definition: ViewBase.h:62
A function that can be added to a DataRep and used in a fitter.
Definition: FunctionBase.h:90
virtual void drawProjectedValues(ProjectorBase &projector, ViewBase &view)
Draws the values from the projector to the view.
Definition: FuncParmRep.cxx:41
hippodraw::FunctionProjector class interface
virtual void drawText(const std::string &s, float x, float y, float fontsize, float angle=0.0, char xp= 'l', char yp= 't', bool resize=false, const FontBase *font=0, const Color *color=0)=0
Draws a text string at a point in the view&#39;s coordinate system.
FunctionBase * function() const
Returns a pointer to the contained function.
const std::string & name() const
Returns the name of the representation.
Definition: RepBase.cxx:47
hippodraw::FunctionBase class interface
hippodraw::ViewBase class interface
The base class for the point representation hierarchy.
Definition: RepBase.h:45
A projector that plots one function.

Generated for HippoDraw Class Library by doxygen