Salome HOME
Merge branch 'abn/paravis_rearch'
[modules/gui.git] / src / GLViewer / GLViewer_AspectLine.cxx
index 4df6041b3f230a36be94918767c55f02e569f81b..687bdcf9377c6f1be3c2acfb5c64c411c4b4e429 100644 (file)
@@ -1,37 +1,34 @@
-//  Copyright (C) 2005 OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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.
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.
+// 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.
 //
-//  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
+// 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.
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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
 //
-//  Author : OPEN CASCADE
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+//  Author : OPEN CASCADE
 // File:      GLViewer_AspectLine.cxx
 // Created:   26/05/2005 3:17:00 PM
-
-//================================================================
-// Class       : GLViewer_AspectLine
-// Description : Substitution of Prs2d_AspectLine for OpenGL
-//================================================================
+//
 #include "GLViewer_AspectLine.h"
 
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+  Default constructor
+*/
 GLViewer_AspectLine::GLViewer_AspectLine()
 {
     myNColor = QColor( 255, 255, 255 );
@@ -42,10 +39,11 @@ GLViewer_AspectLine::GLViewer_AspectLine()
     myLineType = 0;
 }
 
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+  Constructor
+  \param type: 0 for normal line and 1 for strip line
+  \param width - width of line
+*/
 GLViewer_AspectLine::GLViewer_AspectLine( int type, float width )
 {
     myNColor = QColor( 255, 255, 255 );
@@ -59,18 +57,19 @@ GLViewer_AspectLine::GLViewer_AspectLine( int type, float width )
         myLineType = 0;
 }
 
-//=======================================================================
-// Function: ~GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+  Destructor
+*/
 GLViewer_AspectLine::~GLViewer_AspectLine()
 {
 }
 
-//=======================================================================
-// Function: setLineColors
-// Purpose :
-//=======================================================================
+/*!
+  Sets line color
+  \param nc - normal color
+  \param hc - hilighting color
+  \param sc - selection color
+*/
 void GLViewer_AspectLine::setLineColors( QColor nc, QColor hc, QColor sc )
 {
     myNColor = nc;
@@ -78,10 +77,10 @@ void GLViewer_AspectLine::setLineColors( QColor nc, QColor hc, QColor sc )
     mySColor = sc;
 }
 
-//=======================================================================
-// Function: setLineType
-// Purpose :
-//=======================================================================
+/*!
+  Sets type of line
+  \param type: 0 for normal line and 1 for strip line
+*/
 int GLViewer_AspectLine::setLineType( const int type )
 {
     if( type == 1 || type == 0 )
@@ -92,10 +91,10 @@ int GLViewer_AspectLine::setLineType( const int type )
     return 1;
 }
 
-//=======================================================================
-// Function: setLineWidth
-// Purpose :
-//=======================================================================
+/*!
+  Sets width of line
+  \param width - new width of line
+*/
 int GLViewer_AspectLine::setLineWidth( const float width )
 {
     if( width > 0 )
@@ -106,10 +105,12 @@ int GLViewer_AspectLine::setLineWidth( const float width )
     return 1;
 }
 
-//=======================================================================
-// Function: getLineColors
-// Purpose :
-//=======================================================================
+/*!
+  \return colors of line
+  \param nc - variable for normal color
+  \param hc - variable for hilighting color
+  \param sc - variable for selection color
+*/
 void GLViewer_AspectLine::getLineColors( QColor& nc, QColor& hc, QColor& sc ) const
 {
     nc = myNColor;
@@ -117,10 +118,9 @@ void GLViewer_AspectLine::getLineColors( QColor& nc, QColor& hc, QColor& sc ) co
     sc = mySColor;
 }
 
-//=======================================================================
-// Function: getByteCopy
-// Purpose :
-//=======================================================================
+/*!
+  \return binary representation of line aspect
+*/
 QByteArray GLViewer_AspectLine::getByteCopy() const
 {
     int anISize = sizeof( int );
@@ -129,7 +129,8 @@ QByteArray GLViewer_AspectLine::getByteCopy() const
     int aHR = myHColor.red(), aHG = myHColor.green(), aHB = myHColor.blue();
     int aSR = mySColor.red(), aSG = mySColor.green(), aSB = mySColor.blue();
 
-    QByteArray aResult( anISize * 10 + aFSize );
+    QByteArray aResult;
+    aResult.resize( anISize * 10 + aFSize );
 
     int i = 0;
     
@@ -174,10 +175,9 @@ QByteArray GLViewer_AspectLine::getByteCopy() const
     return aResult;
 }
 
-//=======================================================================
-// Function: fromByteCopy
-// Purpose :
-//=======================================================================
+/*!
+  Sets line aspect from binary representation
+*/
 GLViewer_AspectLine* GLViewer_AspectLine::fromByteCopy( QByteArray theBytes )
 {