Salome HOME
Copyright update 2022
[modules/gui.git] / src / GLViewer / GLViewer_BaseObjects.h
index 53604863f9a6c1563f1339c8e97761c5e702bb92..7dddfaedc8b697d2dcea560ce5a4f69d6815818a 100644 (file)
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  Author : OPEN CASCADE
 // File:      GLViewer_BaseObjects.h
 // Created:   November, 2004
-// Author:    OCC team
-// Copyright (C) CEA 2004
-
+//
 #ifndef GLVIEWER_BASEOBJECTS_H
 #define GLVIEWER_BASEOBJECTS_H
 
 #include "GLViewer.h"
 #include "GLViewer_Object.h"
 
-#include <qcolor.h>
-#include <qvaluelist.h>
+#include <QColor>
 
 #include <TColStd_SequenceOfInteger.hxx>
 
-#ifdef WNT
+#ifdef WIN32
 #pragma warning( disable:4251 )
 #endif
 
-// Class:   GLViewer_MarkerSet
-// Descr:   OpenGL MarkerSet
-
+/*! 
+ \class GLViewer_MarkerSet
+ OpenGL MarkerSet
+*/
 class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
 {
 public:
+  //! A constructor
   GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" );
+  //! A destructor
   ~GLViewer_MarkerSet();
-  
-  virtual void            compute();
+
+  // redefined  methods
+  virtual void             compute();
   virtual GLViewer_Drawer* createDrawer();
   
-  virtual GLboolean       highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
-  virtual GLboolean       unhighlight();
-  virtual GLboolean       select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
+  virtual GLboolean        highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
+  virtual GLboolean        unhighlight();
+  virtual GLboolean        select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
     GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
-  virtual GLboolean       unselect();
-  
-  virtual GLViewer_Rect*  getUpdateRect();
+  virtual GLboolean        unselect();
   
-  void                    setXCoord( GLfloat* xCoord, int size );
-  void                    setYCoord( GLfloat* yCoord, int size );
-  GLfloat*                getXCoord() const { return myXCoord; }
-  GLfloat*                getYCoord() const { return myYCoord; }
-  void                    setNumMarkers( GLint );
-  GLint                   getNumMarkers() const { return myNumber; };
+  virtual GLViewer_Rect*   getUpdateRect();
   
-  void                    setMarkerSize( const float size ) { myMarkerSize = size; }
-  float                   getMarkerSize() const { return myMarkerSize; }
+  virtual void             moveObject( float, float, bool fromGroup = false );
   
-  void                    exportNumbers( QValueList<int>&, QValueList<int>& , QValueList<int>&, QValueList<int>& );
+  virtual QByteArray       getByteCopy();
+  virtual bool             initializeFromByteCopy( QByteArray );
   
-  QValueList<int>         getSelectedElements() { return mySelNumbers; }
-  bool                    addOrRemoveSelected( int index );
-  void                    addSelected( const TColStd_SequenceOfInteger& );
-  void                    setSelected( const TColStd_SequenceOfInteger& );
-  
-  virtual void            moveObject( float, float, bool fromGroup = false );
-  
-  virtual QByteArray      getByteCopy();
-  virtual bool            initializeFromByteCopy( QByteArray );
-  
-  virtual bool            translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
-  virtual bool            translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );    
+  virtual bool             translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
+  virtual bool             translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );    
   
 #ifdef WIN32
-  virtual bool            translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
+  virtual bool             translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
 #endif
 
+  //! Sets array of x coords of markers
+  void                     setXCoord( GLfloat* xCoord, int size );
+  //! Sets array of y coords of markers
+  void                     setYCoord( GLfloat* yCoord, int size );
+  //! Returns x coords
+  GLfloat*                 getXCoord() const { return myXCoord; }
+  //! Returns y coords
+  GLfloat*                 getYCoord() const { return myYCoord; }
+  
+  //! Sets markers number
+  void                     setNumMarkers( GLint );
+  //! returns markers number
+  GLint                    getNumMarkers() const { return myNumber; };
+  //! Sets merker radius
+  void                     setMarkerSize( const float size ) { myMarkerSize = size; }
+  //! Returns merker radius
+  float                    getMarkerSize() const { return myMarkerSize; }
+  
+  //! Export numbers of heghlighted/selected markers
+  void                     exportNumbers( QList<int>& high, QList<int>& unhigh,
+                                          QList<int>& sel, QList<int>& unsel );
+  
+  //! Returns selected numbers
+  QList<int>               getSelectedElements() { return mySelNumbers; }
+  //! Adds or remove selected number
+  bool                     addOrRemoveSelected( int index );
+  //! Adds selected numbers
+  void                     addSelected( const TColStd_SequenceOfInteger& );
+  //! Sets selected nembers
+  void                     setSelected( const TColStd_SequenceOfInteger& );
+
 protected:
   GLint                   myNumber;
   GLfloat*                myXCoord;
   GLfloat*                myYCoord;    
   GLfloat                 myMarkerSize;
-  QValueList<int>         myHNumbers;
-  QValueList<int>         myUHNumbers;
-  QValueList<int>         mySelNumbers;
-  QValueList<int>         myCurSelNumbers;
-  QValueList<int>         myUSelNumbers;
-  QValueList<int>         myPrevHNumbers;
+  QList<int>              myHNumbers;
+  QList<int>              myUHNumbers;
+  QList<int>              mySelNumbers;
+  QList<int>              myCurSelNumbers;
+  QList<int>              myUSelNumbers;
+  QList<int>              myPrevHNumbers;
   TColStd_SequenceOfInteger mySelectedIndexes;
 };
 
-// Class:   GLViewer_Polyline
-// Descr:   OpenGL Polyline
-
+/*! 
+ \class  GLViewer_Polyline
+ OpenGL Polyline
+*/
 class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
 {
 public:
   GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
 ~GLViewer_Polyline();
+ ~GLViewer_Polyline();
   
+  // redefined  methods
   virtual void            compute();
   virtual GLViewer_Drawer* createDrawer();
   
@@ -101,23 +141,6 @@ public:
   
   virtual GLViewer_Rect*  getUpdateRect();
   
-  void                    setXCoord( GLfloat* xCoord, int size );
-  void                    setYCoord( GLfloat* yCoord, int size );
-  GLfloat*                getXCoord() const { return myXCoord; }
-  GLfloat*                getYCoord() const { return myYCoord; }
-  void                    setNumber( GLint );
-  GLint                   getNumber() const { return myNumber; };
-  
-  void                    setClosed( GLboolean closed ) { myIsClosed = closed; }
-  GLboolean               isClosed() const { return myIsClosed; }
-  
-  void                    setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
-  GLboolean               isHighSelAll() const { return myHighSelAll; }
-  
-  void                    exportNumbers( QValueList<int>&, QValueList<int>& , QValueList<int>&, QValueList<int>& );
-  
-  QValueList<int>         getSelectedElements() { return mySelNumbers; }
-  
   virtual void            moveObject( float, float, bool fromGroup = false );
   
   virtual QByteArray      getByteCopy();
@@ -129,6 +152,37 @@ public:
 #ifdef WIN32
   virtual bool            translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
 #endif
+  
+  //! Sets array of x coords of points
+  void                     setXCoord( GLfloat* xCoord, int size );
+  //! Sets array of y coords of points
+  void                     setYCoord( GLfloat* yCoord, int size );
+  //! Returns x coords
+  GLfloat*                 getXCoord() const { return myXCoord; }
+  //! Returns y coords
+  GLfloat*                 getYCoord() const { return myYCoord; }
+
+  //! SetS number of points
+  void                    setNumber( GLint );
+  //! Returns number of points
+  GLint                   getNumber() const { return myNumber; };
+  
+  //! On/off closed status of polyline
+  void                    setClosed( GLboolean closed ) { myIsClosed = closed; }
+  //! Checks closed status of polyline
+  GLboolean               isClosed() const { return myIsClosed; }
+  
+  //! On/off highlight as whole object status
+  void                    setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
+  //! Checks highlight as whole object status
+  GLboolean               isHighSelAll() const { return myHighSelAll; }
+  
+  //! Export numbers of highlighted/selected lines
+  void                    exportNumbers( QList<int>& high, QList<int>& unhigh,
+                                         QList<int>& sel, QList<int>& unsel );
+
+  //! Returns numbers of selected lines
+  QList<int>              getSelectedElements() { return mySelNumbers; }
 
 protected:
   GLfloat*                myXCoord;
@@ -137,20 +191,21 @@ protected:
   GLboolean               myIsClosed;
   GLboolean               myHighSelAll;
   
-  QValueList<int>         myHNumbers;
-  QValueList<int>         myUHNumbers;
-  QValueList<int>         mySelNumbers;
-  QValueList<int>         myUSelNumbers;
-  QValueList<int>         myCurSelNumbers;
-  QValueList<int>         myPrevHNumbers;
+  QList<int>              myHNumbers;
+  QList<int>              myUHNumbers;
+  QList<int>              mySelNumbers;
+  QList<int>              myUSelNumbers;
+  QList<int>              myCurSelNumbers;
+  QList<int>              myPrevHNumbers;
   TColStd_SequenceOfInteger mySelectedIndexes;
   
   GLboolean               myHighFlag;
 };
 
-// Class:   GLViewer_TextObject
-// Descr:   Text as Object for OpenGL
-
+/*!
+  \class GLViewer_TextObject
+  Text as Object for OpenGL
+*/
 class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
 {
 public:  
@@ -194,7 +249,7 @@ protected:
   int                       myHeight;
 };
 
-#ifdef WNT
+#ifdef WIN32
 #pragma warning ( default:4251 )
 #endif