TextPlotter.cxx

Go to the documentation of this file.
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 using namespace hippodraw;
00028 
00029 TextPlotter::TextPlotter ( )
00030   : PlotterBase ( "TextPlotter" )
00031 {
00032   m_datarep = new TextDataRep ( 0 );
00033   m_title = "none";
00034 }
00035 
00036 TextPlotter::TextPlotter ( const TextPlotter & plotter )
00037   : PlotterBase ( plotter )
00038 {
00039 }
00040 
00041 TextPlotter::~TextPlotter ()
00042 {
00043   if ( m_datarep != 0 ) delete m_datarep;
00044 }
00045 
00046 PlotterBase * TextPlotter::clone ()
00047 {
00048   return new TextPlotter ( *this );
00049 }
00050 
00051 /* virtual */
00052 void TextPlotter::addDataRep ( DataRep * rep )
00053 {
00054   TextDataRep * textrep = dynamic_cast < TextDataRep * > ( rep );
00055   assert ( textrep != 0 );
00056 
00057   m_datarep = textrep;
00058 }
00059 
00060 int TextPlotter::getNumDataReps () const
00061 {
00062   return 1;
00063 }
00064 
00065 DataRep * TextPlotter::getDataRep ( int ) const
00066 {
00067   return m_datarep;
00068 }
00069 
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 void TextPlotter::setRepresentation ( RepBase * rep )
00081 {
00082   m_datarep->setPointRep ( rep );
00083 }
00084 
00085 RepBase * TextPlotter::representation () const
00086 {
00087   return m_datarep->getRepresentation ();
00088 }
00089  
00091 void
00092 TextPlotter::
00093 setErrorDisplay ( hippodraw::Axes::Type, bool )
00094 {
00095   assert ( false );
00096 }
00097 
00099 bool
00100 TextPlotter::
00101 errorDisplay ( hippodraw::Axes::Type ) const
00102 {
00103   return false;
00104 }
00105 
00106 void TextPlotter::setAxisModel ( AxisModelBase *, hippodraw::Axes::Type )
00107 {
00108 }
00109 
00110 void TextPlotter::setRepColor ( const Color & color )
00111 {
00112   m_datarep->setRepColor ( color );
00113   notifyObservers ();
00114 }
00115 
00116 const Color & TextPlotter::repColor () const
00117 {
00118   return m_datarep->getRepColor();
00119 }
00120 
00121 float TextPlotter::userToMarginX ( double x ) const
00122 {
00123   return x;
00124 }
00125 
00126 float TextPlotter::userToMarginY ( double y ) const
00127 {
00128   return y;
00129 }
00130 
00131 float TextPlotter::userToInvertedMarginY ( double y ) const
00132 {
00133   return y;
00134 }
00135 
00136 void
00137 TextPlotter::
00138 toUserXY ( double mx, double my, bool, 
00139            double & ux, double & uy ) const
00140 {
00141   ux = mx;
00142   uy = my;
00143 }
00144 
00145 const DataRep * TextPlotter:: getParentDataRep () const
00146 {
00147   return m_datarep -> getParentDataRep ();
00148 }
00149 
00150 void TextPlotter:: setParentDataRep ( DataRep * rep )
00151 {
00152   m_datarep -> setParentDataRep ( rep );
00153   rep -> addObserver ( this );
00154 }
00155 
00156 void TextPlotter::willDelete ( const Observable * observable )
00157 {
00158    const DataRep * rep = dynamic_cast < const DataRep * > ( observable );
00159    if ( getParentDataRep() == rep ){
00160      m_datarep->setParentDataRep ( 0 );
00161    }
00162 }
00163 
00164 TransformBase * TextPlotter::getTransform ()
00165 {
00166   return 0;
00167 }
00168 
00170 NTuple *
00171 TextPlotter::
00172 createNTuple () const
00173 {
00174   return 0;
00175 }
00176 
00177 void
00178 TextPlotter::
00179 update ()
00180 {
00181   m_datarep -> update ();
00182 }
00183 
00184 bool
00185 TextPlotter::
00186 isTextPlotter () const
00187 {
00188   return true;
00189 }

Generated for HippoDraw Class Library by doxygen