PlotDialog.h

Go to the documentation of this file.
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 
00051 class LayerItem;
00052 class CurveTreeItem;
00053 class ColorBox;
00054 class PatternBox;
00055 class ColorButton;
00056 class MultiLayer;
00057 class SymbolBox;
00058 class ColorMapEditor;
00059 class QwtPlotItem;
00060 class DoubleSpinBox;
00061 class PenStyleBox;
00062 class Spectrogram;
00063 class QwtErrorPlotCurve;
00064 class ContourLinesEditor;
00065 
00066 static const char* folder_closed[]={
00067     "16 16 9 1",
00068     "g c #808080",
00069     "b c #c0c000",
00070     "e c #c0c0c0",
00071     "# c #000000",
00072     "c c #ffff00",
00073     ". c None",
00074     "a c #585858",
00075     "f c #a0a0a4",
00076     "d c #ffffff",
00077     "..###...........",
00078     ".#abc##.........",
00079     ".#daabc#####....",
00080     ".#ddeaabbccc#...",
00081     ".#dedeeabbbba...",
00082     ".#edeeeeaaaab#..",
00083     ".#deeeeeeefe#ba.",
00084     ".#eeeeeeefef#ba.",
00085     ".#eeeeeefeff#ba.",
00086     ".#eeeeefefff#ba.",
00087     ".##geefeffff#ba.",
00088     "...##gefffff#ba.",
00089     ".....##fffff#ba.",
00090     ".......##fff#b##",
00091     ".........##f#b##",
00092     "...........####."};
00093 
00094 static const char * layer_disabled_xpm[] = {
00095 "14 14 3 1",
00096 "   c None",
00097 ".  c #666666",
00098 "+  c #FFFFFF",
00099 "..............",
00100 ".++++++++++++.",
00101 ".+..+++++++++.",
00102 ".+..+++++++++.",
00103 ".+..+++++++++.",
00104 ".+..+++++++++.",
00105 ".+..+++++++++.",
00106 ".+..+++++++++.",
00107 ".+..+++++++++.",
00108 ".+..+++++++++.",
00109 ".+..........+.",
00110 ".+..........+.",
00111 ".++++++++++++.",
00112 ".............."};
00113 
00114 /* XPM */
00115 static const char * layer_enabled_xpm[] = {
00116 "14 14 4 1",
00117 "   c None",
00118 ".  c #1A1A1A",
00119 "+  c #FFFFFF",
00120 "@  c #CB1D08",
00121 "..............",
00122 ".++++++++++++.",
00123 ".+@@+++++++++.",
00124 ".+@@+++++++++.",
00125 ".+@@+++++++++.",
00126 ".+@@+++++++++.",
00127 ".+@@+++++++++.",
00128 ".+@@+++++++++.",
00129 ".+@@+++++++++.",
00130 ".+@@+++++++++.",
00131 ".+@@@@@@@@@@+.",
00132 ".+@@@@@@@@@@+.",
00133 ".++++++++++++.",
00134 ".............."};
00135 
00136 static const char * graph_disabled_xpm[] = {
00137 "14 14 5 1",
00138 "   c None",
00139 ".  c #666666",
00140 "+  c #FFFFFF",
00141 "@  c #999999",
00142 "#  c #747474",
00143 "..............",
00144 ".++++@@++++++.",
00145 ".++++@@++++++.",
00146 ".+++@++@+++++.",
00147 ".++@++++@@+++.",
00148 ".+@+++++@@++#.",
00149 ".++++##+++@+#.",
00150 ".++++##++++#+.",
00151 ".+++#++#++#+@.",
00152 ".++#++++##+++.",
00153 ".+#+++++##+++.",
00154 ".++++++++++++.",
00155 ".++++++++++++.",
00156 ".............."};
00157 
00158 static const char * graph_enabled_xpm[] = {
00159 "14 14 6 1",
00160 "   c None",
00161 ".  c #030003",
00162 "+  c #FFFFFF",
00163 "@  c #FC0D00",
00164 "#  c #2F28EF",
00165 "$  c #0000FC",
00166 "..............",
00167 ".++++@@++++++.",
00168 ".++++@@++++++.",
00169 ".+++@++@+++++.",
00170 ".++@++++@@+++.",
00171 ".+@+++++@@++#.",
00172 ".++++##+++@+#.",
00173 ".++++##++++$+.",
00174 ".+++#++#++$+@.",
00175 ".++#++++##+++.",
00176 ".+#+++++##+++.",
00177 ".++++++++++++.",
00178 ".++++++++++++.",
00179 ".............."};
00180 
00182 class PlotDialog : public QDialog
00183 {
00184     Q_OBJECT
00185 
00186 public:
00187     PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 );
00188     void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
00189     void insertColumnsList(const QStringList& names){columnNames = names;};
00190     void setMultiLayer(MultiLayer *ml);
00191 
00192 public slots:
00193     void showAll(bool all);
00194     void selectCurve(int index);
00195 
00196 private slots:
00197     void showStatistics();
00198     void customVectorsPage(bool angleMag);
00199     void updateEndPointColumns(const QString& text);
00200 
00201     void fillBoxSymbols();
00202     void fillSymbols();
00203     bool acceptParams();
00204     void showWorksheet();
00205     void quit();
00206 
00207     int setPlotType(CurveTreeItem *item);
00208     void changePlotType(int plotType);
00209     void setActiveCurve(CurveTreeItem *item);
00210 
00211     void insertTabs(int plot_type);
00212     void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
00213     void showAreaColor(bool show);
00214 
00215     void removeSelectedCurve();
00216 
00217     void pickErrorBarsColor();
00218 
00219     void setAutomaticBinning();
00220     bool validInput();
00221     void showPlotAssociations(QTreeWidgetItem *item, int);
00222 
00223     //box plots
00224     void setBoxType(int index);
00225     void setBoxRangeType(int index);
00226     void setWhiskersRange(int index);
00227 
00228     //spectrograms
00229     void showDefaultContourLinesBox(bool show);
00230     void showColorMapEditor(bool show);
00231 
00232     //layer geometry
00233     void adjustLayerHeight(double width);
00234     void adjustLayerWidth(double height);
00235     void displayCoordinates(int unit, Graph *g = 0);
00236 
00237 protected slots:
00238     void setActiveLayer(LayerItem *item);
00239     void updateTreeWidgetItem(QTreeWidgetItem *item);
00240     void updateBackgroundTransparency(int alpha);
00241     void updateCanvasTransparency(int alpha);
00242     void setTitlesFont();
00243     void setAxesLabelsFont();
00244     void setAxesNumbersFont();
00245     void setLegendsFont();
00246     void editCurve();
00247     void chooseLabelsFont();
00248     void applyLayerFormat();
00249     void setLayerDefaultValues();
00250     void setEquidistantLevels();
00251     void showCustomPenColumn(bool on);
00252 
00253 private:
00254     void applyFormatToLayer(Graph *g);
00255     void applySymbolsFormatToCurve(QwtPlotCurve *c, bool fillColor = true, bool penColor = true);
00256     void applySymbolsFormatToLayer(Graph *g);
00257     void applySymbolsFormat(QwtPlotCurve *c);
00258 
00259     void applyLineFormatToLayer(Graph *g);
00260     void applyLineFormat(QwtPlotCurve *c);
00261 
00262     void applyErrorBarFormatToCurve(QwtErrorPlotCurve *err, bool color = true);
00263     void applyErrorBarFormatToLayer(Graph *g);
00264     void applyErrorBarFormat(QwtErrorPlotCurve *c);
00265 
00266     int labelsAlignment();
00267     void closeEvent(QCloseEvent* e);
00268 
00269     void clearTabWidget();
00270     void initAxesPage();
00271     void initLinePage();
00272     void initSymbolsPage();
00273     void initHistogramPage();
00274     void initErrorsPage();
00275     void initSpacingPage();
00276     void initVectPage();
00277     void initBoxPage();
00278     void initPercentilePage();
00279     void initSpectrogramPage();
00280     void initSpectrogramValuesPage();
00281     void initContourLinesPage();
00282     void initLayerPage();
00283     void initLayerGeometryPage();
00284     void initLayerSpeedPage();
00285     void initFontsPage();
00286     void initPiePage();
00287     void initPieGeometryPage();
00288     void initPieLabelsPage();
00289     void initPrintPage();
00290     void initLabelsPage();
00291     void contextMenuEvent(QContextMenuEvent *e);
00292     void showAllLabelControls(bool show = true);
00293     void updateContourLevelsDisplay(Spectrogram *sp);
00294 
00295     double aspect_ratio;
00296 
00297     QFont titleFont, legendFont, axesFont, numbersFont;
00298 
00299     MultiLayer *d_ml;
00300     QStringList columnNames;
00301 
00302     DoubleSpinBox* boxX, *boxY, *boxLayerWidth, *boxLayerHeight;
00303     QCheckBox *keepRatioBox;
00304 
00305     QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend;
00306     ColorMapEditor *colorMapEditor;
00307     QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage, *speedPage;
00308     QTreeWidget* listBox;
00309     QCheckBox *boxAntialiasing, *boxScaleLayers, *boxPrintCrops;
00310     ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor;
00311     QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin;
00312     QSpinBox *boxRadius;
00313     DoubleSpinBox *boxPieLineWidth;
00314     ColorBox *boxFirstColor;
00315     ColorButton *boxPieLineColor;
00316     PatternBox *boxPiePattern;
00317     PenStyleBox* boxPieLineStyle;
00318 
00319     QPushButton* buttonApply, *btnWorksheet;
00320     QPushButton* buttonOk, *btnMore;
00321     QPushButton* buttonCancel;
00322     QComboBox* boxPlotType;
00323     QWidget* linePage;
00324     QComboBox* boxConnect;
00325     PenStyleBox* boxLineStyle;
00326     DoubleSpinBox *boxLineWidth, *boxPenWidth;
00327     ColorButton* boxLineColor, *boxAreaColor;
00328     QWidget* symbolPage;
00329     QSpinBox* boxSymbolSize;
00330     ColorButton *boxSymbolColor, *boxFillColor;
00331     SymbolBox* boxSymbolStyle;
00332     PatternBox *boxPattern;
00333     QTabWidget* privateTabWidget;
00334     QWidget *errorsPage, *spectrogramPage, *contourLinesPage;
00335     QGroupBox* fillGroupBox;
00336     QCheckBox* plusBox;
00337     QCheckBox* minusBox;
00338     QCheckBox* xBox;
00339     ColorButton *colorBox, *levelsColorBox, *vectColorBox;
00340     DoubleSpinBox* widthBox;
00341     QComboBox* capBox;
00342     QCheckBox* throughBox;
00343     QLabel *labelPosition, *labelXEnd, *labelYEnd;
00344     QGroupBox* GroupBoxH;
00345     QWidget *histogramPage, *spacingPage;
00346     QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox;
00347     QCheckBox *automaticBox;
00348     QPushButton* buttonStatistics, *btnEditCurve;
00349     QSpinBox* gapBox, *offsetBox, *boxWidth;
00350     QWidget *vectPage, *boxPage, *percentilePage, *axesPage;
00351     QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange;
00352     QSpinBox* headAngleBox, *headLengthBox, *boxPercSize;
00353     DoubleSpinBox *vectWidthBox, *boxEdgeWidth;
00354     QCheckBox *filledHeadBox;
00355     QSpinBox *boxCoef, *boxWhiskersCoef;
00356     QCheckBox *boxFillSymbols, *boxFillSymbol;
00357     ColorButton *boxPercFillColor, *boxEdgeColor;
00358     QLabel  *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel;
00359     QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel;
00360     QGroupBox *GroupBoxVectEnd;
00361     QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox;
00362     PenStyleBox *boxContourStyle;
00363     QSpinBox *levelsBox, *colorScaleWidthBox;
00364     DoubleSpinBox *contourWidthBox;
00365     QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox;
00366     QGroupBox *defaultPenBox;
00367     QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox;
00368 
00369     SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style;
00370     QDoubleSpinBox *whiskerCnt, *boxCnt;
00372     QGroupBox *labelsGroupBox;
00373     DoubleSpinBox *boxLabelsAngle;
00374     QSpinBox *boxLabelsXOffset, *boxLabelsYOffset;
00375     QCheckBox *boxLabelsWhiteOut;
00376     QPushButton *btnLabelsFont;
00377     QComboBox *boxLabelsAlign, *boxLabelsColumn;
00378     ColorButton* boxLabelsColor;
00379     QWidget *labelsPage;
00380 
00381     QGroupBox *pieAutoLabelsBox, *boxPieWedge;
00382     DoubleSpinBox *boxPieStartAzimuth, *boxPieEdgeDist, *boxPieViewAngle, *boxPieThickness;
00383     QCheckBox *boxPieConterClockwise, *boxPieValues, *boxPiePercentages, *boxPieCategories;
00384     QWidget *pieLabelsPage;
00385     QSpinBox *boxPieOffset;
00386     QWidget *pieGeometryPage;
00387 
00388     QComboBox *unitBox;
00389     QComboBox *backgroundApplyToBox;
00390     QPushButton *layerDefaultBtn;
00391 
00392     DoubleSpinBox *firstContourLineBox, *contourLinesDistanceBox;
00393     QLabel *justifyLabelsLbl, *labelsColumnLbl;
00394 
00395     QWidget *spectroValuesPage;
00396     QComboBox *boxSpectroMatrix;
00397     QCheckBox *boxUseMatrixFormula;
00398     ContourLinesEditor *contourLinesEditor;
00399     QPushButton *btnSetEquidistantLevels;
00400     QRadioButton *customPenBtn;
00401 
00402     QSpinBox *boxSkipSymbols, *boxSkipErrorBars;
00403     QComboBox *symbolsFormatApplyToBox, *lineFormatApplyToBox, *errorBarsFormatApplyToBox;
00404     QSpinBox *boxMaxPoints;
00405     DoubleSpinBox *boxDouglasPeukerTolerance;
00406     QGroupBox *speedModeBox;
00407 };
00408 
00409 /*****************************************************************************
00410  *
00411  * Class LayerItem
00412  *
00413  *****************************************************************************/
00415 class LayerItem : public QTreeWidgetItem
00416 {
00417 public:
00418     enum {LayerTreeItem = 1001};
00419     LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s);
00420 
00421     Graph *graph() { return d_graph; };
00422     void setActive(bool select);
00423 
00424 protected:
00425     void insertCurvesList();
00426     Graph *d_graph;
00427 };
00428 
00429 /*****************************************************************************
00430  *
00431  * Class CurveTreeItem
00432  *
00433  *****************************************************************************/
00435 class CurveTreeItem : public QTreeWidgetItem
00436 {
00437 public:
00438     enum {PlotCurveTreeItem = 1002};
00439     CurveTreeItem(QwtPlotItem *curve, LayerItem *parent, const QString& s);
00440 
00441     Graph* graph(){return ((LayerItem *)parent())->graph();};
00442     void setActive(bool on);
00443 
00444     const QwtPlotItem *plotItem() { return d_curve; };
00445     int plotItemType();
00446     int plotItemIndex();
00447 
00448 protected:
00449     QwtPlotItem *d_curve;
00450 };
00451 
00452 #endif

Generated by  doxygen 1.6.2