X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGLViewer%2FGLViewer_Group.cxx;h=5834f61da21e187a4df7ef7b358b64049350fd6f;hb=797f7c8b3ebf8d8a1eabc9082f8bd79f6f7ea413;hp=3adf4d9a2703c68526daeacef0609fe0f81f7042;hpb=2e750f9ded92337bc3c44e9d7388180974cc4a43;p=modules%2Fgui.git diff --git a/src/GLViewer/GLViewer_Group.cxx b/src/GLViewer/GLViewer_Group.cxx index 3adf4d9a2..5834f61da 100644 --- a/src/GLViewer/GLViewer_Group.cxx +++ b/src/GLViewer/GLViewer_Group.cxx @@ -1,57 +1,67 @@ +// Copyright (C) 2007-2016 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_Group.xx // Created: March, 2005 -// Author: OCC team -// Copyright (C) CEA 2005 //#include "GLViewerAfx.h" +// #include "GLViewer_Group.h" #include "GLViewer_Object.h" -/*************************************************************************** -** Class: GLViewer_Group -** Descr: Group of GLViewer_Objects -** Module: GLViewer -** Created: UI team, 25.03.05 -****************************************************************************/ - -//-------------------------------------------------------------------------- -//Function: GLViewer_Group() -//Description: constructor -//-------------------------------------------------------------------------- +/*! + constructor +*/ GLViewer_Group::GLViewer_Group() { mySelObjNum = 0; } -//-------------------------------------------------------------------------- -//Function: GLViewer_Group() -//Description: destructor -//-------------------------------------------------------------------------- +/*! + destructor +*/ GLViewer_Group::~GLViewer_Group() { } -//-------------------------------------------------------------------------- -//Function: isEmpty -//Description: detection of empty group -//-------------------------------------------------------------------------- +/*! + detection of empty group +*/ bool GLViewer_Group::isEmpty() { return myList.empty(); } -//-------------------------------------------------------------------------- -//Function: count -//Description: number of elements -//-------------------------------------------------------------------------- +/*! + \return number of elements +*/ int GLViewer_Group::count() { return myList.size(); } -//-------------------------------------------------------------------------- -//Function: contains -//Description: return the position of object, else -1 -//-------------------------------------------------------------------------- +/*! + \return the position of object if group contains it, else -1 +*/ int GLViewer_Group::contains( GLViewer_Object* theObject ) { if( !theObject ) @@ -66,10 +76,9 @@ int GLViewer_Group::contains( GLViewer_Object* theObject ) return -1; } -//-------------------------------------------------------------------------- -//Function: addObject -//Description: adding object to group -//-------------------------------------------------------------------------- +/*! + adding object to group +*/ int GLViewer_Group::addObject( GLViewer_Object* theObject ) { if( theObject && contains( theObject ) == -1 ) @@ -80,10 +89,9 @@ int GLViewer_Group::addObject( GLViewer_Object* theObject ) return count(); } -//-------------------------------------------------------------------------- -//Function: removeObject -//Description: removing object from group -//-------------------------------------------------------------------------- +/*! + removing object from group +*/ int GLViewer_Group::removeObject( GLViewer_Object* theObject ) { if( theObject ) @@ -102,27 +110,31 @@ int GLViewer_Group::removeObject( GLViewer_Object* theObject ) return count(); } -//-------------------------------------------------------------------------- -//Function: dragingObjects -//Description: -//-------------------------------------------------------------------------- -void GLViewer_Group::dragingObjects( float x, float y ) +/*! + Dragging operation + \param Once is true, if this operation calls only one time for all object + \param x, y - dragging position +*/ +void GLViewer_Group::dragingObjects( float x, float y, bool once ) { - if( !mySelObjNum ) + if( !once ) { - OGIterator it = myList.begin(); - OGIterator end_it = myList.end(); - for( int i = 0; it != end_it; ++it, i++ ) - if( (*it)->isSelected() ) - mySelObjNum++; + if( !mySelObjNum ) + { + OGIterator it = myList.begin(); + OGIterator end_it = myList.end(); + for( int i = 0; it != end_it; ++it, i++ ) + if( (*it)->isSelected() ) + mySelObjNum++; - if( mySelObjNum ) + if( mySelObjNum ) + mySelObjNum--; + } + else + { mySelObjNum--; - } - else - { - mySelObjNum--; - return; + return; + } } OGIterator it = myList.begin(); @@ -131,10 +143,11 @@ void GLViewer_Group::dragingObjects( float x, float y ) (*it)->moveObject( x, y, true ); } -//-------------------------------------------------------------------------- -//Function: updateZoom -//Description: -//-------------------------------------------------------------------------- +/*! + Updates zoom of object + \param sender - object to be updated + \param zoom - zoom coefficient +*/ void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom ) { OGIterator it = myList.begin(); @@ -143,6 +156,6 @@ void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom ) { GLViewer_Object* anObject = *it; if( anObject != sender ) - anObject->setZoom( zoom, GL_TRUE ); + anObject->setZoom( zoom, true, true ); } }