RepBase.cxx
Go to the documentation of this file.
1 
11 // for dll interface warning
12 #ifdef _MSC_VER
13 #include "msdevstudio/MSconfig.h"
14 #endif
15 
16 #include "RepBase.h"
17 
18 #include "graphics/ViewBase.h"
19 
20 using std::string;
21 
22 using namespace hippodraw;
23 
24 const Color RepBase::s_desel_color ( 225, 225, 225 );
25 
26 RepBase::RepBase ( const char * string, float size )
27  : m_name ( string ),
28  m_size ( size ),
29  m_desel ( false )
30 {
31 }
32 
34  : m_name ( rep.m_name ),
35  m_text ( rep.m_text ),
36  m_color ( rep.m_color ),
37  m_size ( rep.m_size ),
38  m_desel ( rep.m_desel )
39 {
40 }
41 
42 /* virtual */
44 {
45 }
46 
47 const string & RepBase::name () const
48 {
49  return m_name;
50 }
51 
52 void
53 RepBase::setColor ( const Color & color )
54 {
55  m_color = color;
56 }
57 
58 const Color & RepBase::getColor () const
59 {
60  return m_color;
61 }
62 
63 const Color & RepBase::color () const
64 {
65  if ( m_desel ) {
66  return s_desel_color;
67  }
68 
69  return m_color;
70 }
71 
73 {
74  m_desel = !yes;
75 }
76 
77 bool
79 isSelected () const
80 {
81  return m_desel == false;
82 }
83 
84 void
87 {
88  m_highlite = yes;
89 }
90 
91 float RepBase::size () const
92 {
93  return m_size;
94 }
95 
96 void RepBase::setSize ( float size )
97 {
98  m_size = size;
99 }
100 
101 void
102 RepBase::
103 setStyle ( unsigned int )
104 {
105  // do nothing
106 }
107 
108 unsigned int
109 RepBase::
110 getStyle ( ) const
111 {
112  return 0;
113 }
114 
115 /* virtual */
116 bool RepBase::xError () const
117 {
118  return false;
119 }
120 
121 /* virtual */
122 bool RepBase::yError () const
123 {
124  return false;
125 }
126 
127 void
128 RepBase::
130 {
131 }
132 
133 void RepBase::setText ( const std::string & text )
134 {
135  m_text = text;
136 }
137 
138 const std::string &
140 {
141  return m_text;
142 }
143 
144 
145 const BinToColor *
146 RepBase::
148 {
149  return 0;
150 }
151 
152 void
153 RepBase::
155 {
156  // do nothing
157 }
158 
159 void
160 RepBase::
162 {
163  string error ( "Error: " );
164  error += m_name;
165  error += " can not be displayed.";
166  view.drawText ( error, 5.0, 0.0, m_size, 0, 'l', 't', true );
167 }
168 
169 bool
170 RepBase::
172 {
173  return true;
174 }
175 
176 bool
177 RepBase::
178 uses ( Line::Style ) const
179 {
180  return false;
181 }
182 
183 bool
184 RepBase::
186 {
187  return false;
188 }
virtual void setHighLighted(bool yes)
Sets the highlighted state of the point representation.
Definition: RepBase.cxx:86
bool m_desel
A flag to indicate the representation is de-selected.
Definition: RepBase.h:66
virtual ~RepBase()
The virtual destructor.
Definition: RepBase.cxx:43
virtual bool uses(Color::Value) const
Returns true if receiving object uses a Color::Value as a property, otherwise returns false...
Definition: RepBase.cxx:171
The base class for the value to the color transformation.
Definition: BinToColor.h:30
Type
Enumeration of the type of symbols supported by this class.
Definition: SymbolType.h:28
virtual void setSelected(bool yes=true)
Sets the representation to be selected if yes is true, otherwise set it to be deselected.
Definition: RepBase.cxx:72
return rep
Definition: Inspector.cxx:3843
Value
A few common colors.
Definition: Color.h:51
const std::string & getText() const
Gets the text.
Definition: RepBase.cxx:139
std::string m_name
The name of the representation.
Definition: RepBase.h:51
return yes
Definition: CanvasView.cxx:883
virtual bool yError() const
Returns true if the point representation displays error on the Y axis.
Definition: RepBase.cxx:122
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
static const Color s_desel_color
The color of the representation when it is de-selected.
Definition: RepBase.h:60
virtual void setStyle(unsigned int style)
Sets the symbol of the representation.
Definition: RepBase.cxx:103
intp size(numeric::array arr)
Definition: num_util.cpp:296
virtual void setSize(float value)
Sets the size of the representation.
Definition: RepBase.cxx:96
virtual const Color & color() const
Returns the representation's color.
Definition: RepBase.cxx:63
virtual void setColor(const Color &)
Sets the color of the representation.
Definition: RepBase.cxx:53
Color m_color
The color of the representation.
Definition: RepBase.h:57
Style
Line style constants.
Definition: LineStyle.h:25
virtual void setValueTransform(BinToColor *)
Sets the value transform.
Definition: RepBase.cxx:154
RepBase(const char *, float size)
A constructor that sets the name and size of the representation.
Definition: RepBase.cxx:26
hippodraw::RepBase class interface
float m_size
The size of the representation.
Definition: RepBase.h:63
virtual void setErrorOn(hippodraw::Axes::Type axis, bool yes=true)
Sets the error representation on specified axis, if any, to yes.
Definition: RepBase.cxx:129
std::string m_text
The text to be displayed before the statistics.
Definition: RepBase.h:54
The abstract base class for views.
Definition: ViewBase.h:62
virtual void displayError(ViewBase &view)
Display an error message.
Definition: RepBase.cxx:161
virtual const BinToColor * getValueTransform() const
Returns the value transform.
Definition: RepBase.cxx:147
virtual void drawText(const std::string &s, float x, float y, float fontsize, float angle=0.0, char xp= 'l', char yp= 't', bool resize=false, const FontBase *font=0, const Color *color=0)=0
Draws a text string at a point in the view's coordinate system.
bool m_highlite
Sets the state of highlighting.
Definition: RepBase.h:70
virtual unsigned int getStyle() const
Returns the style of the point representation.
Definition: RepBase.cxx:110
virtual bool isSelected() const
Returns true if representation is in selected state, otherwise returns false.
Definition: RepBase.cxx:79
const std::string & name() const
Returns the name of the representation.
Definition: RepBase.cxx:47
virtual const Color & getColor() const
Get the color of the representation.
Definition: RepBase.cxx:58
virtual bool xError() const
Returns true if the point representation displays error on the X axis.
Definition: RepBase.cxx:116
hippodraw::ViewBase class interface
void setText(const std::string &text)
Sets the text.
Definition: RepBase.cxx:133
float size() const
Returns the size of the representation.
Definition: RepBase.cxx:91
Type
Axes constants.
Definition: AxesType.h:31
The base class for the point representation hierarchy.
Definition: RepBase.h:45

Generated for HippoDraw Class Library by doxygen