Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0020832: EDF 1359 SMESH : Automatic meshing of boundary layers
[modules/smesh.git]
/
src
/
StdMeshersGUI
/
StdMeshersGUI_FixedPointsParamWdg.cxx
diff --git
a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx
b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx
index 0069a7b4e223032f32d8add8233adfff85d74c0f..8b503af3d975fcbc51f2a51d93a1075366429831 100644
(file)
--- a/
src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx
+++ b/
src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx
@@
-1,7
+1,4
@@
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2007-2010 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-19,14
+16,16
@@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : StdMeshersGUI_FixedPointsParamWdg.cxx
// Author : Open CASCADE S.A.S.
// SMESH includes
//
#include "StdMeshersGUI_FixedPointsParamWdg.h"
// File : StdMeshersGUI_FixedPointsParamWdg.cxx
// Author : Open CASCADE S.A.S.
// SMESH includes
//
#include "StdMeshersGUI_FixedPointsParamWdg.h"
-#include <QtxIntSpinBox.h>
-#include <QtxDoubleSpinBox.h>
+#include <SMESHGUI_SpinBox.h>
+
+#include <SalomeApp_IntSpinBox.h>
// Qt includes
#include <QPushButton>
// Qt includes
#include <QPushButton>
@@
-48,6
+47,8
@@
#define TOLERANCE 1e-7
#define EQUAL_DBL(a,b) (fabs(a-b)<TOLERANCE)
#define TOLERANCE 1e-7
#define EQUAL_DBL(a,b) (fabs(a-b)<TOLERANCE)
+#define LT_DBL(a,b) ((a<b)&&!EQUAL_DBL(a,b))
+#define GT_DBL(a,b) ((a>b)&&!EQUAL_DBL(a,b))
/*
* class : Tree Widget Item Delegate
/*
* class : Tree Widget Item Delegate
@@
-74,12
+75,13
@@
StdMeshersGUI_FixedPointsParamWdg::LineDelegate::LineDelegate( QTreeWidget* pare
}
QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* parent,
}
QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* parent,
- const QStyleOptionViewItem& option,
- const QModelIndex& index ) const
+
const QStyleOptionViewItem& option,
+
const QModelIndex& index ) const
{
QWidget* w = 0;
if ( (index.column() == 1 ) ) {
{
QWidget* w = 0;
if ( (index.column() == 1 ) ) {
- QtxIntSpinBox* sb = new QtxIntSpinBox( parent );
+ SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( parent );
+ sb->setAcceptNames( false ); // No Notebook variables allowed
sb->setFrame( false );
sb->setRange( 1, 999);
w = sb;
sb->setFrame( false );
sb->setRange( 1, 999);
w = sb;
@@
-89,11
+91,11
@@
QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget*
}
void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* editor,
}
void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* editor,
- QAbstractItemModel* model,
- const QModelIndex& index ) const
+
QAbstractItemModel* model,
+
const QModelIndex& index ) const
{
{
- model->setData( index, qobject_cast<
Qtx
IntSpinBox*>( editor )->value(), Qt::EditRole );
- model->setData( index, qobject_cast<
Qtx
IntSpinBox*>( editor )->value(), Qt::UserRole );
+ model->setData( index, qobject_cast<
SalomeApp_
IntSpinBox*>( editor )->value(), Qt::EditRole );
+ model->setData( index, qobject_cast<
SalomeApp_
IntSpinBox*>( editor )->value(), Qt::UserRole );
}
//================================================================================
}
//================================================================================
@@
-112,7
+114,7
@@
StdMeshersGUI_FixedPointsParamWdg
myListWidget = new QListWidget( this );
myTreeWidget = new QTreeWidget( this );
myListWidget = new QListWidget( this );
myTreeWidget = new QTreeWidget( this );
- mySpinBox = new
QtxDouble
SpinBox( this );
+ mySpinBox = new
SMESHGUI_
SpinBox( this );
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this);
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this);
@@
-139,10
+141,8
@@
StdMeshersGUI_FixedPointsParamWdg
myListWidget->setMinimumWidth( 80 );
myTreeWidget->setMinimumWidth( 200 );
myListWidget->setMinimumWidth( 80 );
myTreeWidget->setMinimumWidth( 200 );
- mySpinBox->setRange( 0, 1 );
- mySpinBox->setSingleStep( 0.1 );
- mySpinBox->setDecimals( 4 );
- mySpinBox->setPrecision( 4 );
+ mySpinBox->setAcceptNames( false ); // No Notebook variables allowed
+ mySpinBox->RangeStepAndValidator( 0., 1., .1, "parametric_precision" );
myListWidget->setMinimumWidth( 70 );
connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) );
myListWidget->setMinimumWidth( 70 );
connect( myAddButton, SIGNAL( clicked() ), SLOT( onAdd() ) );
@@
-203,7
+203,7
@@
void StdMeshersGUI_FixedPointsParamWdg::onAdd()
{
addPoint( mySpinBox->value() );
}
{
addPoint( mySpinBox->value() );
}
-
+
//=================================================================================
// function : onRemove()
// purpose : Called when Remove Button Clicked
//=================================================================================
// function : onRemove()
// purpose : Called when Remove Button Clicked
@@
-255,14
+255,14
@@
QString StdMeshersGUI_FixedPointsParamWdg::treeItemText( double v1, double v2 )
//=================================================================================
void StdMeshersGUI_FixedPointsParamWdg::addPoint( double v)
{
//=================================================================================
void StdMeshersGUI_FixedPointsParamWdg::addPoint( double v)
{
- if (
v > 0 && v < 1
) {
+ if (
GT_DBL(v, 0.0) && LT_DBL(v, 1.0)
) {
bool toInsert = true;
int idx = myTreeWidget->topLevelItemCount()-1;
for ( int i = 0 ; i < myListWidget->count(); i++ ) {
double lv = point( i );
bool toInsert = true;
int idx = myTreeWidget->topLevelItemCount()-1;
for ( int i = 0 ; i < myListWidget->count(); i++ ) {
double lv = point( i );
- if ( EQUAL_DBL(lv,v) ) { toInsert = false; break; }
- else if (
lv > v
) {
- idx = i; break;
+ if ( EQUAL_DBL(lv,
v) ) { toInsert = false; break; }
+ else if (
GT_DBL(lv, v)
) {
+
idx = i; break;
}
}
if ( toInsert ) {
}
}
if ( toInsert ) {
@@
-290,7
+290,7
@@
void StdMeshersGUI_FixedPointsParamWdg::removePoints()
delete myTreeWidget->topLevelItem( idx );
delete item;
myTreeWidget->topLevelItem( idx )->setText( 0, treeItemText( idx == 0 ? 0 : point( idx-1 ),
delete myTreeWidget->topLevelItem( idx );
delete item;
myTreeWidget->topLevelItem( idx )->setText( 0, treeItemText( idx == 0 ? 0 : point( idx-1 ),
- idx > myListWidget->count()-1 ? 1 : point( idx ) ) );
+
idx > myListWidget->count()-1 ? 1 : point( idx ) ) );
}
onCheckBoxChanged();
updateState();
}
onCheckBoxChanged();
updateState();
@@
-333,7
+333,8
@@
void StdMeshersGUI_FixedPointsParamWdg::onCheckBoxChanged()
//=================================================================================
void StdMeshersGUI_FixedPointsParamWdg::updateState()
{
//=================================================================================
void StdMeshersGUI_FixedPointsParamWdg::updateState()
{
- myAddButton->setEnabled( mySpinBox->value() > 0 && mySpinBox->value() < 1 );
+ double v = mySpinBox->value();
+ myAddButton->setEnabled( GT_DBL(v, 0.0) && LT_DBL(v, 1.0) );
myRemoveButton->setEnabled( myListWidget->selectedItems().count() > 0 );
}
myRemoveButton->setEnabled( myListWidget->selectedItems().count() > 0 );
}