mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 08:20:34 +05:00
Join modifications from branch BR_3_1_0deb
This commit is contained in:
parent
e884fc2507
commit
6b471bcc54
10
INSTALL
10
INSTALL
@ -1,6 +1,6 @@
|
||||
This is the version 3.1.0b1 of SMESH
|
||||
This is the version 3.1.0 of SMESH
|
||||
Compatible with :
|
||||
- KERNEL 3.1.0b1
|
||||
- SALOMEGUI 3.1.0b1
|
||||
- GEOM 3.1.0b1
|
||||
- MED 3.1.0b1
|
||||
- KERNEL 3.1.0
|
||||
- SALOMEGUI 3.1.0
|
||||
- GEOM 3.1.0
|
||||
- MED 3.1.0
|
||||
|
@ -1 +1 @@
|
||||
THIS IS SALOME - SMESH VERSION: 3.1.0b1
|
||||
THIS IS SALOME - SMESH VERSION: 3.1.0
|
||||
|
@ -110,7 +110,7 @@ fi
|
||||
|
||||
# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
|
||||
echo "" >> configure.in_tmp1
|
||||
echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
|
||||
echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
|
||||
|
||||
echo "" >> configure.in_tmp1
|
||||
echo "AC_OUTPUT([ \\" >> configure.in_tmp1
|
||||
|
@ -3,7 +3,7 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "SALOME - SMESH - v.2.1.0"
|
||||
PROJECT_NAME = "SALOME - SMESH - v.3.1.0"
|
||||
PROJECT_NUMBER = id#1.1
|
||||
OUTPUT_DIRECTORY = ../
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
@ -3,7 +3,7 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "SALOME - SMESH - v.2.1.0"
|
||||
PROJECT_NAME = "SALOME - SMESH - v.3.1.0"
|
||||
PROJECT_NUMBER = id#1.1
|
||||
OUTPUT_DIRECTORY = ../
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
@ -1,4 +1,4 @@
|
||||
foldersTree = gFld("<b>SALOME v.2.1.0 </b>", "", "")
|
||||
foldersTree = gFld("<b>SALOME v.3.1.0 </b>", "", "")
|
||||
insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
|
||||
|
||||
aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
|
||||
|
@ -21,7 +21,6 @@
|
||||
//
|
||||
// File : SMESH_BasicHypothesis.idl
|
||||
// Author : Paul RASCLE, EDF
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_BASICHYPOTHESIS_IDL_
|
||||
#define _SMESH_BASICHYPOTHESIS_IDL_
|
||||
@ -75,6 +74,14 @@ module StdMeshers
|
||||
*/
|
||||
interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis
|
||||
{
|
||||
/*!
|
||||
* Builds and returns point distribution according to passed density function
|
||||
*/
|
||||
SMESH::double_array BuildDistributionExpr( in string func, in long nbSeg, in long conv )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
SMESH::double_array BuildDistributionTab( in SMESH::double_array func, in long nbSeg, in long conv )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Sets <number of segments> parameter value
|
||||
*/
|
||||
@ -134,15 +141,15 @@ module StdMeshers
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Sets <exponent mode> parameter value for functional distributions
|
||||
* Sets <conversion mode> parameter value for functional distributions
|
||||
*/
|
||||
void SetExponentMode(in boolean isExponent)
|
||||
void SetConversionMode(in long conv )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Returns <exponent mode> parameter value for functional distributions
|
||||
* Returns <conversion mode> parameter value for functional distributions
|
||||
*/
|
||||
boolean IsExponentMode()
|
||||
long ConversionMode()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<component-username>Mesh</component-username>
|
||||
<component-type>MESH</component-type>
|
||||
<component-author>NRI</component-author>
|
||||
<component-version>3.1.0b1</component-version>
|
||||
<component-version>3.1.0</component-version>
|
||||
<component-comment>Mesh component</component-comment>
|
||||
<component-multistudy>1</component-multistudy>
|
||||
<component-icone>ModuleMesh.png</component-icone>
|
||||
|
@ -282,6 +282,10 @@ SMDSAbs_ElementType MinimumAngle::GetType() const
|
||||
*/
|
||||
double AspectRatio::GetValue( const TSequenceOfXYZ& P )
|
||||
{
|
||||
// According to "Mesh quality control" by Nadir Bouhamau referring to
|
||||
// Pascal Jean Frey and Paul-Louis George. Maillages, applications aux elements finis.
|
||||
// Hermes Science publications, Paris 1999 ISBN 2-7462-0024-4
|
||||
|
||||
int nbNodes = P.size();
|
||||
|
||||
if ( nbNodes < 3 )
|
||||
@ -289,12 +293,7 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
|
||||
|
||||
// Compute lengths of the sides
|
||||
|
||||
//double aLen[ nbNodes ];
|
||||
#ifndef WNT
|
||||
double aLen [nbNodes];
|
||||
#else
|
||||
double* aLen = (double *)new double[nbNodes];
|
||||
#endif
|
||||
vector< double > aLen (nbNodes);
|
||||
|
||||
for ( int i = 0; i < nbNodes - 1; i++ )
|
||||
aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
|
||||
@ -304,30 +303,43 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
|
||||
|
||||
if ( nbNodes == 3 )
|
||||
{
|
||||
// Q = alfa * h * p / S, where
|
||||
//
|
||||
// alfa = sqrt( 3 ) / 6
|
||||
// h - length of the longest edge
|
||||
// p - half perimeter
|
||||
// S - triangle surface
|
||||
|
||||
const double alfa = sqrt( 3. ) / 6.;
|
||||
double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
|
||||
double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.;
|
||||
double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
|
||||
if ( anArea <= Precision::Confusion() )
|
||||
return 0.;
|
||||
double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
|
||||
static double aCoef = sqrt( 3. ) / 4;
|
||||
|
||||
return aCoef * aMaxLen * aMaxLen / anArea;
|
||||
return alfa * maxLen * half_perimeter / anArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
double aMinLen = aLen[ 0 ];
|
||||
double aMaxLen = aLen[ 0 ];
|
||||
// return aspect ratio of the worst triange which can be built
|
||||
// taking three nodes of the quadrangle
|
||||
TSequenceOfXYZ triaPnts(3);
|
||||
// triangle on nodes 1 3 2
|
||||
triaPnts(1) = P(1);
|
||||
triaPnts(2) = P(3);
|
||||
triaPnts(3) = P(2);
|
||||
double ar = GetValue( triaPnts );
|
||||
// triangle on nodes 1 3 4
|
||||
triaPnts(3) = P(4);
|
||||
ar = Max ( ar, GetValue( triaPnts ));
|
||||
// triangle on nodes 1 2 4
|
||||
triaPnts(2) = P(2);
|
||||
ar = Max ( ar, GetValue( triaPnts ));
|
||||
// triangle on nodes 3 2 4
|
||||
triaPnts(1) = P(3);
|
||||
ar = Max ( ar, GetValue( triaPnts ));
|
||||
|
||||
for(int i = 1; i < nbNodes ; i++ ){
|
||||
aMinLen = Min( aMinLen, aLen[ i ] );
|
||||
aMaxLen = Max( aMaxLen, aLen[ i ] );
|
||||
}
|
||||
#ifdef WNT
|
||||
delete [] aLen;
|
||||
#endif
|
||||
if ( aMinLen <= Precision::Confusion() )
|
||||
return 0.;
|
||||
|
||||
return aMaxLen / aMinLen;
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +459,7 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
|
||||
double aVolume = getVolume(P);
|
||||
//double aVolume = getVolume(aLen);
|
||||
double aHeight = getMaxHeight(aLen);
|
||||
static double aCoeff = sqrt(6.0)/36.0;
|
||||
static double aCoeff = sqrt(2.0)/12.0;
|
||||
aQuality = aCoeff*aHeight*aSumArea/aVolume;
|
||||
break;
|
||||
}
|
||||
@ -633,6 +645,21 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( nbNodes > 4 ) {
|
||||
// avaluate aspect ratio of quadranle faces
|
||||
AspectRatio aspect2D;
|
||||
SMDS_VolumeTool::VolumeType type = SMDS_VolumeTool::GetType( nbNodes );
|
||||
int nbFaces = SMDS_VolumeTool::NbFaces( type );
|
||||
TSequenceOfXYZ points(4);
|
||||
for ( int i = 0; i < nbFaces; ++i ) { // loop on faces of a volume
|
||||
if ( SMDS_VolumeTool::NbFaceNodes( type, i ) != 4 )
|
||||
continue;
|
||||
const int* pInd = SMDS_VolumeTool::GetFaceNodesIndices( type, i, true );
|
||||
for ( int p = 0; p < 4; ++p ) // loop on nodes of a quadranle face
|
||||
points( p + 1 ) = P( pInd[ p ] + 1 );
|
||||
aQuality = max( aQuality, aspect2D.GetValue( points ));
|
||||
}
|
||||
}
|
||||
return aQuality;
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,7 @@ EXPORT_HEADERS= SMESHGUI_Swig.hxx \
|
||||
SMESHGUI_Hypotheses.h \
|
||||
SMESHGUI_HypothesesUtils.h \
|
||||
SMESHGUI_SpinBox.h \
|
||||
SMESHGUI_aParameter.h \
|
||||
SMESHGUI_aParameterDlg.h \
|
||||
SMESHGUI_Selection.h \
|
||||
SMESHGUI_FunctionPreview.h
|
||||
SMESHGUI_Selection.h
|
||||
|
||||
# .po files to transform in .qm
|
||||
PO_FILES = \
|
||||
@ -70,7 +67,6 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_Preferences_ColorDlg.cxx \
|
||||
SMESHGUI_Preferences_ScalarBarDlg.cxx \
|
||||
SMESHGUI_Preferences_SelectionDlg.cxx \
|
||||
SMESHGUI_aParameterDlg.cxx \
|
||||
SMESHGUI_Swig.cxx \
|
||||
SMESHGUI_MoveNodesDlg.cxx \
|
||||
SMESHGUI_AddMeshElementDlg.cxx \
|
||||
@ -82,7 +78,6 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_FilterLibraryDlg.cxx \
|
||||
SMESHGUI_SingleEditDlg.cxx \
|
||||
SMESHGUI_MultiEditDlg.cxx \
|
||||
SMESHGUI_aParameter.cxx \
|
||||
SMESHGUI_DeleteGroupDlg.cxx \
|
||||
SMESHGUI_GroupOpDlg.cxx \
|
||||
SMESHGUI_SmoothingDlg.cxx \
|
||||
@ -113,7 +108,7 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_MeshDlg.cxx \
|
||||
SMESHGUI_MeshOp.cxx \
|
||||
SMESHGUI_Displayer.cxx \
|
||||
SMESHGUI_FunctionPreview.cxx
|
||||
SMESHGUI_Hypotheses.cxx
|
||||
|
||||
LIB_MOC = \
|
||||
SMESHGUI.h \
|
||||
@ -132,7 +127,6 @@ LIB_MOC = \
|
||||
SMESHGUI_Preferences_ColorDlg.h \
|
||||
SMESHGUI_Preferences_ScalarBarDlg.h \
|
||||
SMESHGUI_Preferences_SelectionDlg.h \
|
||||
SMESHGUI_aParameterDlg.h \
|
||||
SMESHGUI_MoveNodesDlg.h \
|
||||
SMESHGUI_AddMeshElementDlg.h \
|
||||
SMESHGUI_EditHypothesesDlg.h \
|
||||
@ -154,7 +148,6 @@ LIB_MOC = \
|
||||
SMESHGUI_SewingDlg.h \
|
||||
SMESHGUI_PrecisionDlg.h \
|
||||
SMESHGUI_MergeNodesDlg.h \
|
||||
SMESHGUI_aParameter.h \
|
||||
SMESHGUI_EditMeshDlg.h \
|
||||
SMESHGUI_CreatePolyhedralVolumeDlg.h \
|
||||
SMESHGUI_Operation.h \
|
||||
@ -162,7 +155,7 @@ LIB_MOC = \
|
||||
SMESHGUI_Dialog.h \
|
||||
SMESHGUI_MeshDlg.h \
|
||||
SMESHGUI_MeshOp.h \
|
||||
SMESHGUI_FunctionPreview.h
|
||||
SMESHGUI_Hypotheses.h
|
||||
|
||||
|
||||
LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
@ -189,17 +182,16 @@ LIB_SERVER_IDL =
|
||||
|
||||
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
|
||||
-I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) $(QWT_INCLUDES)
|
||||
-I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
|
||||
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome
|
||||
|
||||
|
||||
LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef \
|
||||
$(OCC_KERNEL_LIBS) -lTKBO -lTKAdvTools -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome \
|
||||
-lVTKViewer -lSalomeApp -lSalomePrs -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject \
|
||||
-lEvent -lSALOMELocalTrace -lSVTK -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOM -lGEOMClient \
|
||||
-lGEOMBase -lGEOMObject -lGEOMFiltersSelection $(QWT_LIBS)
|
||||
-lGEOMBase -lGEOMObject -lGEOMFiltersSelection
|
||||
|
||||
LDFLAGSFORBIN += $(LDFLAGS)
|
||||
|
||||
|
@ -1725,9 +1725,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
char* sName = Hyp->GetName();
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName);
|
||||
if (aCreator)
|
||||
{
|
||||
aCreator->EditHypothesis(Hyp);
|
||||
}
|
||||
aCreator->edit( Hyp.in(), desktop() );
|
||||
else
|
||||
{
|
||||
// report error
|
||||
|
@ -205,8 +205,13 @@ void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator =
|
||||
SMESH::GetHypothesisCreator(sHypType);
|
||||
|
||||
// Create hypothesis/algorithm
|
||||
aCreator->CreateHypothesis(myIsAlgo, this);
|
||||
if( aCreator )
|
||||
// Create hypothesis/algorithm
|
||||
aCreator->create( myIsAlgo, this );
|
||||
else
|
||||
{
|
||||
// report about error
|
||||
}
|
||||
}
|
||||
|
||||
// buttonApply->setEnabled(FALSE);
|
||||
|
@ -1,271 +0,0 @@
|
||||
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org/
|
||||
//
|
||||
|
||||
#include "SMESHGUI_FunctionPreview.h"
|
||||
#include <Expr_NamedUnknown.hxx>
|
||||
#include <Expr_GeneralExpression.hxx>
|
||||
#include <CASCatch_CatchSignals.hxx>
|
||||
#include <CASCatch_Failure.hxx>
|
||||
#include <CASCatch_ErrorHandler.hxx>
|
||||
#include <OSD.hxx>
|
||||
|
||||
SMESHGUI_FunctionPreview::SMESHGUI_FunctionPreview( QWidget* p )
|
||||
: QwtPlot( p ),
|
||||
myXmin( 0.0 ),
|
||||
myXmax( 1.0 ),
|
||||
myPoints( 50 ),
|
||||
myIsTable( false ),
|
||||
myVars( 1, 1 ),
|
||||
myValues( 1, 1 ),
|
||||
myIsExp( false ),
|
||||
myIsDone( true )
|
||||
{
|
||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||
myCurve = insertCurve( QString() );
|
||||
setCurvePen( myCurve, QPen( Qt::red, 1 ) );
|
||||
}
|
||||
|
||||
SMESHGUI_FunctionPreview::~SMESHGUI_FunctionPreview()
|
||||
{
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::isTableFunc() const
|
||||
{
|
||||
return myIsTable;
|
||||
}
|
||||
|
||||
void SMESHGUI_FunctionPreview::tableFunc( SMESH::double_array& f ) const
|
||||
{
|
||||
f = myTableFunc;
|
||||
}
|
||||
|
||||
QString SMESHGUI_FunctionPreview::function() const
|
||||
{
|
||||
return myFunction;
|
||||
}
|
||||
|
||||
void SMESHGUI_FunctionPreview::interval( double& xmin, double& xmax ) const
|
||||
{
|
||||
xmin = myXmin;
|
||||
xmax = myXmax;
|
||||
}
|
||||
|
||||
int SMESHGUI_FunctionPreview::pointsCount() const
|
||||
{
|
||||
return myPoints;
|
||||
}
|
||||
|
||||
void SMESHGUI_FunctionPreview::setIsExp( const bool exp, const bool update )
|
||||
{
|
||||
myIsExp = exp;
|
||||
if( update )
|
||||
repaint();
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::setParams( const QString& func,
|
||||
const double xmin, const double xmax,
|
||||
const int points, const bool update )
|
||||
{
|
||||
myIsTable = false;
|
||||
myTableFunc = SMESH::double_array();
|
||||
myFunction = func.isEmpty() ? "0" : func;
|
||||
myXmin = xmin;
|
||||
myXmax = xmax<myXmin ? myXmax : xmax;
|
||||
myPoints = points>0 ? points : 2;
|
||||
bool res = init( func );
|
||||
if( update )
|
||||
repaint();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::setParams( const SMESH::double_array& f, const double xmin, const double xmax,
|
||||
const bool update )
|
||||
{
|
||||
myIsTable = true;
|
||||
myTableFunc = f;
|
||||
if( myTableFunc.length()%2==1 )
|
||||
myTableFunc.length( myTableFunc.length()-1 );
|
||||
|
||||
myFunction = "0";
|
||||
myXmin = xmin;
|
||||
myXmax = xmax<myXmin ? myXmax : xmax;
|
||||
myPoints = myTableFunc.length()/2;
|
||||
|
||||
if( update )
|
||||
repaint();
|
||||
|
||||
return myTableFunc.length()>0;
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::createTable( SMESH::double_array& func )
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
{
|
||||
func.length( 0 );
|
||||
return false;
|
||||
}
|
||||
|
||||
double d = (myXmax-myXmin)/double(myPoints-1);
|
||||
func.length( 2*myPoints );
|
||||
int err = 0;
|
||||
for( int i=0, j=0; i<myPoints; j++ )
|
||||
{
|
||||
bool ok;
|
||||
double t = myXmin + d*j, f = funcValue( t, ok );
|
||||
if( ok )
|
||||
{
|
||||
func[2*i] = t;
|
||||
func[2*i+1] = f;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
err++;
|
||||
}
|
||||
func.length( func.length()-2*err );
|
||||
return err==0;
|
||||
}
|
||||
|
||||
void SMESHGUI_FunctionPreview::drawContents( QPainter* p )
|
||||
{
|
||||
SMESH::double_array f;
|
||||
if( isTableFunc() )
|
||||
{
|
||||
myIsDone = true;
|
||||
f = myTableFunc;
|
||||
}
|
||||
else
|
||||
myIsDone = createTable( f );
|
||||
|
||||
int size = f.length()/2;
|
||||
if( size==0 )
|
||||
{
|
||||
setAxisScale( curveXAxis( myCurve ), 0.0, 0.0 );
|
||||
setAxisScale( curveYAxis( myCurve ), 0.0, 0.0 );
|
||||
setCurveData( myCurve, 0, 0, 0 );
|
||||
replot();
|
||||
QwtPlot::drawContents( p );
|
||||
return;
|
||||
}
|
||||
|
||||
double* x = new double[size], *y = new double[size];
|
||||
double min_x, max_x, min_y, max_y;
|
||||
for( int i=0; i<size; i++ )
|
||||
{
|
||||
x[i] = f[2*i];
|
||||
y[i] = myIsExp ? pow( 10.0, f[2*i+1] ) : f[2*i+1];
|
||||
if( i==0 || y[i]<min_y )
|
||||
min_y = y[i];
|
||||
if( i==0 || y[i]>max_y )
|
||||
max_y = y[i];
|
||||
if( i==0 || x[i]<min_x )
|
||||
min_x = x[i];
|
||||
if( i==0 || x[i]>max_x )
|
||||
max_x = x[i];
|
||||
}
|
||||
|
||||
setAxisScale( curveXAxis( myCurve ), min_x, max_x );
|
||||
setAxisScale( curveYAxis( myCurve ), min_y, max_y );
|
||||
setCurveData( myCurve, x, y, size );
|
||||
delete[] x;
|
||||
delete[] y;
|
||||
|
||||
replot();
|
||||
QwtPlot::drawContents( p );
|
||||
}
|
||||
|
||||
bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
|
||||
{
|
||||
Handle( Expr_NamedUnknown ) sub = Handle( Expr_NamedUnknown )::DownCast( expr );
|
||||
if( !sub.IsNull() )
|
||||
return sub->GetName()=="t";
|
||||
|
||||
bool res = true;
|
||||
for( int i=1, n=expr->NbSubExpressions(); i<=n && res; i++ )
|
||||
{
|
||||
Handle( Expr_GeneralExpression ) sub = expr->SubExpression( i );
|
||||
Handle( Expr_NamedUnknown ) name = Handle( Expr_NamedUnknown )::DownCast( sub );
|
||||
if( !name.IsNull() )
|
||||
{
|
||||
if( name->GetName()!="t" )
|
||||
res = false;
|
||||
}
|
||||
else
|
||||
res = isCorrectArg( sub );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::init( const QString& str )
|
||||
{
|
||||
myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( ( Standard_CString ) str.latin1() );
|
||||
|
||||
bool syntax = false, args = false;
|
||||
if( myExpr->IsDone() )
|
||||
{
|
||||
syntax = true;
|
||||
args = isCorrectArg( myExpr->Expression() );
|
||||
}
|
||||
|
||||
bool res = syntax && args;
|
||||
if( !res )
|
||||
myExpr.Nullify();
|
||||
return res;
|
||||
}
|
||||
|
||||
double SMESHGUI_FunctionPreview::funcValue( const double t, bool& ok )
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
return 0;
|
||||
|
||||
myValues.ChangeValue( 1 ) = t;
|
||||
|
||||
ok = true;
|
||||
double res = calc( ok );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
double SMESHGUI_FunctionPreview::calc( bool& ok )
|
||||
{
|
||||
OSD::SetSignal( true );
|
||||
double res = 0.0;
|
||||
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
ok = true;
|
||||
CASCatch_TRY {
|
||||
res = myExpr->Expression()->Evaluate( myVars, myValues );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure) {
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
ok = false;
|
||||
res = 0.0;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool SMESHGUI_FunctionPreview::isDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org/
|
||||
//
|
||||
|
||||
#ifndef SMESHGUI_FUNCTION_PREVIEW_HEADER
|
||||
#define SMESHGUI_FUNCTION_PREVIEW_HEADER
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include <ExprIntrp_GenExp.hxx>
|
||||
#include <Expr_Array1OfNamedUnknown.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
class SMESHGUI_FunctionPreview : public QwtPlot
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_FunctionPreview( QWidget* );
|
||||
virtual ~SMESHGUI_FunctionPreview();
|
||||
|
||||
QString function() const;
|
||||
bool isTableFunc() const;
|
||||
void tableFunc( SMESH::double_array& ) const;
|
||||
void interval( double&, double& ) const;
|
||||
int pointsCount() const;
|
||||
bool isDone() const;
|
||||
|
||||
bool setParams( const QString&, const double = 0.0, const double = 1.0, const int = 50, const bool = true );
|
||||
bool setParams( const SMESH::double_array&, const double = 0.0, const double = 1.0, const bool = true );
|
||||
void setIsExp( const bool, const bool = true );
|
||||
|
||||
protected:
|
||||
virtual bool init( const QString& );
|
||||
virtual double funcValue( const double, bool& );
|
||||
virtual bool createTable( SMESH::double_array& );
|
||||
virtual void drawContents( QPainter* );
|
||||
|
||||
private:
|
||||
double calc( bool& );
|
||||
|
||||
private:
|
||||
QString myFunction;
|
||||
double myXmin, myXmax;
|
||||
int myPoints;
|
||||
bool myIsTable;
|
||||
bool myIsExp;
|
||||
SMESH::double_array myTableFunc;
|
||||
long myCurve;
|
||||
Handle(ExprIntrp_GenExp) myExpr;
|
||||
Expr_Array1OfNamedUnknown myVars;
|
||||
TColStd_Array1OfReal myValues;
|
||||
bool myIsDone;
|
||||
};
|
||||
|
||||
#endif
|
336
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
Normal file
336
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
Normal file
@ -0,0 +1,336 @@
|
||||
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
|
||||
#include <SALOMEDSClient_Study.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
#include <QtxIntSpinBox.h>
|
||||
|
||||
#include <qframe.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& aHypType )
|
||||
: myHypType( aHypType ),
|
||||
myIsCreate( false )
|
||||
{
|
||||
}
|
||||
|
||||
SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
|
||||
{
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::create( const bool isAlgo, QWidget* parent )
|
||||
{
|
||||
MESSAGE( "Creation of hypothesis" );
|
||||
|
||||
// Get default name for hypothesis/algorithm creation
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData( hypType().latin1() );
|
||||
QString aHypName = aHypData ? aHypData->Label : hypType();
|
||||
|
||||
myIsCreate = true;
|
||||
|
||||
// Create hypothesis/algorithm
|
||||
if (isAlgo)
|
||||
SMESH::CreateHypothesis( hypType(), aHypName, isAlgo );
|
||||
|
||||
else
|
||||
{
|
||||
SMESH::SMESH_Hypothesis_var newHypo = SMESH::SMESH_Hypothesis::_narrow
|
||||
( SMESH::CreateHypothesis( hypType(), aHypName, false ) );
|
||||
|
||||
if( !editHypothesis( newHypo.in(), parent ) )
|
||||
{ //remove just created hypothesis
|
||||
_PTR(SObject) SHyp = SMESH::FindSObject( newHypo.in() );
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
if( aStudy && !aStudy->GetProperties()->IsLocked() )
|
||||
{
|
||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
aBuilder->RemoveObjectWithChildren( SHyp );
|
||||
}
|
||||
}
|
||||
}
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr h, QWidget* parent )
|
||||
{
|
||||
if( CORBA::is_nil( h ) )
|
||||
return;
|
||||
|
||||
MESSAGE("Edition of hypothesis");
|
||||
|
||||
myIsCreate = false;
|
||||
|
||||
if( !editHypothesis( h, parent ) )
|
||||
return;
|
||||
|
||||
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( h );
|
||||
if( listSOmesh.size() > 0 )
|
||||
for( int i=0; i<listSOmesh.size(); i++ )
|
||||
{
|
||||
_PTR(SObject) submSO = listSOmesh[i];
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
|
||||
if( !aSubMesh->_is_nil() )
|
||||
aMesh = aSubMesh->GetFather();
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
|
||||
SMESH::ModifiedMesh( meshSO, false);
|
||||
}
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
||||
}
|
||||
|
||||
bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h, QWidget* parent )
|
||||
{
|
||||
if( CORBA::is_nil( h ) )
|
||||
return false;
|
||||
|
||||
bool res = true;
|
||||
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
|
||||
QFrame* fr = buildFrame();
|
||||
if( fr )
|
||||
{
|
||||
SMESHGUI_HypothesisDlg* dlg =
|
||||
new SMESHGUI_HypothesisDlg( const_cast<SMESHGUI_GenericHypothesisCreator*>( this ), parent );
|
||||
dlg->setCustomFrame( fr );
|
||||
dlg->setCaption( caption() );
|
||||
dlg->setHIcon( icon() );
|
||||
dlg->setType( type() );
|
||||
retrieveParams();
|
||||
res = dlg->exec()==QDialog::Accepted;
|
||||
if( res )
|
||||
storeParams();
|
||||
delete dlg;
|
||||
}
|
||||
changeWidgets().clear();
|
||||
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||
return res;
|
||||
}
|
||||
|
||||
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
{
|
||||
if( CORBA::is_nil( hypothesis() ) )
|
||||
return 0;
|
||||
|
||||
ListOfStdParams params;
|
||||
if( !stdParams( params ) || params.isEmpty() )
|
||||
return 0;
|
||||
|
||||
QFrame* fr = new QFrame( 0, "myframe" );
|
||||
QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 );
|
||||
|
||||
QGroupBox* GroupC1 = new QGroupBox( fr, "GroupC1" );
|
||||
lay->addWidget( GroupC1 );
|
||||
|
||||
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
||||
GroupC1Layout->setSpacing( 6 );
|
||||
GroupC1Layout->setMargin( 11 );
|
||||
|
||||
ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
|
||||
for( int i=0; anIt!=aLast; anIt++, i++ )
|
||||
{
|
||||
QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
|
||||
GroupC1Layout->addWidget( lab, i, 0 );
|
||||
|
||||
QWidget* w = 0;
|
||||
switch( (*anIt).myValue.type() )
|
||||
{
|
||||
case QVariant::Int:
|
||||
{
|
||||
QtxIntSpinBox* sb = new QtxIntSpinBox( GroupC1, (*anIt).myName.latin1() );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setValue( (*anIt).myValue.toInt() );
|
||||
connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
|
||||
w = sb;
|
||||
}
|
||||
break;
|
||||
case QVariant::Double:
|
||||
{
|
||||
QtxDblSpinBox* sb = new SMESHGUI_SpinBox( GroupC1, (*anIt).myName.latin1() );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setValue( (*anIt).myValue.toDouble() );
|
||||
connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
|
||||
w = sb;
|
||||
}
|
||||
break;
|
||||
case QVariant::String:
|
||||
{
|
||||
QLineEdit* le = new QLineEdit( GroupC1, (*anIt).myName.latin1() );
|
||||
attuneStdWidget( le, i );
|
||||
le->setText( (*anIt).myValue.toString() );
|
||||
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
w = le;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( w )
|
||||
{
|
||||
GroupC1Layout->addWidget( w, i, 1 );
|
||||
changeWidgets().append( w );
|
||||
}
|
||||
}
|
||||
|
||||
return fr;
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::onValueChanged()
|
||||
{
|
||||
}
|
||||
|
||||
bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
|
||||
{
|
||||
bool res = true;
|
||||
StdParam item;
|
||||
ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
item.myName = (*anIt)->name();
|
||||
if( (*anIt)->inherits( "QtxIntSpinBox" ) )
|
||||
{
|
||||
QtxIntSpinBox* sb = ( QtxIntSpinBox* )( *anIt );
|
||||
item.myValue = sb->value();
|
||||
params.append( item );
|
||||
}
|
||||
|
||||
else if( (*anIt)->inherits( "QtxDblSpinBox" ) )
|
||||
{
|
||||
QtxDblSpinBox* sb = ( QtxDblSpinBox* )( *anIt );
|
||||
item.myValue = sb->value();
|
||||
params.append( item );
|
||||
}
|
||||
|
||||
else if( (*anIt)->inherits( "QLineEdit" ) )
|
||||
{
|
||||
QLineEdit* line = ( QLineEdit* )( *anIt );
|
||||
item.myValue = line->text();
|
||||
params.append( item );
|
||||
}
|
||||
|
||||
else
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
|
||||
{
|
||||
return myHypo;
|
||||
}
|
||||
|
||||
QString SMESHGUI_GenericHypothesisCreator::hypType() const
|
||||
{
|
||||
return myHypType;
|
||||
}
|
||||
|
||||
const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
|
||||
{
|
||||
return myParamWidgets;
|
||||
}
|
||||
|
||||
SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
|
||||
{
|
||||
return myParamWidgets;
|
||||
}
|
||||
|
||||
bool SMESHGUI_GenericHypothesisCreator::isCreation() const
|
||||
{
|
||||
return myIsCreate;
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
|
||||
{
|
||||
}
|
||||
|
||||
QString SMESHGUI_GenericHypothesisCreator::caption() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
|
||||
{
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
QString SMESHGUI_GenericHypothesisCreator::type() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
|
||||
: QtxDialog( parent, "", true, true, QtxDialog::OKCancel ),
|
||||
myCreator( creator )
|
||||
{
|
||||
setMinimumSize( 300, height() );
|
||||
// setFixedSize( 300, height() );
|
||||
myLayout = new QVBoxLayout( mainFrame(), 0, 0 );
|
||||
|
||||
QFrame* titFrame = new QFrame( mainFrame() );
|
||||
QHBoxLayout* titLay = new QHBoxLayout( titFrame, 0, 5 );
|
||||
|
||||
myIconLabel = new QLabel( titFrame );
|
||||
myIconLabel->setScaledContents( false );
|
||||
myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||
myTypeLabel = new QLabel( titFrame );
|
||||
if( creator )
|
||||
myTypeLabel->setText( creator->hypType() );
|
||||
|
||||
titLay->addWidget( myIconLabel, 0 );
|
||||
titLay->addWidget( myTypeLabel, 0 );
|
||||
titLay->addStretch( 1 );
|
||||
|
||||
myLayout->addWidget( titFrame, 0 );
|
||||
}
|
||||
|
||||
SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
||||
{
|
||||
if( f )
|
||||
{
|
||||
f->reparent( mainFrame(), QPoint( 0, 0 ) );
|
||||
myLayout->insertWidget( 1, f, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::accept()
|
||||
{
|
||||
if( !myCreator || myCreator->checkParams() )
|
||||
QtxDialog::accept();
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
|
||||
{
|
||||
myIconLabel->setPixmap( p );
|
||||
}
|
||||
|
||||
void SMESHGUI_HypothesisDlg::setType( const QString& t )
|
||||
{
|
||||
myTypeLabel->setText( t );
|
||||
}
|
@ -31,20 +31,88 @@
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
// QT Includes
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
#include <qvaluevector.h>
|
||||
#include <qstringlist.h>
|
||||
#include <QtxDialog.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QPixmap;
|
||||
|
||||
/*!
|
||||
* \brief Auxiliary class for creation of hypotheses
|
||||
*/
|
||||
class SMESHGUI_GenericHypothesisCreator
|
||||
class SMESHGUI_GenericHypothesisCreator : public QObject
|
||||
{
|
||||
public:
|
||||
virtual void CreateHypothesis (const bool isAlgo, QWidget* parent) = 0;
|
||||
virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp) = 0;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_GenericHypothesisCreator( const QString& );
|
||||
virtual ~SMESHGUI_GenericHypothesisCreator();
|
||||
|
||||
void create( const bool isAlgo, QWidget* );
|
||||
void edit( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||
virtual bool checkParams() const = 0;
|
||||
|
||||
QString hypType() const;
|
||||
bool isCreation() const;
|
||||
|
||||
protected:
|
||||
typedef struct
|
||||
{
|
||||
QString myName;
|
||||
QVariant myValue;
|
||||
|
||||
} StdParam;
|
||||
|
||||
typedef QValueList<StdParam> ListOfStdParams;
|
||||
typedef QPtrList<QWidget> ListOfWidgets;
|
||||
|
||||
SMESH::SMESH_Hypothesis_var hypothesis() const;
|
||||
const ListOfWidgets& widgets() const;
|
||||
ListOfWidgets& changeWidgets();
|
||||
|
||||
virtual QFrame* buildFrame () = 0;
|
||||
QFrame* buildStdFrame ();
|
||||
virtual void retrieveParams() const = 0;
|
||||
virtual void storeParams () const = 0;
|
||||
virtual bool stdParams ( ListOfStdParams& ) const;
|
||||
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||
virtual QString caption() const;
|
||||
virtual QPixmap icon() const;
|
||||
virtual QString type() const;
|
||||
|
||||
protected slots:
|
||||
virtual void onValueChanged();
|
||||
|
||||
private:
|
||||
bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, QWidget* );
|
||||
|
||||
private:
|
||||
SMESH::SMESH_Hypothesis_var myHypo;
|
||||
QString myHypType;
|
||||
ListOfWidgets myParamWidgets;
|
||||
bool myIsCreate;
|
||||
};
|
||||
|
||||
class SMESHGUI_HypothesisDlg : public QtxDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
|
||||
virtual ~SMESHGUI_HypothesisDlg();
|
||||
|
||||
void setHIcon( const QPixmap& );
|
||||
void setCustomFrame( QFrame* );
|
||||
void setType( const QString& );
|
||||
|
||||
protected slots:
|
||||
virtual void accept();
|
||||
|
||||
private:
|
||||
SMESHGUI_GenericHypothesisCreator* myCreator;
|
||||
QVBoxLayout* myLayout;
|
||||
QLabel *myIconLabel, *myTypeLabel;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -297,7 +297,7 @@ namespace SMESH{
|
||||
// get method, returning hypothesis creator
|
||||
if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
|
||||
typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
|
||||
(QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
|
||||
( const QString& );
|
||||
GetHypothesisCreator procHandle =
|
||||
(GetHypothesisCreator)dlsym(libHandle, "GetHypothesisCreator");
|
||||
if (!procHandle) {
|
||||
@ -307,7 +307,7 @@ namespace SMESH{
|
||||
else {
|
||||
// get hypothesis creator
|
||||
if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType);
|
||||
aCreator = procHandle(aHypType, aServerLibName, SMESHGUI::GetSMESHGUI());
|
||||
aCreator = procHandle( aHypType );
|
||||
if (!aCreator) {
|
||||
if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
|
||||
}
|
||||
|
@ -560,7 +560,8 @@ void SMESHGUI_MeshOp::onCreateHyp( const int theHypType, const int theIndex )
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHypTypeName );
|
||||
|
||||
// Create hypothesis
|
||||
aCreator->CreateHypothesis( false, myDlg );
|
||||
if( aCreator )
|
||||
aCreator->create( false, myDlg );
|
||||
}
|
||||
|
||||
QStringList aNewHyps;
|
||||
@ -602,7 +603,7 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
|
||||
char* aTypeName = aHyp->GetName();
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aTypeName );
|
||||
if ( aCreator )
|
||||
aCreator->EditHypothesis( aHyp );
|
||||
aCreator->edit( aHyp.in(), dlg() );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -632,7 +633,9 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
||||
{
|
||||
const QString& aHypoTypeName = (*aHypoList)[ i ];
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
|
||||
if ( !aHypData ) continue;
|
||||
if ( !aHypData )
|
||||
continue;
|
||||
|
||||
int aDim = aHypData->Dim[0];
|
||||
// create or/and set
|
||||
int index = -1;
|
||||
@ -673,7 +676,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
||||
// Get hypotheses creator client (GUI)
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator =
|
||||
SMESH::GetHypothesisCreator( aHypoTypeName );
|
||||
aCreator->CreateHypothesis( false, myDlg );
|
||||
aCreator->create( false, myDlg );
|
||||
}
|
||||
QStringList aNewHyps;
|
||||
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
|
||||
@ -915,7 +918,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator =
|
||||
SMESH::GetHypothesisCreator( aHypName );
|
||||
if ( aCreator )
|
||||
aCreator->CreateHypothesis( true, myDlg );
|
||||
aCreator->create( true, myDlg );
|
||||
}
|
||||
QStringList tmpList;
|
||||
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,305 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_aParameterDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_aParameterDlg.h"
|
||||
#include "SMESHGUI_aParameter.h"
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_FunctionPreview.h"
|
||||
|
||||
#include "SUIT_Tools.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//======================================================================================
|
||||
// function : SMESHGUI_aParameterDlg()
|
||||
//
|
||||
// The dialog will by default be modal, unless you set 'modal' to
|
||||
// false when constructing dialog
|
||||
//
|
||||
//======================================================================================
|
||||
SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
|
||||
( SMESHGUI* theModule,
|
||||
std::list<SMESHGUI_aParameterPtr> params,
|
||||
QString title,
|
||||
bool modal)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), "MyParameterDialog", modal, WStyle_Customize |
|
||||
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
|
||||
myParamList(params),
|
||||
mySMESHGUI(theModule)
|
||||
{
|
||||
/* creating widgets */
|
||||
init();
|
||||
/* title */
|
||||
setCaption(title);
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
SUIT_Tools::centerWidget(this, SMESH::GetDesktop( theModule ) );
|
||||
}
|
||||
|
||||
//======================================================================================
|
||||
// function : SMESHGUI_aParameterDlg::init()
|
||||
// purpose : creates dialog's layout
|
||||
//======================================================================================
|
||||
void SMESHGUI_aParameterDlg::init()
|
||||
{
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(11); topLayout->setSpacing(6);
|
||||
|
||||
/***************************************************************/
|
||||
QGroupBox* GroupC1 = new QGroupBox(this, "GroupC1");
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
||||
GroupC1->layout()->setSpacing(0);
|
||||
GroupC1->layout()->setMargin(0);
|
||||
QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
|
||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
||||
GroupC1Layout->setSpacing(6);
|
||||
GroupC1Layout->setMargin(11);
|
||||
/* Spin boxes with labels */
|
||||
list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
|
||||
int row;
|
||||
for( row = 0; paramIt != myParamList.end(); paramIt++ , row++)
|
||||
{
|
||||
SMESHGUI_aParameterPtr param = (*paramIt);
|
||||
QLabel * label = new QLabel(GroupC1, "TextLabel");
|
||||
GroupC1Layout->addWidget(label, row, 0);
|
||||
label->setText(param->Label());
|
||||
QWidget* aSpinWidget = param->CreateWidget( GroupC1 );
|
||||
if (aSpinWidget) {
|
||||
GroupC1Layout->addWidget(aSpinWidget, row, 1);
|
||||
aSpinWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
aSpinWidget->setMinimumSize(150, 0);
|
||||
|
||||
QString sig = param->sigValueChanged();
|
||||
if( !sig.isEmpty() /*&& param->GetType()!=SMESHGUI_aParameter::TABLE*/ )
|
||||
connect( aSpinWidget, sig.latin1(), this, SLOT( onValueChanged() ) );
|
||||
|
||||
param->InitializeWidget(aSpinWidget);
|
||||
mySpinList.push_back(aSpinWidget);
|
||||
myLabelList.push_back(label);
|
||||
}
|
||||
}
|
||||
|
||||
myPreview = new SMESHGUI_FunctionPreview( GroupC1 );
|
||||
myPreview->hide();
|
||||
GroupC1Layout->addWidget( myPreview, row, 1 );
|
||||
|
||||
paramIt = myParamList.begin();
|
||||
std::list<QWidget*>::const_iterator anIt = mySpinList.begin();
|
||||
for( ; paramIt!=myParamList.end(); paramIt++, anIt++ )
|
||||
{
|
||||
(*paramIt)->TakeValue( *anIt );
|
||||
UpdateShown( *paramIt, *anIt );
|
||||
FunctionPreview( *paramIt, *anIt );
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
/* Ok button */
|
||||
myButtonOk = new QPushButton(GroupButtons, "buttonOk");
|
||||
myButtonOk->setText(tr("SMESH_BUT_OK"));
|
||||
myButtonOk->setAutoDefault(TRUE);
|
||||
myButtonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(myButtonOk, 0, 0);
|
||||
/* add spacer between buttons */
|
||||
GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
|
||||
/* Cancel button */
|
||||
myButtonCancel = new QPushButton(GroupButtons, "buttonCancel");
|
||||
myButtonCancel->setText(tr("SMESH_BUT_CANCEL"));
|
||||
myButtonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(myButtonCancel, 0, 2);
|
||||
|
||||
/***************************************************************/
|
||||
topLayout->addWidget(GroupC1, 1 );
|
||||
topLayout->addWidget(GroupButtons, 0 );
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(myButtonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
//======================================================================================
|
||||
// function : ~SMESHGUI_aParameterDlg()
|
||||
// purpose : Destructor
|
||||
//======================================================================================
|
||||
SMESHGUI_aParameterDlg::~SMESHGUI_aParameterDlg()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClickOnOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_aParameterDlg::ClickOnOk()
|
||||
{
|
||||
if (!mySMESHGUI->isActiveStudyLocked()) {
|
||||
list<SMESHGUI_aParameterPtr>::iterator paramIt = myParamList.begin();
|
||||
list<QWidget*>::iterator widgetIt = mySpinList.begin();
|
||||
for (;
|
||||
paramIt != myParamList.end() && widgetIt != mySpinList.end();
|
||||
paramIt++ , widgetIt++)
|
||||
(*paramIt)->TakeValue(*widgetIt);
|
||||
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Parameters()
|
||||
// purpose : return a list of parameters from a dialog box
|
||||
//=======================================================================
|
||||
bool SMESHGUI_aParameterDlg::Parameters( SMESHGUI* theModule,
|
||||
list<SMESHGUI_aParameterPtr> params,
|
||||
const char *aTitle)
|
||||
{
|
||||
if (!params.empty()) {
|
||||
SMESHGUI_aParameterDlg *Dialog =
|
||||
new SMESHGUI_aParameterDlg( theModule, params, aTitle, TRUE);
|
||||
return (Dialog->exec() == QDialog::Accepted);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : FunctionPreview
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_aParameterDlg::FunctionPreview( const SMESHGUI_aParameterPtr p, QWidget* w )
|
||||
{
|
||||
if( !w || !w->isShown() )
|
||||
return;
|
||||
|
||||
SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( p.operator->() );
|
||||
SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( p.operator->() );
|
||||
SMESHGUI_boolParameter* bool_param = dynamic_cast<SMESHGUI_boolParameter*>( p.operator->() );
|
||||
if( str_param && str_param->needPreview() )
|
||||
{
|
||||
QString val; str_param->GetNewText( val );
|
||||
if( !val.isNull() )
|
||||
myPreview->setParams( val );
|
||||
}
|
||||
else if( tab_param && tab_param->needPreview() )
|
||||
{
|
||||
SMESH::double_array d;
|
||||
tab_param->data( d );
|
||||
myPreview->setParams( d );
|
||||
}
|
||||
else if( bool_param && bool_param->needPreview() )
|
||||
{
|
||||
int exp=0;
|
||||
bool_param->GetNewInt( exp );
|
||||
myPreview->setIsExp( exp );
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : onValueChanged
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_aParameterDlg::onValueChanged()
|
||||
{
|
||||
if( sender()->inherits( "QWidget" ) )
|
||||
{
|
||||
QWidget* w = ( QWidget* )sender();
|
||||
|
||||
|
||||
std::list<QWidget*>::const_iterator anIt = mySpinList.begin(),
|
||||
aLast = mySpinList.end();
|
||||
std::list<SMESHGUI_aParameterPtr>::const_iterator aPIt = myParamList.begin();
|
||||
for( ; anIt!=aLast; anIt++, aPIt++ )
|
||||
if( *anIt == w )
|
||||
{
|
||||
(*aPIt)->TakeValue( w );
|
||||
UpdateShown( *aPIt, w );
|
||||
FunctionPreview( *aPIt, w );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : onValueChanged
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_aParameterDlg::UpdateShown( const SMESHGUI_aParameterPtr param, QWidget* w )
|
||||
{
|
||||
SMESHGUI_dependParameter* depPar = dynamic_cast<SMESHGUI_enumParameter*>( param.get() );
|
||||
if( !depPar )
|
||||
depPar = dynamic_cast<SMESHGUI_boolParameter*>( param.get() );
|
||||
|
||||
if( !depPar )
|
||||
return;
|
||||
|
||||
SMESHGUI_dependParameter::ShownMap& map = depPar->shownMap();
|
||||
if( map.isEmpty() )
|
||||
return;
|
||||
|
||||
int val;
|
||||
depPar->TakeValue( w );
|
||||
depPar->GetNewInt( val );
|
||||
bool hasValue = map.contains( val );
|
||||
|
||||
std::list<QWidget*>::const_iterator anIt = mySpinList.begin(),
|
||||
aLast = mySpinList.end(),
|
||||
aLIt = myLabelList.begin();
|
||||
std::list<SMESHGUI_aParameterPtr>::iterator aPIt = myParamList.begin();
|
||||
bool preview = false;
|
||||
for( int i=0; anIt!=aLast; anIt++, aLIt++, i++, aPIt++ )
|
||||
{
|
||||
bool shown = hasValue && map[ val ].contains( i );
|
||||
(*anIt)->setShown( shown );
|
||||
(*aLIt)->setShown( shown );
|
||||
if( shown )
|
||||
{
|
||||
SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( (*aPIt).operator->() );
|
||||
SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( (*aPIt).operator->() );
|
||||
preview = preview || ( str_param && str_param->needPreview() ) || ( tab_param && tab_param->needPreview() );
|
||||
}
|
||||
}
|
||||
myPreview->setShown( preview );
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_aParameterDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef SMESHGUI_aParameterDlg_H
|
||||
#define SMESHGUI_aParameterDlg_H
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
|
||||
#include <list>
|
||||
#include "SMESHGUI_aParameter.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class SMESHGUI;
|
||||
class QWidget;
|
||||
class SMESHGUI_FunctionPreview;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_aParameterDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_aParameterDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_aParameterDlg( SMESHGUI*,
|
||||
std::list<SMESHGUI_aParameterPtr> params,
|
||||
QString title = QString::null,
|
||||
bool modal = TRUE);
|
||||
|
||||
~SMESHGUI_aParameterDlg();
|
||||
|
||||
/* Parameter function */
|
||||
static bool Parameters( SMESHGUI*, std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
protected slots:
|
||||
virtual void onValueChanged();
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
void UpdateShown( const SMESHGUI_aParameterPtr, QWidget* );
|
||||
|
||||
private:
|
||||
void FunctionPreview( const SMESHGUI_aParameterPtr, QWidget* );
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI;
|
||||
|
||||
QPushButton* myButtonOk;
|
||||
QPushButton* myButtonCancel;
|
||||
|
||||
std::list<QWidget*> mySpinList, myLabelList;
|
||||
std::list<SMESHGUI_aParameterPtr> myParamList;
|
||||
SMESHGUI_FunctionPreview* myPreview;
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_aParameterDlg.h
|
@ -98,7 +98,8 @@ hypNbSeg.append(hypNbSeg2)
|
||||
hypNbSeg3 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
|
||||
hypNbSeg3.SetDistrType(2)
|
||||
hypNbSeg3.SetNumberOfSegments(7)
|
||||
hypNbSeg3.SetTableFunction( [0.25, 0.5, 0.5, 0.25] )
|
||||
hypNbSeg3.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
|
||||
hypNbSeg3.SetConversionMode(0)
|
||||
print hypNbSeg3.GetName()
|
||||
print hypNbSeg3.GetId()
|
||||
print hypNbSeg3.GetNumberOfSegments()
|
||||
@ -110,6 +111,7 @@ hypNbSeg4 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
|
||||
hypNbSeg4.SetDistrType(3)
|
||||
hypNbSeg4.SetNumberOfSegments(10)
|
||||
hypNbSeg4.SetExpressionFunction("sin(3*t)")
|
||||
hypNbSeg4.SetConversionMode(1)
|
||||
print hypNbSeg4.GetName()
|
||||
print hypNbSeg4.GetId()
|
||||
print hypNbSeg4.GetNumberOfSegments()
|
||||
|
@ -23,7 +23,6 @@
|
||||
# File : Makefile.in
|
||||
# Author : Julia DOROVSKIKH
|
||||
# Module : SMESH
|
||||
# $Header$
|
||||
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=../..
|
||||
@ -50,6 +49,7 @@ EXPORT_HEADERS = \
|
||||
StdMeshers_MEFISTO_2D.hxx \
|
||||
StdMeshers_Hexa_3D.hxx \
|
||||
StdMeshers_AutomaticLength.hxx \
|
||||
StdMeshers_Distribution.hxx \
|
||||
StdMeshers_QuadranglePreference.hxx
|
||||
|
||||
EXPORT_PYSCRIPTS =
|
||||
@ -75,6 +75,7 @@ LIB_SRC = \
|
||||
StdMeshers_Penta_3D.cxx \
|
||||
StdMeshers_Hexa_3D.cxx \
|
||||
StdMeshers_AutomaticLength.cxx \
|
||||
StdMeshers_Distribution.cxx \
|
||||
StdMeshers_QuadranglePreference.cxx
|
||||
|
||||
LIB_SERVER_IDL =
|
||||
|
342
src/StdMeshers/StdMeshers_Distribution.cxx
Normal file
342
src/StdMeshers/StdMeshers_Distribution.cxx
Normal file
@ -0,0 +1,342 @@
|
||||
// SMESH StdMeshers : implementaion of point distribution algorithm
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Distribution.cxx
|
||||
// Author : Alexandre SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "StdMeshers_Distribution.hxx"
|
||||
#include <CASCatch_CatchSignals.hxx>
|
||||
#include <CASCatch_Failure.hxx>
|
||||
#include <CASCatch_ErrorHandler.hxx>
|
||||
#include <OSD.hxx>
|
||||
#include <math_GaussSingleIntegration.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
Function::Function( const int conv )
|
||||
: myConv( conv )
|
||||
{
|
||||
}
|
||||
|
||||
Function::~Function()
|
||||
{
|
||||
}
|
||||
|
||||
bool Function::value( const double, double& f ) const
|
||||
{
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
bool ok = true;
|
||||
if( myConv==0 )
|
||||
{
|
||||
CASCatch_TRY
|
||||
{
|
||||
f = pow( 10, f );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
f = 0.0;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else if( myConv==1 && f<0.0 )
|
||||
f = 0.0;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
FunctionIntegral::FunctionIntegral( const Function* f, const double st )
|
||||
: Function( -1 ),
|
||||
myFunc( const_cast<Function*>( f ) ),
|
||||
myStart( st )
|
||||
{
|
||||
}
|
||||
|
||||
FunctionIntegral::~FunctionIntegral()
|
||||
{
|
||||
}
|
||||
|
||||
bool FunctionIntegral::value( const double t, double& f ) const
|
||||
{
|
||||
f = myFunc ? myFunc->integral( myStart, t ) : 0;
|
||||
return myFunc!=0 && Function::value( t, f );
|
||||
}
|
||||
|
||||
double FunctionIntegral::integral( const double, const double ) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FunctionTable::FunctionTable( const std::vector<double>& data, const int conv )
|
||||
: Function( conv )
|
||||
{
|
||||
myData = data;
|
||||
}
|
||||
|
||||
FunctionTable::~FunctionTable()
|
||||
{
|
||||
}
|
||||
|
||||
bool FunctionTable::value( const double t, double& f ) const
|
||||
{
|
||||
int i1, i2;
|
||||
if( !findBounds( t, i1, i2 ) )
|
||||
return false;
|
||||
|
||||
double
|
||||
x1 = myData[2*i1], y1 = myData[2*i1+1],
|
||||
x2 = myData[2*i2], y2 = myData[2*i2+1];
|
||||
|
||||
Function::value( x1, y1 );
|
||||
Function::value( x2, y2 );
|
||||
|
||||
f = y1 + ( y2-y1 ) * ( t-x1 ) / ( x2-x1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const int i ) const
|
||||
{
|
||||
if( i>=0 && i<myData.size()-1 )
|
||||
return integral( i, myData[2*(i+1)]-myData[2*i] );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const int i, const double d ) const
|
||||
{
|
||||
double f, res = 0.0;
|
||||
if( value( myData[2*i]+d, f ) )
|
||||
res = ( myData[2*i+1] + f ) / 2.0 * d;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const double a, const double b ) const
|
||||
{
|
||||
int x1s, x1f, x2s, x2f;
|
||||
findBounds( a, x1s, x1f );
|
||||
findBounds( b, x2s, x2f );
|
||||
double J = 0;
|
||||
for( int i=x1s; i<x2s; i++ )
|
||||
J+=integral( i );
|
||||
J-=integral( x1s, a-myData[2*x1s] );
|
||||
J+=integral( x2s, b-myData[2*x2s] );
|
||||
return J;
|
||||
}
|
||||
|
||||
bool FunctionTable::findBounds( const double x, int& x_ind_1, int& x_ind_2 ) const
|
||||
{
|
||||
int n = myData.size();
|
||||
if( n==0 || x<myData[0] )
|
||||
{
|
||||
x_ind_1 = x_ind_2 = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int i=0; i<n-1; i++ )
|
||||
if( myData[2*i]<=x && x<=myData[2*(i+1)] )
|
||||
{
|
||||
x_ind_1 = i;
|
||||
x_ind_2 = i+1;
|
||||
return true;
|
||||
}
|
||||
x_ind_1 = n-1;
|
||||
x_ind_2 = n-1;
|
||||
return false;
|
||||
}
|
||||
|
||||
FunctionExpr::FunctionExpr( const char* str, const int conv )
|
||||
: Function( conv ),
|
||||
myVars( 1, 1 ),
|
||||
myValues( 1, 1 )
|
||||
{
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
bool ok = true;
|
||||
CASCatch_TRY
|
||||
{
|
||||
myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( ( Standard_CString )str );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
ok = false;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
|
||||
if( !ok || !myExpr->IsDone() )
|
||||
myExpr.Nullify();
|
||||
|
||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||
}
|
||||
|
||||
FunctionExpr::~FunctionExpr()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean FunctionExpr::Value( Standard_Real T, Standard_Real& F )
|
||||
{
|
||||
double f;
|
||||
Standard_Boolean res = value( T, f );
|
||||
F = f;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool FunctionExpr::value( const double t, double& f ) const
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
return false;
|
||||
|
||||
OSD::SetSignal( true );
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
( ( TColStd_Array1OfReal& )myValues ).ChangeValue( 1 ) = t;
|
||||
bool ok = true;
|
||||
CASCatch_TRY {
|
||||
f = myExpr->Expression()->Evaluate( myVars, myValues );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure) {
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
f = 0.0;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
aCatchSignals.Deactivate();
|
||||
ok = Function::value( t, f ) && ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
double FunctionExpr::integral( const double a, const double b ) const
|
||||
{
|
||||
double res = 0.0;
|
||||
CASCatch_TRY
|
||||
{
|
||||
math_GaussSingleIntegration _int( ( math_Function& )*this, a, b, 20 );
|
||||
if( _int.IsDone() )
|
||||
res = _int.Value();
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
res = 0.0;
|
||||
MESSAGE( "Exception in integral calculating" );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double dihotomySolve( Function& f, const double val, const double _start, const double _fin, const double eps, bool& ok )
|
||||
{
|
||||
double start = _start, fin = _fin, start_val, fin_val; bool ok1, ok2;
|
||||
ok1 = f.value( start, start_val );
|
||||
ok2 = f.value( fin, fin_val );
|
||||
|
||||
if( !ok1 || !ok2 )
|
||||
{
|
||||
ok = false;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool start_pos = start_val>=val, fin_pos = fin_val>=val;
|
||||
ok = true;
|
||||
|
||||
while( fin-start>eps )
|
||||
{
|
||||
double mid = ( start+fin )/2.0, mid_val;
|
||||
ok = f.value( mid, mid_val );
|
||||
if( !ok )
|
||||
return 0.0;
|
||||
|
||||
//char buf[1024];
|
||||
//sprintf( buf, "start=%f\nfin=%f\nmid_val=%f\n", float( start ), float( fin ), float( mid_val ) );
|
||||
//MESSAGE( buf );
|
||||
|
||||
bool mid_pos = mid_val>=val;
|
||||
if( start_pos!=mid_pos )
|
||||
{
|
||||
fin_pos = mid_pos;
|
||||
fin = mid;
|
||||
}
|
||||
else if( fin_pos!=mid_pos )
|
||||
{
|
||||
start_pos = mid_pos;
|
||||
start = mid;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (start+fin)/2.0;
|
||||
}
|
||||
|
||||
bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end,
|
||||
const int nbSeg, vector<double>& data, const double eps )
|
||||
{
|
||||
FunctionExpr F( f.ToCString(), conv );
|
||||
return buildDistribution( F, start, end, nbSeg, data, eps );
|
||||
}
|
||||
|
||||
bool buildDistribution( const std::vector<double>& f, const int conv, const double start, const double end,
|
||||
const int nbSeg, vector<double>& data, const double eps )
|
||||
{
|
||||
FunctionTable F( f, conv );
|
||||
return buildDistribution( F, start, end, nbSeg, data, eps );
|
||||
}
|
||||
|
||||
bool buildDistribution( const Function& func, const double start, const double end, const int nbSeg,
|
||||
vector<double>& data, const double eps )
|
||||
{
|
||||
if( nbSeg<=0 )
|
||||
return false;
|
||||
|
||||
data.resize( nbSeg+1 );
|
||||
data[0] = start;
|
||||
double J = func.integral( start, end ) / nbSeg;
|
||||
if( J<1E-10 )
|
||||
return false;
|
||||
|
||||
bool ok;
|
||||
//MESSAGE( "distribution:" );
|
||||
//char buf[1024];
|
||||
for( int i=1; i<nbSeg; i++ )
|
||||
{
|
||||
FunctionIntegral f_int( &func, data[i-1] );
|
||||
data[i] = dihotomySolve( f_int, J, data[i-1], end, eps, ok );
|
||||
//sprintf( buf, "%f\n", float( data[i] ) );
|
||||
//MESSAGE( buf );
|
||||
if( !ok )
|
||||
return false;
|
||||
}
|
||||
|
||||
data[nbSeg] = end;
|
||||
return true;
|
||||
}
|
113
src/StdMeshers/StdMeshers_Distribution.hxx
Normal file
113
src/StdMeshers/StdMeshers_Distribution.hxx
Normal file
@ -0,0 +1,113 @@
|
||||
// SMESH StdMeshers : implementaion of point distribution algorithm
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Distribution.hxx
|
||||
// Author : Alexandre SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _STD_MESHERS_DISTRIBUTION_HXX_
|
||||
#define _STD_MESHERS_DISTRIBUTION_HXX_
|
||||
|
||||
#include <vector>
|
||||
#include <math_Function.hxx>
|
||||
#include <ExprIntrp_GenExp.hxx>
|
||||
#include <Expr_Array1OfNamedUnknown.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
|
||||
class Function
|
||||
{
|
||||
public:
|
||||
Function( const int );
|
||||
virtual ~Function();
|
||||
virtual bool value( const double, double& ) const;
|
||||
virtual double integral( const double, const double ) const = 0;
|
||||
|
||||
private:
|
||||
int myConv;
|
||||
};
|
||||
|
||||
class FunctionIntegral : public Function
|
||||
{
|
||||
public:
|
||||
FunctionIntegral( const Function*, const double );
|
||||
virtual ~FunctionIntegral();
|
||||
virtual bool value( const double, double& ) const;
|
||||
virtual double integral( const double, const double ) const;
|
||||
|
||||
private:
|
||||
Function* myFunc;
|
||||
double myStart;
|
||||
};
|
||||
|
||||
class FunctionTable : public Function
|
||||
{
|
||||
public:
|
||||
FunctionTable( const std::vector<double>&, const int );
|
||||
virtual ~FunctionTable();
|
||||
virtual bool value( const double, double& ) const;
|
||||
virtual double integral( const double, const double ) const;
|
||||
|
||||
private:
|
||||
bool findBounds( const double, int&, int& ) const;
|
||||
|
||||
//integral from x[i] to x[i+1]
|
||||
double integral( const int i ) const;
|
||||
|
||||
//integral from x[i] to x[i]+d
|
||||
//warning: function is presented as linear on interaval from x[i] to x[i]+d,
|
||||
// for correct result d must be >=0 and <=x[i+1]-x[i]
|
||||
double integral( const int i, const double d ) const;
|
||||
|
||||
private:
|
||||
std::vector<double> myData;
|
||||
};
|
||||
|
||||
class FunctionExpr : public Function, public math_Function
|
||||
{
|
||||
public:
|
||||
FunctionExpr( const char*, const int );
|
||||
virtual ~FunctionExpr();
|
||||
virtual Standard_Boolean Value( Standard_Real, Standard_Real& );
|
||||
virtual bool value( const double, double& ) const;
|
||||
virtual double integral( const double, const double ) const;
|
||||
|
||||
private:
|
||||
Handle(ExprIntrp_GenExp) myExpr;
|
||||
Expr_Array1OfNamedUnknown myVars;
|
||||
TColStd_Array1OfReal myValues;
|
||||
};
|
||||
|
||||
bool buildDistribution( const Function& f,
|
||||
const double start, const double end,
|
||||
const int nbSeg,
|
||||
vector<double>& data,
|
||||
const double eps );
|
||||
|
||||
bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end,
|
||||
const int nbSeg, vector<double>& data, const double eps );
|
||||
bool buildDistribution( const std::vector<double>& f, const int conv, const double start, const double end,
|
||||
const int nbSeg, vector<double>& data, const double eps );
|
||||
|
||||
#endif
|
@ -29,6 +29,7 @@
|
||||
|
||||
using namespace std;
|
||||
#include "StdMeshers_NumberOfSegments.hxx"
|
||||
#include "StdMeshers_Distribution.hxx"
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <ExprIntrp_GenExp.hxx>
|
||||
@ -55,7 +56,7 @@ StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments(int hypId, int studyId,
|
||||
_numberOfSegments(1),
|
||||
_distrType(DT_Regular),
|
||||
_scaleFactor(1.),
|
||||
_expMode(false)
|
||||
_convMode(1) //cut negative by default
|
||||
{
|
||||
_name = "NumberOfSegments";
|
||||
_param_algo_dim = 1;
|
||||
@ -71,6 +72,28 @@ StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments()
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
const std::vector<double>& StdMeshers_NumberOfSegments::BuildDistributionExpr( const char* expr, int nbSeg, int conv )
|
||||
throw ( SALOME_Exception )
|
||||
{
|
||||
if( !buildDistribution( TCollection_AsciiString( ( Standard_CString )expr ), conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
|
||||
_distr.resize( 0 );
|
||||
return _distr;
|
||||
}
|
||||
|
||||
const std::vector<double>& StdMeshers_NumberOfSegments::BuildDistributionTab( const std::vector<double>& tab,
|
||||
int nbSeg, int conv )
|
||||
throw ( SALOME_Exception )
|
||||
{
|
||||
if( !buildDistribution( tab, conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
|
||||
_distr.resize( 0 );
|
||||
return _distr;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
@ -186,10 +209,31 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
|
||||
double prev = -PRECISION;
|
||||
bool isSame = table.size() == _table.size();
|
||||
|
||||
OSD::SetSignal( true );
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
bool pos = false;
|
||||
for (i=0; i < table.size()/2; i++) {
|
||||
double par = table[i*2];
|
||||
double val = table[i*2+1];
|
||||
if( _convMode==0 )
|
||||
{
|
||||
CASCatch_TRY
|
||||
{
|
||||
val = pow( 10.0, val );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
throw SALOME_Exception( LOCALIZED( "invalid value"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if( _convMode==1 && val<0.0 )
|
||||
val = 0.0;
|
||||
|
||||
if ( par<0 || par > 1)
|
||||
throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
|
||||
if ( fabs(par-prev)<PRECISION )
|
||||
@ -207,6 +251,7 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
|
||||
}
|
||||
prev = par;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
|
||||
if( !pos )
|
||||
throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
|
||||
@ -263,21 +308,39 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
|
||||
* ( result in 'syntax' ) and if only 't' is unknown variable in expression ( result in 'args' )
|
||||
*/
|
||||
//================================================================================
|
||||
bool process( const TCollection_AsciiString& str,
|
||||
bool process( const TCollection_AsciiString& str, int convMode,
|
||||
bool& syntax, bool& args,
|
||||
bool& non_neg, bool& non_zero,
|
||||
bool& singulars, double& sing_point )
|
||||
{
|
||||
Handle( ExprIntrp_GenExp ) myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( str.ToCString() );
|
||||
OSD::SetSignal( true );
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
if( myExpr->IsDone() )
|
||||
bool parsed_ok = true;
|
||||
Handle( ExprIntrp_GenExp ) myExpr;
|
||||
CASCatch_TRY
|
||||
{
|
||||
myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( str.ToCString() );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
parsed_ok = false;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
|
||||
syntax = false;
|
||||
args = false;
|
||||
if( parsed_ok && myExpr->IsDone() )
|
||||
{
|
||||
syntax = true;
|
||||
args = isCorrectArg( myExpr->Expression() );
|
||||
}
|
||||
|
||||
bool res = syntax && args;
|
||||
bool res = parsed_ok && syntax && args;
|
||||
if( !res )
|
||||
myExpr.Nullify();
|
||||
|
||||
@ -287,42 +350,27 @@ bool process( const TCollection_AsciiString& str,
|
||||
|
||||
if( res )
|
||||
{
|
||||
OSD::SetSignal( true );
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
double res;
|
||||
Expr_Array1OfNamedUnknown myVars( 1, 1 );
|
||||
TColStd_Array1OfReal myValues( 1, 1 );
|
||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||
|
||||
FunctionExpr f( str.ToCString(), convMode );
|
||||
const int max = 500;
|
||||
for( int i=0; i<=max; i++ )
|
||||
{
|
||||
double t = double(i)/double(max);
|
||||
myValues.ChangeValue( 1 ) = t;
|
||||
CASCatch_TRY
|
||||
{
|
||||
res = myExpr->Expression()->Evaluate( myVars, myValues );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
double t = double(i)/double(max), val;
|
||||
if( !f.value( t, val ) )
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
sing_point = t;
|
||||
singulars = true;
|
||||
break;
|
||||
}
|
||||
if( res<0 )
|
||||
if( val<0 )
|
||||
{
|
||||
non_neg = false;
|
||||
break;
|
||||
}
|
||||
if( res>PRECISION )
|
||||
if( val>PRECISION )
|
||||
non_zero = true;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
}
|
||||
return res && non_neg && ( !singulars );
|
||||
return res && non_neg && non_zero && ( !singulars );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -346,7 +394,7 @@ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr)
|
||||
|
||||
bool syntax, args, non_neg, singulars, non_zero;
|
||||
double sing_point;
|
||||
bool res = true;//process( str, syntax, args, non_neg, non_zero, singulars, sing_point );
|
||||
bool res = process( str, _convMode, syntax, args, non_neg, non_zero, singulars, sing_point );
|
||||
if( !res )
|
||||
{
|
||||
if( !syntax )
|
||||
@ -395,15 +443,15 @@ const char* StdMeshers_NumberOfSegments::GetExpressionFunction() const
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_NumberOfSegments::SetExponentMode(bool isExp)
|
||||
void StdMeshers_NumberOfSegments::SetConversionMode( int conv )
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
|
||||
throw SALOME_Exception(LOCALIZED("not a functional distribution"));
|
||||
|
||||
if (isExp != _expMode)
|
||||
if( conv != _convMode )
|
||||
{
|
||||
_expMode = isExp;
|
||||
_convMode = conv;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
@ -414,12 +462,12 @@ void StdMeshers_NumberOfSegments::SetExponentMode(bool isExp)
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshers_NumberOfSegments::IsExponentMode() const
|
||||
int StdMeshers_NumberOfSegments::ConversionMode() const
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
|
||||
throw SALOME_Exception(LOCALIZED("not a functional distribution"));
|
||||
return _expMode;
|
||||
return _convMode;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -451,7 +499,7 @@ ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
|
||||
}
|
||||
|
||||
if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc)
|
||||
save << " " << (int)_expMode;
|
||||
save << " " << _convMode;
|
||||
|
||||
return save;
|
||||
}
|
||||
@ -563,7 +611,7 @@ istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
|
||||
{
|
||||
isOK = (load >> a);
|
||||
if (isOK)
|
||||
_expMode = (bool) a;
|
||||
_convMode = a;
|
||||
else
|
||||
load.clear(ios::badbit | load.rdstate());
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ public:
|
||||
StdMeshers_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen);
|
||||
virtual ~StdMeshers_NumberOfSegments();
|
||||
|
||||
// Builds point distribution according to passed function
|
||||
const std::vector<double>& BuildDistributionExpr( const char*, int, int ) throw ( SALOME_Exception );
|
||||
const std::vector<double>& BuildDistributionTab( const std::vector<double>&, int, int ) throw ( SALOME_Exception );
|
||||
|
||||
/*!
|
||||
* \brief Set the number of segments
|
||||
* \param segmentsNumber - must be greater than zero
|
||||
@ -138,22 +142,23 @@ public:
|
||||
throw (SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* \brief When exponent mode is set, the function of distribution of density
|
||||
* is used as an exponent of 10, i,e, 10^f(t). This mode is sensible only when
|
||||
* function distribution is used (DT_TabFunc or DT_ExprFunc)
|
||||
* \param isExp - boolean switching on/off the mode
|
||||
* \brief Set conversion mode. When it is 0, it means "exponent mode":
|
||||
* the function of distribution of density is used as an exponent of 10, i,e, 10^f(t).
|
||||
* When it is 1, it means "cut negative mode". The function of distribution is used as
|
||||
* F(t), where F(t0)=f(t0), if f(t0)>=0, otherwise F(t0) = 0.
|
||||
* This mode is sensible only when function distribution is used (DT_TabFunc or DT_ExprFunc)
|
||||
*
|
||||
* Throws SALOME_Exception if distribution type is not functional
|
||||
*/
|
||||
void SetExponentMode(bool isExp)
|
||||
void SetConversionMode( int conv )
|
||||
throw (SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* \brief Returns true if the exponent mode is set
|
||||
* \brief Returns conversion mode
|
||||
*
|
||||
* Throws SALOME_Exception if distribution type is not functional
|
||||
*/
|
||||
bool IsExponentMode() const
|
||||
int ConversionMode() const
|
||||
throw (SALOME_Exception);
|
||||
|
||||
virtual ostream & SaveTo(ostream & save);
|
||||
@ -165,9 +170,9 @@ protected:
|
||||
int _numberOfSegments; //!< an edge will be split on to this number of segments
|
||||
DistrType _distrType; //!< the type of distribution of density function
|
||||
double _scaleFactor; //!< the scale parameter for DT_Scale
|
||||
std::vector<double> _table; //!< the table for DT_TabFunc, a sequence of pairs of numbers
|
||||
std::vector<double> _table, _distr; //!< the table for DT_TabFunc, a sequence of pairs of numbers
|
||||
std::string _func; //!< the expression of the function for DT_ExprFunc
|
||||
bool _expMode; //!< flag of exponent mode
|
||||
int _convMode; //!< flag of conversion mode: 0=exponent, 1=cut negative
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,9 +30,12 @@
|
||||
using namespace std;
|
||||
|
||||
#include "StdMeshers_Regular_1D.hxx"
|
||||
#include "StdMeshers_Distribution.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
|
||||
#include <OSD.hxx>
|
||||
|
||||
#include "StdMeshers_LocalLength.hxx"
|
||||
#include "StdMeshers_NumberOfSegments.hxx"
|
||||
#include "StdMeshers_Arithmetic1D.hxx"
|
||||
@ -64,12 +67,6 @@ using namespace std;
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <ExprIntrp_GenExp.hxx>
|
||||
|
||||
#include <CASCatch_CatchSignals.hxx>
|
||||
#include <CASCatch_Failure.hxx>
|
||||
#include <CASCatch_ErrorHandler.hxx>
|
||||
#include <OSD.hxx>
|
||||
#include <math_GaussSingleIntegration.hxx>
|
||||
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
|
||||
@ -167,7 +164,7 @@ bool StdMeshers_Regular_1D::CheckHypothesis
|
||||
}
|
||||
if (_ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_TabFunc ||
|
||||
_ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_ExprFunc)
|
||||
_ivalue[ EXP_MODE_IND ] = (int) hyp->IsExponentMode();
|
||||
_ivalue[ CONV_MODE_IND ] = hyp->ConversionMode();
|
||||
_hypType = NB_SEGMENTS;
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
@ -266,304 +263,13 @@ static void compensateError(double a1, double an,
|
||||
}
|
||||
}
|
||||
|
||||
class Function
|
||||
{
|
||||
public:
|
||||
Function( const bool exp )
|
||||
: myExp( exp )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Function()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool value( const double, double& f )
|
||||
{
|
||||
if( myExp )
|
||||
f = pow( 10, f );
|
||||
return true;
|
||||
}
|
||||
virtual double integral( const double, const double ) = 0;
|
||||
|
||||
private:
|
||||
bool myExp;
|
||||
};
|
||||
|
||||
class FunctionIntegral : public Function
|
||||
{
|
||||
public:
|
||||
FunctionIntegral( Function*, const double );
|
||||
virtual ~FunctionIntegral();
|
||||
virtual bool value( const double, double& );
|
||||
virtual double integral( const double, const double );
|
||||
|
||||
private:
|
||||
Function* myFunc;
|
||||
double myStart;
|
||||
};
|
||||
|
||||
FunctionIntegral::FunctionIntegral( Function* f, const double st )
|
||||
: Function( false )
|
||||
{
|
||||
myFunc = f;
|
||||
myStart = st;
|
||||
}
|
||||
|
||||
FunctionIntegral::~FunctionIntegral()
|
||||
{
|
||||
}
|
||||
|
||||
bool FunctionIntegral::value( const double t, double& f )
|
||||
{
|
||||
f = myFunc ? myFunc->integral( myStart, t ) : 0;
|
||||
return myFunc!=0 && Function::value( t, f );
|
||||
}
|
||||
|
||||
double FunctionIntegral::integral( const double, const double )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
class FunctionTable : public Function
|
||||
{
|
||||
public:
|
||||
FunctionTable( const std::vector<double>&, const bool );
|
||||
virtual ~FunctionTable();
|
||||
virtual bool value( const double, double& );
|
||||
virtual double integral( const double, const double );
|
||||
|
||||
private:
|
||||
bool findBounds( const double, int&, int& ) const;
|
||||
|
||||
//integral from x[i] to x[i+1]
|
||||
double integral( const int i );
|
||||
|
||||
//integral from x[i] to x[i]+d
|
||||
//warning: function is presented as linear on interaval from x[i] to x[i]+d,
|
||||
// for correct result d must be >=0 and <=x[i+1]-x[i]
|
||||
double integral( const int i, const double d );
|
||||
|
||||
private:
|
||||
std::vector<double> myData;
|
||||
};
|
||||
|
||||
FunctionTable::FunctionTable( const std::vector<double>& data, const bool exp )
|
||||
: Function( exp )
|
||||
{
|
||||
myData = data;
|
||||
}
|
||||
|
||||
FunctionTable::~FunctionTable()
|
||||
{
|
||||
}
|
||||
|
||||
bool FunctionTable::value( const double t, double& f )
|
||||
{
|
||||
int i1, i2;
|
||||
if( !findBounds( t, i1, i2 ) )
|
||||
return false;
|
||||
|
||||
double
|
||||
x1 = myData[2*i1], y1 = myData[2*i1+1],
|
||||
x2 = myData[2*i2], y2 = myData[2*i2+1];
|
||||
|
||||
Function::value( x1, y1 );
|
||||
Function::value( x2, y2 );
|
||||
|
||||
f = y1 + ( y2-y1 ) * ( t-x1 ) / ( x2-x1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const int i )
|
||||
{
|
||||
if( i>=0 && i<myData.size()-1 )
|
||||
return integral( i, myData[2*(i+1)]-myData[2*i] );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const int i, const double d )
|
||||
{
|
||||
double f, res = 0.0;
|
||||
if( value( myData[2*i]+d, f ) )
|
||||
res = ( myData[2*i] + f ) / 2.0 * d;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
double FunctionTable::integral( const double a, const double b )
|
||||
{
|
||||
int x1s, x1f, x2s, x2f;
|
||||
findBounds( a, x1s, x1f );
|
||||
findBounds( b, x2s, x2f );
|
||||
double J = 0;
|
||||
for( int i=x1s; i<x2s; i++ )
|
||||
J+=integral( i );
|
||||
J-=integral( x1s, a-myData[2*x1s] );
|
||||
J+=integral( x2s, b-myData[2*x2s] );
|
||||
return J;
|
||||
}
|
||||
|
||||
bool FunctionTable::findBounds( const double x, int& x_ind_1, int& x_ind_2 ) const
|
||||
{
|
||||
int n = myData.size();
|
||||
if( n==0 || x<myData[0] )
|
||||
{
|
||||
x_ind_1 = x_ind_2 = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int i=0; i<n-1; i++ )
|
||||
if( myData[2*i]<=x && x<=myData[2*(i+1)] )
|
||||
{
|
||||
x_ind_1 = i;
|
||||
x_ind_2 = i+1;
|
||||
return true;
|
||||
}
|
||||
x_ind_1 = n-1;
|
||||
x_ind_2 = n-1;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class FunctionExpr : public Function, public math_Function
|
||||
{
|
||||
public:
|
||||
FunctionExpr( const char*, const bool );
|
||||
virtual ~FunctionExpr();
|
||||
virtual Standard_Boolean Value( Standard_Real, Standard_Real& );
|
||||
virtual bool value( const double, double& ); //inherited from Function
|
||||
virtual double integral( const double, const double );
|
||||
|
||||
private:
|
||||
Handle(ExprIntrp_GenExp) myExpr;
|
||||
Expr_Array1OfNamedUnknown myVars;
|
||||
TColStd_Array1OfReal myValues;
|
||||
};
|
||||
|
||||
FunctionExpr::FunctionExpr( const char* str, const bool exp )
|
||||
: Function( exp ),
|
||||
myVars( 1, 1 ),
|
||||
myValues( 1, 1 )
|
||||
{
|
||||
myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( ( Standard_CString )str );
|
||||
if( !myExpr->IsDone() )
|
||||
myExpr.Nullify();
|
||||
|
||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||
}
|
||||
|
||||
FunctionExpr::~FunctionExpr()
|
||||
{
|
||||
}
|
||||
|
||||
Standard_Boolean FunctionExpr::Value( Standard_Real T, Standard_Real& F )
|
||||
{
|
||||
double f;
|
||||
Standard_Boolean res = value( T, f );
|
||||
F = f;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool FunctionExpr::value( const double t, double& f )
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
return false;
|
||||
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
myValues.ChangeValue( 1 ) = t;
|
||||
bool ok = true;
|
||||
CASCatch_TRY {
|
||||
f = myExpr->Expression()->Evaluate( myVars, myValues );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure) {
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
f = 0.0;
|
||||
}
|
||||
|
||||
aCatchSignals.Deactivate();
|
||||
ok = Function::value( t, f ) && ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
double FunctionExpr::integral( const double a, const double b )
|
||||
{
|
||||
double res = 0.0;
|
||||
CASCatch_TRY
|
||||
{
|
||||
math_GaussSingleIntegration _int( *this, a, b, 20 );
|
||||
if( _int.IsDone() )
|
||||
res = _int.Value();
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
res = 0.0;
|
||||
MESSAGE( "Exception in integral calculating" );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
double dihotomySolve( Function& f, const double val, const double _start, const double _fin, const double eps, bool& ok )
|
||||
{
|
||||
double start = _start, fin = _fin, start_val, fin_val; bool ok1, ok2;
|
||||
ok1 = f.value( start, start_val );
|
||||
ok2 = f.value( fin, fin_val );
|
||||
|
||||
if( !ok1 || !ok2 )
|
||||
{
|
||||
ok = false;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool start_pos = start_val>=val, fin_pos = fin_val>=val;
|
||||
ok = true;
|
||||
|
||||
while( fin-start>eps )
|
||||
{
|
||||
double mid = ( start+fin )/2.0, mid_val;
|
||||
ok = f.value( mid, mid_val );
|
||||
if( !ok )
|
||||
return 0.0;
|
||||
|
||||
// char buf[1024];
|
||||
// sprintf( buf, "start=%f\nfin=%f\nmid_val=%f\n", float( start ), float( fin ), float( mid_val ) );
|
||||
// MESSAGE( buf );
|
||||
|
||||
bool mid_pos = mid_val>=val;
|
||||
if( start_pos!=mid_pos )
|
||||
{
|
||||
fin_pos = mid_pos;
|
||||
fin = mid;
|
||||
}
|
||||
else if( fin_pos!=mid_pos )
|
||||
{
|
||||
start_pos = mid_pos;
|
||||
start = mid;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
return (start+fin)/2.0;
|
||||
}
|
||||
|
||||
static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
|
||||
double length, bool theReverse,
|
||||
int nbSeg, Function& func,
|
||||
list<double>& theParams)
|
||||
{
|
||||
OSD::SetSignal( true );
|
||||
|
||||
if( nbSeg<=0 )
|
||||
return false;
|
||||
|
||||
@ -572,18 +278,9 @@ static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
|
||||
int nbPnt = 1 + nbSeg;
|
||||
vector<double> x(nbPnt, 0.);
|
||||
|
||||
x[0] = 0.0;
|
||||
double J = func.integral( 0.0, 1.0 ) / nbSeg;
|
||||
bool ok;
|
||||
for( int i=1; i<nbSeg; i++ )
|
||||
{
|
||||
FunctionIntegral f_int( &func, x[i-1] );
|
||||
x[i] = dihotomySolve( f_int, J, x[i-1], 1.0, 1E-4, ok );
|
||||
if( !ok )
|
||||
return false;
|
||||
}
|
||||
if( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ) )
|
||||
return false;
|
||||
|
||||
x[nbSeg] = 1.0;
|
||||
MESSAGE( "Points:\n" );
|
||||
char buf[1024];
|
||||
for( int i=0; i<=nbSeg; i++ )
|
||||
@ -673,7 +370,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(const TopoDS_Edge& theEdge
|
||||
break;
|
||||
case StdMeshers_NumberOfSegments::DT_TabFunc:
|
||||
{
|
||||
FunctionTable func(_vvalue[ TAB_FUNC_IND ], (bool)_ivalue[ EXP_MODE_IND ]);
|
||||
FunctionTable func(_vvalue[ TAB_FUNC_IND ], _ivalue[ CONV_MODE_IND ]);
|
||||
return computeParamByFunc(C3d, f, l, length, theReverse,
|
||||
_ivalue[ NB_SEGMENTS_IND ], func,
|
||||
theParams);
|
||||
@ -681,7 +378,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(const TopoDS_Edge& theEdge
|
||||
break;
|
||||
case StdMeshers_NumberOfSegments::DT_ExprFunc:
|
||||
{
|
||||
FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), (bool)_ivalue[ EXP_MODE_IND ]);
|
||||
FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), _ivalue[ CONV_MODE_IND ]);
|
||||
return computeParamByFunc(C3d, f, l, length, theReverse,
|
||||
_ivalue[ NB_SEGMENTS_IND ], func,
|
||||
theParams);
|
||||
@ -705,6 +402,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(const TopoDS_Edge& theEdge
|
||||
double param = Discret.Parameter(i);
|
||||
theParams.push_back( param );
|
||||
}
|
||||
compensateError( eltSize, eltSize, f, l, length, C3d, theParams ); // for PAL9899
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
enum IValueIndex {
|
||||
NB_SEGMENTS_IND = 0,
|
||||
DISTR_TYPE_IND = 1,
|
||||
EXP_MODE_IND = 2
|
||||
CONV_MODE_IND = 2
|
||||
};
|
||||
|
||||
enum VValueIndex {
|
||||
|
@ -23,7 +23,6 @@
|
||||
# File : Makefile.in
|
||||
# Author : Julia DOROVSKIKH
|
||||
# Module : SMESH
|
||||
# $Header$
|
||||
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=../..
|
||||
@ -42,24 +41,28 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/sal
|
||||
LIB = libStdMeshersGUI.la
|
||||
LIB_SRC = \
|
||||
StdMeshersGUI.cxx \
|
||||
StdMeshersGUI_CreateHypothesisDlg.cxx \
|
||||
StdMeshersGUI_CreateStdHypothesisDlg.cxx \
|
||||
StdMeshersGUI_Parameters.cxx
|
||||
StdMeshersGUI_StdHypothesisCreator.cxx \
|
||||
StdMeshersGUI_DistrPreview.cxx \
|
||||
StdMeshersGUI_DistrTable.cxx \
|
||||
StdMeshersGUI_NbSegmentsCreator.cxx
|
||||
|
||||
LIB_MOC = \
|
||||
StdMeshersGUI_CreateHypothesisDlg.h \
|
||||
StdMeshersGUI_CreateStdHypothesisDlg.h
|
||||
StdMeshersGUI_StdHypothesisCreator.h \
|
||||
StdMeshersGUI_DistrPreview.h \
|
||||
StdMeshersGUI_DistrTable.h \
|
||||
StdMeshersGUI_NbSegmentsCreator.h
|
||||
|
||||
EXPORT_HEADERS = StdMeshersGUI_CreateHypothesisDlg.h \
|
||||
StdMeshersGUI_Parameters.h
|
||||
EXPORT_HEADERS =
|
||||
|
||||
LIB_CLIENT_IDL = \
|
||||
SALOME_Exception.idl \
|
||||
SMESH_Hypothesis.idl \
|
||||
SMESH_BasicHypothesis.idl
|
||||
SMESH_BasicHypothesis.idl \
|
||||
SMESH_Mesh.idl
|
||||
|
||||
## pb in dependencies search
|
||||
LIB_CLIENT_IDL += \
|
||||
SALOMEDS.idl \
|
||||
SALOME_GenericObj.idl \
|
||||
SALOME_ContainerManager.idl \
|
||||
SALOME_Component.idl \
|
||||
@ -72,10 +75,11 @@ LIB_SERVER_IDL =
|
||||
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
|
||||
-I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
|
||||
$(BOOST_CPPFLAGS) $(QWT_INCLUDES)
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
|
||||
|
||||
#$(OCC_CXXFLAGS)
|
||||
|
||||
LDFLAGS += -lSMESH -lVTKViewer -lSalomeApp -lSMESHObject -lSMESHFiltersSelection $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome $(QWT_LIBS)
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
|
||||
|
||||
LDFLAGS += -lSMESH -lVTKViewer -lSalomeApp -lSMESHObject -lSMESHFiltersSelection $(OCC_KERNEL_LIBS) \
|
||||
-lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome \
|
||||
$(QWT_LIBS)
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -21,152 +21,12 @@
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI.cxx
|
||||
// Author : Julia DOROVSKIKH
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESHGUI_aParameterDlg.h"
|
||||
#include "StdMeshersGUI_Parameters.h"
|
||||
#include "StdMeshersGUI_CreateStdHypothesisDlg.h"
|
||||
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
|
||||
#include <SalomeApp_Tools.h>
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=============================================================================
|
||||
/*! class HypothesisCreator
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
class StdMeshersGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
|
||||
{
|
||||
public:
|
||||
StdMeshersGUI_HypothesisCreator (const QString& aHypType,
|
||||
const QString& aServerLibName,
|
||||
SMESHGUI* aSMESHGUI)
|
||||
: myHypType(aHypType),
|
||||
myServerLibName(aServerLibName),
|
||||
mySMESHGUI(aSMESHGUI) {}
|
||||
|
||||
virtual void CreateHypothesis (const bool isAlgo, QWidget* parent = 0);
|
||||
virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp);
|
||||
|
||||
private:
|
||||
QString myHypType;
|
||||
QString myServerLibName;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
/*! HypothesisCreator::CreateHypothesis
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void StdMeshersGUI_HypothesisCreator::CreateHypothesis
|
||||
(bool isAlgo, QWidget* parent)
|
||||
{
|
||||
MESSAGE("StdMeshersGUI_HypothesisCreator::CreateHypothesis");
|
||||
|
||||
// Get default name for hypothesis/algorithm creation
|
||||
char* sHypType = (char*)myHypType.latin1();
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
|
||||
QString aHypName;
|
||||
if (aHypData)
|
||||
aHypName = aHypData->Label;
|
||||
else
|
||||
aHypName = myHypType;
|
||||
|
||||
// Create hypothesis/algorithm
|
||||
if (isAlgo)
|
||||
{
|
||||
SMESH::CreateHypothesis(myHypType, aHypName, isAlgo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( StdMeshersGUI_Parameters::HasParameters( myHypType ))
|
||||
{
|
||||
// Show Dialog for hypothesis creation
|
||||
StdMeshersGUI_CreateStdHypothesisDlg *aDlg =
|
||||
new StdMeshersGUI_CreateStdHypothesisDlg(myHypType, parent, "");
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
// int x, y ;
|
||||
// mySMESHGUI->DefineDlgPosition( aDlg, x, y ) ;
|
||||
// aDlg->move( x, y ) ;
|
||||
aDlg->exec() ; /* displays Dialog */
|
||||
}
|
||||
else
|
||||
SMESH::CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*! HypothesisCreator::EditHypothesis
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void StdMeshersGUI_HypothesisCreator::EditHypothesis
|
||||
(SMESH::SMESH_Hypothesis_ptr theHyp)
|
||||
{
|
||||
MESSAGE("StdMeshersGUI_HypothesisCreator::EditHypothesis");
|
||||
|
||||
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis(theHyp);
|
||||
|
||||
list<SMESHGUI_aParameterPtr> paramList;
|
||||
StdMeshersGUI_Parameters::GetParameters( theHyp, paramList );
|
||||
|
||||
bool modified = false;
|
||||
if ( SMESHGUI_aParameterDlg::Parameters( SMESHGUI::GetSMESHGUI(), paramList, QObject::tr("SMESH_VALUE")) )
|
||||
{
|
||||
try
|
||||
{
|
||||
modified = StdMeshersGUI_Parameters::SetParameters( theHyp, paramList );
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex)
|
||||
{
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( modified ) {
|
||||
//set new Attribute Comment for hypothesis which parameters were modified
|
||||
QString aParams = "";
|
||||
StdMeshersGUI_Parameters::GetParameters( theHyp, paramList, aParams );
|
||||
_PTR(SObject) SHyp = SMESH::FindSObject(theHyp);
|
||||
if (SHyp)
|
||||
if (!aParams.isEmpty()) {
|
||||
SMESH::SetValue(SHyp, aParams);
|
||||
//mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
|
||||
}
|
||||
|
||||
if ( listSOmesh.size() > 0 ) {
|
||||
_PTR(SObject) submSO = listSOmesh[0];
|
||||
SMESH::SMESH_Mesh_var aMesh =
|
||||
SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(submSO);
|
||||
SMESH::SMESH_subMesh_var aSubMesh =
|
||||
SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(submSO);
|
||||
if ( !aSubMesh->_is_nil() )
|
||||
aMesh = aSubMesh->GetFather();
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
|
||||
SMESH::ModifiedMesh( meshSO, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "StdMeshersGUI_StdHypothesisCreator.h"
|
||||
#include "StdMeshersGUI_NbSegmentsCreator.h"
|
||||
|
||||
//=============================================================================
|
||||
/*! GetHypothesisCreator
|
||||
@ -175,10 +35,11 @@ void StdMeshersGUI_HypothesisCreator::EditHypothesis
|
||||
//=============================================================================
|
||||
extern "C"
|
||||
{
|
||||
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator
|
||||
(QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI)
|
||||
{
|
||||
return new StdMeshersGUI_HypothesisCreator
|
||||
(aHypType, aServerLibName, aSMESHGUI);
|
||||
}
|
||||
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType )
|
||||
{
|
||||
if( aHypType=="NumberOfSegments" )
|
||||
return new StdMeshersGUI_NbSegmentsCreator();
|
||||
else
|
||||
return new StdMeshersGUI_StdHypothesisCreator( aHypType );
|
||||
}
|
||||
}
|
||||
|
@ -1,471 +0,0 @@
|
||||
// SMESH StdMeshersGUI : GUI for StdMeshers plugin
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_CreateHypothesisDlg.cxx
|
||||
// Moved here from SMESHGUI_CreateHypothesisDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "StdMeshersGUI_CreateHypothesisDlg.h"
|
||||
#include "StdMeshersGUI_Parameters.h"
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_FunctionPreview.h"
|
||||
|
||||
#include "SUIT_Application.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include "SalomeApp_Tools.h"
|
||||
#include "SalomeApp_Application.h"
|
||||
|
||||
#include "OB_Browser.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qcheckbox.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
// class : StdMeshersGUI_CreateHypothesisDlg()
|
||||
// purpose : Constructs a StdMeshersGUI_CreateHypothesisDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
StdMeshersGUI_CreateHypothesisDlg::StdMeshersGUI_CreateHypothesisDlg (const QString& hypType,
|
||||
QWidget* parent,
|
||||
const char* name,
|
||||
bool modal,
|
||||
WFlags /*fl*/)
|
||||
: QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myHypType( hypType )
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateDlgLayout
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshersGUI_CreateHypothesisDlg::CreateDlgLayout(const QString & theCaption,
|
||||
const QPixmap & theHypIcon,
|
||||
const QString & theHypTypeName)
|
||||
{
|
||||
setCaption( theCaption );
|
||||
|
||||
setSizeGripEnabled( TRUE );
|
||||
QVBoxLayout* StdMeshersGUI_CreateHypothesisDlgLayout = new QVBoxLayout( this );
|
||||
StdMeshersGUI_CreateHypothesisDlgLayout->setSpacing( 6 );
|
||||
StdMeshersGUI_CreateHypothesisDlgLayout->setMargin( 11 );
|
||||
|
||||
/***************************************************************/
|
||||
QFrame* titFrame = new QFrame( this );
|
||||
QHBoxLayout* titLay = new QHBoxLayout( titFrame, 0, 0 );
|
||||
|
||||
iconLabel = new QLabel( titFrame );
|
||||
iconLabel->setPixmap( theHypIcon );
|
||||
iconLabel->setScaledContents( false );
|
||||
iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||
typeLabel = new QLabel( titFrame );
|
||||
typeLabel->setText( theHypTypeName );
|
||||
titLay->addWidget( iconLabel, 0 );
|
||||
titLay->addWidget( typeLabel, 0 );
|
||||
titLay->addStretch( 1 );
|
||||
|
||||
StdMeshersGUI_CreateHypothesisDlgLayout->addWidget( titFrame, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
||||
GroupC1Layout->setSpacing( 6 );
|
||||
GroupC1Layout->setMargin( 11 );
|
||||
|
||||
TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
|
||||
TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
|
||||
GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
|
||||
|
||||
LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
|
||||
GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
|
||||
|
||||
myParamMap.clear();
|
||||
std::list<SMESHGUI_aParameterPtr> aParamList;
|
||||
GetParameters( myHypType, aParamList );
|
||||
ASSERT( !aParamList.empty() );
|
||||
|
||||
/* Spin boxes with labels */
|
||||
list<SMESHGUI_aParameterPtr>::iterator paramIt = aParamList.begin();
|
||||
int row;
|
||||
for ( row = 1; paramIt != aParamList.end(); paramIt++ , row++ )
|
||||
{
|
||||
SMESHGUI_aParameterPtr param = (*paramIt);
|
||||
QLabel * label = new QLabel( GroupC1, "TextLabel" );
|
||||
GroupC1Layout->addWidget( label, row, 0 );
|
||||
label->setText( param->Label() );
|
||||
QWidget* aWidget = param->CreateWidget( GroupC1 );
|
||||
|
||||
if ( aWidget ) {
|
||||
GroupC1Layout->addWidget( aWidget, row, 1 );
|
||||
aWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
aWidget->setMinimumSize( 150, 0 );
|
||||
|
||||
QString sig = param->sigValueChanged();
|
||||
if( !sig.isEmpty() /* && param->GetType()!=SMESHGUI_aParameter::TABLE*/ )
|
||||
connect( aWidget, sig.latin1(), this, SLOT( onValueChanged() ) );
|
||||
|
||||
param->InitializeWidget( aWidget );
|
||||
|
||||
ParamInfo info;
|
||||
info.editor = aWidget;
|
||||
info.label = label;
|
||||
info.order = row-1;
|
||||
|
||||
myParamMap.insert( param, info );
|
||||
}
|
||||
}
|
||||
myPreview = new SMESHGUI_FunctionPreview( GroupC1 );
|
||||
myPreview->hide();
|
||||
GroupC1Layout->addWidget( myPreview, row, 1 );
|
||||
|
||||
StdMeshersGUI_CreateHypothesisDlgLayout->addWidget( GroupC1, 1 );
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
||||
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
|
||||
buttonOk->setAutoDefault( TRUE );
|
||||
buttonOk->setDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
||||
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
|
||||
buttonApply->setAutoDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
GroupButtonsLayout->addItem( spacer, 0, 2 );
|
||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
||||
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
||||
StdMeshersGUI_CreateHypothesisDlgLayout->addWidget( GroupButtons, 0 );
|
||||
|
||||
/***************************************************************/
|
||||
Init() ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~StdMeshersGUI_CreateHypothesisDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
StdMeshersGUI_CreateHypothesisDlg::~StdMeshersGUI_CreateHypothesisDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::Init()
|
||||
{
|
||||
ParameterMap::const_iterator anIt = myParamMap.begin(),
|
||||
aLast = myParamMap.end();
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
UpdateShown( anIt.key() );
|
||||
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
|
||||
|
||||
char* sHypType = const_cast<char*>(myHypType.latin1());
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
|
||||
LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : QString("") );
|
||||
|
||||
mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()) );
|
||||
connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
|
||||
connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
|
||||
|
||||
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
||||
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
int x, y ;
|
||||
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
|
||||
this->move( x, y ) ;
|
||||
this->show() ; /* displays Dialog */
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::ClickOnOk()
|
||||
{
|
||||
if ( ClickOnApply() )
|
||||
ClickOnCancel() ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool StdMeshersGUI_CreateHypothesisDlg::ClickOnApply()
|
||||
{
|
||||
if ( !mySMESHGUI || mySMESHGUI->isActiveStudyLocked() )
|
||||
return false;
|
||||
|
||||
QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
|
||||
if ( myHypName.isEmpty() ) {
|
||||
SUIT_MessageBox::warn1 (this, tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
|
||||
( SMESH::CreateHypothesis( myHypType, myHypName, false ) ); // isAlgorithm
|
||||
|
||||
try {
|
||||
|
||||
list<SMESHGUI_aParameterPtr> aParamList;
|
||||
ParameterMap::const_iterator anIt = myParamMap.begin(),
|
||||
aLast = myParamMap.end();
|
||||
for( int i=0; i<myParamMap.count(); i++ )
|
||||
for( anIt=myParamMap.begin(); anIt!=aLast; anIt++ )
|
||||
if( (*anIt).order==i )
|
||||
{
|
||||
anIt.key()->TakeValue( anIt.data().editor );
|
||||
aParamList.push_back( anIt.key() );
|
||||
break;
|
||||
}
|
||||
|
||||
if( !SetParameters( Hyp, aParamList ) )
|
||||
return false;
|
||||
|
||||
//set new Attribute Comment for hypothesis which parameters were set
|
||||
QString aParams = "";
|
||||
StdMeshersGUI_Parameters::GetParameters( Hyp.in(), aParamList, aParams );
|
||||
_PTR(SObject) SHyp = SMESH::FindSObject(Hyp.in());
|
||||
if (SHyp)
|
||||
if (!aParams.isEmpty())
|
||||
{
|
||||
SMESH::SetValue(SHyp, aParams);
|
||||
mySMESHGUI->getApp()->objectBrowser()->updateTree();
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex)
|
||||
{
|
||||
wc.suspend();
|
||||
|
||||
_PTR(SObject) SHyp = SMESH::FindSObject(Hyp.in());
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
if( aStudy && !aStudy->GetProperties()->IsLocked() )
|
||||
{
|
||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
aBuilder->RemoveObjectWithChildren( SHyp );
|
||||
mySMESHGUI->updateObjBrowser( true, 0 );
|
||||
}
|
||||
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::ClickOnCancel()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::DeactivateActiveDialog()
|
||||
{
|
||||
// iconLabel->setEnabled(false) ;
|
||||
// typeLabel->setEnabled(false) ;
|
||||
// GroupC1->setEnabled(false) ;
|
||||
// GroupButtons->setEnabled(false) ;
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::ActivateThisDialog()
|
||||
{
|
||||
if (! isEnabled() ) {
|
||||
mySMESHGUI->EmitSignalDeactivateDialog() ;
|
||||
// iconLabel->setEnabled(true) ;
|
||||
// typeLabel->setEnabled(true) ;
|
||||
// GroupC1->setEnabled(true) ;
|
||||
// GroupButtons->setEnabled(true) ;
|
||||
setEnabled(true) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
ActivateThisDialog() ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
mySMESHGUI->ResetState();
|
||||
QDialog::closeEvent( e );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onValueChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::onValueChanged()
|
||||
{
|
||||
if( sender()->inherits( "QWidget" ) )
|
||||
{
|
||||
QWidget* w = ( QWidget* )sender();
|
||||
|
||||
SMESHGUI_aParameterPtr param;
|
||||
|
||||
ParameterMap::const_iterator anIt = myParamMap.begin(),
|
||||
aLast = myParamMap.end();
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
if( anIt.data().editor == w )
|
||||
{
|
||||
param = anIt.key();
|
||||
param->TakeValue( w );
|
||||
|
||||
SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( param.operator->() );
|
||||
SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( param.operator->() );
|
||||
SMESHGUI_boolParameter* bool_param = dynamic_cast<SMESHGUI_boolParameter*>( param.operator->() );
|
||||
|
||||
if( str_param && str_param->needPreview() )
|
||||
{
|
||||
QString val; str_param->GetNewText( val );
|
||||
myPreview->setParams( val );
|
||||
}
|
||||
else if( tab_param && tab_param->needPreview() )
|
||||
{
|
||||
SMESH::double_array d;
|
||||
tab_param->data( d );
|
||||
myPreview->setParams( d );
|
||||
}
|
||||
else if( bool_param && bool_param->needPreview() )
|
||||
{
|
||||
int exp=0;
|
||||
bool_param->GetNewInt( exp );
|
||||
myPreview->setIsExp( exp );
|
||||
}
|
||||
UpdateShown( param );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : UpdateShown()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void StdMeshersGUI_CreateHypothesisDlg::UpdateShown( const SMESHGUI_aParameterPtr param )
|
||||
{
|
||||
SMESHGUI_dependParameter* depPar = dynamic_cast<SMESHGUI_enumParameter*>( param.get() );
|
||||
if( !depPar )
|
||||
depPar = dynamic_cast<SMESHGUI_boolParameter*>( param.get() );
|
||||
|
||||
if( !depPar )
|
||||
return;
|
||||
|
||||
SMESHGUI_dependParameter::ShownMap& map = depPar->shownMap();
|
||||
if( map.isEmpty() )
|
||||
return;
|
||||
|
||||
int val;
|
||||
depPar->TakeValue( myParamMap[ param ].editor );
|
||||
depPar->GetNewInt( val );
|
||||
|
||||
bool hasValue = map.contains( val );
|
||||
|
||||
ParameterMap::const_iterator anIt = myParamMap.begin(),
|
||||
aLast = myParamMap.end();
|
||||
bool preview = false;
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
bool shown = hasValue && map[ val ].contains( (*anIt).order );
|
||||
(*anIt).editor->setShown( shown );
|
||||
(*anIt).label->setShown( shown );
|
||||
if( shown )
|
||||
{
|
||||
SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( anIt.key().operator->() );
|
||||
SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( anIt.key().operator->() );
|
||||
preview = preview || ( str_param && str_param->needPreview() ) || ( tab_param && tab_param->needPreview() );
|
||||
}
|
||||
}
|
||||
myPreview->setShown( preview );
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_CreateHypothesisDlg.h
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_CreateHypothesisDlg_H
|
||||
#define DIALOGBOX_CreateHypothesisDlg_H
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
#include <qmap.h>
|
||||
#include <qpair.h>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESHGUI_aParameter.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class SMESHGUI;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SMESHGUI_FunctionPreview;
|
||||
|
||||
//=================================================================================
|
||||
// class : StdMeshersGUI_CreateHypothesisDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class StdMeshersGUI_CreateHypothesisDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_CreateHypothesisDlg (const QString& hypType,
|
||||
QWidget* parent = 0,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~StdMeshersGUI_CreateHypothesisDlg ();
|
||||
|
||||
protected:
|
||||
|
||||
void CreateDlgLayout(const QString & caption,
|
||||
const QPixmap & hypIcon,
|
||||
const QString & hypTypeName);
|
||||
|
||||
virtual void GetParameters( const QString& hypType,
|
||||
std::list<SMESHGUI_aParameterPtr>& ) = 0;
|
||||
|
||||
virtual bool SetParameters( SMESH::SMESH_Hypothesis_ptr theHyp,
|
||||
const std::list<SMESHGUI_aParameterPtr> & params ) = 0;
|
||||
|
||||
protected slots:
|
||||
virtual void onValueChanged();
|
||||
|
||||
private:
|
||||
void UpdateShown( const SMESHGUI_aParameterPtr );
|
||||
void Init() ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ;
|
||||
|
||||
SMESHGUI* mySMESHGUI;
|
||||
QString myHypType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QWidget* editor;
|
||||
QLabel* label;
|
||||
int order;
|
||||
|
||||
} ParamInfo;
|
||||
|
||||
typedef QMap< SMESHGUI_aParameterPtr, ParamInfo > ParameterMap;
|
||||
ParameterMap myParamMap;
|
||||
|
||||
QLabel* iconLabel;
|
||||
QLabel* typeLabel;
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabel_NameHypothesis ;
|
||||
QLineEdit* LineEdit_NameHypothesis ;
|
||||
QLabel* TextLabel_Length ;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonApply;
|
||||
QPushButton* buttonCancel;
|
||||
SMESHGUI_FunctionPreview* myPreview;
|
||||
|
||||
private slots:
|
||||
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
bool ClickOnApply();
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_LOCAL_LENGTH_H
|
@ -1,59 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_CreateStdHypothesisDlg.h
|
||||
// Moved here from SMESHGUI_CreateStdHypothesisDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_CreateStdHypothesisDlg_H
|
||||
#define DIALOGBOX_CreateStdHypothesisDlg_H
|
||||
|
||||
#include "StdMeshersGUI_CreateHypothesisDlg.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : StdMeshersGUI_CreateStdHypothesisDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class StdMeshersGUI_CreateStdHypothesisDlg : public StdMeshersGUI_CreateHypothesisDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_CreateStdHypothesisDlg (const QString& hypType,
|
||||
QWidget* parent = 0,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~StdMeshersGUI_CreateStdHypothesisDlg ();
|
||||
|
||||
private:
|
||||
virtual void GetParameters(const QString & hypType,
|
||||
std::list<SMESHGUI_aParameterPtr> & params);
|
||||
|
||||
virtual bool SetParameters(SMESH::SMESH_Hypothesis_ptr theHyp,
|
||||
const std::list<SMESHGUI_aParameterPtr> & params);
|
||||
};
|
||||
|
||||
#endif
|
358
src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx
Normal file
358
src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx
Normal file
@ -0,0 +1,358 @@
|
||||
|
||||
#include "StdMeshersGUI_DistrPreview.h"
|
||||
#include <Expr_NamedUnknown.hxx>
|
||||
#include <Expr_GeneralExpression.hxx>
|
||||
#include <CASCatch_CatchSignals.hxx>
|
||||
#include <CASCatch_Failure.hxx>
|
||||
#include <CASCatch_ErrorHandler.hxx>
|
||||
#include <OSD.hxx>
|
||||
|
||||
StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
|
||||
: QwtPlot( p ),
|
||||
myPoints( 50 ),
|
||||
myIsTable( false ),
|
||||
myVars( 1, 1 ),
|
||||
myValues( 1, 1 ),
|
||||
myConv( CUT_NEGATIVE ),
|
||||
myIsDone( true ),
|
||||
myNbSeg( 1 )
|
||||
{
|
||||
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
|
||||
myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
|
||||
myCurve1 = insertCurve( QString() );
|
||||
myCurve2 = insertCurve( QString() );
|
||||
myMsg = insertMarker( new QwtPlotMarker( this ) );
|
||||
setMarkerPos( myMsg, 0.5, 0.5 );
|
||||
setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) );
|
||||
QFont f = markerFont( myMsg );
|
||||
f.setPointSize( 14 );
|
||||
f.setBold( true );
|
||||
setMarkerFont( myMsg, f );
|
||||
setCurvePen( myCurve1, 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 ) ) );
|
||||
}
|
||||
|
||||
StdMeshersGUI_DistrPreview::~StdMeshersGUI_DistrPreview()
|
||||
{
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::isTableFunc() const
|
||||
{
|
||||
return myIsTable;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrPreview::tableFunc( SMESH::double_array& f ) const
|
||||
{
|
||||
f = myTableFunc;
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_DistrPreview::function() const
|
||||
{
|
||||
return myFunction;
|
||||
}
|
||||
|
||||
int StdMeshersGUI_DistrPreview::nbSeg() const
|
||||
{
|
||||
return myNbSeg;
|
||||
}
|
||||
|
||||
int StdMeshersGUI_DistrPreview::pointsCount() const
|
||||
{
|
||||
return myPoints;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrPreview::setConversion( Conversion conv, const bool upd )
|
||||
{
|
||||
myConv = conv;
|
||||
if( upd )
|
||||
update();
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::setParams( const QString& func, const int nbSeg, const int points, const bool upd )
|
||||
{
|
||||
myIsTable = false;
|
||||
myTableFunc = SMESH::double_array();
|
||||
myFunction = func.isEmpty() ? "0" : func;
|
||||
myPoints = points>0 ? points : 2;
|
||||
myNbSeg = nbSeg>0 ? nbSeg : 1;
|
||||
bool res = init( func );
|
||||
if( upd )
|
||||
update();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::setParams( const SMESH::double_array& f, const int nbSeg, const bool upd )
|
||||
{
|
||||
myIsTable = true;
|
||||
myTableFunc = f;
|
||||
if( myTableFunc.length()%2==1 )
|
||||
myTableFunc.length( myTableFunc.length()-1 );
|
||||
|
||||
myFunction = "0";
|
||||
myPoints = myTableFunc.length()/2;
|
||||
myNbSeg = nbSeg>0 ? nbSeg : 1;
|
||||
|
||||
if( upd )
|
||||
update();
|
||||
|
||||
return myTableFunc.length()>0;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::createTable( SMESH::double_array& func )
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
{
|
||||
func.length( 0 );
|
||||
return false;
|
||||
}
|
||||
|
||||
const double xmin = 0.0, xmax = 1.0;
|
||||
|
||||
double d = (xmax-xmin)/double(myPoints-1);
|
||||
func.length( 2*myPoints );
|
||||
int err = 0;
|
||||
for( int i=0, j=0; i<myPoints; j++ )
|
||||
{
|
||||
bool ok;
|
||||
double t = xmin + d*j, f = funcValue( t, ok );
|
||||
if( ok )
|
||||
{
|
||||
func[2*i] = t;
|
||||
func[2*i+1] = f;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
err++;
|
||||
}
|
||||
func.length( func.length()-2*err );
|
||||
return err==0;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrPreview::update()
|
||||
{
|
||||
SMESH::double_array graph, distr;
|
||||
if( isTableFunc() )
|
||||
{
|
||||
myIsDone = true;
|
||||
graph = myTableFunc;
|
||||
}
|
||||
else
|
||||
myIsDone = createTable( graph );
|
||||
|
||||
if( graph.length()>=2 )
|
||||
{
|
||||
StdMeshers::StdMeshers_NumberOfSegments_var h =
|
||||
StdMeshers::StdMeshers_NumberOfSegments::_narrow( myHypo );
|
||||
|
||||
if( !CORBA::is_nil( h.in() ) )
|
||||
{
|
||||
SMESH::double_array* arr = 0;
|
||||
if( isTableFunc() )
|
||||
arr = h->BuildDistributionTab( myTableFunc, myNbSeg, ( int )myConv );
|
||||
else
|
||||
arr = h->BuildDistributionExpr( myFunction.latin1(), myNbSeg, ( int )myConv );
|
||||
if( arr )
|
||||
{
|
||||
distr = *arr;
|
||||
delete arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool correct = graph.length()>=2 && distr.length()>=2;
|
||||
if( !correct )
|
||||
{
|
||||
showError();
|
||||
return;
|
||||
}
|
||||
else
|
||||
setMarkerLabel( myMsg, QString() );
|
||||
|
||||
int size = graph.length()/2;
|
||||
double* x = new double[size], *y = new double[size];
|
||||
double min_x, max_x, min_y, max_y;
|
||||
for( int i=0; i<size; i++ )
|
||||
{
|
||||
x[i] = graph[2*i];
|
||||
y[i] = graph[2*i+1];
|
||||
if( !convert( y[i] ) )
|
||||
{
|
||||
min_x = 0.0; max_x = 1.0; min_y = 0.0; max_y = 1.0;
|
||||
delete[] x; delete[] y;
|
||||
x = y = 0;
|
||||
showError();
|
||||
return;
|
||||
}
|
||||
if( i==0 || y[i]<min_y )
|
||||
min_y = y[i];
|
||||
if( i==0 || y[i]>max_y )
|
||||
max_y = y[i];
|
||||
if( i==0 || x[i]<min_x )
|
||||
min_x = x[i];
|
||||
if( i==0 || x[i]>max_x )
|
||||
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 );
|
||||
if( x )
|
||||
delete[] x;
|
||||
if( y )
|
||||
delete[] y;
|
||||
x = y = 0;
|
||||
|
||||
size = distr.length();
|
||||
x = new double[size];
|
||||
y = new double[size];
|
||||
for( int i=0; i<size; i++ )
|
||||
{
|
||||
x[i] = distr[i];
|
||||
y[i] = 0;
|
||||
}
|
||||
setCurveData( myCurve2, x, y, size );
|
||||
delete[] x;
|
||||
delete[] y;
|
||||
x = y = 0;
|
||||
replot();
|
||||
}
|
||||
|
||||
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 );
|
||||
setMarkerLabel( myMsg, tr( "SMESH_INVALID_FUNCTION" ) );
|
||||
replot();
|
||||
}
|
||||
|
||||
bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
|
||||
{
|
||||
Handle( Expr_NamedUnknown ) sub = Handle( Expr_NamedUnknown )::DownCast( expr );
|
||||
if( !sub.IsNull() )
|
||||
return sub->GetName()=="t";
|
||||
|
||||
bool res = true;
|
||||
for( int i=1, n=expr->NbSubExpressions(); i<=n && res; i++ )
|
||||
{
|
||||
Handle( Expr_GeneralExpression ) sub = expr->SubExpression( i );
|
||||
Handle( Expr_NamedUnknown ) name = Handle( Expr_NamedUnknown )::DownCast( sub );
|
||||
if( !name.IsNull() )
|
||||
{
|
||||
if( name->GetName()!="t" )
|
||||
res = false;
|
||||
}
|
||||
else
|
||||
res = isCorrectArg( sub );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::init( const QString& str )
|
||||
{
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
bool parsed_ok = true;
|
||||
CASCatch_TRY
|
||||
{
|
||||
myExpr = ExprIntrp_GenExp::Create();
|
||||
myExpr->Process( ( Standard_CString ) str.latin1() );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
parsed_ok = false;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
|
||||
bool syntax = false, args = false;
|
||||
if( parsed_ok && myExpr->IsDone() )
|
||||
{
|
||||
syntax = true;
|
||||
args = isCorrectArg( myExpr->Expression() );
|
||||
}
|
||||
|
||||
bool res = parsed_ok && syntax && args;
|
||||
if( !res )
|
||||
myExpr.Nullify();
|
||||
return res;
|
||||
}
|
||||
|
||||
double StdMeshersGUI_DistrPreview::funcValue( const double t, bool& ok )
|
||||
{
|
||||
if( myExpr.IsNull() )
|
||||
return 0;
|
||||
|
||||
myValues.ChangeValue( 1 ) = t;
|
||||
|
||||
ok = true;
|
||||
double res = calc( ok );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
double StdMeshersGUI_DistrPreview::calc( bool& ok )
|
||||
{
|
||||
OSD::SetSignal( true );
|
||||
double res = 0.0;
|
||||
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
ok = true;
|
||||
CASCatch_TRY {
|
||||
res = myExpr->Expression()->Evaluate( myVars, myValues );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure) {
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
ok = false;
|
||||
res = 0.0;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::isDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrPreview::convert( double& v ) const
|
||||
{
|
||||
CASCatch_CatchSignals aCatchSignals;
|
||||
aCatchSignals.Activate();
|
||||
|
||||
bool ok = true;
|
||||
switch( myConv )
|
||||
{
|
||||
case EXPONENT:
|
||||
{
|
||||
CASCatch_TRY
|
||||
{
|
||||
v = pow( 10.0, v );
|
||||
}
|
||||
CASCatch_CATCH(CASCatch_Failure)
|
||||
{
|
||||
aCatchSignals.Deactivate();
|
||||
Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
|
||||
v = 0.0;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CUT_NEGATIVE:
|
||||
if( v<0 )
|
||||
v = 0;
|
||||
break;
|
||||
}
|
||||
aCatchSignals.Deactivate();
|
||||
return ok;
|
||||
}
|
59
src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h
Normal file
59
src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
#ifndef STD_MESHERS_GUI_DISTR_PREVIEW_HEADER
|
||||
#define STD_MESHERS_GUI_DISTR_PREVIEW_HEADER
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
#include <ExprIntrp_GenExp.hxx>
|
||||
#include <Expr_Array1OfNamedUnknown.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
class StdMeshersGUI_DistrPreview : public QwtPlot
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef enum { EXPONENT, CUT_NEGATIVE } Conversion;
|
||||
|
||||
StdMeshersGUI_DistrPreview( QWidget*, StdMeshers::StdMeshers_NumberOfSegments_ptr );
|
||||
virtual ~StdMeshersGUI_DistrPreview();
|
||||
|
||||
QString function() const;
|
||||
bool isTableFunc() const;
|
||||
void tableFunc( SMESH::double_array& ) const;
|
||||
int pointsCount() const;
|
||||
int nbSeg() const;
|
||||
bool isDone() const;
|
||||
|
||||
bool setParams( const QString&, const int, const int = 50, const bool = true );
|
||||
bool setParams( const SMESH::double_array&, const int, const bool = true );
|
||||
void setConversion( Conversion, const bool = true );
|
||||
|
||||
protected:
|
||||
virtual bool init( const QString& );
|
||||
virtual double funcValue( const double, bool& );
|
||||
virtual bool createTable( SMESH::double_array& );
|
||||
virtual bool convert( double& ) const;
|
||||
void update();
|
||||
|
||||
private:
|
||||
double calc( bool& );
|
||||
void showError();
|
||||
|
||||
private:
|
||||
QString myFunction;
|
||||
int myPoints, myNbSeg;
|
||||
bool myIsTable;
|
||||
Conversion myConv;
|
||||
SMESH::double_array myTableFunc;
|
||||
long myCurve1, myCurve2, myMsg;
|
||||
Handle(ExprIntrp_GenExp) myExpr;
|
||||
Expr_Array1OfNamedUnknown myVars;
|
||||
TColStd_Array1OfReal myValues;
|
||||
bool myIsDone;
|
||||
StdMeshers::StdMeshers_NumberOfSegments_var myHypo;
|
||||
};
|
||||
|
||||
#endif
|
348
src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx
Normal file
348
src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx
Normal file
@ -0,0 +1,348 @@
|
||||
// SMESH StdMeshersGUI
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_DistrTable.cxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "StdMeshersGUI_DistrTable.h"
|
||||
#include <qlayout.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : StdMeshersGUI_DistrTable
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
StdMeshersGUI_DistrTable::StdMeshersGUI_DistrTable( const int rows, QWidget* parent, const char* name )
|
||||
: QTable( rows, 2, parent, name )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable()
|
||||
{
|
||||
}
|
||||
|
||||
QSize StdMeshersGUI_DistrTable::sizeHint() const
|
||||
{
|
||||
if( cachedSizeHint().isValid() )
|
||||
return cachedSizeHint();
|
||||
|
||||
constPolish();
|
||||
|
||||
QSize sh = QScrollView::sizeHint();
|
||||
if( sh.width()<400 )
|
||||
sh.setWidth( 400 );
|
||||
if( sh.height()<200 )
|
||||
sh.setHeight( 200 );
|
||||
|
||||
setCachedSizeHint( sh );
|
||||
return sh;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::stopEditing( const bool accept )
|
||||
{
|
||||
endEdit( currEditRow(), currEditCol(), accept, false );
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::edit( const int r, const int c )
|
||||
{
|
||||
if( isEditing() )
|
||||
endEdit( currEditRow(), currEditCol(), true, false );
|
||||
clearSelection();
|
||||
setCurrentCell( r, c );
|
||||
if( beginEdit( r, c, false ) )
|
||||
setEditMode( Editing, r, c );
|
||||
QTableSelection sel;
|
||||
sel.init( r, c );
|
||||
sel.expandTo( r, c );
|
||||
addSelection( sel );
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrTable::eventFilter( QObject* o, QEvent* e )
|
||||
{
|
||||
if( e && e->type()==QEvent::KeyPress )
|
||||
{
|
||||
QKeyEvent* ke = ( QKeyEvent* )e;
|
||||
int k = ke->key();
|
||||
if( k==Qt::Key_Tab || k==Qt::Key_BackTab || k==Qt::Key_Return || k==Qt::Key_Up || k==Qt::Key_Down )
|
||||
{
|
||||
keyPressEvent( ke );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QTable::eventFilter( o, e );
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
if( e )
|
||||
{
|
||||
int r = currentRow(), c = currentColumn(), nr, nc;
|
||||
bool shift = e->state() & Qt::ShiftButton, cr = false;
|
||||
switch( e->key() )
|
||||
{
|
||||
case Qt::Key_Tab:
|
||||
nc = c+1;
|
||||
nr = r;
|
||||
break;
|
||||
|
||||
case Qt::Key_BackTab:
|
||||
nc = c-1;
|
||||
nr = r;
|
||||
break;
|
||||
|
||||
case Qt::Key_Return:
|
||||
nc = 0;
|
||||
nr = shift ? r-1 : r+1;
|
||||
cr = true;
|
||||
break;
|
||||
|
||||
case Qt::Key_Up:
|
||||
nc = c;
|
||||
nr = r-1;
|
||||
break;
|
||||
|
||||
case Qt::Key_Down:
|
||||
nc = c;
|
||||
nr = r+1;
|
||||
break;
|
||||
|
||||
default:
|
||||
QTable::keyPressEvent( e );
|
||||
return;
|
||||
}
|
||||
|
||||
if( nc<0 )
|
||||
{
|
||||
nc=1; nr--;
|
||||
}
|
||||
if( nc>1 )
|
||||
{
|
||||
nc=0; nr++;
|
||||
}
|
||||
|
||||
if( nr>=numRows() && cr )
|
||||
{
|
||||
if( isEditing() )
|
||||
endEdit( currEditRow(), currEditCol(), true, false );
|
||||
onEdit( INSERT_ROW, nr );
|
||||
}
|
||||
|
||||
else if( nr<0 || nr>=numRows() )
|
||||
{
|
||||
nr = r; nc = c;
|
||||
}
|
||||
edit( nr, nc );
|
||||
e->accept();
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* StdMeshersGUI_DistrTable::createEditor( int r, int c, bool init ) const
|
||||
{
|
||||
QWidget* w = QTable::createEditor( r, c, init );
|
||||
if( w )
|
||||
{
|
||||
//w->installEventFilter( this );
|
||||
if( w->inherits( "QLineEdit" ) )
|
||||
{
|
||||
QLineEdit* le = ( QLineEdit* )w;
|
||||
le->setValidator( c==0 ? myArgV : myFuncV );
|
||||
}
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::onEdit( TableButton b, int cur )
|
||||
{
|
||||
switch( b )
|
||||
{
|
||||
case INSERT_ROW:
|
||||
setNumRows( numRows()+1 );
|
||||
for( int i=numRows()-1; i>=cur; i-- )
|
||||
for( int j=0; j<numCols(); j++ )
|
||||
if( i>cur )
|
||||
setText( i, j, text( i-1, j ) );
|
||||
else
|
||||
setText( i, j, "0" );
|
||||
emit( valueChanged( cur, 0 ) );
|
||||
break;
|
||||
|
||||
case REMOVE_ROW:
|
||||
if( numRows()>1 )
|
||||
{
|
||||
for( int i=cur; i<numRows(); i++ )
|
||||
for( int j=0; j<numCols(); j++ )
|
||||
setText( i, j, text( i+1, j ) );
|
||||
setNumRows( numRows()-1 );
|
||||
}
|
||||
emit( valueChanged( cur, 0 ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::sortData( SMESH::double_array& arr )
|
||||
{
|
||||
QValueList< QPair<double,double> > aData;
|
||||
if( arr.length()%2==1 )
|
||||
arr.length( arr.length()-1 );
|
||||
|
||||
int aLen = arr.length();
|
||||
for( int i=0; i<aLen/2; i++ )
|
||||
aData.append( QPair<double,double>( arr[2*i], arr[2*i+1] ) );
|
||||
|
||||
qHeapSort( aData );
|
||||
|
||||
QValueList< QPair<double,double> >::const_iterator anIt = aData.begin(), aLast = aData.end();
|
||||
QValueList<double> unique_values;
|
||||
double prev; int i=0;
|
||||
if( (*anIt).first>0.0 )
|
||||
{
|
||||
unique_values.append( 0.0 );
|
||||
unique_values.append( (*anIt).second );
|
||||
i++; prev = 0.0;
|
||||
}
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
if( i==0 || (*anIt).first>prev )
|
||||
{
|
||||
unique_values.append( (*anIt).first );
|
||||
unique_values.append( (*anIt).second );
|
||||
i++;
|
||||
}
|
||||
prev = (*anIt).first;
|
||||
}
|
||||
if( prev<1.0 )
|
||||
{
|
||||
unique_values.append( 1.0 );
|
||||
anIt--;
|
||||
unique_values.append( (*anIt).second );
|
||||
}
|
||||
|
||||
arr.length( unique_values.count() );
|
||||
QValueList<double>::const_iterator anIt1 = unique_values.begin(), aLast1 = unique_values.end();
|
||||
for( int j=0; anIt1!=aLast1; anIt1++, j++ )
|
||||
arr[j] = *anIt1;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::data( SMESH::double_array& v )
|
||||
{
|
||||
stopEditing( true );
|
||||
v.length( 2*numRows() );
|
||||
for( int i=0; i<numRows(); i++ )
|
||||
for( int j=0; j<numCols(); j++ )
|
||||
v[numCols()*i+j] = text( i, j ).toDouble();
|
||||
sortData( v );
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTable::setData( const SMESH::double_array& d )
|
||||
{
|
||||
stopEditing( false );
|
||||
setNumRows( d.length()/2 );
|
||||
for( int i=0; i<d.length(); i++ )
|
||||
setText( i/2, i%2, QString( "%1" ).arg( d[i] ) );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : StdMeshersGUI_DistrTableFrame
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
StdMeshersGUI_DistrTableFrame::StdMeshersGUI_DistrTableFrame( QWidget* parent )
|
||||
: QFrame( parent )
|
||||
{
|
||||
QVBoxLayout* main = new QVBoxLayout( this, 0, 0 );
|
||||
|
||||
myTable = new StdMeshersGUI_DistrTable( 1, this );
|
||||
connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SIGNAL( valueChanged( int, int ) ) );
|
||||
connect( this, SIGNAL( toEdit( TableButton, int ) ), myTable, SLOT( onEdit( TableButton, int ) ) );
|
||||
|
||||
QFrame* aButFrame = new QFrame( this );
|
||||
QHBoxLayout* butLay = new QHBoxLayout( aButFrame, 5, 5 );
|
||||
|
||||
myInsertRow = new QPushButton( tr( "SMESH_INSERT_ROW" ), aButFrame );
|
||||
myRemoveRow = new QPushButton( tr( "SMESH_REMOVE_ROW" ), aButFrame );
|
||||
|
||||
butLay->addWidget( myInsertRow, 0 );
|
||||
butLay->addWidget( myRemoveRow, 0 );
|
||||
butLay->addStretch( 1 );
|
||||
|
||||
main->addWidget( myTable, 1 );
|
||||
main->addWidget( aButFrame, 0 );
|
||||
|
||||
connect( myInsertRow, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
|
||||
connect( myRemoveRow, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
|
||||
}
|
||||
|
||||
StdMeshersGUI_DistrTableFrame::~StdMeshersGUI_DistrTableFrame()
|
||||
{
|
||||
}
|
||||
|
||||
StdMeshersGUI_DistrTable* StdMeshersGUI_DistrTableFrame::table() const
|
||||
{
|
||||
return myTable;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTableFrame::setShown( const TableButton b, const bool sh )
|
||||
{
|
||||
if( button( b ) )
|
||||
button( b )->setShown( sh );
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_DistrTableFrame::isShown( const TableButton b ) const
|
||||
{
|
||||
bool res = false;
|
||||
if( button( b ) )
|
||||
res = button( b )->isShown();
|
||||
return res;
|
||||
}
|
||||
|
||||
QButton* StdMeshersGUI_DistrTableFrame::button( const TableButton b ) const
|
||||
{
|
||||
QButton* res = 0;
|
||||
switch( b )
|
||||
{
|
||||
case INSERT_ROW:
|
||||
res = myInsertRow;
|
||||
break;
|
||||
|
||||
case REMOVE_ROW:
|
||||
res = myRemoveRow;
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_DistrTableFrame::onButtonClicked()
|
||||
{
|
||||
if( sender()==button( INSERT_ROW ) )
|
||||
emit toEdit( INSERT_ROW, table()->currentRow() );
|
||||
|
||||
else if( sender()==button( REMOVE_ROW ) )
|
||||
emit toEdit( REMOVE_ROW, table()->currentRow() );
|
||||
}
|
127
src/StdMeshersGUI/StdMeshersGUI_DistrTable.h
Normal file
127
src/StdMeshersGUI/StdMeshersGUI_DistrTable.h
Normal file
@ -0,0 +1,127 @@
|
||||
// SMESH StdMeshersGUI
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_DistrTable.h
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef StdMesherGUI_DistrTable_Header
|
||||
#define StdMesherGUI_DistrTable_Header
|
||||
|
||||
#include <qtable.h>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QButton;
|
||||
class QDoubleValidator;
|
||||
|
||||
/*!
|
||||
* \brief Values corresponding to buttons for table resize
|
||||
*/
|
||||
typedef enum { INSERT_ROW, REMOVE_ROW } TableButton;
|
||||
|
||||
/*!
|
||||
* \brief This class represents custom table. It has only double values and
|
||||
editor for every cell has validator
|
||||
*/
|
||||
class StdMeshersGUI_DistrTable : public QTable
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_DistrTable( const int rows, QWidget* = 0, const char* = 0 );
|
||||
virtual ~StdMeshersGUI_DistrTable();
|
||||
|
||||
/*!
|
||||
* \brief Hides current editor of cell
|
||||
*/
|
||||
void stopEditing( const bool accept );
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
static void sortData( SMESH::double_array& );
|
||||
|
||||
void data( SMESH::double_array& );
|
||||
void setData( const SMESH::double_array& );
|
||||
|
||||
protected:
|
||||
virtual QWidget* createEditor( int, int, bool ) const;
|
||||
virtual bool eventFilter( QObject*, QEvent* );
|
||||
virtual void keyPressEvent( QKeyEvent* );
|
||||
virtual void edit( const int, const int );
|
||||
|
||||
private slots:
|
||||
void onEdit( TableButton, int );
|
||||
|
||||
private:
|
||||
QDoubleValidator *myArgV, *myFuncV;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class represents frame for table and buttons
|
||||
*/
|
||||
class StdMeshersGUI_DistrTableFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_DistrTableFrame( QWidget* );
|
||||
~StdMeshersGUI_DistrTableFrame();
|
||||
|
||||
StdMeshersGUI_DistrTable* table() const;
|
||||
|
||||
/*!
|
||||
* \brief Changes shown state of some button for table resize
|
||||
*/
|
||||
void setShown( const TableButton, const bool );
|
||||
|
||||
/*!
|
||||
* \brief Returns shown state of some button for table resize
|
||||
*/
|
||||
bool isShown( const TableButton ) const;
|
||||
|
||||
private:
|
||||
QButton* button( const TableButton ) const;
|
||||
|
||||
private slots:
|
||||
void onButtonClicked();
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief This signal is emitted if some of button for table resize is clicked
|
||||
* Second parameter is current row. Take into account that
|
||||
* this object resize table ( returned by table() ) automatically
|
||||
*/
|
||||
void toEdit( TableButton, int );
|
||||
void valueChanged( int, int );
|
||||
|
||||
private:
|
||||
QButton *myInsertRow, *myRemoveRow;
|
||||
StdMeshersGUI_DistrTable *myTable;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
307
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
Normal file
307
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
Normal file
@ -0,0 +1,307 @@
|
||||
|
||||
#include "StdMeshersGUI_NbSegmentsCreator.h"
|
||||
#include "StdMeshersGUI_DistrTable.h"
|
||||
#include "StdMeshersGUI_DistrPreview.h"
|
||||
|
||||
#include <SMESHGUI_Utils.h>
|
||||
#include <SMESHGUI_HypothesesUtils.h>
|
||||
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include <SalomeApp_Tools.h>
|
||||
|
||||
#include <QtxIntSpinBox.h>
|
||||
#include <QtxComboBox.h>
|
||||
#include <SMESHGUI_SpinBox.h>
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qframe.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qradiobutton.h>
|
||||
|
||||
StdMeshersGUI_NbSegmentsCreator::StdMeshersGUI_NbSegmentsCreator()
|
||||
: StdMeshersGUI_StdHypothesisCreator( "NumberOfSegments" ),
|
||||
myNbSeg( 0 ),
|
||||
myDistr( 0 ),
|
||||
myScale( 0 ),
|
||||
myTable( 0 ),
|
||||
myPreview( 0 ),
|
||||
myExpr( 0 ),
|
||||
myConv( 0 ),
|
||||
myLScale( 0 ),
|
||||
myLTable( 0 ),
|
||||
myLExpr( 0 ),
|
||||
myLConv( 0 ),
|
||||
myInfo( 0 ),
|
||||
myGroupLayout( 0 ),
|
||||
myTableRow( 0 ),
|
||||
myPreviewRow( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator()
|
||||
{
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_NbSegmentsCreator::checkParams() const
|
||||
{
|
||||
NbSegmentsHypothesisData data_old, data_new;
|
||||
readParamsFromHypo( data_old );
|
||||
readParamsFromWidgets( data_new );
|
||||
bool res = storeParamsToHypo( data_new );
|
||||
storeParamsToHypo( data_old );
|
||||
return res;
|
||||
}
|
||||
|
||||
QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
||||
{
|
||||
QFrame* fr = new QFrame( 0, "myframe" );
|
||||
QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 );
|
||||
|
||||
QGroupBox* GroupC1 = new QGroupBox( fr, "GroupC1" );
|
||||
lay->addWidget( GroupC1 );
|
||||
|
||||
StdMeshers::StdMeshers_NumberOfSegments_var h =
|
||||
StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );
|
||||
myPreview = new StdMeshersGUI_DistrPreview( GroupC1, h.in() );
|
||||
|
||||
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
myGroupLayout = new QGridLayout( GroupC1->layout() );
|
||||
myGroupLayout->setAlignment( Qt::AlignTop );
|
||||
myGroupLayout->setSpacing( 6 );
|
||||
myGroupLayout->setMargin( 11 );
|
||||
myGroupLayout->setColStretch( 0, 0 );
|
||||
myGroupLayout->setColStretch( 1, 1 );
|
||||
|
||||
int row = 0;
|
||||
// 0) name
|
||||
myName = 0;
|
||||
if( isCreation() )
|
||||
{
|
||||
myName = new QLineEdit( GroupC1 );
|
||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
|
||||
myGroupLayout->addWidget( myName, row, 1 );
|
||||
row++;
|
||||
}
|
||||
|
||||
// 1) number of segments
|
||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 );
|
||||
myNbSeg = new QtxIntSpinBox( GroupC1 );
|
||||
myNbSeg->setMinValue( 1 );
|
||||
myNbSeg->setMaxValue( 9999 );
|
||||
myGroupLayout->addWidget( myNbSeg, row, 1 );
|
||||
row++;
|
||||
|
||||
// 2) type of distribution
|
||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_DISTR_TYPE" ), GroupC1 ), row, 0 );
|
||||
myDistr = new QtxComboBox( GroupC1 );
|
||||
QStringList types;
|
||||
types.append( QObject::tr( "SMESH_DISTR_REGULAR" ) );
|
||||
types.append( QObject::tr( "SMESH_DISTR_SCALE" ) );
|
||||
types.append( QObject::tr( "SMESH_DISTR_TAB" ) );
|
||||
types.append( QObject::tr( "SMESH_DISTR_EXPR" ) );
|
||||
myDistr->insertStringList( types );
|
||||
myGroupLayout->addWidget( myDistr, row, 1 );
|
||||
row++;
|
||||
|
||||
// 3) scale
|
||||
myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 );
|
||||
myScale = new SMESHGUI_SpinBox( GroupC1 );
|
||||
myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, 6 );
|
||||
myGroupLayout->addWidget( myScale, row, 1 );
|
||||
row++;
|
||||
|
||||
myInfo = new QLabel( tr( "SMESH_FUNC_DOMAIN" ), GroupC1 );
|
||||
myGroupLayout->addMultiCellWidget( myInfo, row, row, 0, 1 );
|
||||
row++;
|
||||
|
||||
// 4) table
|
||||
myGroupLayout->addWidget( myLTable = new QLabel( tr( "SMESH_TAB_FUNC" ), GroupC1 ), row, 0 );
|
||||
myTable = new StdMeshersGUI_DistrTableFrame( GroupC1 );
|
||||
myGroupLayout->addWidget( myTable, row, 1 );
|
||||
myGroupLayout->setRowStretch( row, 1 );
|
||||
myTableRow = row;
|
||||
row++;
|
||||
|
||||
// 5) expression
|
||||
myGroupLayout->addWidget( myLExpr = new QLabel( tr( "SMESH_EXPR_FUNC" ), GroupC1 ), row, 0 );
|
||||
myExpr = new QLineEdit( GroupC1 );
|
||||
myGroupLayout->addWidget( myExpr, row, 1 );
|
||||
row++;
|
||||
|
||||
// 6) conversion (radiogroup)
|
||||
myGroupLayout->addWidget( myLConv = new QLabel( tr( "SMESH_CONV_MODE" ), GroupC1 ), row, 0 );
|
||||
myConv = new QButtonGroup( GroupC1 );
|
||||
myConv->setExclusive( true );
|
||||
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 );
|
||||
myGroupLayout->addWidget( myConv, row, 1 );
|
||||
row++;
|
||||
|
||||
// 7) distribution preview
|
||||
myGroupLayout->addMultiCellWidget( myPreview, row, row, 0, 1 );
|
||||
myGroupLayout->setRowStretch( row, 1 );
|
||||
myPreviewRow = row;
|
||||
row++;
|
||||
|
||||
connect( myNbSeg, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myDistr, SIGNAL( activated( int ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myExpr, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
connect( myConv, SIGNAL( clicked( int ) ), this, SLOT( onValueChanged() ) );
|
||||
|
||||
return fr;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const
|
||||
{
|
||||
NbSegmentsHypothesisData data;
|
||||
readParamsFromHypo( data );
|
||||
|
||||
if( myName )
|
||||
myName->setText( data.myName );
|
||||
myNbSeg->setValue( data.myNbSeg );
|
||||
myDistr->setCurrentItem( data.myDistrType );
|
||||
myScale->setValue( data.myScale );
|
||||
myConv->setButton( data.myConv );
|
||||
myTable->table()->setData( data.myTable );
|
||||
myExpr->setText( data.myExpr );
|
||||
}
|
||||
|
||||
void StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
||||
{
|
||||
NbSegmentsHypothesisData data;
|
||||
readParamsFromWidgets( data );
|
||||
storeParamsToHypo( data );
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo( NbSegmentsHypothesisData& h_data ) const
|
||||
{
|
||||
StdMeshers::StdMeshers_NumberOfSegments_var h =
|
||||
StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );
|
||||
|
||||
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
|
||||
h_data.myName = isCreation() && data ? data->Label : "";
|
||||
|
||||
h_data.myNbSeg = (int) h->GetNumberOfSegments();
|
||||
int distr = (int) h->GetDistrType();
|
||||
h_data.myDistrType = distr;
|
||||
h_data.myScale = distr==1 ? h->GetScaleFactor() : 1.0;
|
||||
if( distr==2 )
|
||||
{
|
||||
SMESH::double_array* a = h->GetTableFunction();
|
||||
h_data.myTable = *a;
|
||||
delete a;
|
||||
}
|
||||
else
|
||||
{
|
||||
SMESH::double_array& a = h_data.myTable;
|
||||
// by default, constant table function f(t)=1
|
||||
a.length( 4 );
|
||||
a[0] = 0.0; a[1] = 1.0;
|
||||
a[2] = 1.0; a[3] = 1.0;
|
||||
}
|
||||
|
||||
h_data.myExpr = distr==3 ? h->GetExpressionFunction() : "1";
|
||||
h_data.myConv = distr==2 || distr==3 ? h->ConversionMode() : 1; /*cut negative by default*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothesisData& h_data ) const
|
||||
{
|
||||
StdMeshers::StdMeshers_NumberOfSegments_var h =
|
||||
StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );
|
||||
|
||||
bool ok = true;
|
||||
try
|
||||
{
|
||||
if( isCreation() )
|
||||
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() );
|
||||
|
||||
h->SetNumberOfSegments( h_data.myNbSeg );
|
||||
int distr = h_data.myDistrType;
|
||||
h->SetDistrType( distr );
|
||||
|
||||
if( distr==1 )
|
||||
h->SetScaleFactor( h_data.myScale );
|
||||
|
||||
if( distr==2 || distr==3 )
|
||||
h->SetConversionMode( h_data.myConv );
|
||||
|
||||
if( distr==2 )
|
||||
h->SetTableFunction( h_data.myTable );
|
||||
|
||||
if( distr==3 )
|
||||
h->SetExpressionFunction( h_data.myExpr.latin1() );
|
||||
//setting of function must follow after setConversionMode, because otherwise
|
||||
//the function will be checked with old conversion mode, so that it may occurs
|
||||
//unexpected errors for user
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& ex)
|
||||
{
|
||||
SalomeApp_Tools::QtCatchCorbaException(ex);
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesisData& h_data ) const
|
||||
{
|
||||
h_data.myName = myName ? myName->text() : "";
|
||||
h_data.myNbSeg = myNbSeg->value();
|
||||
h_data.myDistrType = myDistr->currentItem();
|
||||
h_data.myConv = myConv->id( myConv->selected() );
|
||||
h_data.myScale = myScale->value();
|
||||
myTable->table()->data( h_data.myTable );
|
||||
h_data.myExpr = myExpr->text();
|
||||
return true;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
|
||||
{
|
||||
int distr = myDistr->currentItem();
|
||||
|
||||
myScale->setShown( distr==1 );
|
||||
myLScale->setShown( distr==1 );
|
||||
|
||||
bool isFunc = distr==2 || distr==3;
|
||||
myPreview->setShown( isFunc );
|
||||
myGroupLayout->setRowStretch( myPreviewRow, isFunc ? 1 : 0 );
|
||||
|
||||
myConv->setShown( isFunc );
|
||||
myLConv->setShown( isFunc );
|
||||
|
||||
if( distr==2 )
|
||||
myTable->show();
|
||||
else
|
||||
myTable->hide();
|
||||
myLTable->setShown( distr==2 );
|
||||
myGroupLayout->setRowStretch( myTableRow, distr==2 ? 1 : 0 );
|
||||
|
||||
myExpr->setShown( distr==3 );
|
||||
myLExpr->setShown( distr==3 );
|
||||
myInfo->setShown( isFunc );
|
||||
|
||||
//change of preview
|
||||
int nbSeg = myNbSeg->value();
|
||||
if( distr==2 ) //preview for table-described function
|
||||
{
|
||||
SMESH::double_array a;
|
||||
myTable->table()->data( a );
|
||||
myPreview->setParams( a, nbSeg, false );
|
||||
}
|
||||
else if( distr==3 ) //preview for analytic-described function
|
||||
myPreview->setParams( myExpr->text(), nbSeg, 100, false );
|
||||
|
||||
if( isFunc )
|
||||
myPreview->setConversion( StdMeshersGUI_DistrPreview::Conversion( myConv->id( myConv->selected() ) ) );
|
||||
}
|
64
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h
Normal file
64
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
#ifndef NB_SEGMENTS_CREATOR_HEADER
|
||||
#define NB_SEGMENTS_CREATOR_HEADER
|
||||
|
||||
#include "StdMeshersGUI_StdHypothesisCreator.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QtxIntSpinBox;
|
||||
class QtxComboBox;
|
||||
class SMESHGUI_SpinBox;
|
||||
class StdMeshersGUI_DistrTableFrame;
|
||||
class StdMeshersGUI_DistrPreview;
|
||||
class QLineEdit;
|
||||
class QButtonGroup;
|
||||
class QGridLayout;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int myNbSeg, myDistrType, myConv;
|
||||
double myScale;
|
||||
SMESH::double_array myTable;
|
||||
QString myName, myExpr;
|
||||
|
||||
} NbSegmentsHypothesisData;
|
||||
|
||||
class StdMeshersGUI_NbSegmentsCreator : public StdMeshersGUI_StdHypothesisCreator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_NbSegmentsCreator();
|
||||
virtual ~StdMeshersGUI_NbSegmentsCreator();
|
||||
|
||||
virtual bool checkParams() const;
|
||||
|
||||
protected:
|
||||
virtual QFrame* buildFrame();
|
||||
virtual void retrieveParams() const;
|
||||
virtual void storeParams() const;
|
||||
|
||||
protected slots:
|
||||
virtual void onValueChanged();
|
||||
|
||||
private:
|
||||
bool readParamsFromHypo( NbSegmentsHypothesisData& ) const;
|
||||
bool readParamsFromWidgets( NbSegmentsHypothesisData& ) const;
|
||||
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
|
||||
|
||||
private:
|
||||
QtxIntSpinBox* myNbSeg;
|
||||
QtxComboBox* myDistr;
|
||||
SMESHGUI_SpinBox* myScale;
|
||||
StdMeshersGUI_DistrTableFrame* myTable;
|
||||
StdMeshersGUI_DistrPreview* myPreview;
|
||||
QLineEdit *myName, *myExpr;
|
||||
QButtonGroup* myConv;
|
||||
QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo;
|
||||
QGridLayout* myGroupLayout;
|
||||
int myTableRow, myPreviewRow;
|
||||
};
|
||||
|
||||
#endif
|
277
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
Normal file
277
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
Normal file
@ -0,0 +1,277 @@
|
||||
// SMESH StdMeshersGUI : GUI for plugged-in meshers
|
||||
//
|
||||
// Copyright (C) 2003 CEA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_StdHypothesisCreator.cxx
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
|
||||
|
||||
#include "StdMeshersGUI_StdHypothesisCreator.h"
|
||||
|
||||
#include <SMESHGUI.h>
|
||||
#include <SMESHGUI_SpinBox.h>
|
||||
#include <SMESHGUI_HypothesesUtils.h>
|
||||
#include <SMESHGUI_Utils.h>
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
#include <qpixmap.h>
|
||||
|
||||
|
||||
const double VALUE_MAX = 1.0e+15, // COORD_MAX
|
||||
VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
|
||||
VALUE_MAX_3 = VALUE_MAX_2 * VALUE_MAX,
|
||||
VALUE_SMALL = 1.0e-15,
|
||||
VALUE_SMALL_2 = VALUE_SMALL * VALUE_SMALL,
|
||||
VALUE_SMALL_3 = VALUE_SMALL_2 * VALUE_SMALL;
|
||||
|
||||
StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type )
|
||||
: SMESHGUI_GenericHypothesisCreator( type )
|
||||
{
|
||||
}
|
||||
|
||||
StdMeshersGUI_StdHypothesisCreator::~StdMeshersGUI_StdHypothesisCreator()
|
||||
{
|
||||
}
|
||||
|
||||
QFrame* StdMeshersGUI_StdHypothesisCreator::buildFrame()
|
||||
{
|
||||
return buildStdFrame();
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_StdHypothesisCreator::checkParams() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_StdHypothesisCreator::retrieveParams() const
|
||||
{
|
||||
//here this method must be empty because buildStdParam sets values itself
|
||||
}
|
||||
|
||||
void StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
{
|
||||
ListOfStdParams params;
|
||||
bool res = getStdParamFromDlg( params );
|
||||
if( isCreation() )
|
||||
{
|
||||
SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().latin1() );
|
||||
params.remove( params.begin() );
|
||||
}
|
||||
|
||||
if( res && !params.isEmpty() )
|
||||
{
|
||||
if( hypType()=="LocalLength" )
|
||||
{
|
||||
StdMeshers::StdMeshers_LocalLength_var h =
|
||||
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Arithmetic1D_var h =
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementArea_var h =
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
||||
|
||||
h->SetMaxElementArea( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementVolume_var h =
|
||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
|
||||
|
||||
h->SetMaxElementVolume( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="StartEndLength" )
|
||||
{
|
||||
StdMeshers::StdMeshers_StartEndLength_var h =
|
||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
|
||||
|
||||
h->SetDeflection( params[0].myValue.toDouble() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
{
|
||||
bool res = true;
|
||||
SMESHGUI_GenericHypothesisCreator::StdParam item;
|
||||
|
||||
p.clear();
|
||||
if( isCreation() )
|
||||
{
|
||||
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
|
||||
item.myName = tr( "SMESH_NAME" );
|
||||
item.myValue = data ? data->Label : QString();
|
||||
p.append( item );
|
||||
}
|
||||
|
||||
if( hypType()=="LocalLength" )
|
||||
{
|
||||
StdMeshers::StdMeshers_LocalLength_var h =
|
||||
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||
item.myValue = isCreation() ? 1.0 : h->GetLength();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Arithmetic1D_var h =
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
item.myValue = isCreation() ? 1.0 : h->GetLength( true );
|
||||
p.append( item );
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
item.myValue = isCreation() ? 10.0 : h->GetLength( false );
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementArea_var h =
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
|
||||
item.myValue = isCreation() ? 1.0 : h->GetMaxElementArea();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementVolume_var h =
|
||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
|
||||
item.myValue = isCreation() ? 1.0 : h->GetMaxElementVolume();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="StartEndLength" )
|
||||
{
|
||||
StdMeshers::StdMeshers_StartEndLength_var h =
|
||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
item.myValue = isCreation() ? 1.0 : h->GetLength( true );
|
||||
p.append( item );
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
item.myValue = isCreation() ? 10.0 : h->GetLength( false );
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
|
||||
|
||||
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
|
||||
item.myValue = isCreation() ? 1.0 : h->GetDeflection();
|
||||
p.append( item );
|
||||
}
|
||||
else
|
||||
res = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget( QWidget* w, const int ) const
|
||||
{
|
||||
SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
|
||||
if( hypType()=="LocalLength" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6 );
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, 6 );
|
||||
}
|
||||
else if( hypType()=="StartEndLength" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
|
||||
}
|
||||
else if( hypType()=="Deflection1D" && sb )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
|
||||
}
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_StdHypothesisCreator::caption() const
|
||||
{
|
||||
return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ) );
|
||||
}
|
||||
|
||||
QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const
|
||||
{
|
||||
QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ) );
|
||||
return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName );
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_StdHypothesisCreator::type() const
|
||||
{
|
||||
return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ) );
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) const
|
||||
{
|
||||
static QMap<QString,QString> types;
|
||||
if( types.isEmpty() )
|
||||
{
|
||||
types.insert( "LocalLength", "LOCAL_LENGTH" );
|
||||
types.insert( "NumberOfSegments", "NB_SEGMENTS" );
|
||||
types.insert( "MaxElementArea", "MAX_ELEMENT_AREA" );
|
||||
types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" );
|
||||
types.insert( "StartEndLength", "START_END_LENGTH" );
|
||||
types.insert( "Deflection1D", "DEFLECTION1D" );
|
||||
types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
|
||||
}
|
||||
|
||||
QString res;
|
||||
if( types.contains( t ) )
|
||||
res = types[ t ];
|
||||
|
||||
return res;
|
||||
}
|
60
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h
Normal file
60
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h
Normal file
@ -0,0 +1,60 @@
|
||||
// SMESH StdMeshersGUI : GUI for plugged-in meshers
|
||||
//
|
||||
// Copyright (C) 2003 CEA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshersGUI_StdHypothesisCreator.h
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h
|
||||
|
||||
#ifndef STDMESHERSGUI_StdHypothesisCreator_HeaderFile
|
||||
#define STDMESHERSGUI_StdHypothesisCreator_HeaderFile
|
||||
|
||||
#include <SMESHGUI_Hypotheses.h>
|
||||
|
||||
/*!
|
||||
* \brief Class for creation of simple hypotheses (only set of parameters without dependencies)
|
||||
*/
|
||||
class StdMeshersGUI_StdHypothesisCreator : public SMESHGUI_GenericHypothesisCreator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StdMeshersGUI_StdHypothesisCreator( const QString& );
|
||||
virtual ~StdMeshersGUI_StdHypothesisCreator();
|
||||
|
||||
virtual bool checkParams() const;
|
||||
|
||||
protected:
|
||||
virtual QFrame* buildFrame ();
|
||||
virtual void retrieveParams() const;
|
||||
virtual void storeParams () const;
|
||||
virtual bool stdParams ( ListOfStdParams& ) const;
|
||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||
virtual QString caption() const;
|
||||
virtual QPixmap icon() const;
|
||||
virtual QString type() const;
|
||||
|
||||
private:
|
||||
QString hypTypeName( const QString& ) const;
|
||||
};
|
||||
|
||||
#endif
|
@ -53,12 +53,30 @@ msgstr "Table function"
|
||||
msgid "SMESH_EXPR_FUNC"
|
||||
msgstr "Density function f(t) = "
|
||||
|
||||
msgid "SMESH_EXP_MODE"
|
||||
msgstr "Exponent mode "
|
||||
msgid "SMESH_CONV_MODE"
|
||||
msgstr "Conversion mode "
|
||||
|
||||
msgid "SMESH_NB_SEGMENTS_TITLE"
|
||||
msgstr "Hypothesis Construction"
|
||||
|
||||
msgid "SMESH_EXP_MODE"
|
||||
msgstr "Exponent"
|
||||
|
||||
msgid "SMESH_CUT_NEG_MODE"
|
||||
msgstr "Cut negative"
|
||||
|
||||
msgid "SMESH_INSERT_ROW"
|
||||
msgstr "Insert row"
|
||||
|
||||
msgid "SMESH_REMOVE_ROW"
|
||||
msgstr "Remove row"
|
||||
|
||||
msgid "SMESH_FUNC_DOMAIN"
|
||||
msgstr "Warning: function must be defined on segment [0..1]"
|
||||
|
||||
msgid "SMESH_INVALID_FUNCTION"
|
||||
msgstr "Function is invalid"
|
||||
|
||||
# ----------- Max. Element Area ------------
|
||||
|
||||
msgid "SMESH_MAX_ELEMENT_AREA_PARAM"
|
||||
@ -91,7 +109,7 @@ msgid "SMESH_END_LENGTH_PARAM"
|
||||
msgstr "End Length"
|
||||
|
||||
msgid "SMESH_START_END_LENGTH_HYPOTHESIS"
|
||||
msgstr "Start and EndLocal Length"
|
||||
msgstr "Start and End local Length"
|
||||
|
||||
msgid "SMESH_START_END_LENGTH_TITLE"
|
||||
msgstr "Hypothesis Construction"
|
||||
|
@ -71,6 +71,59 @@ StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i()
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::BuildDistribution
|
||||
*
|
||||
* Builds point distribution according to passed function
|
||||
*/
|
||||
//=============================================================================
|
||||
SMESH::double_array* StdMeshers_NumberOfSegments_i::BuildDistributionExpr( const char* func, long nbSeg, long conv )
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::BuildDistribution" );
|
||||
ASSERT( myBaseImpl );
|
||||
try
|
||||
{
|
||||
SMESH::double_array_var aRes = new SMESH::double_array();
|
||||
const std::vector<double>& res = this->GetImpl()->BuildDistributionExpr( func, nbSeg, conv );
|
||||
aRes->length( res.size() );
|
||||
for (int i = 0; i < res.size(); i++)
|
||||
aRes[i] = res[i];
|
||||
return aRes._retn();
|
||||
}
|
||||
catch( SALOME_Exception& S_ex )
|
||||
{
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
SMESH::double_array* StdMeshers_NumberOfSegments_i::BuildDistributionTab( const SMESH::double_array& func,
|
||||
long nbSeg, long conv )
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::BuildDistribution" );
|
||||
ASSERT( myBaseImpl );
|
||||
|
||||
std::vector<double> tbl( func.length() );
|
||||
for (int i = 0; i < func.length(); i++)
|
||||
tbl[i] = func[i];
|
||||
|
||||
try
|
||||
{
|
||||
SMESH::double_array_var aRes = new SMESH::double_array();
|
||||
const std::vector<double>& res = this->GetImpl()->BuildDistributionTab( tbl, nbSeg, conv );
|
||||
aRes->length( res.size() );
|
||||
for (int i = 0; i < res.size(); i++)
|
||||
aRes[i] = res[i];
|
||||
return aRes._retn();
|
||||
}
|
||||
catch( SALOME_Exception& S_ex )
|
||||
{
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments_i::SetNumberOfSegments
|
||||
@ -289,15 +342,15 @@ char* StdMeshers_NumberOfSegments_i::GetExpressionFunction()
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_NumberOfSegments_i::SetExponentMode(CORBA::Boolean isExp)
|
||||
void StdMeshers_NumberOfSegments_i::SetConversionMode(CORBA::Long conv )
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::SetExponentMode" );
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::SetConversionMode" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
this->GetImpl()->SetExponentMode( isExp );
|
||||
this->GetImpl()->SetConversionMode( conv );
|
||||
// Update Python script
|
||||
SMESH::TPythonDump() << _this() << ".SetExponentMode( " << isExp << " )";
|
||||
SMESH::TPythonDump() << _this() << ".SetConversionMode( " << conv << " )";
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
@ -310,20 +363,20 @@ void StdMeshers_NumberOfSegments_i::SetExponentMode(CORBA::Boolean isExp)
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Boolean StdMeshers_NumberOfSegments_i::IsExponentMode()
|
||||
CORBA::Long StdMeshers_NumberOfSegments_i::ConversionMode()
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::IsExponentMode" );
|
||||
MESSAGE( "StdMeshers_NumberOfSegments_i::ConversionMode" );
|
||||
ASSERT( myBaseImpl );
|
||||
bool isExp;
|
||||
int conv;
|
||||
try {
|
||||
isExp = this->GetImpl()->IsExponentMode();
|
||||
conv = this->GetImpl()->ConversionMode();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
return isExp;
|
||||
return conv;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -52,6 +52,12 @@ public:
|
||||
// Destructor
|
||||
virtual ~StdMeshers_NumberOfSegments_i();
|
||||
|
||||
// Builds point distribution according to passed function
|
||||
SMESH::double_array* BuildDistributionExpr( const char*, CORBA::Long, CORBA::Long )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
SMESH::double_array* BuildDistributionTab( const SMESH::double_array&, CORBA::Long, CORBA::Long )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Set number of segments
|
||||
void SetNumberOfSegments( CORBA::Long theSegmentsNumber )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
@ -86,10 +92,10 @@ public:
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Set the exponent mode on/off
|
||||
void SetExponentMode(CORBA::Boolean isExp)
|
||||
void SetConversionMode( CORBA::Long conv )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Returns true if the exponent mode is set
|
||||
CORBA::Boolean IsExponentMode()
|
||||
CORBA::Long ConversionMode()
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Get implementation
|
||||
|
Loading…
Reference in New Issue
Block a user