Salome HOME
0020082: EDF 869 GEOM : Edges Orientation indicator/reverse
authoreap <eap@opencascade.com>
Wed, 15 Jul 2009 13:44:24 +0000 (13:44 +0000)
committereap <eap@opencascade.com>
Wed, 15 Jul 2009 13:44:24 +0000 (13:44 +0000)
     implement python dump

src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx
src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx
src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx
src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx
src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx

index 3bf9e825bcaea9c3a9eba69557ed8300d5951355..9afb8748aa2c2702205e1467147d04dd23dd0e38 100644 (file)
@@ -93,8 +93,32 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
   }
 
   // Update Python script
-  SMESH::TPythonDump() << _this() << ".SetLength( "
-                       << theLength << ", " << theIsStart << " )";
+  SMESH::TPythonDump()
+    << _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 )
 {
-  MESSAGE( "StdMeshers_Arithmetic1D_i::SetReversedEdges" );
   ASSERT( myBaseImpl );
   try {
     std::vector<int> ids( theIds.length() );
@@ -138,8 +161,7 @@ void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theId
   }
 
   // Update Python script
-  /*  SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
-      << theList << " )";*/
+  SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
 }
 
 //=============================================================================
@@ -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 );
-
+  string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
   try {
-    this->GetImpl()->SetObjectEntry( entry );
+    this->GetImpl()->SetObjectEntry( entry.c_str() );
     // Update Python script
-    //    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
+    SMESH::TPythonDump() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
   }
   catch ( SALOME_Exception& S_ex ) {
-    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
-                                  SALOME::BAD_PARAM );
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
   }
 }
 
index 7abea29e1011c41305d117fb84b384d9d37c8ca5..641e567798c6505a877169c4bef3df4206b12a7b 100644 (file)
@@ -23,7 +23,6 @@
 //  File   : StdMeshers_Arithmetic1D_i.hxx
 //  Author : Damien COQUERET, OCC
 //  Module : SMESH
-//  $Header$
 //
 #ifndef _SMESH_ARITHMETIC1D_I_HXX_
 #define _SMESH_ARITHMETIC1D_I_HXX_
@@ -47,14 +46,21 @@ public:
   // Constructor
   StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
                             int                     theStudyId,
-                           ::SMESH_Gen*            theGenImpl );
+                             ::SMESH_Gen*            theGenImpl );
   // Destructor
   virtual ~StdMeshers_Arithmetic1D_i();
 
   // Set length
+  // * OBSOLETE *. Avoid such a way of interface design
   void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
     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
   CORBA::Double GetLength(CORBA::Boolean theIsStart);
 
@@ -72,7 +78,7 @@ public:
 
   // Get implementation
   ::StdMeshers_Arithmetic1D* GetImpl();
-  
+
   // Verify whether hypothesis supports given entity type 
   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
 };
index 8efa554d3457ff983a262b1799dd8ae243b9bf14..55a269f9b1beb87f340dc3135bbfec41192ed6d2 100644 (file)
@@ -172,7 +172,6 @@ CORBA::Long StdMeshers_NumberOfSegments_i::GetNumberOfSegments()
 
 void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& theIds )
 {
-  MESSAGE( "StdMeshers_NumberOfSegments_i::SetReversedEdges" );
   ASSERT( myBaseImpl );
   try {
     std::vector<int> ids( theIds.length() );
@@ -188,8 +187,7 @@ void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& t
   }
 
   // Update Python script
-  /*  SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
-      << theList << " )";*/
+  SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
 }
 
 //=============================================================================
@@ -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 );
-
+  string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
   try {
-    this->GetImpl()->SetObjectEntry( entry );
-    // Update Python script
-    //    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
+    this->GetImpl()->SetObjectEntry( entry.c_str() );
   }
   catch ( SALOME_Exception& S_ex ) {
     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
                                   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()
 {
-  MESSAGE( "StdMeshers_NumberOfSegments_i::SetObjectEntry" );
   ASSERT( myBaseImpl );
 
   const char* entry;
index c9a75a3d53a7287164219fd62b7e6bd51c3cba49..628f4acff3cc2ba06e57270505a0de4dc8423888 100644 (file)
@@ -94,8 +94,32 @@ void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength,
   }
 
   // Update Python script
-  SMESH::TPythonDump() << _this() << ".SetLength( "
-                       << theLength << ", " << theIsStart << " )";
+  SMESH::TPythonDump() <<
+    _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 )
 {
-  MESSAGE( "StdMeshers_StartEndLength_i::SetReversedEdges" );
   ASSERT( myBaseImpl );
   try {
     std::vector<int> ids( theIds.length() );
@@ -139,8 +162,7 @@ void StdMeshers_StartEndLength_i::SetReversedEdges( const SMESH::long_array& the
   }
 
   // Update Python script
-  /*  SMESH::TPythonDump() << _this() << ".SetEdgesToReverse( "
-      << theList << " )";*/
+  SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
 }
 
 //=============================================================================
@@ -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 );
+  string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
   try {
-    this->GetImpl()->SetObjectEntry( entry );
+    this->GetImpl()->SetObjectEntry( entry.c_str() );
     // Update Python script
-    //    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
+    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry.c_str() << "' )";
   }
   catch ( SALOME_Exception& S_ex ) {
-    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
-                                  SALOME::BAD_PARAM );
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
   }
 }
 
@@ -176,15 +197,13 @@ void StdMeshers_StartEndLength_i::SetObjectEntry( const char* entry )
 
 char* StdMeshers_StartEndLength_i::GetObjectEntry()
 {
-  MESSAGE( "StdMeshers_StartEndLength_i::SetObjectEntry" );
   ASSERT( myBaseImpl );
   const char* entry;
   try {
     entry = this->GetImpl()->GetObjectEntry();
   }
   catch ( SALOME_Exception& S_ex ) {
-    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
-                                  SALOME::BAD_PARAM );
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
   }
   return CORBA::string_dup( entry );
 }
@@ -199,7 +218,6 @@ char* StdMeshers_StartEndLength_i::GetObjectEntry()
 
 SMESH::long_array* StdMeshers_StartEndLength_i::GetReversedEdges()
 {
-  MESSAGE( "StdMeshers_StartEndLength_i::GetReversedEdges" );
   ASSERT( myBaseImpl );
   SMESH::long_array_var anArray = new SMESH::long_array;
   std::vector<int> ids = this->GetImpl()->GetReversedEdges();
index 3ce0e9db390529a730f2d55b591b9e504060b190..89ec616964e63e659a415f25dd1a124103db3f96 100644 (file)
@@ -24,7 +24,6 @@
 //           Moved here from SMESH_LocalLength_i.hxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
-//  $Header$
 //
 #ifndef _SMESH_StartEndLength_I_HXX_
 #define _SMESH_StartEndLength_I_HXX_
@@ -55,8 +54,16 @@ public:
   virtual ~StdMeshers_StartEndLength_i();
 
   // Set length
+  // * OBSOLETE *. Avoid such a way of interface design
   void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
     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
   CORBA::Double GetLength(CORBA::Boolean theIsStart);