Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

colormap.h

Go to the documentation of this file.
00001 /*
00002 Arroyo - software for the simulation of electromagnetic wave propagation
00003 through turbulence and optics.
00004 
00005 Copyright (c) 2000-2004 California Institute of Technology.  Written by
00006 Dr. Matthew Britton.  For comments or questions about this software,
00007 please contact the author at mbritton@astro.caltech.edu.
00008 
00009 This program is free software; you can redistribute it and/or modify it
00010 under the terms of the GNU General Public License as  published by the
00011 Free Software Foundation; either version 2 of the License, or (at your
00012 option) any later version.
00013 
00014 This program is provided "as is" and distributed in the hope that it
00015 will be useful, but WITHOUT ANY WARRANTY; without even the implied
00016 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  In no
00017 event shall California Institute of Technology be liable to any party
00018 for direct, indirect, special, incidental or consequential damages,
00019 including lost profits, arising out of the use of this software and its
00020 documentation, even if the California Institute of Technology has been
00021 advised of the possibility of such damage.   The California Institute of
00022 Technology has no obligation to provide maintenance, support, updates,
00023 enhancements or modifications.  See the GNU General Public License for
00024 more details.
00025 
00026 You should have received a copy of the GNU General Public License along
00027 with this program; if not, write to the Free Software
00028 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00029 */
00030 
00031 #ifndef COLORMAP_H
00032 #define COLORMAP_H
00033 
00034 #include <vector>
00035 #include <ostream>
00036 
00037 namespace Arroyo {
00038 
00042 
00043   class colormap {
00044 
00045   public:
00048     colormap(){};
00049 
00052     virtual ~colormap(){};
00053 
00056     colormap & operator= (const colormap & fhd);
00057  
00060     virtual void read(const char * filename) = 0;
00061 
00064     virtual void print(std::ostream & os, const char * prefix = "") const = 0;
00065 
00068     virtual void invert() = 0;
00069 
00072     virtual char get_R(double val, double min, double max,
00073                                 bool logscale = false) const = 0;
00074 
00077     virtual char get_G(double val, double min, double max,
00078                                 bool logscale = false) const = 0;
00079 
00082     virtual char get_B(double val, double min, double max,
00083                                 bool logscale = false) const = 0;
00084 
00085   };
00086 
00095 
00096   class sao_colormap :
00097     public colormap {
00098 
00099   private:
00100 
00101   protected:
00102     
00103     std::vector<std::vector<double> > R_points;
00104     std::vector<std::vector<double> > G_points;
00105     std::vector<std::vector<double> > B_points;
00106 
00107   public:
00108 
00111     sao_colormap(){
00112       R_points = std::vector<std::vector<double> >(3);
00113       R_points[0] = std::vector<double>(2,0);
00114       R_points[1] = std::vector<double>(2,1);
00115       R_points[1][0] = .5;
00116       R_points[2] = std::vector<double>(2,1);
00117 
00118       G_points = R_points;
00119       B_points = R_points;
00120 
00121     };
00122 
00125     sao_colormap(std::vector<std::vector<double> > & in_R_points, 
00126                  std::vector<std::vector<double> > & in_G_points, 
00127                  std::vector<std::vector<double> > & in_B_points);
00128 
00131     sao_colormap(const char * filename);
00132 
00135     sao_colormap(const sao_colormap & scm){
00136       sao_colormap::operator=(scm);
00137     };
00138 
00141     ~sao_colormap(){};
00142 
00145     sao_colormap & operator= (const sao_colormap & scm);
00146  
00149     void read(const char * filename);
00150 
00153     void print(std::ostream & os, const char * prefix = "") const;
00154 
00157     void invert();
00158 
00161     char get_R(double val, double min, double max, bool logscale) const;
00162 
00165     char get_G(double val, double min, double max, bool logscale) const;
00166 
00169     char get_B(double val, double min, double max, bool logscale) const;
00170 
00171   };
00172 
00173 }
00174 
00175 #endif

Generated on Thu Nov 29 17:16:28 2007 for arroyo by  doxygen 1.3.9.1