casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FeatherPlot.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 FEATHERPLOT_H_
27 #define FEATHERPLOT_H_
28 
29 #include <QList>
30 #include <qwt_plot.h>
31 #include <qwt_legend.h>
32 
33 class QwtPlotCurve;
34 class QGridLayout;
35 
36 namespace casa {
37 
38 class ExternalAxisControlBottom;
39 class ExternalAxisControlRight;
40 class ExternalAxisControlLeft;
41 class ExternalAxisControl;
42 class ExternalAxis;
43 class FeatherCurve;
44 
45 class FeatherPlot : public QwtPlot {
46 
50 
51 public:
52  FeatherPlot(QWidget* parent );
54  virtual ~FeatherPlot();
55  void clearCurves();
56  void clearLegend();
57  void resetLegend();
58 
59  void addCurve( QVector<double> xValues, QVector<double> yValues,
60  QColor curveColor, const QString& curveTitle, QwtPlot::Axis yAxis, bool sumCurve );
61  void addAxisTitle( QwtPlot::Axis axis, const QString& title );
62  void addDiagonal( QVector<double> xValues, QColor lineColor, QwtPlot::Axis yAxis );
63  void initializePlot( const QString& title, PlotType plotType );
64 
65  //Preferences
66  void setFunctionColor( const QString& curveID, const QColor& color );
67  void setLineThickness( int thickness );
68  void setDotSize( int dotSize );
69  void setLegendVisibility( bool visible );
74  bool setLogScale( bool uvScale, bool ampScale );
75 
76  //Legend
77  void insertSingleLegend( QWidget* parent );
78  QWidget* getExternalAxisControl( QwtPlot::Axis position );
79 
80  //Accessors
82  bool isLogUV() const;
83  bool isLogAmplitude() const;
84  bool isEmpty() const;
85  bool isScatterPlot() const;
86  bool isSliceCut() const;
87 
88 
89  static const QString Y_EQUALS_X;
90 
91 private:
92  void setCurvePenColor( int curveIndex, const QColor& color );
93  int getCurveIndex( const QString& curveTitle ) const;
94  void setCurveSize( int curveIndex );
95  void updateAxes();
96  void updateAxis( int index );
97  void setAxisLabels();
98  void adjustPlotBounds( std::pair<double,double> curveBounds, QwtPlot::Axis yAxis );
99  void resetPlotBounds();
100  void setLegendSize();
101  void initAxes( );
102  void setCurveData( FeatherCurve* curve, QwtPlot::Axis yAxis );
103 
104  QwtLegend* externalLegend;
105  QWidget* legendParent;
107 
109  int dotSize;
112 
113  const int AXIS_COUNT;
115 
116  QList<FeatherCurve*> curves;
117 
118  //External axis drawing support
119  QList<QString> axisTitles;
120  QList<QString> axisLabels;
121  QList<ExternalAxisControl*> axisWidgets;
122  QList<ExternalAxis*> axisBlanks;
123 
124  double minX;
125  double maxX;
126  double minY;
127  double maxY;
128  double minYRight;
129  double maxYRight;
130 };
131 
132 } /* namespace casa */
133 #endif /* FEATHERPLOT_H_ */
void setDotSize(int dotSize)
void initializePlot(const QString &title, PlotType plotType)
void setLineThickness(int thickness)
void adjustPlotBounds(std::pair< double, double > curveBounds, QwtPlot::Axis yAxis)
bool setLogScale(bool uvScale, bool ampScale)
Returns true if the uvScale changed.
FeatherPlot::PlotType getPlotType() const
Accessors.
void setCurvePenColor(int curveIndex, const QColor &color)
QwtLegend * externalLegend
Definition: FeatherPlot.h:104
QList< QString > axisTitles
External axis drawing support.
Definition: FeatherPlot.h:119
void addDiagonal(QVector< double > xValues, QColor lineColor, QwtPlot::Axis yAxis)
QWidget * legendParent
Definition: FeatherPlot.h:105
void setLegendVisibility(bool visible)
QList< ExternalAxis * > axisBlanks
Definition: FeatherPlot.h:122
void setCurveData(FeatherCurve *curve, QwtPlot::Axis yAxis)
void addCurve(QVector< double > xValues, QVector< double > yValues, QColor curveColor, const QString &curveTitle, QwtPlot::Axis yAxis, bool sumCurve)
QWidget * getExternalAxisControl(QwtPlot::Axis position)
bool isLogUV() const
Represents a curve on one of the plots.
Definition: FeatherCurve.h:44
const int AXIS_COUNT
Definition: FeatherPlot.h:113
QList< QString > axisLabels
Definition: FeatherPlot.h:120
virtual ~FeatherPlot()
bool isLogAmplitude() const
void insertSingleLegend(QWidget *parent)
Legend.
void setCurveSize(int curveIndex)
int getCurveIndex(const QString &curveTitle) const
bool isScatterPlot() const
FeatherPlot(QWidget *parent)
static const QString Y_EQUALS_X
Definition: FeatherPlot.h:89
void setFunctionColor(const QString &curveID, const QColor &color)
Preferences.
QList< ExternalAxisControl * > axisWidgets
Definition: FeatherPlot.h:121
void addAxisTitle(QwtPlot::Axis axis, const QString &title)
void updateAxis(int index)
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
const int MINIMUM_LEGEND_LINE_WIDTH
Definition: FeatherPlot.h:114
bool isEmpty() const
bool isSliceCut() const
QList< FeatherCurve * > curves
Definition: FeatherPlot.h:116