PlotMSRegions.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
00026
00027 #ifndef PLOTMSREGIONS_H_
00028 #define PLOTMSREGIONS_H_
00029
00030 #include <plotms/PlotMS/PlotMSConstants.h>
00031
00032 #include <map>
00033
00034 namespace casa {
00035
00036
00037 class PlotMSRegion {
00038 public:
00039
00040
00041 PlotMSRegion();
00042
00043
00044 PlotMSRegion(double xMin, double xMax, double yMin, double yMax);
00045
00046
00047 PlotMSRegion(const PlotMSRegion& copy);
00048
00049
00050 ~PlotMSRegion();
00051
00052
00053
00054
00055 bool isValid() const;
00056
00057
00058
00059 bool contains(double x, double y, bool exclusive = true) const;
00060
00061
00062
00063 double left() const { return xMin(); }
00064 double right() const { return xMax(); }
00065 double bottom() const { return yMin(); }
00066 double top() const { return yMax(); }
00067
00068 double xMin() const;
00069 double xMax() const;
00070 double yMin() const;
00071 double yMax() const;
00072
00073
00074
00075
00076 void setValues(double xMin, double xMax, double yMin, double yMax);
00077 void setX(double min, double max);
00078 void setY(double min, double max);
00079 void setXMin(double val);
00080 void setXMax(double val);
00081 void setYMin(double val);
00082 void setYMax(double val);
00083 void setLeft(double val) { setXMin(val); }
00084 void setRight(double val) { setXMax(val); }
00085 void setBottom(double val) { setYMin(val); }
00086 void setTop(double val) { setYMax(val); }
00087
00088
00089
00090
00091
00092 bool operator==(const PlotMSRegion& region) const;
00093 bool operator!=(const PlotMSRegion& region) const {
00094 return !(operator==(region)); }
00095
00096
00097
00098 PlotMSRegion& operator=(const PlotMSRegion& copy);
00099
00100 private:
00101
00102 double itsXMin_, itsXMax_, itsYMin_, itsYMax_;
00103 };
00104
00105
00106
00107
00108
00109 class PlotMSRegions {
00110 public:
00111
00112 PlotMSRegions();
00113
00114
00115 ~PlotMSRegions();
00116
00117
00118
00119 Vector<std::pair<PMS::Axis, PMS::Axis> > allAxisPairs() const;
00120
00121
00122 bool hasRegionsFor(PMS::Axis x, PMS::Axis y) const;
00123
00124
00125 Vector<PlotMSRegion> regionsFor(PMS::Axis x, PMS::Axis y) const;
00126
00127
00128
00129
00130 void addRegions(PMS::Axis x, PMS::Axis y, const vector<PlotMSRegion>& r) {
00131 addRegions(x, y, Vector<PlotMSRegion>(r)); }
00132 void addRegions(PMS::Axis x, PMS::Axis y, const Vector<PlotMSRegion>& r);
00133
00134
00135
00136
00137 void addRegions(PMS::Axis x, PMS::Axis y, PlotCanvasPtr canvas);
00138
00139
00140
00141
00142 void setRegions(PMS::Axis x, PMS::Axis y, const vector<PlotMSRegion>& r) {
00143 setRegions(x, y, Vector<PlotMSRegion>(r)); }
00144 void setRegions(PMS::Axis x, PMS::Axis y, const Vector<PlotMSRegion>& r);
00145
00146
00147
00148
00149 void setRegions(PMS::Axis x, PMS::Axis y, PlotCanvasPtr canvas);
00150
00151
00152 void clearRegions(PMS::Axis x, PMS::Axis y);
00153
00154 private:
00155
00156 typedef std::map<std::pair<PMS::Axis, PMS::Axis>, Vector<PlotMSRegion> > PMSRMap;
00157
00158
00159 PMSRMap itsRegions_;
00160 };
00161
00162 }
00163
00164 #endif