1 // File: GLViewer_Drawer.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 /***************************************************************************
7 ** Class: GLViewer_Drawer
8 ** Descr: Drawer for GLViewer_Object
10 ** Created: UI team, 01.10.01
11 ****************************************************************************/
12 #ifndef GLVIEWER_DRAWER_H
13 #define GLVIEWER_DRAWER_H
28 #include "GLViewer_Defs.h"
30 class GLViewer_Object;
32 class GLViewer_AspectLine;
33 class GLViewer_CoordSystem;
36 #pragma warning( disable:4251 )
39 struct GLVIEWER_EXPORT GLViewer_TexIdStored
46 struct GLVIEWER_EXPORT GLViewer_TexFindId
50 bool operator < (const GLViewer_TexFindId theStruct) const
52 if ( myViewPortId != theStruct.myViewPortId ) return myViewPortId < theStruct.myViewPortId;
53 else return myFontString < theStruct.myFontString;
57 class GLVIEWER_EXPORT GLViewer_TexFont
61 GLViewer_TexFont( QFont* theFont, int theSeparator = 2 );
64 void generateTexture();
65 void drawString( QString theStr, GLdouble theX = 0.0, GLdouble theY = 0.0 );
67 int getSeparator(){ return mySeparator; }
68 void setSeparator( int theSeparator ){ mySeparator = theSeparator; }
70 int getStringWidth( QString );
71 int getStringHeight();
73 static QMap<GLViewer_TexFindId,GLViewer_TexIdStored> TexFontBase;
74 static int LastmyTexStoredId;
86 /***************************************************************************
87 ** Class: GLViewer_Drawer
88 ** Descr: Drawer for GLObject
90 ** Created: UI team, 03.10.01
91 ****************************************************************************/
92 class GLVIEWER_EXPORT GLViewer_Drawer: public QObject
98 virtual ~GLViewer_Drawer();
100 enum ObjectStatus { OS_Normal = 0, OS_Highlighted = 1, OS_Selected = 2 };
101 enum ClosedStatus { CS_CLOSED = 0, CS_OPEN = 1 };
103 virtual void create( float, float, bool ) = 0;
105 virtual void addObject( GLViewer_Object* theObject ){ myObjects.append( theObject ); }
106 virtual void clear(){ myObjects.clear(); }
108 QString getObjectType(){ return myObjectType; }
110 static void destroyAllTextures();
112 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
113 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
116 virtual bool translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
119 void drawText( const QString& text,
120 GLfloat xPos, GLfloat yPos,
123 DisplayTextFormat = DTF_BITMAP );
125 virtual void drawText( GLViewer_Object* );
130 QValueList<GLViewer_Object*> myObjects;
133 QString myObjectType;
136 /***************************************************************************
137 ** Class: GLViewer_MarkerDrawer
138 ** Descr: Drawer for GLViewer_MarkerSet
140 ** Created: UI team, 03.10.01
141 ****************************************************************************/
142 #ifndef GLVIEWER_MARKERDRAWER_H
143 #define GLVIEWER_MARKERDRAWER_H
145 class GLVIEWER_EXPORT GLViewer_MarkerDrawer : public GLViewer_Drawer
148 GLViewer_MarkerDrawer();
149 ~GLViewer_MarkerDrawer();
151 virtual void create( float, float, bool );
154 void drawMarker( float&, float&, float&, QColor&, GLViewer_AspectLine* );
157 #endif // GLVIEWER_MARKERDRAWER_H
159 /***************************************************************************
160 ** Class: GLViewer_PolylineDrawer
161 ** Descr: Drawer for GLViewer_Polyline
163 ** Created: UI team, 03.10.01
164 ****************************************************************************/
165 #ifndef GLVIEWER_POLYLINEDRAWER_H
166 #define GLVIEWER_POLYLINEDRAWER_H
168 class GLVIEWER_EXPORT GLViewer_PolylineDrawer : public GLViewer_Drawer
171 GLViewer_PolylineDrawer();
172 ~GLViewer_PolylineDrawer();
174 virtual void create( float, float, bool );
177 #endif // GLVIEWER_POLYLINEDRAWER_H
179 /***************************************************************************
180 ** Class: GLViewer_TextDrawer
183 ** Created: UI team, 27.02.04
184 ****************************************************************************/
185 #ifndef GLVIEWER_TEXTDRAWER
186 #define GLVIEWER_TEXTDRAWER
188 class GLVIEWER_EXPORT GLViewer_TextDrawer: public GLViewer_Drawer
192 GLViewer_TextDrawer();
193 ~GLViewer_TextDrawer();
195 virtual void create( float, float, bool );
196 void updateObjects(); //after update font
199 #endif // GLVIEWER_TEXTDRAWER
202 #pragma warning ( default:4251 )
205 #endif // GLVIEWER_DRAWER_H