mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-15 17:11:26 +05:00
Debug
This commit is contained in:
parent
e5ea28a26f
commit
792925c262
@ -3201,12 +3201,6 @@ module GEOM
|
||||
ListOfGO PublishNamedShapesInStudy(in SALOMEDS::Study theStudy,
|
||||
//in SObject theSObject,
|
||||
in Object theObject);
|
||||
|
||||
/*!
|
||||
* Returns a pointer to SALOME Notebook interface.
|
||||
* \param theStudyID is a SALOMEDS Study ID
|
||||
*/
|
||||
SALOME::Notebook GetNotebook(in long theStudyID);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -62,6 +62,27 @@
|
||||
|
||||
#include "SALOMEDS_Tool.hxx"
|
||||
|
||||
// Static variables definition
|
||||
PortableServer::POA_var GEOM_Gen_i::myPoa;
|
||||
|
||||
//=============================================================================
|
||||
// function : GetServant()
|
||||
// purpose : Get servant of the CORBA object
|
||||
//=============================================================================
|
||||
PortableServer::ServantBase_var GEOM_Gen_i::GetServant( CORBA::Object_ptr theObject )
|
||||
{
|
||||
if( CORBA::is_nil( theObject ) || CORBA::is_nil( GetPOA() ) )
|
||||
return NULL;
|
||||
try {
|
||||
PortableServer::Servant aServant = GetPOA()->reference_to_servant( theObject );
|
||||
return aServant;
|
||||
}
|
||||
catch (...) {
|
||||
INFOS( "GetServant - Unknown exception was caught!!!" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : GEOM_Gen_i()
|
||||
// purpose : constructor to be called for servant creation.
|
||||
@ -73,6 +94,8 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
|
||||
const char *interfaceName) :
|
||||
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
|
||||
{
|
||||
myPoa = PortableServer::POA::_duplicate(poa);
|
||||
|
||||
_thisObj = this;
|
||||
_id = _poa->activate_object(_thisObj);
|
||||
name_service = new SALOME_NamingService(_orb);
|
||||
@ -321,27 +344,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
||||
aNameAttrib->Destroy();
|
||||
|
||||
//Set NoteBook variables used in the object creation
|
||||
/*ASL: temporary commented
|
||||
TCollection_AsciiString aVars;
|
||||
CORBA::String_var aString=aShape->GetParameters();
|
||||
SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aString);
|
||||
for(int i = 0, n = aSections->length(); i < n; i++) {
|
||||
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
|
||||
for(int j = 0, m = aListOfVars.length(); j < m; j++) {
|
||||
if(theStudy->IsVariable(aListOfVars[j].in()))
|
||||
aVars += TCollection_AsciiString(aListOfVars[j].in());
|
||||
if(j != m-1)
|
||||
aVars += ":";
|
||||
}
|
||||
if(i != n-1)
|
||||
aVars += "|";
|
||||
}
|
||||
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
|
||||
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
|
||||
aStringAttrib->SetValue(aVars.ToCString());
|
||||
aStringAttrib->Destroy();
|
||||
*/
|
||||
if( GEOM_Object_i* aServant = dynamic_cast<GEOM_Object_i*>( GetServant( aShape ).in() ) )
|
||||
aServant->UpdateStringAttribute();
|
||||
|
||||
aFather->Destroy();
|
||||
|
||||
@ -1815,15 +1819,25 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetStudy()
|
||||
// purpose : Returns a pointer to SALOMEDS Study object by its id
|
||||
//=================================================================================
|
||||
SALOMEDS::Study_ptr GEOM_Gen_i::GetStudy(CORBA::Long theStudyID)
|
||||
{
|
||||
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
|
||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( theStudyID );
|
||||
return aStudy._retn();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetNotebook()
|
||||
// purpose : Returns a pointer to SALOME Notebook object by an id of the study
|
||||
//=================================================================================
|
||||
SALOME::Notebook_ptr GEOM_Gen_i::GetNotebook( CORBA::Long theStudyID )
|
||||
{
|
||||
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
|
||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( theStudyID );
|
||||
SALOMEDS::Study_ptr aStudy = GetStudy( theStudyID );
|
||||
SALOME::Notebook_var aNotebook = aStudy->GetNotebook();
|
||||
return aNotebook._retn();
|
||||
}
|
||||
|
@ -62,6 +62,15 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
{
|
||||
public:
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Static methods //
|
||||
//-----------------------------------------------------------------------//
|
||||
|
||||
// Get SMESH module's POA object
|
||||
static PortableServer::POA_var GetPOA() { return myPoa;}
|
||||
// Get object of the CORBA reference
|
||||
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Constructor / Destructor //
|
||||
//-----------------------------------------------------------------------//
|
||||
@ -242,6 +251,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
virtual bool hasObjectInfo();
|
||||
virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
|
||||
|
||||
SALOMEDS::Study_ptr GetStudy(CORBA::Long theStudyID);
|
||||
SALOME::Notebook_ptr GetNotebook(CORBA::Long theStudyID);
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
@ -276,6 +286,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
GEOM::ListOfGO_var aResList);
|
||||
|
||||
private:
|
||||
static PortableServer::POA_var myPoa; // POA reference
|
||||
|
||||
::GEOMImpl_Gen* _impl;
|
||||
SALOME_NamingService * name_service;
|
||||
|
@ -20,6 +20,7 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
#include "GEOM_IOperations_i.hh"
|
||||
#include "GEOM_Gen_i.hh"
|
||||
|
||||
#include "GEOM_Engine.hxx"
|
||||
|
||||
@ -139,7 +140,8 @@ GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObjec
|
||||
GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
|
||||
GEOM::GEOM_Object_ptr aResult = GO._retn();
|
||||
if (theIsDependent && !CORBA::is_nil(aResult)) {
|
||||
SALOME::Notebook_ptr aNotebook = _engine->GetNotebook(aResult->GetStudyID());
|
||||
GEOM_Gen_i* aGEOMGen = dynamic_cast<GEOM_Gen_i*>(GEOM_Gen_i::GetServant(_engine).in());
|
||||
SALOME::Notebook_ptr aNotebook = aGEOMGen->GetNotebook(aResult->GetStudyID());
|
||||
if (!CORBA::is_nil(aNotebook))
|
||||
aResult->StoreDependencies(aNotebook);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
#include <GEOM_Object_i.hh>
|
||||
#include <GEOM_Gen_i.hh>
|
||||
#include <GEOM_ISubShape.hxx>
|
||||
#include <GEOM_Engine.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
@ -446,6 +447,8 @@ void GEOM_Object_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOM
|
||||
aFunc->SetParam( i+1, TCollection_AsciiString( aParam.c_str() ) );
|
||||
_parameters.push_back( aParam );
|
||||
}
|
||||
|
||||
UpdateStringAttribute();
|
||||
}
|
||||
|
||||
SALOME::StringArray* GEOM_Object_i::GetParameters()
|
||||
@ -529,3 +532,37 @@ void GEOM_Object_i::StoreDependencies( SALOME::Notebook_ptr theNotebook )
|
||||
theNotebook->AddDependency( _this(), obj._retn() );
|
||||
}
|
||||
}
|
||||
|
||||
void GEOM_Object_i::UpdateStringAttribute()
|
||||
{
|
||||
GEOM_Gen_i* aGEOMGen = dynamic_cast<GEOM_Gen_i*>( GEOM_Gen_i::GetServant( _engine ).in() );
|
||||
|
||||
SALOME::Notebook_ptr aNotebook = aGEOMGen->GetNotebook( GetStudyID() );
|
||||
|
||||
SALOME::StringArray* anObjectParameters = aNotebook->GetObjectParameters( GetComponent(), GetEntry() );
|
||||
int aParametersLength = anObjectParameters ? anObjectParameters->length() : 0;
|
||||
if( aParametersLength == 0 )
|
||||
return;
|
||||
|
||||
SALOMEDS::Study_ptr aStudy = aGEOMGen->GetStudy( GetStudyID() );
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( GetStudyEntry() );
|
||||
if( CORBA::is_nil( aSObject ) )
|
||||
return;
|
||||
|
||||
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute( aSObject, "AttributeString" );
|
||||
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow( anAttr );
|
||||
|
||||
std::string aString;
|
||||
for( int i = 0, n = anObjectParameters->length(); i < n; i++ ) {
|
||||
std::string aParameter = anObjectParameters->operator[](i).in();
|
||||
if( aParameter != "" )
|
||||
{
|
||||
if( aString != "" )
|
||||
aString += ", ";
|
||||
aString += aParameter;
|
||||
}
|
||||
}
|
||||
aStringAttrib->SetValue( aString.c_str() );
|
||||
aStringAttrib->Destroy();
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
|
||||
|
||||
virtual void Update( SALOME::Notebook_ptr theNotebook );
|
||||
|
||||
virtual void UpdateStringAttribute();
|
||||
|
||||
Handle(GEOM_Object) GetImpl() { return _impl; }
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user