FeatherPlot.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 FEATHERPLOT_H_
00027 #define FEATHERPLOT_H_
00028 
00029 #include <QList>
00030 #include <qwt_plot.h>
00031 #include <qwt_legend.h>
00032 
00033 class QwtPlotCurve;
00034 class QGridLayout;
00035 
00036 namespace casa {
00037 
00038 class ExternalAxisControlBottom;
00039 class ExternalAxisControlRight;
00040 class ExternalAxisControlLeft;
00041 class ExternalAxisControl;
00042 class ExternalAxis;
00043 class FeatherCurve;
00044 
00045 class FeatherPlot : public QwtPlot {
00046 
00047 friend class ExternalAxisControlBottom;
00048 friend class ExternalAxisControlRight;
00049 friend class ExternalAxisControlLeft;
00050 
00051 public:
00052         FeatherPlot(QWidget* parent );
00053         enum PlotType { SLICE_CUT, SCATTER_PLOT, NO_TYPE };
00054         virtual ~FeatherPlot();
00055         void clearCurves();
00056         void clearLegend();
00057         void resetLegend();
00058 
00059         void addCurve( QVector<double> xValues, QVector<double> yValues,
00060                         QColor curveColor, const QString& curveTitle, QwtPlot::Axis yAxis, bool sumCurve );
00061         void addAxisTitle( QwtPlot::Axis axis, const QString& title );
00062         void addDiagonal( QVector<double> xValues, QColor lineColor, QwtPlot::Axis yAxis );
00063         void initializePlot( const QString& title, PlotType plotType );
00064 
00065         //Preferences
00066         void setFunctionColor( const QString& curveID, const QColor& color );
00067         void setLineThickness( int thickness );
00068         void setDotSize( int dotSize );
00069         void setLegendVisibility( bool visible );
00074         bool setLogScale( bool uvScale, bool ampScale );
00075 
00076         //Legend
00077         void insertSingleLegend( QWidget* parent );
00078         QWidget* getExternalAxisControl( QwtPlot::Axis position );
00079 
00080         //Accessors
00081         FeatherPlot::PlotType getPlotType() const;
00082         bool isLogUV() const;
00083         bool isLogAmplitude() const;
00084         bool isEmpty() const;
00085         bool isScatterPlot() const;
00086         bool isSliceCut() const;
00087 
00088 
00089         static const QString Y_EQUALS_X;
00090 
00091 private:
00092         void setCurvePenColor( int curveIndex, const QColor& color );
00093         int getCurveIndex( const QString& curveTitle ) const;
00094         void setCurveSize( int curveIndex );
00095         void updateAxes();
00096         void updateAxis( int index );
00097         void setAxisLabels();
00098         void adjustPlotBounds( std::pair<double,double> curveBounds, QwtPlot::Axis yAxis );
00099         void resetPlotBounds();
00100         void setLegendSize();
00101         void initAxes( );
00102         void setCurveData( FeatherCurve* curve, QwtPlot::Axis yAxis );
00103 
00104         QwtLegend* externalLegend;
00105         QWidget* legendParent;
00106         PlotType plotType;
00107 
00108         int lineThickness;
00109         int dotSize;
00110         bool scaleLogAmplitude;
00111         bool scaleLogUV;
00112 
00113         const int AXIS_COUNT;
00114         const int MINIMUM_LEGEND_LINE_WIDTH;
00115 
00116     QList<FeatherCurve*> curves;
00117 
00118     //External axis drawing support
00119     QList<QString> axisTitles;
00120     QList<QString> axisLabels;
00121     QList<ExternalAxisControl*> axisWidgets;
00122     QList<ExternalAxis*> axisBlanks;
00123 
00124     double minX;
00125     double maxX;
00126     double minY;
00127     double maxY;
00128     double minYRight;
00129     double maxYRight;
00130 };
00131 
00132 } /* namespace casa */
00133 #endif /* FEATHERPLOT_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1