IndexedColorMap.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: IndexedColorMap.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 VDRAW_INDEXEDCOLORMAP_H
00028 #define VDRAW_INDEXEDCOLORMAP_H
00029 
00030 #include "Color.hpp"
00031 #include "Palette.hpp"
00032 
00033 namespace vdraw
00034 {
00037 
00042   class IndexedColorMap
00043   {
00044     public:
00048       IndexedColorMap()
00049       {
00050         cols=rows=0;
00051         c=0;
00052       }
00053 
00061       IndexedColorMap(int icols, int irows, const Palette &pp, int base=0);
00062 
00064       ~IndexedColorMap() { reset(); }
00065 
00067       inline void setColor(int row, int col, int f) { c[row][col]=f; }
00068 
00070       inline Color get(int row, int col) const { return p.getColor(getIndex(row,col)); }
00071 
00073       inline int getIndex(int row, int col) const { return c[row][col]; }
00074 
00076       inline int getCols() const { return cols; }
00077 
00079       inline int getRows() const { return rows; }
00080 
00082       inline const Palette getPalette() const { return p; }
00083 
00085       void reset();
00086 
00087     protected:
00089       int cols;
00090 
00092       int rows;
00093 
00095       Palette p;
00096 
00098       int **c;
00099   }; // class IndexedColorMap
00100 
00101   // @}
00102 
00103 } // namespace vdraw
00104 
00105 #endif // VDRAW_INDEXEDCOLORMAP_H
00106 

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