QtPlotSettings.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef QTPLOTSETTINGS_H
00027 #define QTPLOTSETTINGS_H
00028
00029 #include <cmath>
00030 #include <QString>
00031 #include <utility>
00032 #include <coordinates/Coordinates/SpectralCoordinate.h>
00033
00034 namespace casa {
00035
00036 class QtPlotSettings {
00037 public:
00038 QtPlotSettings( );
00039 void adjust( const QString& topUnits, const QString& topType, const QString& bottomUnits,
00040 const QString& bottomType, bool autoScaleX, bool autoScaleY, bool zoom = false );
00041 void setSpectralCoordinate( const SpectralCoordinate& coord );
00042 void zoomOut( double zoomFactor, const QString& topUnits, const QString& topType,
00043 const QString& bottomUnits, const QString& bottomType,
00044 bool autoScaleX, bool autoScaleY );
00045 void zoomIn( double zoomFactor, const QString& topUnits, const QString& topType,
00046 const QString& bottomUnits, const QString& bottomType,
00047 bool autoScaleX, bool autoScaleY );
00048 void zoomY( double minY, double maxY, bool autoScaleY );
00049 pair<double,double> getZoomInY( double zoomFactor ) const;
00050 pair<double,double> getZoomOutY( double zoomFactor ) const;
00051
00052 void scroll(int dx, int dy);
00053 enum AxisIndex {xBottom, xTop, END_AXIS_INDEX };
00054 double spanX( AxisIndex index ) const {
00055 return maxX[static_cast<int>(index)] - minX[static_cast<int>(index)];
00056 }
00057 double spanY() const {
00058 return maxY - minY;
00059 }
00060 double getMinX( AxisIndex index ) const {
00061 return minX[static_cast<int>(index)];
00062 }
00063 void setMinX( AxisIndex index, double value );
00064 double getMaxX( AxisIndex index ) const {
00065 return maxX[static_cast<int>(index)];
00066 }
00067 void setMaxX( AxisIndex index, double value );
00068 double getMinY() const {
00069 return minY;
00070 }
00071
00072 void setMinY( double value );
00073 double getMaxY() const {
00074 return maxY;
00075 }
00076
00077 void setMaxY( double value );
00078 int getNumTicksX( ) const {
00079 return numXTicks;
00080 }
00081 int getNumTicksY() const {
00082 return numYTicks;
00083 }
00084
00085 double getTickLabelX(int tickIndex, int tickCount, QtPlotSettings::AxisIndex axisIndex ) const;
00086
00087 static const QString RADIO_VELOCITY;
00088 static const QString OPTICAL_VELOCITY;
00089 static const QString OPTICAL_WAVELENGTH;
00090 static const double ZERO_LIMIT;
00091
00092 private:
00093
00094 pair<double,double> adjustAxis(double &min, double &max, int &numTicks);
00095
00096 void adjustAxisTop( double &min, double &max);
00097 std::pair<double,double> convertBottomBounds(
00098 double min, double max, const QString& topUnits, const QString& unitType );
00099 MDoppler::Types getDoppler( const QString& unitType );
00100 double getTickValue(int tickIndex, int tickCount,
00101 QtPlotSettings::AxisIndex axisIndex) const;
00102 double minX[END_AXIS_INDEX];
00103 double maxX[END_AXIS_INDEX];
00104 int numXTicks;
00105 double minY;
00106 double maxY;
00107 double minPercentage;
00108 double maxPercentage;
00109 int numYTicks;
00110 QString m_topType;
00111 QString m_bottomType;
00112 QString m_topUnits;
00113 QString m_bottomUnits;
00114
00115
00116 SpectralCoordinate m_spectralCoordinate;
00117
00118 };
00119
00120
00121 }
00122 #endif
00123