QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : Graph.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2004-2008 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : Graph widget 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 GRAPH_H 00030 #define GRAPH_H 00031 00032 #include <QList> 00033 #include <QPointer> 00034 #include <QPrinter> 00035 #include <QVector> 00036 #include <QEvent> 00037 #include <QMap> 00038 00039 #include <qwt_text.h> 00040 #include <qwt_plot.h> 00041 #include <qwt_plot_marker.h> 00042 #include <qwt_plot_curve.h> 00043 00044 #include <AxesDialog.h> 00045 #include <PlotToolInterface.h> 00046 #include <ScaleDraw.h> 00047 #include <FrameWidget.h> 00048 #include <float.h> 00049 00050 class QwtPlotPanner; 00051 class QwtPlotMagnifier; 00052 class QwtPlotCurve; 00053 class QwtPlotZoomer; 00054 class QwtPieCurve; 00055 class Table; 00056 class ArrowMarker; 00057 class ImageWidget; 00058 class TitlePicker; 00059 class ScalePicker; 00060 class CanvasPicker; 00061 class ApplicationWindow; 00062 class Matrix; 00063 class SelectionMoveResizer; 00064 class RangeSelectorTool; 00065 class DataCurve; 00066 class PlotCurve; 00067 class QwtErrorPlotCurve; 00068 class MultiLayer; 00069 class Spectrogram; 00070 class FunctionCurve; 00071 class VectorCurve; 00072 class BoxCurve; 00073 class QwtHistogram; 00074 class Grid; 00075 class TexWidget; 00076 class LegendWidget; 00077 00079 typedef struct{ 00080 QColor lCol; 00081 float lWidth; 00082 int lStyle; 00083 double filledArea; 00084 QColor aCol; 00085 int aStyle; 00086 QColor symCol; 00087 QColor fillCol; 00088 float penWidth; 00089 int sSize; 00090 int sType; 00091 int connectType; 00092 } CurveLayout; 00093 00122 class Graph: public QwtPlot 00123 { 00124 Q_OBJECT 00125 00126 public: 00127 Graph (int x = 0, int y = 0, int width = 500, int height = 400, QWidget* parent=0, Qt::WFlags f=0); 00128 ~Graph(); 00129 00130 enum Axis{Left, Right, Bottom, Top}; 00131 enum Scale{Linear, Log10, Ln, Log2, Reciprocal, Probability, Logit}; 00132 enum Ticks{NoTicks = 0, Out = 1, InOut = 2, In = 3}; 00133 enum MarkerType{None = -1, Text = 0, Arrow = 1, Image = 2}; 00134 enum CurveType{Line, Scatter, LineSymbols, VerticalBars, Area, Pie, VerticalDropLines, 00135 Spline, HorizontalSteps, Histogram, HorizontalBars, VectXYXY, ErrorBars, 00136 Box, VectXYAM, VerticalSteps, ColorMap, GrayScale, Contour, Function, ImagePlot, 00137 StackBar, StackColumn}; 00138 enum LegendDisplayMode{ColumnName, ColumnComment, TableName, TableLegend}; 00139 enum AxisTitlePolicy{Default, ColName, ColComment, NameAndComment}; 00140 00142 MultiLayer *multiLayer() const; 00143 00145 void setActiveTool(PlotToolInterface *tool); 00147 PlotToolInterface* activeTool() const { return d_active_tool; } 00149 bool hasActiveTool(); 00150 00151 QList <LegendWidget *> textsList(); 00152 LegendWidget *activeText(); 00153 void setActiveText(LegendWidget *l){d_active_enrichment = (FrameWidget *)l;}; 00154 void select(QWidget *l, bool add = false); 00155 00156 FrameWidget *activeEnrichment(){return d_active_enrichment;}; 00157 QList <FrameWidget *> enrichmentsList(){return d_enrichments;}; 00158 QList <FrameWidget *> increasingAreaEnrichmentsList(); 00159 00160 bool hasSeletedItems(); 00161 void deselect(); 00162 void deselect(QWidget *); 00163 00164 QPointer<SelectionMoveResizer> selectionMoveResizer(){return d_markers_selector;}; 00165 00166 QwtPlotItem* selectedCurveLabels(); 00168 void restoreCurveLabels(int curveID, const QStringList& lst); 00169 00170 Grid *grid(){return (Grid *)d_grid;}; 00171 QList<QwtPlotItem *> curvesList(){return d_curves;}; 00172 00173 QwtPlotItem* closestCurve(int xpos, int ypos, int &dist, int &point); 00174 00175 void insertMarker(QwtPlotMarker *m); 00176 00177 QList<int> getMajorTicksType(); 00178 void setMajorTicksType(int axis, int type); 00179 00180 QList<int> getMinorTicksType(); 00181 void setMinorTicksType(int axis, int type); 00182 00183 int minorTickLength() const; 00184 int majorTickLength() const; 00185 void setTickLength (int minLength, int majLength); 00186 00187 int axesLinewidth() const; 00188 void setAxesLinewidth(int width); 00189 00190 void axisLabelFormat(int axis, char &f, int &prec) const; 00191 00192 int axisLabelFormat(int axis); 00193 int axisLabelPrecision(int axis); 00194 00195 QColor frameColor(); 00196 const QColor & paletteBackgroundColor() const; 00197 00198 void print(QPainter *, const QRect &rect, const QwtPlotPrintFilter & = QwtPlotPrintFilter()); 00199 void updateLayout(); 00200 void setCanvasGeometry(const QRect &canvasRect); 00202 void setCanvasGeometry(int x, int y, int w, int h){setCanvasGeometry(QRect(x, y, w, h));}; 00203 void setCanvasSize(const QSize &size); 00205 void setCanvasSize(int w, int h){setCanvasSize(QSize(w, h));}; 00206 00207 void updateCurveLabels(); 00208 00209 TexWidget* addTexFormula(const QString& s, const QPixmap& pix); 00210 00211 FrameWidget* add(FrameWidget* fw, bool copy = true); 00212 void remove(FrameWidget*); 00213 00214 QRect boundingRect(); 00215 void raiseEnrichements(); 00216 void addLegendItem(); 00217 bool isPrinting(){return d_is_printing;}; 00218 00219 void enablePanningMagnifier(bool on = true, int mode = 0); 00220 bool hasPanningMagnifierEnabled(){if (d_magnifier && d_panner) return true; return false;}; 00221 QwtPlotMagnifier* magnifyTool(){return d_magnifier;}; 00222 00223 static QString escapeTeXSpecialCharacters(const QString &); 00224 static QString texSuperscripts(const QString &); 00225 00226 void changeCurveIndex(int fromIndex, int toIndex); 00227 void enableDouglasPeukerSpeedMode(double tolerance, int maxPoints); 00228 00229 int speedModeMaxPoints(){return d_speed_mode_points;}; 00230 double getDouglasPeukerTolerance(){return d_Douglas_Peuker_tolerance;}; 00231 00232 AxisTitlePolicy axisTitlePolicy(){return d_axis_title_policy;}; 00233 void setAxisTitlePolicy(const AxisTitlePolicy& policy){d_axis_title_policy = policy;}; 00234 void setSynchronizedScaleDivisions(bool on){d_synchronize_scales = on;}; 00235 00236 public slots: 00237 void copy(Graph* g); 00238 void copyCurves(Graph* g); 00239 00241 00242 00243 bool isPiePlot(); 00245 QwtPieCurve* plotPie(Table* w,const QString& name, int startRow = 0, int endRow = -1); 00247 QwtPieCurve* plotPie(Table* w, const QString& name, const QPen& pen, int brush, int size, 00248 int firstColor, int startRow = 0, int endRow = -1, bool visible = true, 00249 double d_start_azimuth = 270, double d_view_angle = 90, double d_thickness = 33, 00250 double d_horizontal_offset = 0.0, double d_edge_dist = 25, bool d_counter_clockwise = false, 00251 bool d_auto_labeling = true, bool d_values = false, bool d_percentages = true, 00252 bool d_categories = false, bool d_fixed_labels_pos = true); 00253 00254 void removePie(); 00255 QString pieLegendText(); 00256 QString savePieCurveLayout(); 00258 00259 bool addCurves(Table* w, const QStringList& names, int style = 0, double lWidth = 1, int sSize = 3, int startRow = 0, int endRow = -1); 00260 DataCurve* insertCurve(Table* w, const QString& name, int style, int startRow = 0, int endRow = -1); 00261 DataCurve* insertCurve(Table* w, int xcol, const QString& name, int style); 00262 DataCurve* insertCurve(Table* w, const QString& xColName, const QString& yColName, int style, int startRow = 0, int endRow = -1); 00263 void insertPlotItem(QwtPlotItem *i, int type); 00264 void insertCurve(QwtPlotItem *c); 00265 00267 void showCurve(int index, bool visible = true); 00268 int visibleCurves(); 00269 00270 void removeCurve(QwtPlotItem *it); 00272 void removeCurve(int index); 00276 void removeCurve(const QString& s); 00280 void removeCurves(const QString& s); 00281 00282 void updateCurvesData(Table* w, const QString& yColName); 00283 00284 int curveCount(){return d_curves.size();}; 00285 bool validCurvesDataSize(); 00286 double selectedXStartValue(); 00287 double selectedXEndValue(); 00288 00290 int curveIndex(QwtPlotItem *c){return d_curves.indexOf(c);}; 00292 int curveIndex(const QString &title){return plotItemsList().findIndex(title);} 00293 DataCurve* dataCurve(int index); 00295 PlotCurve* curve(int index); 00297 PlotCurve* curve(const QString &title){return curve(curveIndex(title));}; 00299 QString curveTitle(int index); 00300 00302 QStringList analysableCurvesList(); 00304 QStringList curveNamesList(); 00306 QStringList plotItemsList(); 00308 QwtPlotItem* plotItem(int index); 00309 00310 void updateCurveNames(const QString& oldName, const QString& newName, bool updateTableName = true); 00311 00313 00314 void setCurveStyle(int index, int s); 00315 void setCurveFullRange(int curveIndex); 00316 void setCurveLineColor(int curveIndex, int colorIndex); 00317 void setCurveLineColor(int curveIndex, QColor qColor); 00318 void setCurveLineStyle(int curveIndex, Qt::PenStyle style); 00319 void setCurveLineWidth(int curveIndex, double width); 00320 void setGrayScale(); 00321 void setIndexedColors(); 00323 00325 00326 void print(); 00327 void copyImage(); 00328 QPixmap graphPixmap(const QSize& size = QSize(), double scaleFontsFactor = 1.0, bool transparent = false); 00330 void exportToFile(const QString& fileName); 00331 void exportSVG(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0); 00332 #ifdef EMF_OUTPUT 00333 void exportEMF(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0); 00334 #endif 00335 void exportTeX(const QString& fname, bool color = true, bool escapeStrings = true, bool fontSizes = true, 00336 const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0); 00337 void exportVector(const QString& fileName, int res = 0, bool color = true, 00338 const QSizeF& customSize = QSizeF (), int unit = FrameWidget::Pixel, double fontsFactor = 1.0); 00339 void exportImage(const QString& fileName, int quality = 100, bool transparent = false, 00340 int dpi = 0, const QSizeF& customSize = QSizeF (), 00341 int unit = FrameWidget::Pixel, double fontsFactor = 1.0); 00342 00343 void draw(QPaintDevice *, const QSize& size, double fontsFactor = 1.0); 00344 static QSize customPrintSize(const QSizeF& customSize, int unit, int dpi); 00345 00346 bool isExportingTeX(){return d_is_exporting_tex;}; 00347 void setTeXExportingMode(bool on = true){d_is_exporting_tex = on;}; 00348 bool escapeTeXStrings(){return d_tex_escape_strings;}; 00349 void setEscapeTeXStringsMode(bool on = true){d_tex_escape_strings = on;}; 00351 00352 void updatePlot(); 00353 00355 00356 QwtErrorPlotCurve* addErrorBars(const QString& xColName, const QString& yColName, Table *errTable, 00357 const QString& errColName, int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black), 00358 bool through = true, bool minus = true, bool plus = true); 00359 00360 QwtErrorPlotCurve* addErrorBars(const QString& yColName, Table *errTable, const QString& errColName, 00361 int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black), 00362 bool through = true, bool minus = true, bool plus = true); 00363 00364 void updateErrorBars(QwtErrorPlotCurve *er, bool xErr, double width, int cap, const QColor& c, bool plus, bool minus, bool through); 00365 00367 DataCurve* masterCurve(QwtErrorPlotCurve *er); 00369 DataCurve* masterCurve(const QString& xColName, const QString& yColName); 00371 00373 00374 void contextMenuEvent(QContextMenuEvent *); 00375 void closeEvent(QCloseEvent *e); 00376 bool focusNextPrevChild ( bool next ); 00378 00380 void invertScale(int axis); 00381 void setScale(int axis, double start, double end, double step = 0.0, 00382 int majorTicks = 5, int minorTicks = 5, int type = 0, bool inverted = false, 00383 double left_break = -DBL_MAX, double right_break = DBL_MAX, int pos = 50, 00384 double stepBeforeBreak = 0.0, double stepAfterBreak = 0.0, int minTicksBeforeBreak = 4, 00385 int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, bool breakDecoration = true); 00386 double axisStep(int axis){return d_user_step[axis];}; 00387 void setCanvasCoordinates(const QRectF&); 00388 00390 00391 CurveLayout initCurveLayout(int style, int curves = 0, bool guessLayout = true); 00392 static CurveLayout initCurveLayout(); 00393 void updateCurveLayout(PlotCurve* c, const CurveLayout *cL); 00395 void guessUniqueCurveLayout(int& colorIndex, int& symbolIndex); 00397 00399 00400 void zoomed (const QwtDoubleRect &); 00401 void zoom(bool on); 00402 void zoomOut(); 00403 bool zoomOn(); 00405 00406 void setAutoScale(); 00407 void updateScale(); 00408 00410 00411 QString saveToString(bool saveAsTemplate = false); 00412 QString saveScale(); 00413 QString saveScaleTitles(); 00414 QString saveFonts(); 00415 QString saveMarkers(); 00416 QString saveCurveLayout(int index); 00417 QString saveAxesTitleColors(); 00418 QString saveAxesColors(); 00419 QString saveEnabledAxes(); 00420 QString saveCanvas(); 00421 QString saveTitle(); 00422 QString saveAxesTitleAlignement(); 00423 QString saveEnabledTickLabels(); 00424 QString saveTicksType(); 00425 QString saveCurves(); 00426 QString saveLabelsFormat(); 00427 QString saveLabelsRotation(); 00428 QString saveAxesLabelsType(); 00429 QString saveAxesBaseline(); 00430 QString saveAxesFormulas(); 00431 QString saveAxesBackbones(); 00432 QString saveTickLabelsSpace(); 00433 QString saveLabelsPrefixAndSuffix(); 00435 00437 00438 LegendWidget* addText(LegendWidget*); 00440 LegendWidget* insertText(const QStringList& list, int fileVersion); 00441 00442 LegendWidget* addTimeStamp(); 00443 void removeLegendItem(int index); 00444 void insertLegend(const QStringList& lst, int fileVersion); 00445 00446 LegendWidget* newLegend(const QString& text = QString()); 00448 QString legendText(bool layerSpec = false, int fromIndex = 0); 00450 00452 00453 LegendWidget* legend(); 00454 void setLegend(const QString&); 00455 void removeLegend(); 00457 00459 00460 ArrowMarker* addArrow(ArrowMarker* mrk); 00461 void remove(ArrowMarker* arrow); 00462 00464 void addArrow(QStringList list, int fileVersion); 00465 QList<ArrowMarker *> arrowsList(){return d_lines;}; 00466 int numArrows(){return d_lines.count();}; 00467 00469 void drawLine(bool on, bool arrow = false); 00470 bool drawArrow(){return drawArrowOn;}; 00471 bool drawLineActive(){return drawLineOn;}; 00472 bool arrowMarkerSelected(); 00474 00476 00477 ImageWidget* addImage(ImageWidget* i); 00478 ImageWidget* addImage(const QString& fileName); 00479 ImageWidget* addImage(const QImage& image); 00480 00481 void insertImageMarker(const QStringList& lst, int fileVersion); 00482 bool imageMarkerSelected(); 00484 00486 00487 void removeMarker(); 00489 void updateMarkersBoundingRect(bool rescaleEvent = true); 00490 00497 void setSelectedArrow(ArrowMarker* mrk, bool add = false); 00498 ArrowMarker* selectedArrow(){return d_selected_arrow;}; 00499 bool markerSelected(); 00501 void deselectMarker(); 00503 00505 00506 QwtScaleWidget* currentScale(); 00507 QwtScaleWidget* selectedScale(); 00508 QRect axisTitleRect(const QwtScaleWidget *scale); 00509 bool axisTitleSelected(); 00510 00511 ScaleDraw::ScaleType axisType(int axis); 00512 00513 void setXAxisTitle(const QString& text); 00514 void setYAxisTitle(const QString& text); 00515 void setRightAxisTitle(const QString& text); 00516 void setTopAxisTitle(const QString& text); 00517 00518 QString axisTitleString(int axis); 00519 void setAxisTitleString(int axis, const QString& text); 00520 void setAxisTitle(int axis, const QString& text); 00521 void updateAxesTitles(); 00523 void setScaleTitle(int axis, const QString& text); 00524 00525 QFont axisTitleFont(int axis); 00526 void setAxisTitleFont(int axis,const QFont &fnt); 00527 00528 void setAxisFont(int axis, const QFont &fnt); 00529 void initFonts(const QFont &scaleTitleFnt,const QFont &numbersFnt); 00530 00531 QColor axisTitleColor(int axis); 00532 void setAxisTitleColor(int axis, const QColor& c); 00533 00534 int axisTitleAlignment (int axis); 00535 void setAxisTitleAlignment(int axis, int align); 00536 00537 int axisTitleDistance(int axis); 00538 void setAxisTitleDistance(int axis, int dist); 00539 00540 QColor axisColor(int axis); 00541 void setAxisColor(int axis, const QColor& color); 00542 00543 QColor axisLabelsColor(int axis); 00544 void setAxisLabelsColor(int axis, const QColor& color); 00545 00546 void showAxis(int axis, int type, const QString& formatInfo, Table *table, bool axisOn, 00547 int majTicksType, int minTicksType, bool labelsOn, const QColor& c, int format, 00548 int prec, int rotation, int baselineDist, const QString& formula, const QColor& labelsColor, 00549 int spacing = 4, bool backbone = true, const ScaleDraw::ShowTicksPolicy& showTicks = ScaleDraw::ShowAll, 00550 const QString& prefix = QString::null, const QString& suffix = QString::null); 00551 00552 void enableAxis(int axis, bool on = true); 00553 void enableAxisLabels(int axis, bool on = true); 00554 00555 int labelsRotation(int axis); 00556 void setAxisLabelRotation(int axis, int rotation); 00557 00559 void loadAxesLinewidth(int width); 00560 00561 void drawAxesBackbones(bool yes); 00562 bool axesBackbones(){return drawAxesBackbone;}; 00564 void loadAxesOptions(const QStringList& lst); 00565 00566 void setAxisMargin(int axis, int margin); 00567 00568 void setMajorTicksType(const QList<int>& lst); 00569 void setMajorTicksType(const QStringList& lst); 00570 00571 void setMinorTicksType(const QList<int>& lst); 00572 void setMinorTicksType(const QStringList& lst); 00573 00574 void setAxisTicksLength(int axis, int majTicksType, int minTicksType, int minLength, int majLength); 00575 void setTicksLength(int minLength, int majLength); 00576 void changeTicksLength(int minLength, int majLength); 00578 void setLabelsNumericFormat(const QStringList& l); 00579 void setLabelsNumericFormat(int axis, int format, int prec = 6, const QString& formula = QString()); 00580 void setLabelsDateTimeFormat(int axis, int type, const QString& formatInfo); 00581 void setLabelsDayFormat(int axis, int format); 00582 void setLabelsMonthFormat(int axis, int format); 00583 00584 QString axisFormatInfo(int axis); 00585 00586 void setLabelsTextFormat(int axis, int type, const QString& name, const QStringList& lst); 00587 void setLabelsTextFormat(int axis, int type, const QString& labelsColName, Table *table); 00588 00589 QString axisFormula(int axis); 00590 void setAxisFormula(int axis, const QString &); 00592 00594 00595 void setCanvasFrame(int width = 1, const QColor& color = QColor(Qt::black)); 00596 QColor canvasFrameColor(); 00597 int canvasFrameWidth(); 00599 00601 00602 void setTitleFont(const QFont &fnt); 00603 void setTitleColor(const QColor &c); 00604 void setTitleAlignment(int align); 00605 00606 bool titleSelected(); 00607 void selectTitle(bool select = true); 00609 void clearTitle(); 00611 void removeTitle(); 00612 void initTitle( bool on, const QFont& fnt); 00614 00616 00617 QString selectedCurveTitle(); 00619 00620 void disableTools(); 00621 00628 bool enableRangeSelectors(const QObject *status_target=NULL, const char *status_slot=""); 00629 bool rangeSelectorsEnabled(); 00630 QPointer<RangeSelectorTool> rangeSelectorTool(){return d_range_selector;}; 00632 00633 void setFrame(int width = 1, const QColor& color = Qt::black); 00634 void setBackgroundColor(const QColor& color); 00636 00637 void addFitCurve(QwtPlotCurve *c); 00638 void deleteFitCurves(); 00639 QList<QwtPlotCurve *> fitCurvesList(){return d_fit_curves;}; 00644 int range(const QString& curveTitle, double *start, double *end); 00649 int range(QwtPlotCurve *c, double *start, double *end); 00650 00652 void setBarsGap(int curve, int gapPercent, int offset); 00653 00655 00656 void modifyFunctionCurve(int curve, int type, const QStringList &formulas, const QString &var, 00657 double start, double end, int points, const QMap<QString, double>& constants); 00658 FunctionCurve* addFunction(const QStringList &formulas, double start, double end, int points = 100, const QString &var = "x", int type = 0, const QString& title = QString::null); 00660 FunctionCurve* insertFunctionCurve(const QString& formula, int points, int fileVersion); 00661 00663 QString generateFunctionName(const QString& name = tr("F")); 00665 00667 void createTable(const QString& curveName); 00668 void createTable(const QwtPlotCurve* curve); 00669 void activateGraph(); 00670 00672 00673 VectorCurve* plotVectorCurve(Table* w, const QStringList& colList, int style, int startRow = 0, int endRow = -1); 00674 void updateVectorsLayout(int curve, const QColor& color, double width, int arrowLength, int arrowAngle, bool filled, int position, 00675 const QString& xEndColName = QString(), const QString& yEndColName = QString()); 00677 00679 00680 BoxCurve* openBoxDiagram(Table *w, const QStringList& l, int fileVersion); 00681 void plotBoxDiagram(Table *w, const QStringList& names, int startRow = 0, int endRow = -1); 00683 00685 00686 void resizeEvent(QResizeEvent *e); 00687 void scaleFonts(double factor); 00689 00690 void notifyChanges(); 00691 00692 void updateSecondaryAxis(int axis, bool changeFormat = false); 00693 00694 bool isAutoscalingEnabled(){return d_auto_scale;}; 00695 void enableAutoscaling(bool on = true){d_auto_scale = on;}; 00696 00697 bool autoscaleFonts(){return autoScaleFonts;}; 00698 void setAutoscaleFonts(bool on = true){autoScaleFonts = on;}; 00699 00700 static int obsoleteSymbolStyle(int type); 00701 static QString penStyleName(Qt::PenStyle style); 00702 static Qt::PenStyle getPenStyle(const QString& s); 00703 static Qt::PenStyle getPenStyle(int style); 00704 static void showPlotErrorMessage(QWidget *parent, const QStringList& emptyColumns); 00705 00706 void showTitleContextMenu(); 00707 void copyTitle(); 00708 void cutTitle(); 00709 00710 void clearAxisTitle(); 00711 void removeAxisTitle(); 00712 void cutAxisTitle(); 00713 void copyAxisTitle(); 00714 void showAxisTitleMenu(); 00715 void showAxisContextMenu(int axis); 00716 void hideSelectedAxis(); 00717 void showGrids(); 00718 00720 void showGrid(); 00722 void showGrid(int axis); 00723 00724 void showAxisDialog(); 00725 void showScaleDialog(); 00726 00728 Spectrogram* spectrogram(Matrix *m); 00730 Spectrogram* plotSpectrogram(Matrix *m, CurveType type); 00732 void restoreSpectrogram(ApplicationWindow *app, const QStringList& lst); 00734 QwtHistogram* addHistogram(Matrix *m); 00736 QwtHistogram* restoreHistogram(Matrix *m, const QStringList& l); 00737 00738 bool antialiasing(){return d_antialiasing;}; 00740 void setAntialiasing(bool on = true, bool update = true); 00741 00742 void disableCurveAntialiasing(bool disable, int maxPoints); 00743 bool isCurveAntialiasingEnabled(QwtPlotItem *it); 00744 00745 void setCurrentFont(const QFont& f); 00746 void notifyFontChange(const QFont& f){emit currentFontChanged(f);}; 00747 void enableTextEditor(); 00748 00749 signals: 00750 void selectedGraph (Graph*); 00751 void closedGraph(); 00752 void drawLineEnded(bool); 00753 void cursorInfo(const QString&); 00754 void showPlotDialog(int); 00755 00756 void viewLineDialog(); 00757 void viewTitleDialog(); 00758 void modifiedGraph(); 00759 void hiddenPlot(QWidget*); 00760 00761 void showContextMenu(); 00762 void showCurveContextMenu(QwtPlotItem *); 00763 void showMarkerPopupMenu(); 00764 00765 void showAxisDialog(int); 00766 void axisDblClicked(int); 00767 00768 void showAxisTitleDialog(); 00769 00770 void dataRangeChanged(); 00771 void showFitResults(const QString&); 00772 void currentFontChanged(const QFont&); 00773 void enableTextEditor(Graph *); 00774 void axisDivChanged(Graph *, int); 00775 void updatedLayout(Graph *); 00776 void selectionChanged(SelectionMoveResizer *); 00777 00778 private slots: 00779 void selectorDeleted(); 00780 00781 private: 00782 QString parseAxisTitle(int axis); 00783 QList<FrameWidget*> stackingOrderEnrichmentsList() const; 00785 QwtDoubleInterval axisBoundingInterval(int axis); 00786 void deselectCurves(); 00787 00788 void dropEvent(QDropEvent*); 00789 void dragEnterEvent(QDragEnterEvent*); 00790 void showEvent (QShowEvent * event); 00791 void printFrame(QPainter *painter, const QRect &rect) const; 00792 void printCanvas(QPainter *painter, const QRect &canvasRect, 00793 const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const; 00794 virtual void printScale (QPainter *, int axisId, int startDist, int endDist, 00795 int baseDist, const QRect &) const; 00796 virtual void drawItems (QPainter *painter, const QRect &rect, 00797 const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const; 00798 00799 void drawInwardTicks(QPainter *painter, const QRect &rect, 00800 const QwtScaleMap&map, int axis, bool min, bool maj) const; 00801 void drawBreak(QPainter *painter, const QRect &rect, const QwtScaleMap &map, int axis) const; 00802 00803 QwtPlotZoomer *d_zoomer[2]; 00804 TitlePicker *titlePicker; 00805 ScalePicker *scalePicker; 00806 CanvasPicker* cp; 00808 Grid *d_grid; 00810 QList<QwtPlotItem*> d_curves; 00812 QList<QwtPlotCurve *>d_fit_curves; 00814 bool d_antialiasing; 00815 bool d_disable_curve_antialiasing; 00816 int d_max_antialising_size; 00817 bool autoScaleFonts; 00818 bool drawLineOn, drawArrowOn, drawAxesBackbone; 00820 bool d_is_printing; 00822 QVector<double> d_user_step; 00824 QList<ArrowMarker*> d_lines; 00826 ArrowMarker* d_selected_arrow; 00828 QPointer<SelectionMoveResizer> d_markers_selector; 00830 QPointer<RangeSelectorTool> d_range_selector; 00832 PlotToolInterface *d_active_tool, *d_peak_fit_tool; 00834 FrameWidget *d_active_enrichment; 00836 bool d_auto_scale; 00838 int d_min_tick_length, d_maj_tick_length; 00839 bool d_is_exporting_tex; 00840 bool d_tex_escape_strings; 00841 QList<FrameWidget*> d_enrichments; 00842 QwtPlotMagnifier *d_magnifier; 00843 QwtPlotPanner *d_panner; 00844 00845 double d_Douglas_Peuker_tolerance; 00846 int d_speed_mode_points; 00847 AxisTitlePolicy d_axis_title_policy; 00848 bool d_synchronize_scales; 00849 QStringList d_axis_titles; 00850 }; 00851 #endif // GRAPH_H