00001
00002
00014 #ifndef _PeriodicBinaryTransform_H_
00015 #define _PeriodicBinaryTransform_H_
00016
00017 #ifdef _MSC_VER
00018 #include "msdevstudio/MSconfig.h"
00019 #endif
00020
00021 #include "BinaryTransform.h"
00022
00023 #include "axes/AxisTick.h"
00024 #include "axes/Range.h"
00025
00026
00027
00028 struct wcsprm;
00029
00030
00031 namespace hippodraw {
00032
00039 class MDL_HIPPOPLOT_API PeriodicBinaryTransform : public BinaryTransform
00040 {
00041
00042 protected:
00043
00045 void initwcs(const std::string &transformName, double* crpix,
00046 double* crval, double* cdelt,
00047 double crota2, bool galactic);
00048
00051 void throwWCSMissing () const;
00052
00053
00054
00055 wcsprm* m_wcs;
00056 char m_wcs_struct[2000];
00057
00058
00060 Range m_x_limits;
00061
00063 Range m_y_limits;
00064
00066 double m_x_offset;
00067
00069 double m_y_offset;
00070
00072 PeriodicBinaryTransform();
00073
00080 PeriodicBinaryTransform ( UnaryTransform *, bool = false, bool = false,
00081 bool = true, bool = true,
00082 double = -180, double = +180,
00083 double = -90, double = +90);
00084
00086 PeriodicBinaryTransform ( const PeriodicBinaryTransform & );
00087
00088
00089
00090
00091
00094 std::vector < AxisTick > m_ticks;
00095
00097 void setTickStep( AxisModelBase & axis );
00098
00100 void setFirstTick( AxisModelBase & axis );
00101
00103 const std::vector < AxisTick > &
00104 genTicks ( AxisModelBase & axis, hippodraw::Axes::Type axistype );
00105
00106
00107 public:
00108
00110 virtual ~PeriodicBinaryTransform();
00111
00113 virtual const Range & limitX() const;
00114
00116 virtual const Range & limitY() const;
00117
00119 double xOffset() const;
00120
00122 void setXOffset ( double x_offset );
00123
00125 double yOffset() const;
00126
00128 void setYOffset( double y_offset );
00129
00131 double moduloAdd ( double a1, double a2, hippodraw::Axes::Type axis ) const;
00132
00134 double moduloSub ( double s1, double s2, hippodraw::Axes::Type axis ) const;
00135
00137 double moduloAddX ( double x1, double x2 ) const;
00138
00140 double moduloAddY ( double y1, double y2 ) const;
00141
00143 double moduloSubX ( double x1, double x2 ) const;
00144
00146 double moduloSubY ( double y1, double y2 ) const;
00147
00148
00149 virtual Rect calcRectangle ( const Range & x,
00150 const Range & y );
00151
00152 virtual void validate ( Range & lat, Range & lon ) const;
00153
00154 virtual const std::vector < AxisTick > &
00155 setTicks ( AxisModelBase & axis_model, hippodraw::Axes::Type axis );
00156
00161 virtual void adjustValues ( AxisModelBase & model,
00162 hippodraw::Axes::Type axes,
00163 const Range & limit );
00164
00165
00166 virtual bool isLinearInXY () const;
00167
00168
00169 virtual void transform (double & lon, double & lat) const;
00170 virtual bool inverseTransform (double & lon, double & lat) const;
00171 virtual void transform ( std::vector< double > & lon,
00172 std::vector< double > & lat) const;
00173
00174 };
00175
00176 }
00177
00178 #endif // _PeriodicBinaryTransform_H_