CanvasCurve.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 #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>                      /***for std::pair***/
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 } /* namespace casa */
00095 #endif /* CANVASCURVE_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1