AxisStyle.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: AxisStyle.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 #ifndef VPLOT_AXISSTYLE_H
00028 #define VPLOT_AXISSTYLE_H
00029 
00030 #include "StrokeStyle.hpp"
00031 #include "TextStyle.hpp"
00032 
00033 namespace vplot
00034 {
00035   /*
00036    * I probably need a class for the following things:
00037    *
00038    * - Axis setup
00039    *   - This would be in the middle (on 0) or on an edge as a border
00040    *     of the plot/frame.
00041    *   * StrokeStyle for everything
00042    *   * Length of ticks 
00043    *   * Alignment of ticks
00044    *     -  --|   Left
00045    *     -   -|-  Center
00046    *     -    |-- Right
00047    *     -   |     |  
00048    *     -  ---   ---   --- 
00049    *     -         |     |
00050    *     - Above Center Below
00051    *   - Placement of ticks
00052    *     - Evenly space n across the line (to bounds)
00053    *     - or evenly space them a given amount to wherever
00054    *     - Start at 0 or side
00055    *   - Tick recursion for najor/minor ticks
00056    *   - Tick recursion for labels
00057    *   - Label placement
00058    *   - Label formatting?
00059    *   * TextStyle for label
00060    *   - Direction for axis
00061    *   - Bounds!
00062    *     - Bound generation from min/max (with buffer area? round?)
00063    * - If this is a seperate class it needs a set of COPY commands
00064    *   that copy to a different orientation.  Or a mirror setting that
00065    *   does so automagically.
00066    */
00067 
00072   class AxisStyle
00073   {
00074     public:
00084       static const int ABOVE  = -1;
00085       static const int CENTER = 0;
00086       static const int BELOW  = 1;
00087 
00088       /*
00089        * Tick settings
00090        */
00091 
00093       bool logarithmic;
00094 
00096       int tick_position;
00097 
00099       vdraw::StrokeStyle tick_style;
00100 
00102       double major_tick_length;
00103 
00106       bool tight_bounds;
00107 
00109       // TODO: Start labelling from some specific place?
00110       bool start_ticks_on_zero;
00111 
00113       double tick_depth_multiplier;
00114 
00116       int tick_recursion_depth;
00117 
00119       int subticks_per_tick;
00120 
00121       /*
00122        * Label settings
00123        */
00124       
00126       bool draw_labels;
00127 
00128       // TODO: Special labels?
00129       // std::vector<std::string> labels
00130       // or
00131       // Map from value to label:
00132       // std::map<double,std::string> labels
00133       // for example
00134       // labels.put(10,"Elevation mask");
00135 
00137       vdraw::TextStyle label_style;
00138 
00139       // The depth of tick recursion to draw labels
00140       // NOTE: This isn't really necessary, though maybe for log plots
00141       //int tick_label_depth;
00142 
00144       int label_position;
00145 
00152       std::string label_format;
00153 
00154       /*
00155        * General settings
00156        */
00157 
00159       vdraw::StrokeStyle line_style;
00160 
00161       /*
00162        * Constructor/Destructor
00163        */
00164 
00165       AxisStyle()
00166       {
00167         logarithmic = false;
00168         tick_position = CENTER;
00169         tick_style = vdraw::StrokeStyle();
00170         major_tick_length = 10;
00171         tight_bounds = false;
00172         start_ticks_on_zero = true;
00173         tick_depth_multiplier = 0.7;
00174         tick_recursion_depth = 2;
00175         subticks_per_tick = 1;
00176         draw_labels = true;
00177         label_style = vdraw::TextStyle();
00178         label_position = ABOVE;
00179         label_format = "";
00180         line_style = vdraw::StrokeStyle();
00181       }
00182 
00183       ~AxisStyle()
00184       {
00185       }
00186   };
00187 }
00188 
00189 #endif //VPLOT_AXISSTYLE_H
00190 

Generated on Wed Feb 8 03:30:57 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1