00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00020
00021 #ifndef DENSITYBASE_H
00022 #define DENSITYBASE_H
00023
00025
00026
00027 #include <vector>
00028
00029
00030 class DensityLoadThread;
00031 class IsoSurface;
00032
00033
00034 #include <point3d.h>
00035
00036
00037 #include "densitywidget.h"
00038
00040 class DensityBase : public DensityWidget
00041 {
00042 Q_OBJECT
00043
00044 public:
00046 DensityBase(IsoSurface* surface, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
00047 ~DensityBase();
00048
00050 bool surfaceVisible(const unsigned int surface);
00051 QColor surfaceColor(const unsigned int surface);
00052 unsigned int surfaceOpacity(const unsigned int surface);
00053 unsigned int surfaceType(const unsigned int surface);
00054
00055 signals:
00056 void newSurface(const unsigned int surface);
00057 void updatedSurface(const unsigned int surface);
00058 void deletedSurface(const unsigned int surface);
00059 void redrawScene();
00060
00061 public slots:
00062 void loadDensityA();
00063 void loadDensityB();
00064 void addSurface();
00065 void addSurfacePair();
00066 void deleteSurface();
00067 void updateAll();
00068
00069 protected:
00070 void customEvent(QCustomEvent* e);
00071 void showEvent(QShowEvent* e);
00072 void hideEvent(QHideEvent* e);
00073
00074 private slots:
00075 void updateSliderLevel();
00076 void updateLineEditLevel();
00077 void updateListView();
00078 void updateSettings();
00079 void updateVisibility(QListViewItem* item, const QPoint&, int column);
00080 void updateOperation(const unsigned int density = 0);
00081 void updateOpacity();
00082
00083 private:
00085 enum Columns{COLUMN_VISIBLE, COLUMN_ID, COLUMN_RGB, COLUMN_LEVEL, COLUMN_COLOUR, COLUMN_OPACITY, COLUMN_TYPE};
00086
00088 void makeConnections();
00089 void loadDensity(const bool densityA);
00090 void updateDensity();
00091 void updateProgress(const unsigned int progress);
00092 unsigned int typeToNum(const QString& type);
00093 void enableWidgets();
00094 bool identicalGrids();
00095
00097 struct SurfaceProperties
00099 {
00100 bool visible;
00101 double level;
00102 unsigned int colour;
00103 unsigned int opacity;
00104 unsigned int type;
00105 bool deleted;
00106 bool isNew;
00107 unsigned int ID;
00108 };
00109
00111 IsoSurface* isoSurface;
00112 unsigned int idCounter;
00113 std::vector<SurfaceProperties> surfaceProperties;
00114 DensityLoadThread* loadingThread;
00115 std::vector<double> densityPointsA;
00116 std::vector<double> densityPointsB;
00117 bool loadingDensityA;
00118 Point3D<float> originA;
00119 Point3D<float> originB;
00120 Point3D<unsigned int> numPointsA;
00121 Point3D<unsigned int> numPointsB;
00122 Point3D<float> deltaA;
00123 Point3D<float> deltaB;
00124 QString newDescription;
00125 int columnColourWidth;
00126
00128 static const double deltaLevel;
00129 };
00130 #endif
00131