void UndoPostponed(in long theWay);
- boolean DumpStudy(in string thePath, in string theBaseName, in boolean isPublished, in string thePrefix);
+ boolean DumpStudy(in string thePath, in string theBaseName, in boolean isPublished);
/*!
Returns an AttributeParameter used to store common parameters for given %theSavePoint.
return v;
}
-void SALOMEDS_IParameters::setDumpPython(bool isDumping)
-{
- if(!_ap) return;
- _ap->SetBool(_AP_DUMP_PYTHON_, isDumping);
-}
-
-bool SALOMEDS_IParameters::isDumpPython()
-{
- if(!_ap) return false;
- if(!_ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
- return (bool)_ap->GetBool(_AP_DUMP_PYTHON_);
-}
-
string SALOMEDS_IParameters::encodeEntry(const string& entry, const string& compName)
{
string tail(entry, 6, entry.length()-1);
return newEntry;
}
+void SALOMEDS_IParameters::setDumpPython(_PTR(Study) study, const string& theID)
+{
+ string anID;
+ if(theID == "") anID = getDefaultVisualComponent();
+ else anID = theID;
+
+ _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
+ ap->SetBool(_AP_DUMP_PYTHON_, true);
+}
+
+bool SALOMEDS_IParameters::isDumpPython(_PTR(Study) study, const string& theID)
+{
+ string anID;
+ if(theID == "") anID = getDefaultVisualComponent();
+ else anID = theID;
+
+ _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
+ if(!ap) return false;
+ if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
+ return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
+}
int SALOMEDS_IParameters::getLastSavePoint(_PTR(Study) study, const string& theID)
{
- _PTR(SObject) so = study->FindComponent(theID);
+ string anID;
+ if(theID == "") anID = getDefaultVisualComponent();
+ else anID = theID;
+
+ _PTR(SObject) so = study->FindComponent(anID);
if(!so) return -1;
_PTR(StudyBuilder) builder = study->NewBuilder();
string SALOMEDS_IParameters::getDefaultScript(_PTR(Study) study,
- const string& theID,
const string& moduleName,
- const string& shift)
+ const string& shift,
+ const string& theID)
{
+ string anID;
+ if(theID == "") anID = getDefaultVisualComponent();
+ else anID = theID;
string dump("");
- int savePoint = SALOMEDS_IParameters::getLastSavePoint(study, theID);
+ int savePoint = SALOMEDS_IParameters::getLastSavePoint(study, anID);
if(savePoint < 0) return dump;
- SALOMEDS_IParameters ip = SALOMEDS_IParameters(study->GetCommonParameters(theID, savePoint));
- if(!ip.isDumpPython()) return dump;
+ SALOMEDS_IParameters ip = SALOMEDS_IParameters(study->GetCommonParameters(anID, savePoint));
+ if(!isDumpPython(study)) return dump;
- _PTR(AttributeParameter) ap = study->GetModuleParameters(theID, moduleName,savePoint);
+ _PTR(AttributeParameter) ap = study->GetModuleParameters(anID, moduleName,savePoint);
ip = SALOMEDS_IParameters(ap);
dump += shift +"import iparameters\n";
- dump += shift + "ipar = iparameters.IParameters(theStudy.GetModuleParameters(\""+theID+"\", \""+moduleName+"\", 1))\n\n";
+ dump += shift + "ipar = iparameters.IParameters(theStudy.GetModuleParameters(\""+anID+"\", \""+moduleName+"\", 1))\n\n";
vector<string> v = ip.getProperties();
if(v.size() > 0) {
return dump;
}
-string SALOMEDS_IParameters::getStudyScript(_PTR(Study) study, const std::string& theID, int savePoint)
-{
- _PTR(AttributeParameter) ap = study->GetCommonParameters(theID, savePoint);
- SALOMEDS_IParameters ip(ap);
- ip.setDumpPython(true); //Enable DumpPython of visual parameters for modules.
- string dump("");
+string SALOMEDS_IParameters::getDefaultVisualComponent()
+{
+ return "Interface Applicative";
+}
- dump += "import iparameters\n";
- dump += "ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters(\""+theID+"\", 1))\n\n";
-
-
- vector<string> v = ip.getProperties();
- if(v.size() > 0) {
- dump += "#Set up visual properties:\n";
- for(int i = 0; i<v.size(); i++) {
- string prp = ip.getProperty(v[i]);
- dump += "ipar.setProperty(\""+v[i]+"\", \""+prp+"\")\n";
- }
- }
- v = ip.getLists();
- if(v.size() > 0) {
- dump += "#Set up lists:\n";
- for(int i = 0; i<v.size(); i++) {
- vector<string> lst = ip.getValues(v[i]);
- dump += "# fill list "+v[i]+"\n";
- for(int j = 0; j < lst.size(); j++)
- dump += "ipar.append(\""+v[i]+"\", \""+lst[j]+"\")\n";
- }
- }
- return dump;
-}
Returns a number of the added value.
Note: the name of the list MUST be unique
*/
- int append(const std::string& listName, const std::string& value);
+ virtual int append(const std::string& listName, const std::string& value);
/*!
Returns a number elements in the list
*/
- int nbValues(const std::string& listName);
+ virtual int nbValues(const std::string& listName);
/*!
Returns a list of values in the list
*/
- std::vector<std::string> getValues(const std::string& listName);
+ virtual std::vector<std::string> getValues(const std::string& listName);
/*!
Returns a value with given %index, where %index is in range [0:nbValues-1]
*/
- std::string getValue(const std::string& listName, int index);
+ virtual std::string getValue(const std::string& listName, int index);
/*!
Returns a list all entries lists
*/
- std::vector<std::string> getLists();
+ virtual std::vector<std::string> getLists();
/*!
Sets a new named parameter value for the given entry
*/
- void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value);
+ virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value);
/*!
Gets a named parameter value for the given entry
*/
- std::string getParameter(const std::string& entry, const std::string& parameterName);
+ virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
/*!
Returns all parameter names of the given entry
*/
- std::vector<std::string> SALOMEDS_IParameters::getAllParameterNames(const std::string& entry);
+ virtual std::vector<std::string> getAllParameterNames(const std::string& entry);
/*!
Returns all parameter values of the given entry
*/
- std::vector<std::string> SALOMEDS_IParameters::getAllParameterValues(const std::string& entry);
+ virtual std::vector<std::string> getAllParameterValues(const std::string& entry);
/*!
Returns a number of parameters of the given entry
*/
- int getNbParameters(const std::string& entry);
+ virtual int getNbParameters(const std::string& entry);
/*!
Returns a list all entries
*/
- std::vector<std::string> getEntries();
+ virtual std::vector<std::string> getEntries();
/*!
Sets a global named property value
*/
- void setProperty(const std::string& name, const std::string& value);
+ virtual void setProperty(const std::string& name, const std::string& value);
/*!
Gets a value of global named property
*/
- std::string getProperty(const std::string& name);
+ virtual std::string getProperty(const std::string& name);
/*!
Returns a list all properties
*/
- std::vector<std::string> getProperties();
+ virtual std::vector<std::string> getProperties();
/*!
Breaks a value string in two parts which is divided by %separator.
If fromEnd is True the search of separator starts from the end of the string
*/
- std::vector<std::string> parseValue(const std::string& value, const char separator, bool fromEnd = true);
+ virtual std::vector<std::string> parseValue(const std::string& value, const char separator, bool fromEnd = true);
- /*!
- Enables/Disables the dumping visual parameters
- */
- void setDumpPython(bool isDumping);
-
- /*!
- Returns whether there is the dumping visual parameters
- */
- bool isDumpPython();
-
/*!
Returns encoded entry that is a relative entry for the component
*/
- std::string encodeEntry(const std::string& entry, const std::string& compName);
+ virtual std::string encodeEntry(const std::string& entry, const std::string& compName);
/*!
Returns decoded entry that is an absolute entry
*/
- std::string decodeEntry(const std::string& entry);
+ virtual std::string decodeEntry(const std::string& entry);
/*!
Returns an ID of the last save point
*/
- static int getLastSavePoint(_PTR(Study) study, const std::string& theID);
+ static int getLastSavePoint(_PTR(Study) study, const std::string& theID = "");
/*!
Returns a default Python script that set ups visual parameters for the given module
+ shift is a string that contain spaces to make valid Python script indentaion
*/
static std::string getDefaultScript(_PTR(Study) study,
- const std::string& theID,
const std::string& moduleName,
- const std::string& shift);
+ const std::string& shift,
+ const std::string& theID = "");
+
+ /*!
+ Enables/Disables the dumping visual parameters
+ */
+ static void setDumpPython(_PTR(Study) study, const std::string& theID = "");
+
+ /*!
+ Returns whether there is the dumping visual parameters
+ */
+ static bool isDumpPython(_PTR(Study) study, const std::string& theID = "");
/*!
- Returns a Python script for the study, which sets up visual parameters
+ Returns a default name of the component where the visula parameters are stored.
*/
- static std::string getStudyScript(_PTR(Study) study, const std::string& theID, int savePoint);
+ static std::string getDefaultVisualComponent();
private:
_PTR(AttributeParameter) _ap;
else _corba_impl->EnableUseCaseAutoFilling(isEnabled);
}
-bool SALOMEDS_Study::DumpStudy(const string& thePath, const string& theBaseName, bool isPublished, const string& thePrefix)
+bool SALOMEDS_Study::DumpStudy(const string& thePath, const string& theBaseName, bool isPublished)
{
//SRN: Pure CORBA DumpStudy as it does more cleaning than the local one
- bool ret = _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished, thePrefix.c_str());
+ bool ret = _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished);
return ret;
}
_PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const string& theID, int theSavePoint)
{
SALOMEDSClient_AttributeParameter* AP = NULL;
- if(theSavePoint > 0) {
+ if(theSavePoint >= 0) {
if (_isLocal) {
SALOMEDS::Locker lock;
AP = new SALOMEDS_AttributeParameter(_local_impl->GetCommonParameters(theID.c_str(), theSavePoint));
virtual _PTR(UseCaseBuilder) GetUseCaseBuilder();
virtual void Close();
virtual void EnableUseCaseAutoFilling(bool isEnabled);
- virtual bool DumpStudy(const std::string& thePath,const std::string& theBaseName,bool isPublished,const std::string& thePrefix);
+ virtual bool DumpStudy(const std::string& thePath,const std::string& theBaseName,bool isPublished);
virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint);
virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID,
const std::string& theModuleName, int theSavePoint);
//============================================================================
CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath,
const char* theBaseName,
- CORBA::Boolean isPublished,
- const char* thePrefix)
+ CORBA::Boolean isPublished)
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName), aPrefix((char*)thePrefix);
+ TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName);
SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
- CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory, aPrefix);
+ CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory);
delete factory;
return ret;
}
const char* theModuleName,
CORBA::Long theSavePoint);
- virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished, const char* thePrefix);
+ virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
virtual void EnableUseCaseAutoFilling(bool isEnabled) = 0;
virtual bool DumpStudy(const std::string& thePath,
const std::string& theBaseName,
- bool isPublished,
- const std::string& thePrefix) = 0;
+ bool isPublished) = 0;
virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint) = 0;
virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID,
const std::string& theModuleName, int theSavePoint) = 0;