00001 #ifndef CTRANSFERPROPERTY_H 00002 #define CTRANSFERPROPERTY_H 00003 00004 /**************************************************************************\ 00005 * REQUIRED HEADERS * 00006 \**************************************************************************/ 00007 00008 //OWN 00009 #include "CTransferWdt.h" 00010 #include "CShaderProperty.h" 00011 #include "Memory/TSmartPointer.h" 00012 00013 /**************************************************************************\ 00014 * DEFINITIONS * 00015 \**************************************************************************/ 00016 00017 class QLayout; 00018 00019 /**************************************************************************\ 00020 * CLASS * 00021 \**************************************************************************/ 00022 class CTransferProperty : public CShaderProperty 00023 { 00024 Q_OBJECT 00025 00026 /**************************************************************************\ 00027 * PUBLIC CLASS FUNCTIONS * 00028 \**************************************************************************/ 00029 public: 00030 00031 //CONSTRUCTOR 00032 CTransferProperty(const char * pName,const char * pID); 00033 00034 //DESTRUCTOR 00035 virtual ~CTransferProperty(void); 00036 00037 //HELPER 00038 virtual void OpenState(QSettings &openFile); 00039 virtual void SaveState(QSettings &saveFile); 00040 virtual void SaveDefaultState(QSettings &openFile); 00041 00042 //Attach the GUI ELEMENT to a Layout 00043 void Attach(QLayout * insertLayout); 00044 00045 //Show the GUI ELEMENT - if not attached as a seperate Window 00046 void Show(); 00047 00048 //Modify HISTOGRAM Quality 00049 void SetHistogramQuality(int quality){pTransferWdgt->SetHistogramQuality(quality);} 00050 int GetHistogramQuality(){return pTransferWdgt->GetHistogramQuality();} 00051 void SetHistogramSize(int size){pTransferWdgt->SetHistogramSize(size);} 00052 int GetHistogramSize(){return pTransferWdgt->GetHistogramSize();} 00053 bool Logarithmic(){return pTransferWdgt->Logarithmic();} 00054 bool Overlay(){return pTransferWdgt->Overlay();} 00055 00056 //Modify TRANSFER Quality 00057 void SetTransferFuncSize(int val){pTransferWdgt->SetTransferSize(val);Update();} 00058 QSize GetTransferFuncSize(){return pTransferWdgt->GetTransferSize();} 00059 00060 //Set HISTOGRAM Data 00061 void SetHistogramData(float * data, int dataSize){pTransferWdgt->SetHistogramData(data,dataSize);} 00062 00063 //Refresh the TransferFunction 00064 void Update(){pTransferWdgt->UpdateTransfer();MarkDirty(DIRTY_LOG);} 00065 00066 /**************************************************************************\ 00067 * PROTECTED CLASS FUNCTIONS * 00068 \**************************************************************************/ 00069 protected: 00070 00071 virtual void UpdateShader(uint programID,int texUnit,int texNum); 00072 virtual bool NeedTextureUnit(){return true;} 00073 00074 /**************************************************************************\ 00075 * PRIVATE SLOTS * 00076 \**************************************************************************/ 00077 private slots: 00078 00079 void MarkDirty(int ht){dirty = true; emit Dirty(ht);} 00080 00081 /**************************************************************************\ 00082 * PRIVATE CLASS FUNCTIONS * 00083 \**************************************************************************/ 00084 private: 00085 00086 bool CreateTransferTexture(); 00087 00088 /**************************************************************************\ 00089 * PRIVATE CLASS MEMBERS * 00090 \**************************************************************************/ 00091 00092 //GUI Element 00093 TSmartPointer<CTransferWdt> pTransferWdgt; 00094 00095 //Current Transfer 00096 unsigned int txTransfer; 00097 QSize transferSize; 00098 00099 bool dirty; 00100 }; 00101 00102 #endif //CTRANSFERPROPERTY_H