00001 00012 // for truncation warning in debug mode 00013 #ifdef _MSC_VER 00014 #include "msdevstudio/MSconfig.h" 00015 #endif 00016 00017 #include "TextPlotter.h" 00018 00019 #include "datareps/TextDataRep.h" 00020 00021 #include <cassert> 00022 00023 using std::list; 00024 using std::swap; 00025 using std::string; 00026 00027 TextPlotter::TextPlotter ( ) 00028 : PlotterBase ( "TextPlotter" ) 00029 { 00030 m_datarep = new TextDataRep ( 0 ); 00031 m_title = "none"; 00032 } 00033 00034 TextPlotter::TextPlotter ( const TextPlotter & plotter ) 00035 : PlotterBase ( plotter ) 00036 { 00037 } 00038 00039 TextPlotter::~TextPlotter () 00040 { 00041 if ( m_datarep != 0 ) delete m_datarep; 00042 } 00043 00044 PlotterBase * TextPlotter::clone () 00045 { 00046 return new TextPlotter ( *this ); 00047 } 00048 00049 /* virtual */ 00050 void TextPlotter::addDataRep ( DataRep * rep ) 00051 { 00052 TextDataRep * textrep = dynamic_cast < TextDataRep * > ( rep ); 00053 assert ( textrep != 0 ); 00054 00055 m_datarep = textrep; 00056 } 00057 00058 /* virtual */ 00059 int TextPlotter::getNumDataReps () const 00060 { 00061 return 1; 00062 } 00063 00064 DataRep * TextPlotter::getDataRep ( int index ) const 00065 { 00066 return m_datarep; 00067 } 00068 00069 /* virtual */ 00070 void TextPlotter::drawIn ( ViewBase * view ) 00071 { 00072 m_datarep->drawProjectedValues ( 0, view ); 00073 } 00074 00075 bool TextPlotter::hasNTupleBindings () const 00076 { 00077 return false; 00078 } 00079 00080 /* virtual */ 00081 void TextPlotter::setRepresentation ( RepBase * rep ) 00082 { 00083 m_datarep->setRepresentation ( rep ); 00084 } 00085 00086 /* virtual */ 00087 RepBase * TextPlotter::representation () const 00088 { 00089 return m_datarep->getRepresentation (); 00090 } 00091 00092 /* virtual */ 00094 void TextPlotter::setErrorDisplay ( hippodraw::Axes::Type axis, bool ) 00095 { 00096 assert ( false ); 00097 } 00098 00100 bool TextPlotter::errorDisplay ( hippodraw::Axes::Type axis ) const 00101 { 00102 return false; 00103 } 00104 00105 void TextPlotter::setAxisModel ( AxisModelBase *, hippodraw::Axes::Type ) 00106 { 00107 } 00108 void TextPlotter::setRepColor ( const Color & color ) 00109 { 00110 m_datarep->setRepColor ( color ); 00111 } 00112 00113 const Color & TextPlotter::repColor () const 00114 { 00115 return m_datarep->getRepColor(); 00116 } 00117 00118 float TextPlotter::userToMarginX ( double x ) const 00119 { 00120 return x; 00121 } 00122 00123 float TextPlotter::userToMarginY ( double y ) const 00124 { 00125 return y; 00126 } 00127 00128 float TextPlotter::userToInvertedMarginY ( double y ) const 00129 { 00130 return y; 00131 } 00132 00133 void 00134 TextPlotter:: 00135 marginToUserXY ( double mx, double my, bool, 00136 double & ux, double & uy ) const 00137 { 00138 ux = mx; 00139 uy = my; 00140 } 00141 00142 const DataRep * TextPlotter:: getParentDataRep () const 00143 { 00144 return m_datarep -> getParentDataRep (); 00145 } 00146 00147 void TextPlotter:: setParentDataRep ( DataRep * rep ) 00148 { 00149 m_datarep -> setParentDataRep ( rep ); 00150 rep -> addObserver ( this ); 00151 } 00152 00153 void TextPlotter::willDelete ( const Observable * observable ) 00154 { 00155 const DataRep * rep = dynamic_cast < const DataRep * > ( observable ); 00156 if ( getParentDataRep() == rep ){ 00157 m_datarep->setParentDataRep ( 0 ); 00158 } 00159 } 00160 00161 TransformBase * TextPlotter::getTransform () 00162 { 00163 return 0; 00164 } 00165 00167 NTuple * 00168 TextPlotter:: 00169 createNTuple () const 00170 { 00171 return 0; 00172 } 00173 00174 void 00175 TextPlotter:: 00176 update () 00177 { 00178 m_datarep -> update (); 00179 }