VariableMesh.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 "VariableMesh.h"
18 
20 #include "reps/ColorBoxPointRep.h"
21 
22 using namespace hippodraw;
23 
24 using std::string;
25 using std::vector;
26 
27 
29  : DataRep ()
30 {
31  m_name = "Variable Mesh";
32 
33  MeshProjector * projector = new MeshProjector();
34  projector->setXErrorOption ( false ); // method not in ProjectorBase
35  projector->setYErrorOption ( false );
36  m_projector = projector;
37 
38  m_rep = new ColorBoxPointRep ( );
39 }
40 
42 {
43  return new VariableMesh( *this );
44 }
45 
51 void
54 {
55  DataRep::setPointRep ( rep );
56 
57  const vector < string > & bindings = m_projector -> getAxisBindings ();
58 
59  bool yes = bindings[3] != "nil";
60  setErrorDisplay ( Axes::X, yes );
61 
62  yes = bindings[4] != "nil";
63  setErrorDisplay ( Axes::Y, yes );
64 }
65 
67 {
68  return num == 2;
69 }
70 
71 bool
74 {
75  bool yes = true;
76 
77  const vector < string > & bindings = m_projector -> getAxisBindings ();
78 
79  // Was 2 and 3, should be a bug
80  yes = bindings[3] != "nil" || bindings[4] != "nil";
81 
82  return yes;
83 }
84 
85 
86 void
88 setAxisBinding ( const std::string & axis, const std::string & label )
89 {
90  DataRep::setAxisBinding ( axis, label );
91 
92  NTupleProjector * projector
93  = dynamic_cast < NTupleProjector * > ( m_projector );
94  unsigned int index = projector -> indexOfBindingOption ( axis );
95 
96  bool yes = label != "nil";
97  if ( index == 3 ) {
98  setErrorDisplay ( Axes::X, yes );
99  }
100 
101  if ( index == 4 ) {
102  setErrorDisplay ( Axes::Y, yes );
103  }
104 }
105 
106 void
108 setAxisBindings ( const std::vector < std::string > & new_bindings )
109 {
110  DataRep::setAxisBindings ( new_bindings );
111 
112  const vector < string > & bindings = m_projector ->getAxisBindings ();
113  bool yes = bindings[3] != "nil";
114  setErrorDisplay ( Axes::X, yes );
115 
116  yes = bindings[4] != "nil";
117  setErrorDisplay ( Axes::Y, yes );
118 }
119 
120 bool
123 {
124  return axis == Axes::X || axis == Axes::Y || axis == Axes::Z;
125 }
hippodraw::ColorBoxPointRep class interface
std::string m_name
The name of the display as it might be displayed in a GUI.
Definition: DataRep.h:76
A PointRep class that draws a colored box to represent the value.
bool acceptFunction(int num)
Returns true if the DataRep accepts functions on number variables.
virtual void setAxisBinding(const std::string &axis, const std::string &label)
Sets the axis binding.
Definition: DataRep.cxx:102
virtual void setAxisBindings(const std::vector< std::string > &bindings)
Sets the axis bindings.
Definition: DataRep.cxx:112
virtual void setPointRep(RepBase *pointrep)
Sets the representation of the data points.
Definition: DataRep.cxx:217
void setErrorDisplay(Axes::Type axis, bool)
Sets the display of error bar, if applicable, on the specified axis.
Definition: DataRep.cxx:186
virtual bool hasErrorDisplay() const
Returns true.
virtual DataRep * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
An NTupleProjector is a projector that projects data from an DataSource object.
virtual void setRepresentation(RepBase *point_rep)
Sets the point representation.
return rep
Definition: Inspector.cxx:3843
virtual const std::vector< std::string > & getAxisBindings() const
Returns the axis bindings.
RepBase * m_rep
The representation used for drawing each data point in the view.
Definition: DataRep.h:94
return yes
Definition: CanvasView.cxx:883
A derived class of NTupleProjector that maps 3 DataSource columns to a two dimensional mesh projectio...
Definition: MeshProjector.h:28
virtual void setAxisBinding(const std::string &axis, const std::string &label)
Sets the axis bindings.
virtual void setXErrorOption(bool enable)
Sets whether the X width options are to be enabled or not.
The base class for data representations.
Definition: DataRep.h:68
hippodraw::MeshProjector class interface
virtual void setAxisBindings(const std::vector< std::string > &bindings)
Sets the axis bindings.
ProjectorBase * m_projector
A projector used to transform data to projected values that will be plotted.
Definition: DataRep.h:90
virtual bool hasAxis(hippodraw::Axes::Type) const
Returns true if the data representation has specified axis type axis.
return index
Definition: PickTable.cxx:182
virtual void setYErrorOption(bool enable)
Sets whether the Y width options are to be enabled or not.
VariableMesh()
The default constructor.
Type
Axes constants.
Definition: AxesType.h:31
The base class for the point representation hierarchy.
Definition: RepBase.h:45
hippodraw::VariableMesh classes interface.

Generated for HippoDraw Class Library by doxygen