00001 00012 #ifdef HAVE_CONFIG_H 00013 #include "config.h" 00014 #else 00015 #ifdef _MSC_VER 00016 // include max() and min() missing from MicroSoft Visual C++ 00017 #include "msdevstudio/MSconfig.h" 00018 #endif //_MSC_VER 00019 #endif 00020 00021 #include "FuncChiRep.h" 00022 00023 #include "graphics/ViewBase.h" 00024 #include "projectors/FunctionProjector.h" 00025 00026 #ifdef SSTREAM_DEFECT 00027 #include <strstream> 00028 using std::ostrstream; 00029 #else 00030 #include <sstream> 00031 using std::ostringstream; 00032 #endif 00033 00034 using std::string; 00035 00036 FuncChiRep::FuncChiRep ( ) 00037 : TextRepBase ( "Chi-squared" ) 00038 { 00039 } 00040 00041 FuncChiRep::FuncChiRep ( const FuncChiRep & rep ) 00042 : TextRepBase( rep ) 00043 { 00044 } 00045 00046 /* virtual */ 00047 RepBase * FuncChiRep::clone () 00048 { 00049 return new FuncChiRep ( *this ); 00050 } 00051 00052 void 00053 FuncChiRep:: 00054 drawProjectedValues ( ProjectorBase & proj, 00055 ViewBase & view ) 00056 { 00057 const FunctionProjector & projector 00058 = dynamic_cast< const FunctionProjector & > ( proj ); 00059 00060 int dof = projector.degreesOfFreedom (); 00061 double value = projector.objectiveValue () / dof; 00062 00063 #ifdef SSTREAM_DEFECT 00064 ostrstream strm_text; 00065 #else 00066 ostringstream strm_text; 00067 #endif 00068 00069 strm_text << "Chi-Squared per d.f. = " << value << std::ends; 00070 00071 string str_text ( strm_text.str () ); 00072 00073 view.drawText ( str_text, 5.0, 0.0, m_size, 0, 'l', 't', true ); 00074 }