PlotMSPlotParameterGroups.h

Go to the documentation of this file.
00001 //# PlotMSPlotParameterGroups.h: Implementations of plot subparameter groups.
00002 //# Copyright (C) 2009
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: $
00027 #ifndef PLOTMSPLOTPARAMETERGROUPS_H_
00028 #define PLOTMSPLOTPARAMETERGROUPS_H_
00029 
00030 #include <plotms/Plots/PlotMSPlotParameters.h>
00031 
00032 #include <plotms/PlotMS/PlotMSAveraging.h>
00033 #include <plotms/PlotMS/PlotMSExportParam.h>
00034 #include <plotms/PlotMS/PlotMSIterParam.h>
00035 #include <plotms/PlotMS/PlotMSSelection.h>
00036 #include <plotms/PlotMS/PlotMSTransformations.h>
00037 #include <plotms/PlotMS/PlotMSCalibration.h>
00038 #include <plotms/PlotMS/PlotMSLabelFormat.h>
00039 
00040 namespace casa {
00041 
00042 // Container class to hold constants for groups.
00043 class PMS_PP {
00044 
00045 public:
00046         // Update flag for redrawing.
00047         // <group>
00048         static const String UPDATE_REDRAW_NAME;
00049         static const int UPDATE_REDRAW;
00050         // </group>
00051 
00052         // Update flag for MS data group.
00053         // <group>
00054         static const String UPDATE_MSDATA_NAME;
00055         static const int UPDATE_MSDATA;
00056         // </group>
00057 
00058         // Update flag for cache group.
00059         // <group>
00060         static const String UPDATE_CACHE_NAME;
00061         static const int UPDATE_CACHE;
00062         // </group>
00063 
00064         // Update flag for axes group.
00065         // <group>
00066         static const String UPDATE_AXES_NAME;
00067         static const int UPDATE_AXES;
00068         // </group>
00069 
00070         // Update flag for canvas group.
00071         // <group>
00072         static const String UPDATE_CANVAS_NAME;
00073         static const int UPDATE_CANVAS;
00074         // </group>
00075 
00076         // Update flag for display group.
00077         // <group>
00078         static const String UPDATE_DISPLAY_NAME;
00079         static const int UPDATE_DISPLAY;
00080         // </group>
00081 
00082         // Update flag for iteration group.
00083         // <group>
00084         static const String UPDATE_ITERATION_NAME;
00085         static const int UPDATE_ITERATION;
00086         // </group>
00087 
00088         // Update flag for log group.
00089         // <group>
00090         static const String UPDATE_LOG_NAME;
00091         static const int UPDATE_LOG;
00092         // </group>
00093         //
00094         // Update flag for plotms_options group.
00095         // <group>
00096         static const String UPDATE_PLOTMS_OPTIONS_NAME;
00097         static const int UPDATE_PLOTMS_OPTIONS;
00098         // </group>
00099 
00100 private:
00101         // Disable constructor.
00102         PMS_PP() {
00103         }
00104 };
00105 
00106 
00107 
00108 
00109 // Subclass of PlotMSPlotParameters::Group to handle subparameters for MS data.
00110 // Currently includes:
00111 // * filename
00112 // * selection
00113 // * averaging
00114 //
00115 class PMS_PP_MSData : public PlotMSPlotParameters::Group {
00116 
00117 public:
00118         /* Constructor which takes a factory */
00119         PMS_PP_MSData (PlotFactoryPtr factory);
00120 
00121         /* Copy constructor.  See operator=(). */
00122         PMS_PP_MSData (const PMS_PP_MSData & copy);
00123         ~PMS_PP_MSData();
00124 
00125 
00126         /* Overrides PlotMSPlotParameters::Group::operator=(). */
00127         Group *clone() const {
00128                 return new PMS_PP_MSData (*this);
00129         }
00130 
00131         /* Implements PlotMSPlotParameters::Group::name(). */
00132         const String & name() const {
00133                 static String groupName = PMS_PP::UPDATE_MSDATA_NAME;
00134                 return groupName;
00135         }
00136 
00137         /* Implements PlotMSPlotParameters::Group::toRecord(). */
00138         Record toRecord() const;
00139 
00140         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
00141         void fromRecord (const Record & record);
00142 
00143         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
00144         bool requiresRedrawOnChange() const {
00145                 return true;
00146         }
00147 
00148         /* Overrides the real assignment operator, operator=(). */
00149         PMS_PP_MSData& operator=(const PMS_PP_MSData& other);
00150 
00151         /* Overrides PlotMSPlotParameters::Group::operator=(). */
00152         PMS_PP_MSData & operator= (const Group & other);
00153 
00154         /* Overrides PlotMSPlotParameters::Group::operator==(). */
00155         bool operator== (const Group & other) const;
00156 
00157 
00158         bool isSet() const {
00159                 return !itsFilename_.empty();
00160         }
00161 
00162         const String & filename() const {
00163                 return itsFilename_;
00164         }
00165         void setFilename (const String & value) {
00166                 if (itsFilename_ != value) {
00167                         itsFilename_ = value;
00168                         updated();
00169                 }
00170         }
00171 
00172         const PlotMSSelection & selection() const {
00173                 return itsSelection_;
00174         }
00175         void setSelection (const PlotMSSelection & value) {
00176                 if (itsSelection_ != value) {
00177                         itsSelection_ = value;
00178                         updated();
00179                 }
00180         }
00181 
00182 
00183         const PlotMSAveraging & averaging() const {
00184                 return itsAveraging_;
00185         }
00186         void setAveraging (const PlotMSAveraging & value) {
00187                 if (itsAveraging_ != value) {
00188                         itsAveraging_ = value;
00189                         updated();
00190                 }
00191         }
00192 
00193 
00194         const PlotMSTransformations & transformations() const {
00195                 return itsTransformations_;
00196         }
00197         void setTransformations (const PlotMSTransformations & value) {
00198                 if (itsTransformations_ != value) {
00199                         itsTransformations_ = value;
00200                         updated();
00201                 }
00202         }
00203 
00204 
00205         const PlotMSCalibration & calibration() const {
00206                 return itsCalibration_;
00207         }
00208         void setCalibration (const PlotMSCalibration & value) {
00209                 if (itsCalibration_ != value) {
00210                         itsCalibration_ = value;
00211                         updated();
00212                 }
00213         }
00214 
00215 private:
00216         //Does the work of the operator=()s.
00217         PMS_PP_MSData& assign(const PMS_PP_MSData* other);
00218 
00219         /* Parameters' values */
00220         String itsFilename_;
00221         PlotMSSelection itsSelection_;
00222         PlotMSAveraging itsAveraging_;
00223         PlotMSTransformations itsTransformations_;
00224         PlotMSCalibration itsCalibration_;
00225 
00226         /* Key strings for Record */
00227         static const String REC_FILENAME;
00228         static const String REC_SELECTION;
00229         static const String REC_AVERAGING;
00230         static const String REC_TRANSFORMATIONS;
00231         static const String REC_CALIBRATION;
00232 
00233 
00234         void setDefaults();
00235 };
00236 
00237 
00238 
00239 
00240 
00241 
00242 // Subclass of PlotMSPlotParameters::Group to handle cache parameters.
00243 // Currently includes:
00244 // * x and y axes
00245 // * x and y data columns
00246 // Parameters are vector-based, on a per-plot basis.
00247 //
00248 class PMS_PP_Cache : public PlotMSPlotParameters::Group {
00249 
00250 public:
00251         /* Constructor which takes a factory */
00252         PMS_PP_Cache (PlotFactoryPtr factory);
00253 
00254         /* Copy constructor.  See operator=(). */
00255         PMS_PP_Cache (const PMS_PP_Cache & copy);
00256 
00257         ~PMS_PP_Cache();
00258 
00259         /* Implements PlotMSPlotParameters::Group::clone(). */
00260         Group *clone() const {
00261                 return new PMS_PP_Cache (*this);
00262         }
00263 
00264         /* Implements PlotMSPlotParameters::Group::name(). */
00265         const String & name() const {
00266                 static String groupName = PMS_PP::UPDATE_CACHE_NAME;
00267                 return groupName;
00268         }
00269 
00270         /* Implements PlotMSPlotParameters::Group::toRecord(). */
00271         Record toRecord() const;
00272 
00273         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
00274         void fromRecord (const Record & record);
00275 
00276         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
00277         bool requiresRedrawOnChange() const {
00278                 return true;
00279         }
00280 
00281         /* Overrides the real assignment operator=().*/
00282         PMS_PP_Cache& operator=(const PMS_PP_Cache& other);
00283 
00284         /* Overrides PlotMSPlotParameters::Group::operator=(). */
00285         PMS_PP_Cache & operator= (const Group & other);
00286 
00287         /* Overrides PlotMSPlotParameters::Group::operator==(). */
00288         bool operator== (const Group & other) const;
00289 
00290 
00291 
00292         // Gets how many axes and data columns there are.
00293         // <group>
00294         unsigned int numXAxes() const;
00295         unsigned int numYAxes() const;
00296         // </group>
00297 
00298 
00299         // Setting the data and data columns for the x- and y-axes
00300         // <group>
00301         void setXAxis (const PMS::Axis & axis, const PMS::DataColumn & data,
00302                         unsigned int index = 0);
00303         void setYAxis (const PMS::Axis & axis, const PMS::DataColumn & data,
00304                         unsigned int index = 0);
00305         void setAxes (const PMS::Axis & xAxis, const PMS::Axis & yAxis,
00306                         const PMS::DataColumn & xData,
00307                         const PMS::DataColumn & yData, unsigned int index = 0);
00308         //<group>
00309 
00310         const vector<PMS::Axis> &xAxes() const {
00311                 return itsXAxes_;
00312         }
00313         void setXAxes (const vector<PMS::Axis> &value) {
00314                 if (itsXAxes_ != value) {
00315                         itsXAxes_ = value;
00316                         updated();
00317                 }
00318         }
00319         PMS::Axis xAxis (unsigned int index = 0) const {
00320                 if (index >= itsXAxes_.size())
00321                         const_cast< vector<PMS::Axis>& >(itsXAxes_).resize (index + 1);
00322                 return itsXAxes_[index];
00323         }
00324         void setXAxis (const PMS::Axis & value, unsigned int index = 0) {
00325                 if (index >= itsXAxes_.size())
00326                         itsXAxes_.resize (index + 1);
00327                 if (itsXAxes_[index] != value) {
00328                         itsXAxes_[index] = value;
00329                         updated();
00330                 }
00331         }
00332 
00333 
00334         const vector<PMS::Axis>&yAxes() const {
00335                 return itsYAxes_;
00336         }
00337         void setYAxes (const vector<PMS::Axis> &value) {
00338                 if (itsYAxes_ != value) {
00339                         itsYAxes_ = value;
00340                         updated();
00341                 }
00342         }
00343         PMS::Axis yAxis (unsigned int index = 0) const {
00344                 if (index >= itsYAxes_.size())
00345                         const_cast< vector<PMS::Axis> &>(itsYAxes_).resize (index + 1);
00346                 return itsYAxes_[index];
00347         }
00348         void setYAxis (const PMS::Axis & value, unsigned int index = 0) {
00349                 if (index >= itsYAxes_.size())
00350                         itsYAxes_.resize (index + 1);
00351                 if (itsYAxes_[index] != value)   {
00352                         itsYAxes_[index] = value;
00353                         updated();
00354                 }
00355         }
00356 
00357 
00358 
00359         const vector<PMS::DataColumn> &xDataColumns() const {
00360                 return itsXData_;
00361         }
00362         void setXDataColumns (const vector < PMS::DataColumn > &value) {
00363                 if (itsXData_ != value)   {
00364                         itsXData_ = value;
00365                         updated();
00366                 }
00367         }
00368         PMS::DataColumn xDataColumn (unsigned int index = 0) const {
00369                 if (index >= itsXData_.size())
00370                         const_cast < vector < PMS::DataColumn >
00371                 &>(itsXData_).resize (index + 1);
00372                 return itsXData_[index];
00373         }
00374         void setXDataColumn (const PMS::DataColumn & value, unsigned int index =
00375                         0) {
00376                 if (index >= itsXData_.size())
00377                         itsXData_.resize (index + 1);
00378                 if (itsXData_[index] != value)   {
00379                         itsXData_[index] = value;
00380                         updated();
00381                 }
00382         }
00383 
00384 
00385         const vector < PMS::DataColumn > &yDataColumns() const {
00386                 return itsYData_;
00387         }
00388         void setYDataColumns (const vector < PMS::DataColumn > &value) {
00389                 if (itsYData_ != value) {
00390                         itsYData_ = value;
00391                         updated();
00392                 }
00393         }
00394         PMS::DataColumn yDataColumn (unsigned int index = 0) const {
00395                 if (index >= itsYData_.size())
00396                         const_cast < vector < PMS::DataColumn >
00397                 &>(itsYData_).resize (index + 1);
00398                 return itsYData_[index];
00399         }
00400         void setYDataColumn (const PMS::DataColumn & value, unsigned int index =
00401                         0) {
00402                 if (index >= itsYData_.size())
00403                         itsYData_.resize (index + 1);
00404                 if (itsYData_[index] != value)   {
00405                         itsYData_[index] = value;
00406                         updated();
00407                 }
00408         }
00409 
00410         void resize( int count );
00411 
00412 private:
00413         //Does the work for the operator=()s.
00414         PMS_PP_Cache& assign(const PMS_PP_Cache* o);
00415 
00416         /* Parameters' values */
00417         vector<PMS::Axis> itsXAxes_;
00418         vector<PMS::Axis> itsYAxes_;
00419         vector<PMS::DataColumn> itsXData_;
00420         vector<PMS::DataColumn> itsYData_;
00421 
00422         /* Key strings for Record */
00423         static const String REC_XAXES;
00424         static const String REC_YAXES;
00425         static const String REC_XDATACOLS;
00426         static const String REC_YDATACOLS;
00427 
00428 
00429         void setDefaults();
00430 };
00431 
00432 
00433 
00434 
00435 
00436 
00437 // Subclass of PlotMSPlotParameters::Group to handle axes parameters.
00438 // Currently includes:
00439 // * canvas attach axes
00440 // * axes ranges, if any
00441 // Parameters are vector-based, on a per-plot basis.
00442 //
00443 class PMS_PP_Axes : public PlotMSPlotParameters::Group {
00444 
00445 public:
00446         /* Constructor which takes a factory */
00447         PMS_PP_Axes (PlotFactoryPtr factory);
00448 
00449         /* Copy constructor.  See operator=(). */
00450         PMS_PP_Axes (const PMS_PP_Axes & copy);
00451 
00452         ~PMS_PP_Axes();
00453 
00454 
00455         /* Implements PlotMSPlotParameters::Group::clone(). */
00456         Group *clone() const {
00457                 return new PMS_PP_Axes (*this);
00458         }
00459 
00460         /* Implements PlotMSPlotParameters::Group::name(). */
00461         const String & name() const {
00462                 static String groupName = PMS_PP::UPDATE_AXES_NAME;
00463                 return groupName;
00464         }
00465 
00466         /* Implements PlotMSPlotParameters::Group::toRecord(). */
00467         Record toRecord() const;
00468 
00469         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
00470         void fromRecord (const Record & record);
00471 
00472         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
00473         bool requiresRedrawOnChange() const {
00474                 return true;
00475         }
00476 
00477         /* Overrides the real assignment operator, operator= */
00478         PMS_PP_Axes& operator=(const PMS_PP_Axes& other);
00479 
00480         /* Overrides PlotMSPlotParameters::Group::operator=(). */
00481         PMS_PP_Axes & operator= (const Group & other);
00482 
00483         /* Overrides PlotMSPlotParameters::Group::operator==(). */
00484         bool operator== (const Group & other) const;
00485 
00486 
00487         // Gets how many axes there are.
00488         // <group>
00489         unsigned int numXAxes() const;
00490         unsigned int numYAxes() const;
00491         // </group>
00492 
00493 
00494         // Sets single versions of the parameters for the given index.
00495         // <group>
00496         void setAxes (const PlotAxis & xAxis, const PlotAxis & yAxis,
00497                         unsigned int index = 0);
00498         void setXRange (const bool & set, const prange_t & range,
00499                         unsigned int index = 0) {
00500                 setRanges (set, yRangeSet (index), range, yRange (index), index);
00501         }
00502         void setYRange (const bool & set, const prange_t & range,
00503                         unsigned int index = 0) {
00504                 setRanges (xRangeSet (index), set, xRange (index), range, index);
00505         }
00506         void setRanges (const bool & xSet, const bool & ySet,
00507                         const prange_t & xRange, const prange_t & yRange,
00508                         unsigned int index = 0);
00509         // </group>
00510 
00511 
00512         const vector < PlotAxis > &xAxes() const {
00513                 return itsXAxes_;
00514         }
00515         void setXAxes (const vector < PlotAxis > &value) {
00516                 if (itsXAxes_ != value) {
00517                         itsXAxes_ = value;
00518                         updated();
00519                 }
00520         }
00521 
00522 
00523         PlotAxis xAxis (unsigned int index = 0) const {
00524                 if (index >= itsXAxes_.size())
00525                         const_cast < vector < PlotAxis > &>(itsXAxes_).resize (index + 1);
00526                 return itsXAxes_[index];
00527         }
00528         void setXAxis(const PlotAxis & value, unsigned int index = 0) {
00529                 if (index >= itsXAxes_.size()){
00530                         itsXAxes_.resize (index + 1);
00531 
00532                 }
00533                 if (itsXAxes_[index] != value) {
00534 
00535                         itsXAxes_[index] = value;
00536                         updated();
00537                 }
00538         }
00539 
00540 
00541         const vector<PlotAxis> &yAxes() const {
00542                 return itsYAxes_;
00543         }
00544         void setYAxes (const vector < PlotAxis > &value) {
00545                 if (itsYAxes_ != value) {
00546                         itsYAxes_ = value;
00547                         updated();
00548                 }
00549         }
00550 
00551 
00552         PlotAxis yAxis (unsigned int index = 0) const {
00553                 if (index >= itsYAxes_.size())
00554                         const_cast < vector < PlotAxis > &>(itsYAxes_).resize (index + 1);
00555                 return itsYAxes_[index];
00556         }
00557         void setYAxis (const PlotAxis & value, unsigned int index = 0) {
00558                 if (index >= itsYAxes_.size())
00559                         itsYAxes_.resize (index + 1);
00560                 if (itsYAxes_[index] != value) {
00561                         itsYAxes_[index] = value;
00562                         updated();
00563                 }
00564         }
00565 
00566         void setYAxis( String& value, unsigned int index = 0 ){
00567                 PlotAxis axisLocation = Y_LEFT;
00568                 if ( value == "right"){
00569                         axisLocation = Y_RIGHT;
00570                 }
00571                 setYAxis( axisLocation, index );
00572         }
00573 
00574 
00575 
00576         const vector<bool> &xRangesSet() const {
00577                 return itsXRangesSet_;
00578         }
00579         void setXRanges (const vector < bool > &value) {
00580                 if (itsXRangesSet_ != value) {
00581                         itsXRangesSet_ = value;
00582                         updated();
00583                 }
00584         }
00585 
00586 
00587         bool xRangeSet (unsigned int index = 0) const {
00588                 if (index >= itsXRangesSet_.size())
00589                         const_cast < vector < bool > &>(itsXRangesSet_).resize (index + 1);
00590                 return itsXRangesSet_[index];
00591         }
00592         void setXRange (const bool & value, unsigned int index = 0) {
00593                 if (index >= itsXRangesSet_.size())
00594                         itsXRangesSet_.resize (index + 1);
00595                 if (itsXRangesSet_[index] != value) {
00596                         itsXRangesSet_[index] = value;
00597                         updated();
00598                 }
00599         }
00600 
00601 
00602         const vector < bool > &yRangesSet() const {
00603                 return itsYRangesSet_;
00604         }
00605         void setYRanges (const vector < bool > &value) {
00606                 if (itsYRangesSet_ != value) {
00607                         itsYRangesSet_ = value;
00608                         updated();
00609                 }
00610         }
00611 
00612 
00613         bool yRangeSet (unsigned int index = 0) const {
00614                 if (index >= itsYRangesSet_.size())
00615                         const_cast < vector < bool > &>(itsYRangesSet_).resize (index + 1);
00616                 return itsYRangesSet_[index];
00617         }
00618         void setYRange (const bool & value, unsigned int index = 0) {
00619                 if (index >= itsYRangesSet_.size())
00620                         itsYRangesSet_.resize (index + 1);
00621                 if (itsYRangesSet_[index] != value) {
00622                         itsYRangesSet_[index] = value;
00623                         updated();
00624                 }
00625         }
00626 
00627 
00628 
00629         const vector < prange_t > &xRanges() const {
00630                 return itsXRanges_;
00631         }
00632         void setXRanges (const vector < prange_t > &value) {
00633                 if (itsXRanges_ != value) {
00634                         itsXRanges_ = value;
00635                         updated();
00636                 }
00637         }
00638 
00639 
00640         const prange_t & xRange (unsigned int index = 0) const {
00641                 return itsXRanges_[index];
00642         }
00643         void setXRange (const prange_t & value, unsigned int index = 0) {
00644                 if (itsXRanges_[index] != value) {
00645                         itsXRanges_[index] = value;
00646                         updated();
00647                 }
00648         }
00649 
00650 
00651         const vector < prange_t > &yRanges() const {
00652                 return itsYRanges_;
00653         }
00654         void setYRanges (const vector < prange_t > &value) {
00655                 if (itsYRanges_ != value) {
00656                         itsYRanges_ = value;
00657                         updated();
00658                 }
00659         }
00660 
00661 
00662         const prange_t & yRange (unsigned int index = 0) const {
00663                 return itsYRanges_[index];
00664         }
00665         void setYRange (const prange_t & value, unsigned int index = 0) {
00666                 if (itsYRanges_[index] != value) {
00667                         itsYRanges_[index] = value;
00668                         updated();
00669                 }
00670         }
00671 
00672         //Change the size of the vectors.
00673         void resize( int count );
00674 
00675 private:
00676 
00677         //Does the work for operator=()s.
00678         PMS_PP_Axes& assign(const PMS_PP_Axes* o);
00679 
00680         /* Parameters' values */
00681         vector<PlotAxis> itsXAxes_;
00682         vector<PlotAxis> itsYAxes_;
00683         vector<bool> itsXRangesSet_;
00684         vector<bool> itsYRangesSet_;
00685         vector<prange_t> itsXRanges_;
00686         vector<prange_t> itsYRanges_;
00687 
00688         /* Key strings for Record */
00689         static const String REC_XAXES;
00690         static const String REC_YAXES;
00691         static const String REC_XRANGESSET;
00692         static const String REC_YRANGESSET;
00693         static const String REC_XRANGES;
00694         static const String REC_YRANGES;
00695 
00696 
00697         void setDefaults();
00698 };
00699 
00700 
00701 
00702 
00703 
00704 // Subclass of PlotMSPlotParameters::Group to handle canvas parameters.
00705 // Currently includes:
00706 // * axes label formats
00707 // * whether to show the canvas axes or not
00708 // * whether to show the legend or not, and its position
00709 // * canvas title label format
00710 // * whether to show grid lines, and their properties
00711 // Parameters are vector-based, on a per-canvas basis.
00712 //
00713 class PMS_PP_Canvas : public PlotMSPlotParameters::Group {
00714 
00715 public:
00716         /* Constructor which takes a factory */
00717         PMS_PP_Canvas (PlotFactoryPtr factory);
00718 
00719         /* Copy constructor.  See operator=(). */
00720         PMS_PP_Canvas (const PMS_PP_Canvas & copy);
00721 
00722         ~PMS_PP_Canvas();
00723 
00724         /* Implements PlotMSPlotParameters::Group::clone(). */
00725         Group *clone() const {
00726                 return new PMS_PP_Canvas (*this);
00727         }
00728 
00729         /* Implements PlotMSPlotParameters::Group::name(). */
00730         const String & name() const {
00731                 static String groupName = PMS_PP::UPDATE_CANVAS_NAME;
00732                 return groupName;
00733         }
00734 
00735         /* Implements PlotMSPlotParameters::Group::toRecord(). */
00736         Record toRecord() const;
00737 
00738         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
00739         void fromRecord (const Record & record);
00740 
00741         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
00742         bool requiresRedrawOnChange() const {
00743                 return true;
00744         }
00745 
00746         /* Overrides PlotMSPlotParameters::Group::operator=(). */
00747         PMS_PP_Canvas& operator= (const Group & other);
00748 
00749         /* Overrides the actual operator=(). */
00750         PMS_PP_Canvas& operator=(const PMS_PP_Canvas& other );
00751 
00752         /* Overrides PlotMSPlotParameters::Group::operator==(). */
00753         bool operator== (const Group & other) const;
00754 
00755 
00756         // Gets how many canvases there are.
00757         unsigned int numCanvases() const;
00758 
00759         // Sets single versions of the parameters for the given index.
00760         // <group>
00761         void setLabelFormats (const PlotMSLabelFormat & xFormat,
00762                         const PlotMSLabelFormat & yFormat,
00763                         unsigned int index = 0);
00764         void showAxes (const bool & xShow, const bool & yShow,
00765                         unsigned int index = 0);
00766         void showLegend (const bool & show,
00767                         const PlotCanvas::LegendPosition & pos,
00768                         unsigned int index = 0);
00769 
00770         void showLegend( const bool& show, const String& pos, unsigned int index=0);
00771 
00772         void showGridMajor (const bool & show, const PlotLinePtr & line,
00773                         unsigned int index = 0) {
00774                 showGrid (show, gridMinorShown (index), line, gridMinorLine (index),
00775                                 index);
00776         }
00777         void showGridMinor (const bool & show, const PlotLinePtr & line,
00778                         unsigned int index = 0) {
00779                 showGrid (gridMajorShown (index), show, gridMajorLine (index), line,
00780                                 index);
00781         }
00782         void showGrid (const bool & showMajor, const bool & showMinor,
00783                         const PlotLinePtr & majorLine,
00784                         const PlotLinePtr & minorLine, unsigned int index = 0);
00785         // </group>
00786 
00787 
00788 
00789         const vector < PlotMSLabelFormat > &xLabelFormats() const {
00790                 return itsXLabels_;
00791         }
00792         void setXLabelFormats (const vector < PlotMSLabelFormat > &value) {
00793                 if (itsXLabels_ != value) {
00794                         itsXLabels_ = value;
00795                         updated();
00796                 }
00797         }
00798         const PlotMSLabelFormat & xLabelFormat (unsigned int index = 0) const {
00799                 return itsXLabels_[index];
00800         }
00801         void setXLabelFormat (const PlotMSLabelFormat & value,
00802                         unsigned int index = 0) {
00803                 if (itsXLabels_[index] != value) {
00804                         itsXLabels_[index] = value;
00805                         updated();
00806                 }
00807         }
00808 
00809 
00810         const vector < PlotMSLabelFormat > &yLabelFormats() const {
00811                 return itsYLabels_;
00812         }
00813         void setYLabelFormats (const vector < PlotMSLabelFormat > &value) {
00814                 if (itsYLabels_ != value) {
00815                         itsYLabels_ = value;
00816                         updated();
00817                 }
00818         }
00819         const PlotMSLabelFormat & yLabelFormat (unsigned int index = 0) const {
00820                 return itsYLabels_[index];
00821         }
00822         void setYLabelFormat (const PlotMSLabelFormat & value,
00823                         unsigned int index = 0) {
00824                 if (itsYLabels_[index] != value) {
00825                         itsYLabels_[index] = value;
00826                         updated();
00827                 }
00828         }
00829 
00830         const vector < bool > &xFontsSet() const {
00831                 return itsXFontsSet_;
00832         }
00833         void setXFontsSet (const vector < bool > &value) {
00834                 if (itsXFontsSet_ != value) {
00835                         itsXFontsSet_ = value;
00836                         updated();
00837                 }
00838         }
00839         bool xFontSet (unsigned int index = 0) const {
00840                 return itsXFontsSet_[index];
00841         }
00842         void setXFontSet (const bool & value, unsigned int index = 0) {
00843                 if (itsXFontsSet_[index] != value) {
00844                         itsXFontsSet_[index] = value;
00845                         updated();
00846                 }
00847         }
00848     const vector < bool > &yFontsSet() const {
00849                 return itsYFontsSet_;
00850         }
00851         void setYFontsSet (const vector < bool > &value) {
00852                 if (itsYFontsSet_ != value) {
00853                         itsYFontsSet_ = value;
00854                         updated();
00855                 }
00856         }
00857         bool yFontSet (unsigned int index = 0) const {
00858                 return itsYFontsSet_[index];
00859         }
00860         void setYFontSet (const bool & value, unsigned int index = 0) {
00861                 if (itsYFontsSet_[index] != value) {
00862                         itsYFontsSet_[index] = value;
00863                         updated();
00864                 }
00865         }
00866 
00867     const vector < Int > &xAxisFonts() const {
00868                 return itsXAxisFonts_;
00869         }
00870         void setXAxisFonts (const vector < Int > &value) {
00871                 if (itsXAxisFonts_ != value) {
00872                         itsXAxisFonts_ = value;
00873                         updated();
00874                 }
00875         }
00876         const Int & xAxisFont (unsigned int index = 0) const {
00877                 return itsXAxisFonts_[index];
00878         }
00879         void setXAxisFont (const Int value, unsigned int index = 0) {
00880                 if (itsXAxisFonts_[index] != value) {
00881                         itsXAxisFonts_[index] = value;
00882                         updated();
00883                 }
00884         }
00885 
00886     const vector < Int > &yAxisFonts() const {
00887                 return itsYAxisFonts_;
00888         }
00889         void setYAxisFonts (const vector < Int > &value) {
00890                 if (itsYAxisFonts_ != value) {
00891                         itsYAxisFonts_ = value;
00892                         updated();
00893                 }
00894         }
00895         const Int & yAxisFont (unsigned int index = 0) const {
00896                 return itsYAxisFonts_[index];
00897         }
00898         void setYAxisFont (const Int value, unsigned int index = 0) {
00899                 if (itsYAxisFonts_[index] != value) {
00900                         itsYAxisFonts_[index] = value;
00901                         updated();
00902                 }
00903         }
00904 
00905 
00906         const vector < bool > &xAxesShown() const {
00907                 return itsXAxesShown_;
00908         }
00909         void showXAxes (const vector < bool > &value) {
00910                 if (itsXAxesShown_ != value) {
00911                         itsXAxesShown_ = value;
00912                         updated();
00913                 }
00914         }
00915         bool xAxisShown (unsigned int index = 0) const {
00916                 if (index >= itsXAxesShown_.size())
00917                         const_cast < vector < bool > &>(itsXAxesShown_).resize (index + 1);
00918                 return itsXAxesShown_[index];
00919         }
00920         void showXAxis (const bool & value, unsigned int index = 0) {
00921                 if (index >= itsXAxesShown_.size())
00922                         itsXAxesShown_.resize (index + 1);
00923                 if (itsXAxesShown_[index] != value) {
00924                         itsXAxesShown_[index] = value;
00925                         updated();
00926                 }
00927         }
00928 
00929 
00930         const vector < bool > &yAxesShown() const {
00931                 return itsYAxesShown_;
00932         }
00933         void showYAxes (const vector < bool > &value) {
00934                 if (itsYAxesShown_ != value) {
00935                         itsYAxesShown_ = value;
00936                         updated();
00937                 }
00938         }
00939         bool yAxisShown (unsigned int index = 0) const {
00940                 if (index >= itsYAxesShown_.size())
00941                         const_cast < vector < bool > &>(itsYAxesShown_).resize (index + 1);
00942                 return itsYAxesShown_[index];
00943         }
00944         void showYAxis (const bool & value, unsigned int index = 0) {
00945                 if (index >= itsYAxesShown_.size())
00946                         itsYAxesShown_.resize (index + 1);
00947                 if (itsYAxesShown_[index] != value) {
00948                         itsYAxesShown_[index] = value;
00949                         updated();
00950                 }
00951         }
00952 
00953 
00954         const vector < bool > &legendsShown() const {
00955                 return itsLegendsShown_;
00956         }
00957         void showLegends (const vector < bool > &value) {
00958                 if (itsLegendsShown_ != value) {
00959                         itsLegendsShown_ = value;
00960                         updated();
00961                 }
00962         }
00963         bool legendShown (unsigned int index = 0) const {
00964                 if (index >= itsLegendsShown_.size())
00965                         const_cast < vector < bool > &>(itsLegendsShown_).resize (index + 1);
00966                 return itsLegendsShown_[index];
00967         }
00968         void showLegend (const bool & value, unsigned int index = 0) {
00969                 if (index >= itsLegendsShown_.size())
00970                         itsLegendsShown_.resize (index + 1);
00971                 if (itsLegendsShown_[index] != value) {
00972                         itsLegendsShown_[index] = value;
00973                         updated();
00974                 }
00975         }
00976 
00977 
00978         const vector < PlotCanvas::LegendPosition > &legendPositions() const {
00979                 return itsLegendsPos_;
00980         }
00981         void setLegendPositions (const vector < PlotCanvas::LegendPosition > &value) {
00982                 if (itsLegendsPos_ != value) {
00983                         itsLegendsPos_ = value;
00984                         updated();
00985                 }
00986         }
00987         PlotCanvas::LegendPosition legendPosition (unsigned int index = 0) const {
00988                 if (index >= itsLegendsPos_.size())
00989                         const_cast < vector < PlotCanvas::LegendPosition >
00990                 &>(itsLegendsPos_).resize (index + 1);
00991                 return itsLegendsPos_[index];
00992         }
00993         void setLegendPosition (const PlotCanvas::LegendPosition & value,
00994                         unsigned int index = 0) {
00995                 if (index >= itsLegendsPos_.size())
00996                         itsLegendsPos_.resize (index + 1);
00997                 if (itsLegendsPos_[index] != value) {
00998                         itsLegendsPos_[index] = value;
00999                         updated();
01000                 }
01001         }
01002 
01003 
01004         const vector < PlotMSLabelFormat > &titleFormats() const {
01005                 return itsTitles_;
01006         }
01007         void setTitleFormats (const vector < PlotMSLabelFormat > &value) {
01008                 if (itsTitles_ != value) {
01009                         itsTitles_ = value;
01010                         updated();
01011                 }
01012         }
01013         const PlotMSLabelFormat & titleFormat (unsigned int index = 0) const {
01014                 return itsTitles_[index];
01015         }
01016         void setTitleFormat (const PlotMSLabelFormat & value, unsigned int index =
01017                         0) {
01018                 if (itsTitles_[index] != value) {
01019                         itsTitles_[index] = value;
01020                         updated();
01021                 }
01022         }
01023         const vector < bool > &titleFontsSet() const {
01024                 return itsTitleFontsSet_;
01025         }
01026         void setTitleFontsSet (const vector < bool > &value) {
01027                 if (itsTitleFontsSet_ != value) {
01028                         itsTitleFontsSet_ = value;
01029                         updated();
01030                 }
01031         }
01032         bool titleFontSet (unsigned int index = 0) const {
01033                 return itsTitleFontsSet_[index];
01034         }
01035         void setTitleFontSet (const bool & value, unsigned int index = 0) {
01036                 if (itsTitleFontsSet_[index] != value) {
01037                         itsTitleFontsSet_[index] = value;
01038                         updated();
01039                 }
01040         }
01041     const vector < Int > &titleFonts() const {
01042                 return itsTitleFonts_;
01043         }
01044         void setTitleFonts (const vector < Int > &value) {
01045                 if (itsTitleFonts_ != value) {
01046                         itsTitleFonts_ = value;
01047                         updated();
01048                 }
01049         }
01050         const Int & titleFont (unsigned int index = 0) const {
01051                 return itsTitleFonts_[index];
01052         }
01053         void setTitleFont (const Int value, unsigned int index =
01054                         0) {
01055                 if (itsTitleFonts_[index] != value) {
01056                         itsTitleFonts_[index] = value;
01057                         updated();
01058                 }
01059         }
01060 
01061         const vector < bool > &gridMajorsShown() const {
01062                 return itsGridMajsShown_;
01063         }
01064         void showGridMajors (const vector < bool > &value) {
01065                 if (itsGridMajsShown_ != value) {
01066                         itsGridMajsShown_ = value;
01067                         updated();
01068                 }
01069         }
01070         bool gridMajorShown (unsigned int index = 0) const {
01071                 if (index >= itsGridMajsShown_.size())
01072                         const_cast < vector < bool > &>(itsGridMajsShown_).resize (index + 1);
01073                 return itsGridMajsShown_[index];
01074         }
01075         void showGridMajor (const bool & value, unsigned int index = 0) {
01076                 if (index >= itsGridMajsShown_.size())
01077                         itsGridMajsShown_.resize (index + 1);
01078                 if (itsGridMajsShown_[index] != value) {
01079                         itsGridMajsShown_[index] = value;
01080                         updated();
01081                 }
01082         }
01083 
01084 
01085         const vector < bool > &gridMinorsShown() const {
01086                 return itsGridMinsShown_;
01087         }
01088         void showGridMinors (const vector < bool > &value) {
01089                 if (itsGridMinsShown_ != value) {
01090                         itsGridMinsShown_ = value;
01091                         updated();
01092                 }
01093         }
01094         bool gridMinorShown (unsigned int index = 0) const {
01095                 if (index >= itsGridMinsShown_.size())
01096                         const_cast < vector < bool > &>(itsGridMinsShown_).resize (index + 1);
01097                 return itsGridMinsShown_[index];
01098         }
01099         void showGridMinor (const bool & value, unsigned int index = 0) {
01100                 if (index >= itsGridMinsShown_.size())
01101                         itsGridMinsShown_.resize (index + 1);
01102                 if (itsGridMinsShown_[index] != value) {
01103                         itsGridMinsShown_[index] = value;
01104                         updated();
01105                 }
01106         }
01107 
01108 
01109         const vector < PlotLinePtr > &gridMajorLines() const {
01110                 return itsGridMajLines_;
01111         }
01112         void setGridMajorLines (const vector < PlotLinePtr > &value) {
01113                 if (itsGridMajLines_ != value) {
01114                         itsGridMajLines_ = value;
01115                         updated();
01116                 }
01117         }
01118         PlotLinePtr gridMajorLine (unsigned int index = 0) const {
01119                 if (index >= itsGridMajLines_.size())
01120                         const_cast < vector < PlotLinePtr >
01121                 &>(itsGridMajLines_).resize (index + 1);
01122                 return itsGridMajLines_[index];
01123         }
01124         void setGridMajorLine (const PlotLinePtr & value, unsigned int index = 0) {
01125                 if (index >= itsGridMajLines_.size())
01126                         itsGridMajLines_.resize (index + 1);
01127                 if (itsGridMajLines_[index] != value) {
01128                         itsGridMajLines_[index] = value;
01129                         updated();
01130                 }
01131         }
01132 
01133 
01134         const vector < PlotLinePtr > &gridMinorLines() const {
01135                 return itsGridMinLines_;
01136         }
01137         void setGridMinorLines (const vector < PlotLinePtr > &value) {
01138                 if (itsGridMinLines_ != value) {
01139                         itsGridMinLines_ = value;
01140                         updated();
01141                 }
01142         }
01143         PlotLinePtr gridMinorLine (unsigned int index = 0) const {
01144                 if (index >= itsGridMinLines_.size())
01145                         const_cast < vector < PlotLinePtr >
01146                 &>(itsGridMinLines_).resize (index + 1);
01147                 return itsGridMinLines_[index];
01148         }
01149         void setGridMinorLine (const PlotLinePtr & value, unsigned int index = 0) {
01150                 if (index >= itsGridMinLines_.size())
01151                         itsGridMinLines_.resize (index + 1);
01152                 if (itsGridMinLines_[index] != value) {
01153                         itsGridMinLines_[index] = value;
01154                         updated();
01155                 }
01156         }
01157 
01158 
01159 private:
01160 
01161         //Does the work for the operator=()s.
01162         PMS_PP_Canvas& assign(const PMS_PP_Canvas* o );
01163 
01164         /* Parameters' values */
01165         vector<PlotMSLabelFormat> itsXLabels_;
01166         vector<bool> itsXFontsSet_;
01167         vector<Int> itsXAxisFonts_;
01168         vector<PlotMSLabelFormat> itsYLabels_;
01169         vector<bool> itsYFontsSet_;
01170         vector<Int> itsYAxisFonts_;
01171         vector<bool> itsXAxesShown_;
01172         vector<bool> itsYAxesShown_;
01173         vector<bool> itsLegendsShown_;
01174         vector<PlotCanvas::LegendPosition > itsLegendsPos_;
01175         vector<PlotMSLabelFormat> itsTitles_;
01176         vector<bool> itsTitleFontsSet_;
01177         vector<Int> itsTitleFonts_;
01178         vector<bool> itsGridMajsShown_;
01179         vector<bool> itsGridMinsShown_;
01180         vector<PlotLinePtr> itsGridMajLines_;
01181         vector<PlotLinePtr> itsGridMinLines_;
01182 
01183         /* Key strings for Record */
01184         static const String REC_XLABELS;
01185         static const String REC_XFONTSSET;
01186         static const String REC_XAXISFONTS;
01187         static const String REC_YLABELS;
01188         static const String REC_YFONTSSET;
01189         static const String REC_YAXISFONTS;
01190         static const String REC_SHOWXAXES;
01191         static const String REC_SHOWYAXES;
01192         static const String REC_SHOWLEGENDS;
01193         static const String REC_LEGENDSPOS;
01194         static const String REC_TITLES;
01195         static const String REC_TITLEFONTSSET;
01196         static const String REC_TITLEFONTS;
01197         static const String REC_SHOWGRIDMAJS;
01198         static const String REC_SHOWGRIDMINS;
01199         static const String REC_GRIDMAJLINES;
01200         static const String REC_GRIDMINLINES;
01201 
01202 
01203         void setDefaults();
01204 };
01205 
01206 
01207 
01208 
01209 
01210 // Subclass of PlotMSPlotParameters::Group to handle display parameters.
01211 // Currently includes:
01212 // * flagged and unflagged symbols
01213 // * plot title format
01214 // * colorize flag and axis
01215 // Parameters are vector-based, on a per-plot basis.
01216 //
01217 class PMS_PP_Display : public PlotMSPlotParameters::Group {
01218 
01219 public:
01220         /* Constructor which takes a factory */
01221         PMS_PP_Display (PlotFactoryPtr factory);
01222 
01223         /* Copy constructor.  See operator=(). */
01224         PMS_PP_Display (const PMS_PP_Display & copy);
01225 
01226         ~PMS_PP_Display();
01227 
01228 
01229         /* Implements PlotMSPlotParameters::Group::clone(). */
01230         Group *clone() const {
01231                 return new PMS_PP_Display (*this);
01232         }
01233 
01234         /* Implements PlotMSPlotParameters::Group::name(). */
01235         const String & name() const {
01236                 static String groupName = PMS_PP::UPDATE_DISPLAY_NAME;
01237                 return groupName;
01238         }
01239 
01240         /* Implements PlotMSPlotParameters::Group::toRecord(). */
01241         Record toRecord() const;
01242 
01243         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
01244         void fromRecord (const Record & record);
01245 
01246         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
01247         bool requiresRedrawOnChange() const {
01248                 return true;
01249         }
01250 
01251         /* Overrides PlotMSPlotParameters::Group::operator=(). */
01252         PMS_PP_Display & operator= (const Group & other);
01253 
01254         /*  Overrides the actual assignment operator=() */
01255         PMS_PP_Display& operator=(const PMS_PP_Display& other);
01256 
01257         /* Overrides PlotMSPlotParameters::Group::operator==(). */
01258         bool operator== (const Group & other) const;
01259 
01260 
01261         void setColorize (const bool & colorize, const PMS::Axis & axis,
01262                         unsigned int index = 0);
01263 
01264 
01265         void resizeVectors (unsigned int newSize);
01266 
01267 
01268         const vector < PlotSymbolPtr > &unflaggedSymbols() const {
01269                 return itsUnflaggedSymbols_;
01270         }
01271         void setUnflaggedSymbols (const vector < PlotSymbolPtr > &value) {
01272                 if (itsUnflaggedSymbols_ != value) {
01273                         itsUnflaggedSymbols_ = value;
01274                         updated();
01275                 }
01276         }
01277         PlotSymbolPtr unflaggedSymbol (unsigned int index = 0) const {
01278                 if (index >= itsUnflaggedSymbols_.size()){
01279                         int newSize = index+1;
01280                         vector<PlotSymbolPtr> & unflaggedSymbols = const_cast < vector <PlotSymbolPtr > &>(itsUnflaggedSymbols_);
01281                         unflaggedSymbols.resize ( newSize);
01282                         for ( int j = 0; j < newSize; j++ ){
01283                                 if ( unflaggedSymbols[j].null() ){
01284                                         unflaggedSymbols[j]=PMS::DEFAULT_UNFLAGGED_SYMBOL(factory());
01285                                 }
01286                         }
01287                 }
01288                 return itsUnflaggedSymbols_[index];
01289         }
01290         void setUnflaggedSymbol (const PlotSymbolPtr & value, unsigned int index =0);
01291 
01292         const vector < PlotSymbolPtr > &flaggedSymbols() const {
01293                 return itsFlaggedSymbols_;
01294         }
01295         void setFlaggedSymbols (const vector < PlotSymbolPtr > &value) {
01296                 if (itsFlaggedSymbols_ != value) {
01297                         itsFlaggedSymbols_ = value;
01298                         updated();
01299                 }
01300         }
01301         PlotSymbolPtr flaggedSymbol (unsigned int index = 0) const {
01302                 if (index >= itsFlaggedSymbols_.size()){
01303                         int newSize = index + 1;
01304                         vector<PlotSymbolPtr> & flaggedSymbols = const_cast < vector <PlotSymbolPtr > &>(itsFlaggedSymbols_);
01305                         flaggedSymbols.resize( newSize );
01306                         for ( int j = 0; j < newSize; j++ ){
01307                                 if ( flaggedSymbols[j].null()){
01308                                         flaggedSymbols[j] = PMS::DEFAULT_FLAGGED_SYMBOL(factory());
01309                                 }
01310                         }
01311                 }
01312                 return itsFlaggedSymbols_[index];
01313         }
01314         void setFlaggedSymbol (const PlotSymbolPtr & value, unsigned int index =0);
01315 
01316         const vector < PlotMSLabelFormat > &titleFormats() const {
01317                 return itsTitleFormats_;
01318         }
01319         void setTitleFormats (const vector < PlotMSLabelFormat > &value) {
01320                 if (itsTitleFormats_ != value) {
01321                         itsTitleFormats_ = value;
01322                         updated();
01323                 }
01324         }
01325         const PlotMSLabelFormat & titleFormat (unsigned int index = 0) const {
01326                 return itsTitleFormats_[index];
01327         }
01328         void setTitleFormat (const PlotMSLabelFormat & value, unsigned int index =
01329                         0) {
01330                 if (itsTitleFormats_[index] != value) {
01331                         itsTitleFormats_[index] = value;
01332                         updated();
01333                 }
01334         }
01335 
01336 
01337         const vector < bool > &colorizeFlags() const {
01338                 return itsColorizeFlags_;
01339         }
01340         void setColorize (const vector < bool > &value) {
01341                 if (itsColorizeFlags_ != value) {
01342                         itsColorizeFlags_ = value;
01343                         updated();
01344                 }
01345         }
01346         bool colorizeFlag (unsigned int index = 0) const {
01347                 if (index >= itsColorizeFlags_.size())
01348                         const_cast < vector < bool > &>(itsColorizeFlags_).resize (index + 1);
01349                 return itsColorizeFlags_[index];
01350         }
01351         void setColorize (const bool & value, unsigned int index = 0);
01352 
01353         const vector < PMS::Axis > &colorizeAxes() const {
01354                 return itsColorizeAxes_;
01355         }
01356         void setColorize (const vector < PMS::Axis > &value) {
01357                 if (itsColorizeAxes_ != value) {
01358                         itsColorizeAxes_ = value;
01359                         updated();
01360                 }
01361         }
01362         PMS::Axis colorizeAxis (unsigned int index = 0) const {
01363                 if (index >= itsColorizeAxes_.size())
01364                         const_cast < vector < PMS::Axis >
01365                 &>(itsColorizeAxes_).resize (index + 1);
01366                 return itsColorizeAxes_[index];
01367         }
01368         void setColorize (const PMS::Axis & value, unsigned int index = 0) {
01369                 if (index >= itsColorizeAxes_.size())
01370                         itsColorizeAxes_.resize (index + 1);
01371                 if (itsColorizeAxes_[index] != value) {
01372                         itsColorizeAxes_[index] = value;
01373                         updated();
01374                 }
01375         }
01376 
01377 
01378 
01379 
01380 private:
01381 
01382         /* Does the work for both versions of operator=() */
01383         PMS_PP_Display& assign( const PMS_PP_Display* o );
01384 
01385 
01386         /* Parameters' values */
01387         vector<PlotSymbolPtr> itsUnflaggedSymbols_;
01388         vector<PlotSymbolPtr> itsFlaggedSymbols_;
01389         vector<PlotMSLabelFormat> itsTitleFormats_;
01390         vector<bool> itsColorizeFlags_;
01391         vector<PMS::Axis> itsColorizeAxes_;
01392 
01393 
01394         /* Key strings for Record */
01395         static const String REC_UNFLAGGEDS;
01396         static const String REC_FLAGGEDS;
01397         static const String REC_TITLES;
01398         static const String REC_COLFLAGS;
01399         static const String REC_COLAXES;
01400 
01401         void setDefaults();
01402 };
01403 
01404 
01405 
01406 
01407 // Subclass of PlotMSPlotParameters::Group to handle iteration parameters.
01408 // Currently includes:
01409 // * which axis to use
01410 // * rows, columns to fit onto each page
01411 // Parameters apply to whole set of plots
01412 //
01413 class PMS_PP_Iteration : public PlotMSPlotParameters::Group {
01414 
01415 
01416 
01417 public:
01418 
01419         /* Constructor which takes a factory */
01420         PMS_PP_Iteration (PlotFactoryPtr factory);
01421 
01422         /* Copy constructor.  See operator=(). */
01423         PMS_PP_Iteration (const PMS_PP_Iteration & copy);
01424 
01425         ~PMS_PP_Iteration();
01426 
01427 
01428         /* Implements PlotMSPlotParameters::Group::clone(). */
01429         Group *clone() const {
01430                 return new PMS_PP_Iteration (*this);
01431         }
01432 
01433         /* Implements PlotMSPlotParameters::Group::name(). */
01434         const String & name() const {
01435                 static String groupName = PMS_PP::UPDATE_ITERATION_NAME;
01436                 return groupName;
01437         }
01438 
01439         /* Implements PlotMSPlotParameters::Group::toRecord(). */
01440         Record toRecord() const;
01441 
01442         /* Implements PlotMSPlotParameters::Group::fromRecord(). */
01443         void fromRecord (const Record & record);
01444 
01445         /* Implements PlotMSPlotParameters::Group::requiresRedrawOnChanged(). */
01446         bool requiresRedrawOnChange() const {
01447                 return true;
01448         }
01449 
01450         /* Overrides the real operator=().  */
01451         PMS_PP_Iteration& operator=(const PMS_PP_Iteration& other);
01452 
01453         /* Overrides PlotMSPlotParameters::Group::operator=(). */
01454         PMS_PP_Iteration & operator= (const Group & other);
01455 
01456         /* Overrides PlotMSPlotParameters::Group::operator==(). */
01457         bool operator== (const Group & other) const;
01458 
01459         //Returns whether or not we are iterating on an axis.
01460         bool isIteration() const;
01461 
01462         const PlotMSIterParam& iterParam() const {
01463                 return itsIterParam_;
01464         }
01465         void setIterParam(PlotMSIterParam iterparam) {
01466                 if (itsIterParam_ != iterparam) {
01467                         itsIterParam_=iterparam;
01468                         updated();
01469                 }
01470         }
01471 
01472         PMS::Axis  iterationAxis() const {
01473                 return itsIterParam_.iterAxis();
01474         }
01475 
01476         void setIterationAxis (const PMS::Axis & value) {
01477                 if (iterationAxis()!=value) {
01478                         itsIterParam_.setIterAxis(value);
01479                         updated();
01480                 }
01481         }
01482 
01483 
01484         int getGridRow() const  {
01485                 return itsIterParam_.getGridRow();
01486         }
01487         void setGridRow(const int &value)  {
01488                 if (getGridRow() != value) {
01489                         itsIterParam_.setGridRow(value);
01490                         updated();
01491                 }
01492         }
01493 
01494         int getGridCol() const  {
01495                 return itsIterParam_.getGridCol();
01496         }
01497         void setGridCol(const int &value)  {
01498                 if (getGridCol() != value) {
01499                         itsIterParam_.setGridCol(value);
01500                         updated();
01501                 }
01502         }
01503 
01504         Bool isCommonAxisX() const {
01505                 return itsIterParam_.isCommonAxisX();
01506         }
01507         void setCommonAxisX( bool commonAxis ){
01508                 if ( isCommonAxisX() != commonAxis ){
01509                         bool validValue = false;
01510                         if ( isGlobalScaleX()){
01511                                 validValue = true;
01512                         }
01513                         else if ( !commonAxis ){
01514                                 validValue = true;
01515                         }
01516 
01517                         if ( validValue ){
01518                                 itsIterParam_.setCommonAxisX( commonAxis );
01519                                 updated();
01520                         }
01521                 }
01522         }
01523         Bool isCommonAxisY() const {
01524                 return itsIterParam_.isCommonAxisY();
01525         }
01526         void setCommonAxisY( bool commonAxis ){
01527                 if ( isCommonAxisY() != commonAxis ){
01528                         bool validValue = false;
01529                         if ( isGlobalScaleY() ){
01530                                 validValue = true;
01531                         }
01532                         else if ( !commonAxis ){
01533                                 validValue = true;
01534                         }
01535                         if ( validValue ){
01536                                 itsIterParam_.setCommonAxisY( commonAxis );
01537                                 updated();
01538                         }
01539                 }
01540         }
01541         Bool isGlobalScaleX() const {
01542                         return itsIterParam_.isGlobalAxisX();
01543                 }
01544                 void setGlobalScaleX( bool globalAxis ){
01545                         if ( isGlobalScaleX() != globalAxis ){
01546                                 itsIterParam_.setGlobalScaleX( globalAxis );
01547                                 updated();
01548                         }
01549                 }
01550                 Bool isGlobalScaleY() const {
01551                         return itsIterParam_.isGlobalAxisY();
01552                 }
01553                 void setGlobalScaleY( bool globalAxis ){
01554                         if ( isGlobalScaleY() != globalAxis ){
01555                                 itsIterParam_.setGlobalScaleY( globalAxis );
01556                                 updated();
01557                         }
01558                 }
01559 private:
01560 
01561         //Does the work for the operator=()s.
01562         PMS_PP_Iteration& assign(const PMS_PP_Iteration* o);
01563 
01564         /* Parameters' values */
01565         PlotMSIterParam itsIterParam_;
01566         void setDefaults();
01567 };
01568 
01569 
01570 
01571 
01572 }
01573 
01574 #endif /* PLOTMSPLOTPARAMETERGROUPS_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1