ScatterPlot.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ScatterPlot.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_SCATTERPLOT_H
00028 #define VPLOT_SCATTERPLOT_H
00029 
00030 #include "Color.hpp"
00031 #include "Frame.hpp"
00032 #include "Marker.hpp"
00033 
00034 #include "Plot.hpp"
00035 #include "SeriesList.hpp"
00036 
00037 using namespace vdraw;
00038 
00039 namespace vplot
00040 {
00044   class ScatterPlot : public Plot
00045   {
00046     public:
00050       ScatterPlot(unsigned int iidx=0) : Plot()
00051       {
00052         init(iidx);
00053       }
00054 
00056       ~ScatterPlot()
00057       {
00058       }
00059 
00061       void init(unsigned int imidx);
00062 
00064       Marker pickNextMarker(void);
00065 
00067       Marker pickNextMarker(int idx);
00068 
00070       inline void addSeries(string label, vector<pair<double,double> >& series)
00071       {
00072         addSeries(label,series,pickNextMarker());
00073       }
00074 
00076       inline void addSeries(string label, vector<pair<double,double> >& series, Marker m)
00077       {
00078         sl.addSeries(label,series,m);
00079       }
00080 
00082       inline void drawPlot(Frame& frame)
00083       {
00084         drawPlot(&frame);
00085       }
00086 
00087       void drawPlot(Frame* frame)
00088       {
00089         Frame innerFrame = getPlotArea(frame);
00090 
00091         double minX, maxX, minY, maxY;
00092         sl.findMinMax(minX,maxX,minY,maxY);
00093 
00094         // Use default min/max
00095         sl.drawInFrame(innerFrame,minX,maxX,minY,maxY);
00096 
00097         setXAxis(minX, maxX);
00098         setYAxis(minY, maxY); 
00099 
00100         drawAxis(frame);
00101       }
00102 
00109       inline void drawKey(Frame& frame, unsigned int columns = 1) 
00110       {
00111         drawKey(&frame, columns);
00112       }
00113 
00120       inline void drawKey(Frame* frame, unsigned int columns = 1) 
00121       {
00122         drawLegend(frame,&sl, columns);
00123       }
00124 
00125 
00126     protected:
00127 
00128 
00129     private:
00130 
00132       SeriesList sl;
00133 
00135       unsigned int midx;
00136       unsigned int imidx;
00137 
00139       std::vector<Color> mcvec;
00140 
00142       std::vector<Marker::Mark> mvec;
00143 
00144   };
00145 
00146 }
00147 
00148 #endif

Generated on Tue May 22 03:31:01 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1