-// 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 = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for the method AddInStudy with theFather argumenet != NULL
//THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM);
}
- anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR");
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aGeomObjIOR = _orb->object_to_string(theObject);
- anIOR->SetValue(aGeomObjIOR);
- anIOR->Destroy();
+ aResultSO->SetAttrString("AttributeIOR",aGeomObjIOR);
- anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
- SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
TCollection_AsciiString aShapeName("Shape_");
- if ( aShape->GetType() == GEOM_GROUP ) {
+ CORBA::Long mytype=aShape->GetType();
+ if ( mytype == GEOM_GROUP ) {
GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() );
switch ( (TopAbs_ShapeEnum)anOp->GetType( aShape ) ) {
case TopAbs_VERTEX:
- aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_PNT" );
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_PNT" );
aShapeName = "Group_Of_Vertices_";
break;
case TopAbs_EDGE:
- aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_EDGE" );
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_EDGE");
aShapeName = "Group_Of_Edges_";
break;
case TopAbs_FACE:
- aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_FACE" );
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_FACE");
aShapeName = "Group_Of_Faces_";
break;
case TopAbs_SOLID:
- aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_SOLID" );
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_SOLID");
aShapeName = "Group_Of_Solids_";
break;
}
- } else if ( aShape->GetType() == GEOM_MARKER ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_LCS" );
+ } else if ( mytype == GEOM_MARKER ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS");
aShapeName = "LocalCS_";
- } else if ( aShape->GetType() > ADVANCED_BASE ) {
+ } else if ( mytype > ADVANCED_BASE ) {
char buf[20];
sprintf( buf, "%d", aShape->GetType() );
std::string advId = "ICON_OBJBROWSER_ADVANCED_"; advId += buf;
- aPixmap->SetPixMap( advId.c_str() );
+ aResultSO->SetAttrString("AttributePixMap",advId.c_str());
aShapeName = "Advanced_";
- } else if ( aShape->GetShapeType() == GEOM::COMPOUND ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
+ } else {
+ GEOM::shape_type myshapetype=aShape->GetShapeType();
+ if ( myshapetype == GEOM::COMPOUND ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" );
aShapeName = "Compound_";
- } else if ( aShape->GetShapeType() == GEOM::COMPSOLID ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
+ } else if ( myshapetype == GEOM::COMPSOLID ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID");
aShapeName = "Compsolid_";
- } else if ( aShape->GetShapeType() == GEOM::SOLID ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
+ } else if ( myshapetype == GEOM::SOLID ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID");
aShapeName = "Solid_";
- } else if ( aShape->GetShapeType() == GEOM::SHELL ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
+ } else if ( myshapetype == GEOM::SHELL ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL");
aShapeName = "Shell_";
- } else if ( aShape->GetShapeType() == GEOM::FACE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
+ } else if ( myshapetype == GEOM::FACE ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE");
aShapeName = "Face_";
- } else if ( aShape->GetShapeType() == GEOM::WIRE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
+ } else if ( myshapetype == GEOM::WIRE ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE");
aShapeName = "Wire_";
- } else if ( aShape->GetShapeType() == GEOM::EDGE ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
+ } else if ( myshapetype == GEOM::EDGE ) {
+ aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE");
aShapeName = "Edge_";
- } else if ( aShape->GetShapeType() == GEOM::VERTEX ) {
- aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
+ } else if ( myshapetype == GEOM::VERTEX ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" );
aShapeName = "Vertex_";
}
- aPixmap->Destroy();
+ }
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
//else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName));
aShape->SetStudyEntry(anID.in());
//Set a name of the added shape
- anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName");
- SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr);
- aNameAttrib->SetValue(aShapeName.ToCString());
- aNameAttrib->Destroy();
+ aResultSO->SetAttrString("AttributeName",aShapeName.ToCString());
//Set NoteBook variables used in the object creation
TCollection_AsciiString 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();
+ 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
//=====================================================================================