File indexing completed on 2024-12-22 04:17:33
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2007 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #ifndef IMAGEDIALOG_H 0014 #define IMAGEDIALOG_H 0015 0016 #include "datadialog.h" 0017 #include "datatab.h" 0018 0019 #include "image.h" 0020 0021 #include "ui_imagetab.h" 0022 0023 #include <QPointer> 0024 0025 #include "kst_export.h" 0026 0027 namespace Kst { 0028 0029 class ObjectStore; 0030 0031 class ImageTab : public DataTab, Ui::ImageTab { 0032 Q_OBJECT 0033 public: 0034 explicit ImageTab(QWidget *parent = 0); 0035 virtual ~ImageTab(); 0036 0037 CurvePlacement* curvePlacement() const; 0038 ColorPalette* colorPalette() const; 0039 0040 void setObjectStore(ObjectStore *store); 0041 0042 bool realTimeAutoThreshold() const; 0043 bool realTimeAutoThresholdDirty() const; 0044 void setRealTimeAutoThreshold(const bool realTimeAutoThreshold); 0045 0046 bool colorOnly() const; 0047 void setColorOnly(const bool colorOnly); 0048 0049 bool contourOnly() const; 0050 void setContourOnly(const bool contourOnly); 0051 0052 bool colorAndContour() const; 0053 void setColorAndContour(const bool colorAndContour); 0054 0055 bool modeDirty() const; 0056 0057 double lowerThreshold() const; 0058 bool lowerThresholdDirty() const; 0059 void setLowerThreshold(const double lowerThreshold); 0060 0061 double upperThreshold() const; 0062 bool upperThresholdDirty() const; 0063 void setUpperThreshold(const double upperThreshold); 0064 0065 int numberOfContourLines() const; 0066 bool numberOfContourLinesDirty() const; 0067 void setNumberOfContourLines(const int numberOfContourLines); 0068 0069 int contourWeight() const; 0070 bool contourWeightDirty() const; 0071 void setContourWeight(const int contourWeight); 0072 0073 QColor contourColor() const; 0074 bool contourColorDirty() const; 0075 void setContourColor(const QColor contourColor); 0076 0077 MatrixPtr matrix() const; 0078 bool matrixDirty() const; 0079 void setMatrix(const MatrixPtr matrix); 0080 0081 bool useVariableLineWeight() const; 0082 bool useVariableLineWeightDirty() const; 0083 void setUseVariableLineWeight(const bool useVariableLineWeight); 0084 0085 void hidePlacementOptions(); 0086 void clearTabValues(); 0087 0088 void resetModeDirty(); 0089 0090 private Q_SLOTS: 0091 void realTimeAutoThresholdToggled(const bool checked); 0092 void updateEnabled(const bool checked); 0093 void selectionChanged(); 0094 void calculateAutoThreshold(); 0095 void calculateSmartThreshold(); 0096 void modeChanged(); 0097 0098 Q_SIGNALS: 0099 void optionsChanged(); 0100 0101 private: 0102 ObjectStore* _store; 0103 0104 bool _modeDirty; 0105 }; 0106 0107 class ImageDialog : public DataDialog { 0108 Q_OBJECT 0109 public: 0110 explicit ImageDialog(ObjectPtr dataObject, QWidget *parent = 0); 0111 virtual ~ImageDialog(); 0112 0113 void setMatrix(MatrixPtr matrix); 0114 0115 virtual bool dialogValid() const {return bool(_imageTab->matrix()) || (editMode() == EditMultiple);} 0116 0117 protected: 0118 virtual ObjectPtr createNewDataObject(); 0119 virtual ObjectPtr editExistingDataObject() const; 0120 0121 private Q_SLOTS: 0122 void updateButtons(); 0123 void editMultipleMode(); 0124 void editSingleMode(); 0125 0126 private: 0127 void configureTab(ObjectPtr object); 0128 0129 ImageTab *_imageTab; 0130 }; 0131 0132 } 0133 0134 #endif