23 #ifndef PLOT2D_VIEWFRAME_H
24 #define PLOT2D_VIEWFRAME_H
28 #ifndef NO_ANALYTICAL_CURVES
38 #include <qwt_symbol.h>
39 #include <qwt_scale_draw.h>
40 #include <qwt_plot_marker.h>
41 #include <qwt_plot_picker.h>
42 #include <qwt_plot_canvas.h>
43 #include <qwt_legend.h>
60 typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*>
CurveDict;
61 typedef QMultiHash<QwtPlotItem*, Plot2d_Object*>
ObjectDict;
64 #ifndef NO_ANALYTICAL_CURVES
70 enum { NoOpId, FitAreaId,
ZoomId, PanId, GlPanId, DumpId,
72 LegendId, CurvePointsId, CurveLinesId, CurveSplinesId };
86 virtual void DisplayAll();
87 virtual void EraseAll();
91 void Erase(
const Plot2d_Prs*,
const bool =
false );
97 void updateTitles(
const bool =
true );
98 void setTitle(
const QString& );
99 QString getTitle()
const;
118 QwtSymbol::Style markerKind,
121 bool displayLegend=
true);
125 QwtPlotCurve *createSegment(
double *X,
double *Y,
int nbPoint,
126 Qt::PenStyle lineKind,
129 QwtSymbol::Style markerKind,
134 void displayCurves(
const curveList&,
bool =
false );
136 void eraseCurves(
const curveList&,
bool =
false );
140 void processFiltering(
bool =
false);
144 void displayObjects(
const objectList&,
bool =
false );
146 void eraseObjects(
const objectList&,
bool =
false );
147 void eraseBasicObject(
QwtPlotItem*,
bool =
false );
156 void fitArea(
const QRect& );
157 void fitData(
const int,
const double,
const double,
158 const double,
const double,
159 const double = 0,
const double = 0 );
161 void getFitRanges(
double&,
double&,
double&,
double&,
164 void getFitRangeByCurves(
double&,
double&,
double&,
double&,
167 void getFitRangeByMarkers(
double&,
double&,
double&,
double&,
170 #ifndef NO_ANALYTICAL_CURVES
175 void deselectAnalyticalCurves();
181 void deselectObjects();
185 void setCurveType(
int,
bool =
true );
186 int getCurveType()
const;
189 void showLegend(
bool,
bool =
true );
190 void setLegendPos(
int );
191 int getLegendPos()
const;
192 void setLegendSymbolType(
int );
193 int getLegendSymbolType()
const;
194 void setLegendFont(
const QFont& );
195 QFont getLegendFont()
const;
196 void setLegendFontColor(
const QColor& );
197 QColor getLegendFontColor()
const;
198 void setSelectedLegendFontColor(
const QColor& );
199 QColor getSelectedLegendFontColor()
const;
200 void setMarkerSize(
const int,
bool =
true );
201 int getMarkerSize()
const;
202 virtual void setBackgroundColor(
const QColor& );
203 QColor backgroundColor()
const;
204 virtual void setSelectionColor(
const QColor& );
205 QColor selectionColor()
const;
206 void setXGrid(
bool,
const int,
bool,
const int,
bool =
true );
207 void setYGrid(
bool,
const int,
bool,
const int,
208 bool,
const int,
bool,
const int,
bool =
true );
209 void setTitle(
bool,
const QString&,
ObjectType,
bool =
true );
212 void setFont(
const QFont&,
ObjectType,
bool =
true );
213 void setHorScaleMode(
const int,
bool =
true );
214 int getHorScaleMode()
const;
215 void setVerScaleMode(
const int,
bool =
true );
216 int getVerScaleMode()
const;
217 void setNormLMaxMode(
bool,
bool =
true);
218 bool getNormLMaxMode()
const;
219 void setNormLMinMode(
bool,
bool =
true);
220 bool getNormLMinMode()
const;
221 void setNormRMaxMode(
bool,
bool =
true);
222 bool getNormRMaxMode()
const;
223 void setNormRMinMode(
bool,
bool =
true);
224 bool getNormRMinMode()
const;
227 bool isModeHorLinear();
228 bool isModeVerLinear();
229 bool isNormLMaxMode();
230 bool isNormLMinMode();
231 bool isNormRMaxMode();
232 bool isNormRMinMode();
234 bool isLegendShow()
const;
239 bool isXLogEnabled()
const;
240 bool isYLogEnabled()
const;
243 virtual bool print(
const QString&,
const QString& )
const;
244 void printPlot( QPainter*,
const QRectF& )
const;
246 QString getVisualParameters();
247 void setVisualParameters(
const QString& );
249 void incrementalPan (
const int,
const int );
250 void incrementalZoom(
const int,
const int );
252 QwtPlotCanvas* getPlotCanvas()
const;
253 Plot2d_Curve* getClosestCurve( QPoint,
double&,
int& )
const;
262 int testOperation(
const QMouseEvent& );
263 virtual void readPreferences();
264 virtual void writePreferences();
265 QString getInfo(
const QPoint& );
266 virtual void wheelEvent( QWheelEvent* );
270 QString getXmlVisualParameters();
271 bool setXmlVisualParameters(
const QString&);
277 void onViewFitArea();
278 void onViewGlobalPan();
280 #ifndef NO_ANALYTICAL_CURVES
281 void onAnalyticalCurve();
284 void onChangeBackground();
293 virtual void customEvent(
QEvent* );
294 void plotMousePressed(
const QMouseEvent& );
295 bool plotMouseMoved(
const QMouseEvent& );
296 void plotMouseReleased(
const QMouseEvent& );
299 void vpModeHorChanged();
300 void vpModeVerChanged();
301 void vpNormLModeChanged();
302 void vpNormRModeChanged();
303 void vpCurveChanged();
304 void contextMenuRequested( QContextMenuEvent* );
305 void clicked (
const QVariant&,
int );
333 #ifndef NO_ANALYTICAL_CURVES
378 QwtPlotGrid*
grid()
const;
390 double XLeftmargin,
double XRightMargin,
391 const QList< QPair< QString, QMap<double,QString> > > & devicesPosLabelTicks);
413 virtual QwtText
label(
double value )
const;
427 virtual QwtText
label(
double value )
const;
445 virtual void draw( QPainter * painter,
const QPalette & palette)
const;
447 virtual QwtText
label(
double value)
const;
453 void setInterval(
double lowerBound,
double upperBound);
457 double extent(
const QFont &font )
const;
461 void drawLabel( QPainter* painter,
double value)
const;
463 void drawTick( QPainter* painter,
double value,
int len)
const;
495 RubberBand rubberBand,
496 DisplayMode trackerMode,
497 QwtPlotCanvas *canvas);
501 QwtPlotCanvas *canvas);
510 virtual QwtText
trackerText(
const QPoint & pos )
const;