-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// 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_plot_canvas.h>
+#include <qwt_legend.h>
#include <iostream>
#include <ostream>
virtual ~Plot2d_ViewFrame();
void Init();
+ void SetPreference();
enum ObjectType { MainTitle, XTitle, YTitle, Y2Title, XAxis, YAxis, Y2Axis };
void showLegend( bool, bool = true );
void setLegendPos( int );
int getLegendPos() const;
+ void setLegendSymbolType( int );
+ int getLegendSymbolType() const;
void setLegendFont( const QFont& );
QFont getLegendFont() const;
void setLegendFontColor( const QColor& );
QColor getLegendFontColor() const;
+ void setSelectedLegendFontColor( const QColor& );
+ QColor getSelectedLegendFontColor() const;
void setMarkerSize( const int, bool = true );
int getMarkerSize() const;
virtual void setBackgroundColor( const QColor& );
QColor backgroundColor() const;
+ virtual void setSelectionColor( const QColor& );
+ QColor selectionColor() 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 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;
QString getVisualParameters();
void setVisualParameters( const QString& );
void vpNormRModeChanged();
void vpCurveChanged();
void contextMenuRequested( QContextMenuEvent* );
- void legendClicked( QwtPlotItem* );
+ void clicked (const QVariant&, int );
protected:
Plot2d_Plot2d* myPlot;
int myCurveType;
bool myShowLegend;
int myLegendPos;
+ int myLegendSymbolType;
QFont myLegendFont;
QColor myLegendColor;
+ QColor mySelectedLegendFontColor;
int myMarkerSize;
QColor myBackground;
+ QColor mySelectionColor;
QString myTitle, myXTitle, myYTitle, myY2Title;
bool myTitleEnabled, myXTitleEnabled, myYTitleEnabled, myY2TitleEnabled;
bool myXGridMajorEnabled, myYGridMajorEnabled, myY2GridMajorEnabled;
Plot2d_Plot2d( QWidget* );
virtual ~Plot2d_Plot2d();
- void setLogScale( int, bool );
+ void setLogScale( int, bool );
- 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();
- 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);
- bool polished() const;
QwtPlotGrid* grid() const;
QwtPlotZoomer* zoomer() const;
void createSeparationLine( double Xpos);
-
-public slots:
- virtual void polish();
-
-protected slots:
- void onScaleDivChanged();
-
protected:
QwtPlotGrid* myGrid;
QList<QColor> myColors;
- bool myIsPolished;
QwtPlotZoomer* myPlotZoomer;
Plot2d_AxisScaleDraw* myScaleDraw;
// The point picker associated with the graphic view
private:
// List of verticals segments between two curves
QList<QwtPlotMarker*> mySeparationLineList;
+ int myLegendSymbolType;
};
class Plot2d_ScaleDraw: public QwtScaleDraw
{
public:
Plot2d_ScaleDraw( char f = 'g', int prec = 6 );
- Plot2d_ScaleDraw( const QwtScaleDraw& scaleDraw, char f = 'g', int prec = 6 );
virtual QwtText label( double value ) const;
void applyTicks();
+ double extent( const QFont &font ) const;
+
protected:
void drawLabel( QPainter* painter, double value) const;
Plot2d_QwtPlotPicker( int xAxis,
int yAxis,
- int selectionFlags,
RubberBand rubberBand,
DisplayMode trackerMode,
QwtPlotCanvas *canvas);
protected:
- virtual QwtText trackerText( const QwtDoublePoint & pos ) const;
+ virtual QwtText trackerText( const QPoint & pos ) const;
};