]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
1. GetParameters() is implemented
authorasl <asl@opencascade.com>
Wed, 25 Nov 2009 08:22:54 +0000 (08:22 +0000)
committerasl <asl@opencascade.com>
Wed, 25 Nov 2009 08:22:54 +0000 (08:22 +0000)
2. Debug

src/GEOM_I/GEOM_Object_i.cc
src/GEOM_I/GEOM_Object_i.hh

index 91108bdb3c50eade73901648261bf7dc8a07b210..2e9b99946cd047c5211c2b4d61b90395ff844919 100644 (file)
@@ -431,32 +431,35 @@ bool GEOM_Object_i::IsShape()
 
 void GEOM_Object_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters )
 {
 
 void GEOM_Object_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters )
 {
-  //printf( "set parameters\n" );
-  int n = theParameters.length();
-  if ( n <= 0 )
-    return;
-
   theNotebook->ClearDependencies( _this(), SALOME::Parameters );
   theNotebook->ClearDependencies( _this(), SALOME::Parameters );
+  _parameters.clear();
 
 
+  int n = theParameters.length();
   Handle( GEOM_Function ) aFunc = _impl->GetLastFunction();
   Handle( GEOM_Function ) aFunc = _impl->GetLastFunction();
-  TColStd_Array1OfAsciiString aParams( 1, n );
-  char* aStr;
   for( int i = 0; i < n; i++ )
   {
   for( int i = 0; i < n; i++ )
   {
-    aStr = CORBA::string_dup( theParameters[i] );
-    //printf( "\tparam = %s\n", aStr );
-    SALOME::Parameter_ptr aParam = theNotebook->GetParameter( aStr );
-    TCollection_AsciiString anAsciiName;
-    if( !CORBA::is_nil( aParam ) )
-    {
-      //printf( "add dep\n" );
-      theNotebook->AddDependency( _this(), aParam );
-      anAsciiName = aStr;
-    }
-    aFunc->SetParam( i+1, anAsciiName );
+    std::string aParam = CORBA::string_dup( theParameters[i] );
+    SALOME::Parameter_ptr aParamPtr = theNotebook->GetParameter( aParam.c_str() );
+    if( !CORBA::is_nil( aParamPtr ) )
+      theNotebook->AddDependency( _this(), aParamPtr );
+
+    aFunc->SetParam( i+1, TCollection_AsciiString( aParam.c_str() ) );
+    _parameters.push_back( aParam );
   }
 }
 
   }
 }
 
+SALOME::StringArray* GEOM_Object_i::GetParameters()
+{
+  SALOME::StringArray_var aParams = new SALOME::StringArray();
+
+  aParams->length( _parameters.size() );
+  std::list<std::string>::const_iterator it = _parameters.begin(), last = _parameters.end();
+  for( int i=0; it!=last; it++, i++ )
+    aParams[i] = CORBA::string_dup( it->c_str() );
+
+  return aParams._retn();
+}
+
 char* GEOM_Object_i::GetComponent()
 {
   return CORBA::string_dup( "GEOM" );
 char* GEOM_Object_i::GetComponent()
 {
   return CORBA::string_dup( "GEOM" );
index 24aac56137635be5cb8333b1dcad7f171df27a62..d3e40bad09d007e7816fad28194c8d862df97c1c 100644 (file)
@@ -94,6 +94,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
 
   virtual void SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters );
 
 
   virtual void SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters );
 
+  virtual SALOME::StringArray* GetParameters();
+
   virtual void StoreDependencies( SALOME::Notebook_ptr theNotebook );
 
   virtual char* GetComponent();
   virtual void StoreDependencies( SALOME::Notebook_ptr theNotebook );
 
   virtual char* GetComponent();
@@ -104,8 +106,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
 
   Handle(GEOM_Object) GetImpl() { return _impl; }
 
 
   Handle(GEOM_Object) GetImpl() { return _impl; }
 
- private:
-
+private:
+  std::list<std::string> _parameters;
   GEOM::GEOM_Gen_var _engine;
   Handle(GEOM_Object) _impl;
   TopoDS_Shape _geom;
   GEOM::GEOM_Gen_var _engine;
   Handle(GEOM_Object) _impl;
   TopoDS_Shape _geom;