Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ContourPointRep Class Reference

#include <ContourPointRep.h>

Inheritance diagram for ContourPointRep:

Inheritance graph
[legend]
Collaboration diagram for ContourPointRep:

Collaboration graph
[legend]
List of all members.

Detailed Description

A PointRep class that draws a contour lines.

The ContourPointRep transforms a two dimension matrix of projected values into a set of colored contour levels. The algorithm used is adapted from CONREC, which is a contouring Fortran 77 subroutine written by Paul Bourke, of the Center for Astrophysics and Supercomputing, Swinburne University of Technology in Melbourne, Australia.

Bug:
Doesn't gray itself out when in deselected state.

Bug:
Does not respond to line style change.

Author:
Sanket B. Malde sanket @ stanford.edu

Definition at line 39 of file ContourPointRep.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.
 ContourPointRep (const ContourPointRep &point_rep)
 The copy constructor.
 ContourPointRep (float size)
 Constructor that takes size as argument.
 ContourPointRep ()
 The default constructor.
virtual void displayError (ViewBase &view)
 Display an error message.
void drawContourTicks (const TransformBase &, ViewBase &, const std::vector< double > &)
virtual void drawProjectedValues (const DataSource *ntuple, TransformBase *transform, ViewBase *view)
 Draws the projected values.
virtual const ColorgetColor () const
 Get the color of the representation.
int getNumContours () const
 Returns the number of contours.
virtual unsigned int getStyle () const
 Returns the style of the line drawing.
virtual unsigned int getStyle () const
 Returns the style of the line drawing.
bool getUsingUserValues () const
 Get the m_usingUserValues boolean.
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::stringname () const
 Returns the name of the representation.
virtual void setColor (const Color &)
 Sets the color of the representation.
void setContourValues (std::vector< double > &values, ProjectorBase *proj)
 Set user defined contour values.
virtual void setErrorOn (const std::string &axis, bool yes=true)
 Sets the error representation on specified axis, if any, to yes.
virtual void setHighLighted (bool yes)
 Sets the highlighted state of the point representation.
void setNumContours (int i)
 Set number of contours.
virtual void setSelected (bool yes)
 Sets the selection state of the representation.
void setSize (float value)
 Sets the size of the representation.
virtual void setStyle (unsigned int style)
 Sets the style of the line drawing.
virtual void setStyle (unsigned int style)
 Sets the style of the line drawing.
void setText (const std::string &text)
 Sets the text.
void setUsingUserValues (bool flag)
 Set the m_usingUserValues boolean.
virtual void setValueTransform (BinToColor *)
 Sets the value transform.
float size () const
 Returns the size of the representation.
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.
 ~ContourPointRep ()
 The destructor.

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.
hippodraw::Line::Style m_line_style
 The style currently used.
std::string m_name
 The name of the representation.
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 along the X axis to be drawn.
std::vector< double > m_y
 A cache of the points along the Y axis to be drawn.

Static Protected Attributes

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

Private Member Functions

void createContours (const DataSource *ntuple, const TransformBase *transform)
 The method that actually calculates the contour lines.
virtual void endPlot (const TransformBase &, ViewBase &vb, const Range &range)
double getContour (int i, const TransformBase *transform)
 Returns the z value where the i-th level contour is to be drawn.
void init ()
 Initialization member function used by constructors.
double intersect (int p1, int p2, double *h, double *xh)
 Returns the intersection of the segment given by h[p1] and h[p2] with the segment given by xh[p1] and xh[p2].
void setContourVector (const TransformBase *transform)
 Prepare the vector of contour values.
void setMinMax (const DataSource *)
 Set the min and max Z values of the data being plotted.

Private Attributes

BinToColorm_bin_to_color
 The color scale generator.
std::vector< Colorm_colorvec
 The vector of colors used for drawing the lines.
double m_maxValue
 The max Z value of the data.
double m_minValue
 The min Z value of the data.
int m_numContours
 The number of contours to be drawn.
bool m_usingUserValues
 A boolean which is true if we are using user input contour values.
std::vector< double > m_values
 The vector of contour values.


Constructor & Destructor Documentation

ContourPointRep::ContourPointRep  ) 
 

The default constructor.

Definition at line 43 of file ContourPointRep.cxx.

References init().

Referenced by clone().

ContourPointRep::ContourPointRep float  size  ) 
 

Constructor that takes size as argument.

Definition at line 37 of file ContourPointRep.cxx.

References init().

ContourPointRep::ContourPointRep const ContourPointRep point_rep  ) 
 

The copy constructor.

Definition at line 62 of file ContourPointRep.cxx.

References clone(), getNumContours(), getUsingUserValues(), m_bin_to_color, m_numContours, m_usingUserValues, and m_values.

ContourPointRep::~ContourPointRep  ) 
 

The destructor.

Definition at line 74 of file ContourPointRep.cxx.

References m_bin_to_color.


Member Function Documentation

RepBase * ContourPointRep::clone  )  [virtual]
 

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

Reimplemented from LinePointRep.

Definition at line 79 of file ContourPointRep.cxx.

References ContourPointRep().

Referenced by ContourPointRep().

const Color & RepBase::color  )  const [virtual, inherited]
 

Returns the representation's color.

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

Definition at line 61 of file RepBase.cxx.

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

Referenced by createContours(), SymbolPointRep::drawProjectedValues(), LinePointRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), ColumnPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), ColorBoxPointRep::drawProjectedValues(), and DataRep::getRepColor().

void ContourPointRep::createContours const DataSource ntuple,
const TransformBase transform
[private]
 

The method that actually calculates the contour lines.

The implementation is modified version of Nicholas Yue's C++ adaption of CONREC, to use STL vector instead of a double ** array.

Author:
Nicholas Yue

Definition at line 178 of file ContourPointRep.cxx.

References RepBase::color(), Range::excludes(), BinToColor::getRange(), intersect(), m_bin_to_color, m_colorvec, m_numContours, m_values, LinePointRep::m_x, LinePointRep::m_y, std::max(), std::min(), num_util::shape(), RepBase::size(), hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by drawProjectedValues().

void RepBase::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 153 of file RepBase.cxx.

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

void ContourPointRep::drawContourTicks const TransformBase ,
ViewBase ,
const std::vector< double > & 
 

Definition at line 127 of file ContourPointRep.cxx.

References ViewBase::drawViewLines(), Range::excludes(), HippoRectangle::getHeight(), ViewBase::getMarginRect(), ViewBase::getRange(), HippoRectangle::getY(), RepBase::size(), hippodraw::Line::Solid, BinaryTransform::transformZ(), ViewBase::userToDrawColor(), and hippodraw::Axes::Z.

Referenced by endPlot().

void ContourPointRep::drawProjectedValues const DataSource ntuple,
TransformBase transform,
ViewBase view
[virtual]
 

Draws the projected values.

Draws the projected values contained in the DataSource ntuple. Each row of the ntuple is data point tuple of some dimension. Derived classes expect the DataSoruce to be of the correct dimension. The drawn points undergo a transform represented by transform and are drawn to the view view. If highlighting is on, uses the ranges to control highlighting.

Reimplemented from LinePointRep.

Definition at line 548 of file ContourPointRep.cxx.

References createContours(), endPlot(), Range::high(), Range::low(), m_bin_to_color, m_colorvec, LinePointRep::m_x, LinePointRep::m_y, setContourVector(), setMinMax(), BinToColor::setRange(), RepBase::size(), and hippodraw::Axes::Z.

void ContourPointRep::endPlot const TransformBase ,
ViewBase vb,
const Range range
[private, virtual]
 

Definition at line 99 of file ContourPointRep.cxx.

References ViewBase::drawColorLines(), drawContourTicks(), ViewBase::getUserRect(), m_colorvec, LinePointRep::m_line_style, RepBase::m_size, m_values, LinePointRep::m_x, LinePointRep::m_y, HippoRectangle::makeInBounds(), and BinaryTransform::transform().

Referenced by drawProjectedValues().

const Color & RepBase::getColor  )  const [virtual, inherited]
 

Get the color of the representation.

Definition at line 56 of file RepBase.cxx.

References RepBase::m_color.

Referenced by PointRepXML::createElement().

double ContourPointRep::getContour int  i,
const TransformBase transform
[private]
 

Returns the z value where the i-th level contour is to be drawn.

Todo:
Test contour when low end of range is negative.

Definition at line 455 of file ContourPointRep.cxx.

References m_maxValue, m_minValue, and m_numContours.

Referenced by setContourVector().

int ContourPointRep::getNumContours  )  const
 

Returns the number of contours.

Definition at line 489 of file ContourPointRep.cxx.

References m_numContours.

Referenced by ContourPointRep(), Inspector::contourRadioButton1_toggled(), and Inspector::contourTextBox_returnPressed().

virtual unsigned int LinePointRep::getStyle  )  const [virtual, inherited]
 

Returns the style of the line drawing.

Reimplemented from RepBase.

unsigned int LinePointRep::getStyle  )  const [virtual, inherited]
 

Returns the style of the line drawing.

Reimplemented from RepBase.

Definition at line 70 of file LineFunctionRep.cxx.

References LinePointRep::m_line_style.

bool ContourPointRep::getUsingUserValues  )  const
 

Get the m_usingUserValues boolean.

Definition at line 504 of file ContourPointRep.cxx.

References m_usingUserValues.

Referenced by ContourPointRep(), and Inspector::updateAxisTab().

const BinToColor * ContourPointRep::getValueTransform  )  const [virtual]
 

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 from RepBase.

Definition at line 86 of file ContourPointRep.cxx.

References m_bin_to_color.

void ContourPointRep::init  )  [private]
 

Initialization member function used by constructors.

Definition at line 51 of file ContourPointRep.cxx.

References BinToColorFactory::instance(), m_bin_to_color, RepBase::m_name, m_numContours, m_usingUserValues, and m_values.

Referenced by ContourPointRep().

double ContourPointRep::intersect int  p1,
int  p2,
double *  h,
double *  xh
[private]
 

Returns the intersection of the segment given by h[p1] and h[p2] with the segment given by xh[p1] and xh[p2].

Definition at line 484 of file ContourPointRep.cxx.

Referenced by createContours().

bool RepBase::isSelected  )  const [virtual, inherited]
 

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

Definition at line 77 of file RepBase.cxx.

References RepBase::m_desel.

Referenced by DataRep::isSelected().

const string & RepBase::name  )  const [inherited]
 

Returns the name of the representation.

This name might be used by a Factory.

Definition at line 45 of file RepBase.cxx.

References RepBase::m_name.

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

void RepBase::setColor const Color  )  [virtual, inherited]
 

Sets the color of the representation.

Reimplemented in ColumnPointRep, and SymbolPointRep.

Definition at line 51 of file RepBase.cxx.

References RepBase::m_color.

Referenced by PointRepXML::createObject(), CutRangeRep::CutRangeRep(), FunctionRep::FunctionRep(), LineDataRep::LineDataRep(), SymbolPointRep::setColor(), ColumnPointRep::setColor(), and DataRep::setRepColor().

void ContourPointRep::setContourValues std::vector< double > &  values,
ProjectorBase proj
 

Set user defined contour values.

Definition at line 511 of file ContourPointRep.cxx.

References ProjectorBase::getAxisModel(), AxisModelBase::getScaleFactor(), m_numContours, m_usingUserValues, m_values, and hippodraw::Axes::Z.

Referenced by Inspector::contourLevelsTextBox_returnPressed().

void ContourPointRep::setContourVector const TransformBase transform  )  [private]
 

Prepare the vector of contour values.

Definition at line 532 of file ContourPointRep.cxx.

References getContour(), m_numContours, m_usingUserValues, and m_values.

Referenced by drawProjectedValues().

void RepBase::setErrorOn const std::string axis,
bool  yes = true
[virtual, inherited]
 

Sets the error representation on specified axis, if any, to yes.

Todo:
This member Needs to be implemented in some derived classes.

Reimplemented in ColumnPointRep, and SymbolPointRep.

Definition at line 128 of file RepBase.cxx.

Referenced by PointRepXML::createObject(), and DataRep::setErrorDisplay().

void RepBase::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 84 of file RepBase.cxx.

References RepBase::m_highlite.

void ContourPointRep::setMinMax const DataSource  )  [private]
 

Set the min and max Z values of the data being plotted.

Definition at line 591 of file ContourPointRep.cxx.

References Range::high(), Range::low(), m_maxValue, m_minValue, and hippodraw::Axes::Z.

Referenced by drawProjectedValues().

void ContourPointRep::setNumContours int  i  ) 
 

Set number of contours.

Definition at line 494 of file ContourPointRep.cxx.

References m_numContours.

Referenced by Inspector::contourSlider_valueChanged(), and Inspector::contourTextBox_returnPressed().

void PointRepBase::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 36 of file PointRepBase.cxx.

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

void RepBase::setSize float  value  )  [inherited]
 

Sets the size of the representation.

Definition at line 94 of file RepBase.cxx.

References RepBase::m_size.

Referenced by PointRepXML::createObject(), FunctionRep::FunctionRep(), and DataRep::setRepSize().

virtual void LinePointRep::setStyle unsigned int  style  )  [virtual, inherited]
 

Sets the style of the line drawing.

Reimplemented from RepBase.

void LinePointRep::setStyle unsigned int  style  )  [virtual, inherited]
 

Sets the style of the line drawing.

Reimplemented from RepBase.

Definition at line 63 of file LineFunctionRep.cxx.

References hippodraw::Axes::convert(), and LinePointRep::m_line_style.

void RepBase::setText const std::string text  )  [inherited]
 

Sets the text.

Definition at line 132 of file RepBase.cxx.

References RepBase::m_text.

Referenced by DisplayController::createTextDataRep().

void ContourPointRep::setUsingUserValues bool  flag  ) 
 

Set the m_usingUserValues boolean.

Definition at line 499 of file ContourPointRep.cxx.

References m_usingUserValues.

Referenced by Inspector::contourSlider_valueChanged(), and Inspector::contourTextBox_returnPressed().

void ContourPointRep::setValueTransform BinToColor  )  [virtual]
 

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 from RepBase.

Definition at line 93 of file ContourPointRep.cxx.

References m_bin_to_color.

float RepBase::size  )  const [inherited]
 

Returns the size of the representation.

Definition at line 89 of file RepBase.cxx.

References RepBase::m_size.

Referenced by createContours(), drawContourTicks(), SymbolPointRep::drawProjectedValues(), LinePointRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), drawProjectedValues(), ColumnPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), ColorBoxPointRep::drawProjectedValues(), DisplayController::pointSize(), and PointRepXML::setAttributes().

bool RepBase::xError  )  const [virtual, inherited]
 

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

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

Reimplemented in SymbolPointRep.

Definition at line 114 of file RepBase.cxx.

Referenced by DataRep::isErrorDisplayed(), and PointRepXML::setAttributes().

bool RepBase::yError  )  const [virtual, inherited]
 

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

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

Reimplemented in ColumnPointRep, and SymbolPointRep.

Definition at line 120 of file RepBase.cxx.

Referenced by DataRep::isErrorDisplayed(), and PointRepXML::setAttributes().


Member Data Documentation

BinToColor* ContourPointRep::m_bin_to_color [private]
 

The color scale generator.

Definition at line 45 of file ContourPointRep.h.

Referenced by ContourPointRep(), createContours(), drawProjectedValues(), getValueTransform(), init(), setValueTransform(), and ~ContourPointRep().

Color RepBase::m_color [protected, inherited]
 

The color of the representation.

Definition at line 55 of file RepBase.h.

Referenced by RepBase::color(), CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), CutRangeRep::drawNormalRange(), RepBase::getColor(), and RepBase::setColor().

std::vector< Color > ContourPointRep::m_colorvec [private]
 

The vector of colors used for drawing the lines.

Definition at line 48 of file ContourPointRep.h.

Referenced by createContours(), drawProjectedValues(), and endPlot().

bool RepBase::m_desel [protected, inherited]
 

A flag to indicate the representation is de-selected.

Definition at line 64 of file RepBase.h.

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

ErrorBarRep* PointRepBase::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 42 of file PointRepBase.h.

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

bool RepBase::m_highlite [protected, inherited]
 

Sets the state of highlighting.

Definition at line 68 of file RepBase.h.

Referenced by RepBase::setHighLighted().

hippodraw::Line::Style LinePointRep::m_line_style [protected, inherited]
 

The style currently used.

Definition at line 94 of file LinePointRep.h.

Referenced by LinePointRep::drawProjectedValues(), endPlot(), LinePointRep::getStyle(), and LinePointRep::setStyle().

double ContourPointRep::m_maxValue [private]
 

The max Z value of the data.

Definition at line 54 of file ContourPointRep.h.

Referenced by getContour(), and setMinMax().

double ContourPointRep::m_minValue [private]
 

The min Z value of the data.

Definition at line 57 of file ContourPointRep.h.

Referenced by getContour(), and setMinMax().

std::string RepBase::m_name [protected, inherited]
 

The name of the representation.

Definition at line 49 of file RepBase.h.

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

int ContourPointRep::m_numContours [private]
 

The number of contours to be drawn.

Definition at line 51 of file ContourPointRep.h.

Referenced by ContourPointRep(), createContours(), getContour(), getNumContours(), init(), setContourValues(), setContourVector(), and setNumContours().

float RepBase::m_size [protected, inherited]
 

The size of the representation.

Definition at line 61 of file RepBase.h.

Referenced by RepBase::displayError(), TotalTextRep::drawProjectedValues(), SymbolPointRep::drawProjectedValues(), LinePointRep::drawProjectedValues(), FuncParmRep::drawProjectedValues(), FuncChiRep::drawProjectedValues(), ErrorBarRep::drawProjectedValues(), ColumnPointRep::drawProjectedValues(), ColorSymbolPointRep::drawProjectedValues(), BoxTextRep::drawProjectedValues(), AverageTextRep::drawProjectedValues(), endPlot(), RepBase::setSize(), and RepBase::size().

std::string RepBase::m_text [protected, inherited]
 

The text to be displayed before the statistics.

Definition at line 52 of file RepBase.h.

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

bool ContourPointRep::m_usingUserValues [private]
 

A boolean which is true if we are using user input contour values.

Definition at line 64 of file ContourPointRep.h.

Referenced by ContourPointRep(), getUsingUserValues(), init(), setContourValues(), setContourVector(), and setUsingUserValues().

std::vector< double > ContourPointRep::m_values [private]
 

The vector of contour values.

Definition at line 60 of file ContourPointRep.h.

Referenced by ContourPointRep(), createContours(), endPlot(), init(), setContourValues(), and setContourVector().

std::vector< double > LinePointRep::m_x [protected, inherited]
 

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

For efficiency, all line segments are sent once to the view. However, the x and y points are kept separate so that they can be transformed separately. LinePointRep builds a cache for efficiency.

Definition at line 82 of file LinePointRep.h.

Referenced by createContours(), LinePointRep::drawProjectedValues(), drawProjectedValues(), and endPlot().

std::vector< double > LinePointRep::m_y [protected, inherited]
 

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

For efficiency, all line segments are sent once to the view. However, the x and y points are kept separate so that they can be transformed separately. LinePointRep builds a cache for efficiency.

Definition at line 90 of file LinePointRep.h.

Referenced by createContours(), LinePointRep::drawProjectedValues(), drawProjectedValues(), and endPlot().

const Color RepBase::s_desel_color [static, protected, inherited]
 

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

Referenced by RepBase::color(), CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), and CutRangeRep::drawNormalRange().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3