casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtPlotSettings.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef QTPLOTSETTINGS_H
27 #define QTPLOTSETTINGS_H
28 
29 #include <cmath>
30 #include <QString>
31 #include <utility> /***for std::pair***/
33 
34 namespace casa {
35 
37  public:
38  QtPlotSettings( );
39  void adjust( const QString& topUnits, const QString& topType, const QString& bottomUnits,
40  const QString& bottomType, bool autoScaleX, bool autoScaleY, bool zoom = false );
42  void zoomOut( double zoomFactor, const QString& topUnits, const QString& topType,
43  const QString& bottomUnits, const QString& bottomType,
44  bool autoScaleX, bool autoScaleY );
45  void zoomIn( double zoomFactor, const QString& topUnits, const QString& topType,
46  const QString& bottomUnits, const QString& bottomType,
47  bool autoScaleX, bool autoScaleY );
48  void zoomY( double minY, double maxY, bool autoScaleY );
49  std::pair<double,double> getZoomInY( double zoomFactor ) const;
50  std::pair<double,double> getZoomOutY( double zoomFactor ) const;
51 
52  void scroll(int dx, int dy);
54  double spanX( AxisIndex index ) const {
55  return maxX[static_cast<int>(index)] - minX[static_cast<int>(index)];
56  }
57  double spanY() const {
58  return maxY - minY;
59  }
60  double getMinX( AxisIndex index ) const {
61  return minX[static_cast<int>(index)];
62  }
63  void setMinX( AxisIndex index, double value );
64  double getMaxX( AxisIndex index ) const {
65  return maxX[static_cast<int>(index)];
66  }
67  void setMaxX( AxisIndex index, double value );
68  double getMinY() const {
69  return minY;
70  }
71 
72  void setMinY( double value );
73  double getMaxY() const {
74  return maxY;
75  }
76 
77  void setMaxY( double value );
78  int getNumTicksX( ) const {
79  return numXTicks;
80  }
81  int getNumTicksY() const {
82  return numYTicks;
83  }
84 
85  double getTickLabelX(int tickIndex, int tickCount, QtPlotSettings::AxisIndex axisIndex ) const;
86 
87  static const QString &RADIO_VELOCITY( ) {
88  static QString result("radio velocity");
89  return result;
90  }
91  static const QString &OPTICAL_VELOCITY( ) {
92  static QString result("optical velocity");
93  return result;
94  }
95  static const QString &OPTICAL_WAVELENGTH( ) {
96  static QString result("air wavelength");
97  return result;
98  }
99  static constexpr double ZERO_LIMIT = 0.0000000000000005f;
100 
101  private:
102 
103  std::pair<double,double> adjustAxis(double &min, double &max, int &numTicks);
104 
105  void adjustAxisTop( double &min, double &max);
106  std::pair<double,double> convertBottomBounds(
107  double min, double max, const QString& topUnits, const QString& unitType );
108  casacore::MDoppler::Types getDoppler( const QString& unitType );
109  double getTickValue(int tickIndex, int tickCount,
110  QtPlotSettings::AxisIndex axisIndex) const;
114  double minY;
115  double maxY;
119  QString m_topType;
120  QString m_bottomType;
121  QString m_topUnits;
122  QString m_bottomUnits;
123 
124  //Used for conversions
126 
127  };
128 
129 
130 }
131 #endif
132 
double getMinX(AxisIndex index) const
void setMinX(AxisIndex index, double value)
double maxX[END_AXIS_INDEX]
casacore::SpectralCoordinate m_spectralCoordinate
Used for conversions.
void setMaxY(double value)
void adjustAxisTop(double &min, double &max)
double spanX(AxisIndex index) const
#define max(a, b)
Definition: hio.h:44
double minX[END_AXIS_INDEX]
static constexpr double ZERO_LIMIT
#define min(a, b)
Definition: hio.h:45
static const QString & OPTICAL_VELOCITY()
void zoomOut(double zoomFactor, const QString &topUnits, const QString &topType, const QString &bottomUnits, const QString &bottomType, bool autoScaleX, bool autoScaleY)
void scroll(int dx, int dy)
double spanY() const
void zoomIn(double zoomFactor, const QString &topUnits, const QString &topType, const QString &bottomUnits, const QString &bottomType, bool autoScaleX, bool autoScaleY)
std::pair< double, double > convertBottomBounds(double min, double max, const QString &topUnits, const QString &unitType)
double getMaxY() const
static const QString & RADIO_VELOCITY()
double getTickLabelX(int tickIndex, int tickCount, QtPlotSettings::AxisIndex axisIndex) const
int getNumTicksY() const
double getMaxX(AxisIndex index) const
std::pair< double, double > getZoomOutY(double zoomFactor) const
void setSpectralCoordinate(const casacore::SpectralCoordinate &coord)
void setMaxX(AxisIndex index, double value)
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
void adjust(const QString &topUnits, const QString &topType, const QString &bottomUnits, const QString &bottomType, bool autoScaleX, bool autoScaleY, bool zoom=false)
static const QString & OPTICAL_WAVELENGTH()
Interconvert pixel and frequency values.
double getTickValue(int tickIndex, int tickCount, QtPlotSettings::AxisIndex axisIndex) const
std::pair< double, double > adjustAxis(double &min, double &max, int &numTicks)
void setMinY(double value)
std::pair< double, double > getZoomInY(double zoomFactor) const
casacore::MDoppler::Types getDoppler(const QString &unitType)
int getNumTicksX() const
void zoomY(double minY, double maxY, bool autoScaleY)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
double getMinY() const