00001 00012 #include "FuncParmRep.h" 00013 00014 #include "functions/FunctionBase.h" 00015 #include "graphics/ViewBase.h" 00016 #include "pattern/string_convert.h" 00017 #include "projectors/FunctionProjector.h" 00018 00019 using std::string; 00020 using std::vector; 00021 00022 using namespace hippodraw; 00023 00024 FuncParmRep::FuncParmRep ( ) 00025 : TextRepBase ( "Function Parameters" ) 00026 { 00027 } 00028 00029 FuncParmRep::FuncParmRep ( const FuncParmRep & rep ) 00030 : TextRepBase( rep ) 00031 { 00032 } 00033 00034 RepBase * FuncParmRep::clone () 00035 { 00036 return new FuncParmRep( *this ); 00037 } 00038 00039 void 00040 FuncParmRep:: 00041 drawProjectedValues ( ProjectorBase & proj, 00042 ViewBase & view ) 00043 { 00044 const FunctionProjector & projector 00045 = dynamic_cast< const FunctionProjector & > ( proj ); 00046 00047 FunctionBase * function = projector.function (); 00048 00049 string text = function -> name (); 00050 00051 const vector < string > & parm_names = function->parmNames (); 00052 const vector < double > & parm_values =function->getParameters (); 00053 00054 for ( unsigned int i = 0; i < parm_names.size (); i++ ) { 00055 text += "\n" + parm_names[i]; 00056 text += " = "; 00057 text += String::convert ( parm_values[i] ); 00058 } 00059 00060 view.drawText ( text, 5.0, 0., m_size, 0, 'l', 't', true, 0, & m_color ); 00061 }