//_lastObjectTag = 0;
}
+/*!
+ * Destructor
+ */
+GEOM_Engine::~GEOM_Engine()
+{
+ GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects);
+ for(; It.More(); It.Next())
+ {
+ RemoveObject(Handle(GEOM_Object)::DownCast(It.Value()));
+ }
+
+ //Close all documents not closed
+ for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next())
+ Close(anItr.Key());
+
+ _mapIDDocument.Clear();
+ _objects.Clear();
+}
+
//=============================================================================
/*!
* GetDocument
{
public:
Standard_EXPORT GEOM_Engine();
- Standard_EXPORT ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); }
+ Standard_EXPORT virtual ~GEOM_Engine();
//Retuns the engine
Standard_EXPORT static GEOM_Engine* GetEngine();
//============================================================================
void GEOM_Gen_i::register_name(char * name)
{
- GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this());
- name_service->Register(g, CORBA::string_dup(name));
+ GEOM::GEOM_Gen_var g = _this();
+ name_service->Register(g, name);
}
//============================================================================
GEOM::GEOM_Gen_ptr engine = _this();
+ //transfer reference on engine
GEOM_IBasicOperations_i* aServant =
new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
const char * interfaceName)
{
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
- myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
+ // Don't understand the reason of this register ????
+// myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
return myGEOM_Gen_i->getId();
}
}
if (thePnt == NULL) return aGEOMObject._retn();
//Get the reference point
+ CORBA::String_var entry=thePnt->GetEntry();
Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
- (thePnt->GetStudyID(), thePnt->GetEntry());
+ (thePnt->GetStudyID(), entry);
if (aPnt.IsNull()) return aGEOMObject._retn();
if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn();
//Get the reference shapes
+ CORBA::String_var entry=theShape1->GetEntry();
Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject
- (theShape1->GetStudyID(), theShape1->GetEntry());
+ (theShape1->GetStudyID(), entry);
+ entry=theShape2->GetEntry();
Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject
- (theShape2->GetStudyID(), theShape2->GetEntry());
+ (theShape2->GetStudyID(), entry);
if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
private:
::GEOM_IOperations* _impl;
- GEOM::GEOM_Gen_ptr _engine;
+ GEOM::GEOM_Gen_var _engine;
};
#endif
//=============================================================================
GEOM_Object_i::~GEOM_Object_i()
-{}
+{
+ GEOM_Engine::GetEngine()->RemoveObject(_impl);
+}
//=============================================================================
private:
- GEOM::GEOM_Gen_ptr _engine;
+ GEOM::GEOM_Gen_var _engine;
Handle(GEOM_Object) _impl;
TopoDS_Shape _geom;
};
GEOM_Superv_i::~GEOM_Superv_i()
{
MESSAGE("GEOM_Superv_i::~GEOM_Superv_i");
+ if (!CORBA::is_nil(myBasicOp))
+ myBasicOp->Destroy();
+ if (!CORBA::is_nil(myBoolOp))
+ myBoolOp->Destroy();
+ if (!CORBA::is_nil(my3DPrimOp))
+ my3DPrimOp->Destroy();
delete name_service;
}
//============================================================================
void GEOM_Superv_i::register_name(char * name)
{
- GEOM::GEOM_Superv_ptr g = GEOM::GEOM_Superv::_narrow(POA_GEOM::GEOM_Superv::_this());
- name_service->Register(g, strdup(name));
+ GEOM::GEOM_Superv_var g = _this();
+ name_service->Register(g, name);
}
//=============================================================================
//=============================================================================
void GEOM_Superv_i::setGeomEngine()
{
+ if ( !CORBA::is_nil(myGeomEngine) )
+ return;
// get GEOM_Gen engine
+ /*
SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service );
Engines::Component_var comp = lcc->FindOrLoad_Component( "FactoryServer", "GEOM" );
+ */
+
+ Engines::Container_var cont=GetContainerRef();
+ cont->load_component_Library("GEOM");
+ Engines::Component_var comp=cont->create_component_instance("GEOM",0);
myGeomEngine = GEOM::GEOM_Gen::_narrow(comp);
}
MESSAGE("GEOM_Superv_i::MakeSphepe");
getBasicOp();
get3DPrimOp();
- GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(myBasicOp->MakePointXYZ(theX, theY, theZ), theRadius);
+ GEOM::GEOM_Object_var o = myBasicOp->MakePointXYZ(theX, theY, theZ);
+ GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(o, theRadius);
+ o->Destroy();
endService( " GEOM_Superv_i::MakeSphepe" );
return anObj;
}
const char * interfaceName)
{
GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName);
- myGEOM_Superv_i->register_name("/myGEOM_Superv");
+ //Don't understand the reason why this component is registered ???
+// myGEOM_Superv_i->register_name("/myGEOM_Superv");
return myGEOM_Superv_i->getId() ;
}
}
private:
SALOME_NamingService * name_service;
- GEOM::GEOM_Gen_ptr myGeomEngine;
+ GEOM::GEOM_Gen_var myGeomEngine;
CORBA::Long myStudyID;
CORBA::Long myLastStudyID; // mkr : PAL10770
PortableServer::POA_var myPOA;
- GEOM::GEOM_IBasicOperations_ptr myBasicOp;
- GEOM::GEOM_I3DPrimOperations_ptr my3DPrimOp;
- GEOM::GEOM_IBooleanOperations_ptr myBoolOp;
- GEOM::GEOM_IInsertOperations_ptr myInsOp;
- GEOM::GEOM_ITransformOperations_ptr myTransfOp;
- GEOM::GEOM_IShapesOperations_ptr myShapesOp;
- GEOM::GEOM_IBlocksOperations_ptr myBlocksOp;
- GEOM::GEOM_ICurvesOperations_ptr myCurvesOp;
- GEOM::GEOM_ILocalOperations_ptr myLocalOp;
- GEOM::GEOM_IGroupOperations_ptr myGroupOp;
+ GEOM::GEOM_IBasicOperations_var myBasicOp;
+ GEOM::GEOM_I3DPrimOperations_var my3DPrimOp;
+ GEOM::GEOM_IBooleanOperations_var myBoolOp;
+ GEOM::GEOM_IInsertOperations_var myInsOp;
+ GEOM::GEOM_ITransformOperations_var myTransfOp;
+ GEOM::GEOM_IShapesOperations_var myShapesOp;
+ GEOM::GEOM_IBlocksOperations_var myBlocksOp;
+ GEOM::GEOM_ICurvesOperations_var myCurvesOp;
+ GEOM::GEOM_ILocalOperations_var myLocalOp;
+ GEOM::GEOM_IGroupOperations_var myGroupOp;
};