00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGGRAPHICSTATISTICSFOREGROUND_H_
00040 #define _OSGGRAPHICSTATISTICSFOREGROUND_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGConfig.h>
00046
00047 #include <OSGTextureChunk.h>
00048 #include <OSGTextFace.h>
00049 #include <OSGTextLayoutParam.h>
00050
00051 #include <OSGGraphicStatisticsForegroundBase.h>
00052
00053 OSG_BEGIN_NAMESPACE
00054
00055 class TextTXFFace;
00056
00061 class OSG_SYSTEMLIB_DLLMAPPING GraphicStatisticsForeground : public GraphicStatisticsForegroundBase
00062 {
00063 private:
00064
00065 typedef GraphicStatisticsForegroundBase Inherited;
00066
00067
00068 public:
00069
00070 enum Type {
00071 OSG_ANALOG = 0,
00072 OSG_BAR = 1,
00073 OSG_CHART = 2,
00074 OSG_LINE_CHART = 3,
00075 OSG_TEXT = 4
00076 };
00077
00078 enum Mode {
00079 OSG_OVERFLOW_RESIZE = 1,
00080 OSG_UNDERFLOW_RESIZE = 2,
00081 OSG_RECIPROC = 4,
00082 OSG_SMOOTH = 8,
00083 OSG_ENABLE_POINTS = 16,
00084 OSG_MAX_TEXT = 32,
00085 OSG_MIN_TEXT = 64
00086 };
00087
00088 enum TextHA {
00089 OSG_LEFT = 0,
00090 OSG_RIGHT = 1,
00091 OSG_CENTER = 2
00092 };
00093
00094 enum TextVA {
00095 OSG_BOTTOM = 0,
00096 OSG_MIDDLE = 1,
00097 OSG_TOP = 2
00098 };
00099
00100
00104 virtual void changed(BitVector whichField, UInt32 from);
00105
00107
00111 virtual void dump( UInt32 uiIndent = 0,
00112 const BitVector bvFlags = 0) const;
00113
00114
00115 void draw(DrawActionBase *, Viewport *);
00116
00117
00119 void addElement(StatElemDescBase &desc,
00120 UInt32 displayType,
00121 Vec2f pos,
00122 Vec2f size,
00123 Color4f highColor,
00124 Color4f lowColor,
00125 Color4f currentColor,
00126 Real32 minValue = 0.0,
00127 Real32 maxValue = 0.0,
00128 UInt32 Flags = OSG_UNDERFLOW_RESIZE |
00129 OSG_OVERFLOW_RESIZE,
00130 UInt32 historySize = 0,
00131 std::string description="" );
00132
00133 void removeElement(StatElemDescBase &desc);
00134
00135
00136
00138
00139 protected:
00140
00141
00142
00143
00147 GraphicStatisticsForeground(void);
00148 GraphicStatisticsForeground(const GraphicStatisticsForeground &source);
00149
00151
00155 virtual ~GraphicStatisticsForeground(void);
00156
00159
00160 void drawAnalog(UInt32, StatElem*, DrawActionBase *, Viewport *);
00162 void drawChart(UInt32, StatElem*, DrawActionBase *, Viewport *);
00164 void drawLineChart(UInt32, StatElem*, DrawActionBase *, Viewport*);
00166 void drawBar(UInt32, StatElem*, DrawActionBase *, Viewport *);
00168 void drawText(UInt32, StatElem*, DrawActionBase *, Viewport *);
00169
00170
00171
00173 void initText( void );
00174
00176 void drawString(DrawActionBase *base,
00177 const std::string &text,
00178 TextLayoutParam::Alignment majorAlignment
00179 = TextLayoutParam::ALIGN_FIRST,
00180 TextLayoutParam::Alignment minorAlignment
00181 = TextLayoutParam::ALIGN_END);
00182
00183
00184 std::string real2String(Real32 value, char* format = 0);
00185
00186
00187 void calcPosAndSize(const UInt32& elementID,
00188 Viewport* port,
00189 Vec2f* Position,
00190 Vec2f* Size);
00191
00193 inline void processValue( Real32& value, const UInt32& elementID );
00194 inline void processOnlyValue( Real32& value, const UInt32& elementID );
00195 inline void addValueToHistory( Real32& value, const UInt32& elementID );
00196
00197
00198
00199
00200 private:
00201
00202 static TextTXFFace* _face;
00203
00204 static TextureChunkPtr _texchunk;
00205
00206
00207 friend class FieldContainer;
00208 friend class GraphicStatisticsForegroundBase;
00209
00210 static void initMethod(void);
00211
00212 std::vector< std::vector< Real32> > _history;
00213
00214 std::vector< UInt32 > _historyID;
00215
00216
00217
00218 void operator =(const GraphicStatisticsForeground &source);
00219 };
00220
00221 typedef GraphicStatisticsForeground *GraphicStatisticsForegroundP;
00222
00223 OSG_END_NAMESPACE
00224
00225 #include <OSGGraphicStatisticsForegroundBase.inl>
00226 #include <OSGGraphicStatisticsForeground.inl>
00227
00228 #define OSGGRAPHICSTATISTICSFOREGROUND_HEADER_CVSID "@(#)$Id: OSGGraphicStatisticsForeground.h,v 1.1 2002/07/18 16:09:33 jbehr Exp $"
00229
00230 #endif