-// 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 );
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 );
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;
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 )
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 )
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;
sc = mySColor;
}
-//=======================================================================
-// Function: getByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ \return binary representation of line aspect
+*/
QByteArray GLViewer_AspectLine::getByteCopy() const
{
int anISize = sizeof( int );
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;
return aResult;
}
-//=======================================================================
-// Function: fromByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ Sets line aspect from binary representation
+*/
GLViewer_AspectLine* GLViewer_AspectLine::fromByteCopy( QByteArray theBytes )
{