InterpolatedColorMap.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: InterpolatedColorMap.hpp 3140 2012-06-18 15:03:02Z susancummins $"
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 #ifndef VDRAW_INTERPOLATEDCOLORMAP_H
00028 #define VDRAW_INTERPOLATEDCOLORMAP_H
00029 
00030 #include "Color.hpp"
00031 #include "Palette.hpp"
00032 
00033 namespace vdraw
00034 {
00037 
00042   class InterpolatedColorMap
00043   {
00044     public:
00048       InterpolatedColorMap()
00049       {
00050         cols=rows=0;
00051         c=0;
00052       }
00053 
00061       InterpolatedColorMap(int icols, int irows, const Palette &pp, double base=0.0);
00062 
00064       InterpolatedColorMap(const InterpolatedColorMap &o);
00065 
00067       ~InterpolatedColorMap() { reset(); }
00068 
00084       InterpolatedColorMap& operator=(InterpolatedColorMap o);
00085 
00087       inline void setColor(int row, int col, double f) { c[row][col]=f; }
00088 
00090       inline Color get(int row, int col) const { return p.getColor(getIndex(row,col)); }
00091 
00093       inline double getIndex(int row, int col) const  { return c[row][col]; }
00094 
00096       inline int getCols() const { return cols; }
00097 
00099       inline int getRows() const { return rows; }
00100 
00102       inline const Palette getPalette() const { return p; }
00103 
00104     protected:
00106       void init(int icols, int irows);
00107 
00109       void reset();
00110 
00112       int cols;
00113 
00115       int rows;
00116 
00118       Palette p;
00119 
00121       double **c;
00122   }; // class InterpolatedColorMap
00123 
00125 
00126 } // namespace vdraw
00127 
00128 #endif // VDRAW_INTERPOLATEDCOLORMAP_H
00129 

Generated on Sun May 19 03:31:09 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1