Layers.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2008 by Antonello Lobianco                         *
00003  *   antonello@regmas.org                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef LAYERS_H
00021 #define LAYERS_H
00022 #include <string>
00023 #include <vector>
00024 #include <stdexcept>
00025 #include <iostream>
00026 #include <sstream>
00027 
00028 #include <QColor>
00029 
00030 // regmas headers...
00031 #include "BaseRegmas.h"
00032 
00033 using namespace std;
00034 
00035 struct LegendItems;
00036 struct ReclassRules;
00037 
00039 
00047 class Layers : public BaseRegmas{
00048 
00049 public:
00051                         Layers(  ThreadManager*     MTHREAD_h,
00052                                  string                name_h,
00053                                  string               label_h,
00054                                  bool             isInteger_h,
00055                                  bool        dynamicContent_h,
00056                                  string        fullFilename_h  );
00057                        ~Layers();
00059     void                addLegendItem( int             ID_h,
00060                                        string       label_h,
00061                                        int         rColor_h,
00062                                        int         gColor_h,
00063                                        int         bColor_h,
00064                                        double    minValue_h,
00065                                        double    maxValue_h   );
00067     QColor              getColor(double ID_h);
00069     string              getCategory(double ID_h);
00071     void                addReclassificationRule(int inCode_h, int outCode_h, double p_h);
00073     double              filterExogenousDataset(double code_h);
00075     void                countMyPixels(bool debug=false);
00077     void                randomShuffle();
00079     bool                getIsInteger() {return isInteger;};
00081     void                print();
00083     void                printBinMap();
00084 
00085     string              getName(){return name;};
00087     string              getFilename(){return fullFileName;}
00089     bool                getDynamicContent(){return dynamicContent;}
00090 
00091 
00092 private:
00093     string                                  name; 
00094     string                                 label; 
00095     bool                               isInteger; 
00096     bool                          dynamicContent; 
00097     string                          fullFileName; 
00098     vector<LegendItems>              legendItems; 
00099     vector<ReclassRules>      reclassRulesVector; 
00100 };
00101 
00103 
00109 struct LegendItems {
00110     int                                       ID;
00111     string                                 label;
00112     int                                   rColor;
00113     int                                   gColor;
00114     int                                   bColor;
00115     double                              minValue;
00116     double                              maxValue;
00117     int                              cashedCount; 
00118 };
00119 
00121 
00129 struct ReclassRules{
00130     int                                   inCode;
00131     int                                  outCode;
00133     double                                     p;
00134 };
00135 
00136 #endif