SymbolPointRep Class Reference

#include <SymbolPointRep.h>

Inheritance diagram for SymbolPointRep:

Inheritance graph
ColorSymbolPointRepPointRepBaseRepBase
[legend]
Collaboration diagram for SymbolPointRep:

Collaboration graph
PointRepBaseRepBaseErrorBarRepColorRangeBinaryTransformTransformBasePeriodicBinaryTransformUnaryTransform
[legend]
List of all members.

Detailed Description

A PointRep class draws a symbol to represent the value.

The variety of symbols available is enumerated on in hippodraw::Symbol::Type. The following plot was made with SymbolPointRep.

Bug:
The triangle is upside down, or should have both types.
Bug:
A symbol can be drawn outside the drawing rectangle if for example, it is located at 0,0.
Todo:
Could add diamond.
xyplot.png

Plot with SymbolPointRep

Author:
Kaustuv <kaustuv@stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 44 of file SymbolPointRep.h.

Public Member Functions

virtual RepBaseclone ()
 The clone function returns an object of its own kind which is a copy of this object at this moment.
virtual const Colorcolor () const
 Returns the representation's color.
virtual void displayError (ViewBase &view)
 Display an error message.
virtual void drawProjectedValues (const DataSource *ntuple, TransformBase *transform, ViewBase *view)
virtual const ColorgetColor () const
 Get the color of the representation.
virtual unsigned int getStyle () const
 Returns the style of the point symbol.
const std::string & getText () const
 Gets the text.
virtual const BinToColorgetValueTransform () const
 Returns the value transform.
virtual bool isSelected () const
 Returns true if representation is in selected state, otherwise returns false.
const std::string & name () const
 Returns the name of the representation.
virtual void setColor (const Color &color)
 Sets the color of the representation.
virtual void setErrorOn (hippodraw::Axes::Type axis, bool yes=true)
 Sets the display of the error bar.
virtual void setHighLighted (bool yes)
 Sets the highlighted state of the point representation.
virtual void setSelected (bool yes)
 Sets the selection state of the representation.
virtual void setSize (float value)
 Sets the size of the line drawing and that of the error bar.
virtual void setStyle (unsigned int symbol)
 Sets the symbol of the representation.
void setText (const std::string &text)
 Sets the text.
virtual void setValueTransform (BinToColor *)
 Sets the value transform.
float size () const
 Returns the size of the representation.
 SymbolPointRep (const SymbolPointRep &point_rep)
 The copy constructor.
 SymbolPointRep ()
 The default constructor.
 SymbolPointRep (hippodraw::Symbol::Type symbol, float size)
 The following constructor takes the symbol and size as arguments.
virtual void transformPoints (const TransformBase &transform, ViewBase &view)
 Transforms the cached coordinates using transform.
virtual bool uses (hippodraw::Line::Style) const
 Returns true if receiving object uses a hippodraw::Line::Style as a property, otherwise returns false.
virtual bool uses (Color::Value) const
 Returns true if receiving object uses a Color::Value as a property, otherwise returns false.
virtual bool xError () const
 Returns true if the point representation displays error on the X axis.
virtual bool yError () const
 Returns true if the point representation displays error on the Y axis.
 ~SymbolPointRep ()
 The destructor.

Protected Member Functions

void beginPlot (unsigned int size, const BinaryTransform *tf, const ViewBase *view)
 Sets the value of cached data members.
bool drawProjectedValue (unsigned int i, const DataSource *ntuple, const BinaryTransform *transform, ViewBase *view)
 Draws a projected value.
virtual bool uses (hippodraw::Symbol::Type) const
 Returns true as this class uses hippodraw::Symbol::Type as a property.

Protected Attributes

Color m_color
 The color of the representation.
bool m_desel
 A flag to indicate the representation is de-selected.
ErrorBarRepm_error_rep
 The error bar representation.
bool m_highlite
 Sets the state of highlighting.
std::string m_name
 The name of the representation.
hippodraw::Symbol::Type m_plot_symbol
 The PlotSymbol currently used.
float m_size
 The size of the representation.
std::string m_text
 The text to be displayed before the statistics.
std::vector< double > m_x
 A cache of the points to be drawn on the X axis.
bool m_x_flag
 The x error flag.
std::vector< double > m_y
 A cache of the points to be drawn on the Y axis.
bool m_y_flag
 The y error flag.

Static Protected Attributes

static const Color s_desel_color
 The color of the representation when it is de-selected.

Static Private Member Functions

static void rotate (double &lat, double &lon, double alpha, double beta, double gamma, bool negative=true)
 Rotates the coordinate.

Private Attributes

double c_beta
 Cached xOffset of PeriodicBinaryTransform.
double c_gamma
 Cached yOffset of PeriodBinaryTransform.
double c_max_x
 Cached xHighLimit of PeriodicBinaryTransform.
const PeriodicBinaryTransformc_periodic_tf
 Cached dynamic cast of BinaryTransform to PeriodicBinaryTransform if the BinaryTransform is periodic.
Range c_x_range
 Cached Range on X axis.
Range c_y_range
 Cached Range on X axis.
double m_x_cap
 The X error bar cap length.
double m_y_cap
 The Y error bar cap length.


Constructor & Destructor Documentation

SymbolPointRep ( hippodraw::Symbol::Type  symbol,
float  size 
)

The following constructor takes the symbol and size as arguments.

Definition at line 38 of file SymbolPointRep.cxx.

References PointRepBase::m_error_rep.

SymbolPointRep (  ) 

The default constructor.

Definition at line 45 of file SymbolPointRep.cxx.

References PointRepBase::m_error_rep.

Referenced by SymbolPointRep::clone().

SymbolPointRep ( const SymbolPointRep point_rep  ) 

The copy constructor.

Definition at line 52 of file SymbolPointRep.cxx.

References ErrorBarRep::clone(), SymbolPointRep::clone(), and PointRepBase::m_error_rep.

~SymbolPointRep (  ) 

The destructor.

Definition at line 64 of file SymbolPointRep.cxx.

References PointRepBase::m_error_rep.


Member Function Documentation

void beginPlot ( unsigned int  size,
const BinaryTransform tf,
const ViewBase view 
) [protected]

Sets the value of cached data members.

This member function should be called before any projected values are transformed.

Definition at line 221 of file SymbolPointRep.cxx.

References SymbolPointRep::c_beta, SymbolPointRep::c_gamma, SymbolPointRep::c_max_x, SymbolPointRep::c_periodic_tf, SymbolPointRep::c_x_range, SymbolPointRep::c_y_range, SymbolPointRep::m_x, SymbolPointRep::m_y, hippodraw::Axes::X, and hippodraw::Axes::Y.

Referenced by SymbolPointRep::drawProjectedValues(), and ColorSymbolPointRep::drawProjectedValues().

RepBase * clone (  )  [virtual]

The clone function returns an object of its own kind which is a copy of this object at this moment.

Implements PointRepBase.

Reimplemented in ColorSymbolPointRep.

Definition at line 69 of file SymbolPointRep.cxx.

References SymbolPointRep::SymbolPointRep().

Referenced by SymbolPointRep::SymbolPointRep().

const Color & color (  )  const [virtual, inherited]

Returns the representation's color.

Todo:
Remove this member in favor of getColor().

Definition at line 63 of file RepBase.cxx.

References RepBase::m_color, RepBase::m_desel, and RepBase::s_desel_color.

Referenced by ContourPointRep::createContours(), SymbolPointRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), ColorBoxPointRep::drawProjectedValues(), LinePointRep::drawValues(), ColumnPointRep::drawValues(), DataRep::getRepColor(), SymbolPointRep::setColor(), RepBase::setColor(), FilledColumnPointRep::setColor(), and ColumnPointRep::setColor().

void displayError ( ViewBase view  )  [virtual, inherited]

Display an error message.

Display an error message instead of drawing a point. This base class implementation displays a message with the name of the RepBase object.

Definition at line 161 of file RepBase.cxx.

References ViewBase::drawText(), RepBase::m_name, and RepBase::m_size.

bool drawProjectedValue ( unsigned int  i,
const DataSource ntuple,
const BinaryTransform transform,
ViewBase view 
) [protected]

Draws a projected value.

Draws the projected value index by index if the coordinate is within range. Returns true if the point is drawn, otherwise returns false.

Attention:
The member function beginPlot must be called before a call this member function.

Definition at line 244 of file SymbolPointRep.cxx.

References SymbolPointRep::c_beta, SymbolPointRep::c_gamma, SymbolPointRep::c_max_x, SymbolPointRep::c_periodic_tf, Range::includes(), SymbolPointRep::m_x, SymbolPointRep::m_y, SymbolPointRep::rotate(), hippodraw::Axes::X, hippodraw::DataPoint3DTuple::X, hippodraw::Axes::Y, and hippodraw::DataPoint3DTuple::Y.

Referenced by SymbolPointRep::drawProjectedValues(), and ColorSymbolPointRep::drawProjectedValues().

void drawProjectedValues ( const DataSource ntuple,
TransformBase transform,
ViewBase view 
) [virtual]

Todo:
Should transform be const in this method.

Implements RepBase.

Reimplemented in ColorSymbolPointRep.

Definition at line 192 of file SymbolPointRep.cxx.

References SymbolPointRep::beginPlot(), RepBase::color(), SymbolPointRep::drawProjectedValue(), PointRepBase::m_error_rep, SymbolPointRep::m_plot_symbol, RepBase::m_size, SymbolPointRep::m_x, SymbolPointRep::m_x_flag, SymbolPointRep::m_y, SymbolPointRep::m_y_flag, and RepBase::size().

const Color & getColor (  )  const [virtual, inherited]

Get the color of the representation.

Definition at line 58 of file RepBase.cxx.

References RepBase::m_color.

Referenced by PointRepXML::createElement().

unsigned int getStyle (  )  const [virtual]

Returns the style of the point symbol.

Reimplemented from RepBase.

Definition at line 90 of file SymbolPointRep.cxx.

References SymbolPointRep::m_plot_symbol.

const std::string & getText (  )  const [inherited]

Gets the text.

Definition at line 139 of file RepBase.cxx.

References RepBase::m_text.

Referenced by PointRepXML::setAttributes().

const BinToColor * getValueTransform (  )  const [virtual, inherited]

Returns the value transform.

A value transform changes a binary value to some graphical representations such as color. The implementation in this base class returns a null pointer. Derived classes that implement value transform should return a pointer to the object it uses.

Reimplemented in ColorBoxPointRep, ColorSymbolPointRep, and ContourPointRep.

Definition at line 147 of file RepBase.cxx.

Referenced by PointRepXML::createElement().

bool isSelected (  )  const [virtual, inherited]

Returns true if representation is in selected state, otherwise returns false.

Definition at line 79 of file RepBase.cxx.

References RepBase::m_desel.

Referenced by DataRep::isSelected().

const string & name (  )  const [inherited]

Returns the name of the representation.

This name might be used by a Factory.

Definition at line 47 of file RepBase.cxx.

References RepBase::m_name.

Referenced by ContourPointRep::createContours(), FuncParmRep::drawProjectedValues(), ContourPointRep::drawProjectedValues(), PointRepXML::setAttributes(), QtDisplay::setContourLevels(), and Inspector::updatePlotTab().

void rotate ( double &  lat,
double &  lon,
double  alpha,
double  beta,
double  gamma,
bool  negative = true 
) [static, private]

Rotates the coordinate.

If negative is true, range is [-180, 180], otherwise range is [0, 360]

Definition at line 139 of file SymbolPointRep.cxx.

Referenced by SymbolPointRep::drawProjectedValue().

void setColor ( const Color  )  [virtual]

Sets the color of the representation.

Reimplemented from RepBase.

Definition at line 74 of file SymbolPointRep.cxx.

References RepBase::color(), PointRepBase::m_error_rep, and RepBase::setColor().

void setErrorOn ( hippodraw::Axes::Type  axis,
bool  yes = true 
) [virtual]

Sets the display of the error bar.

Sets the display of the error bar on the specified axis to on or off.

Reimplemented from RepBase.

Definition at line 97 of file SymbolPointRep.cxx.

References PointRepBase::m_error_rep, SymbolPointRep::m_x_flag, SymbolPointRep::m_y_flag, hippodraw::Axes::X, and hippodraw::Axes::Y.

void setHighLighted ( bool  yes  )  [virtual, inherited]

Sets the highlighted state of the point representation.

If yes is true, then the point representation should show the non highlighted regions in some fashion, typically using light gray color instead of its normal color.

See also:
setSelected (bool)

m_ranges.

Definition at line 86 of file RepBase.cxx.

References RepBase::m_highlite.

void setSelected ( bool  yes  )  [virtual, inherited]

Sets the selection state of the representation.

Also sets the selection state of the ErrorBarRep representation, if any. If yes is false, the point representation should shows its deselected stated by some fashion, typically using a light gray color instead of its normal color.

Reimplemented from RepBase.

Definition at line 38 of file PointRepBase.cxx.

References PointRepBase::m_error_rep, and RepBase::setSelected().

void setSize ( float  value  )  [virtual]

Sets the size of the line drawing and that of the error bar.

Reimplemented from RepBase.

Definition at line 291 of file SymbolPointRep.cxx.

References PointRepBase::m_error_rep, and RepBase::setSize().

void setStyle ( unsigned int  style  )  [virtual]

Sets the symbol of the representation.

Derived classes may use this method to set the style of the representation, if they have various styles. This base class implementation does nothing.

Reimplemented from RepBase.

Definition at line 83 of file SymbolPointRep.cxx.

References hippodraw::String::convert(), and SymbolPointRep::m_plot_symbol.

void setText ( const std::string &  text  )  [inherited]

Sets the text.

Definition at line 133 of file RepBase.cxx.

References RepBase::m_text.

Referenced by PointRepXML::createObject(), and DisplayController::createTextDataRep().

void setValueTransform ( BinToColor  )  [virtual, inherited]

Sets the value transform.

The implementation in this base class does nothing. Derived classes that implement a value transform should override this method and take possession of the received object.

Todo:
Should have base class that doesn't know about color and BinToColor class should derive from it.

Reimplemented in ColorBoxPointRep, ColorSymbolPointRep, and ContourPointRep.

Definition at line 154 of file RepBase.cxx.

float size (  )  const [inherited]

Returns the size of the representation.

Definition at line 91 of file RepBase.cxx.

References RepBase::m_size.

Referenced by ContourPointRep::createContours(), ContourPointRep::drawContourTicks(), SymbolPointRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), ContourPointRep::drawProjectedValues(), ColumnPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), ColorBoxPointRep::drawProjectedValues(), LinePointRep::drawValues(), FilledColumnPointRep::drawValues(), DisplayController::pointSize(), PointRepXML::setAttributes(), LineFunctionRep::smoothCurve(), and LinePointRep::transformValues().

void transformPoints ( const TransformBase transform,
ViewBase view 
) [virtual]

Transforms the cached coordinates using transform.

Definition at line 123 of file SymbolPointRep.cxx.

References SymbolPointRep::m_x, SymbolPointRep::m_y, and BinaryTransform::transform().

bool uses ( hippodraw::Line::Style   )  const [virtual, inherited]

Returns true if receiving object uses a hippodraw::Line::Style as a property, otherwise returns false.

This base class implementation returns false. Derived classes that use hippodraw::Line::Style should override this member function and return true.

Reimplemented in ColumnPointRep, and LinePointRep.

Definition at line 178 of file RepBase.cxx.

bool uses ( Color::Value   )  const [virtual, inherited]

Returns true if receiving object uses a Color::Value as a property, otherwise returns false.

This base class implementation returns true as most derived classes use a Color::Value as a property. Derived classes that do not, such as those that represent a value in color, should override this member function and return false.

Reimplemented in ColorBoxPointRep, and ColorSymbolPointRep.

Definition at line 171 of file RepBase.cxx.

bool uses ( hippodraw::Symbol::Type   )  const [protected, virtual]

Returns true as this class uses hippodraw::Symbol::Type as a property.

Reimplemented from RepBase.

Definition at line 284 of file SymbolPointRep.cxx.

bool xError (  )  const [virtual]

Returns true if the point representation displays error on the X axis.

The default implementation returns false. May be overridden by derived classes.

Reimplemented from RepBase.

Definition at line 109 of file SymbolPointRep.cxx.

References SymbolPointRep::m_x_flag.

bool yError (  )  const [virtual]

Returns true if the point representation displays error on the Y axis.

The default implementation returns false. May be overridden by derived classes.

Reimplemented from RepBase.

Definition at line 114 of file SymbolPointRep.cxx.

References SymbolPointRep::m_y_flag.


Member Data Documentation

double c_beta [private]

Cached xOffset of PeriodicBinaryTransform.

Definition at line 86 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), and SymbolPointRep::drawProjectedValue().

double c_gamma [private]

Cached yOffset of PeriodBinaryTransform.

Definition at line 90 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), and SymbolPointRep::drawProjectedValue().

double c_max_x [private]

Cached xHighLimit of PeriodicBinaryTransform.

Definition at line 94 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), and SymbolPointRep::drawProjectedValue().

const PeriodicBinaryTransform* c_periodic_tf [private]

Cached dynamic cast of BinaryTransform to PeriodicBinaryTransform if the BinaryTransform is periodic.

Definition at line 82 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), and SymbolPointRep::drawProjectedValue().

Range c_x_range [private]

Cached Range on X axis.

Definition at line 97 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot().

Range c_y_range [private]

Cached Range on X axis.

Definition at line 100 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot().

Color m_color [protected, inherited]

The color of the representation.

Definition at line 57 of file RepBase.h.

Referenced by RepBase::color(), ContourPointRep::createContours(), CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), CutRangeRep::drawNormalRange(), UnderflowTextRep::drawProjectedValues(), TotalTextRep::drawProjectedValues(), OverflowTextRep::drawProjectedValues(), FuncParmRep::drawProjectedValues(), FuncChiRep::drawProjectedValues(), BoxTextRep::drawProjectedValues(), AverageTextRep::drawProjectedValues(), RepBase::getColor(), and RepBase::setColor().

bool m_desel [protected, inherited]

A flag to indicate the representation is de-selected.

Definition at line 66 of file RepBase.h.

Referenced by RepBase::color(), ContourPointRep::createContours(), CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), CutRangeRep::drawNormalRange(), ColorBoxPointRep::drawProjectedValues(), RepBase::isSelected(), and RepBase::setSelected().

ErrorBarRep* m_error_rep [protected, inherited]

The error bar representation.

Will be a null pointer if a derived class doesn't have one.

Definition at line 44 of file PointRepBase.h.

Referenced by ColumnPointRep::ColumnPointRep(), SymbolPointRep::drawProjectedValues(), ColumnPointRep::drawProjectedValues(), SymbolPointRep::setColor(), ColumnPointRep::setColor(), SymbolPointRep::setErrorOn(), ColumnPointRep::setErrorOn(), PointRepBase::setSelected(), SymbolPointRep::setSize(), ColumnPointRep::setSize(), SymbolPointRep::SymbolPointRep(), ColumnPointRep::~ColumnPointRep(), and SymbolPointRep::~SymbolPointRep().

bool m_highlite [protected, inherited]

Sets the state of highlighting.

Definition at line 70 of file RepBase.h.

Referenced by RepBase::setHighLighted().

std::string m_name [protected, inherited]

The name of the representation.

Definition at line 51 of file RepBase.h.

Referenced by AverageTextRep::AverageTextRep(), ColorSymbolPointRep::ColorSymbolPointRep(), RepBase::displayError(), FilledColumnPointRep::FilledColumnPointRep(), ContourPointRep::init(), and RepBase::name().

hippodraw::Symbol::Type m_plot_symbol [protected]

The PlotSymbol currently used.

Definition at line 111 of file SymbolPointRep.h.

Referenced by SymbolPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), SymbolPointRep::getStyle(), and SymbolPointRep::setStyle().

float m_size [protected, inherited]

The size of the representation.

Definition at line 63 of file RepBase.h.

Referenced by RepBase::displayError(), UnderflowTextRep::drawProjectedValues(), TotalTextRep::drawProjectedValues(), SymbolPointRep::drawProjectedValues(), OverflowTextRep::drawProjectedValues(), FuncParmRep::drawProjectedValues(), FuncChiRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), BoxTextRep::drawProjectedValues(), AverageTextRep::drawProjectedValues(), LinePointRep::drawValues(), ContourPointRep::drawValues(), ColumnPointRep::drawValues(), ContourPointRep::drawValuesWithStyle(), RepBase::setSize(), and RepBase::size().

std::string m_text [protected, inherited]

The text to be displayed before the statistics.

Definition at line 54 of file RepBase.h.

Referenced by BoxTextRep::drawProjectedValues(), RepBase::getText(), and RepBase::setText().

std::vector< double > m_x [protected]

A cache of the points to be drawn on the X axis.

A cache is used so that all the points are delivered to the View with one call. The cache is cleared with a call to beginPlot. However, X and Y caches are separate so that they can be transformed independently.

Definition at line 64 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), SymbolPointRep::drawProjectedValue(), SymbolPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), and SymbolPointRep::transformPoints().

double m_x_cap [private]

The X error bar cap length.

Definition at line 103 of file SymbolPointRep.h.

bool m_x_flag [protected]

The x error flag.

If set true, error bars along the X axis are generated.

Definition at line 71 of file SymbolPointRep.h.

Referenced by SymbolPointRep::drawProjectedValues(), SymbolPointRep::setErrorOn(), and SymbolPointRep::xError().

std::vector< double > m_y [protected]

A cache of the points to be drawn on the Y axis.

See also:
m_x

Definition at line 67 of file SymbolPointRep.h.

Referenced by SymbolPointRep::beginPlot(), SymbolPointRep::drawProjectedValue(), SymbolPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), and SymbolPointRep::transformPoints().

double m_y_cap [private]

The Y error bar cap length.

Definition at line 106 of file SymbolPointRep.h.

bool m_y_flag [protected]

The y error flag.

If set true, error bars along the Y axis are generated.

Definition at line 75 of file SymbolPointRep.h.

Referenced by SymbolPointRep::drawProjectedValues(), SymbolPointRep::setErrorOn(), and SymbolPointRep::yError().

const Color s_desel_color [static, protected, inherited]

The color of the representation when it is de-selected.

Definition at line 60 of file RepBase.h.

Referenced by RepBase::color(), ContourPointRep::createContours(), CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), CutRangeRep::drawNormalRange(), and ColorBoxPointRep::drawProjectedValues().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen