Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
LogTransform Class Reference

A UnaryTransform which takes the log of the coordinate. More...

#include <LogTransform.h>

Inheritance diagram for LogTransform:
Inheritance graph
[legend]
Collaboration diagram for LogTransform:
Collaboration graph
[legend]

Public Member Functions

const RangeadjustValues (AxisModelBase &axis, const Range &limit)
 Sets the range of given axis to be a new "nice" within the limits given. More...
 
virtual double aspectRatio () const
 Get the aspect ratio. More...
 
virtual LogTransformclone () const
 Creates a new Transform object by copying an existing one. More...
 
virtual void inverseTransform (double &x) const
 Inverse transforms the coordinate x. More...
 
virtual bool isLinear () const
 
virtual const Rangelimits () const
 Returns a Range whose values are the limits on the coordinate. More...
 
 LogTransform ()
 The default constructor. More...
 
 LogTransform (const LogTransform &)
 The copy constructor. More...
 
const std::string & name () const
 Returns the name of the Transform. More...
 
virtual const std::vector< AxisTick > & setTicks (AxisModelBase &axis)
 Sets the vector of ticks along the axis to which this Log transform is applied. More...
 
virtual void transform (double &x) const
 Transforms the coordinate @ x. More...
 
virtual void transform (std::vector< double > &x) const
 Transforms each element of the vector x. More...
 
virtual void validate (Range &) const
 Validates the Range, and adjusts the argument Range so that the values are positive. More...
 
virtual ~LogTransform ()
 The virtual destructor. More...
 

Protected Attributes

const Range m_limits
 The valid Range of the transform. More...
 
std::string m_name
 Name of the Transform. More...
 

Private Member Functions

const RangeadjustLogValues (AxisModelBase &axis)
 
const std::vector< AxisTick > & genTicks (AxisModelBase &)
 
double nextStep (double current, AxisModelBase &axis)
 
double prevStep (double current, AxisModelBase &axis)
 
void setFirstTick (AxisModelBase &)
 
void setTickStep (AxisModelBase &)
 

Private Attributes

std::vector< AxisTickm_ticks
 The ticks generated by this transform. More...
 

Detailed Description

A UnaryTransform which takes the log of the coordinate.

Author
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 28 of file LogTransform.h.

Constructor & Destructor Documentation

◆ LogTransform() [1/2]

The default constructor.

Definition at line 41 of file LogTransform.cxx.

References TransformBase::m_name.

Referenced by LogTransform::clone().

◆ LogTransform() [2/2]

LogTransform ( const LogTransform lt)

The copy constructor.

Definition at line 51 of file LogTransform.cxx.

References LogTransform::clone().

◆ ~LogTransform()

~LogTransform ( )
virtual

The virtual destructor.

Definition at line 47 of file LogTransform.cxx.

Member Function Documentation

◆ adjustLogValues()

const Range & adjustLogValues ( AxisModelBase axis)
private

◆ adjustValues()

const Range & adjustValues ( AxisModelBase axis,
const Range limit 
)
virtual

◆ aspectRatio()

double aspectRatio ( ) const
virtualinherited

◆ clone()

LogTransform * clone ( ) const
virtual

Creates a new Transform object by copying an existing one.

Implements UnaryTransform.

Definition at line 59 of file LogTransform.cxx.

References LogTransform::isLinear(), and LogTransform::LogTransform().

Referenced by LogTransform::LogTransform().

◆ genTicks()

const vector< AxisTick > & genTicks ( AxisModelBase axis)
private
Todo:
This is an ugly way to display scientific notation.

Can we improve it?

Todo:
Use C++ stringstream insted of sprintf().

Definition at line 183 of file LogTransform.cxx.

References hippodraw::FLT_EQUAL(), AxisModelBase::getFirstTick(), AxisModelBase::getMaxTicks(), AxisModelBase::getRange(), AxisModelBase::getScaleFactor(), AxisModelBase::getTickStep(), Range::high(), Range::low(), LogTransform::m_ticks, and LogTransform::nextStep().

Referenced by FLT_EQUAL(), and LogTransform::setTicks().

◆ inverseTransform()

void inverseTransform ( double &  x) const
virtual

Inverse transforms the coordinate x.

Implements UnaryTransform.

Definition at line 77 of file LogTransform.cxx.

References LogTransform::transform().

◆ isLinear()

bool isLinear ( ) const
virtual

Implements UnaryTransform.

Definition at line 67 of file LogTransform.cxx.

Referenced by LogTransform::clone().

◆ limits()

const Range & limits ( ) const
virtualinherited

Returns a Range whose values are the limits on the coordinate.

Definition at line 28 of file UnaryTransform.cxx.

References UnaryTransform::m_limits.

Referenced by XYZTransform::limitX(), XYTransform::limitX(), XYZTransform::limitY(), XYTransform::limitY(), XYZTransform::limitZ(), and BinaryTransform::limitZ().

◆ name()

const string & name ( ) const
inherited

◆ nextStep()

double nextStep ( double  current,
AxisModelBase axis 
)
private
Todo:
: Change this to an array of good ticks rather than hardcoded in here.

Definition at line 293 of file LogTransform.cxx.

References AxisModelBase::getTickStep().

Referenced by LogTransform::adjustValues(), and LogTransform::genTicks().

◆ prevStep()

double prevStep ( double  current,
AxisModelBase axis 
)
private
Todo:
Change this to an array of good ticks rather than hardcoded in here.

Definition at line 335 of file LogTransform.cxx.

References AxisModelBase::getTickStep().

Referenced by LogTransform::adjustValues(), and LogTransform::setFirstTick().

◆ setFirstTick()

void setFirstTick ( AxisModelBase axis)
private

◆ setTicks()

const vector< AxisTick > & setTicks ( AxisModelBase axis)
virtual

Sets the vector of ticks along the axis to which this Log transform is applied.

Implements UnaryTransform.

Definition at line 117 of file LogTransform.cxx.

References LogTransform::genTicks(), LogTransform::setFirstTick(), and LogTransform::setTickStep().

Referenced by LogTransform::validate().

◆ setTickStep()

void setTickStep ( AxisModelBase axis)
private

◆ transform() [1/2]

void transform ( double &  x) const
virtual

Transforms the coordinate @ x.

If the coordinate is non-positive, it is transformed to -DBL_MAX as defined in float.h.

Implements UnaryTransform.

Definition at line 72 of file LogTransform.cxx.

Referenced by LogTransform::inverseTransform().

◆ transform() [2/2]

void transform ( std::vector< double > &  x) const
virtual

Transforms each element of the vector x.

If any element is non positive, it is transformed to -DBL_MAX.

Implements UnaryTransform.

Definition at line 84 of file LogTransform.cxx.

◆ validate()

void validate ( Range range) const
virtual

Validates the Range, and adjusts the argument Range so that the values are positive.

Implements UnaryTransform.

Definition at line 101 of file LogTransform.cxx.

References Range::high(), Range::low(), Range::pos(), Range::setHigh(), Range::setLow(), and LogTransform::setTicks().

Member Data Documentation

◆ m_limits

const Range m_limits
protectedinherited

The valid Range of the transform.

Definition at line 41 of file UnaryTransform.h.

Referenced by UnaryTransform::limits().

◆ m_name

std::string m_name
protectedinherited

◆ m_ticks

std::vector< AxisTick > m_ticks
private

The ticks generated by this transform.

Definition at line 34 of file LogTransform.h.

Referenced by LogTransform::genTicks().


The documentation for this class was generated from the following files:

Generated for HippoDraw Class Library by doxygen