Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGGraphicStatisticsForeground.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
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     /*==========================  PUBLIC  =================================*/
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     /*=========================  PROTECTED  ===============================*/
00139   protected:
00140 
00141     // Variables should all be in GraphicStatisticsForegroundBase.
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     // converts a Real32 to a std::string
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     /*==========================  PRIVATE  ================================*/
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     // prohibit default functions (move to 'public' if you need one)
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 /* _OSGGRAPHICSTATISTICSFOREGROUND_H_ */

Generated on Thu Aug 25 04:05:45 2005 for OpenSG by  doxygen 1.4.3