-// Copyright (C) 2005 OPEN CASCADE
+// Copyright (C) 2007-2015 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
//
-//#include <GLViewerAfx.h>
#include "GLViewer_BaseObjects.h"
#include "GLViewer_BaseDrawers.h"
#include "GLViewer_AspectLine.h"
#include "GLViewer_CoordSystem.h"
#include "GLViewer_Text.h"
#include "GLViewer_Group.h"
-
#include "GLViewer_Drawer.h"
-//#include <cmath>
-//using namespace std;
+#include <QFile>
/*!
Constructor
}
aBuffer+="closepath\nstroke\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
}
aBuffer+="PU;\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
}
return true;
for ( int i = 0; i < myNumber; i++ )
{
- xa = QMIN( xa, myXCoord[i] );
- xb = QMAX( xb, myXCoord[i] );
- ya = QMIN( ya, myYCoord[i] );
- yb = QMAX( yb, myYCoord[i] );
+ xa = qMin( xa, myXCoord[i] );
+ xb = qMax( xb, myXCoord[i] );
+ ya = qMin( ya, myYCoord[i] );
+ yb = qMax( yb, myYCoord[i] );
}
myXGap = ( xb - xa ) / 10;
// cout << "GLViewer_MarkerSet::highlight " << x <<" " << y << " " << tol << endl;
int count = 0;
GLfloat xdist, ydist, radius;
- QValueList<int>::Iterator it;
- QValueList<int> curHNumbers;
+ QList<int>::Iterator it;
+ QList<int> curHNumbers;
bool isFound;
GLboolean update;
int cnt = 0;
ydist = ( myYCoord[i] - y ) * myYScale;
// if ( isCircle && ( xdist * xdist + ydist * ydist <= radius * radius ) ||
- if ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ||
- !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) )
+ if ( ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ) ||
+ ( !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) )
{
- isFound = FALSE;
+ isFound = false;
count++;
for ( it = myCurSelNumbers.begin(); it != myCurSelNumbers.end(); ++it )
if( i == *it )
{
- isFound = TRUE;
+ isFound = true;
curHNumbers.append( i );
}
// cout << "GLViewer_MarkerSet::select " << x << " " << y << endl;
int count = 0;
GLfloat xdist, ydist, radius;
- QValueList<int>::Iterator it;
- QValueList<int>::Iterator it1;
- QValueList<int>::Iterator remIt;
- QValueList<int>::Iterator curIt;
+ QList<int>::Iterator it;
+ QList<int>::Iterator it1;
+ QList<int>::Iterator remIt;
+ QList<int>::Iterator curIt;
radius = tol - myMarkerSize / 2.;
ydist = ( myYCoord[i] - y ) * myYScale;
//if ( isCircle && ( xdist * xdist + ydist * ydist <= radius * radius ) ||
- if ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ||
- !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) )
+ if ( ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ) ||
+ ( !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) )
{
count++;
if ( isShift )
{
- bool isFound = FALSE;
+ bool isFound = false;
for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
if ( *it == i )
{
myUSelNumbers.append( *it );
remIt = it;
- isFound = TRUE;
+ isFound = true;
break;
}
for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myHNumbers.remove( it1 );
+ myHNumbers.erase( it1 );
break;
}
for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myUHNumbers.remove( it1 );
+ myUHNumbers.erase( it1 );
break;
}
}
else
{
- mySelNumbers.remove( remIt );
+ mySelNumbers.erase( remIt );
for ( curIt = myCurSelNumbers.begin(); curIt != myCurSelNumbers.end(); ++curIt )
if( *curIt == *remIt)
{
- myCurSelNumbers.remove( curIt );
+ myCurSelNumbers.erase( curIt );
break;
}
for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myHNumbers.remove( it1 );
+ myHNumbers.erase( it1 );
break;
}
for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myUHNumbers.remove( it1 );
+ myUHNumbers.erase( it1 );
break;
}
}
for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myHNumbers.remove( it1 );
+ myHNumbers.erase( it1 );
break;
}
for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 )
if( i == *it1 )
{
- myUHNumbers.remove( it1 );
+ myUHNumbers.erase( it1 );
break;
}
}
for( it1 = myUSelNumbers.begin(); it1 != myUSelNumbers.end(); ++it1 )
if( *it == *it1 )
{
- it1 = myUSelNumbers.remove( it1 );
+ it1 = myUSelNumbers.erase( it1 );
it1--;
}
/*!
Export numbers of highlighted/selected lines
*/
-void GLViewer_MarkerSet::exportNumbers( QValueList<int>& highlight,
- QValueList<int>& unhighlight,
- QValueList<int>& select,
- QValueList<int>& unselect )
+void GLViewer_MarkerSet::exportNumbers( QList<int>& highlight,
+ QList<int>& unhighlight,
+ QList<int>& select,
+ QList<int>& unselect )
{
highlight = myHNumbers;
unhighlight = myUHNumbers;
bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
{
if( index < 0 || index > myNumber )
- return FALSE;
+ return false;
- int n = mySelNumbers.findIndex( index );
+ int n = mySelNumbers.indexOf( index );
if( n == -1 )
mySelNumbers.append( index );
else
{
- QValueList<int>::Iterator it;
- it = mySelNumbers.at( n );
- mySelNumbers.remove( it );
+ mySelNumbers.removeAt(n);
myUSelNumbers.append( index );
}
- return TRUE;
+ return true;
}
/*!
void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq )
{
for ( int i = 1; i <= seq.Length(); i++ )
- if( mySelNumbers.findIndex( seq.Value( i ) ) == -1 )
+ if( mySelNumbers.indexOf( seq.Value( i ) ) == -1 )
mySelNumbers.append( seq.Value( i ) - 1 );
}
*/
void GLViewer_MarkerSet::setSelected( const TColStd_SequenceOfInteger& seq )
{
-// for( QValueList<int>::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
+// for( QList<int>::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
// if( myUSelNumbers.findIndex( *it ) == -1 )
// myUSelNumbers.append( *it );
QByteArray aObject = GLViewer_Object::getByteCopy();
- QByteArray aResult( anISize + 2*aFSize*myNumber + aFSize + aObject.size());
+ QByteArray aResult;
+ aResult.resize( anISize + 2*aFSize*myNumber + aFSize + aObject.size());
char* aPointer = (char*)&myNumber;
for( i = 0; i < anISize; i++, aPointer++ )
aResult[i] = *aPointer;
- for( ; i < aResult.size(); i++ )
+ for ( ; i < (int)aResult.size(); i++ )
aResult[i] = aObject[i - anISize - 2*aFSize*myNumber - aFSize];
return aResult;
*aPointer = theArray[i];
int aCurIndex = anISize + 2*aFSize*myNumber + aFSize;
- QByteArray aObject( aSize - aCurIndex );
+ QByteArray aObject;
+ aObject.resize( aSize - aCurIndex );
for( ; i < aSize; i++ )
aObject[i - aCurIndex] = theArray[i];
aBuffer+="closepath\nstroke\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
aBuffer+="PU;\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
for ( int i = 0; i < myNumber; i++ )
{
- xa = QMIN( xa, myXCoord[i] );
- xb = QMAX( xb, myXCoord[i] );
- ya = QMIN( ya, myYCoord[i] );
- yb = QMAX( yb, myYCoord[i] );
+ xa = qMin( xa, myXCoord[i] );
+ xb = qMax( xb, myXCoord[i] );
+ ya = qMin( ya, myYCoord[i] );
+ yb = qMax( yb, myYCoord[i] );
}
GLfloat xGap = ( xb - xa ) / 10;
return false;
GLfloat xa, xb, ya, yb, l;
GLfloat rsin, rcos, r, ra, rb;
- GLboolean update;
+ // GLboolean update;
GLboolean selected = myIsSel;
myIsSel = GL_FALSE;
else
myHighFlag = GL_TRUE;
- update = ( GLboolean )( myIsSel != selected );
+ // update = ( GLboolean )( myIsSel != selected );
// cout << "GLViewer_Polyline::select complete with " << (int)myIsSel << endl;
/*!
Export numbers of highlighted/selected lines
*/
-void GLViewer_Polyline::exportNumbers( QValueList<int>& highlight,
- QValueList<int>& unhighlight,
- QValueList<int>& select,
- QValueList<int>& unselect )
+void GLViewer_Polyline::exportNumbers( QList<int>& highlight,
+ QList<int>& unhighlight,
+ QList<int>& select,
+ QList<int>& unselect )
{
highlight = myHNumbers;
unhighlight = myUHNumbers;
QByteArray aObject = GLViewer_Object::getByteCopy();
- QByteArray aResult( aFSize*myNumber*2 + anISize + 2*aBSize + aObject.size());
+ QByteArray aResult;
+ aResult.resize( aFSize*myNumber*2 + anISize + 2*aBSize + aObject.size());
char* aPointer = (char*)&myNumber;
for( i = 0; i < anISize; i++, aPointer++ )
for( ; i < anISize + 2*aFSize*myNumber + 2*aBSize; i++, aPointer++ )
aResult[i] = *aPointer;
- for( ; i < aResult.size(); i++ )
+ for ( ; i < (int)aResult.size(); i++ )
aResult[i] = aObject[i - anISize - 2*aFSize*myNumber - 2*aBSize];
return aResult;
*aPointer = theArray[i];
int aCurIndex = anISize + 2*aFSize*myNumber + 2*aBSize;
- QByteArray aObject( aSize - aCurIndex );
+ QByteArray aObject;
+ aObject.resize( aSize - aCurIndex );
for( ; i < aSize; i++ )
aObject[i - aCurIndex] = theArray[i];
AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) );
aBuffer += "(" + aText + ") show\n";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
aBuffer = "LB" + aText + "#;";
- hFile.writeBlock( aBuffer.ascii(), aBuffer.length() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
y = double( yPos );
aViewerCS->transform( *aEMFCS, x, y );
- const char* str = aText.ascii();
+ const char* str = aText.toLatin1();
int nHeight = 35*14; // height of font
int nWidth = 35*12; // average character width
int nEscapement = 0; // angle of escapement
int nOrientation = 0; // base-line orientation angle
int fnWeight = FW_NORMAL; // font weight
- DWORD fdwItalic = FALSE; // italic attribute option
- DWORD fdwUnderline = FALSE; // underline attribute option
- DWORD fdwStrikeOut = FALSE; // strikeout attribute option
+ DWORD fdwItalic = false; // italic attribute option
+ DWORD fdwUnderline = false; // underline attribute option
+ DWORD fdwStrikeOut = false; // strikeout attribute option
DWORD fdwCharSet = ANSI_CHARSET; // character set identifier
DWORD fdwOutputPrecision = OUT_DEFAULT_PRECIS; // output precision
DWORD fdwClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
(int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
if( isCircle )
- intersection = obj.intersect( circle );
+ intersection = obj.intersected( circle );
else
- intersection = obj.intersect( region );
+ intersection = obj.intersected( region );
if( intersection.isEmpty() )
myIsHigh = false;
QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
(int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
if( isCircle )
- intersection = obj.intersect( circle );
+ intersection = obj.intersected( circle );
else
- intersection = obj.intersect( region );
+ intersection = obj.intersected( region );
if( intersection.isEmpty() )
myIsSel = false;