CanvasCurve.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 #ifndef CANVASCURVE_H_
00026 #define CANVASCURVE_H_
00027
00028 #include <casa/aips.h>
00029 #include <casa/Arrays/Vector.h>
00030 #include <coordinates/Coordinates/SpectralCoordinate.h>
00031 #include <vector>
00032 #include <utility>
00033 #include <QColor>
00034 #include <QString>
00035
00040 namespace casa {
00041
00042 typedef std::vector<double> CurveData;
00043 typedef std::vector<double> ErrorData;
00044
00045 class CanvasCurve {
00046 public:
00047 CanvasCurve();
00048 CanvasCurve( CurveData curveData, ErrorData errorData,
00049 QString legend, QColor curveColor, int curveType,
00050 double beamAngle, double beamArea, SpectralCoordinate coord);
00051 QColor getColor() const;
00052 void setColor( QColor color );
00053 QString getLegend() const;
00054 void setLegend( const QString& legend );
00055 int getCurveType() const;
00056 CurveData getCurveData();
00057 Vector<float> getXValues() const;
00058 Vector<float> getYValues() const;
00059 CurveData getErrorData();
00060
00061
00062 QString getToolTip( double x, double y , const QString& xUnit, const QString& yUnit ) const;
00063 void getMinMax(Double& xmin, Double& xmax, Double& ymin,
00064 Double& ymax, bool plotError ) const;
00065 std::pair<double,double> getRangeFor(double xMin, double xMax, Bool& exists );
00066 void scaleYValues( const QString& oldDisplayUnits, const QString& yUnitDisplay, const QString& xUnits );
00067 double convertValue( double value, double freqValue, const QString& oldDisplayUnits, const QString& yUnitDisplay,
00068 const QString& xUnits, SpectralCoordinate& coord);
00069 virtual ~CanvasCurve();
00070
00071 private:
00072 Vector<float> getErrorValues() const;
00073 double getMaxY() const;
00074 double getMaxError() const;
00075 void storeData( const QString& oldUnits );
00076 void setYValues( const Vector<float>& yValues );
00077 void setErrorValues( const Vector<float>& errorValues );
00078 double calculateRelativeError( double minValue, double maxValue ) const ;
00079 void calculateRelativeErrors( double& errorX, double& errorY ) const;
00080 QColor curveColor;
00081 QString legend;
00082 CurveData curveData;
00083 ErrorData errorData;
00084 QString maxUnits;
00085 double maxValue;
00086 double maxErrorValue;
00087 double beamAngle;
00088 double beamArea;
00089 int curveType;
00090 SpectralCoordinate spectralCoordinate;
00091
00092 };
00093
00094 }
00095 #endif