//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <qwt_scale_draw.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_picker.h>
#include <qwt_scale_draw.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_picker.h>
typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*> CurveDict;
typedef QMultiHash<QwtPlotItem*, Plot2d_Object*> ObjectDict;
typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*> CurveDict;
typedef QMultiHash<QwtPlotItem*, Plot2d_Object*> ObjectDict;
-class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget, public Plot2d_CurveContainer
-{
+class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget
+#ifndef NO_ANALYTICAL_CURVES
+ , public Plot2d_CurveContainer
+#endif
+{
-
- enum { NoOpId, FitAreaId, ZoomId, PanId, GlPanId, DumpId,
+
+ enum { NoOpId, FitAreaId, ZoomId, PanId, GlPanId, DumpId,
ModeXLinearId, ModeXLogarithmicId, ModeYLinearId, ModeYLogarithmicId,
LegendId, CurvePointsId, CurveLinesId, CurveSplinesId };
public:
ModeXLinearId, ModeXLogarithmicId, ModeYLinearId, ModeYLogarithmicId,
LegendId, CurvePointsId, CurveLinesId, CurveSplinesId };
public:
Plot2d_ViewFrame( QWidget*, const QString& = "" );
virtual ~Plot2d_ViewFrame();
Plot2d_ViewFrame( QWidget*, const QString& = "" );
virtual ~Plot2d_ViewFrame();
enum ObjectType { MainTitle, XTitle, YTitle, Y2Title, XAxis, YAxis, Y2Axis };
QWidget* getViewWidget();
enum ObjectType { MainTitle, XTitle, YTitle, Y2Title, XAxis, YAxis, Y2Axis };
QWidget* getViewWidget();
void setTitle( const QString& );
QString getTitle() const;
QVector< QVector<QwtPlotCurve *> > displayPlot2dCurveList( const QList< QList<Plot2d_Curve*> >& sysCoCurveList,
bool displayLegend,
const QList< QList<bool> >& sides);
void setTitle( const QString& );
QString getTitle() const;
QVector< QVector<QwtPlotCurve *> > displayPlot2dCurveList( const QList< QList<Plot2d_Curve*> >& sysCoCurveList,
bool displayLegend,
const QList< QList<bool> >& sides);
QVector< QVector<QwtPlotCurve *> > displayPlot2dCurveList( const QList<Plot2d_Curve*>& curveList,
int groupsize,
bool displayLegend,
const QList< bool >& sides);
QVector< QVector<QwtPlotCurve *> > displayPlot2dCurveList( const QList<Plot2d_Curve*>& curveList,
int groupsize,
bool displayLegend,
const QList< bool >& sides);
void fitData( const int, const double, const double,
const double, const double,
const double = 0, const double = 0 );
void fitData( const int, const double, const double,
const double, const double,
const double = 0, const double = 0 );
void getFitRanges( double&, double&, double&, double&,
double&, double&);
void getFitRanges( double&, double&, double&, double&,
double&, double&);
void getFitRangeByCurves( double&, double&, double&, double&,
double&, double& );
void getFitRangeByMarkers(double&, double&, double&, double&,
double&, double& );
void getFitRangeByCurves( double&, double&, double&, double&,
double&, double& );
void getFitRangeByMarkers(double&, double&, double&, double&,
double&, double& );
void addAnalyticalCurve( Plot2d_AnalyticalCurve* );
void removeAnalyticalCurve( Plot2d_AnalyticalCurve* );
void updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false );
void updateAnalyticalCurves();
void addAnalyticalCurve( Plot2d_AnalyticalCurve* );
void removeAnalyticalCurve( Plot2d_AnalyticalCurve* );
void updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false );
void updateAnalyticalCurves();
AnalyticalCurveList getAnalyticalCurves() const;
Plot2d_AnalyticalCurve* getAnalyticalCurve(QwtPlotItem *);
AnalyticalCurveList getAnalyticalCurves() const;
Plot2d_AnalyticalCurve* getAnalyticalCurve(QwtPlotItem *);
void showLegend( bool, bool = true );
void setLegendPos( int );
int getLegendPos() const;
void showLegend( bool, bool = true );
void setLegendPos( int );
int getLegendPos() const;
void setLegendFont( const QFont& );
QFont getLegendFont() const;
void setLegendFontColor( const QColor& );
QColor getLegendFontColor() const;
void setLegendFont( const QFont& );
QFont getLegendFont() const;
void setLegendFontColor( const QColor& );
QColor getLegendFontColor() const;
void setMarkerSize( const int, bool = true );
int getMarkerSize() const;
void setMarkerSize( const int, bool = true );
int getMarkerSize() const;
void setXGrid( bool, const int, bool, const int, bool = true );
void setYGrid( bool, const int, bool, const int,
bool, const int, bool, const int, bool = true );
void setXGrid( bool, const int, bool, const int, bool = true );
void setYGrid( bool, const int, bool, const int,
bool, const int, bool, const int, bool = true );
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
bool isXLogEnabled() const;
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
bool isXLogEnabled() const;
void setEnableAxis( QwtPlot::Axis, bool );
virtual bool print( const QString&, const QString& ) const;
void setEnableAxis( QwtPlot::Axis, bool );
virtual bool print( const QString&, const QString& ) const;
- void printPlot( QPainter*, const QRect&,
- const QwtPlotPrintFilter& = QwtPlotPrintFilter() ) const;
+ void printPlot( QPainter*, const QRectF& ) const;
QwtPlotCanvas* getPlotCanvas() const;
Plot2d_Curve* getClosestCurve( QPoint, double&, int& ) const;
QwtPlotCanvas* getPlotCanvas() const;
Plot2d_Curve* getClosestCurve( QPoint, double&, int& ) const;
Plot2d_Object* getPlotObject( QwtPlotItem* ) const;
QwtPlotItem* getPlotObject( Plot2d_Object* ) const;
QwtPlotCurve* getPlotCurve( Plot2d_Curve* ) const;
Plot2d_Object* getPlotObject( QwtPlotItem* ) const;
QwtPlotItem* getPlotObject( Plot2d_Object* ) const;
QwtPlotCurve* getPlotCurve( Plot2d_Curve* ) const;
void updatePlotItem(Plot2d_Object*, QwtPlotItem*);
protected:
int testOperation( const QMouseEvent& );
void updatePlotItem(Plot2d_Object*, QwtPlotItem*);
protected:
int testOperation( const QMouseEvent& );
QString getInfo( const QPoint& );
virtual void wheelEvent( QWheelEvent* );
bool hasPlotCurve( Plot2d_Curve* ) const;
QString getInfo( const QPoint& );
virtual void wheelEvent( QWheelEvent* );
bool hasPlotCurve( Plot2d_Curve* ) const;
QString myTitle, myXTitle, myYTitle, myY2Title;
bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled;
bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled;
QString myTitle, myXTitle, myYTitle, myY2Title;
bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled;
bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled;
Plot2d_NormalizeAlgorithm* myLNormAlgo;
Plot2d_NormalizeAlgorithm* myRNormAlgo;
bool myIsDefTitle;
private:
// List of QwtPlotCurve curves to draw (created by Plot2d_Curve::createPlotItem() )
QList<QwtPlotItem*> myQwtPlotCurveList;
Plot2d_NormalizeAlgorithm* myLNormAlgo;
Plot2d_NormalizeAlgorithm* myRNormAlgo;
bool myIsDefTitle;
private:
// List of QwtPlotCurve curves to draw (created by Plot2d_Curve::createPlotItem() )
QList<QwtPlotItem*> myQwtPlotCurveList;
- void replot();
- QwtLegend* getLegend();
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
- void defaultPicker();
- void setPickerMousePattern( int, int = Qt::NoButton );
- void setPicker( Plot2d_QwtPlotPicker *picker);
+ void replot();
+ QwtAbstractLegend* getLegend();
+ QSize sizeHint() const;
+ QSize minimumSizeHint() const;
+ void defaultPicker();
+ void setPickerMousePattern( int, int = Qt::NoButton );
+ void setPicker( Plot2d_QwtPlotPicker *picker);
Plot2d_QwtPlotPicker* getPicker() { return myPicker; }
Plot2d_AxisScaleDraw* getScaleDraw() { return myScaleDraw; }
QList<QwtPlotMarker*> getSeparationLineList() { return mySeparationLineList; }
void clearSeparationLineList();
Plot2d_QwtPlotPicker* getPicker() { return myPicker; }
Plot2d_AxisScaleDraw* getScaleDraw() { return myScaleDraw; }
QList<QwtPlotMarker*> getSeparationLineList() { return mySeparationLineList; }
void clearSeparationLineList();
- QwtPlotMarker *createMarkerAndTooltip( QwtSymbol symbol,
- double X,
- double Y,
- QString & tooltip,
- Plot2d_QwtPlotPicker *picker);
+ void setLegendSymbolType( const int );
+ int getLegendSymbolType();
+ QwtPlotMarker *createMarkerAndTooltip( QwtSymbol* symbol,
+ double X,
+ double Y,
+ QString & tooltip,
+ Plot2d_QwtPlotPicker *picker);
QwtPlotGrid* grid() const;
QwtPlotZoomer* zoomer() const;
virtual void updateYAxisIdentifiers();
QwtPlotGrid* grid() const;
QwtPlotZoomer* zoomer() const;
virtual void updateYAxisIdentifiers();
const QList< QPair< QString, QMap<double,QString> > > & devicesPosLabelTicks);
void createSeparationLine( double Xpos);
const QList< QPair< QString, QMap<double,QString> > > & devicesPosLabelTicks);
void createSeparationLine( double Xpos);
QwtPlotZoomer* myPlotZoomer;
Plot2d_AxisScaleDraw* myScaleDraw;
// The point picker associated with the graphic view
QwtPlotZoomer* myPlotZoomer;
Plot2d_AxisScaleDraw* myScaleDraw;
// The point picker associated with the graphic view
};
class Plot2d_ScaleDraw: public QwtScaleDraw
{
public:
Plot2d_ScaleDraw( char f = 'g', int prec = 6 );
};
class Plot2d_ScaleDraw: public QwtScaleDraw
{
public:
Plot2d_ScaleDraw( char f = 'g', int prec = 6 );
virtual QwtText label(double value) const;
void setLabelTick(double value, QString label, bool isDevice = false);
virtual QwtText label(double value) const;
void setLabelTick(double value, QString label, bool isDevice = false);
void setTicks(const QList<double> aTicks);
void setInterval(double lowerBound, double upperBound);
void applyTicks();
void setTicks(const QList<double> aTicks);
void setInterval(double lowerBound, double upperBound);
void applyTicks();
QMap<double, QString> myLabelX; // position, label
//
QList<double> myTicks; // positions
QMap<double, QString> myLabelX; // position, label
//
QList<double> myTicks; // positions
// Systems names to display under X axis
QMap<double, QString> myLabelDevice;
// Systems names to display under X axis
QMap<double, QString> myLabelDevice;
QList<QwtPlotMarker*> pMarkers; // points markers
QMap<QwtPlotMarker*, QwtText> pMarkersToolTip; // associations (marker,tooltip)
protected:
QList<QwtPlotMarker*> pMarkers; // points markers
QMap<QwtPlotMarker*, QwtText> pMarkersToolTip; // associations (marker,tooltip)
protected: