00001 /** 00002 \file Plot2D_OptionFile.h 00003 \brief The option file class for Plot2D. 00004 00005 \author Glenn D. MacGougan (GDM) 00006 \date 2007-12-19 00007 \since 2007-12-19 00008 00009 \b "LICENSE INFORMATION" \n 00010 Copyright (c) 2007, refer to 'author' doxygen tags \n 00011 All rights reserved. \n 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided the following conditions are met: \n 00015 00016 - Redistributions of source code must retain the above copyright 00017 notice, this list of conditions and the following disclaimer. \n 00018 - Redistributions in binary form must reproduce the above copyright 00019 notice, this list of conditions and the following disclaimer in the 00020 documentation and/or other materials provided with the distribution. \n 00021 - The name(s) of the contributor(s) may not be used to endorse or promote 00022 products derived from this software without specific prior written 00023 permission. \n 00024 00025 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 00026 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00027 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00029 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00030 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00034 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00035 SUCH DAMAGE. 00036 */ 00037 00038 #ifndef _PLOT2D_OPTIONFILE_H_ 00039 #define _PLOT2D_OPTIONFILE_H_ 00040 00041 #include <string> 00042 #include "OptionFile.h" 00043 #include "Plot2D.h" 00044 00045 namespace namespace_Plot2D 00046 { 00047 /// \brief A derived option file class for the program. 00048 class Plot2D_OptionFile : public OptionFile 00049 { 00050 public: 00051 00052 /// \brief The default constructor (no data allocated yet). 00053 Plot2D_OptionFile(); 00054 00055 /// \brief The destructor. 00056 virtual ~Plot2D_OptionFile(); 00057 00058 private: 00059 00060 /// \brief The copy constructor. Disabled! 00061 Plot2D_OptionFile( const Plot2D_OptionFile& rhs ) {}; 00062 00063 /// \brief The assignment operator. Disabled! 00064 void operator=(const Plot2D_OptionFile& rhs) {}; 00065 00066 public: 00067 00068 /// \brief Read and interpret the option file. 00069 /// \return true if successful, false if error. 00070 bool ReadAndInterpretOptions( std::string OptionFilePath ); 00071 00072 public: 00073 00074 struct PLOT2D_structAxisSubOption 00075 { 00076 std::string str; 00077 double val; 00078 bool useDefault; 00079 00080 PLOT2D_structAxisSubOption() 00081 : val(0), useDefault(true) 00082 {} 00083 }; 00084 00085 /// \brief The options for a plot axis. 00086 struct PLOT2D_structAxisInfo 00087 { 00088 bool isGridOn; //!< Are the dashed grid lines on. 00089 std::string label; //!< The axis label. 00090 PLOT2D_structAxisSubOption lower_limit; //!< The lower plotting limit. 00091 PLOT2D_structAxisSubOption upper_limit; //!< The upper plotting limit. 00092 PLOT2D_structAxisSubOption tick_start; //!< The start xtick label value. 00093 PLOT2D_structAxisSubOption tick_size; //!< The xtick size value. 00094 PLOT2D_structAxisSubOption tick_end; //!< The end xtick label value. 00095 00096 PLOT2D_structAxisInfo() 00097 : isGridOn(true) 00098 {} 00099 }; 00100 00101 std::string m_OutputFileName; //!< The name of the output bitmap file. 00102 00103 int m_NumberOfSeries; //!< The total number of series to plot. 00104 int m_PlotSize_Width; //!< The width of the plot [cm]. 00105 int m_PlotSize_Height; //!< the height of the plot [cm]. 00106 00107 std::string m_Title; //!< The plot title. 00108 00109 PLOT2D_structAxisInfo m_xAxis; //!< The x-axis plot information. 00110 00111 PLOT2D_structAxisInfo m_yAxis; //!< The y-axis plot information. 00112 00113 bool m_PlotStatistics; //!< A boolean indicating if statistics are to be included in the figure. 00114 00115 bool m_PlaceLabelBelowThePlot; //!< Where to place the labels and statistics? Below or to the right. 00116 00117 CPLOT_enumColor m_FigureBackgroundColor; //!< The figure background color. 00118 00119 /** 00120 \brief A boolean indicating if the special GPS x axis label is to be used. 00121 Enabling X_UseGPSLabel assumes that the X part of the 00122 series is a GPS time of week, (0-604800 s), and will 00123 compute the corresponding UTC time and include it 00124 below each xtick. 00125 */ 00126 bool m_UseGPSLabel; 00127 00128 int m_UTCOffset; //!< The GPS/UTC offset (always +ve). 00129 00130 /** \brief a y-axis label for the right side of the figure. 00131 00132 Data can be plotted with respect to y ticks on the right 00133 hand side of the plot window. 00134 For example, plot elevation angle (0-90, left side y ticks) 00135 and plot azimuth angle (-180-180, right side y ticks). 00136 00137 \code 00138 rhs_ytick = lhs_ytick * scale_factor + offset 00139 e.g. 00140 Y_Label, = "Elevation (deg)" 00141 Y_RightYLabel, = "Azimuth (deg)" 00142 Y_RightYOffset, = -180 00143 Y_RightYScaleFactor, = 4 00144 \endcode 00145 */ 00146 std::string m_rightY_label; 00147 double m_rightY_scale_factor; //!< Scale the lhs y ticks by this value for the rhs ticks. 00148 double m_rightY_offset; //!< Offset the rhs y ticks by this value after scaling. 00149 00150 /// \brief The array of series options. Up to 12 series can be plotted. 00151 PLOT2D_structSeriesInfo m_Series[12]; 00152 00153 00154 /// Determine the color enum from the string value. 00155 bool DetermineColorFromString( CPLOT_enumColor &color, std::string color_str ); 00156 00157 private: 00158 00159 /// Determine if a value is used or the item uses a default. 00160 void DetermineValueOrDefault( PLOT2D_structAxisSubOption &s ); 00161 00162 }; 00163 00164 } // end namespace 00165 00166 #endif // _PLOT2D_OPTIONFILE_H_ 00167