-// Copyright (C) 2005 OPEN CASCADE
+// Copyright (C) 2007-2016 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
//
-// File: GLViewer_Widget.cxx
-// Created: November, 2004
-
#include "GLViewer_Widget.h"
#include "GLViewer_ViewPort2d.h"
#include "GLViewer_Viewer2d.h"
-#include "GLViewer_Compass.h"
#include "GLViewer_Grid.h"
-#include "GLViewer_Object.h"
#include "GLViewer_CoordSystem.h"
+#include "GLViewer_ViewFrame.h"
#include <cmath>
-using namespace std;
-
-#include <qevent.h>
-#include <qrect.h>
-#include <qpixmap.h>
-#include <qimage.h>
-#include <qapplication.h>
-#include <qintdict.h>
-#include <qpaintdevicemetrics.h>
-#include <qsize.h>
-#include <qtooltip.h>
+#include <QEvent>
+#include <QPaintEvent>
+#include <QRect>
+#include <QFile>
+#include <QImage>
+#include <QApplication>
+#include <QToolTip>
/*!
A constructor
\return start point of curren rotation of Window in OpenGL global scene
*/
void GLViewer_Widget::getRotationStart( GLfloat& rotationStartX,
- GLfloat& rotationStartY,
+ GLfloat& rotationStartY,
GLfloat& rotationStartZ )
{
rotationStartX = myRotationStartX;
A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D)
*/
void GLViewer_Widget::setRotationStart( GLfloat rotationStartX,
- GLfloat rotationStartY,
+ GLfloat rotationStartY,
GLfloat rotationStartZ )
{
myRotationStartX = rotationStartX;
\param rotationCenterZ - center z
*/
void GLViewer_Widget::getRotation( GLfloat& rotationAngle,
- GLfloat& rotationCenterX,
- GLfloat& rotationCenterY,
- GLfloat& rotationCenterZ )
+ GLfloat& rotationCenterX,
+ GLfloat& rotationCenterY,
+ GLfloat& rotationCenterZ )
{
rotationAngle = myRotationAngle;
rotationCenterX = myRotationCenterX;
\param rotationCenterZ - center z
*/
void GLViewer_Widget::setRotation( GLfloat rotationAngle,
- GLfloat rotationCenterX,
- GLfloat rotationCenterY,
- GLfloat rotationCenterZ )
+ GLfloat rotationCenterX,
+ GLfloat rotationCenterY,
+ GLfloat rotationCenterZ )
{
myRotationAngle = rotationAngle;
myRotationCenterX = rotationCenterX;
void GLViewer_Widget::addToolTip( QString theString, QRect theRect )
{
myToolTipRect = theRect;
- QToolTip::add( this, myToolTipRect, theString );
+ setToolTip(theString);
+ //QToolTip::add( this, myToolTipRect, theString );
}
/*!
*/
void GLViewer_Widget::removeToolTip()
{
- QToolTip::remove( this, myToolTipRect );
+ setToolTip("");
+ //QToolTip::remove( this, myToolTipRect );
}
/*!
updateGL();
}
+/*!
+ Custom leave event handler
+*/
+bool GLViewer_Widget::event ( QEvent* e )
+{
+ if (e->type() == QEvent::ToolTip) {
+ QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e);
+ if ( myToolTipRect.contains(helpEvent->pos()) )
+ QToolTip::showText(helpEvent->globalPos(), toolTip());
+ }
+ return QGLWidget::event(e);
+}
/*!
\return the hex code of digit < 16
{
uchar* theCurLine = image.scanLine( i ), cur;
for( int j=w1; j<=w2; j++ )
- for( int k=0; k<3; k++ )
- {
- cur = *(theCurLine+4*j+2-k);
- *(line+cur_index) = hex( cur/16 ); //HI
- *(line+cur_index+1) = hex( cur%16 ); //LO
- full++;
- cur_index+=2;
- if( cur_index>=80 )
- {
- aBuffer += line;
- aBuffer += "\n";
- cur_index = 0;
- }
- }
+ for( int k=0; k<3; k++ )
+ {
+ cur = *(theCurLine+4*j+2-k);
+ *(line+cur_index) = hex( cur/16 ); //HI
+ *(line+cur_index+1) = hex( cur%16 ); //LO
+ full++;
+ cur_index+=2;
+ if( cur_index>=80 )
+ {
+ aBuffer += line;
+ aBuffer += "\n";
+ cur_index = 0;
+ }
+ }
}
aBuffer += "> false 3 colorimage\n\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
}
}
const int max = 133000; //The maximum length of string in PS
int dh = int( floor( double( max ) / ( 3.0*2.0*width ) ) );
for( int k=buf.height()-1; k>=0; k-=dh )
- AddImagePart( hFile, buf, 0, buf.width()-1, QMAX( k-dh+1, 0 ), k,
+ AddImagePart( hFile, buf, 0, buf.width()-1, qMax( k-dh+1, 0 ), k,
aViewerCS, aPSCS, a, b, c, d, dx, dy-(buf.height()-1-k) );
}
}