QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : PlotDialog.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : Custom curves dialog 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef PLOTDIALOG_H 00030 #define PLOTDIALOG_H 00031 00032 #include <QDialog> 00033 #include <QTreeWidgetItem> 00034 #include <MultiLayer.h> 00035 00036 class QCheckBox; 00037 class QComboBox; 00038 class QLabel; 00039 class QLineEdit; 00040 class QListWidget; 00041 class QPushButton; 00042 class QSpinBox; 00043 class QTabWidget; 00044 class QWidget; 00045 class QStringList; 00046 class QGroupBox; 00047 class QDoubleSpinBox; 00048 class QRadioButton; 00049 class QTreeWidget; 00050 class QSlider; 00051 00052 class LayerItem; 00053 class CurveTreeItem; 00054 class ColorBox; 00055 class PatternBox; 00056 class ColorButton; 00057 class MultiLayer; 00058 class SymbolBox; 00059 class ColorMapEditor; 00060 class QwtPlotItem; 00061 class DoubleSpinBox; 00062 class PenStyleBox; 00063 class Spectrogram; 00064 class QwtErrorPlotCurve; 00065 class ContourLinesEditor; 00066 class FunctionDialog; 00067 class EnrichmentDialog; 00068 00070 class PlotDialog : public QDialog 00071 { 00072 Q_OBJECT 00073 00074 public: 00075 PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 ); 00076 void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont); 00077 void insertColumnsList(const QStringList& names){columnNames = names;}; 00078 void setMultiLayer(MultiLayer *ml); 00079 00080 public slots: 00081 void showAll(bool all); 00082 void selectCurve(int index); 00083 00084 private slots: 00085 void showStatistics(); 00086 void customVectorsPage(bool angleMag); 00087 void updateEndPointColumns(const QString& text); 00088 00089 void fillBoxSymbols(); 00090 void fillSymbols(); 00091 bool acceptParams(); 00092 void showWorksheet(); 00093 void quit(); 00094 00095 int setPlotType(CurveTreeItem *item); 00096 void changePlotType(int plotType); 00097 void setActiveCurve(CurveTreeItem *item); 00098 00099 void raiseCurve(); 00100 void shiftCurveBy(int offset = 1); 00101 00102 void insertTabs(int plot_type); 00103 void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem); 00104 void showAreaColor(bool show); 00105 00106 void removeSelectedObject(); 00107 00108 void pickErrorBarsColor(); 00109 00110 void setAutomaticBinning(); 00111 bool validInput(); 00112 void showPlotAssociations(QTreeWidgetItem *item, int); 00113 00114 //box plots 00115 void setBoxType(int index); 00116 void setBoxRangeType(int index); 00117 void setWhiskersRange(int index); 00118 00119 //spectrograms 00120 void showDefaultContourLinesBox(bool show); 00121 void showColorMapEditor(bool show); 00122 00123 //layer geometry 00124 void adjustLayerHeight(double width); 00125 void adjustLayerWidth(double height); 00126 void displayCoordinates(int unit, Graph *g = 0); 00127 //plot window geometry 00128 void displayPlotCoordinates(int unit); 00129 void adjustPlotWidth(double height); 00130 void adjustPlotHeight(double width); 00131 00132 protected slots: 00133 void setActiveLayer(LayerItem *item); 00134 void updateTreeWidgetItem(QTreeWidgetItem *item); 00135 void updateBackgroundTransparency(int alpha); 00136 void updateCanvasTransparency(int alpha); 00137 void setTitlesFont(); 00138 void setAxesLabelsFont(); 00139 void setAxesNumbersFont(); 00140 void setLegendsFont(); 00141 void editCurve(); 00142 void chooseLabelsFont(); 00143 void applyLayerFormat(); 00144 void setLayerDefaultValues(); 00145 void setEquidistantLevels(); 00146 void showCustomPenColumn(bool on); 00147 00148 private: 00149 void applyCanvasSize(); 00150 00151 void applyFormatToLayer(Graph *g); 00152 void applySymbolsFormatToCurve(QwtPlotCurve *c, bool fillColor = true, bool penColor = true); 00153 void applySymbolsFormatToLayer(Graph *g); 00154 void applySymbolsFormat(QwtPlotCurve *c); 00155 00156 void applyLineFormatToLayer(Graph *g); 00157 void applyLineFormat(QwtPlotCurve *c); 00158 00159 void applyErrorBarFormatToCurve(QwtErrorPlotCurve *err, bool color = true); 00160 void applyErrorBarFormatToLayer(Graph *g); 00161 void applyErrorBarFormat(QwtErrorPlotCurve *c); 00162 00163 int labelsAlignment(); 00164 void closeEvent(QCloseEvent* e); 00165 00166 void clearTabWidget(); 00167 void initAxesPage(); 00168 void initLinePage(); 00169 void initSymbolsPage(); 00170 void initHistogramPage(); 00171 void initErrorsPage(); 00172 void initSpacingPage(); 00173 void initVectPage(); 00174 void initBoxPage(); 00175 void initPercentilePage(); 00176 void initSpectrogramPage(); 00177 void initSpectrogramValuesPage(); 00178 void initContourLinesPage(); 00179 void initLayerPage(); 00180 void initLayerGeometryPage(); 00181 void initPlotGeometryPage(); 00182 void initLayerSpeedPage(); 00183 void initFontsPage(); 00184 void initMiscPage(); 00185 void initPiePage(); 00186 void initPieGeometryPage(); 00187 void initPieLabelsPage(); 00188 void initPrintPage(); 00189 void initLabelsPage(); 00190 void initFunctionPage(); 00191 void contextMenuEvent(QContextMenuEvent *e); 00192 void showAllLabelControls(bool show = true); 00193 void updateContourLevelsDisplay(Spectrogram *sp); 00194 QRect layerCanvasRect(QWidget *widget, double x, double y, double w, double h, FrameWidget::Unit unit); 00195 00196 double aspect_ratio, plot_aspect_ratio; 00197 00198 QFont titleFont, legendFont, axesFont, numbersFont; 00199 00200 MultiLayer *d_ml; 00201 QStringList columnNames; 00202 00203 DoubleSpinBox* boxX, *boxY, *boxLayerWidth, *boxLayerHeight; 00204 QCheckBox *keepRatioBox; 00205 00206 QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend; 00207 ColorMapEditor *colorMapEditor; 00208 QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage, *speedPage, *functionPage; 00209 QTreeWidget* listBox; 00210 QCheckBox *boxAntialiasing, *boxScaleLayers, *boxPrintCrops; 00211 ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor; 00212 QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin; 00213 QSpinBox *boxRadius; 00214 DoubleSpinBox *boxPieLineWidth; 00215 ColorBox *boxFirstColor; 00216 ColorButton *boxPieLineColor; 00217 PatternBox *boxPiePattern; 00218 PenStyleBox* boxPieLineStyle; 00219 00220 QPushButton* buttonApply, *btnWorksheet; 00221 QPushButton* buttonOk, *btnMore; 00222 QPushButton* buttonCancel; 00223 QComboBox* boxPlotType; 00224 QWidget* linePage; 00225 QComboBox* boxConnect; 00226 PenStyleBox* boxLineStyle; 00227 DoubleSpinBox *boxLineWidth, *boxPenWidth; 00228 ColorButton* boxLineColor, *boxAreaColor; 00229 QWidget* symbolPage; 00230 QSpinBox* boxSymbolSize; 00231 ColorButton *boxSymbolColor, *boxFillColor; 00232 SymbolBox* boxSymbolStyle; 00233 PatternBox *boxPattern; 00234 QTabWidget* privateTabWidget; 00235 QWidget *errorsPage, *spectrogramPage, *contourLinesPage; 00236 QGroupBox* fillGroupBox; 00237 QCheckBox* plusBox; 00238 QCheckBox* minusBox; 00239 QCheckBox* xBox; 00240 ColorButton *colorBox, *levelsColorBox, *vectColorBox; 00241 DoubleSpinBox* widthBox; 00242 QComboBox* capBox; 00243 QCheckBox* throughBox; 00244 QLabel *labelPosition, *labelXEnd, *labelYEnd; 00245 QGroupBox* GroupBoxH; 00246 QWidget *histogramPage, *spacingPage; 00247 QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox; 00248 QCheckBox *automaticBox; 00249 QPushButton* buttonStatistics, *btnEditCurve; 00250 QSpinBox* gapBox, *offsetBox, *boxWidth; 00251 QWidget *vectPage, *boxPage, *percentilePage, *axesPage; 00252 QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange; 00253 QSpinBox* headAngleBox, *headLengthBox, *boxPercSize; 00254 DoubleSpinBox *vectWidthBox, *boxEdgeWidth; 00255 QCheckBox *filledHeadBox; 00256 QSpinBox *boxCoef, *boxWhiskersCoef; 00257 QCheckBox *boxFillSymbols, *boxFillSymbol; 00258 ColorButton *boxPercFillColor, *boxEdgeColor; 00259 QLabel *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel; 00260 QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel; 00261 QGroupBox *GroupBoxVectEnd; 00262 QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox; 00263 PenStyleBox *boxContourStyle; 00264 QSpinBox *levelsBox, *colorScaleWidthBox; 00265 DoubleSpinBox *contourWidthBox; 00266 QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox; 00267 QGroupBox *defaultPenBox; 00268 QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox; 00269 00270 SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style; 00271 QDoubleSpinBox *whiskerCnt, *boxCnt; 00273 QGroupBox *labelsGroupBox; 00274 DoubleSpinBox *boxLabelsAngle; 00275 QSpinBox *boxLabelsXOffset, *boxLabelsYOffset; 00276 QCheckBox *boxLabelsWhiteOut; 00277 QPushButton *btnLabelsFont; 00278 QComboBox *boxLabelsAlign, *boxLabelsColumn; 00279 ColorButton* boxLabelsColor; 00280 QWidget *labelsPage; 00281 00282 QGroupBox *pieAutoLabelsBox, *boxPieWedge; 00283 DoubleSpinBox *boxPieStartAzimuth, *boxPieEdgeDist, *boxPieViewAngle, *boxPieThickness; 00284 QCheckBox *boxPieConterClockwise, *boxPieValues, *boxPiePercentages, *boxPieCategories; 00285 QWidget *pieLabelsPage; 00286 QSpinBox *boxPieOffset; 00287 QWidget *pieGeometryPage; 00288 00289 QComboBox *unitBox; 00290 QComboBox *backgroundApplyToBox; 00291 QPushButton *layerDefaultBtn; 00292 00293 DoubleSpinBox *firstContourLineBox, *contourLinesDistanceBox; 00294 QLabel *justifyLabelsLbl, *labelsColumnLbl; 00295 00296 QWidget *spectroValuesPage; 00297 QComboBox *boxSpectroMatrix; 00298 QCheckBox *boxUseMatrixFormula; 00299 ContourLinesEditor *contourLinesEditor; 00300 QPushButton *btnSetEquidistantLevels; 00301 QRadioButton *customPenBtn; 00302 00303 QSpinBox *boxSkipSymbols, *boxSkipErrorBars; 00304 QComboBox *symbolsFormatApplyToBox, *lineFormatApplyToBox, *errorBarsFormatApplyToBox, *sizeApplyToBox; 00305 QSpinBox *boxMaxPoints; 00306 DoubleSpinBox *boxDouglasPeukerTolerance; 00307 QGroupBox *speedModeBox; 00308 00309 QWidget *miscPage, *plotGeometryPage; 00310 QCheckBox *boxLinkXAxes; 00311 QComboBox *boxLinkAllXAxes; 00312 00313 FunctionDialog *functionEdit; 00314 QSpinBox *boxCurveOpacity; 00315 QSlider *curveOpacitySlider; 00316 00317 DoubleSpinBox *boxPlotX, *boxPlotY, *boxPlotWidth, *boxPlotHeight; 00318 QComboBox *plotUnitBox; 00319 QCheckBox *boxResizeLayers, *keepPlotRatioBox, *layerScaleFonts; 00320 EnrichmentDialog *enrichmentDialog; 00321 QPushButton *btnUp, *btnDown; 00322 }; 00323 00324 /***************************************************************************** 00325 * 00326 * Class LayerItem 00327 * 00328 *****************************************************************************/ 00330 class LayerItem : public QTreeWidgetItem 00331 { 00332 public: 00333 enum {LayerTreeItem = 1001}; 00334 LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s); 00335 00336 Graph *graph() { return d_graph; }; 00337 void setActive(bool select); 00338 00339 protected: 00340 void insertCurvesList(); 00341 void insertEnrichmentsList(); 00342 Graph *d_graph; 00343 }; 00344 00345 /***************************************************************************** 00346 * 00347 * Class CurveTreeItem 00348 * 00349 *****************************************************************************/ 00351 class CurveTreeItem : public QTreeWidgetItem 00352 { 00353 public: 00354 enum {PlotCurveTreeItem = 1002}; 00355 CurveTreeItem(QwtPlotItem *curve, LayerItem *parent, const QString& s); 00356 00357 Graph* graph(){return ((LayerItem *)parent())->graph();}; 00358 void setActive(bool on); 00359 00360 const QwtPlotItem *plotItem() { return d_curve; }; 00361 int plotItemType(); 00362 int plotItemStyle(); 00363 int plotItemIndex(); 00364 00365 protected: 00366 QwtPlotItem *d_curve; 00367 }; 00368 00369 /***************************************************************************** 00370 * 00371 * Class FrameWidgetTreeItem 00372 * 00373 *****************************************************************************/ 00375 class FrameWidgetTreeItem : public QTreeWidgetItem 00376 { 00377 public: 00378 enum {FrameWidgetItem = 1003}; 00379 FrameWidgetTreeItem(FrameWidget *w, LayerItem *parent, const QString& s); 00380 00381 Graph* graph(){return ((LayerItem *)parent())->graph();}; 00382 FrameWidget *frameWidget(){return d_widget;}; 00383 00384 void setActive(bool on); 00385 00386 protected: 00387 QPixmap frameWidgetPixmap(); 00388 00389 FrameWidget *d_widget; 00390 }; 00391 #endif