from salome.geom import geomBuilder
lcc = salome.lcc
engineGeom = lcc.FindOrLoadComponent("myServer", "GEOM")
-geompy = geomBuilder.New(theStudy, engineGeom)
+geompy = geomBuilder.New(engineGeom)
\endcode
Or, within a Distributed Python Node of a YACS Schema, where the container
from salome.geom import geomBuilder
my_container.load_component_Library("GEOM")
engineGeom = my_container.create_component_instance("GEOM")
-geompy = geomBuilder.New(theStudy, engineGeom)
+geompy = geomBuilder.New(engineGeom)
\endcode
//=================================================================================
bool EntityGUI_FieldDlg::execute()
{
- SALOMEDS::Study_var aStudyDS = GeometryGUI::GetStudy();
+ SALOMEDS::Study_var aStudyDS = GeometryGUI::getStudyServant();
SALOMEDS::StudyBuilder_var aBuilder = aStudyDS->NewBuilder();
QString aName = getNewObjectName().trimmed();
void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj,
const QStringList& theParameters)
{
- SALOMEDS::Study_var aStudy = GeometryGUI::GetStudy();
+ SALOMEDS::Study_var aStudy = GeometryGUI::getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry());
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
#include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx>
-#include <SalomeApp_Study.h>
+#include <SalomeApp_Application.h>
// Static patterns for casting value-to-string & value-from-string. The patterns are:
// ITEM: { name[string] : visibility : type : values[composite] };
// function : Init constructor
// purpose :
//=================================================================================
-GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry )
+GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( const std::string& theEntry )
{
- LoadFromAttribute( theStudy, theEntry );
+ LoadFromAttribute( theEntry );
}
//=================================================================================
// function : LoadFromAttribute
// purpose :
//=================================================================================
-void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy,
- const std::string& theEntry )
+void GEOMGUI_DimensionProperty::LoadFromAttribute( const std::string& theEntry )
{
Clear();
- _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
+ _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj )
{
return;
}
- _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder();
+ _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(GenericAttribute) aSeekAtt;
_PTR(AttributeTableOfReal) aRecordsAtt;
// function : SaveToAttribute
// purpose :
//=================================================================================
-void GEOMGUI_DimensionProperty::SaveToAttribute( SalomeApp_Study *theStudy,
- const std::string &theEntry )
+void GEOMGUI_DimensionProperty::SaveToAttribute( const std::string &theEntry )
{
- _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
+ _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj )
{
return;
}
- _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder();
+ _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(AttributeTableOfReal) aRecordsAtt;
/*!
* \brief Constructor. Inits property from attribute.
*/
- GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry );
+ GEOMGUI_DimensionProperty( const std::string& theEntry );
/*!
* \brief Constructor. Inits property from formatted QString.
/*!
* \brief Loads properties data from attribute "AttributeTableOfReal".
- * \param theStudy [in] the study.
* \param theEntry [in] the entry of GEOM object to operate with.
*/
- void LoadFromAttribute( SalomeApp_Study* theStudy, const std::string& theEntry );
+ void LoadFromAttribute( const std::string& theEntry );
/*!
* \brief Saves properties data to attribute "AttributeTableOfReal".
- * \param theStudy [in] the study.
* \param theEntry [in] the entry of GEOM object to operate with.
*/
- void SaveToAttribute( SalomeApp_Study* theStudy, const std::string& theEntry );
+ void SaveToAttribute( const std::string& theEntry );
private:
bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const
{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
-
- if ( !appStudy )
- {
- return false;
- }
-
QString anEntry = entry( theIndex );
- _PTR(Study) aStudy = appStudy->studyDS();
- if ( !aStudy || anEntry.isNull() )
+ if ( anEntry.isNull() )
{
return false;
}
- GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() );
+ GEOMGUI_DimensionProperty aDimensions( anEntry.toStdString() );
theHidden = false;
theVisible = false;
QString aName = obj->GetName().c_str();
GEOMGUI_DimensionProperty aProp;
- aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ aProp.LoadFromAttribute( theEntry.toStdString() );
int nbProps = aProp.GetNumber();
QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
std::string anEntry = entryFromItem( theItem->parent() ).toStdString();
int aDimIndex = idFromItem( theItem );
GEOMGUI_DimensionProperty aProp;
- aProp.LoadFromAttribute( myStudy, anEntry );
+ aProp.LoadFromAttribute( anEntry );
if ( aProp.IsVisible( aDimIndex ) ) {
aProp.SetVisible( aDimIndex, false );
theItem->setIcon( 1, myInvisibleIcon );
aProp.SetVisible( aDimIndex, true );
theItem->setIcon( 1, myVisibleIcon );
}
- aProp.SaveToAttribute( myStudy, anEntry );
+ aProp.SaveToAttribute( anEntry );
redisplay( anEntry.c_str() );
}
for ( int i=0; i < anItem->childCount(); i++ ) {
aChildItem = anItem->child( i );
if ( theState == Qtx::ShownState ) {
- aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ aProp.LoadFromAttribute( theEntry.toStdString() );
if ( aProp.GetNumber() == 0 )
continue;
aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon );
QString anEntry = entryFromItem( anItem->parent() );
if ( !anEntry.isEmpty() ) {
GEOMGUI_DimensionProperty aProp;
- aProp.LoadFromAttribute( myStudy, anEntry.toStdString() );
+ aProp.LoadFromAttribute( anEntry.toStdString() );
if ( aProp.GetNumber() == 0 )
return;
aMenu.clear();
void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility )
{
GEOMGUI_DimensionProperty aProp;
- aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ aProp.LoadFromAttribute( theEntry.toStdString() );
int aDimIndex = idFromItem( theDimItem );
if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility )
return;;
aProp.SetVisible( aDimIndex, theVisibility );
- aProp.SaveToAttribute( myStudy, theEntry.toStdString() );
+ aProp.SaveToAttribute( theEntry.toStdString() );
theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon );
redisplay( theEntry );
}
else
{
- aRecords.LoadFromAttribute( getStudy(), theIO->getEntry() );
+ aRecords.LoadFromAttribute( theIO->getEntry() );
}
// create up-to-date dimension presentations
// function : GetStudy
// purpose :
//=======================================================================
-SALOMEDS::Study_var GeometryGUI::GetStudy()
+SALOMEDS::Study_var GeometryGUI::getStudyServant()
{
SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
CORBA::Object_var aStudyObject = aNamingService->Resolve("/Study");
std::string aStudyEntry = (*aEntryIt).toLatin1().data();
std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName);
- GEOMGUI_DimensionProperty aDimensions( appStudy, aStudyEntry );
+ GEOMGUI_DimensionProperty aDimensions( aStudyEntry );
if ( aDimensions.GetNumber() == 0 )
{
if ( aParamNameStr == GEOM::propertyName( GEOM::Dimensions ) )
{
GEOMGUI_DimensionProperty aDimensionProp( aValuesStr );
- aDimensionProp.SaveToAttribute( appStudy, entry.toLatin1().data() );
+ aDimensionProp.SaveToAttribute( entry.toLatin1().data() );
}
continue;
static GEOM::GEOM_Gen_var GetGeomGen();
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
- static SALOMEDS::Study_var GetStudy();
+ static SALOMEDS::Study_var getStudyServant();
static void Modified( bool = true );
CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript)
{
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
if(CORBA::is_nil(aStudy))
return new Engines::TMPFile(0);
{
Unexpect aCatch(SALOME_SalomeException);
SALOMEDS::SObject_var aResultSO;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
if(CORBA::is_nil(theObject) || aStudy->_is_nil()) return aResultSO;
GEOM::GEOM_BaseObject_var aBaseObj = GEOM::GEOM_BaseObject::_narrow(theObject);
GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow(theObject);
TCollection_AsciiString aNameWithExt("");
if (isMultiFile)
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
- (GetStudy()->URL())).c_str());
+ (getStudyServant()->URL())).c_str());
#if OCC_VERSION_MAJOR > 6
aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
#else
// Prepare a file name to open
TCollection_AsciiString aNameWithExt("");
- SALOMEDS::Study_var study = GetStudy();
+ SALOMEDS::Study_var study = getStudyServant();
#if OCC_VERSION_MAJOR > 6
// Get the file name.
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject) {
// Find the current Study and StudyBuilder
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_var anUseCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var aNewSO;
GEOM::GEOM_BaseObject_ptr theFather)
{
SALOMEDS::SObject_var aResultSO;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
if(theObject->_is_nil() || aStudy->_is_nil()) return aResultSO;
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject))
return aParts._retn();
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
- if (CORBA::is_nil(GetStudy()) || CORBA::is_nil(theObject))
+ if (CORBA::is_nil(getStudyServant()) || CORBA::is_nil(theObject))
return aParts._retn();
// find SObject in the study if it is already published
CORBA::String_var anIORo = _orb->object_to_string(theObject);
- SALOMEDS::SObject_var aSO = GetStudy()->FindObjectIOR(anIORo.in());
+ SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectIOR(anIORo.in());
//PTv, IMP 0020001, The salome object <aSO>
// is not obligatory in case of invokation from script
// if (CORBA::is_nil(aSO))
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
- if (CORBA::is_nil(GetStudy()) || CORBA::is_nil(theSObject))
+ if (CORBA::is_nil(getStudyServant()) || CORBA::is_nil(theSObject))
return aParts._retn();
SALOMEDS::GenericAttribute_var anAttr;
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
//PTv, IMP 0020001, The salome object <theSObject>
// is not obligatory in case of invokation from script
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
CORBA::Boolean theAddPrefix)
{
int i = 0;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO;
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) ||
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
//PTv, IMP 0020001, The salome object <theSObject>
// is not obligatory in case of invokation from script
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
CORBA::Boolean theAddPrefix)
{
int i = 0;
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO;
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) ||
}
//============================================================================
-// function : GetStudy()
+// function : getStudyServant()
// purpose : Get Study
//============================================================================
-SALOMEDS::Study_var GEOM_Gen_i::GetStudy()
+SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
{
static SALOMEDS::Study_var aStudy;
if(CORBA::is_nil(aStudy)){
{
GEOM::GEOM_Object_var aGeomObject;
- SALOMEDS::SObject_var aSObj = GetStudy()->FindObjectID( entry );
+ SALOMEDS::SObject_var aSObj = getStudyServant()->FindObjectID( entry );
SALOMEDS::SObject_var aResultSObj;
if (aSObj->ReferencedObject(aResultSObj))
aSObj = aResultSObj;
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aVal = anIOR->Value();
anIOR->UnRegister();
- CORBA::Object_var anObject = GetStudy()->ConvertIORToObject(aVal);
+ CORBA::Object_var anObject = getStudyServant()->ConvertIORToObject(aVal);
aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
}
if (!aSObj->_is_nil() )
aLocalID->UnRegister();
}
- SALOMEDS::Study_var aStudy = GetStudy();
+ SALOMEDS::Study_var aStudy = getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder( aStudy->NewBuilder() );
aFolderSO = aStudyBuilder->NewObject( theFather );
SALOMEDS::SObject_ptr theFolder) {
GEOM::object_list_var objects = new GEOM::object_list();
objects->length( 1 );
- SALOMEDS::SObject_var aSO = GetStudy()->FindObjectID( theObject->GetStudyEntry() );
+ SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectID( theObject->GetStudyEntry() );
objects[0] = aSO;
Move( objects, theFolder, -1 );
}
SALOMEDS::SObject_var aSO;
for (int i = 0; i < aLen; i++) {
aGO = GEOM::GEOM_Object::_duplicate( theListOfGO[i] );
- aSO = GetStudy()->FindObjectID( aGO->GetStudyEntry() );
+ aSO = getStudyServant()->FindObjectID( aGO->GetStudyEntry() );
objects[i] = aSO;
}
if ( objects->length() > 0 )
{
if ( CORBA::is_nil( where ) ) return;
- SALOMEDS::Study_var study = GetStudy();
+ SALOMEDS::Study_var study = getStudyServant();
SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
SALOMEDS::SComponent_var father = where->GetFatherComponent();
SALOME_NamingService* GetNS() { return name_service; }
// Get Study
- SALOMEDS::Study_var GetStudy();
+ SALOMEDS::Study_var getStudyServant();
//-----------------------------------------------------------------------//
// Inherited methods from SALOMEDS::Driver //
## @addtogroup l1_geomBuilder_auxiliary
## @{
- def init_geom(self,theStudy):
- self.myStudy = theStudy
+ def init_geom(self):
+ self.myStudy = salome.myStudy
self.myBuilder = self.myStudy.NewBuilder()
self.father = self.myStudy.FindComponent("GEOM")
- notebook.myStudy = theStudy
+ notebook.myStudy = salome.myStudy
if self.father is None:
self.father = self.myBuilder.NewComponent("GEOM")
A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
return;
}
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
- if ( !aStudy )
- {
- return;
- }
-
LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( !aSelMgr )
{
SUIT_OverrideCursor wc;
- GEOMGUI_DimensionProperty aDimensions( aStudy, anIObject->getEntry() );
+ std::string anEntry(anIObject->getEntry());
+ GEOMGUI_DimensionProperty aDimensions( anEntry );
for ( int anIt = 0; anIt < aDimensions.GetNumber(); ++anIt )
{
aDimensions.SetVisible( anIt, theIsVisible );
}
- aDimensions.SaveToAttribute( aStudy, anIObject->getEntry() );
+ aDimensions.SaveToAttribute( anIObject->getEntry() );
GEOM_Displayer().Redisplay( anIObject, true );
}
QVariant() )
.value<GEOMGUI_DimensionProperty>();
- mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
+ mySavedPropertyState.SaveToAttribute( myEditObject->GetStudyEntry() );
myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
return;
}
- mySavedPropertyState.LoadFromAttribute( getStudy(), myEditObject->GetStudyEntry() );
+ mySavedPropertyState.LoadFromAttribute( myEditObject->GetStudyEntry() );
// set property state for preview
aStudy->setObjectProperty( GEOM::sharedPropertiesId(),