progressiveLineGraph.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 
00009 
00010 #ifndef progressiveLineGraph_H_
00011 #define progressiveLineGraph_H_
00012 
00013 #include "lgrZoomableWidget.h"
00014 
00015 #include <set>
00016 #include <list>
00017 #include <map>
00018 #include <utility>
00019 #include <QtGui/QWidget>
00020 
00021 class QPainter;
00022 class QPolygon;
00023 class QLinearGradient;
00024 
00025 namespace MAKLogger
00026 {
00027    class DtLgrGuiModel;
00028 
00031    class DT_DLL_LGRGUI DtProgressiveLineGraph : public DtLgrZoomableWidget
00032    {
00033       Q_OBJECT
00034 
00035    public:
00036 
00038       DtProgressiveLineGraph(int rangeMin, int rangeMax,bool autoScale,
00039          QWidget* parent);
00040 
00042       virtual ~DtProgressiveLineGraph();
00043 
00046       void setModel(DtLgrGuiModel* myModel);
00047 
00049       int verticalMargin() const;
00050 
00052       void setMargins(int horizontalMargin,int verticalMargin);
00053 
00055       void addSet(int set,QPen pen, int initial, bool valueCentered = false);
00056 
00058       void insertValue(int set,double percent,int value);
00059 
00061       virtual void resetAllValues(int value);
00062 
00064       virtual void resetValues(int set,int value);
00065 
00067       virtual void clearValues(int set);
00068 
00070       virtual void clearAllValues();
00071 
00074       virtual void offsetPercentages(double percentOffset);
00075 
00078       virtual void offsetPercentages(int set, double percentOffset);
00079 
00082       virtual void setRange(int min,int max);
00083 
00085       virtual int rangeMinimum() const;
00086       virtual int rangeMaximum() const;
00087 
00090       virtual bool autoScale() const;
00091 
00094       virtual void setAutoScale(bool value);
00095 
00097       virtual void setNegativeReflection(bool positive);
00098 
00100       virtual void useBackgroundGradient(bool useIt);
00101 
00103       virtual bool usesBackgroundGradient() const;
00104 
00106       virtual void useAlphaBlending(bool useIt);
00107 
00109       virtual bool usesAlphaBlending() const;
00110 
00112       void useBasicGui(bool basic);
00113 
00116       virtual void drawAsVerticalLines(bool useVerticalLines);
00117 
00120       virtual bool usesVerticalLines() const;
00121 
00123       virtual void setOffsets(float left,float right);
00124 
00126       void forceUpdate(bool widgetUpdate);
00127 
00129       bool updateNeeded() const;
00130 
00131       typedef std::set<std::pair<double,int> > PercentValueMap;
00132 
00134       virtual void testForUpdate(DtLgrGuiModel& model);
00135 
00136    protected:
00137 
00138       class Set;
00139       typedef std::map<int,Set*> SetMap;
00140 
00142       virtual double firstTime() const;
00143 
00145       virtual double lastTime() const;
00146 
00148       virtual double currentTime() const;
00149 
00151       virtual void resizeEvent( QResizeEvent* e);
00152 
00154       virtual void paintEvent( QPaintEvent* );
00155 
00157       virtual void draw(QPainter& painter,const QRect& rect);
00158 
00160       virtual void paintBackground(QPainter& painter);
00161 
00163       virtual int getSeparation() const;
00164 
00166       virtual void paintLines(QPainter&,Set& set);
00167 
00169       virtual int desiredRange() const;
00170 
00172       void paintVerticalLines( PercentValueMap &set, QRectF svp,
00173          int rangeHeight, QPainter &painter, QPen pen, bool centered);
00174 
00176       void paintConnectedLines( PercentValueMap &set, QRectF svp,
00177          int rangeHeight, QPainter &painter, QPen pen );
00178 
00180       int desiredMinimum() const;
00181 
00182       int myInitialMinimumRange;
00183       int myInitialMaximumRange;
00184 
00185       int myMinimumRange;
00186       int myMaximumRange;
00187 
00188       int myVerticalMargin;
00189 
00190       bool myAutoScale;
00191       bool myActive;
00192 
00193       SetMap mySets;
00194 
00195       bool myUseGradient;
00196       bool myUseAlphaBlending;
00197       QLinearGradient* myLinearGradient;
00198       bool myGraphNeedsUpdating;
00199       bool myUseVerticalLines;
00200       bool myNegativeReflection;
00201       QPolygon* myPointCache;
00202       QPixmap* myLineBuffer;
00203       bool myUseCachedGraph;
00204 
00205       DtLgrGuiModel* myModel;
00206       double myDrawnRange;
00207    };
00208 
00209 }
00210 
00211 #endif

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)