Salome HOME
Copyright update 2022
[modules/gui.git] / src / GLViewer / GLViewer_Selector2d.cxx
index 14d17722dfe901cd6f69308e3ca7f1ecfc813240..ef8c8daa994c0004a5e0ea1a2f5ac780cdda0747 100644 (file)
@@ -1,21 +1,39 @@
+// 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_Selector2d.cxx
 // Created:   November, 2004
-// Author:    OCC team
-// Copyright (C) CEA 2004
-
-/****************************************************************************
-**  Class:   GLViewer_Selector2d 
-**  Descr:   OpenGL Selector 2D
-**  Module:  GLViewer
-**  Created: UI team, 20.09.02
-*****************************************************************************/
-
 //#include <GLViewerAfx.h>
+//
 #include "GLViewer_Selector2d.h"
 #include "GLViewer_Viewer2d.h"
 #include "GLViewer_Context.h"
-#include "GLViewer_ViewPort2d.h"
+#include "GLViewer_ViewPort.h"
+#include "GLViewer_ViewFrame.h"
 
+/*!
+  Constructor
+*/
 GLViewer_Selector2d::GLViewer_Selector2d( GLViewer_Viewer2d* v2d, GLViewer_Context* glc ) :
 GLViewer_Selector( v2d ),
 myGLContext( glc )
@@ -24,20 +42,35 @@ myGLContext( glc )
 //  myGLContext->SetSelectionColor( Quantity_NOC_RED );
 }
 
+/*!
+  Destructor
+*/
 GLViewer_Selector2d::~GLViewer_Selector2d()
 {
 }
 
+/*!
+  Changes hilight color of context
+  \param color - new hilight color
+*/
 void GLViewer_Selector2d::setHilightColor( Quantity_NameOfColor color )
 {
   myGLContext->SetHighlightColor( color );
 }
 
+/*!
+  Changes selection color of context
+  \param color - new selection color
+*/
 void GLViewer_Selector2d::setSelectColor( Quantity_NameOfColor color )
 {
   myGLContext->SetSelectionColor( color );
 }
 
+/*!
+  Detects object at point
+  \param x, y - point co-ordinates
+*/
 void GLViewer_Selector2d::detect( int x, int y )
 {
   //cout << "GLViewer_Selector2d    : detect ( " << x << " , " << y << " )" << endl;
@@ -52,6 +85,9 @@ void GLViewer_Selector2d::detect( int x, int y )
   myGLContext->MoveTo( x, y );
 }
 
+/*!
+  Undetects all objects
+*/
 void GLViewer_Selector2d::undetectAll()
 {
   if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() || 
@@ -62,9 +98,13 @@ void GLViewer_Selector2d::undetectAll()
   if( !vp->inherits( "GLViewer_ViewPort2d" ) )
     return;
 
-  myGLContext->clearHighlighted();
+  myGLContext->clearHighlighted( true );
 }
 
+/*!
+  Selects previously hilighted objects
+  \param append - append objects to selection
+*/
 void GLViewer_Selector2d::select( bool append )
 {
   //cout << "GLViewer_Selector2d    : select ( " << (int)append << " )" << endl;
@@ -85,6 +125,11 @@ void GLViewer_Selector2d::select( bool append )
   checkSelection( selBefore, append, status );
 }
 
+/*!
+  Selects objects in rectangle
+  \param selRect - selection rectangle
+  \param append - append objects to selection
+*/
 void GLViewer_Selector2d::select( const QRect& selRect, bool append )
 {
     GLViewer_Viewer::SelectionMode selMode = myViewer->getSelectionMode();
@@ -104,6 +149,9 @@ void GLViewer_Selector2d::select( const QRect& selRect, bool append )
     checkSelection( selBefore, append, aStatus );
 }
 
+/*!
+  Unselects all objects
+*/
 void GLViewer_Selector2d::unselectAll()
 {
   if ( myLocked || !myViewer ) 
@@ -118,9 +166,11 @@ void GLViewer_Selector2d::unselectAll()
   if ( hadSelection ) emit selSelectionCancel();
 }
 
-/*  Checks selection state and emits  'selSelectionDone' or 'selSelectionCancel'     
-    Should be called by after non-interactive selection. */
-void GLViewer_Selector2d::checkSelection( int selBefore, bool append, int aStatus )
+/*!
+  Checks selection state and emits  'selSelectionDone' or 'selSelectionCancel'     
+  Should be called by after non-interactive selection.
+*/
+void GLViewer_Selector2d::checkSelection( int selBefore, bool /*append*/, int aStatus )
 {
     int selAfter = numSelected();
     if ( selBefore > 0 && selAfter < 1 )     
@@ -139,6 +189,9 @@ void GLViewer_Selector2d::checkSelection( int selBefore, bool append, int aStatu
     }
 }
 
+/*!
+  \return number of selected objects
+*/
 int GLViewer_Selector2d::numSelected() const
 {
   return myGLContext->NbSelected();