mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-15 20:51:27 +05:00
Debug
This commit is contained in:
parent
e5ea28a26f
commit
792925c262
@ -3201,12 +3201,6 @@ module GEOM
|
|||||||
ListOfGO PublishNamedShapesInStudy(in SALOMEDS::Study theStudy,
|
ListOfGO PublishNamedShapesInStudy(in SALOMEDS::Study theStudy,
|
||||||
//in SObject theSObject,
|
//in SObject theSObject,
|
||||||
in Object theObject);
|
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"
|
#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()
|
// function : GEOM_Gen_i()
|
||||||
// purpose : constructor to be called for servant creation.
|
// 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) :
|
const char *interfaceName) :
|
||||||
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
|
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
|
||||||
{
|
{
|
||||||
|
myPoa = PortableServer::POA::_duplicate(poa);
|
||||||
|
|
||||||
_thisObj = this;
|
_thisObj = this;
|
||||||
_id = _poa->activate_object(_thisObj);
|
_id = _poa->activate_object(_thisObj);
|
||||||
name_service = new SALOME_NamingService(_orb);
|
name_service = new SALOME_NamingService(_orb);
|
||||||
@ -321,27 +344,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
aNameAttrib->Destroy();
|
aNameAttrib->Destroy();
|
||||||
|
|
||||||
//Set NoteBook variables used in the object creation
|
//Set NoteBook variables used in the object creation
|
||||||
/*ASL: temporary commented
|
if( GEOM_Object_i* aServant = dynamic_cast<GEOM_Object_i*>( GetServant( aShape ).in() ) )
|
||||||
TCollection_AsciiString aVars;
|
aServant->UpdateStringAttribute();
|
||||||
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();
|
|
||||||
*/
|
|
||||||
|
|
||||||
aFather->Destroy();
|
aFather->Destroy();
|
||||||
|
|
||||||
@ -1815,15 +1819,25 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
|
|||||||
return ret;
|
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()
|
// function : GetNotebook()
|
||||||
// purpose : Returns a pointer to SALOME Notebook object by an id of the study
|
// purpose : Returns a pointer to SALOME Notebook object by an id of the study
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SALOME::Notebook_ptr GEOM_Gen_i::GetNotebook( CORBA::Long theStudyID )
|
SALOME::Notebook_ptr GEOM_Gen_i::GetNotebook( CORBA::Long theStudyID )
|
||||||
{
|
{
|
||||||
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
|
SALOMEDS::Study_ptr aStudy = GetStudy( theStudyID );
|
||||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
|
||||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( theStudyID );
|
|
||||||
SALOME::Notebook_var aNotebook = aStudy->GetNotebook();
|
SALOME::Notebook_var aNotebook = aStudy->GetNotebook();
|
||||||
return aNotebook._retn();
|
return aNotebook._retn();
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,15 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
{
|
{
|
||||||
public:
|
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 //
|
// 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 bool hasObjectInfo();
|
||||||
virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
|
virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
|
||||||
|
|
||||||
|
SALOMEDS::Study_ptr GetStudy(CORBA::Long theStudyID);
|
||||||
SALOME::Notebook_ptr GetNotebook(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);
|
GEOM::ListOfGO_var aResList);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static PortableServer::POA_var myPoa; // POA reference
|
||||||
|
|
||||||
::GEOMImpl_Gen* _impl;
|
::GEOMImpl_Gen* _impl;
|
||||||
SALOME_NamingService * name_service;
|
SALOME_NamingService * name_service;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
|
||||||
#include "GEOM_IOperations_i.hh"
|
#include "GEOM_IOperations_i.hh"
|
||||||
|
#include "GEOM_Gen_i.hh"
|
||||||
|
|
||||||
#include "GEOM_Engine.hxx"
|
#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());
|
GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
|
||||||
GEOM::GEOM_Object_ptr aResult = GO._retn();
|
GEOM::GEOM_Object_ptr aResult = GO._retn();
|
||||||
if (theIsDependent && !CORBA::is_nil(aResult)) {
|
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))
|
if (!CORBA::is_nil(aNotebook))
|
||||||
aResult->StoreDependencies(aNotebook);
|
aResult->StoreDependencies(aNotebook);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <Standard_OStream.hxx>
|
#include <Standard_OStream.hxx>
|
||||||
|
|
||||||
#include <GEOM_Object_i.hh>
|
#include <GEOM_Object_i.hh>
|
||||||
|
#include <GEOM_Gen_i.hh>
|
||||||
#include <GEOM_ISubShape.hxx>
|
#include <GEOM_ISubShape.hxx>
|
||||||
#include <GEOM_Engine.hxx>
|
#include <GEOM_Engine.hxx>
|
||||||
#include <GEOMImpl_Types.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() ) );
|
aFunc->SetParam( i+1, TCollection_AsciiString( aParam.c_str() ) );
|
||||||
_parameters.push_back( aParam );
|
_parameters.push_back( aParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateStringAttribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOME::StringArray* GEOM_Object_i::GetParameters()
|
SALOME::StringArray* GEOM_Object_i::GetParameters()
|
||||||
@ -529,3 +532,37 @@ void GEOM_Object_i::StoreDependencies( SALOME::Notebook_ptr theNotebook )
|
|||||||
theNotebook->AddDependency( _this(), obj._retn() );
|
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 Update( SALOME::Notebook_ptr theNotebook );
|
||||||
|
|
||||||
|
virtual void UpdateStringAttribute();
|
||||||
|
|
||||||
Handle(GEOM_Object) GetImpl() { return _impl; }
|
Handle(GEOM_Object) GetImpl() { return _impl; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user