# Cartesian Class Reference

`#include <Cartesian.h>`

Inheritance diagram for Cartesian:

[legend]
Collaboration diagram for Cartesian:

[legend]

## Detailed Description

A transform that performs the Cartesian projection.

Definition at line 24 of file Cartesian.h.

## 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.
Cartesian (const Cartesian &)
The copy constructor.
Cartesian (UnaryTransform *z)
The constructor.
virtual Cartesianclone () const
Creates a new Transform 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
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.
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 (std::vector< double > &lon, std::vector< double > &lat) const
A transform on two axes.
virtual void transform (double &lon, double &lat) const
Transform the coordinates on the X and Y 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 ~Cartesian ()
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.
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.

## Constructor & Destructor Documentation

 Cartesian ( UnaryTransform * z )

The constructor.

The constructor taking a UnaryTransform for its Z axis.

Definition at line 18 of file Cartesian.cxx.

References PeriodicBinaryTransform::initwcs(), and TransformBase::m_name.

Referenced by Cartesian::clone().

 Cartesian ( const Cartesian & t )

The copy constructor.

Definition at line 29 of file Cartesian.cxx.

References PeriodicBinaryTransform::initwcs().

 ~Cartesian ( ) ` [virtual]`

The virtual destructor.

Definition at line 37 of file Cartesian.cxx.

## Member Function Documentation

 void adjustValues ( AxisModelBase & model, hippodraw::Axes::Type axes, const Range & limit ) ` [virtual, inherited]`

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

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` [virtual]`

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 BinaryTransform.

Definition at line 53 of file Cartesian.cxx.

 Rect calcRectangle ( const Range & x, const Range & y ) ` [virtual, inherited]`

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().

 Cartesian * clone ( ) const` [virtual]`

Creates a new Transform object by copying an existing one.

Implements BinaryTransform.

Definition at line 44 of file Cartesian.cxx.

References Cartesian::Cartesian().

 const vector< AxisTick > & genTicks ( AxisModelBase & axis, hippodraw::Axes::Type axistype ) ` [protected, inherited]`

Generates the ticks in the axis.

Todo:
Handle too many ticks better, rather than doing nothing. See more detailed comment in code.

Do not use sprintf, it cause warnings from VS 8.

Definition at line 353 of file PeriodicBinaryTransform.cxx.

Referenced by PeriodicBinaryTransform::setTicks().

 void initwcs ( const std::string & transformName, double * crpix, double * crval, double * cdelt, double crota2, bool galactic ) ` [protected, inherited]`

Initialize the WCS transform type.

Definition at line 472 of file PeriodicBinaryTransform.cxx.

 bool inverseTransform ( double & x, double & y ) const` [virtual, inherited]`

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.

 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, inherited]`

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` [virtual, inherited]`

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]`

Sets whether this transform is periodic.

Definition at line 148 of file BinaryTransform.cxx.

References BinaryTransform::m_is_periodic.

 const Range & limitX ( ) const` [virtual, inherited]`

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, inherited]`

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` [inherited]`

Modulo Addition along either X or Y axis.

Definition at line 122 of file PeriodicBinaryTransform.cxx.

 double moduloAddX ( double x1, double x2 ) const` [inherited]`

Definition at line 146 of file PeriodicBinaryTransform.cxx.

 double moduloAddY ( double y1, double y2 ) const` [inherited]`

Definition at line 175 of file PeriodicBinaryTransform.cxx.

 double moduloSub ( double s1, double s2, hippodraw::Axes::Type axis ) const` [inherited]`

Modulo Subtraction along either X or Y axis.

Definition at line 135 of file PeriodicBinaryTransform.cxx.

 double moduloSubX ( double x1, double x2 ) const` [inherited]`

Modulo Subtraction along X axis.

Definition at line 161 of file PeriodicBinaryTransform.cxx.

 double moduloSubY ( double y1, double y2 ) const` [inherited]`

Modulo Subtraction along Y axis.

Definition at line 190 of file PeriodicBinaryTransform.cxx.

 const string & name ( ) const` [inherited]`

Returns the name of the Transform.

Definition at line 45 of file TransformBase.cxx.

References TransformBase::m_name.

 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, inherited]`

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, inherited]`

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.

 void setTickStep ( AxisModelBase & axis ) ` [protected, inherited]`

Helps to decide the tick size for the corresponding axis.

Definition at line 316 of file PeriodicBinaryTransform.cxx.

Referenced by PeriodicBinaryTransform::setTicks().

 void setXOffset ( double x_offset ) ` [inherited]`

Sets the xOffset of the (periodic) transform.

Definition at line 103 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_x_offset.

 void setYOffset ( double y_offset ) ` [inherited]`

Sets the yOffset of the (periodic) transform.

Definition at line 113 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_y_offset.

 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.

 void throwWCSMissing ( ) const` [protected, inherited]`

Throws an exception if WCSLIB support is missing.

Definition at line 505 of file PeriodicBinaryTransform.cxx.

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

A transform on two axes.

Implements BinaryTransform.

Definition at line 578 of file PeriodicBinaryTransform.cxx.

 void transform ( double & x, double & y ) const` [virtual, inherited]`

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.

Referenced by PeriodicBinaryTransform::calcRectangle().

 void transformZ ( double & z ) const` [inherited]`

Transforms the z coordinate.

Definition at line 100 of file BinaryTransform.cxx.

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

 void validate ( Range & x, Range & y ) const` [virtual, inherited]`

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.

 double xOffset ( ) const` [inherited]`

Returns the xOffset of the (periodic) transform.

Definition at line 98 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_x_offset.

 double yOffset ( ) const` [inherited]`

Returns the yOffset of the (periodic) transform.

Definition at line 108 of file PeriodicBinaryTransform.cxx.

References PeriodicBinaryTransform::m_y_offset.

 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` [protected, inherited]`

Is this transform periodic.

Definition at line 57 of file BinaryTransform.h.

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

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

 bool m_needs_grid` [protected, inherited]`

Does this binary transform needs grid?

Definition at line 48 of file BinaryTransform.h.

 bool m_needs_x_ticks` [protected, inherited]`

Does this binary transform x ticks?

Definition at line 51 of file BinaryTransform.h.

 bool m_needs_y_ticks` [protected, inherited]`

Does this binary transform y ticks?

Definition at line 54 of file BinaryTransform.h.

 std::vector< AxisTick > m_ticks` [protected, inherited]`

The ticks last generated by this transform.

Definition at line 94 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::genTicks().

 wcsprm* m_wcs` [protected, inherited]`

Definition at line 55 of file PeriodicBinaryTransform.h.

 char m_wcs_struct[2000]` [protected, inherited]`

Definition at line 56 of file PeriodicBinaryTransform.h.

Referenced by PeriodicBinaryTransform::initwcs().

 Range m_x_limits` [protected, inherited]`

The limits on X axis of the transform.

Definition at line 60 of file PeriodicBinaryTransform.h.

 double m_x_offset` [protected, inherited]`

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, inherited]`

The limits on Y axis of the transform.

Definition at line 63 of file PeriodicBinaryTransform.h.

 double m_y_offset` [protected, inherited]`

The yoffset of this periodic transform.

Definition at line 69 of file PeriodicBinaryTransform.h.

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

 UnaryTransform* m_z` [protected, inherited]`

The transform on the Z axis.

Definition at line 45 of file BinaryTransform.h.

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