-This is the version 3.1.0 of SALOMEGUI
+This is the version 3.2.0a1 of SALOMEGUI
Compatible with :
- - KERNEL 3.1.0
+ - KERNEL 3.2.0a1
-THIS IS SALOME - SALOMEGUI VERSION: 3.1.0
+THIS IS SALOME - SALOMEGUI VERSION: 3.2.0a1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME v.3.1.0"
+PROJECT_NAME = "SALOME v.3.2.0a1"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = NO
+REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = YES
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
+INHERIT_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 5
ALIASES =
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = YES
LDOM_NodeList systemList = systems.getElementsByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEM" ) );
for ( Standard_Integer i = 0; i < systemList.getLength(); i++ )
{
- LDOM_Element aSystem = (const LDOM_Element &)systemList.item( i );
+ //const LDOM_Element& aSystem = (const LDOM_Element &)systemList.item( i );
+ LDOM_Node aNode = systemList.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aSystem(anElem);
TCollection_AsciiString aName = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_NAME" ) );
TCollection_ExtendedString aLabel = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_LABEL" ) );
for ( Standard_Integer i = 0; i < aData.getLength(); i++ )
{
- LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ //LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
+ LDOM_Node aNode = aData.item( i );
+ const LDOM_Element& anElem = (const LDOM_Element&) aNode;
+ LDOM_Element aQuantity(anElem);
// 1. Attributes (id,label,units?,format?,required?)
TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) );
if ( aListValueID.IsIntegerValue() )
{
// Read the text in the element "value"
- LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
+ LDOM_Node aNode = aListItemValue.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aListItemTxt(aText);
if ( !aListItemTxt.isNull() )
{
// adding ID and text value to sequence
if ( !aShDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ //LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
+ LDOM_Node aNode = aShDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aShDescrTxt(aText);
if ( !aShDescrTxt.isNull() )
aShortD = aShDescrTxt.getData();
}
if ( !aLDescr.isNull() )
{
// text is always a sub-node of element, containing it
- LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ //LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
+ LDOM_Node aNode = aLDescr.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aLDescrTxt(aText);
if ( !aLDescrTxt.isNull() )
aLongD = aLDescrTxt.getData();
}
#include <qpainter.h>
#define TEXT_GAP 5
+// Two texture components for texmapped fonts: luminance and alpha
+#define NB_TEX_COMP 2
+// A font is split into rows each containing 32 characters
+#define TEX_ROW_LEN 32
+// Gap in pixels between two character rows in a font texture
+#define TEX_ROW_GAP 2
-GLboolean TFLoaded = GL_FALSE;
-
-GLdouble modelMatrix[16], projMatrix[16];
-GLint viewport[4];
-GLdouble winx, winy, winz;
-GLint status;
-
-GLViewer_TexFont* staticGlFont;
+GLfloat modelMatrix[16];
//================================================================
// Class : GLViewer_TexFont
// Purpose :
//=======================================================================
GLViewer_TexFont::GLViewer_TexFont()
+: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
myQFont = QFont::defaultFont();
- QFontMetrics aFM( myQFont );
- myWidths = new int[LastSymbolNumber - FirstSymbolNumber+1];
- myPositions = new int[LastSymbolNumber - FirstSymbolNumber+1];
mySeparator = 2;
- for( int k = FirstSymbolNumber, aWidth = 0; k <= LastSymbolNumber; k++ )
- {
- myWidths[ k - FirstSymbolNumber ] = aFM.width( k );
- myPositions[ k - FirstSymbolNumber ] = aWidth;
- aWidth += myWidths[ k - FirstSymbolNumber ] + 2;//mySeparator;
- }
-
- myTexFontWidth = 0;
- myTexFontHeight = 0;
myIsResizeable = false;
- //myMinMagFilter = GL_NEAREST;
- myMinMagFilter = GL_LINEAR_ATTENUATION ;
+ myMinMagFilter = GL_LINEAR;
+
+ init();
}
//======================================================================
// Purpose :
//=======================================================================
GLViewer_TexFont::GLViewer_TexFont( QFont* theFont, int theSeparator, bool theIsResizeable, GLuint theMinMagFilter )
+: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
myQFont = *theFont;
- QFontMetrics aFM( myQFont );
- myWidths = new int[LastSymbolNumber - FirstSymbolNumber+1];
- myPositions = new int[LastSymbolNumber - FirstSymbolNumber+1];
mySeparator = theSeparator;
- for( int k = FirstSymbolNumber, aWidth = 0; k <= LastSymbolNumber; k++ )
- {
- myWidths[ k - FirstSymbolNumber ] = aFM.width( k );
- myPositions[ k - FirstSymbolNumber ] = aWidth;
- aWidth += myWidths[ k - FirstSymbolNumber ] + 2;//mySeparator;
- }
-
- myTexFontWidth = 0;
- myTexFontHeight = 0;
myIsResizeable = theIsResizeable;
myMinMagFilter = theMinMagFilter;
-
+
+ init();
}
//======================================================================
delete[] myWidths;
delete[] myPositions;
}
+
+//======================================================================
+// Function: init
+// Purpose :
+//=======================================================================
+void GLViewer_TexFont::init()
+{
+ myNbSymbols = LastSymbolNumber - FirstSymbolNumber + 1;
+
+ // It is unsafe to draw all characters in a single row -
+ // this leads to problems on some graphic cards with small GL_MAX_TEXTURE_SIZE.
+ // So splitting the characters into rows each containing 32 characters (or less).
+ // Assuming contant height of each row (64 pixels) to simplify texture mapping.
+ // However, this can be improved if necessary.
+ QFontMetrics aFM( myQFont );
+ myFontHeight = aFM.height();
+
+ myWidths = new int[myNbSymbols];
+ myPositions = new int[myNbSymbols];
+
+ for( int i = 0, k = FirstSymbolNumber, aWidth = 0; i < myNbSymbols; i++, k++ )
+ {
+ // is it time to start a new row?
+ if ( !( i % TEX_ROW_LEN ) )
+ {
+ if( aWidth > myMaxRowWidth )
+ myMaxRowWidth = aWidth;
+ aWidth = 0;
+ }
+ myWidths[i] = aFM.width( k );
+ myPositions[i] = aWidth;
+ aWidth += myWidths[i] + 2;
+ }
+
+ myTexFontWidth = 0;
+ myTexFontHeight = 0;
+}
//======================================================================
// Function: generateTexture
// Purpose :
//=======================================================================
-void GLViewer_TexFont::generateTexture()
+bool GLViewer_TexFont::generateTexture()
{
- QFontMetrics aFM( myQFont );
-
GLViewer_TexFindId aFindFont;
- aFindFont.myFontString = myQFont.toString();
+ aFindFont.myFontFamily = myQFont.family();//myQFont.toString();
+ aFindFont.myIsBold = myQFont.bold();
+ aFindFont.myIsItal = myQFont.italic();
+ aFindFont.myIsUndl = myQFont.underline();
+ aFindFont.myPointSize = myQFont.pointSize();
aFindFont.myViewPortId = (int)QGLContext::currentContext();
if( TexFontBase.contains( aFindFont ) )
}
else
{
- QString aStr;
- int pixelsWidth = 0;
- int pixelsHight = aFM.height();
- myTexFontWidth = 64;
+ // Adding some pixels to have a gap between rows
+ int aRowPixelHeight = myFontHeight + TEX_ROW_GAP;
+ int aDescent = QFontMetrics( myQFont ).descent();
+
+ int aNumRows = myNbSymbols / TEX_ROW_LEN;
+ if ( myNbSymbols % TEX_ROW_LEN )
+ aNumRows++;
+ int pixelsHight = aNumRows * aRowPixelHeight;
+
+ myTexFontWidth = 64;
myTexFontHeight = 64;
-
- pixelsWidth = myWidths[LastSymbolNumber - FirstSymbolNumber] +
- myPositions[LastSymbolNumber - FirstSymbolNumber];
- while( myTexFontWidth < pixelsWidth )
- myTexFontWidth = myTexFontWidth * 2;
+ while( myTexFontWidth < myMaxRowWidth )
+ myTexFontWidth <<= 1;
while( myTexFontHeight < pixelsHight )
- myTexFontHeight = myTexFontHeight * 2;
+ myTexFontHeight <<= 1;
+
+ // Checking whether the texture dimensions for the requested font
+ // do not exceed the maximum size supported by the OpenGL implementation
+ int maxSize;
+ glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxSize );
+ if ( myTexFontWidth > maxSize || myTexFontHeight > maxSize )
+ return false;
QPixmap aPixmap( myTexFontWidth, myTexFontHeight );
aPixmap.fill( QColor( 0, 0, 0) );
QPainter aPainter( &aPixmap );
aPainter.setFont( myQFont );
- for( int l = 0/*, gap = 0*/; l < LastSymbolNumber - FirstSymbolNumber; l++ )
+ int row;
+ for( int l = 0; l < myNbSymbols; l++ )
{
+ row = l / TEX_ROW_LEN;
QString aLetter;
aLetter += (char)(FirstSymbolNumber + l);
aPainter.setPen( QColor( 255,255,255) );
- aPainter.drawText ( myPositions[l], pixelsHight, aLetter );
+ aPainter.drawText( myPositions[l], ( row + 1 ) * aRowPixelHeight - aDescent, aLetter );
}
QImage aImage = aPixmap.convertToImage();
- char* pixels = new char[myTexFontWidth * myTexFontHeight * 2];
+
+ //int qqq = 0;
+ //if (qqq)
+ // aImage.save("w:\\work\\CATHARE\\texture.png", "PNG");
+
+ char* pixels = new char[myTexFontWidth * myTexFontHeight * NB_TEX_COMP];
for( int i = 0; i < myTexFontHeight; i++ )
{
if( aRed != 0 || aGreen != 0 || aBlue != 0 )
{
- pixels[i * myTexFontWidth * 2 + j * 2] = (GLubyte)( (aRed + aGreen + aBlue)/3 );
- pixels[i * myTexFontWidth * 2 + j * 2 + 1]= (GLubyte) 255;
+ pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP] = (GLubyte)( (aRed + aGreen + aBlue)/3 );
+ pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP + 1]= (GLubyte) 255;
}
else
{
- pixels[i * myTexFontWidth * 2 + j * 2] = (GLubyte) 0;
- pixels[i * myTexFontWidth * 2 + j * 2 + 1]= (GLubyte) 0;
+ pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP] = (GLubyte) 0;
+ pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP + 1]= (GLubyte) 0;
}
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &myTexFont);
glBindTexture(GL_TEXTURE_2D, myTexFont);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myMinMagFilter);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myMinMagFilter);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D,
0,
GL_INTENSITY,
TexFontBase.insert( aFindFont, aTexture );
}
+ return true;
}
//======================================================================
// Function: drawString
// Purpose :
//=======================================================================
-void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY )
+void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY, GLfloat theScale )
{
- double aXScale = 1., aYScale = 1.;
- // store attributes
- glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT );
+ // Adding some pixels to have a gap between rows
+ int aRowPixelHeight = myFontHeight + TEX_ROW_GAP;
+ float aXScale = 1.f, aYScale = 1.f;
if ( !myIsResizeable )
{
- glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetFloatv (GL_MODELVIEW_MATRIX, modelMatrix);
aXScale = modelMatrix[0];
- aYScale = modelMatrix[5];
+ aYScale = modelMatrix[5];
+ }
+ else if ( theScale > 0.f )
+ {
+ aXScale = aXScale / theScale;
+ aYScale = aYScale / theScale;
}
- glEnable(GL_TEXTURE_2D);
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myMinMagFilter);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myMinMagFilter);
+ // store attributes
+ glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT );
+ glEnable(GL_TEXTURE_2D);
glPixelTransferi(GL_MAP_COLOR, 0);
glAlphaFunc(GL_GEQUAL, 0.05F);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, myTexFont);
- glBegin(GL_QUADS);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- theY = theY - ( myTexFontHeight - QFontMetrics( myQFont ).height() ) / aYScale;
+ glBegin(GL_QUADS);
- double aLettBegin, aLettEnd, aDY = ( myTexFontHeight - 1 ) / aYScale, aDX;
+ float aLettBeginS, aLettEndS, aLettBeginT, aLettEndT;
+ float aDY = ( aRowPixelHeight - 1 ) / aYScale, aDX;
char aLetter;
- int aLettIndex;
+ int aLettIndex, row;
for( int i = 0; i < theStr.length(); i++ )
{
aLetter = theStr.data()[i];
aLettIndex = (int)aLetter - FirstSymbolNumber;
+ row = aLettIndex / TEX_ROW_LEN;
- aLettBegin = (double)myPositions[aLettIndex] / ( (double)myTexFontWidth - 1. );
- aLettEnd = aLettBegin + ( (double)myWidths[aLettIndex] - 1. ) / ( (double)myTexFontWidth - 1. );
+ aLettBeginS = (float)myPositions[aLettIndex] / ( (float)myTexFontWidth - 1.f );
+ aLettEndS = aLettBeginS + ( (float)myWidths[aLettIndex] - 1.f ) / ( (float)myTexFontWidth - 1.f );
+ aLettBeginT = ( myTexFontHeight - ( row + 1 ) * aRowPixelHeight ) / ( (float)myTexFontHeight - 1.f );
+ aLettEndT = aLettBeginT + ( (float)aRowPixelHeight - 1.f ) / ( (float)myTexFontHeight - 1.f );
- aDX = ( (double)myWidths[aLettIndex] - 1. ) / aXScale;
+ aDX = ( (float)myWidths[aLettIndex] - 1.f ) / aXScale;
- glTexCoord2d( aLettBegin, 0.0 ); glVertex3d( theX, theY, 1.0 );
- glTexCoord2d( aLettBegin, 1.0 ); glVertex3d( theX, theY + aDY, 1.0 );
- glTexCoord2d( aLettEnd, 1.0 ); glVertex3d( theX + aDX, theY + aDY, 1.0 );
- glTexCoord2d( aLettEnd, 0.0 ); glVertex3d( theX + aDX, theY, 1.0 );
+ glTexCoord2f( aLettBeginS, aLettBeginT ); glVertex3f( theX, theY, 1.f );
+ glTexCoord2f( aLettBeginS, aLettEndT ); glVertex3f( theX, theY + aDY, 1.f );
+ glTexCoord2f( aLettEndS, aLettEndT ); glVertex3f( theX + aDX, theY + aDY, 1.f );
+ glTexCoord2f( aLettEndS, aLettBeginT ); glVertex3f( theX + aDX, theY, 1.f );
theX += aDX + mySeparator / aXScale;
}
//! function for generation list base for bitmap fonts
static GLuint displayListBase( QFont* theFont )
{
+ if ( !theFont )
+ return 0;
GLuint aList = 0;
//static QMap<GLViewer_TexFindId, GLuint> fontCache;
GLViewer_TexFindId aFindFont;
- aFindFont.myFontString = theFont->toString();
+ aFindFont.myFontFamily = theFont->family();//theFont->toString();
+ aFindFont.myIsBold = theFont->bold();
+ aFindFont.myIsItal = theFont->italic();
+ aFindFont.myIsUndl = theFont->underline();
+ aFindFont.myPointSize = theFont->pointSize();
#ifdef WIN32
HGLRC ctx = ::wglGetCurrentContext();
//glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase );
int aFontCont = 0;
- char** xFontList = XListFonts( aDisp, aFindFont.myFontString.data(), 1, &aFontCont );
+ QString aFontDef = theFont->toString();
+ char** xFontList = XListFonts( aDisp, aFontDef.latin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont );
if( !theFont->handle() )
{
#ifdef _DEBUG_
- printf( "Can't load font %s. loading default font....\n", aFindFont.myFontString.data() );
+ printf( "Can't load font %s. loading default font....\n", aFontDef.latin1()/*aFindFont.myFontString.data()*/ );
#endif
QString aFontMask ("-*-*-*-r-*-*-");
- aFontMask += aFindFont.myFontString.section( ',', 1, 1 );
+ aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 );
#ifdef _DEBUG_
- printf( "Height of Default font: %s\n", aFindFont.myFontString.section( ',', 1, 1 ).data() );
+ printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() );
#endif
aFontMask += "-*-*-*-m-*-*-*";
xFontList = XListFonts( aDisp, aFontMask.data()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont );
myObjectType = "GLViewer_Object";
myPriority = 0;
myTextFormat = DTF_BITMAP;
+ myTextScale = 0.125;
}
//======================================================================
if( theFormat != DTF_BITMAP )
{
GLViewer_TexFont aTexFont( theFont, theSeparator, theFormat == DTF_TEXTURE_SCALABLE, GL_LINEAR );
- aTexFont.generateTexture();
- aTexFont.drawString( text, xPos, yPos );
+ // Font texture was not found or generated --> cannot draw text
+ if ( !aTexFont.generateTexture() )
+ return;
+
+ if ( theFormat == DTF_TEXTURE_SCALABLE )
+ aTexFont.drawString( text, xPos, yPos, textScale() );
+ else
+ aTexFont.drawString( text, xPos, yPos );
}
else
{
if( smallFont )
aFont.setPointSize( aFont.pointSize() * 0.8 );
+ GLfloat scale = textScale() > 0. ? textScale() : 1.;
+
QFontMetrics aFontMetrics( aFont );
- float width = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.width( text ) : aFontMetrics.width( text ) / myXScale;
- float height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() : aFontMetrics.height() / myYScale;
+ float width = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.width( text ) * scale : aFontMetrics.width( text ) / myXScale;
+ float height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() * scale : aFontMetrics.height() / myYScale;
float gap = 5 / myXScale;
switch( hPosition )
drawText( text, x, y, color, &aFont, 2, myTextFormat );
}
+//======================================================================
+// Function: textRect
+// Purpose :
+//=======================================================================
+GLViewer_Rect GLViewer_Drawer::textRect( const QString& text ) const
+{
+ GLfloat scale = textScale() > 0. ? textScale() : 1.;
+
+ QFontMetrics aFontMetrics( myFont );
+ float width = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.width( text ) * scale : aFontMetrics.width( text );
+ float height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() * scale : aFontMetrics.height();
+
+ return GLViewer_Rect( 0, width, height, 0 );
+}
+
//======================================================================
// Function: drawRectangle
// Purpose :
*/
struct GLVIEWER_API GLViewer_TexFindId
{
- //! Font description
- QString myFontString;
+ //! Font family description
+ QString myFontFamily;
+ //! Bold parameter
+ bool myIsBold;
+ //! Italic parameter
+ bool myIsItal;
+ //! Underline parameter
+ bool myIsUndl;
+ //! Font Size
+ int myPointSize;
//! View POrt ID
int myViewPortId;
//! Overloaded operator for using struct as MAP key
bool operator < (const GLViewer_TexFindId theStruct) const
{
- if ( myViewPortId != theStruct.myViewPortId ) return myViewPortId < theStruct.myViewPortId;
- else return myFontString < theStruct.myFontString;
+ if ( myViewPortId != theStruct.myViewPortId )
+ return myViewPortId < theStruct.myViewPortId;
+ else if ( myPointSize != theStruct.myPointSize )
+ return myPointSize < theStruct.myPointSize;
+ else if ( myIsBold != theStruct.myIsBold )
+ return myIsBold < theStruct.myIsBold;
+ else if ( myIsItal != theStruct.myIsItal )
+ return myIsItal < theStruct.myIsItal;
+ else if ( myIsUndl != theStruct.myIsUndl )
+ return myIsUndl < theStruct.myIsUndl;
+ else
+ return myFontFamily < theStruct.myFontFamily;
}
};
~GLViewer_TexFont();
//! Generating font texture
- void generateTexture();
+ bool generateTexture();
//! Drawing string theStr in point with coords theX and theY
- void drawString( QString theStr, GLdouble theX = 0.0, GLdouble theY = 0.0 );
+ void drawString( QString theStr,
+ GLdouble theX = 0.0,
+ GLdouble theY = 0.0,
+ GLfloat theScale = 1.0 );
//! Returns separator between letters
int getSeparator(){ return mySeparator; }
static QMap<GLViewer_TexFindId,GLViewer_TexIdStored> TexFontBase;
//! Map for strorage generated bitmaps fonts
static QMap<GLViewer_TexFindId,GLuint> BitmapFontCache;
+
+private:
+ //! Initializes font parameters
+ void init();
-protected:
+private:
+ //! Number of characters in the font texture
+ int myNbSymbols;
//! Array of letter width
int* myWidths;
//! Array of letter positions in texture
bool myIsResizeable;
//! Min/mag filter
GLuint myMinMagFilter;
+ //! Font height
+ int myFontHeight;
+ //! Diagnostic information
+ int myMaxRowWidth;
};
/***************************************************************************
/*!
*\param format - the default text displaying format
*/
- inline void setTextFormat( DisplayTextFormat format ) { myTextFormat = format; }
+ inline void setTextFormat( const DisplayTextFormat format ) { myTextFormat = format; }
//! Returns a default text displaying format used by drawGLText method
inline DisplayTextFormat textFormat() const { return myTextFormat; }
+ //! Sets a text string displaying scale factor (used only with text format DTF_TEXTURE_SCALABLE)
+ /*!
+ *\param factor - scale factor
+ */
+ inline void setTextScale( const GLfloat factor ) { myTextScale = factor; }
+
+ //! Returns a text string displaying scale factor
+ inline GLfloat textScale() const { return myTextScale; }
+
+ //! Returns a rectangle of text (without viewer scale)
+ GLViewer_Rect textRect( const QString& ) const;
+
+
//! Draw rectangle with predefined color
static void drawRectangle( GLViewer_Rect* theRect, QColor = Qt::black );
QFont myFont;
//! Default text displaying format for drawGLText() method
DisplayTextFormat myTextFormat;
+
+ //! Scale factor for text string draw, by default 0.125
+ //! (used only with text format DTF_TEXTURE_SCALABLE)
+ GLfloat myTextScale;
};
#ifdef WNT
void GLViewer_Object::setGroup( GLViewer_Group* theGroup )
{
+ if ( myGroup == theGroup )
+ return;
+
if( myGroup )
myGroup->removeObject( this );
virtual bool finishMove() { return true; }
//! Returns visible object status
- bool getVisible() const { return myIsVisible; }
+ virtual bool getVisible() const { return myIsVisible; }
//! Installs visible object status
virtual void setVisible( bool theStatus ) { myIsVisible = theStatus; }
//#include <GLViewerAfx.h>
-#if !defined WNT
+#if !(defined WNT) && !(defined QT_CLEAN_NAMESPACE)
#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
#endif
update = anObject->updateZoom( zoomIn ) || update;
}
+ emit wheelZoomChange( zoomIn );
+
if( update )
updateAll();
}
//! Repaints view \param theView. If \param theView = NULL repaints all views.
void repaintView( GLViewer_ViewFrame* theView = NULL, bool makeCurrent = false );
+signals:
+ //! Signal needs for optimum recompute of zoom depending objects
+ //! Warning: use recompute without update viewer
+ void wheelZoomChange( bool );
+
public slots:
//void onSketchDelObject();
//void onSketchUndoLast();
if( vm )
{
vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
- vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ) );
+ vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ),
+ resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
new LightApp_VTKSelector( vm, mySelMgr );
}
}
QString LightApp_Application::getFileFilter() const
{
return "(*.bin)";
+ // HDF persistence not yet completed - to be uncommented later
+ //return "(*.hdf)";
}
/*! Gets file name*/
if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) )
{
int sz = resMgr->integerValue( "VTKViewer", "trihedron_size", -1 );
+ bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true );
QPtrList<SUIT_ViewManager> lst;
viewManagers( SVTK_Viewer::Type(), lst );
for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM )
{
- vtkVM->setTrihedronSize( sz );
+ vtkVM->setTrihedronSize( sz, isRelative );
vtkVM->Repaint();
}
}
/*! Constructor.*/
LightApp_Driver::LightApp_Driver()
+: myIsTemp( false )
{
}
// Create a temporary directory for the component's data files
std::string aDir = GetTmpDir();
+ // Remember that the files are in a temporary location that should be deleted
+ // when a study is closed
+ SetIsTemporary( true );
+
//Get a temporary directory for saving a file
TCollection_AsciiString aTmpDir(const_cast<char*>(aDir.c_str()));
if(IsDirDeleted) {
OSD_Path aPath(aDirName);
OSD_Directory aDir(aPath);
- OSD_FileIterator anIterator(aPath, '*');
-
- if(aDir.Exists() && !anIterator.More()) aDir.Remove();
+ // san -- Using a special code block below is essential - it ensures that
+ // OSD_FileIterator instance is destroyed by the moment when
+ // OSD_Directory::Remove() is called.
+ // Otherwise, the directory remains locked (at least on Windows)
+ // by the iterator and cannot be removed.
+ {
+ OSD_FileIterator anIterator(aPath, '*');
+ if(!aDir.Exists() || anIterator.More())
+ return;
+ }
+ aDir.Remove();
}
}
for ( it = myMap.begin(); it != myMap.end(); ++it )
{
const char* aModuleName = const_cast<char*>(it->first.c_str());
- RemoveTemporaryFiles( aModuleName, false );
+ // If the driver contains temporary files -
+ // remove them along with the temporary directory
+ RemoveTemporaryFiles( aModuleName, IsTemporary() );
}
- myMap.clear();
+ myMap.clear();
+ // Reset the "temporary" flag
+ SetIsTemporary( false );
}
//============================================================================
aDir = OSD_Directory(aPath);
}
- OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
+#ifdef WIN32
+ // Workaround for OSD_Protection bug on Windows
+ OSD_Protection aProtection(OSD_RWXD, OSD_RWXD, OSD_RWXD, OSD_RWXD);
+#else
+ OSD_Protection aProtection(OSD_RX, OSD_RWXD, OSD_RX, OSD_RX);
+#endif
aDir.Build(aProtection);
myTmpDir = aTmpDir.ToCString();
typedef std::vector<std::string> ListOfFiles;
- bool SaveDatasInFile (const char* theFileName, bool isMultiFile );
- bool ReadDatasFromFile (const char* theFileName, bool isMultiFile );
- virtual std::string GetTmpDir (const char* theURL, const bool isMultiFile);
+ virtual bool SaveDatasInFile (const char* theFileName, bool isMultiFile);
+ virtual bool ReadDatasFromFile (const char* theFileName, bool isMultiFile);
+ virtual std::string GetTmpDir (const char* theURL, const bool isMultiFile);
ListOfFiles GetListOfFiles (const char* theModuleName);
virtual void SetListOfFiles (const char* theModuleName, const ListOfFiles theListOfFiles);
virtual void ClearDriverContents();
-private:
+protected:
void PutFilesToStream(const std::string& theModuleName, unsigned char*& theBuffer,
long& theBufferSize, bool theNamesOnly = false);
ListOfFiles PutStreamToFiles(const unsigned char* theBuffer,
std::string GetTmpDir();
std::string GetDirFromPath(const std::string& thePath);
-private:
+ void SetIsTemporary( bool theFlag ) { myIsTemp = theFlag; }
+ bool IsTemporary() const { return myIsTemp; }
+
+protected:
typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
MapOfListOfFiles myMap;
std::string myTmpDir;
+
+private:
+ bool myIsTemp;
};
#endif
#include "LightApp_DataModel.h"
#include "LightApp_DataObject.h"
#include "LightApp_RootObject.h"
-#include "LightApp_Driver.h"
+// HDF persistence not yet completed
+//#include "LightApp_HDFDriver.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_DataObjectIterator.h"
LightApp_Study::LightApp_Study( SUIT_Application* app )
: CAM_Study( app )
{
+ // HDF persistence not yet completed
+ //myDriver = new LightApp_HDFDriver();
myDriver = new LightApp_Driver();
}
//================================================================
void LightApp_Study::closeDocument(bool permanently)
{
- // Remove temporary files
- ModelList aList;
- dataModels( aList );
- myDriver->ClearDriverContents();
-
// Inform everybody that this study is going to close when it's most safe to,
// i.e. in the very beginning
emit closed( this );
CAM_Study::closeDocument(permanently);
+
+ // Remove temporary files
+ myDriver->ClearDriverContents();
}
//================================================================
}
//=======================================================================
-// name : saveModuleData
-/*! Purpose : Create SComponent for module, necessary for SalomeApp study */
+// name : addComponent
+/*! Purpose : Create SComponent for module, necessary for SalomeApp study */
//=======================================================================
void LightApp_Study::addComponent(const CAM_DataModel* dm)
{
}
//================================================================
-// Function : RemoveTemporaryFiles
+// Function : components
/*! Purpose : to be used by modules*/
//================================================================
void LightApp_Study::components( QStringList& comp ) const
comp.append( obj->entry() );
}
}
-
LightApp_UpdateFlags.h \
LightApp_VTKSelector.h \
LightApp_WidgetContainer.h
+# LightApp_HDFDriver.h \
# .po files to transform in .qm
PO_FILES = LightApp_images.po \
LightApp_PreferencesDlg.cxx \
LightApp_VTKSelector.cxx \
LightApp_WidgetContainer.cxx
+# LightApp_HDFDriver.cxx \
LIB_MOC = LightApp_AboutDlg.h \
LightApp_Application.h \
LightApp.ini \
LightApp.xml
-CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES)
+CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES)
+ #$(HDF5_INCLUDES)
LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSOCC -lSVTK -lSPlot2d -lSUPERVGraph -lPyInterp -lPythonConsole
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSOCC -lSVTK -lSPlot2d -lSUPERVGraph -lPyInterp -lPythonConsole
+ #$(HDF5_LIBS) -lSalomeHDFPersistCopy
@CONCLUDE@
msgid "LightApp_PreferencesDlg::CAPTION"
msgstr "Preferences"
+msgid "LightApp_PreferencesDlg::DEFAULT_BTN_TEXT"
+msgstr "Defaults"
+
+msgid "LightApp_PreferencesDlg::WARNING"
+msgstr "Warning"
+
+msgid "LightApp_PreferencesDlg::DEFAULT_QUESTION"
+msgstr "Do you want to retrieve default preferences?"
+
//=======================================================================================
msgid "LightApp_Module::TOP_DISPLAY"
{
if ( !curve )
return;
+
// san -- Protection against QwtCurve bug in Qwt 0.4.x:
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
if ( myYMode && curve->getMinY() <= 0. )
setVerScaleMode( 0, false );
-
if ( hasCurve( curve ) ) {
updateCurve( curve, update );
}
}
myXMode = mode;
- if ( myXMode == 0 ) // linear
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
- else // logarithmic
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, true );
+
+ myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, myXMode != 0 );
if ( update )
fitAll();
}
myYMode = mode;
- if ( myYMode == 0 ) { // linear
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
- if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, false );
- }
- else { // logarithmic
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, true );
- if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, true );
- }
+ myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, myYMode != 0 );
+ if (mySecondY)
+ myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, myYMode != 0 );
+
if ( update )
fitAll();
emit vpModeVerChanged();
msgid "BUT_OK"
msgstr "Ok"
-# ------------------------------------
+#-------------------------------------
# Plot2d_SetupViewDlg
# ------------------------------------
msgid "TLT_SETUP_PLOT2D_VIEW"
-# File : Makefile.in\r# Author : Vladimir Klyachin (OCN)
+# File : Makefile.in
+# Author : Vladimir Klyachin (OCN)
# Module : suit
# $Header$
QSize calculateSize( const bool, const int,
const bool, const bool, const bool ) const;
- friend class Dock;
+#if QT_VER == 3
+ friend class QtxColorScale::Dock;
+#endif
private:
double myMin;
*/
void QtxDirListEditor::getPathList(QStringList& list)
{
+ // Finish the path editing
+ if (myEdit) {
+ validate(true);
+
+ myEdit->deleteLater();
+ myBtn->deleteLater();
+ myEdit = 0;
+ myBtn = 0;
+ myEdited = false;
+ myDirList->setFocus();
+ }
+
list.clear();
for (unsigned i = 0; i < myDirList->count()-1; i++)
list.append(myDirList->text(i));
/*!
Validates entered path, returns true if OK
*/
-bool QtxDirListEditor::validate()
+bool QtxDirListEditor::validate( const bool quietMode )
{
if ( myEdited )
{
- QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).absFilePath();
+ QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).filePath();
/*
#ifndef WNT
if ( dirPath.startsWith( "~") ) {
if (found) {
if (found != myLastSelected) {
// it is forbidden to add directory more then once
- QMessageBox::critical(this,
- tr("Error"),
- tr("Directory already specified."),
- tr("Ok"));
+ if ( !quietMode )
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Directory already specified."),
+ tr("Ok"));
myEdit->setFocus();
return false;
}
}
else {
if (!dir.exists()) {
- if ( QMessageBox::information(this,
- tr("Warning"),
- tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
- tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
+ if ( !quietMode && QMessageBox::information(this,
+ tr("Warning"),
+ tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+ tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
myEdit->setFocus();
return false;
}
* \brief Validates entered path
* \retval bool - returns status (true if OK)
*/
- bool validate();
+ bool validate( const bool quietMode = false );
/*!
* \brief Appends/changes path
#include <qfontdatabase.h>
#include <qfileinfo.h>
#include <qfiledialog.h>
+#include <qapplication.h>
#include "QtxIntSpinBox.h"
#include "QtxDblSpinBox.h"
if( deffam.canCast( QVariant::String ) )
curtext = deffam.toString();
}
+
+ if ( curtext.isEmpty() )
+ curtext = (QApplication::font()).family();
int idx = -1;
for ( int i = 0; i < (int)myFamilies->count() && idx < 0; i++ )
{
if ( desktop() )
savePreferences();
+ SUIT_Study* study = activeStudy();
+
+ if ( study ){
+ study->closeDocument();
+
+ setActiveStudy( 0 );
+ delete study;
+ }
+ setDesktop( 0 );
+
SUIT_Application::closeApplication();
}
return;
}
- SUIT_Study* study = activeStudy();
-
- if ( study )
- study->closeDocument();
-
- setActiveStudy( 0 );
- delete study;
-
- savePreferences();
-
- setDesktop( 0 );
-
closeApplication();
}
//! Returns main widget (Desktop) of the application (if it exists)
virtual SUIT_Desktop* desktop();
- /*! Returns FALSE if applic ation can not be closed (because of non saved data for example).
+ /*! Returns FALSE if application can not be closed (because of non saved data for example).
This method called by SUIT_Session whin closing of application was requested. */
virtual bool isPossibleToClose();
+ /*! Performs some finalization of life cycle of this application.
+ For instance, the application can force its documents(s) to close. */
virtual void closeApplication();
//! Returns active Study. If Application supports wirking with several studies this method should be redefined
//----------------------------------------------------------------------------
void
SVTK_MainWindow
-::SetTrihedronSize( const int theSize )
+::SetTrihedronSize( const int theSize, const bool theRelative )
{
- GetRenderer()->SetTrihedronSize(theSize);
+ GetRenderer()->SetTrihedronSize(theSize, theRelative);
Repaint();
}
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
void
- SetTrihedronSize(const int theSize);
+ SetTrihedronSize(const int theSize, const bool theRelative = true);
//! Redirect the request to #SVTK_Renderer::AdjustActors
void
myTransform(VTKViewer_Transform::New()),
myCubeAxes(SVTK_CubeAxesActor2D::New()),
myTrihedron(SVTK_Trihedron::New()),
- myTrihedronSize(105)
+ myTrihedronSize(105),
+ myIsTrihedronRelative(true)
{
myDevice->Delete();
myTransform->Delete();
// if the new trihedron size have sufficient difference, then apply the value
double aSize = myTrihedron->GetSize();
- ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
- myTrihedron->SetSize(aSize);
+ if ( IsTrihedronRelative() )
+ {
+ ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
+ myTrihedron->SetSize(aSize);
+ }
+ else
+ myTrihedron->SetSize( myTrihedronSize );
// iterate through displayed objects and set size if necessary
vtkActorCollection* anActors = GetDevice()->GetActors();
void
SVTK_Renderer
-::SetTrihedronSize(int theSize)
+::SetTrihedronSize(int theSize, const bool theRelative)
{
- if(myTrihedronSize != theSize){
+ if(myTrihedronSize != theSize || myIsTrihedronRelative != theRelative){
myTrihedronSize = theSize;
+ myIsTrihedronRelative = theRelative;
AdjustActors();
}
}
return myTrihedronSize;
}
+bool
+SVTK_Renderer
+::IsTrihedronRelative() const
+{
+ return myIsTrihedronRelative;
+}
//----------------------------------------------------------------------------
VTKViewer_Trihedron*
//! Set size of the trihedron in percents from bounding box of the scene
void
- SetTrihedronSize(int theSize);
+ SetTrihedronSize(int theSize, const bool theRelative = true);
//! Get size of the trihedron in percents from bounding box of the scene
int
GetTrihedronSize() const;
+ //! Shows if the size of the trihedron is relative
+ bool
+ IsTrihedronRelative() const;
+
//----------------------------------------------------------------------------
//! Get trihedron control
VTKViewer_Trihedron*
//----------------------------------------------------------------------------
vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;
- int myTrihedronSize;
+ int myTrihedronSize;
+ bool myIsTrihedronRelative;
float myBndBox[6];
};
SVTK_Viewer::SVTK_Viewer()
{
myTrihedronSize = 105;
+ myTrihedronRelative = true;
}
//==========================================================
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
- aView->getMainWindow()->SetBackgroundColor(theColor);
+ aView->setBackgroundColor(theColor);
}
}
}
}
//==========================================================
-SUIT_ViewWindow*
+SUIT_ViewWindow*
SVTK_Viewer::
createView( SUIT_Desktop* theDesktop )
{
- SVTK_ViewWindow* aViewWindow = new SVTK_ViewWindow(theDesktop);
+ TViewWindow* aViewWindow = new TViewWindow(theDesktop);
aViewWindow->Initialize(this);
-
+
aViewWindow->setBackgroundColor( backgroundColor() );
- aViewWindow->SetTrihedronSize( trihedronSize() );
+ aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
return aViewWindow;
}
return myTrihedronSize;
}
-void SVTK_Viewer::setTrihedronSize( const int sz )
+bool SVTK_Viewer::trihedronRelative() const
{
- myTrihedronSize = sz;
-
- SUIT_ViewManager* vm = getViewManager();
- if ( !vm )
- return;
-
- QPtrVector<SUIT_ViewWindow> vec = vm->getViews();
- for ( int i = 0; i < vec.count(); i++ )
- {
- SUIT_ViewWindow* win = vec.at( i );
- if ( !win || !win->inherits( "SVTK_ViewWindow" ) )
- continue;
+ return myTrihedronRelative;
+}
- SVTK_ViewWindow* vw = (SVTK_ViewWindow*)win;
- vw->SetTrihedronSize( sz );
+void SVTK_Viewer::setTrihedronSize( const int theSize, const bool theRelative )
+{
+ myTrihedronSize = theSize;
+ myTrihedronRelative = theRelative;
+
+ if (SUIT_ViewManager* aViewManager = getViewManager()) {
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for (int i = 0; i < aViews.count(); i++) {
+ if (TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))) {
+ aView->SetTrihedronSize(theSize, theRelative);
+ }
+ }
}
}
thePopup->insertSeparator();
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
- if ( !aView->getView()->GetMainWindow()->getToolBar()->isVisible() ){
+ if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
}
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
- aView->getView()->GetMainWindow()->getToolBar()->show();
+ aView->getMainWindow()->getToolBar()->show();
}
}
}
{
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
- if(SVTK_View* aView = aViewWindow->getView())
- if(!aView->isVisible( io ))
- return false;
+ if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+ if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow))
+ if(SVTK_View* aView = aViewWnd->getView())
+ if(!aView->isVisible( io ))
+ return false;
return true;
}
// if (theUpdateTrihedron) onAdjustTrihedron();
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+ if(TViewWindow* aViewWindow = dynamic_cast<TViewWindow*>(aViews.at(i)))
if(SVTK_View* aView = aViewWindow->getView())
aView->Repaint();
}
//! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
int trihedronSize() const;
+ //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
+ bool trihedronRelative() const;
+
//! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
- void setTrihedronSize( const int );
+ void setTrihedronSize( const int, const bool = true );
public:
void enableSelection(bool isEnabled);
private:
QColor myBgColor;
int myTrihedronSize;
+ bool myTrihedronRelative;
bool mySelectionEnabled;
bool myMultiSelectionEnabled;
};
#include "SUIT_Accel.h"
#include "VTKViewer_Utilities.h"
-#include "VTKViewer_Transform.h"
#include "SVTK_View.h"
#include "SVTK_MainWindow.h"
void
SVTK_ViewWindow
-::SetTrihedronSize(const int theSize)
+::SetTrihedronSize(const int theSize, const bool theRelative)
{
- myMainWindow->SetTrihedronSize(theSize);
+ myMainWindow->SetTrihedronSize(theSize, theRelative);
}
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
virtual
void
- SetTrihedronSize( const int );
+ SetTrihedronSize( const int, const bool = true );
//! Redirect the request to #SVTK_Renderer::SetSelectionProp
virtual
res = isAscii ?
SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile ) &&
- CAM_Study::saveDocumentAs( theFileName ) && saveStudyData(theFileName);
+ CAM_Study::saveDocumentAs( theFileName ) && //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
+ saveStudyData(theFileName);
if ( res )
emit saved( this );
<parameter value="false" name="auto_groups" />
</section>
<section name="VISU" >
+ <parameter value="false" name="use_build_progress" />
<parameter value="false" name="full_med_loading" />
<parameter value="false" name="represent_shading" />
<parameter value="0.05" name="scalar_bar_horizontal_height" />
#include "VTKViewer_AppendFilter.h"
-#include "VTKViewer_ConvexTool.h"
-
-#include <vtkSmartPointer.h>
-#include <vtkCellArray.h>
+#include <vtkCell.h>
#include <vtkCellData.h>
-#include <vtkGenericCell.h>
-#include <vtkHexahedron.h>
-#include <vtkMergePoints.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
-#include <vtkPolyData.h>
-#include <vtkPyramid.h>
-#include <vtkStructuredGrid.h>
-#include <vtkTetra.h>
-#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkVoxel.h>
-#include <vtkWedge.h>
-#include <vtkDataSetCollection.h>
-
-#include <vector>
-#include <map>
-using namespace std;
-
-#ifdef _DEBUG_
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#else
-//static int MYDEBUG = 0;
-//static int MYDEBUGWITHFILES = 0;
-#endif
+#include <vtkPoints.h>
#if defined __GNUC__
#if __GNUC__ == 2
VTKViewer_AppendFilter
::VTKViewer_AppendFilter()
{
- myDoMappingFlag=false;
+ myDoMappingFlag = false;
}
VTKViewer_AppendFilter
VTKViewer_AppendFilter
::SetDoMappingFlag(const bool theFlag)
{
- myDoMappingFlag=theFlag;
+ if(myDoMappingFlag == theFlag)
+ return;
+
+ myDoMappingFlag = theFlag;
+
+ this->Modified();
}
bool
VTKViewer_AppendFilter
::SetPoints(vtkPoints* thePoints)
{
+ if(GetPoints() == thePoints)
+ return;
+
myPoints = thePoints;
+
+ this->Modified();
}
vtkPoints*
VTKViewer_AppendFilter
::Execute()
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
MakeOutput();
- }
- else {
- vtkAppendFilter::Execute();
- }
- if (myDoMappingFlag){
+ else
+ Superclass::Execute();
+
+ if(myDoMappingFlag)
DoMapping();
- }
}
-void
-VTKViewer_AppendFilter
-::Reset()
-{
- myNodeIds.clear();
- myCellIds.clear();
- myNodeRanges.clear();
- myCellRanges.clear();
- myNodeMapObjIDVtkID.clear();
- myCellMapObjIDVtkID.clear();
-}
+
//==================================================================
// function: DoMapping
// purpose :
VTKViewer_AppendFilter
::DoMapping()
{
- int i, j, i1, i2, iNodeCnt, iCellCnt;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- vtkIdType aNbPnts, aNbCells, aId;
- vtkDataSet *pDS;
- //
- Reset();
- //
- iNodeCnt=0;
- iCellCnt=0;
- for (i=0; i<NumberOfInputs; ++i) {
- pDS=(vtkDataSet *)Inputs[i];
- //
- // Nodes
- if (!myPoints.GetPointer()) {
- aNbPnts=pDS->GetNumberOfPoints();
- i1=myNodeIds.size();
- i2=i1+aNbPnts-1;
- myNodeRanges.push_back(i1);
- myNodeRanges.push_back(i2);
- //
- for(j=0; j<aNbPnts; ++j) {
- aId=(vtkIdType)j;
- myNodeIds.push_back(aId);
- //
- aMapIt=myNodeMapObjIDVtkID.find(aId);
- if (aMapIt==myNodeMapObjIDVtkID.end()) {
- // if not found
- myNodeMapObjIDVtkID[aId]=iNodeCnt;
- }
- ++iNodeCnt;
- }
- }
- //
- // Cells
- aNbCells=pDS->GetNumberOfCells();
- i1=myCellIds.size();
- i2=i1+aNbCells-1;
- myCellRanges.push_back(i1);
- myCellRanges.push_back(i2);
- for(j=0; j<aNbCells; ++j) {
- aId=(vtkIdType)j;
- myCellIds.push_back(aId);
- //
- aMapIt=myCellMapObjIDVtkID.find(aId);
- if (aMapIt==myCellMapObjIDVtkID.end()) {
- // if not found
- myCellMapObjIDVtkID[aId]=iCellCnt;
- }
- ++iCellCnt;
+ myNodeRanges.clear();
+ myCellRanges.clear();
+
+ vtkIdType aPntStartId = 0;
+ vtkIdType aCellStartId = 0;
+
+ for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){
+ vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]);
+ // Do mapping of the nodes
+ if(!myPoints.GetPointer()){
+ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+ myNodeRanges.push_back(aPntStartId + aNbPnts);
+ aPntStartId += aNbPnts;
}
+ // Do mapping of the cells
+ vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+ myCellRanges.push_back(aCellStartId + aNbCells);
+ aCellStartId += aNbCells;
}
}
//---------------------------------------------------------------
+namespace
+{
+ inline
+ vtkIdType
+ GetOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theInputDataSetID = -1;
+
+ vtkIdType aNbInputs = theRanges.size();
+ if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+ return -1;
+
+ vtkIdType aStartId = theRanges[theInputDataSetID];
+ return aStartId + theInputID;
+ }
+}
+
vtkIdType
VTKViewer_AppendFilter
-::GetPointOutputID(vtkIdType theInputID)
+::GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- if (myPoints.GetPointer()) {
+ if(myPoints.GetPointer())
return theInputID;
- }
- //
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myNodeMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myNodeMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
}
//---------------------------------------------------------------
vtkIdType
VTKViewer_AppendFilter
-::GetCellOutputID(vtkIdType theInputID)
+::GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
{
- int aVtkID=-1;
- IteratorOfDataMapOfIntegerInteger aMapIt;
- //
- aMapIt=myCellMapObjIDVtkID.find(theInputID);
- if (aMapIt!=myCellMapObjIDVtkID.end()) {
- // found
- PairOfDataMapOfIntegerInteger& aPair=(*aMapIt);
- aVtkID=aPair.second;
- }
- return aVtkID;
+ if(myPoints.GetPointer())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
}
//---------------------------------------------------------------
-vtkIdType
+namespace
+{
+ void
+ GetInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theStartID = theInputDataSetID = -1;
+
+ if(theRanges.empty())
+ return;
+
+ const vtkIdType& aRangeEnd = theRanges.back();
+ if(theOutputID < 0 || theOutputID >= aRangeEnd)
+ return;
+
+ vtkIdType aStartId = 0;
+ vtkIdType aNbInputs = theRanges.size();
+ for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+ vtkIdType aRange = theRanges[aDataSetId];
+ if(aRange > theOutputID){
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
+ }
+ aStartId = aRange;
+ }
+ }
+}
+
+void
VTKViewer_AppendFilter
-::GetPointInputID(vtkIdType theOutputID,
+::GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- if (myPoints.GetPointer()) {
- theInputDataSetID=0;
- return theOutputID;
- }
- //
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myNodeIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myNodeIds[theOutputID];
- //
- aNbRanges=myNodeRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myNodeRanges[j];
- i2=myNodeRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
+ if(myPoints.GetPointer()) {
+ theStartID = theInputDataSetID = 0;
+ theInputID = theOutputID;
+ return;
}
- //
- return aRetID;
+
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
}
//---------------------------------------------------------------
-vtkIdType
+void
VTKViewer_AppendFilter
-::GetCellInputID(vtkIdType theOutputID,
+::GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID)
{
- int aNb, aNbRanges, aRetID, i, i1, i2, j;
- //
- aRetID=-1;
- theInputDataSetID=-1;
- //
- aNb=myCellIds.size();
- if (theOutputID<0 || theOutputID>=aNb) {
- return aRetID;
- }
- //
- aRetID=(int)myCellIds[theOutputID];
- //
- aNbRanges=myCellRanges.size()/2;
- for (i=0; i<aNbRanges; ++i) {
- j=2*i;
- i1=myCellRanges[j];
- i2=myCellRanges[j+1];
- if (theOutputID>=i1 && theOutputID<=i2) {
- theInputDataSetID=i;
- }
- }
- //
- return aRetID;
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
}
GetPoints();
vtkIdType
- GetPointOutputID(vtkIdType theInputID);
+ GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
vtkIdType
- GetCellOutputID(vtkIdType theInputID);
+ GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
- vtkIdType
- GetPointInputID(vtkIdType theOutputID,
- vtkIdType& theInputDataSetID);
+ void
+ GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
- vtkIdType
- GetCellInputID(vtkIdType theOutputID,
+ void
+ GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
vtkIdType& theInputDataSetID);
+ typedef std::vector<vtkIdType> TVectorIds;
+
protected:
/*! \fn VTKViewer_AppendFilter();
* \brief Constructor
void MakeOutput();
- //
+ bool myDoMappingFlag;
+ TVectorIds myNodeRanges;
+ TVectorIds myCellRanges;
vtkSmartPointer<vtkPoints> myPoints;
-
-private:
- typedef std::vector<vtkIdType> TVectorId;
- typedef std::vector<int> VectorInt;
- typedef std::map <int,int> DataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::iterator IteratorOfDataMapOfIntegerInteger;
- typedef DataMapOfIntegerInteger::value_type PairOfDataMapOfIntegerInteger;
-private:
- bool myDoMappingFlag;
- TVectorId myNodeIds;
- TVectorId myCellIds;
- VectorInt myNodeRanges;
- VectorInt myCellRanges;
- DataMapOfIntegerInteger myNodeMapObjIDVtkID;
- DataMapOfIntegerInteger myCellMapObjIDVtkID;
};
#endif