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

A Periodic transform that transforms coordinates from one 2D coordinate system to another. More...

#include <PeriodicBinaryTransform.h>

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

Public Member Functions

virtual void adjustValues (AxisModelBase &model, hippodraw::Axes::Type axes, const Range &limit)
 Sets the range of given axis to be a new "nice" within the limits given.
virtual double aspectRatio () const
 Returns the aspect ratio.
virtual Rect calcRectangle (const Range &x, const Range &y)
 Returns a rectangle enclosing the transformed data space.
virtual BinaryTransformclone () const =0
 Creates a new XYTransform object by copying an existing one.
virtual bool inverseTransform (double &lon, double &lat) const
 Transform the transformed coordinates on X and Y axis back to the original true data space.
void inverseTransformZ (double &z) const
 Inverse transforms the z coordinate.
virtual bool isLinearInXY () const
 Returns true if the transform would be one to one on both the X and Y axes.
virtual bool isLinearInZ () const
 Returns true if the transform would be one to one on Z axes.
bool isPeriodic () const
 Sets whether this transform is periodic.
virtual const RangelimitX () const
 Returns the Range limits of the first coordinate.
virtual const RangelimitY () const
 Returns the Range limits of the second coordinate.
const RangelimitZ () const
 Returns the Range limits on the third coordinate.
double moduloAdd (double a1, double a2, hippodraw::Axes::Type axis) const
 Modulo Addition along either X or Y axis.
double moduloAddX (double x1, double x2) const
 Modulo Addition along X axis.
double moduloAddY (double y1, double y2) const
 Modulo Addition along Y axis.
double moduloSub (double s1, double s2, hippodraw::Axes::Type axis) const
 Modulo Subtraction along either X or Y axis.
double moduloSubX (double x1, double x2) const
 Modulo Subtraction along X axis.
double moduloSubY (double y1, double y2) const
 Modulo Subtraction along Y axis.
const std::string & name () const
 Returns the name of the Transform.
bool needsGrid () const
 Returns whether this transform needs grid.
bool needsXTicks () const
 Returns whether this transform needs x ticks.
bool needsYTicks () const
 Returns whether this transform needs y ticks.
void setNeedsGrid (bool needs_grid)
 Sets whether this transform needs grid.
void setNeedsXTicks (bool needs_x_ticks)
 Sets whether this transform needs x ticks.
void setNeedsYTicks (bool needs_y_ticks)
 Sets whether this transform needs y yicks.
virtual const std::vector
< AxisTick > & 
setTicks (AxisModelBase &axis_model, hippodraw::Axes::Type axis)
void setXOffset (double x_offset)
 Sets the xOffset of the (periodic) transform.
void setYOffset (double y_offset)
 Sets the yOffset of the (periodic) transform.
void setZTransform (TransformBase *transform)
 Sets the transform function on the Z axis.
virtual void transform (double &lon, double &lat) const
 Transform the coordinates on the X and Y axes.
virtual void transform (std::vector< double > &lon, std::vector< double > &lat) const
 A transform on two axes.
void transformZ (double &z) const
 Transforms the z coordinate.
virtual void validate (Range &lat, Range &lon) const
 Validates the Ranges.
double xOffset () const
 Returns the xOffset of the (periodic) transform.
double yOffset () const
 Returns the yOffset of the (periodic) transform.
TransformBasezTransform () const
 Returns the transform function on the Z axis.
virtual ~PeriodicBinaryTransform ()
 The virtual destructor.

Protected Member Functions

const std::vector< AxisTick > & genTicks (AxisModelBase &axis, hippodraw::Axes::Type axistype)
 Generates the ticks in the axis.
void initwcs (const std::string &transformName, double *crpix, double *crval, double *cdelt, double crota2, bool galactic)
 Initialize the WCS transform type.
 PeriodicBinaryTransform ()
 The default constructor.
 PeriodicBinaryTransform (UnaryTransform *, bool=false, bool=false, bool=true, bool=true, double=-180, double=+180, double=-90, double=+90)
 The constructor that take the z transform as argument also it takes and argument which states if it is a periodic transformation (default false), next optional argument says if this transform needs a grid or not (default is false), and if it needs x and y ticks or not (Default is true).
 PeriodicBinaryTransform (const PeriodicBinaryTransform &)
 The copy constructor.
void setFirstTick (AxisModelBase &axis)
 Sets the first tick on the axis.
void setTickStep (AxisModelBase &axis)
 Helps to decide the tick size for the corresponding axis.
void throwWCSMissing () const
 Throws an exception if WCSLIB support is missing.

Protected Attributes

bool m_is_periodic
 Is this transform periodic.
std::string m_name
 Name of the Transform.
bool m_needs_grid
 Does this binary transform needs grid?
bool m_needs_x_ticks
 Does this binary transform x ticks?
bool m_needs_y_ticks
 Does this binary transform y ticks?
std::vector< AxisTickm_ticks
 The ticks last generated by this transform.
wcsprm * m_wcs
char m_wcs_struct [2000]
Range m_x_limits
 The limits on X axis of the transform.
double m_x_offset
 The xoffset of this periodic transform.
Range m_y_limits
 The limits on Y axis of the transform.
double m_y_offset
 The yoffset of this periodic transform.
UnaryTransformm_z
 The transform on the Z axis.

Detailed Description

A Periodic transform that transforms coordinates from one 2D coordinate system to another.

Author
kaustuv kaust.nosp@m.uv@s.nosp@m.tanfo.nosp@m.rd.e.nosp@m.du
Xie Fang xiefa.nosp@m.ng@s.nosp@m.tanfo.nosp@m.rd.e.nosp@m.du

Definition at line 39 of file PeriodicBinaryTransform.h.

Constructor & Destructor Documentation

PeriodicBinaryTransform ( )
protected

The default constructor.

Should never be called.

. Sets the function name to "nil". Should be overriden by derived class. If function name is "nil", then that indicated error condition that default constructor was called directly.

Definition at line 47 of file PeriodicBinaryTransform.cxx.

PeriodicBinaryTransform ( UnaryTransform z,
bool  is_periodic = false,
bool  needs_grid = false,
bool  needs_x_ticks = true,
bool  needs_y_ticks = true,
double  xlo = -180,
double  xhi = +180,
double  ylo = -90,
double  yhi = +90 
)
protected

The constructor that take the z transform as argument also it takes and argument which states if it is a periodic transformation (default false), next optional argument says if this transform needs a grid or not (default is false), and if it needs x and y ticks or not (Default is true).

Finally we introduce xlo, xhi, ylow and yhi which define the appropriate limits on X and Y axis

Definition at line 56 of file PeriodicBinaryTransform.cxx.

The copy constructor.

Definition at line 72 of file PeriodicBinaryTransform.cxx.

The virtual destructor.

Definition at line 81 of file PeriodicBinaryTransform.cxx.

Member Function Documentation

void adjustValues ( AxisModelBase model,
hippodraw::Axes::Type  axes,
const Range limit 
)
virtual

Sets the range of given axis to be a new "nice" within the limits given.

Todo:
This code is duplicated and should move up the hierarchy.

Implements BinaryTransform.

Definition at line 302 of file PeriodicBinaryTransform.cxx.

double aspectRatio ( ) const
virtualinherited

Returns the aspect ratio.

Some transforms require a specific ration of the width to the height of the display. Returning a value of 2.0, for example, means that the width should be twice the height. Returning a value of 0.0 means any aspect ratio may be used.

Reimplemented from TransformBase.

Reimplemented in XYTransform, HammerAito2, HammerAito, Mercator, Mercator2, AIR, AIR2, ARC, ARC2, Cartesian, Cartesian2, GlobalSinusoidal, GlobalSinusoidal2, Lambert, Lambert2, SIN, SIN2, STG, STG2, TAN, and TAN2.

Definition at line 81 of file BinaryTransform.cxx.

Referenced by XyPlotter::getShape().

Rect calcRectangle ( const Range x,
const Range y 
)
virtual

Returns a rectangle enclosing the transformed data space.

Implements BinaryTransform.

Definition at line 201 of file PeriodicBinaryTransform.cxx.

References Range::high(), Range::low(), and PeriodicBinaryTransform::transform().

virtual BinaryTransform* clone ( ) const
pure virtualinherited

Creates a new XYTransform object by copying an existing one.

Implements TransformBase.

Implemented in HammerAito2, HammerAito, XYTransform, Mercator, Mercator2, AIR, AIR2, ARC, ARC2, Cartesian, Cartesian2, GlobalSinusoidal, GlobalSinusoidal2, Lambert, Lambert2, SIN, SIN2, STG, STG2, TAN, and TAN2.

const vector< AxisTick > & genTicks ( AxisModelBase axis,
hippodraw::Axes::Type  axistype 
)
protected
void initwcs ( const std::string &  transformName,
double *  crpix,
double *  crval,
double *  cdelt,
double  crota2,
bool  galactic 
)
protected
bool inverseTransform ( double &  x,
double &  y 
) const
virtual

Transform the transformed coordinates on X and Y axis back to the original true data space.

Return true if success, else return false.

Implements BinaryTransform.

Definition at line 544 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_wcs, and PeriodicBinaryTransform::throwWCSMissing().

void inverseTransformZ ( double &  z) const
inherited

Inverse transforms the z coordinate.

Definition at line 106 of file BinaryTransform.cxx.

References UnaryTransform::inverseTransform(), and BinaryTransform::m_z.

bool isLinearInXY ( ) const
virtual

Returns true if the transform would be one to one on both the X and Y axes.

Clients can use this function to avoid calling the transform in for loops.

Implements BinaryTransform.

Definition at line 459 of file PeriodicBinaryTransform.cxx.

bool isLinearInZ ( ) const
virtualinherited

Returns true if the transform would be one to one on Z axes.

Clients can use this function to avoid calling the transform in for loops.

Definition at line 153 of file BinaryTransform.cxx.

References UnaryTransform::isLinear(), and BinaryTransform::m_z.

Referenced by ContourPointRep::getContour().

bool isPeriodic ( ) const
inherited
const Range & limitX ( ) const
virtual

Returns the Range limits of the first coordinate.

Implements BinaryTransform.

Definition at line 86 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_x_limits.

const Range & limitY ( ) const
virtual

Returns the Range limits of the second coordinate.

Implements BinaryTransform.

Definition at line 92 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_y_limits.

const Range & limitZ ( ) const
inherited

Returns the Range limits on the third coordinate.

Definition at line 112 of file BinaryTransform.cxx.

References UnaryTransform::limits(), and BinaryTransform::m_z.

Referenced by CompositePlotter::autoScaleZ(), and CompositePlotter::setRangePrivate().

double moduloAdd ( double  a1,
double  a2,
hippodraw::Axes::Type  axis 
) const
double moduloAddX ( double  x1,
double  x2 
) const
double moduloAddY ( double  y1,
double  y2 
) const
double moduloSub ( double  s1,
double  s2,
hippodraw::Axes::Type  axis 
) const

Modulo Subtraction along either X or Y axis.

Definition at line 135 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::moduloSubX(), PeriodicBinaryTransform::moduloSubY(), hippodraw::Axes::X, and hippodraw::Axes::Y.

double moduloSubX ( double  x1,
double  x2 
) const
double moduloSubY ( double  y1,
double  y2 
) const
const string & name ( ) const
inherited
bool needsGrid ( ) const
inherited

Returns whether this transform needs grid.

Definition at line 118 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_grid.

Referenced by BinaryTransform::BinaryTransform().

bool needsXTicks ( ) const
inherited

Returns whether this transform needs x ticks.

Definition at line 128 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_x_ticks.

Referenced by BinaryTransform::BinaryTransform(), and CompositePlotter::drawAxisRep().

bool needsYTicks ( ) const
inherited

Returns whether this transform needs y ticks.

Definition at line 138 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_y_ticks.

Referenced by BinaryTransform::BinaryTransform(), and CompositePlotter::drawAxisRep().

void setFirstTick ( AxisModelBase axis)
protected

Sets the first tick on the axis.

Definition at line 339 of file PeriodicBinaryTransform.cxx.

References AxisModelBase::getRange(), Range::low(), and AxisModelBase::setFirstTick().

Referenced by PeriodicBinaryTransform::setTicks().

void setNeedsGrid ( bool  needs_grid)
inherited

Sets whether this transform needs grid.

Definition at line 123 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_grid.

void setNeedsXTicks ( bool  needs_x_ticks)
inherited

Sets whether this transform needs x ticks.

Definition at line 133 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_x_ticks.

void setNeedsYTicks ( bool  needs_y_ticks)
inherited

Sets whether this transform needs y yicks.

Definition at line 143 of file BinaryTransform.cxx.

References BinaryTransform::m_needs_y_ticks.

const vector< AxisTick > & setTicks ( AxisModelBase model,
hippodraw::Axes::Type  axis 
)
virtual
Todo:
Are the implementations of the functions called, duplicates of what is in the derived classes of LinearTransform?

Implements BinaryTransform.

Definition at line 288 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::genTicks(), BinaryTransform::m_z, PeriodicBinaryTransform::setFirstTick(), PeriodicBinaryTransform::setTickStep(), and hippodraw::Axes::Z.

void setTickStep ( AxisModelBase axis)
protected
void setXOffset ( double  x_offset)

Sets the xOffset of the (periodic) transform.

Definition at line 103 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_x_offset.

Referenced by Inspector::autoScale_clicked(), Inspector::rotateY(), Inspector::setHighRange(), and Inspector::setYRotateText().

void setYOffset ( double  y_offset)

Sets the yOffset of the (periodic) transform.

Definition at line 113 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_y_offset.

Referenced by Inspector::autoScale_clicked(), Inspector::rotateX(), Inspector::setHighRange(), and Inspector::setXRotateText().

void setZTransform ( TransformBase transform)
inherited

Sets the transform function on the Z axis.

The transform object must be derived class of UnaryTransform, otherwise the transform object pointer is set to null.

Definition at line 93 of file BinaryTransform.cxx.

References BinaryTransform::m_z, and BinaryTransform::transform().

void throwWCSMissing ( ) const
protected

Throws an exception if WCSLIB support is missing.

Definition at line 505 of file PeriodicBinaryTransform.cxx.

Referenced by PeriodicBinaryTransform::initwcs(), PeriodicBinaryTransform::inverseTransform(), and PeriodicBinaryTransform::transform().

void transform ( double &  x,
double &  y 
) const
virtual

Transform the coordinates on the X and Y axes.

Attention
The arguments are passed by reference so the values may changed.

Implements BinaryTransform.

Definition at line 517 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_wcs, and PeriodicBinaryTransform::throwWCSMissing().

Referenced by PeriodicBinaryTransform::calcRectangle().

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

A transform on two axes.

Implements BinaryTransform.

Definition at line 578 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_wcs, num_util::size(), and PeriodicBinaryTransform::throwWCSMissing().

void transformZ ( double &  z) const
inherited
void validate ( Range x,
Range y 
) const
virtual

Validates the Ranges.

Adjusts Ranges to be restricted to that which is valid for the transform.

Implements BinaryTransform.

Definition at line 274 of file PeriodicBinaryTransform.cxx.

References Range::high(), Range::low(), PeriodicBinaryTransform::m_x_limits, PeriodicBinaryTransform::m_y_limits, Range::setHigh(), and Range::setLow().

double xOffset ( ) const
double yOffset ( ) const
TransformBase * zTransform ( ) const
inherited

Returns the transform function on the Z axis.

Definition at line 86 of file BinaryTransform.cxx.

References BinaryTransform::m_z.

Referenced by DisplayController::getLog(), and DisplayController::setLog().

Member Data Documentation

bool m_is_periodic
protectedinherited

Is this transform periodic.

Definition at line 57 of file BinaryTransform.h.

Referenced by BinaryTransform::BinaryTransform(), and BinaryTransform::isPeriodic().

std::string m_name
protectedinherited
bool m_needs_grid
protectedinherited

Does this binary transform needs grid?

Definition at line 48 of file BinaryTransform.h.

Referenced by BinaryTransform::BinaryTransform(), BinaryTransform::needsGrid(), and BinaryTransform::setNeedsGrid().

bool m_needs_x_ticks
protectedinherited

Does this binary transform x ticks?

Definition at line 51 of file BinaryTransform.h.

Referenced by BinaryTransform::BinaryTransform(), BinaryTransform::needsXTicks(), and BinaryTransform::setNeedsXTicks().

bool m_needs_y_ticks
protectedinherited

Does this binary transform y ticks?

Definition at line 54 of file BinaryTransform.h.

Referenced by BinaryTransform::BinaryTransform(), BinaryTransform::needsYTicks(), and BinaryTransform::setNeedsYTicks().

std::vector< AxisTick > m_ticks
protected

The ticks last generated by this transform.

Definition at line 94 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::genTicks().

wcsprm* m_wcs
protected
char m_wcs_struct[2000]
protected

Definition at line 56 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::initwcs().

Range m_x_limits
protected
double m_x_offset
protected

The xoffset of this periodic transform.

Definition at line 66 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::setXOffset(), and PeriodicBinaryTransform::xOffset().

Range m_y_limits
protected
double m_y_offset
protected

The yoffset of this periodic transform.

Definition at line 69 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::setYOffset(), and PeriodicBinaryTransform::yOffset().

UnaryTransform* m_z
protectedinherited

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

Generated for HippoDraw Class Library by doxygen