00001 00012 // for truncation warning in debug mode 00013 #ifdef _MSC_VER 00014 #include "msdevstudio/MSconfig.h" 00015 #endif 00016 00017 #include "FunctionRep1.h" 00018 00019 #include "functions/FunctionBase.h" 00020 #include "projectors/ProjectorBase.h" 00021 00022 #include "reps/LineFunctionRep.h" 00023 00024 #include <cassert> 00025 00026 using namespace hippodraw; 00027 00028 FunctionRep1:: 00029 FunctionRep1 ( FunctionBase * function, DataRep * rep ) 00030 : FunctionRep ( function, rep ) 00031 { 00032 m_rep = new LineFunctionRep(); 00033 // The above deleted in ~DataRep() 00034 00035 const Color red ( Color::red ); 00036 m_rep->setColor ( red ); 00037 } 00038 00039 FunctionRep1:: 00040 FunctionRep1 ( const FunctionRep1 & rep ) 00041 : FunctionRep ( rep ) 00042 { 00043 } 00044 00045 FunctionRep1:: 00046 ~FunctionRep1 () 00047 { 00048 } 00049 00050 DataRep * FunctionRep1::clone () 00051 { 00052 return new FunctionRep1 ( *this ); 00053 } 00054 00055 bool 00056 FunctionRep1:: 00057 hasAxis ( hippodraw::Axes::Type axis ) const 00058 { 00059 return axis == Axes::X || axis == Axes::Y; 00060 } 00061 00062 void 00063 FunctionRep1:: 00064 drawProjectedValues ( TransformBase * transform, 00065 ViewBase * view ) 00066 { 00067 drawCuts ( transform, view ); 00068 00069 const Range & range = m_projector -> getRange ( Axes::X ); 00070 FunctionBase * function = getFunction (); 00071 LineFunctionRep * rep = dynamic_cast < LineFunctionRep * > ( m_rep ); 00072 assert ( rep != 0 ); 00073 00074 rep -> drawProjectedValues ( range, function, transform, view ); 00075 00076 setDirty ( false ); 00077 }