00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef POSITIONVIEW_H
00019 #define POSITIONVIEW_H
00020
00021
00022 #include <qwidget.h>
00023 #include <qpixmap.h>
00024 #include <qimage.h>
00025 #include <qpainter.h>
00026 #include <qprinter.h>
00027 #include <qdict.h>
00028
00029
00030 #include <baseframe.h>
00031 #include "positionsprovider.h"
00032 #include <types.h>
00033 #include "eventdata.h"
00034 #include "globaleventsprovider.h"
00035
00036 class ItemColors;
00037
00042 class PositionView : public BaseFrame {
00043 Q_OBJECT
00044 public:
00063 PositionView(PositionsProvider& provider,GlobalEventsProvider& globalEventProvider,QImage backgroundImage,long start,long timeFrameWidth,bool showEvents,int windowTopLeft = -500,int windowBottomRight = 1001,QWidget *parent=0, const char *name=0,
00064 QColor backgroundColor = Qt::black, int minSize = 100, int maxSize = 4000, int border = 0);
00065 ~PositionView();
00066
00067 public slots:
00075 void updatePositionInformation(int width, int height,QImage backgroundImage,bool newOrientation,bool active);
00076
00081 void displayTimeFrame(long start,long timeFrameWidth);
00082
00088 void dataAvailable(Array<dataType>& data,QObject* initiator);
00089
00097 void print(QPainter& printPainter,QPaintDeviceMetrics& metrics,bool whiteBackground,QImage backgroundForPrinting = QImage());
00098
00099
00100 void changeBackgroundColor(QColor color);
00101
00109 void dataAvailable(QDict<EventData>& eventsData,QMap<QString, QValueList<int> >& selectedEvents,QDict<ItemColors>& providerItemColors,QObject* initiator,double samplingRate);
00110
00112 void updateEventDisplay();
00113
00119 void eventColorUpdate(QString name,int eventId,bool active);
00120
00122 inline void updateDrawing(){
00123
00124 drawContentsMode = REDRAW ;
00125 update();
00126 };
00127
00128 inline void addEventProvider(){updateEventDisplay();};
00129
00135 void removeEventProvider(QString name,bool active,bool lastFile);
00136
00140 void setEventsInPositionView(bool shown);
00141
00142 protected:
00147 void drawContents(QPainter* p);
00148
00153 inline void resizeEvent(QResizeEvent* event){
00154 drawContentsMode = REDRAW;
00155 resized = true;
00156 };
00157
00158 private:
00160 QImage background;
00161
00163 QPixmap scaledBackground;
00164
00169 QPixmap doublebuffer;
00170
00172 bool dataReady;
00173
00175 bool isInit;
00176
00178 bool resized;
00179
00181 PositionsProvider& positionsProvider;
00182
00186 Array<dataType> data;
00187
00189 long startTime;
00190
00192 long endTime;
00193
00195 long timeFrameWidth;
00196
00198 int nbSpots;
00199
00201 QDict<EventData> eventsData;
00202
00204 QMap<QString, QValueList<int> > selectedEvents;
00205
00207 QDict<ItemColors> providerItemColors;
00208
00210 GlobalEventsProvider& globalEventProvider;
00211
00213 bool showEvents;
00214
00216
00218 void scaleBackgroundImage();
00219
00224 void drawPositions(QPainter& painter);
00225
00229 void computeEventPositions(double samplingRate);
00230
00234 void drawEvents(QPainter& painter);
00235 };
00236
00237 #endif