1 // File: GLViewer_BaseObjects.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 #ifndef GLVIEWER_BASEOBJECTS_H
7 #define GLVIEWER_BASEOBJECTS_H
10 #include "GLViewer_Object.h"
13 #include <qvaluelist.h>
15 #include <TColStd_SequenceOfInteger.hxx>
18 #pragma warning( disable:4251 )
22 * Class GLViewer_MarkerSet
26 class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
30 GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" );
32 ~GLViewer_MarkerSet();
35 virtual void compute();
36 virtual GLViewer_Drawer* createDrawer();
38 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
39 virtual GLboolean unhighlight();
40 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
41 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
42 virtual GLboolean unselect();
44 virtual GLViewer_Rect* getUpdateRect();
46 virtual void moveObject( float, float, bool fromGroup = false );
48 virtual QByteArray getByteCopy();
49 virtual bool initializeFromByteCopy( QByteArray );
51 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
52 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
55 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
58 //! Sets array of x coords of markers
59 void setXCoord( GLfloat* xCoord, int size );
60 //! Sets array of y coords of markers
61 void setYCoord( GLfloat* yCoord, int size );
63 GLfloat* getXCoord() const { return myXCoord; }
65 GLfloat* getYCoord() const { return myYCoord; }
67 //! Sets markers number
68 void setNumMarkers( GLint );
69 //! returns markers number
70 GLint getNumMarkers() const { return myNumber; };
71 //! Sets merker radius
72 void setMarkerSize( const float size ) { myMarkerSize = size; }
73 //! Returns merker radius
74 float getMarkerSize() const { return myMarkerSize; }
76 //! Export numbers of heghlighted/selected markers
77 void exportNumbers( QValueList<int>& high, QValueList<int>& unhigh,
78 QValueList<int>& sel, QValueList<int>& unsel );
80 //! Returns selected numbers
81 QValueList<int> getSelectedElements() { return mySelNumbers; }
82 //! Adds or remove selected number
83 bool addOrRemoveSelected( int index );
84 //! Adds selected numbers
85 void addSelected( const TColStd_SequenceOfInteger& );
86 //! Sets selected nembers
87 void setSelected( const TColStd_SequenceOfInteger& );
94 QValueList<int> myHNumbers;
95 QValueList<int> myUHNumbers;
96 QValueList<int> mySelNumbers;
97 QValueList<int> myCurSelNumbers;
98 QValueList<int> myUSelNumbers;
99 QValueList<int> myPrevHNumbers;
100 TColStd_SequenceOfInteger mySelectedIndexes;
104 * Class GLViewer_Polyline
108 class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
111 GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
112 ~GLViewer_Polyline();
115 virtual void compute();
116 virtual GLViewer_Drawer* createDrawer();
118 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
119 virtual GLboolean unhighlight();
120 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
121 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
122 virtual GLboolean unselect();
124 virtual GLViewer_Rect* getUpdateRect();
126 virtual void moveObject( float, float, bool fromGroup = false );
128 virtual QByteArray getByteCopy();
129 virtual bool initializeFromByteCopy( QByteArray );
131 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
132 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
135 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
138 //! Sets array of x coords of points
139 void setXCoord( GLfloat* xCoord, int size );
140 //! Sets array of y coords of points
141 void setYCoord( GLfloat* yCoord, int size );
143 GLfloat* getXCoord() const { return myXCoord; }
145 GLfloat* getYCoord() const { return myYCoord; }
147 //! SetS number of points
148 void setNumber( GLint );
149 //! Returns number of points
150 GLint getNumber() const { return myNumber; };
152 //! On/off closed status of polyline
153 void setClosed( GLboolean closed ) { myIsClosed = closed; }
154 //! Checks closed status of polyline
155 GLboolean isClosed() const { return myIsClosed; }
157 //! On/off highlight as whole object status
158 void setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
159 //! Checks highlight as whole object status
160 GLboolean isHighSelAll() const { return myHighSelAll; }
162 //! Export numbers of heghlighted/selected lines
163 void exportNumbers( QValueList<int>& high, QValueList<int>& unhigh,
164 QValueList<int>& sel, QValueList<int>& unsel );
166 //! Returns numbers of selected lines
167 QValueList<int> getSelectedElements() { return mySelNumbers; }
173 GLboolean myIsClosed;
174 GLboolean myHighSelAll;
176 QValueList<int> myHNumbers;
177 QValueList<int> myUHNumbers;
178 QValueList<int> mySelNumbers;
179 QValueList<int> myUSelNumbers;
180 QValueList<int> myCurSelNumbers;
181 QValueList<int> myPrevHNumbers;
182 TColStd_SequenceOfInteger mySelectedIndexes;
184 GLboolean myHighFlag;
187 // Class: GLViewer_TextObject
188 // Descr: Text as Object for OpenGL
190 class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
193 GLViewer_TextObject( const QString&, float xPos = 0, float yPos = 0,
194 const QColor& color = QColor( 0, 255, 0 ), const QString& toolTip = "GLText" );
195 ~GLViewer_TextObject();
197 virtual void compute();
198 virtual GLViewer_Drawer* createDrawer();
200 virtual void setDrawer( GLViewer_Drawer* theDrawer );
202 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle = GL_FALSE );
203 virtual GLboolean unhighlight();
204 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
205 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
206 virtual GLboolean unselect();
208 virtual GLViewer_Rect* getUpdateRect();
210 virtual void moveObject( float, float, bool fromGroup = false );
212 virtual QByteArray getByteCopy();
213 virtual bool initializeFromByteCopy( QByteArray );
215 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
216 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
219 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
222 int getWidth(){ return myWidth; }
223 int getHeight(){ return myWidth; }
224 void setWidth( int w ){ myWidth=w; }
225 void setHeight( int h ){ myHeight=h; }
234 #pragma warning ( default:4251 )