-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifdef WNT
#pragma warning( disable:4786 )
#include "GEOM_Gen_i.hh"
#include "GEOM_Object_i.hh"
+#include "GEOM_version.h"
#include <set>
#include <sstream>
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue("Geometry");
- aName->Destroy();
+ aName->UnRegister();
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap");
SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry");
- aPixMap->Destroy();
+ aPixMap->UnRegister();
aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this());
}
if (aFather->_is_nil()) return aResultSO;
}
aResultSO->SetAttrString("AttributeString",aVars.ToCString());
- aFather->Destroy();
+ aFather->UnRegister();
//Set a name of the GEOM object
- aShape->SetName(theName);
+ aShape->SetName(aShapeName.ToCString());
return aResultSO._retn();
}
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aString=anIOR->Value();
- anIOR->Destroy();
+ anIOR->UnRegister();
CORBA::Object_var anObj = _orb->string_to_object(aString);
GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(anObj);
// If the object is null one it can't be copied: return false
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var objStr = _orb->object_to_string(obj);
anIOR->SetValue(objStr.in());
- anIOR->Destroy();
+ anIOR->UnRegister();
// Return the created in the Study SObject
return aNewSO._retn();
SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR.in());
if(aFatherSO->_is_nil()) return aResultSO._retn();
aResultSO = aStudyBuilder->NewObject(aFatherSO);
- aFatherSO->Destroy();
+ aFatherSO->UnRegister();
//aStudyBuilder->Addreference(aResultSO, aResultSO);
}
if(aLength < 1) return aResultSO._retn();
//Publish the arguments
+ TCollection_AsciiString aPrevID; // to avoid multiple references to same object
for(Standard_Integer i = 0; i< aLength; i++) {
GEOM::GEOM_Object_var anObject = aList[i];
if(anObject->_is_nil()) continue;
IOR = _orb->object_to_string(anObject);
SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(IOR.in());
if(aSO->_is_nil()) continue;
+ CORBA::String_var anID = aSO->GetID();
+ if ( aPrevID == anID.in() ) continue;
+ aPrevID = anID.in();
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
aStudyBuilder->Addreference(aSubSO, aSO);
- aSO->Destroy();
- aSubSO->Destroy();
+ aSO->UnRegister();
+ aSubSO->UnRegister();
}
return aResultSO._retn();
aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs,
theFindMethod, theInheritFirstArg, theAddPrefix);
- if (!CORBA::is_nil(aSO)) aSO->Destroy();
+ if (!CORBA::is_nil(aSO)) aSO->UnRegister();
return aParts._retn();
}
aParts = RestoreGivenSubShapes(theStudy, theObject, aSO, theArgs,
theFindMethod, theInheritFirstArg, theAddPrefix);
- if (!CORBA::is_nil(aSO)) aSO->Destroy();
+ if (!CORBA::is_nil(aSO)) aSO->UnRegister();
return aParts._retn();
}
theObject->SetMarkerTexture(aList[0]->GetMarkerTexture());
}
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
}
}
} // try to build from published parts
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
} // process arguments
}
theObject->SetMarkerTexture(aList[0]->GetMarkerTexture());
}
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
}
}
} // try to build from published parts
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
} // process arguments
}
if (CORBA::is_nil(theMainShape) || theIndices.length() < 1)
return GEOM::GEOM_Object::_nil();
CORBA::String_var entry = theMainShape->GetEntry();
- Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), entry);
- if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil();
+ Handle(GEOM_Object) aMainShape = _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(aMainsShape, anArray, true);
+ Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
if(anObject.IsNull()) return GEOM::GEOM_Object::_nil();
TCollection_AsciiString anEntry;
if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aVal = anIOR->Value();
- anIOR->Destroy();
+ anIOR->UnRegister();
CORBA::Object_var anObject = aStudy->ConvertIORToObject(aVal);
aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
}
if (!aSObj->_is_nil() )
- aSObj->Destroy();
+ aSObj->UnRegister();
const char* aTypeInfo = "Object";
if ( !aGeomObject->_is_nil() ) {
return ret;
}
+// Version information
+char* GEOM_Gen_i::getVersion()
+{
+#if GEOM_DEVELOPMENT
+ return CORBA::string_dup(GEOM_VERSION_STR"dev");
+#else
+ return CORBA::string_dup(GEOM_VERSION_STR);
+#endif
+}
+
//=====================================================================================
// EXPORTED METHODS
//=====================================================================================