densitybase.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                          densitybase.h  -  description
00003                              -------------------
00004     begin                : Thu Mar 17 2005
00005     copyright            : (C) 2005-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef DENSITYBASE_H
00022 #define DENSITYBASE_H
00023 
00025 
00026 // STL includes
00027 #include <vector>
00028 
00029 // Xbrabo forward class declarations
00030 class DensityLoadThread;
00031 class IsoSurface;
00032 
00033 // Xbrabo includes
00034 #include <point3d.h>
00035 
00036 // Base class header files
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);      // constructor
00047     ~DensityBase();                     // destructor
00048 
00050     bool surfaceVisible(const unsigned int surface);        // returns true if a surface is visible
00051     QColor surfaceColor(const unsigned int surface);        // returns the color of a surface
00052     unsigned int surfaceOpacity(const unsigned int surface);// returns the opacity of a surface
00053     unsigned int surfaceType(const unsigned int surface);   // returns the drawing type of a surface
00054 
00055   signals:
00056     void newSurface(const unsigned int surface);  // is emitted after a new surface is created
00057     void updatedSurface(const unsigned int surface);        // is emitted when a surface has changed
00058     void deletedSurface(const unsigned int surface);        // is emitted when an existing surface is deleted
00059     void redrawScene();                 // is emitted when something has changed
00060 
00061   public slots:
00062     void loadDensityA();                // loads a new cube file for density A
00063     void loadDensityB();                // loads a new cube file for density B
00064     void addSurface();                  // adds a new surface
00065     void addSurfacePair();              // adds a pair of surfaces with opposite signs
00066     void deleteSurface();               // deletes an existing surface
00067     void updateAll();                   // updates all changes
00068 
00069   protected:
00070     void customEvent(QCustomEvent* e);  // reimplemented to receive events from loadingThread
00071     void showEvent(QShowEvent* e);      // reimplemented to keep the colour column fixed after a hide/show cycle
00072     void hideEvent(QHideEvent* e);      // reimplemented to keep the colour column fixed after a hide/show cycle
00073 
00074   private slots:
00075     void updateSliderLevel();           // updates SliderLevel from the contents of LineEditLevel
00076     void updateLineEditLevel();         // updates LineEditLevel from the value of SliderLevel
00077     void updateListView();              // updates ListViewParameters upon changes in the settings
00078     void updateSettings();              // updates the settings upon changes in ListViewParameters
00079     void updateVisibility(QListViewItem* item, const QPoint&, int column); // updates the visibility of a surface
00080     void updateOperation(const unsigned int density = 0);   // updates the possible operations 
00081     void updateOpacity();               // updates LabelOpacity with the current opacity value
00082 
00083   private:
00085     enum Columns{COLUMN_VISIBLE, COLUMN_ID, COLUMN_RGB, COLUMN_LEVEL, COLUMN_COLOUR, COLUMN_OPACITY, COLUMN_TYPE}; 
00086 
00088     void makeConnections();             // sets up all connections
00089     void loadDensity(const bool densityA);        // loads a density for density A or B
00090     void updateDensity();               // updates everything after loading has finished
00091     void updateProgress(const unsigned int progress);       // updates the progressbar for the current loading density
00092     unsigned int typeToNum(const QString& type);      // translates the type into a number
00093     void enableWidgets();               // enables/disables the correct widgets depending on the status of the class
00094     bool identicalGrids();              // returns true if the grids of densityA and B are identical
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 

Generated on Fri May 19 14:31:54 2006 for Brabosphere by  doxygen 1.4.6-NO