-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <TColStd_HArray1OfInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
-#include <TopTools_SequenceOfShape.hxx>
#include <OSD.hxx>
#include <TDataStd_ChildNodeIterator.hxx>
#include <TDocStd_Owner.hxx>
#define UnLoadLib( handle ) FreeLibrary( handle );
#else
#define LibHandle void*
- #define LoadLib( name ) dlopen( name, RTLD_LAZY )
+ #define LoadLib( name ) dlopen( name, RTLD_LAZY | RTLD_GLOBAL )
#define GetProc dlsym
#define UnLoadLib( handle ) dlclose( handle );
#endif
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
- Handle(GEOM_BaseObject) anObject =
+ Handle(::GEOM_BaseObject) anObject =
_impl->GetObject(aStudy->StudyId(), aLocalPersistentID);
if ( !anObject.IsNull() )
{
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
- SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
+ SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
SALOMEDS::SComponent_var aFather = theStudy->FindComponent("GEOM");
if (aFather->_is_nil()) {
// BEGIN: try to find existed name for current shape
if ( !aShape->_is_nil() && mytype != GEOM_GROUP)
{
- // recieve current TopoDS shape
+ // receive current TopoDS shape
CORBA::String_var entry = aShape->GetEntry();
- Handle(GEOM_Object) aGShape = Handle(GEOM_Object)::DownCast
+ Handle(::GEOM_Object) aGShape = Handle(::GEOM_Object)::DownCast
( _impl->GetObject( aShape->GetStudyID(), entry ));
TopoDS_Shape TopoSh = aGShape->GetValue();
// find label of main shape
aMainSh = aMainSh->GetMainShape();
}
entry = aMainSh->GetEntry();
- Handle(GEOM_BaseObject) anObj = _impl->GetObject( aMainSh->GetStudyID(), entry );
+ Handle(::GEOM_BaseObject) anObj = _impl->GetObject( aMainSh->GetStudyID(), entry );
TDF_Label aMainLbl = anObj->GetFunction(1)->GetNamingEntry();
// check all named shapes using iterator
//============================================================================
// function : CreateAndPublishGroup
-// purpose : auxilary for PublishNamedShapesInStudy
+// purpose : auxiliary for PublishNamedShapesInStudy
//============================================================================
void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_var theMainShape,
GEOM::ListOfGO_var aResList)
{
CORBA::String_var entry = theMainShape->GetEntry();
- //Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry);
+ //Handle(::GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry);
Handle(TColStd_HArray1OfInteger) anArray;
if(SeqS.Length()>0) {
// create a group
GEOM::GEOM_Object_wrap GrObj = GOp->CreateGroup( theMainShape, SeqS(1).ShapeType() );
AddInStudy(theStudy, GrObj, GrName, theMainShape._retn());
//CORBA::String_var GrEntry = GrObj->GetEntry();
- //Handle(GEOM_Object) HGrObj = _impl->GetObject(GrObj->GetStudyID(), GrEntry);
+ //Handle(::GEOM_Object) HGrObj = _impl->GetObject(GrObj->GetStudyID(), GrEntry);
// add named objects
- //Handle(GEOM_Object) anObj;
+ //Handle(::GEOM_Object) anObj;
for(int i=1; i<=SeqS.Length(); i++) {
TopoDS_Shape aValue = SeqS.Value(i);
//anArray = new TColStd_HArray1OfInteger(1,1);
GOp->AddObject(GrObj,anIndex);
//anObj = GEOM_Engine::GetEngine()->AddObject(aMainShape->GetDocID(), GEOM_SUBSHAPE);
//if (anObj.IsNull()) continue;
- //Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1);
+ //Handle(::GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1);
//if (aFunction.IsNull()) continue;
//GEOM_ISubShape aSSI(aFunction);
//aSSI.SetMainShape(aMainShape->GetLastFunction());
if(theMainShape->_is_nil()) return aResList._retn();
CORBA::String_var entry = theMainShape->GetEntry();
- Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast
+ Handle(::GEOM_Object) aMainShape = Handle(::GEOM_Object)::DownCast
( _impl->GetObject( theMainShape->GetStudyID(), entry ));
if (aMainShape.IsNull()) return aResList._retn();
TopoDS_Shape MainSh = aMainShape->GetValue();
if (isMultiFile)
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
(theComponent->GetStudy()->URL())).c_str());
- aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
+ aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
// Build a full file name of temporary file
TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
// Prepare a file name to open
TCollection_AsciiString aNameWithExt("");
SALOMEDS::Study_var study = theComponent->GetStudy();
- if (isMultiFile) {
- CORBA::String_var url = study->URL();
- aNameWithExt = (char*)SALOMEDS_Tool::GetNameFromPath(url.in()).c_str();
+
+ // Get the file name.
+ int i;
+ int aLength = aSeq->length();
+ const char *aGeomSgd = "_GEOM.sgd";
+ const char *aGeomcbf = "_GEOM.cbf";
+
+ for(i = 0; i < aLength; i++) {
+ std::string aName(aSeq[i]);
+
+ if (aName.rfind(aGeomSgd) != std::string::npos ||
+ aName.rfind(aGeomcbf) != std::string::npos) {
+ aNameWithExt = aName.c_str();
+ break;
+ }
}
- aNameWithExt += "_GEOM.sgd";
+
TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
// Open document
//Create a new GEOM_Object
- Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
- Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
+ Handle(::GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
+ Handle(::GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
aFunction->SetValue(aTopology);
TCollection_AsciiString anEntry;
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
- Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
- Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+ Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+ Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
}
/*
- Handle(GEOM_Function) anOFun = theObject->GetLastFunction();
+ Handle(::GEOM_Function) anOFun = theObject->GetLastFunction();
if (!anOFun.IsNull()) {
CORBA::String_var entryArg = anArgO->GetEntry();
- Handle(GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg);
+ Handle(::GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg);
if (!anArgOImpl.IsNull()) {
TopoDS_Shape anArgOShape = anArgOImpl->GetValue();
TopoDS_Shape aMultiArgShape;
{}
}
GEOM::GEOM_Object_var anArgOMulti = (aMultiArgShape); // TODO
- Handle(GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction();
+ Handle(::GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction();
anArgOMultiFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOMulti);
}
aResParts->length(nb);
if (nb > 0)
{
- Handle(GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
- Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction();
+ Handle(::GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+ Handle(::GEOM_Function) aFunction = aMainObj->GetLastFunction();
GEOM::TPythonDump pd (aFunction, true);
pd <<"[";
int i = 0, j = 0;
anObjEntryMap.insert(anEntry);
aResParts[nbRes++] = anObj;
// clear python dump of object
- Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
- Handle(GEOM_Function) anObjFun = aGeomObj->GetLastFunction();
+ Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
+ Handle(::GEOM_Function) anObjFun = aGeomObj->GetLastFunction();
if ( !anObjFun.IsNull() )
anObjFun->SetDescription( "" );
if ( j > 0 )
GEOM::GEOM_Object_var anObj = anOutArgs[ i ];
if (CORBA::is_nil(anObj))
continue;
- Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
+ Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
if ( j > 0 )
pd << ", ";
pd << aGeomObj;
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
- Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
- Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+ Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+ Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
}
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
- Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
- Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+ Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+ Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
}
aResParts->length(nb);
if (nb > 0)
{
- Handle(GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
- Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction();
+ Handle(::GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+ Handle(::GEOM_Function) aFunction = aMainObj->GetLastFunction();
GEOM::TPythonDump pd (aFunction, true);
pd <<"[";
int i = 0, j = 0;
anObjEntryMap.insert(anEntry);
aResParts[nbRes++] = anObj;
// clear python dump of object
- Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
- Handle(GEOM_Function) anObjFun = aGeomObj->GetLastFunction();
+ Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
+ Handle(::GEOM_Function) anObjFun = aGeomObj->GetLastFunction();
if ( !anObjFun.IsNull() )
anObjFun->SetDescription( "" );
if ( j > 0 )
GEOM::GEOM_Object_var anObj = theArgs[ i ];
if (CORBA::is_nil(anObj))
continue;
- Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
+ Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
if ( j > 0 )
pd << ", ";
pd << aGeomObj;
GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
- Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
- Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+ Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+ Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
anArgOTrsfFun->SetDescription("");
aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
}
void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
{
std::string aPlatformLibName;
-#ifdef WIN32
- aPlatformLibName = theLibName;
- aPlatformLibName += ".dll" ;
-#else
+#if !defined(WIN32)
aPlatformLibName = "lib";
+#endif
aPlatformLibName += theLibName;
+#if defined(WIN32)
+ aPlatformLibName += ".dll" ;
+#elif defined(__APPLE__)
+ aPlatformLibName += ".dylib";
+#else
aPlatformLibName += ".so";
#endif
// load plugin library
LibHandle libHandle = LoadLib( aPlatformLibName.c_str() );
if (!libHandle) {
- // report any error, if occured
+ // report any error, if occurred
#ifndef WIN32
throw(SALOME_Exception(dlerror()));
#else
if (CORBA::is_nil(theMainShape) || theIndices.length() < 1)
return GEOM::GEOM_Object::_nil();
CORBA::String_var entry = theMainShape->GetEntry();
- Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast
+ Handle(::GEOM_Object) aMainShape = Handle(::GEOM_Object)::DownCast
( _impl->GetObject( theMainShape->GetStudyID(), entry ));
if (aMainShape.IsNull()) return GEOM::GEOM_Object::_nil();
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
- Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
+ Handle(::GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
if(anObject.IsNull()) return GEOM::GEOM_Object::_nil();
TCollection_AsciiString anEntry;
void GEOM_Gen_i::RemoveObject(GEOM::GEOM_BaseObject_ptr theObject)
{
CORBA::String_var anEntry = theObject->GetEntry();
- Handle(GEOM_BaseObject) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry, false);
+ Handle(::GEOM_BaseObject) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry, false);
if (!anObject.IsNull())
_impl->RemoveObject(anObject);
}
GEOM::GEOM_BaseObject_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry)
{
GEOM::GEOM_BaseObject_var obj;
- Handle(GEOM_BaseObject) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
+ Handle(::GEOM_BaseObject) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
if (handle_object.IsNull()) return obj._retn();
TCollection_AsciiString stringIOR = handle_object->GetIOR();
GEOM_BaseObject_i* servant = 0;
switch( handle_object->GetType() ) {
case GEOM_FIELD: {
- servant = new GEOM_Field_i (_poa, engine, Handle(GEOM_Field)::DownCast( handle_object ));
+ servant = new GEOM_Field_i (_poa, engine, Handle(::GEOM_Field)::DownCast( handle_object ));
break;
}
case GEOM_FIELD_STEP: {
- Handle(GEOM_FieldStep) step = Handle(GEOM_FieldStep)::DownCast( handle_object );
- Handle(GEOM_Field) field = step->GetField();
+ Handle(::GEOM_FieldStep) step = Handle(::GEOM_FieldStep)::DownCast( handle_object );
+ Handle(::GEOM_Field) field = step->GetField();
int type = ( !field.IsNull() ? field->GetDataType() : 0 );
switch( type ) {
case GEOM::FDT_Bool:
break;
}
default:
- servant = new GEOM_Object_i (_poa, engine, Handle(GEOM_Object)::DownCast( handle_object ));
+ servant = new GEOM_Object_i (_poa, engine, Handle(::GEOM_Object)::DownCast( handle_object ));
}
PortableServer::ObjectId_var id = _poa->activate_object(servant);
}
}
- char* anInfo = new char[strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo) + 3];
- sprintf(anInfo, "Module %s, %s", ComponentDataType(), aTypeInfo);
+ CORBA::String_var compType = ComponentDataType();
+ char* anInfo = new char[strlen("Module ") + strlen(compType.in()) + strlen(", ") + strlen(aTypeInfo) + 3];
+ sprintf(anInfo, "Module %s, %s", compType.in(), aTypeInfo);
char* ret = CORBA::string_dup(anInfo);
delete [] anInfo;
std::string aGboEntry = gbo->GetEntry();
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
Handle(TDataStd_TreeNode) aNode, aRoot;
- Handle(GEOM_Function) aFunction;
+ Handle(::GEOM_Function) aFunction;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
// go through the whole OCAF tree
TDataStd_ChildNodeIterator Itr( aRoot );
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(theStudy->StudyId());
Handle(TDataStd_TreeNode) aNode, aRoot;
- Handle(GEOM_Function) aFunction;
+ Handle(::GEOM_Function) aFunction;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
// go through the whole OCAF tree
TDF_Label aLabel;
// because they could not be modified anyhow.
std::set<std::string> aToBeInSelected;
for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
- Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), (*it).c_str(), false);
+ Handle(::GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), (*it).c_str(), false);
if ( handle_object.IsNull() )
continue;
std::set<std::string>& anOthers)
{
std::set<std::string>::iterator foundIt;
- Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
+ Handle(::GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
if ( handle_object.IsNull() )
return;
- Handle(GEOM_Function) aShapeFun = handle_object->GetFunction(1);
+ Handle(::GEOM_Function) aShapeFun = handle_object->GetFunction(1);
if ( aShapeFun.IsNull() || !aShapeFun->HasSubShapeReferences() )
return;