mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-31 01:59:52 +05:00
IMP 0020001 (replace set of GetInPlace commands by one RestoreSubShapes)
This commit is contained in:
parent
fb601e2825
commit
aaa5aa61bb
@ -2991,11 +2991,11 @@ module GEOM
|
|||||||
* considered as True, not regarding really passed value.
|
* considered as True, not regarding really passed value.
|
||||||
* \return True in case of success, False otherwise.
|
* \return True in case of success, False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean RestoreSubShapesO (in SALOMEDS::Study theStudy,
|
ListOfGO RestoreSubShapesO (in SALOMEDS::Study theStudy,
|
||||||
in GEOM_Object theObject,
|
in GEOM_Object theObject,
|
||||||
in ListOfGO theArgs,
|
in ListOfGO theArgs,
|
||||||
in find_shape_method theFindMethod,
|
in find_shape_method theFindMethod,
|
||||||
in boolean theInheritFirstArg);
|
in boolean theInheritFirstArg);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Publish sub-shapes, standing for arguments and sub-shapes of arguments
|
* Publish sub-shapes, standing for arguments and sub-shapes of arguments
|
||||||
@ -3003,11 +3003,11 @@ module GEOM
|
|||||||
* Work like the above method, but accepts study object theSObject instead of GEOM_Object.
|
* Work like the above method, but accepts study object theSObject instead of GEOM_Object.
|
||||||
* \param theSObject study object, referencing GEOM object, arguments of which will be published
|
* \param theSObject study object, referencing GEOM object, arguments of which will be published
|
||||||
*/
|
*/
|
||||||
boolean RestoreSubShapesSO (in SALOMEDS::Study theStudy,
|
ListOfGO RestoreSubShapesSO (in SALOMEDS::Study theStudy,
|
||||||
in SALOMEDS::SObject theSObject,
|
in SALOMEDS::SObject theSObject,
|
||||||
in ListOfGO theArgs,
|
in ListOfGO theArgs,
|
||||||
in find_shape_method theFindMethod,
|
in find_shape_method theFindMethod,
|
||||||
in boolean theInheritFirstArg);
|
in boolean theInheritFirstArg);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Methods to access interfaces for objects creation and transformation
|
* Methods to access interfaces for objects creation and transformation
|
||||||
|
@ -102,19 +102,38 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID)
|
|||||||
return aDocID.IntegerValue();
|
return aDocID.IntegerValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
TCollection_AsciiString& theScript,
|
TCollection_AsciiString& theScript,
|
||||||
|
TCollection_AsciiString& theAfterScript,
|
||||||
const TVariablesList& theVariables,
|
const TVariablesList& theVariables,
|
||||||
|
const bool theIsPublished,
|
||||||
TDF_LabelMap& theProcessed,
|
TDF_LabelMap& theProcessed,
|
||||||
std::set<std::string>& theDumpedObjs);
|
std::set<std::string>& theIgnoreObjs,
|
||||||
|
bool& theIsDumpCollected);
|
||||||
|
|
||||||
void ReplaceVariables(TCollection_AsciiString& theCommand,
|
void ReplaceVariables(TCollection_AsciiString& theCommand,
|
||||||
const TVariablesList& theVariables);
|
const TVariablesList& theVariables);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
||||||
|
|
||||||
|
void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
|
||||||
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
const bool theIsPublished,
|
||||||
|
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
|
||||||
|
TColStd_SequenceOfAsciiString& theObjListToPublish);
|
||||||
|
|
||||||
|
void AddObjectColors (const Handle(TDocStd_Document)& theDoc,
|
||||||
|
TCollection_AsciiString& theScript,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames);
|
||||||
|
|
||||||
|
void PublishObject (const TCollection_AsciiString& theEntry,
|
||||||
|
const TCollection_AsciiString& theName,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
|
||||||
|
std::map< int, std::string >& theEntryToCommandMap,
|
||||||
|
std::set<std::string>& theMapOfPublished);
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -477,24 +496,6 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
|
|
||||||
Standard_Integer posToInsertGlobalVars = aScript.Length() + 1;
|
Standard_Integer posToInsertGlobalVars = aScript.Length() + 1;
|
||||||
|
|
||||||
Handle(TDataStd_TreeNode) aNode, aRoot;
|
|
||||||
Handle(GEOM_Function) aFunction;
|
|
||||||
TDF_LabelMap aCheckedFuncMap;
|
|
||||||
std::set<std::string> anIgnoreObjMap;
|
|
||||||
|
|
||||||
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
|
|
||||||
TDataStd_ChildNodeIterator Itr(aRoot);
|
|
||||||
for (; Itr.More(); Itr.Next()) {
|
|
||||||
aNode = Itr.Value();
|
|
||||||
aFunction = GEOM_Function::GetFunction(aNode->Label());
|
|
||||||
if (aFunction.IsNull()) {
|
|
||||||
MESSAGE ( "Null function !!!!" );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ProcessFunction(aFunction, aScript, theVariables, aCheckedFuncMap, anIgnoreObjMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry;
|
Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry;
|
||||||
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt;
|
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt;
|
||||||
// build maps entry <-> studyEntry
|
// build maps entry <-> studyEntry
|
||||||
@ -516,97 +517,90 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript);
|
// collect objects entries to be published
|
||||||
Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length();
|
TColStd_SequenceOfAsciiString aObjListToPublish;
|
||||||
Resource_DataMapOfAsciiStringAsciiString aNameToEntry, anEntryToBadName;
|
|
||||||
|
// iterates on functions till critical (that requiers publication of objects)
|
||||||
|
Handle(TDataStd_TreeNode) aNode, aRoot;
|
||||||
|
Handle(GEOM_Function) aFunction;
|
||||||
|
TDF_LabelMap aCheckedFuncMap;
|
||||||
|
std::set<std::string> anIgnoreObjMap;
|
||||||
|
|
||||||
//Replace entries by the names
|
TCollection_AsciiString aFuncScript;
|
||||||
TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"),
|
Resource_DataMapOfAsciiStringAsciiString anEntryToBadName;
|
||||||
allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
|
|
||||||
if (aLen == 0) anUpdatedScript = aScript;
|
|
||||||
|
|
||||||
for (Standard_Integer i = 1; i <= aLen; i+=2) {
|
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
|
||||||
anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1);
|
TDataStd_ChildNodeIterator Itr(aRoot);
|
||||||
anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1));
|
for (; Itr.More(); Itr.Next()) {
|
||||||
if (theObjectNames.IsBound(anEntry)) {
|
aNode = Itr.Value();
|
||||||
aName = theObjectNames.Find(anEntry);
|
aFunction = GEOM_Function::GetFunction(aNode->Label());
|
||||||
// check validity of aName
|
if (aFunction.IsNull()) {
|
||||||
bool isValidName = true;
|
MESSAGE ( "Null function !!!!" );
|
||||||
if ( aName.IsIntegerValue() ) { // aName must not start with a digit
|
continue;
|
||||||
aName.Insert( 1, 'a' );
|
|
||||||
isValidName = false;
|
|
||||||
}
|
}
|
||||||
int p, p2=1; // replace not allowed chars
|
bool isDumpCollected = false;
|
||||||
while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) {
|
TCollection_AsciiString aCurScript, anAfterScript;
|
||||||
aName.SetValue(p, '_');
|
if (!ProcessFunction(aFunction, aCurScript, anAfterScript, theVariables,
|
||||||
p2=p;
|
isPublished, aCheckedFuncMap, anIgnoreObjMap,
|
||||||
isValidName = false;
|
isDumpCollected ))
|
||||||
}
|
continue;
|
||||||
if ( aNameToEntry.IsBound( aName ) && anEntry != aNameToEntry( aName ))
|
// add function description before dump
|
||||||
{ // diff objects have same name - make a new name by appending a digit
|
if (!aCurScript.IsEmpty())
|
||||||
TCollection_AsciiString aName2;
|
aFuncScript += aCurScript;
|
||||||
Standard_Integer i = 0;
|
if (isDumpCollected ) {
|
||||||
do {
|
// Replace entries by the names
|
||||||
aName2 = aName + "_" + ++i;
|
ReplaceEntriesByNames( aFuncScript, theObjectNames,
|
||||||
} while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 ));
|
isPublished, anEntryToBadName, aObjListToPublish );
|
||||||
aName = aName2;
|
|
||||||
isValidName = false;
|
// publish collected objects
|
||||||
}
|
std::map< int, std::string > anEntryToCommandMap; // sort publishing commands by object entry
|
||||||
if ( !isValidName ) {
|
int i = 1, n = aObjListToPublish.Length();
|
||||||
if ( isPublished )
|
for ( ; i <= n; i++ )
|
||||||
anEntryToBadName.Bind( anEntry, theObjectNames.Find(anEntry) );
|
{
|
||||||
theObjectNames( anEntry ) = aName;
|
const TCollection_AsciiString& aEntry = aObjListToPublish.Value(i);
|
||||||
|
if (!theObjectNames.IsBound( aEntry ))
|
||||||
|
continue;
|
||||||
|
PublishObject( aEntry, theObjectNames.Find(aEntry),
|
||||||
|
theObjectNames, aEntry2StEntry, aStEntry2Entry,
|
||||||
|
anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap );
|
||||||
|
}
|
||||||
|
// add publishing commands to the script
|
||||||
|
std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin();
|
||||||
|
for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand )
|
||||||
|
aFuncScript += (char*)anEntryToCommand->second.c_str();
|
||||||
|
|
||||||
|
// PTv, 0020001 add result objects from RestoreSubShapes into ignore list,
|
||||||
|
// because they will be published during command execution
|
||||||
|
int indx = anAfterScript.Search( "RestoreSubShapes" );
|
||||||
|
if ( indx != -1 ) {
|
||||||
|
TCollection_AsciiString aSubStr = anAfterScript.SubString(1, indx);
|
||||||
|
Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aSubStr);
|
||||||
|
i = 1, n = aSeq->Length();
|
||||||
|
for ( ; i <= n; i+=2) {
|
||||||
|
TCollection_AsciiString anEntry =
|
||||||
|
aSubStr.SubString(aSeq->Value(i), aSeq->Value(i+1));
|
||||||
|
if (!anIgnoreObjMap.count(anEntry.ToCString()))
|
||||||
|
anIgnoreObjMap.insert(anEntry.ToCString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aObjListToPublish.Clear();
|
||||||
|
aScript += aFuncScript;
|
||||||
|
aFuncScript.Clear();
|
||||||
}
|
}
|
||||||
|
aFuncScript += anAfterScript;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
do {
|
|
||||||
aName = aBaseName + TCollection_AsciiString(++objectCounter);
|
|
||||||
} while(aNameToEntry.IsBound(aName));
|
|
||||||
theObjectNames.Bind(anEntry, aName);
|
|
||||||
}
|
|
||||||
aNameToEntry.Bind(aName, anEntry); // to detect same name of diff objects
|
|
||||||
|
|
||||||
anUpdatedScript += aName;
|
|
||||||
aStart = aSeq->Value(i+1) + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add final part of the script
|
// Replace entries by the names
|
||||||
if (aLen && aSeq->Value(aLen) < aScriptLength)
|
aObjListToPublish.Clear();
|
||||||
anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
|
ReplaceEntriesByNames( aFuncScript, theObjectNames,
|
||||||
|
isPublished, anEntryToBadName, aObjListToPublish );
|
||||||
|
|
||||||
|
aScript += aFuncScript;
|
||||||
|
|
||||||
// ouv : NPAL12872
|
// ouv : NPAL12872
|
||||||
for (anEntryToNameIt.Initialize( theObjectNames );
|
AddObjectColors( aDoc, aScript, theObjectNames );
|
||||||
anEntryToNameIt.More();
|
|
||||||
anEntryToNameIt.Next())
|
|
||||||
{
|
|
||||||
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
|
||||||
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
|
||||||
|
|
||||||
TDF_Label L;
|
|
||||||
TDF_Tool::Label( aDoc->GetData(), aEntry, L );
|
|
||||||
if ( L.IsNull() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Handle(GEOM_Object) obj = GEOM_Object::GetObject( L );
|
|
||||||
if ( obj.IsNull() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool anAutoColor = obj->GetAutoColor();
|
|
||||||
if ( anAutoColor )
|
|
||||||
{
|
|
||||||
TCollection_AsciiString aCommand( "\n\t" );
|
|
||||||
aCommand += aName + ".SetAutoColor(1)";
|
|
||||||
anUpdatedScript += aCommand.ToCString();
|
|
||||||
}
|
|
||||||
|
|
||||||
SALOMEDS::Color aColor = obj->GetColor();
|
|
||||||
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
|
|
||||||
{
|
|
||||||
TCollection_AsciiString aCommand( "\n\t" );
|
|
||||||
aCommand += aName + ".SetColor(SALOMEDS.Color(" + aColor.R + "," + aColor.G + "," + aColor.B + "))";
|
|
||||||
anUpdatedScript += aCommand.ToCString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make script to publish in study
|
// Make script to publish in study
|
||||||
if ( isPublished )
|
if ( isPublished )
|
||||||
@ -617,47 +611,21 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
anEntryToNameIt.Next())
|
anEntryToNameIt.Next())
|
||||||
{
|
{
|
||||||
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
||||||
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
|
||||||
if (anIgnoreObjMap.count(aEntry.ToCString()))
|
if (anIgnoreObjMap.count(aEntry.ToCString()))
|
||||||
continue; // should not be dumped
|
continue; // should not be dumped
|
||||||
if ( !aEntry2StEntry.IsBound( aEntry ))
|
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
||||||
continue; // was not published
|
PublishObject( aEntry, aName, theObjectNames,
|
||||||
TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry;
|
aEntry2StEntry, aStEntry2Entry,
|
||||||
|
anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap );
|
||||||
// find a father entry
|
|
||||||
const TCollection_AsciiString& aStudyEntry = aEntry2StEntry( aEntry );
|
|
||||||
TCollection_AsciiString aFatherStudyEntry =
|
|
||||||
aStudyEntry.SubString( 1, aStudyEntry.SearchFromEnd(":") - 1 );
|
|
||||||
if ( aStEntry2Entry.IsBound( aFatherStudyEntry ))
|
|
||||||
aFatherEntry = aStEntry2Entry( aFatherStudyEntry );
|
|
||||||
|
|
||||||
// make a command
|
|
||||||
if ( !aFatherEntry.IsEmpty() && theObjectNames.IsBound( aFatherEntry )) {
|
|
||||||
aCommand += "addToStudyInFather( ";
|
|
||||||
aCommand += theObjectNames( aFatherEntry ) + ", ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
aCommand += "addToStudy( ";
|
|
||||||
if ( anEntryToBadName.IsBound( aEntry ))
|
|
||||||
aCommand += aName + ", \"" + anEntryToBadName( aEntry ) + "\" )";
|
|
||||||
else
|
|
||||||
aCommand += aName + ", \"" + aName + "\" )";
|
|
||||||
|
|
||||||
// bind a command to the last digit of the entry
|
|
||||||
int tag =
|
|
||||||
aEntry.SubString( aEntry.SearchFromEnd(":")+1, aEntry.Length() ).IntegerValue();
|
|
||||||
anEntryToCommandMap.insert( std::make_pair( tag, aCommand.ToCString() ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add publishing commands to the script
|
// add publishing commands to the script
|
||||||
std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin();
|
std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin();
|
||||||
for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand ) {
|
for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand )
|
||||||
anUpdatedScript += (char*)anEntryToCommand->second.c_str();
|
aScript += (char*)anEntryToCommand->second.c_str();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//anUpdatedScript += "\n\tpass\n";
|
//aScript += "\n\tpass\n";
|
||||||
anUpdatedScript += "\n";
|
aScript += "\n";
|
||||||
aValidScript = true;
|
aValidScript = true;
|
||||||
|
|
||||||
// fill _studyEntry2NameMap and build globalVars
|
// fill _studyEntry2NameMap and build globalVars
|
||||||
@ -676,10 +644,10 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
}
|
}
|
||||||
if ( !globalVars.IsEmpty() ) {
|
if ( !globalVars.IsEmpty() ) {
|
||||||
globalVars.Insert( 1, "\n\tglobal " );
|
globalVars.Insert( 1, "\n\tglobal " );
|
||||||
anUpdatedScript.Insert( posToInsertGlobalVars, globalVars );
|
aScript.Insert( posToInsertGlobalVars, globalVars );
|
||||||
}
|
}
|
||||||
|
|
||||||
return anUpdatedScript;
|
return aScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -716,15 +684,25 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Internal functions
|
// Internal functions
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|
||||||
TCollection_AsciiString& theScript,
|
|
||||||
const TVariablesList& theVariables,
|
|
||||||
TDF_LabelMap& theProcessed,
|
|
||||||
std::set<std::string>& theIgnoreObjs)
|
|
||||||
{
|
|
||||||
if (theFunction.IsNull()) return;
|
|
||||||
|
|
||||||
if (theProcessed.Contains(theFunction->GetEntry())) return;
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* ProcessFunction: Dump fucntion description into script
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
|
TCollection_AsciiString& theScript,
|
||||||
|
TCollection_AsciiString& theAfterScript,
|
||||||
|
const TVariablesList& theVariables,
|
||||||
|
const bool theIsPublished,
|
||||||
|
TDF_LabelMap& theProcessed,
|
||||||
|
std::set<std::string>& theIgnoreObjs,
|
||||||
|
bool& theIsDumpCollected)
|
||||||
|
{
|
||||||
|
theIsDumpCollected = false;
|
||||||
|
if (theFunction.IsNull()) return false;
|
||||||
|
|
||||||
|
if (theProcessed.Contains(theFunction->GetEntry())) return false;
|
||||||
|
|
||||||
// pass functions, that depends on nonexisting ones
|
// pass functions, that depends on nonexisting ones
|
||||||
bool doNotProcess = false;
|
bool doNotProcess = false;
|
||||||
@ -761,20 +739,44 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|||||||
TCollection_AsciiString anObjEntry;
|
TCollection_AsciiString anObjEntry;
|
||||||
TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
|
TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
|
||||||
theIgnoreObjs.insert(anObjEntry.ToCString());
|
theIgnoreObjs.insert(anObjEntry.ToCString());
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
theProcessed.Add(theFunction->GetEntry());
|
theProcessed.Add(theFunction->GetEntry());
|
||||||
|
|
||||||
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
||||||
if(aDescr.Length() == 0) return;
|
if(aDescr.Length() == 0) return false;
|
||||||
|
|
||||||
//Check if its internal function which doesn't requires dumping
|
//Check if its internal function which doesn't requires dumping
|
||||||
if(aDescr == "None") return;
|
if(aDescr == "None") return false;
|
||||||
|
|
||||||
|
// 0020001 PTv, check for critical functions, which requier dump of objects
|
||||||
|
if (theIsPublished)
|
||||||
|
{
|
||||||
|
// currently, there is only one function "RestoreSubShapes",
|
||||||
|
// later this check could be replaced by iterations on list of such functions
|
||||||
|
if (aDescr.Search( "RestoreSubShapes" ) != -1)
|
||||||
|
theIsDumpCollected = true;
|
||||||
|
}
|
||||||
|
|
||||||
//Replace parameter by notebook variables
|
//Replace parameter by notebook variables
|
||||||
ReplaceVariables(aDescr,theVariables);
|
ReplaceVariables(aDescr,theVariables);
|
||||||
theScript += "\n\t";
|
if ( theIsDumpCollected ) {
|
||||||
theScript += aDescr;
|
int i = 1;
|
||||||
|
bool isBefore = true;
|
||||||
|
TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i++);
|
||||||
|
while (!aSubStr.IsEmpty()) {
|
||||||
|
if (isBefore && aSubStr.Search( "RestoreSubShapes" ) == -1)
|
||||||
|
theScript += TCollection_AsciiString("\n\t") + aSubStr;
|
||||||
|
else
|
||||||
|
theAfterScript += TCollection_AsciiString("\n\t") + aSubStr;
|
||||||
|
aSubStr = aDescr.Token("\n\t", i++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
theScript += "\n\t";
|
||||||
|
theScript += aDescr;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1069,6 +1071,170 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
|||||||
cout<<"Command : "<<theCommand<<endl;
|
cout<<"Command : "<<theCommand<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* ReplaceEntriesByNames: Replace object entries by their names
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
|
||||||
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
const bool theIsPublished,
|
||||||
|
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
|
||||||
|
TColStd_SequenceOfAsciiString& theObjListToPublish)
|
||||||
|
{
|
||||||
|
Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(theScript);
|
||||||
|
Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = theScript.Length();
|
||||||
|
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
|
||||||
|
|
||||||
|
//Replace entries by the names
|
||||||
|
TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"),
|
||||||
|
allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
|
||||||
|
if (aLen == 0) anUpdatedScript = theScript;
|
||||||
|
|
||||||
|
for (Standard_Integer i = 1; i <= aLen; i+=2) {
|
||||||
|
anUpdatedScript += theScript.SubString(aStart, aSeq->Value(i)-1);
|
||||||
|
anEntry = theScript.SubString(aSeq->Value(i), aSeq->Value(i+1));
|
||||||
|
theObjListToPublish.Append( anEntry );
|
||||||
|
if (theObjectNames.IsBound(anEntry)) {
|
||||||
|
aName = theObjectNames.Find(anEntry);
|
||||||
|
// check validity of aName
|
||||||
|
bool isValidName = true;
|
||||||
|
if ( aName.IsIntegerValue() ) { // aName must not start with a digit
|
||||||
|
aName.Insert( 1, 'a' );
|
||||||
|
isValidName = false;
|
||||||
|
}
|
||||||
|
int p, p2=1; // replace not allowed chars
|
||||||
|
while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) {
|
||||||
|
aName.SetValue(p, '_');
|
||||||
|
p2=p;
|
||||||
|
isValidName = false;
|
||||||
|
}
|
||||||
|
if ( aNameToEntry.IsBound( aName ) && anEntry != aNameToEntry( aName ))
|
||||||
|
{ // diff objects have same name - make a new name by appending a digit
|
||||||
|
TCollection_AsciiString aName2;
|
||||||
|
Standard_Integer i = 0;
|
||||||
|
do {
|
||||||
|
aName2 = aName + "_" + ++i;
|
||||||
|
} while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 ));
|
||||||
|
aName = aName2;
|
||||||
|
isValidName = false;
|
||||||
|
}
|
||||||
|
if ( !isValidName ) {
|
||||||
|
if ( theIsPublished )
|
||||||
|
theEntryToBadName.Bind( anEntry, theObjectNames.Find(anEntry) );
|
||||||
|
theObjectNames( anEntry ) = aName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
do {
|
||||||
|
aName = aBaseName + TCollection_AsciiString(++objectCounter);
|
||||||
|
} while(aNameToEntry.IsBound(aName));
|
||||||
|
theObjectNames.Bind(anEntry, aName);
|
||||||
|
}
|
||||||
|
aNameToEntry.Bind(aName, anEntry); // to detect same name of diff objects
|
||||||
|
|
||||||
|
anUpdatedScript += aName;
|
||||||
|
aStart = aSeq->Value(i+1) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add final part of the script
|
||||||
|
if (aLen && aSeq->Value(aLen) < aScriptLength)
|
||||||
|
anUpdatedScript += theScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
|
||||||
|
|
||||||
|
theScript = anUpdatedScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* AddObjectColors: Add color to objects
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void AddObjectColors (const Handle(TDocStd_Document)& theDoc,
|
||||||
|
TCollection_AsciiString& theScript,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
|
||||||
|
{
|
||||||
|
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt;
|
||||||
|
for (anEntryToNameIt.Initialize( theObjectNames );
|
||||||
|
anEntryToNameIt.More();
|
||||||
|
anEntryToNameIt.Next())
|
||||||
|
{
|
||||||
|
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
||||||
|
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
||||||
|
|
||||||
|
TDF_Label L;
|
||||||
|
TDF_Tool::Label( theDoc->GetData(), aEntry, L );
|
||||||
|
if ( L.IsNull() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Handle(GEOM_Object) obj = GEOM_Object::GetObject( L );
|
||||||
|
if ( obj.IsNull() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool anAutoColor = obj->GetAutoColor();
|
||||||
|
if ( anAutoColor )
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aCommand( "\n\t" );
|
||||||
|
aCommand += aName + ".SetAutoColor(1)";
|
||||||
|
theScript += aCommand.ToCString();
|
||||||
|
}
|
||||||
|
|
||||||
|
SALOMEDS::Color aColor = obj->GetColor();
|
||||||
|
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aCommand( "\n\t" );
|
||||||
|
aCommand += aName + ".SetColor(SALOMEDS.Color(" + aColor.R + "," + aColor.G + "," + aColor.B + "))";
|
||||||
|
theScript += aCommand.ToCString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* PublishObject: publish object in study script
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void PublishObject (const TCollection_AsciiString& theEntry,
|
||||||
|
const TCollection_AsciiString& theName,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry,
|
||||||
|
const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
|
||||||
|
std::map< int, std::string >& theEntryToCommandMap,
|
||||||
|
std::set<std::string>& theMapOfPublished)
|
||||||
|
{
|
||||||
|
if ( !theEntry2StEntry.IsBound( theEntry ))
|
||||||
|
return; // was not published
|
||||||
|
if ( theMapOfPublished.count(theEntry.ToCString()) )
|
||||||
|
return; // aready published
|
||||||
|
theMapOfPublished.insert( theEntry.ToCString() );
|
||||||
|
|
||||||
|
TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry;
|
||||||
|
|
||||||
|
// find a father entry
|
||||||
|
const TCollection_AsciiString& aStudyEntry = theEntry2StEntry( theEntry );
|
||||||
|
TCollection_AsciiString aFatherStudyEntry =
|
||||||
|
aStudyEntry.SubString( 1, aStudyEntry.SearchFromEnd(":") - 1 );
|
||||||
|
if ( theStEntry2Entry.IsBound( aFatherStudyEntry ))
|
||||||
|
aFatherEntry = theStEntry2Entry( aFatherStudyEntry );
|
||||||
|
|
||||||
|
// make a command
|
||||||
|
if ( !aFatherEntry.IsEmpty() && theObjectNames.IsBound( aFatherEntry )) {
|
||||||
|
aCommand += "addToStudyInFather( ";
|
||||||
|
aCommand += theObjectNames( aFatherEntry ) + ", ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aCommand += "addToStudy( ";
|
||||||
|
if ( theEntryToBadName.IsBound( theEntry ))
|
||||||
|
aCommand += theName + ", \"" + theEntryToBadName( theEntry ) + "\" )";
|
||||||
|
else
|
||||||
|
aCommand += theName + ", \"" + theName + "\" )";
|
||||||
|
|
||||||
|
// bind a command to the last digit of the entry
|
||||||
|
int tag =
|
||||||
|
theEntry.SubString( theEntry.SearchFromEnd(":")+1, theEntry.Length() ).IntegerValue();
|
||||||
|
theEntryToCommandMap.insert( std::make_pair( tag, aCommand.ToCString() ));
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructor
|
* \brief Constructor
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "GEOM_Gen_i.hh"
|
#include "GEOM_Gen_i.hh"
|
||||||
#include "GEOM_Object_i.hh"
|
#include "GEOM_Object_i.hh"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
#include <strstream>
|
#include <strstream>
|
||||||
//#include <sstream>
|
//#include <sstream>
|
||||||
|
|
||||||
@ -40,6 +41,7 @@
|
|||||||
#include "GEOM_Object.hxx"
|
#include "GEOM_Object.hxx"
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
#include "GEOM_ISubShape.hxx"
|
#include "GEOM_ISubShape.hxx"
|
||||||
|
#include <GEOM_PythonDump.hxx>
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
#include "GEOMImpl_CopyDriver.hxx"
|
#include "GEOMImpl_CopyDriver.hxx"
|
||||||
|
|
||||||
@ -750,22 +752,26 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy,
|
|||||||
// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
// To be used from python scripts out of geompy.addToStudy (non-default usage)
|
// To be used from python scripts out of geompy.addToStudy (non-default usage)
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg)
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
|
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
|
||||||
return false;
|
return aParts._retn();
|
||||||
|
|
||||||
// find SObject in the study
|
// find SObject in the study if it is already published
|
||||||
CORBA::String_var anIORo = _orb->object_to_string(theObject);
|
CORBA::String_var anIORo = _orb->object_to_string(theObject);
|
||||||
SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(anIORo.in());
|
SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(anIORo.in());
|
||||||
if (CORBA::is_nil(aSO))
|
//PTv, IMP 0020001, The salome object <aSO>
|
||||||
return false;
|
// is not obligatory in case of invokation from script
|
||||||
|
// if (CORBA::is_nil(aSO))
|
||||||
|
// return aParts._retn();
|
||||||
|
|
||||||
return RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg);
|
aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg);
|
||||||
|
return aParts._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -773,18 +779,19 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
|||||||
// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
// To be used from GUI and from geompy.addToStudy
|
// To be used from GUI and from geompy.addToStudy
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg)
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
|
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
|
||||||
return false;
|
return aParts._retn();
|
||||||
|
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
SALOMEDS::GenericAttribute_var anAttr;
|
||||||
if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
|
if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
|
||||||
return false;
|
return aParts._retn();
|
||||||
|
|
||||||
SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
CORBA::String_var anIORso = anAttrIOR->Value();
|
CORBA::String_var anIORso = anAttrIOR->Value();
|
||||||
@ -792,9 +799,36 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
|||||||
// get Object from SObject
|
// get Object from SObject
|
||||||
GEOM::GEOM_Object_var anO = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIORso));
|
GEOM::GEOM_Object_var anO = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIORso));
|
||||||
if (CORBA::is_nil(anO))
|
if (CORBA::is_nil(anO))
|
||||||
return false;
|
return aParts._retn();
|
||||||
|
|
||||||
return RestoreSubShapes(theStudy, anO, theSObject, theArgs, theFindMethod, theInheritFirstArg);
|
aParts = RestoreSubShapes(theStudy, anO, theSObject, theArgs, theFindMethod, theInheritFirstArg);
|
||||||
|
aParts._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// function : addToListOfGO
|
||||||
|
// purpose : static local function
|
||||||
|
//============================================================================
|
||||||
|
static void addToListOfGO( const GEOM::GEOM_Object_var& theObject,
|
||||||
|
GEOM::ListOfGO_var& theList )
|
||||||
|
{
|
||||||
|
const int oldLen = theList->length();
|
||||||
|
theList->length(oldLen + 1);
|
||||||
|
theList[ oldLen ] = theObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// function : addToListOfGO
|
||||||
|
// purpose : static local function
|
||||||
|
//============================================================================
|
||||||
|
static void addToListOfGO( GEOM::ListOfGO_var& theSrcList,
|
||||||
|
GEOM::ListOfGO_var& theTrgList )
|
||||||
|
{
|
||||||
|
const int oldLen = theTrgList->length();
|
||||||
|
const int srcLen = theSrcList->length();
|
||||||
|
theTrgList->length(oldLen + srcLen);
|
||||||
|
for( int i = 0; i < srcLen; i++ )
|
||||||
|
theTrgList[ oldLen + i ] = theSrcList[ i ];
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -802,15 +836,18 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
|||||||
// purpose : Private method. Works only if both theObject and theSObject
|
// purpose : Private method. Works only if both theObject and theSObject
|
||||||
// are defined, and does not check, if they correspond to each other.
|
// are defined, and does not check, if they correspond to each other.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg)
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) || CORBA::is_nil(theSObject))
|
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
||||||
return false;
|
//PTv, IMP 0020001, The salome object <theSObject>
|
||||||
|
// is not obligatory in case of invokation from script
|
||||||
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
|
||||||
|
return aParts._retn();
|
||||||
|
|
||||||
// Arguments to be published
|
// Arguments to be published
|
||||||
GEOM::ListOfGO_var aList;
|
GEOM::ListOfGO_var aList;
|
||||||
@ -834,7 +871,7 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aLength < 1)
|
if (aLength < 1)
|
||||||
return false;
|
return aParts._retn();
|
||||||
|
|
||||||
if (theInheritFirstArg || (nbArgsActual == 1)) {
|
if (theInheritFirstArg || (nbArgsActual == 1)) {
|
||||||
// Do not publish argument's reflection,
|
// Do not publish argument's reflection,
|
||||||
@ -844,139 +881,214 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
CORBA::String_var anIOR = _orb->object_to_string(anArgO);
|
CORBA::String_var anIOR = _orb->object_to_string(anArgO);
|
||||||
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
|
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
|
||||||
|
|
||||||
GEOM::ListOfGO_var aParts =
|
aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod);
|
||||||
RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod);
|
|
||||||
|
|
||||||
// set the color of the transformed shape to the color of initial shape
|
// set the color of the transformed shape to the color of initial shape
|
||||||
theObject->SetColor(aList[0]->GetColor());
|
theObject->SetColor(aList[0]->GetColor());
|
||||||
|
|
||||||
return (aParts->length() > 0);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Get interface, containing method, which we will use to reconstruct sub-shapes
|
||||||
|
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
|
||||||
|
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
|
||||||
|
|
||||||
// Get interface, containing method, which we will use to reconstruct sub-shapes
|
// Reconstruct arguments and tree of sub-shapes of the arguments
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
|
CORBA::String_var anIOR;
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
|
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
||||||
|
for (Standard_Integer i = 0; i < aLength; i++)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var anArgO = aList[i];
|
||||||
|
if (!CORBA::is_nil(anArgO)) {
|
||||||
|
anIOR = _orb->object_to_string(anArgO);
|
||||||
|
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
|
||||||
|
TCollection_AsciiString anArgName;
|
||||||
|
if (CORBA::is_nil(anArgSO)) {
|
||||||
|
anArgName = "arg_";
|
||||||
|
anArgName += TCollection_AsciiString(i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
anArgName = anArgSO->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
// Reconstruct arguments and tree of sub-shapes of the arguments
|
// Find a sub-shape of theObject in place of the argument
|
||||||
CORBA::String_var anIOR;
|
GEOM::GEOM_Object_var aSubO;
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
switch (theFindMethod) {
|
||||||
for (Standard_Integer i = 0; i < aLength; i++)
|
case GEOM::FSM_GetInPlace:
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anArgO = aList[i];
|
// Use GetInPlace
|
||||||
if (!CORBA::is_nil(anArgO)) {
|
aSubO = aShapesOp->GetInPlace(theObject, anArgO);
|
||||||
anIOR = _orb->object_to_string(anArgO);
|
}
|
||||||
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
|
break;
|
||||||
TCollection_AsciiString anArgName;
|
case GEOM::FSM_Transformed:
|
||||||
if (CORBA::is_nil(anArgSO)) {
|
{
|
||||||
anArgName = "arg_";
|
// transformation, cannot use GetInPlace, operate with indices
|
||||||
anArgName += TCollection_AsciiString(i);
|
GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices();
|
||||||
|
if (anIDs->length() > 1) {
|
||||||
|
// group
|
||||||
|
aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO));
|
||||||
|
if (!CORBA::is_nil(aSubO))
|
||||||
|
aGroupOp->UnionIDs(aSubO, anIDs);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// single sub-shape
|
||||||
|
aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GEOM::FSM_GetSame:
|
||||||
|
{
|
||||||
|
// Use GetSame
|
||||||
|
aSubO = aShapesOp->GetSame(theObject, anArgO);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GEOM::FSM_GetShapesOnShape:
|
||||||
|
{
|
||||||
|
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
|
||||||
|
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
|
||||||
|
(short)GEOM::SOLID, GEOM::ST_ONIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GEOM::FSM_GetInPlaceByHistory:
|
||||||
|
{
|
||||||
|
// Use GetInPlaceByHistory
|
||||||
|
aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CORBA::is_nil(aSubO)) {
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubO, aParts );
|
||||||
|
|
||||||
|
// Publish the sub-shape
|
||||||
|
SALOMEDS::SObject_var aSubSO;
|
||||||
|
if (!CORBA::is_nil(theSObject)) {
|
||||||
|
TCollection_AsciiString aSubName ("from_");
|
||||||
|
aSubName += anArgName;
|
||||||
|
aSubSO = aStudyBuilder->NewObject(theSObject);
|
||||||
|
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
|
||||||
|
// Restore color
|
||||||
|
aSubO->SetColor(anArgO->GetColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CORBA::is_nil(anArgSO)) {
|
||||||
|
// Restore published sub-shapes of the argument
|
||||||
|
GEOM::ListOfGO_var aSubParts;
|
||||||
|
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
|
||||||
|
// pass theObject, because only it has the history
|
||||||
|
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
|
||||||
|
else
|
||||||
|
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, theFindMethod);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubParts, aParts );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // GetInPlace failed, try to build from published parts
|
||||||
|
if (!CORBA::is_nil(anArgSO)) {
|
||||||
|
SALOMEDS::SObject_var aSubSO;
|
||||||
|
if (!CORBA::is_nil(theSObject))
|
||||||
|
aSubSO = aStudyBuilder->NewObject(theSObject);
|
||||||
|
|
||||||
|
// Restore published sub-shapes of the argument
|
||||||
|
GEOM::ListOfGO_var aSubParts =
|
||||||
|
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
|
||||||
|
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubParts, aParts );
|
||||||
|
|
||||||
|
if (aSubParts->length() > 0) {
|
||||||
|
// try to build an argument from a set of its sub-shapes,
|
||||||
|
// that published and will be reconstructed
|
||||||
|
if (aSubParts->length() > 1) {
|
||||||
|
aSubO = aShapesOp->MakeCompound(aSubParts);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubO, aParts );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aSubO = aSubParts[0];
|
||||||
|
}
|
||||||
|
if (!CORBA::is_nil(aSubO) && !CORBA::is_nil(aSubSO)) {
|
||||||
|
// Publish the sub-shape
|
||||||
|
TCollection_AsciiString aSubName ("from_parts_of_");
|
||||||
|
aSubName += anArgName;
|
||||||
|
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
|
||||||
|
// Restore color
|
||||||
|
aSubO->SetColor(anArgO->GetColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!CORBA::is_nil(aSubSO)) {
|
||||||
|
// remove created aSubSO, because no parts have been found
|
||||||
|
aStudyBuilder->RemoveObject(aSubSO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // try to build from published parts
|
||||||
}
|
}
|
||||||
else {
|
} // process arguments
|
||||||
anArgName = anArgSO->GetName();
|
}
|
||||||
}
|
set<string> anObjEntryMap;
|
||||||
|
GEOM::ListOfGO_var aResParts = new GEOM::ListOfGO;
|
||||||
// Find a sub-shape of theObject in place of the argument
|
int nbRes = 0;
|
||||||
GEOM::GEOM_Object_var aSubO;
|
int nb = aParts->length();
|
||||||
switch (theFindMethod) {
|
aResParts->length(nb);
|
||||||
case GEOM::FSM_GetInPlace:
|
if (nb > 0)
|
||||||
{
|
{
|
||||||
// Use GetInPlace
|
Handle(GEOM_Object) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
|
||||||
aSubO = aShapesOp->GetInPlace(theObject, anArgO);
|
Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction();
|
||||||
}
|
GEOM::TPythonDump pd (aFunction, true);
|
||||||
break;
|
pd <<"[";
|
||||||
case GEOM::FSM_Transformed:
|
int i = 0, j = 0;
|
||||||
{
|
for ( ; i < nb; i++ )
|
||||||
// transformation, cannot use GetInPlace, operate with indices
|
{
|
||||||
GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices();
|
const GEOM::GEOM_Object_var& anObj = aParts[ i ];
|
||||||
if (anIDs->length() > 1) {
|
if (CORBA::is_nil(anObj))
|
||||||
// group
|
continue;
|
||||||
aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO));
|
char* anEntry = anObj->GetEntry();
|
||||||
if (!CORBA::is_nil(aSubO))
|
if (anObjEntryMap.count(anEntry))
|
||||||
aGroupOp->UnionIDs(aSubO, anIDs);
|
continue; // already treated
|
||||||
}
|
anObjEntryMap.insert(anEntry);
|
||||||
else {
|
aResParts[nbRes++] = anObj;
|
||||||
// single sub-shape
|
// clear python dump of object
|
||||||
aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]);
|
Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
|
||||||
}
|
Handle(GEOM_Function) anObjFun = aGeomObj->GetLastFunction();
|
||||||
}
|
if ( !anObjFun.IsNull() )
|
||||||
break;
|
anObjFun->SetDescription( "" );
|
||||||
case GEOM::FSM_GetSame:
|
if ( j > 0 )
|
||||||
{
|
pd << ", ";
|
||||||
// Use GetSame
|
pd << aGeomObj;
|
||||||
aSubO = aShapesOp->GetSame(theObject, anArgO);
|
j++;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GEOM::FSM_GetShapesOnShape:
|
|
||||||
{
|
|
||||||
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
|
|
||||||
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
|
|
||||||
(short)GEOM::SOLID, GEOM::ST_ONIN);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GEOM::FSM_GetInPlaceByHistory:
|
|
||||||
{
|
|
||||||
// Use GetInPlaceByHistory
|
|
||||||
aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CORBA::is_nil(aSubO)) {
|
|
||||||
// Publish the sub-shape
|
|
||||||
TCollection_AsciiString aSubName ("from_");
|
|
||||||
aSubName += anArgName;
|
|
||||||
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject);
|
|
||||||
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
|
|
||||||
// Restore color
|
|
||||||
aSubO->SetColor(anArgO->GetColor());
|
|
||||||
|
|
||||||
if (!CORBA::is_nil(anArgSO)) {
|
|
||||||
// Restore published sub-shapes of the argument
|
|
||||||
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
|
|
||||||
// pass theObject, because only it has the history
|
|
||||||
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
|
|
||||||
else
|
|
||||||
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, theFindMethod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // GetInPlace failed, try to build from published parts
|
|
||||||
if (!CORBA::is_nil(anArgSO)) {
|
|
||||||
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject);
|
|
||||||
|
|
||||||
// Restore published sub-shapes of the argument
|
|
||||||
GEOM::ListOfGO_var aParts =
|
|
||||||
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
|
|
||||||
|
|
||||||
if (aParts->length() > 0) {
|
|
||||||
// try to build an argument from a set of its sub-shapes,
|
|
||||||
// that published and will be reconstructed
|
|
||||||
if (aParts->length() > 1) {
|
|
||||||
aSubO = aShapesOp->MakeCompound(aParts);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aSubO = aParts[0];
|
|
||||||
}
|
|
||||||
if (!CORBA::is_nil(aSubO)) {
|
|
||||||
// Publish the sub-shape
|
|
||||||
TCollection_AsciiString aSubName ("from_parts_of_");
|
|
||||||
aSubName += anArgName;
|
|
||||||
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
|
|
||||||
// Restore color
|
|
||||||
aSubO->SetColor(anArgO->GetColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// remove created aSubSO, because no parts have been found
|
|
||||||
aStudyBuilder->RemoveObject(aSubSO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // try to build from published parts
|
|
||||||
}
|
}
|
||||||
} // process arguments
|
pd <<"]" << " = geompy.RestoreSubShapes(" << aMainObj << ", " << "[";
|
||||||
|
i = 0; nb = theArgs.length(); j = 0;
|
||||||
return true;
|
for ( ; i < nb; i++ )
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var anObj = theArgs[ i ];
|
||||||
|
if (CORBA::is_nil(anObj))
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
|
||||||
|
if ( j > 0 )
|
||||||
|
pd << ", ";
|
||||||
|
pd << aGeomObj;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
pd <<"]" << ", " <<"geompy.GEOM.";
|
||||||
|
switch (theFindMethod) {
|
||||||
|
case GEOM::FSM_GetInPlace:
|
||||||
|
pd << "FSM_GetInPlace"; break;
|
||||||
|
case GEOM::FSM_Transformed:
|
||||||
|
pd << "FSM_Transformed"; break;
|
||||||
|
case GEOM::FSM_GetSame:
|
||||||
|
pd << "FSM_GetSame"; break;
|
||||||
|
case GEOM::FSM_GetShapesOnShape:
|
||||||
|
pd << "FSM_GetShapesOnShape"; break;
|
||||||
|
case GEOM::FSM_GetInPlaceByHistory:
|
||||||
|
default:
|
||||||
|
pd << "FSM_GetInPlaceByHistory"; break;
|
||||||
|
}
|
||||||
|
pd << ", " << theInheritFirstArg << ")";
|
||||||
|
}
|
||||||
|
aResParts->length(nbRes);
|
||||||
|
return aResParts._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -991,8 +1103,9 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
||||||
|
GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO;
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theOldSO) ||
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theOldSO) ||
|
||||||
CORBA::is_nil(theNewO) || CORBA::is_nil(theNewSO))
|
CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
|
||||||
return aParts._retn();
|
return aParts._retn();
|
||||||
|
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
||||||
@ -1073,53 +1186,68 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
|
|||||||
// add the part to the list
|
// add the part to the list
|
||||||
aParts[i] = aNewSubO;
|
aParts[i] = aNewSubO;
|
||||||
i++;
|
i++;
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aNewSubO, aNewParts );
|
||||||
|
|
||||||
// Publish the sub-shape
|
SALOMEDS::SObject_var aNewSubSO;
|
||||||
TCollection_AsciiString aSubName ("from_");
|
if (!CORBA::is_nil(theNewSO)) {
|
||||||
aSubName += anArgName;
|
// Publish the sub-shape
|
||||||
SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
TCollection_AsciiString aSubName ("from_");
|
||||||
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
|
aSubName += anArgName;
|
||||||
// Restore color
|
aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
||||||
aNewSubO->SetColor(anOldSubO->GetColor());
|
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
|
||||||
|
// Restore color
|
||||||
|
aNewSubO->SetColor(anOldSubO->GetColor());
|
||||||
|
}
|
||||||
// Restore published sub-shapes of the argument
|
// Restore published sub-shapes of the argument
|
||||||
|
GEOM::ListOfGO_var aSubParts;
|
||||||
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
|
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
|
||||||
// pass the main shape as Object, because only it has the history
|
// pass the main shape as Object, because only it has the history
|
||||||
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
|
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
|
||||||
else
|
else
|
||||||
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod);
|
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubParts, aNewParts );
|
||||||
}
|
}
|
||||||
else { // GetInPlace failed, try to build from published parts
|
else { // GetInPlace failed, try to build from published parts
|
||||||
SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
SALOMEDS::SObject_var aNewSubSO;
|
||||||
|
if (!CORBA::is_nil(theNewSO))
|
||||||
|
aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
||||||
|
|
||||||
// Restore published sub-shapes of the argument
|
// Restore published sub-shapes of the argument
|
||||||
GEOM::ListOfGO_var aParts =
|
GEOM::ListOfGO_var aSubParts =
|
||||||
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
|
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aSubParts, aNewParts );
|
||||||
|
|
||||||
if (aParts->length() > 0) {
|
if (aSubParts->length() > 0) {
|
||||||
// try to build an object from a set of its sub-shapes,
|
// try to build an object from a set of its sub-shapes,
|
||||||
// that published and will be reconstructed
|
// that published and will be reconstructed
|
||||||
if (aParts->length() > 1) {
|
if (aSubParts->length() > 1) {
|
||||||
aNewSubO = aShapesOp->MakeCompound(aParts);
|
aNewSubO = aShapesOp->MakeCompound(aSubParts);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aNewSubO, aNewParts );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aNewSubO = aParts[0];
|
aNewSubO = aSubParts[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CORBA::is_nil(aNewSubO)) {
|
if (!CORBA::is_nil(aNewSubO)) {
|
||||||
// add the part to the list
|
// add the part to the list
|
||||||
aParts[i] = aNewSubO;
|
aSubParts[i] = aNewSubO;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Publish the sub-shape
|
// Publish the sub-shape
|
||||||
TCollection_AsciiString aSubName = "from_parts_of_";
|
if (!CORBA::is_nil(aNewSubSO)) {
|
||||||
aSubName += anArgName;
|
TCollection_AsciiString aSubName = "from_parts_of_";
|
||||||
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
|
aSubName += anArgName;
|
||||||
// Restore color
|
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
|
||||||
aNewSubO->SetColor(anOldSubO->GetColor());
|
// Restore color
|
||||||
|
aNewSubO->SetColor(anOldSubO->GetColor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (!CORBA::is_nil(aNewSubSO)) {
|
||||||
// remove created aSubSO, because no parts have been found
|
// remove created aSubSO, because no parts have been found
|
||||||
aStudyBuilder->RemoveObject(aNewSubSO);
|
aStudyBuilder->RemoveObject(aNewSubSO);
|
||||||
}
|
}
|
||||||
@ -1129,6 +1257,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
|
|||||||
} // iterate on published sub-shapes
|
} // iterate on published sub-shapes
|
||||||
|
|
||||||
aParts->length(i);
|
aParts->length(i);
|
||||||
|
// add to parts list
|
||||||
|
addToListOfGO( aNewParts, aParts );
|
||||||
return aParts._retn();
|
return aParts._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,20 +143,20 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
* To be used from python scripts out of geompy.addToStudy (non-default usage)
|
* To be used from python scripts out of geompy.addToStudy (non-default usage)
|
||||||
*/
|
*/
|
||||||
CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg);
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
* To be used from GUI and from geompy.addToStudy
|
* To be used from GUI and from geompy.addToStudy
|
||||||
*/
|
*/
|
||||||
CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg);
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// Transaction methods //
|
// Transaction methods //
|
||||||
@ -255,12 +255,12 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
GEOM::GEOM_Object_ptr theNewO,
|
GEOM::GEOM_Object_ptr theNewO,
|
||||||
GEOM::find_shape_method theFindMethod);
|
GEOM::find_shape_method theFindMethod);
|
||||||
|
|
||||||
CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
GEOM::find_shape_method theFindMethod,
|
GEOM::find_shape_method theFindMethod,
|
||||||
CORBA::Boolean theInheritFirstArg);
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
// auxilary for PublishNamedShapesInStudy
|
// auxilary for PublishNamedShapesInStudy
|
||||||
void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
|
void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user