206 lines
5.7 KiB
C++
206 lines
5.7 KiB
C++
/*******************************************************************************
|
|
* *
|
|
* Société de Transports de Montréal. *
|
|
* 2012 *
|
|
* *
|
|
* Projet Zones Tests *
|
|
* *
|
|
* *
|
|
* *
|
|
*******************************************************************************/
|
|
/*
|
|
Description:
|
|
Description du fichier si nécessaire.
|
|
|
|
*/
|
|
|
|
/* ************************************************************************** */
|
|
/* Revision:
|
|
### 20131024 JFM
|
|
Verision d'origine.
|
|
|
|
### YYYMMDD Description du besoin ou du bug
|
|
Description du changement.
|
|
*/
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
#ifndef LOGVIEWPAGE_H
|
|
#define LOGVIEWPAGE_H
|
|
|
|
#include "GlobalDefine.h"
|
|
#include <QGraphicsWidget>
|
|
#include "Guipage.h"
|
|
#include <QString>
|
|
#include "PushButton.h"
|
|
#include "TextButtonWidget.h"
|
|
#include "LogMgr.h"
|
|
#include <QTableWidget>
|
|
#include "GraphItem.h"
|
|
//#include "qcustomplot.h"
|
|
#include "GraphCursorWidget.h"
|
|
#include "GraphRulerWidget.h"
|
|
#include "AnalogGraphItem.h"
|
|
#include "RankRulerWidget.h"
|
|
#include "EventsRulerWidget.h"
|
|
#include "QElapsedTimer"
|
|
|
|
#define GRAPH_ZONE_WIDTH 880//900
|
|
#define GRAPH_ZONE_HEIGHT 650//700
|
|
#define GRAPH_ZONE_X_OFFSET 70 //50
|
|
#define MIN_TIMESPAN 1000 //1 millisecond
|
|
|
|
#define ZOOM_TICK 10
|
|
#define SCROLL_TICK 1
|
|
#define ZOOM_CENTERED_ON_CURSOR
|
|
|
|
class COutilZT;
|
|
|
|
enum eZT1DiscreetPlottableParamID
|
|
{
|
|
ZT1_DISCREET_PLOTTABLE_S1_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_S2_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_PPINT_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_PPEXT_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_PG_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_FN_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_CI_PARAM,
|
|
ZT1_DISCREET_PLOTTABLE_ZT1_CDV_PARAM,
|
|
|
|
ZT1_DISCREET_PLOTTABLE_NB_PARAM
|
|
};
|
|
|
|
enum eZT1AnalogPlottableParamID
|
|
{
|
|
ZT1_ANALOG_PLOTTABLE_PGINT_PARAM,
|
|
ZT1_ANALOG_PLOTTABLE_PGEXT_PARAM,
|
|
ZT1_ANALOG_PLOTTABLE_PGCOMBINED_PARAM,
|
|
ZT1_ANALOG_PLOTTABLE_TRAIN_SPEED_PARAM,
|
|
ZT1_ANALOG_PLOTTABLE_SDF_DATA_PARAM,
|
|
|
|
|
|
ZT1_ANALOG_PLOTTABLE_NB_PARAM
|
|
};
|
|
|
|
enum eZT2DiscreetPlottableParamID
|
|
{
|
|
ZT2_DISCREET_PLOTTABLE_S1_PARAM,
|
|
ZT2_DISCREET_PLOTTABLE_PPEXT_PARAM,
|
|
ZT2_DISCREET_PLOTTABLE_PPINT_PARAM,
|
|
ZT2_DISCREET_PLOTTABLE_CI_PARAM,
|
|
ZT2_DISCREET_PLOTTABLE_APPROACH_CDV_PARAM,
|
|
ZT2_DISCREET_PLOTTABLE_CDV_PARAM,
|
|
|
|
ZT2_DISCREET_PLOTTABLE_NB_PARAM
|
|
};
|
|
|
|
enum eZT2AnalogPlottableParamID
|
|
{
|
|
ZT2_ANALOG_PLOTTABLE_NB_PARAM
|
|
};
|
|
|
|
|
|
class CDiscreetPlottableItem
|
|
{
|
|
public:
|
|
unsigned int mParamID;
|
|
QList<CGraphDiscreteDataPair*> *mDataSet;
|
|
CGraphItem *mPlotGaph;
|
|
};
|
|
|
|
class CAnalogPlottableItem
|
|
{
|
|
public:
|
|
unsigned int mParamID;
|
|
QList<CGraphAnalogDataPair*> *mDataSet;
|
|
CAnalogGraphItem *mPlotGaph;
|
|
};
|
|
|
|
|
|
|
|
class CLogViewPage : public CGuiPage
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CLogViewPage(QGraphicsWidget *Parent = 0);
|
|
~CLogViewPage();
|
|
|
|
COutilZT *mProgramHandle;
|
|
CLogElement *mLogElement;
|
|
CDiscreetPlottableItem mZT1DiscreetPlots[ZT1_DISCREET_PLOTTABLE_NB_PARAM];
|
|
CAnalogPlottableItem mZT1AnalogPlots[ZT1_ANALOG_PLOTTABLE_NB_PARAM];
|
|
CDiscreetPlottableItem mZT2DiscreetPlots[ZT2_DISCREET_PLOTTABLE_NB_PARAM];
|
|
|
|
void SetLogData(CLogElement *element);
|
|
void DestroyData();
|
|
void EnableCloseButton();
|
|
void DisableCloseButton();
|
|
|
|
|
|
virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
|
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
|
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
|
// virtual void keyReleaseEvent(QKeyEvent *event);
|
|
virtual bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
// QCustomPlot mPlotWidget;
|
|
|
|
private:
|
|
|
|
QGraphicsRectItem *mBackgroundRect;
|
|
CTextButtonWidget *mCancelButton;
|
|
CTextButtonWidget *mCursorsZoomButton, *mZoomInButton, *mZoomOutButton, *mZoomResetButton;
|
|
int mZoomValue;
|
|
quint64 mStartTime, mStopTime;
|
|
quint64 mCurTimeSpan;
|
|
quint64 mTotalTimeSpan;
|
|
quint64 mMinTime, mMaxTime;
|
|
qreal mCurPixelTickValue;
|
|
qint32 mPGTreshold;
|
|
CVerticalGraphCursorWidget *mStaticCursor1, *mStaticCursor2, *mVCursor;
|
|
CHorizontalGraphCursorWidget *mHCursor;
|
|
QGraphicsTextItem *mCursorPosTxt;
|
|
QGraphicsTextItem *mStaticCursorDeltaTimeTxt, *mCursor1TimeTxt, *mCursor2TimeTxt;
|
|
QGraphicsTextItem *mPassageStats1Txt,*mPassageStats2Txt;
|
|
QString mPassageDateTime, mPassageStation;
|
|
|
|
CGraphRulerWidget *mRuler;
|
|
CRankRulerWidget *mRankRuler;
|
|
CEventRulerWidget *mEventRuler;
|
|
unsigned int mViewType;
|
|
|
|
int mStaticCursor1Pos, mStaticCursor2Pos;
|
|
int mCursorPos;
|
|
|
|
bool mMouseDragging;
|
|
bool mMouseMoved;
|
|
|
|
QElapsedTimer mScrollAnimationTimer;
|
|
qreal mLastMousePos;
|
|
|
|
void SetZoom(int ZoomValue);
|
|
void ZoomIn(bool CenterOnCursor = true);
|
|
void ZoomOut(bool CenterOnCursor = true);
|
|
void ScrollGraphs(qint64 Delta);
|
|
quint64 GetTimeForPixel(qreal PixelPos);
|
|
qreal GetPixelForTime(quint64 Time);
|
|
unsigned int ShowSpan(qreal PixelPos1, qreal PixelPos2);
|
|
unsigned int ShowSpan(quint64 TimePos1, quint64 TimePos2);
|
|
unsigned int AdjustStaticCursorsPos();
|
|
unsigned int AdjustMouseCursorPos(qreal PosX, qreal PosY);
|
|
unsigned int UpdateStaticCursorsDeltaTime();
|
|
void ShowPlots(unsigned int ViewType);
|
|
|
|
|
|
|
|
public slots:
|
|
void ButtonClicked(CTextButtonWidget *);
|
|
|
|
};
|
|
|
|
#endif // LOGVIEWPAGE_H
|