00001 00012 #ifdef HAVE_CONFIG_H 00013 #include "config.h" 00014 #endif 00015 00016 // for truncation warning 00017 #ifdef _MSC_VER 00018 #include "msdevstudio/MSconfig.h" 00019 #endif 00020 00021 #include "Cut2DPlotter.h" 00022 00023 #include "datareps/DataRep.h" 00024 #include "datasrcs/TupleCut.h" 00025 #include "reps/CutRangeRep.h" 00026 00027 #include <cassert> 00028 00029 using std::vector; 00030 00031 using namespace hippodraw; 00032 00033 Cut2DPlotter:: 00034 Cut2DPlotter ( ) 00035 : CutPlotter ( "Cut2DPlotter" ) 00036 { 00037 setEnableZ ( true ); 00038 } 00039 00040 Cut2DPlotter::Cut2DPlotter ( const Cut2DPlotter & plotter ) 00041 : CutPlotter ( plotter ) 00042 { 00043 setEnableZ ( true ); 00044 } 00045 00046 Cut2DPlotter::~Cut2DPlotter () 00047 { 00048 } 00049 00050 PlotterBase * Cut2DPlotter::clone() 00051 { 00052 return new Cut2DPlotter ( *this ); 00053 } 00054 00055 void 00056 Cut2DPlotter:: 00057 addDataRep ( DataRep * rep ) 00058 { 00059 XyPlotter::addDataRep ( rep ); 00060 m_datarep = rep; 00061 const vector < TupleCut > & cuts = rep -> getCuts (); 00062 vector < TupleCut > & cut_list 00063 = const_cast < vector < TupleCut > & > ( cuts ); 00064 cut_list.resize ( 2, TupleCut () ); 00065 00066 RepBase * cut_rep = new CutRangeRep (); 00067 m_datarep -> setCutRep ( cut_rep ); 00068 } 00069 00070 void Cut2DPlotter::setAxisBinding ( const std::string & axis, 00071 const std::string & label ) 00072 { 00073 assert ( axis == "X" || axis == "Y" ); 00074 00075 CutPlotter::setAxisBinding ( axis, label ); 00076 } 00077 00078 void Cut2DPlotter::setCutRangeFull ( ) 00079 { 00080 const Range & rangeX = getRange ( Axes::X, false ); 00081 m_datarep -> setCutRangeAt (rangeX, 0 ); 00082 00083 const Range & rangeY = getRange ( Axes::Y, false ); 00084 m_datarep -> setCutRangeAt ( rangeY, 1 ); 00085 00086 updateTargets (); 00087 } 00088 00089 void Cut2DPlotter::toggleInverted ( ) 00090 { 00091 m_datarep -> toggleInverted ( 0 ); 00092 m_datarep -> toggleInverted ( 1 ); 00093 00094 updateTargets (); 00095 }