mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-30 19:30:35 +05:00
PAL11054 - crash if user enters "-8" as density function with exponent conversion
PAL11055 - it is impossible to enter negative function value in case, when exponent conversion is applied some remarks from PAL8238
This commit is contained in:
parent
584d5262ff
commit
f1dec40ab1
@ -19,8 +19,8 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::
|
|||||||
{
|
{
|
||||||
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
|
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
|
||||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||||
myCurve1 = insertCurve( QString() );
|
myDensity = insertCurve( QString() );
|
||||||
myCurve2 = insertCurve( QString() );
|
myDistr = insertCurve( QString() );
|
||||||
myMsg = insertMarker( new QwtPlotMarker( this ) );
|
myMsg = insertMarker( new QwtPlotMarker( this ) );
|
||||||
setMarkerPos( myMsg, 0.5, 0.5 );
|
setMarkerPos( myMsg, 0.5, 0.5 );
|
||||||
setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) );
|
setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) );
|
||||||
@ -28,11 +28,16 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::
|
|||||||
f.setPointSize( 14 );
|
f.setPointSize( 14 );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
setMarkerFont( myMsg, f );
|
setMarkerFont( myMsg, f );
|
||||||
setCurvePen( myCurve1, QPen( Qt::red, 1 ) );
|
setCurvePen( myDensity, QPen( Qt::red, 1 ) );
|
||||||
|
|
||||||
QColor dc = Qt::blue;
|
QColor dc = Qt::blue;
|
||||||
setCurvePen( myCurve2, QPen( dc, 1 ) );
|
setCurvePen( myDistr, QPen( dc, 1 ) );
|
||||||
setCurveSymbol( myCurve2, QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) );
|
setCurveSymbol( myDistr, QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) );
|
||||||
|
setAutoLegend( true );
|
||||||
|
enableLegend( true );
|
||||||
|
setLegendPos( Qwt::Bottom );
|
||||||
|
setCurveTitle( myDensity, tr( "SMESH_DENSITY_FUNC" ) );
|
||||||
|
setCurveTitle( myDistr, tr( "SMESH_DISTR" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
StdMeshersGUI_DistrPreview::~StdMeshersGUI_DistrPreview()
|
StdMeshersGUI_DistrPreview::~StdMeshersGUI_DistrPreview()
|
||||||
@ -196,9 +201,9 @@ void StdMeshersGUI_DistrPreview::update()
|
|||||||
max_x = x[i];
|
max_x = x[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
setAxisScale( curveXAxis( myCurve1 ), min_x, max_x );
|
setAxisScale( curveXAxis( myDensity ), min_x, max_x );
|
||||||
setAxisScale( curveYAxis( myCurve1 ), min( 0.0, min_y ), max( 0.0, max_y ) );
|
setAxisScale( curveYAxis( myDensity ), min( 0.0, min_y ), max( 0.0, max_y ) );
|
||||||
setCurveData( myCurve1, x, y, size );
|
setCurveData( myDensity, x, y, size );
|
||||||
if( x )
|
if( x )
|
||||||
delete[] x;
|
delete[] x;
|
||||||
if( y )
|
if( y )
|
||||||
@ -213,19 +218,33 @@ void StdMeshersGUI_DistrPreview::update()
|
|||||||
x[i] = distr[i];
|
x[i] = distr[i];
|
||||||
y[i] = 0;
|
y[i] = 0;
|
||||||
}
|
}
|
||||||
setCurveData( myCurve2, x, y, size );
|
setCurveData( myDistr, x, y, size );
|
||||||
delete[] x;
|
delete[] x;
|
||||||
delete[] y;
|
delete[] y;
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
replot();
|
|
||||||
|
OSD::SetSignal( true );
|
||||||
|
CASCatch_CatchSignals aCatchSignals;
|
||||||
|
aCatchSignals.Activate();
|
||||||
|
|
||||||
|
CASCatch_TRY
|
||||||
|
{
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
CASCatch_CATCH(CASCatch_Failure)
|
||||||
|
{
|
||||||
|
aCatchSignals.Deactivate();
|
||||||
|
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||||
|
}
|
||||||
|
aCatchSignals.Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdMeshersGUI_DistrPreview::showError()
|
void StdMeshersGUI_DistrPreview::showError()
|
||||||
{
|
{
|
||||||
setAxisScale( curveXAxis( myCurve1 ), 0.0, 1.0 );
|
setAxisScale( curveXAxis( myDensity ), 0.0, 1.0 );
|
||||||
setAxisScale( curveYAxis( myCurve1 ), 0.0, 1.0 );
|
setAxisScale( curveYAxis( myDensity ), 0.0, 1.0 );
|
||||||
setCurveData( myCurve1, 0, 0, 0 );
|
setCurveData( myDensity, 0, 0, 0 );
|
||||||
setCurveData( myCurve2, 0, 0, 0 );
|
setCurveData( myDistr, 0, 0, 0 );
|
||||||
setMarkerLabel( myMsg, tr( "SMESH_INVALID_FUNCTION" ) );
|
setMarkerLabel( myMsg, tr( "SMESH_INVALID_FUNCTION" ) );
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
bool myIsTable;
|
bool myIsTable;
|
||||||
Conversion myConv;
|
Conversion myConv;
|
||||||
SMESH::double_array myTableFunc;
|
SMESH::double_array myTableFunc;
|
||||||
long myCurve1, myCurve2, myMsg;
|
long myDensity, myDistr, myMsg;
|
||||||
Handle(ExprIntrp_GenExp) myExpr;
|
Handle(ExprIntrp_GenExp) myExpr;
|
||||||
Expr_Array1OfNamedUnknown myVars;
|
Expr_Array1OfNamedUnknown myVars;
|
||||||
TColStd_Array1OfReal myValues;
|
TColStd_Array1OfReal myValues;
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#include "StdMeshersGUI_DistrTable.h"
|
#include "StdMeshersGUI_DistrTable.h"
|
||||||
|
#include <QtxDblValidator.h>
|
||||||
|
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qvalidator.h>
|
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -40,8 +41,8 @@ StdMeshersGUI_DistrTable::StdMeshersGUI_DistrTable( const int rows, QWidget* par
|
|||||||
{
|
{
|
||||||
horizontalHeader()->setLabel( 0, "t" );
|
horizontalHeader()->setLabel( 0, "t" );
|
||||||
horizontalHeader()->setLabel( 1, "f(t)" );
|
horizontalHeader()->setLabel( 1, "f(t)" );
|
||||||
myArgV = new QDoubleValidator( 0.0, 1.0, 3, this );
|
myArgV = new QtxDblValidator( 0.0, 1.0, 3, this );
|
||||||
myFuncV = new QDoubleValidator( 0.0, 1E10, 3, this );
|
myFuncV = new QtxDblValidator( 0.0, 1E20, 3, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable()
|
StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable()
|
||||||
@ -265,8 +266,24 @@ void StdMeshersGUI_DistrTable::setData( const SMESH::double_array& d )
|
|||||||
{
|
{
|
||||||
stopEditing( false );
|
stopEditing( false );
|
||||||
setNumRows( d.length()/2 );
|
setNumRows( d.length()/2 );
|
||||||
|
QString val;
|
||||||
for( int i=0; i<d.length(); i++ )
|
for( int i=0; i<d.length(); i++ )
|
||||||
setText( i/2, i%2, QString( "%1" ).arg( d[i] ) );
|
{
|
||||||
|
QtxDblValidator* v = i%2==0 ? myArgV : myFuncV;
|
||||||
|
val = QString::number( d[i] );
|
||||||
|
v->fixup( val );
|
||||||
|
setText( i/2, i%2, val );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtxDblValidator* StdMeshersGUI_DistrTable::argValidator() const
|
||||||
|
{
|
||||||
|
return myArgV;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtxDblValidator* StdMeshersGUI_DistrTable::funcValidator() const
|
||||||
|
{
|
||||||
|
return myFuncV;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -346,3 +363,4 @@ void StdMeshersGUI_DistrTableFrame::onButtonClicked()
|
|||||||
else if( sender()==button( REMOVE_ROW ) )
|
else if( sender()==button( REMOVE_ROW ) )
|
||||||
emit toEdit( REMOVE_ROW, table()->currentRow() );
|
emit toEdit( REMOVE_ROW, table()->currentRow() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
class QButton;
|
class QButton;
|
||||||
class QDoubleValidator;
|
class QtxDblValidator;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Values corresponding to buttons for table resize
|
* \brief Values corresponding to buttons for table resize
|
||||||
@ -65,6 +65,9 @@ public:
|
|||||||
void data( SMESH::double_array& );
|
void data( SMESH::double_array& );
|
||||||
void setData( const SMESH::double_array& );
|
void setData( const SMESH::double_array& );
|
||||||
|
|
||||||
|
QtxDblValidator* argValidator() const;
|
||||||
|
QtxDblValidator* funcValidator() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QWidget* createEditor( int, int, bool ) const;
|
virtual QWidget* createEditor( int, int, bool ) const;
|
||||||
virtual bool eventFilter( QObject*, QEvent* );
|
virtual bool eventFilter( QObject*, QEvent* );
|
||||||
@ -75,7 +78,7 @@ private slots:
|
|||||||
void onEdit( TableButton, int );
|
void onEdit( TableButton, int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDoubleValidator *myArgV, *myFuncV;
|
QtxDblValidator *myArgV, *myFuncV;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -122,6 +125,5 @@ private:
|
|||||||
StdMeshersGUI_DistrTable *myTable;
|
StdMeshersGUI_DistrTable *myTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <QtxIntSpinBox.h>
|
#include <QtxIntSpinBox.h>
|
||||||
#include <QtxComboBox.h>
|
#include <QtxComboBox.h>
|
||||||
|
#include <QtxDblValidator.h>
|
||||||
#include <SMESHGUI_SpinBox.h>
|
#include <SMESHGUI_SpinBox.h>
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
@ -142,7 +143,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
|||||||
myConv->setColumnLayout( 0, Qt::Vertical );
|
myConv->setColumnLayout( 0, Qt::Vertical );
|
||||||
QGridLayout* convLay = new QGridLayout( myConv->layout() );
|
QGridLayout* convLay = new QGridLayout( myConv->layout() );
|
||||||
convLay->addWidget( new QRadioButton( tr( "SMESH_EXP_MODE" ), myConv ), 0, 0 );
|
convLay->addWidget( new QRadioButton( tr( "SMESH_EXP_MODE" ), myConv ), 0, 0 );
|
||||||
convLay->addWidget( new QRadioButton( tr( "SMESH_CUT_NEG_MODE" ), myConv ), 1, 0 );
|
convLay->addWidget( myCutNeg = new QRadioButton( tr( "SMESH_CUT_NEG_MODE" ), myConv ), 1, 0 );
|
||||||
myGroupLayout->addWidget( myConv, row, 1 );
|
myGroupLayout->addWidget( myConv, row, 1 );
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
@ -312,6 +313,19 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
|
|||||||
{
|
{
|
||||||
int distr = myDistr->currentItem();
|
int distr = myDistr->currentItem();
|
||||||
|
|
||||||
|
/* if( distr==2 ) //table func
|
||||||
|
myCutNeg->setText( tr( "SMESH_NO_CONV" ) );
|
||||||
|
else if( distr==3 )
|
||||||
|
myCutNeg->setText( tr( "SMESH_CUT_NEG_MODE" ) );*/
|
||||||
|
|
||||||
|
if( distr==2 ) //table func
|
||||||
|
{
|
||||||
|
myTable->table()->funcValidator()->setBottom( myConv->id( myConv->selected() )==0 ? -1E20 : 0 );
|
||||||
|
SMESH::double_array arr;
|
||||||
|
myTable->table()->data( arr );
|
||||||
|
myTable->table()->setData( arr ); //update data in table
|
||||||
|
}
|
||||||
|
|
||||||
myScale->setShown( distr==1 );
|
myScale->setShown( distr==1 );
|
||||||
myLScale->setShown( distr==1 );
|
myLScale->setShown( distr==1 );
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ class StdMeshersGUI_DistrPreview;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
class QRadioButton;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ private:
|
|||||||
QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo;
|
QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo;
|
||||||
QGridLayout* myGroupLayout;
|
QGridLayout* myGroupLayout;
|
||||||
int myTableRow, myPreviewRow;
|
int myTableRow, myPreviewRow;
|
||||||
|
QRadioButton* myCutNeg;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +47,12 @@ msgstr "Distribution with analitic density"
|
|||||||
msgid "SMESH_NB_SEGMENTS_SCALE_PARAM"
|
msgid "SMESH_NB_SEGMENTS_SCALE_PARAM"
|
||||||
msgstr "Scale Factor"
|
msgstr "Scale Factor"
|
||||||
|
|
||||||
|
msgid "SMESH_DENSITY_FUNC"
|
||||||
|
msgstr "Density function"
|
||||||
|
|
||||||
|
msgid "SMESH_DISTR"
|
||||||
|
msgstr "Distribution"
|
||||||
|
|
||||||
msgid "SMESH_TAB_FUNC"
|
msgid "SMESH_TAB_FUNC"
|
||||||
msgstr "Table function"
|
msgstr "Table function"
|
||||||
|
|
||||||
@ -65,6 +71,9 @@ msgstr "Exponent"
|
|||||||
msgid "SMESH_CUT_NEG_MODE"
|
msgid "SMESH_CUT_NEG_MODE"
|
||||||
msgstr "Cut negative"
|
msgstr "Cut negative"
|
||||||
|
|
||||||
|
msgid "SMESH_NO_CONV"
|
||||||
|
msgstr "No conversion"
|
||||||
|
|
||||||
msgid "SMESH_INSERT_ROW"
|
msgid "SMESH_INSERT_ROW"
|
||||||
msgstr "Insert row"
|
msgstr "Insert row"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user