Go to the documentation of this file.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_CONTEXT_H
00028 #define GLVIEWER_CONTEXT_H
00029
00030 #ifdef WIN32
00031 #include "windows.h"
00032 #endif
00033
00034 #include "GLViewer_Defs.h"
00035 #include "GLViewer_Object.h"
00036
00037 class QRect;
00038
00039 #include <Quantity_NameOfColor.hxx>
00040 #include <Quantity_Color.hxx>
00041
00042 #include <GL/gl.h>
00043
00044 class GLViewer_Viewer2d;
00045
00046 #ifdef WIN32
00047 #pragma warning( disable:4251 )
00048 #endif
00049
00053 class GLVIEWER_API GLViewer_Context
00054 {
00055 public:
00057 GLViewer_Context( GLViewer_Viewer2d* );
00059 ~GLViewer_Context();
00060
00062 void setUpdateAll( bool on ) { myUpdateAll = on; }
00064 bool isUpdateAll() const { return myUpdateAll; }
00065
00067
00073 int MoveTo( int x, int y, bool byCircle = FALSE );
00078 int Select( bool Append = FALSE, bool byCircle = FALSE );
00084 int SelectByRect( const QRect& theRect, bool Append = FALSE );
00085
00087 void SetHighlightColor( Quantity_NameOfColor aCol );
00089 void SetSelectionColor( Quantity_NameOfColor aCol );
00091 Quantity_NameOfColor HighlightColor() { return myHighlightColor; }
00093 Quantity_NameOfColor SelectionColor() { return mySelectionColor; }
00094
00096 int NbSelected();
00098 void InitSelected();
00100 bool MoreSelected();
00102 bool NextSelected();
00104 GLViewer_Object* SelectedObject();
00105
00107 bool isSelected( GLViewer_Object* theObject );
00108
00110
00115 int insertObject( GLViewer_Object* theObject, bool display = false, bool isActive = true );
00117
00120 bool replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject );
00122 void updateScales( GLfloat theX, GLfloat theY );
00124 void setTolerance( int tol ) { myTolerance = tol; }
00125
00127
00130 const ObjList& getObjects( bool isActive = true )
00131 { return isActive ? myActiveObjects : myInactiveObjects; }
00132
00134 GLViewer_Object* getFirstObject() { return *( myActiveObjects.begin() ); }
00135
00137 void clearHighlighted( bool updateViewer );
00139 void clearSelected( bool updateViewer );
00141 void setSelected( GLViewer_Object* theObject, bool updateViewer );
00143 void remSelected( GLViewer_Object* theObject, bool updateViewer );
00144
00146 GLViewer_Object* getCurrentObject() { return myLastPicked; }
00148 bool currentObjectIsChanged() { return myLastPickedChanged; }
00149
00151 void eraseObject( GLViewer_Object* theObject, bool updateViewer = true );
00153 void deleteObject( GLViewer_Object* theObject, bool updateViewer = true );
00154
00156 bool setActive( GLViewer_Object* theObject );
00158 bool setInactive( GLViewer_Object* theObject );
00159
00160 protected:
00162
00166 bool myUpdateAll;
00167
00168 GLViewer_Viewer2d* myGLViewer2d;
00170 GLViewer_Object* myLastPicked;
00172 bool myLastPickedChanged;
00173
00175
00176 ObjList myActiveObjects;
00178
00179 ObjList myInactiveObjects;
00180
00182 ObjList mySelectedObjects;
00184 int mySelCurIndex;
00185
00187 GLfloat myXhigh;
00189 GLfloat myYhigh;
00190
00192 Quantity_NameOfColor myHighlightColor;
00194 Quantity_NameOfColor mySelectionColor;
00196 GLboolean myHFlag;
00198 GLboolean mySFlag;
00200 int myTolerance;
00201 };
00202
00203 #ifdef WIN32
00204 #pragma warning ( default:4251 )
00205 #endif
00206
00207 #endif