QtPlotSettings.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef QTPLOTSETTINGS_H
00027 #define QTPLOTSETTINGS_H
00028 
00029 #include <cmath>
00030 #include <QString>
00031 #include <utility>              /***for std::pair***/
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                 //Used for conversions
00116                 SpectralCoordinate m_spectralCoordinate;
00117 
00118         };
00119 
00120 
00121 }
00122 #endif
00123 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1