Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StripChartProjector.cxx

Go to the documentation of this file.
00001 
00012 // For truncation warning
00013 #ifdef _MSC_VER
00014 #include "msdevstudio/MSconfig.h"
00015 #endif
00016 
00017 #include "StripChartProjector.h"
00018 
00019 #include "datasrcs/DataPointTuple.h"
00020 #include "datasrcs/DataSource.h"
00021 
00022 #include <algorithm>
00023 
00024 #include <cassert>
00025 
00026 using std::distance;
00027 using std::min_element;
00028 using std::vector;
00029 
00030 StripChartProjector::StripChartProjector( )
00031   : Map2Projector()
00032 {
00033   addPointReps();
00034 }
00035 
00036 StripChartProjector::
00037 StripChartProjector ( const StripChartProjector & projector )
00038   : Map2Projector( projector )
00039 {
00040   addPointReps();
00041 }
00042 
00043 ProjectorBase * StripChartProjector::clone()
00044 {
00045   return new StripChartProjector ( *this );
00046 }
00047 
00048 void StripChartProjector::addPointReps()
00049 {
00050   m_pointreps.clear();
00051   m_pointreps.push_back ( "Line" );
00052   m_pointreps.push_back ( "Symbol" );
00053 }
00054 
00055 namespace dp = hippodraw::DataPoint2DTuple;
00056 
00057 void
00058 StripChartProjector::
00059 fillProjectedValues ( DataSource * ntuple, bool in_range ) const
00060 {
00061   ntuple -> clear();
00062 
00063   unsigned int x_col = m_columns[0];
00064   unsigned int y_col = m_columns[1];
00065   unsigned int x_err = m_columns[2];
00066   unsigned int y_err = m_columns[3];
00067 
00068   unsigned int min_row = m_ntuple -> indexOfMinElement ( x_col );
00069 
00070   unsigned int size = m_ntuple -> rows ();
00071 
00072   vector < double > row ( dp::SIZE );
00073   for ( unsigned int i = min_row; i < size; i++ ) {
00074 //     if ( acceptRow ( i ) == false ||
00075 //       ( in_range == true && inRange ( i ) == false ) ) continue;
00076     if ( acceptRow ( i ) == false ) continue;
00077 
00078     row[dp::X] = m_ntuple -> valueAt ( i, x_col );
00079     row[dp::Y] = m_ntuple -> valueAt ( i, y_col );
00080 
00081     double xe 
00082       = x_err < UINT_MAX ? m_ntuple -> valueAt ( i, x_err ) : 0.0;
00083     double ye 
00084       = y_err < UINT_MAX ? m_ntuple -> valueAt ( i, y_err ) : 0.0;
00085 
00086     row[dp::XERR] = xe;
00087     row[dp::YERR] = ye;
00088     ntuple -> addRow ( row );
00089   }
00090   for ( unsigned int i = 0; i < min_row; i++ ) {
00091     if ( acceptRow ( i ) == false ||
00092          inRange ( i ) == false ) continue;
00093 
00094     row[dp::X] = m_ntuple -> valueAt ( i, x_col );
00095     row[dp::Y] = m_ntuple -> valueAt ( i, y_col );
00096     double xe 
00097       = x_err < UINT_MAX ? m_ntuple -> valueAt ( i, x_err ) : 0.0;
00098     double ye 
00099       = y_err < UINT_MAX ? m_ntuple -> valueAt ( i, y_err ) : 0.0;
00100 
00101     row[dp::XERR] = xe;
00102     row[dp::YERR] = ye;
00103 
00104     ntuple -> addRow ( row );
00105   }
00106 }

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3