XYPlot.cxx
Go to the documentation of this file.
1 
12 // for truncation warning in debug mode
13 #ifdef _MSC_VER
14 #include "msdevstudio/MSconfig.h"
15 #endif
16 
17 #include "XYPlot.h"
18 
20 #include "reps/SymbolPointRep.h"
21 
22 using namespace hippodraw;
23 
24 using std::string;
25 using std::vector;
26 
27 
29 {
30  m_name = "XY Plot";
31 
32  Map2Projector * projector = new Map2Projector();
33  projector->setXErrorOption ( true ); // method not in ProjectorBase
34  projector->setYErrorOption ( true );
35  m_projector = projector;
36 
38 }
39 
41 {
42  return new XYPlot( *this );
43 }
44 
50 void
53 {
54  DataRep::setPointRep ( rep );
55  if ( rep -> name () == "Symbol" ) {
56  rep -> setSize ( 4.0 );
57  const vector < string > & bindings = m_projector -> getAxisBindings ();
58 
59  bool yes = bindings[2] != "nil";
60  setErrorDisplay ( Axes::X, yes );
61 
62  yes = bindings[3] != "nil";
63  setErrorDisplay ( Axes::Y, yes );
64  }
65 }
66 
67 bool XYPlot::acceptFunction ( int num )
68 {
69  return num == 1;
70 }
71 
72 bool
75 {
76  bool yes = true;
77 
78  if ( m_rep -> name () == "Symbol" ) {
79  const vector < string > & bindings = m_projector -> getAxisBindings ();
80 
81  yes = bindings[2] != "nil" || bindings[3] != "nil";
82  }
83 
84  return yes;
85 }
86 
87 
88 void
90 setAxisBinding ( const std::string & axis, const std::string & label )
91 {
92  DataRep::setAxisBinding ( axis, label );
93 
94  NTupleProjector * projector
95  = dynamic_cast < NTupleProjector * > ( m_projector );
96  unsigned int index = projector -> indexOfBindingOption ( axis );
97 
98  bool yes = label != "nil";
99  if ( index == 2 ) {
100  setErrorDisplay ( Axes::X, yes );
101  }
102 
103  if ( index == 3 ) {
104  setErrorDisplay ( Axes::Y, yes );
105  }
106 }
107 
108 void
109 XYPlot::
110 setAxisBindings ( const std::vector < std::string > & new_bindings )
111 {
112  DataRep::setAxisBindings ( new_bindings );
113 
114  const vector < string > & bindings = m_projector ->getAxisBindings ();
115  bool yes = bindings[2] != "nil";
116  setErrorDisplay ( Axes::X, yes );
117 
118  yes = bindings[3] != "nil";
119  setErrorDisplay ( Axes::Y, yes );
120 }
121 
122 bool
123 XYPlot::
125 {
126  return axis == Axes::X || axis == Axes::Y;
127 }
128 
129 bool
130 XYPlot::
131 hasZoomY ( ) const
132 {
133  return true;
134 }

Generated for HippoDraw Class Library by doxygen