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 #ifndef GLVIEWER_BASEOBJECTS_H
00028 #define GLVIEWER_BASEOBJECTS_H
00029
00030 #include "GLViewer.h"
00031 #include "GLViewer_Object.h"
00032
00033 #include <QColor>
00034
00035 #include <TColStd_SequenceOfInteger.hxx>
00036
00037 #ifdef WIN32
00038 #pragma warning( disable:4251 )
00039 #endif
00040
00045 class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
00046 {
00047 public:
00049 GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" );
00051 ~GLViewer_MarkerSet();
00052
00053
00054 virtual void compute();
00055 virtual GLViewer_Drawer* createDrawer();
00056
00057 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
00058 virtual GLboolean unhighlight();
00059 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
00060 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
00061 virtual GLboolean unselect();
00062
00063 virtual GLViewer_Rect* getUpdateRect();
00064
00065 virtual void moveObject( float, float, bool fromGroup = false );
00066
00067 virtual QByteArray getByteCopy();
00068 virtual bool initializeFromByteCopy( QByteArray );
00069
00070 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
00071 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
00072
00073 #ifdef WIN32
00074 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
00075 #endif
00076
00078 void setXCoord( GLfloat* xCoord, int size );
00080 void setYCoord( GLfloat* yCoord, int size );
00082 GLfloat* getXCoord() const { return myXCoord; }
00084 GLfloat* getYCoord() const { return myYCoord; }
00085
00087 void setNumMarkers( GLint );
00089 GLint getNumMarkers() const { return myNumber; };
00091 void setMarkerSize( const float size ) { myMarkerSize = size; }
00093 float getMarkerSize() const { return myMarkerSize; }
00094
00096 void exportNumbers( QList<int>& high, QList<int>& unhigh,
00097 QList<int>& sel, QList<int>& unsel );
00098
00100 QList<int> getSelectedElements() { return mySelNumbers; }
00102 bool addOrRemoveSelected( int index );
00104 void addSelected( const TColStd_SequenceOfInteger& );
00106 void setSelected( const TColStd_SequenceOfInteger& );
00107
00108 protected:
00109 GLint myNumber;
00110 GLfloat* myXCoord;
00111 GLfloat* myYCoord;
00112 GLfloat myMarkerSize;
00113 QList<int> myHNumbers;
00114 QList<int> myUHNumbers;
00115 QList<int> mySelNumbers;
00116 QList<int> myCurSelNumbers;
00117 QList<int> myUSelNumbers;
00118 QList<int> myPrevHNumbers;
00119 TColStd_SequenceOfInteger mySelectedIndexes;
00120 };
00121
00126 class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
00127 {
00128 public:
00129 GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
00130 ~GLViewer_Polyline();
00131
00132
00133 virtual void compute();
00134 virtual GLViewer_Drawer* createDrawer();
00135
00136 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
00137 virtual GLboolean unhighlight();
00138 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
00139 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
00140 virtual GLboolean unselect();
00141
00142 virtual GLViewer_Rect* getUpdateRect();
00143
00144 virtual void moveObject( float, float, bool fromGroup = false );
00145
00146 virtual QByteArray getByteCopy();
00147 virtual bool initializeFromByteCopy( QByteArray );
00148
00149 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
00150 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
00151
00152 #ifdef WIN32
00153 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
00154 #endif
00155
00157 void setXCoord( GLfloat* xCoord, int size );
00159 void setYCoord( GLfloat* yCoord, int size );
00161 GLfloat* getXCoord() const { return myXCoord; }
00163 GLfloat* getYCoord() const { return myYCoord; }
00164
00166 void setNumber( GLint );
00168 GLint getNumber() const { return myNumber; };
00169
00171 void setClosed( GLboolean closed ) { myIsClosed = closed; }
00173 GLboolean isClosed() const { return myIsClosed; }
00174
00176 void setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
00178 GLboolean isHighSelAll() const { return myHighSelAll; }
00179
00181 void exportNumbers( QList<int>& high, QList<int>& unhigh,
00182 QList<int>& sel, QList<int>& unsel );
00183
00185 QList<int> getSelectedElements() { return mySelNumbers; }
00186
00187 protected:
00188 GLfloat* myXCoord;
00189 GLfloat* myYCoord;
00190 GLint myNumber;
00191 GLboolean myIsClosed;
00192 GLboolean myHighSelAll;
00193
00194 QList<int> myHNumbers;
00195 QList<int> myUHNumbers;
00196 QList<int> mySelNumbers;
00197 QList<int> myUSelNumbers;
00198 QList<int> myCurSelNumbers;
00199 QList<int> myPrevHNumbers;
00200 TColStd_SequenceOfInteger mySelectedIndexes;
00201
00202 GLboolean myHighFlag;
00203 };
00204
00209 class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
00210 {
00211 public:
00212 GLViewer_TextObject( const QString&, float xPos = 0, float yPos = 0,
00213 const QColor& color = QColor( 0, 255, 0 ), const QString& toolTip = "GLText" );
00214 ~GLViewer_TextObject();
00215
00216 virtual void compute();
00217 virtual GLViewer_Drawer* createDrawer();
00218
00219 virtual void setDrawer( GLViewer_Drawer* theDrawer );
00220
00221 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle = GL_FALSE );
00222 virtual GLboolean unhighlight();
00223 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
00224 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
00225 virtual GLboolean unselect();
00226
00227 virtual GLViewer_Rect* getUpdateRect();
00228
00229 virtual void moveObject( float, float, bool fromGroup = false );
00230
00231 virtual QByteArray getByteCopy();
00232 virtual bool initializeFromByteCopy( QByteArray );
00233
00234 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
00235 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
00236
00237 #ifdef WIN32
00238 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
00239 #endif
00240
00241 int getWidth(){ return myWidth; }
00242 int getHeight(){ return myWidth; }
00243 void setWidth( int w ){ myWidth=w; }
00244 void setHeight( int h ){ myHeight=h; }
00245
00246 protected:
00247 bool myHighFlag;
00248 int myWidth;
00249 int myHeight;
00250 };
00251
00252 #ifdef WIN32
00253 #pragma warning ( default:4251 )
00254 #endif
00255
00256 #endif