0020082: EDF 869 GEOM : Edges Orientation indicator/reverse

implement python dump
This commit is contained in:
eap 2009-07-15 13:44:24 +00:00
parent 951e90bf47
commit 74c0034727
5 changed files with 88 additions and 41 deletions

View File

@ -93,8 +93,32 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " SMESH::TPythonDump()
<< theLength << ", " << theIsStart << " )"; << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )";
}
//=============================================================================
/*!
* Sets <start segment length> parameter value
*/
//=============================================================================
void StdMeshers_Arithmetic1D_i::SetStartLength( CORBA::Double length)
throw (SALOME::SALOME_Exception)
{
SetLength( length, true );
}
//=============================================================================
/*!
* Sets <end segment length> parameter value
*/
//=============================================================================
void StdMeshers_Arithmetic1D_i::SetEndLength( CORBA::Double length)
throw (SALOME::SALOME_Exception)
{
SetLength( length, false );
} }
//============================================================================= //=============================================================================
@ -122,7 +146,6 @@ CORBA::Double StdMeshers_Arithmetic1D_i::GetLength( CORBA::Boolean theIsStart)
void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theIds ) void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theIds )
{ {
MESSAGE( "StdMeshers_Arithmetic1D_i::SetReversedEdges" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
try { try {
std::vector<int> ids( theIds.length() ); std::vector<int> ids( theIds.length() );
@ -138,8 +161,7 @@ void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theId
} }
// Update Python script // Update Python script
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( " SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
<< theList << " )";*/
} }
//============================================================================= //=============================================================================
@ -150,19 +172,17 @@ void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theId
*/ */
//============================================================================= //=============================================================================
void StdMeshers_Arithmetic1D_i::SetObjectEntry( const char* entry ) void StdMeshers_Arithmetic1D_i::SetObjectEntry( const char* theEntry )
{ {
MESSAGE( "StdMeshers_Arithmetic1D_i::SetObjectEntry" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
try { try {
this->GetImpl()->SetObjectEntry( entry ); this->GetImpl()->SetObjectEntry( entry.c_str() );
// Update Python script // Update Python script
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )"; SMESH::TPythonDump() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
} }
catch ( SALOME_Exception& S_ex ) { catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
SALOME::BAD_PARAM );
} }
} }

View File

@ -23,7 +23,6 @@
// File : StdMeshers_Arithmetic1D_i.hxx // File : StdMeshers_Arithmetic1D_i.hxx
// Author : Damien COQUERET, OCC // Author : Damien COQUERET, OCC
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_ARITHMETIC1D_I_HXX_ #ifndef _SMESH_ARITHMETIC1D_I_HXX_
#define _SMESH_ARITHMETIC1D_I_HXX_ #define _SMESH_ARITHMETIC1D_I_HXX_
@ -47,14 +46,21 @@ public:
// Constructor // Constructor
StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA, StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
int theStudyId, int theStudyId,
::SMESH_Gen* theGenImpl ); ::SMESH_Gen* theGenImpl );
// Destructor // Destructor
virtual ~StdMeshers_Arithmetic1D_i(); virtual ~StdMeshers_Arithmetic1D_i();
// Set length // Set length
// * OBSOLETE *. Avoid such a way of interface design
void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart ) void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
// Sets <start segment length> parameter value
void SetStartLength( CORBA::Double length) throw (SALOME::SALOME_Exception);
// Sets <end segment length> parameter value
void SetEndLength( CORBA::Double length) throw (SALOME::SALOME_Exception);
// Get length // Get length
CORBA::Double GetLength(CORBA::Boolean theIsStart); CORBA::Double GetLength(CORBA::Boolean theIsStart);
@ -72,7 +78,7 @@ public:
// Get implementation // Get implementation
::StdMeshers_Arithmetic1D* GetImpl(); ::StdMeshers_Arithmetic1D* GetImpl();
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
}; };

View File

@ -172,7 +172,6 @@ CORBA::Long StdMeshers_NumberOfSegments_i::GetNumberOfSegments()
void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& theIds ) void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& theIds )
{ {
MESSAGE( "StdMeshers_NumberOfSegments_i::SetReversedEdges" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
try { try {
std::vector<int> ids( theIds.length() ); std::vector<int> ids( theIds.length() );
@ -188,8 +187,7 @@ void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& t
} }
// Update Python script // Update Python script
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( " SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
<< theList << " )";*/
} }
//============================================================================= //=============================================================================
@ -200,20 +198,19 @@ void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& t
*/ */
//============================================================================= //=============================================================================
void StdMeshers_NumberOfSegments_i::SetObjectEntry( const char* entry ) void StdMeshers_NumberOfSegments_i::SetObjectEntry( const char* theEntry )
{ {
MESSAGE( "StdMeshers_NumberOfSegments_i::SetObjectEntry" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
try { try {
this->GetImpl()->SetObjectEntry( entry ); this->GetImpl()->SetObjectEntry( entry.c_str() );
// Update Python script
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
} }
catch ( SALOME_Exception& S_ex ) { catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
} }
// Update Python script
SMESH::TPythonDump() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
} }
//============================================================================= //=============================================================================
@ -226,7 +223,6 @@ void StdMeshers_NumberOfSegments_i::SetObjectEntry( const char* entry )
char* StdMeshers_NumberOfSegments_i::GetObjectEntry() char* StdMeshers_NumberOfSegments_i::GetObjectEntry()
{ {
MESSAGE( "StdMeshers_NumberOfSegments_i::SetObjectEntry" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
const char* entry; const char* entry;

View File

@ -94,8 +94,32 @@ void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength,
} }
// Update Python script // Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " SMESH::TPythonDump() <<
<< theLength << ", " << theIsStart << " )"; _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )";
}
//=============================================================================
/*!
* Sets <start segment length> parameter value
*/
//=============================================================================
void StdMeshers_StartEndLength_i::SetStartLength( CORBA::Double length)
throw (SALOME::SALOME_Exception)
{
SetLength( length, true );
}
//=============================================================================
/*!
* Sets <end segment length> parameter value
*/
//=============================================================================
void StdMeshers_StartEndLength_i::SetEndLength( CORBA::Double length)
throw (SALOME::SALOME_Exception)
{
SetLength( length, false );
} }
//============================================================================= //=============================================================================
@ -123,7 +147,6 @@ CORBA::Double StdMeshers_StartEndLength_i::GetLength( CORBA::Boolean theIsStart)
void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& theIds ) void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& theIds )
{ {
MESSAGE( "StdMeshers_StartEndLength_i::SetReversedEdges" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
try { try {
std::vector<int> ids( theIds.length() ); std::vector<int> ids( theIds.length() );
@ -139,8 +162,7 @@ void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& the
} }
// Update Python script // Update Python script
/* SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( " SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
<< theList << " )";*/
} }
//============================================================================= //=============================================================================
@ -151,18 +173,17 @@ void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& the
*/ */
//============================================================================= //=============================================================================
void StdMeshers_StartEndLength_i::SetObjectEntry( const char* entry ) void StdMeshers_StartEndLength_i::SetObjectEntry( const char* theEntry )
{ {
MESSAGE( "StdMeshers_StartEndLength_i::SetObjectEntry" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
try { try {
this->GetImpl()->SetObjectEntry( entry ); this->GetImpl()->SetObjectEntry( entry.c_str() );
// Update Python script // Update Python script
// SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )"; SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry.c_str() << "' )";
} }
catch ( SALOME_Exception& S_ex ) { catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
SALOME::BAD_PARAM );
} }
} }
@ -176,15 +197,13 @@ void StdMeshers_StartEndLength_i::SetObjectEntry( const char* entry )
char* StdMeshers_StartEndLength_i::GetObjectEntry() char* StdMeshers_StartEndLength_i::GetObjectEntry()
{ {
MESSAGE( "StdMeshers_StartEndLength_i::SetObjectEntry" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
const char* entry; const char* entry;
try { try {
entry = this->GetImpl()->GetObjectEntry(); entry = this->GetImpl()->GetObjectEntry();
} }
catch ( SALOME_Exception& S_ex ) { catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
SALOME::BAD_PARAM );
} }
return CORBA::string_dup( entry ); return CORBA::string_dup( entry );
} }
@ -199,7 +218,6 @@ char* StdMeshers_StartEndLength_i::GetObjectEntry()
SMESH::long_array* StdMeshers_StartEndLength_i::GetReversedEdges() SMESH::long_array* StdMeshers_StartEndLength_i::GetReversedEdges()
{ {
MESSAGE( "StdMeshers_StartEndLength_i::GetReversedEdges" );
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
SMESH::long_array_var anArray = new SMESH::long_array; SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges(); std::vector<int> ids = this->GetImpl()->GetReversedEdges();

View File

@ -24,7 +24,6 @@
// Moved here from SMESH_LocalLength_i.hxx // Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#ifndef _SMESH_StartEndLength_I_HXX_ #ifndef _SMESH_StartEndLength_I_HXX_
#define _SMESH_StartEndLength_I_HXX_ #define _SMESH_StartEndLength_I_HXX_
@ -55,8 +54,16 @@ public:
virtual ~StdMeshers_StartEndLength_i(); virtual ~StdMeshers_StartEndLength_i();
// Set length // Set length
// * OBSOLETE *. Avoid such a way of interface design
void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart ) void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
// Sets <start segment length> parameter value
void SetStartLength( CORBA::Double length) throw (SALOME::SALOME_Exception);
// Sets <end segment length> parameter value
void SetEndLength( CORBA::Double length) throw (SALOME::SALOME_Exception);
// Get length // Get length
CORBA::Double GetLength(CORBA::Boolean theIsStart); CORBA::Double GetLength(CORBA::Boolean theIsStart);