To show notebook variables in the Object Browser.

This commit is contained in:
rnv 2008-11-01 12:55:44 +00:00
parent 66713229be
commit 1d552bfd2c
6 changed files with 67 additions and 1 deletions

View File

@ -231,6 +231,20 @@ module GEOM
* For example, method return false for GEOM_MARKER
*/
boolean IsShape();
/*!
* Set list of parameters
* \param theParameters is a string containing the notebook variables separated by ":" symbol,
* used for object creation
*/
void SetParameters (in string theParameters);
/*!
* Return list of notebook variables used for object creation separated by ":" symbol
*/
string GetParameters();
};

View File

@ -219,6 +219,14 @@ class GEOM_Object : public MMgt_TShared
//Returns an auxiliary data
Standard_EXPORT TCollection_AsciiString GetAuxData();
//Set a notebook variables used for object creation
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters)
{_parameters = theParameters;}
//Get a notebook variables used for object creation
Standard_EXPORT TCollection_AsciiString GetParameters() const
{return _parameters;}
//###########################################################
// Sub shape methods
//###########################################################
@ -270,6 +278,7 @@ class GEOM_Object : public MMgt_TShared
Handle(TDataStd_TreeNode) _root;
TDF_Label _label;
TCollection_AsciiString _ior;
TCollection_AsciiString _parameters;
};
#endif

View File

@ -272,6 +272,32 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName");
SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr);
aNameAttrib->SetValue(aShapeName.ToCString());
//Set NoteBook variables used in the object creation
TCollection_AsciiString aParams(aShape->GetParameters());
if(!aParams.IsEmpty()) {
TCollection_AsciiString aVars;
int nbVars = 0;
int n = 1;
TCollection_AsciiString aParam = aParams.Token(":",1);
while( aParam.Length() != 0 ) {
aParam = aParams.Token(":",n);
if(theStudy->IsVariable(aParam.ToCString())){
aVars+=aParam;
nbVars++;
}
if(aParam.Length() == 0)
break;
aVars+=":";
n++;
}
aVars.Remove(aVars.Length(),1);
if(nbVars > 0 ) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
aStringAttrib->SetValue(aVars.ToCString());
}
}
//Set a name of the GEOM object
aShape->SetName(theName);

View File

@ -68,7 +68,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double the
Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GetObject(anObject)->SetParameters(GetParameters());
return GetObject(anObject);
}

View File

@ -360,3 +360,14 @@ bool GEOM_Object_i::IsShape()
{
return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER;
}
void GEOM_Object_i::SetParameters(const char* theParameters)
{
_impl->SetParameters((char*)theParameters);
}
char* GEOM_Object_i::GetParameters()
{
return CORBA::string_dup(_impl->GetParameters().ToCString());
}

View File

@ -81,11 +81,16 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
virtual bool IsShape();
virtual void SetParameters(const char* theParameters);
virtual char* GetParameters();
Handle(GEOM_Object) GetImpl() { return _impl; }
private:
GEOM::GEOM_Gen_var _engine;
TCollection_AsciiString _parameters;
Handle(GEOM_Object) _impl;
TopoDS_Shape _geom;
};