mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
Merge branch 'V9_5_BR'
This commit is contained in:
commit
11cbc17d51
@ -31,7 +31,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
|
||||
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
|
||||
SET(${PROJECT_NAME_UC}_VERSION
|
||||
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
|
||||
SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
|
||||
SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
|
||||
|
||||
# Common CMake macros
|
||||
# ===================
|
||||
|
@ -226,23 +226,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObjec
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
|
||||
|
||||
SALOMEDS::SComponent_var aFather = aStudy->FindComponent("GEOM");
|
||||
if (aFather->_is_nil()) {
|
||||
aFather = aStudyBuilder->NewComponent("GEOM");
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
|
||||
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
aName->SetValue("Geometry");
|
||||
aName->UnRegister();
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap");
|
||||
SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||
aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry");
|
||||
aPixMap->UnRegister();
|
||||
aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this());
|
||||
// add component to the use case tree
|
||||
// (to support tree representation customization and drag-n-drop)
|
||||
useCaseBuilder->SetRootCurrent();
|
||||
useCaseBuilder->Append( aFather ); // component object is added as the top level item
|
||||
}
|
||||
SALOMEDS::SComponent_var aFather = findOrCreateComponent();
|
||||
if (aFather->_is_nil()) return aResultSO;
|
||||
|
||||
if (CORBA::is_nil(theSObject)) {
|
||||
@ -2195,6 +2179,41 @@ SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
|
||||
return aStudy;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : findOrCreateComponent()
|
||||
// purpose : Find root study component; create if it does not exist
|
||||
//============================================================================
|
||||
SALOMEDS::SComponent_var GEOM_Gen_i::findOrCreateComponent()
|
||||
{
|
||||
SALOMEDS::SComponent_var aComponent;
|
||||
|
||||
SALOMEDS::Study_var aStudy = getStudyServant();
|
||||
if (aStudy->_is_nil()) return aComponent;
|
||||
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
|
||||
|
||||
aComponent = aStudy->FindComponent(ComponentDataType());
|
||||
if (aComponent->_is_nil()) {
|
||||
aComponent = aStudyBuilder->NewComponent(ComponentDataType());
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aComponent.in(), "AttributeName");
|
||||
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
aName->SetValue("Geometry");
|
||||
aName->UnRegister();
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aComponent.in(), "AttributePixMap");
|
||||
SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||
aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry");
|
||||
aPixMap->UnRegister();
|
||||
aStudyBuilder->DefineComponentInstance(aComponent.in(), (GEOM::GEOM_Gen_var)GEOM_Gen::_this());
|
||||
// add component to the use case tree
|
||||
// (to support tree representation customization and drag-n-drop)
|
||||
useCaseBuilder->SetRootCurrent();
|
||||
useCaseBuilder->Append(aComponent.in()); // component object is added as the top level item
|
||||
}
|
||||
return aComponent;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : Undo
|
||||
// purpose :
|
||||
@ -2866,6 +2885,11 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
|
||||
{
|
||||
SALOMEDS::SObject_var aFolderSO;
|
||||
|
||||
if ( CORBA::is_nil(theFather) ) {
|
||||
SALOMEDS::SComponent_var aComponent = findOrCreateComponent();
|
||||
if (aComponent->_is_nil()) return aFolderSO._retn();
|
||||
theFather = SALOMEDS::SObject::_narrow(aComponent);
|
||||
}
|
||||
if ( CORBA::is_nil(theFather) ) return aFolderSO._retn();
|
||||
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
|
@ -325,6 +325,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
virtual GEOM::GEOM_BaseObject_ptr GetObject(const char* theEntry);
|
||||
|
||||
private:
|
||||
SALOMEDS::SComponent_var findOrCreateComponent();
|
||||
|
||||
GEOM::ListOfGO* RestoreSubShapes (GEOM::GEOM_Object_ptr theObject,
|
||||
SALOMEDS::SObject_ptr theSObject,
|
||||
const GEOM::ListOfGO& theArgs,
|
||||
|
@ -732,8 +732,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
||||
GEOM._objref_GEOM_Gen.__init__(self, *args)
|
||||
self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
|
||||
self.myBuilder = None
|
||||
self.father = None
|
||||
|
||||
self.BasicOp = None
|
||||
self.CurvesOp = None
|
||||
self.PrimOp = None
|
||||
@ -835,18 +833,12 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
||||
def init_geom(self):
|
||||
self.myStudy = salome.myStudy
|
||||
self.myBuilder = self.myStudy.NewBuilder()
|
||||
self.father = self.myStudy.FindComponent("GEOM")
|
||||
notebook.myStudy = salome.myStudy
|
||||
if self.father is None:
|
||||
self.father = self.myBuilder.NewComponent("GEOM")
|
||||
A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
|
||||
FName = A1._narrow(SALOMEDS.AttributeName)
|
||||
FName.SetValue("Geometry")
|
||||
A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
|
||||
aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
|
||||
aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
|
||||
self.myBuilder.DefineComponentInstance(self.father,self)
|
||||
pass
|
||||
|
||||
# load data from the study file, if necessary
|
||||
component = self.myStudy.FindComponent("GEOM")
|
||||
if component:
|
||||
self.myBuilder.LoadWith(component, self)
|
||||
|
||||
self.BasicOp = self.GetIBasicOperations ()
|
||||
self.CurvesOp = self.GetICurvesOperations ()
|
||||
self.PrimOp = self.GetI3DPrimOperations ()
|
||||
@ -861,13 +853,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
||||
self.GroupOp = self.GetIGroupOperations ()
|
||||
self.FieldOp = self.GetIFieldOperations ()
|
||||
|
||||
# set GEOM as root in the use case tree
|
||||
self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder()
|
||||
self.myUseCaseBuilder.SetRootCurrent()
|
||||
self.myUseCaseBuilder.Append(self.father)
|
||||
|
||||
# load data from the study file, if necessary
|
||||
self.myBuilder.LoadWith(self.father, self)
|
||||
notebook.myStudy = salome.myStudy
|
||||
pass
|
||||
|
||||
def GetPluginOperations(self, libraryName):
|
||||
@ -13802,7 +13788,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
||||
Returns:
|
||||
a new created folder
|
||||
"""
|
||||
if not Father: Father = self.father
|
||||
return self.CreateFolder(Name, Father)
|
||||
|
||||
## Move object to the specified folder
|
||||
|
Loading…
Reference in New Issue
Block a user