selectedpixelmodel.h

Go to the documentation of this file.
00001 //
00002 // C++ Interface: selectedpixelmodel
00003 //
00004 // Description: 
00005 //
00006 //
00007 // Author: Nicholas Phillips <Nicholas.G.Phillips@nasa.gov>, (C) 2008
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 #ifndef SELECTEDPIXELMODEL_H
00013 #define SELECTEDPIXELMODEL_H
00014 
00015 #include <vector>
00016 #include <QStringList>
00017 #include <QAbstractTableModel>
00018 #include "enums.h"
00019 #include "pixel.h"
00020 
00021 class Skymap;
00022 
00023 class SelectedPixel
00024 {
00025 public:
00026         int i;
00027         BasePixel *p;
00028         QString label;
00029         SelectedPixel(int j, BasePixel *pp) : i(j), p(pp) {};
00030 };
00031 /*==================================================================
00032         @author Nicholas Phillips <Nicholas.G.Phillips@nasa.gov>
00033 */
00034 class SelectedPixelModel : public QAbstractTableModel
00035 {
00036 public:
00037         SelectedPixelModel(QObject *parent = 0);
00038 
00039 
00040         // Overloaded methods to display content
00041         virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
00042         virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
00043         virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00044         virtual QVariant headerData(const int i, Qt::Orientation o, int role = Qt::DisplayRole) const;
00045 
00046         void set(Skymap *map);
00047         void asStats(SelectedPixelModel *);
00048         void asStats(Skymap *map);
00049 
00050         void asStatus();
00051         void hasField(Field f, bool b);
00052         void loadField(Field f);
00053 
00054         bool operator()(int i, BasePixel *pix);
00055 
00056         int size() const { return pixs.size(); };
00057         int pixnum(int i) const { return pixs[i].i; };
00058 
00059         void clear();
00060 
00061         void updateStats();
00062         
00063         void writeListToFile (const QString &dst);
00064 private:
00065         typedef std::vector<SelectedPixel> PixList;
00066         enum Modes { list, stats, status };
00067 
00068         Modes mode;
00069 
00070         int nrows;
00071         int ncols;
00072         PixList pixs;
00073         QStringList headers;
00074         std::vector<int> pidx;
00075 
00076         SelectedPixelModel *data4stats;
00077         QStringList statnames;
00078         int n;
00079 };
00080 
00081 #endif

Generated on Fri Feb 6 15:32:42 2009 for Skyviewer by  doxygen 1.4.7