PAL11055 - it is impossible to enter negative function value in case, when exponent conversion is applied
some remarks from PAL8238
{
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
- myCurve1 = insertCurve( QString() );
- myCurve2 = insertCurve( QString() );
+ myDensity = insertCurve( QString() );
+ myDistr = insertCurve( QString() );
myMsg = insertMarker( new QwtPlotMarker( this ) );
setMarkerPos( myMsg, 0.5, 0.5 );
setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) );
f.setPointSize( 14 );
f.setBold( true );
setMarkerFont( myMsg, f );
- setCurvePen( myCurve1, QPen( Qt::red, 1 ) );
+ setCurvePen( myDensity, QPen( Qt::red, 1 ) );
QColor dc = Qt::blue;
- setCurvePen( myCurve2, QPen( dc, 1 ) );
- setCurveSymbol( myCurve2, QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) );
+ setCurvePen( myDistr, QPen( dc, 1 ) );
+ 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()
max_x = x[i];
}
- setAxisScale( curveXAxis( myCurve1 ), min_x, max_x );
- setAxisScale( curveYAxis( myCurve1 ), min( 0.0, min_y ), max( 0.0, max_y ) );
- setCurveData( myCurve1, x, y, size );
+ setAxisScale( curveXAxis( myDensity ), min_x, max_x );
+ setAxisScale( curveYAxis( myDensity ), min( 0.0, min_y ), max( 0.0, max_y ) );
+ setCurveData( myDensity, x, y, size );
if( x )
delete[] x;
if( y )
x[i] = distr[i];
y[i] = 0;
}
- setCurveData( myCurve2, x, y, size );
+ setCurveData( myDistr, x, y, size );
delete[] x;
delete[] y;
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()
{
- setAxisScale( curveXAxis( myCurve1 ), 0.0, 1.0 );
- setAxisScale( curveYAxis( myCurve1 ), 0.0, 1.0 );
- setCurveData( myCurve1, 0, 0, 0 );
- setCurveData( myCurve2, 0, 0, 0 );
+ setAxisScale( curveXAxis( myDensity ), 0.0, 1.0 );
+ setAxisScale( curveYAxis( myDensity ), 0.0, 1.0 );
+ setCurveData( myDensity, 0, 0, 0 );
+ setCurveData( myDistr, 0, 0, 0 );
setMarkerLabel( myMsg, tr( "SMESH_INVALID_FUNCTION" ) );
replot();
}
bool myIsTable;
Conversion myConv;
SMESH::double_array myTableFunc;
- long myCurve1, myCurve2, myMsg;
+ long myDensity, myDistr, myMsg;
Handle(ExprIntrp_GenExp) myExpr;
Expr_Array1OfNamedUnknown myVars;
TColStd_Array1OfReal myValues;
// $Header$
#include "StdMeshersGUI_DistrTable.h"
+#include <QtxDblValidator.h>
+
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qvalidator.h>
#include <qlineedit.h>
//=================================================================================
{
horizontalHeader()->setLabel( 0, "t" );
horizontalHeader()->setLabel( 1, "f(t)" );
- myArgV = new QDoubleValidator( 0.0, 1.0, 3, this );
- myFuncV = new QDoubleValidator( 0.0, 1E10, 3, this );
+ myArgV = new QtxDblValidator( 0.0, 1.0, 3, this );
+ myFuncV = new QtxDblValidator( 0.0, 1E20, 3, this );
}
StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable()
{
stopEditing( false );
setNumRows( d.length()/2 );
+ QString val;
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;
}
//=================================================================================
else if( sender()==button( REMOVE_ROW ) )
emit toEdit( REMOVE_ROW, table()->currentRow() );
}
+
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QButton;
-class QDoubleValidator;
+class QtxDblValidator;
/*!
* \brief Values corresponding to buttons for table resize
void data( SMESH::double_array& );
void setData( const SMESH::double_array& );
+ QtxDblValidator* argValidator() const;
+ QtxDblValidator* funcValidator() const;
+
protected:
virtual QWidget* createEditor( int, int, bool ) const;
virtual bool eventFilter( QObject*, QEvent* );
void onEdit( TableButton, int );
private:
- QDoubleValidator *myArgV, *myFuncV;
+ QtxDblValidator *myArgV, *myFuncV;
};
StdMeshersGUI_DistrTable *myTable;
};
-
#endif
#include <QtxIntSpinBox.h>
#include <QtxComboBox.h>
+#include <QtxDblValidator.h>
#include <SMESHGUI_SpinBox.h>
#include <qlabel.h>
myConv->setColumnLayout( 0, Qt::Vertical );
QGridLayout* convLay = new QGridLayout( myConv->layout() );
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 );
row++;
{
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 );
myLScale->setShown( distr==1 );
class QLineEdit;
class QButtonGroup;
class QGridLayout;
+class QRadioButton;
typedef struct
{
QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo;
QGridLayout* myGroupLayout;
int myTableRow, myPreviewRow;
+ QRadioButton* myCutNeg;
};
#endif
msgid "SMESH_NB_SEGMENTS_SCALE_PARAM"
msgstr "Scale Factor"
+msgid "SMESH_DENSITY_FUNC"
+msgstr "Density function"
+
+msgid "SMESH_DISTR"
+msgstr "Distribution"
+
msgid "SMESH_TAB_FUNC"
msgstr "Table function"
msgid "SMESH_CUT_NEG_MODE"
msgstr "Cut negative"
+msgid "SMESH_NO_CONV"
+msgstr "No conversion"
+
msgid "SMESH_INSERT_ROW"
msgstr "Insert row"