mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 01:58:36 +05:00
Bug 0020065: EDF 876 GEOM : Deleting an object leads to unusable dump.
This commit is contained in:
parent
2ca357cd29
commit
b19d40e8dd
@ -85,8 +85,8 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
TCollection_AsciiString& theScript,
|
TCollection_AsciiString& theScript,
|
||||||
TColStd_MapOfTransient& theProcessed);
|
TColStd_MapOfTransient& theProcessed);
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
||||||
|
|
||||||
@ -232,8 +232,8 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType)
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
||||||
Handle(TColStd_HArray1OfInteger) theIndices,
|
Handle(TColStd_HArray1OfInteger) theIndices,
|
||||||
bool isStandaloneOperation)
|
bool isStandaloneOperation)
|
||||||
{
|
{
|
||||||
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
|
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
|
||||||
|
|
||||||
@ -422,22 +422,22 @@ void GEOM_Engine::Close(int theDocID)
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
bool isPublished,
|
bool isPublished,
|
||||||
bool& aValidScript)
|
bool& aValidScript)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aScript;
|
TCollection_AsciiString aScript;
|
||||||
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
||||||
|
|
||||||
if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
|
if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
|
||||||
|
|
||||||
aScript = "import geompy\n";
|
aScript = "import geompy\n";
|
||||||
aScript += "import math\n";
|
aScript += "import math\n";
|
||||||
aScript += "import SALOMEDS\n\n";
|
aScript += "import SALOMEDS\n\n";
|
||||||
aScript += "def RebuildData(theStudy):";
|
aScript += "def RebuildData(theStudy):";
|
||||||
aScript += "\n\tgeompy.init_geom(theStudy)";
|
aScript += "\n\tgeompy.init_geom(theStudy)";
|
||||||
|
|
||||||
Standard_Integer posToInertGlobalVars = aScript.Length() + 1;
|
Standard_Integer posToInsertGlobalVars = aScript.Length() + 1;
|
||||||
|
|
||||||
Handle(TDataStd_TreeNode) aNode, aRoot;
|
Handle(TDataStd_TreeNode) aNode, aRoot;
|
||||||
Handle(GEOM_Function) aFunction;
|
Handle(GEOM_Function) aFunction;
|
||||||
@ -449,8 +449,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
aNode = Itr.Value();
|
aNode = Itr.Value();
|
||||||
aFunction = GEOM_Function::GetFunction(aNode->Label());
|
aFunction = GEOM_Function::GetFunction(aNode->Label());
|
||||||
if(aFunction.IsNull()) {
|
if(aFunction.IsNull()) {
|
||||||
MESSAGE ( "Null function !!!!" );
|
MESSAGE ( "Null function !!!!" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ProcessFunction(aFunction, aScript, aMap);
|
ProcessFunction(aFunction, aScript, aMap);
|
||||||
}
|
}
|
||||||
@ -532,7 +532,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add final part of the script
|
//Add final part of the script
|
||||||
if(aLen && aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
|
if (aLen && aSeq->Value(aLen) < aScriptLength)
|
||||||
|
anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
|
||||||
|
|
||||||
// ouv : NPAL12872
|
// ouv : NPAL12872
|
||||||
for (anEntryToNameIt.Initialize( theObjectNames );
|
for (anEntryToNameIt.Initialize( theObjectNames );
|
||||||
@ -633,7 +634,7 @@ 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( posToInertGlobalVars, globalVars );
|
anUpdatedScript.Insert( posToInsertGlobalVars, globalVars );
|
||||||
}
|
}
|
||||||
|
|
||||||
return anUpdatedScript;
|
return anUpdatedScript;
|
||||||
@ -674,8 +675,8 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
|
|||||||
// Internal functions
|
// Internal functions
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
TCollection_AsciiString& theScript,
|
TCollection_AsciiString& theScript,
|
||||||
TColStd_MapOfTransient& theProcessed)
|
TColStd_MapOfTransient& theProcessed)
|
||||||
{
|
{
|
||||||
if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
|
if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
|
||||||
|
|
||||||
@ -683,26 +684,41 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|||||||
TDF_LabelSequence aSeq;
|
TDF_LabelSequence aSeq;
|
||||||
theFunction->GetDependency(aSeq);
|
theFunction->GetDependency(aSeq);
|
||||||
Standard_Integer aLen = aSeq.Length();
|
Standard_Integer aLen = aSeq.Length();
|
||||||
for(Standard_Integer i = 1; i<= aLen; i++) {
|
for(Standard_Integer i = 1; i <= aLen; i++) {
|
||||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
|
||||||
if(aFunction.IsNull()) continue;
|
if(aFunction.IsNull()) continue;
|
||||||
ProcessFunction(aFunction, theScript, theProcessed);
|
ProcessFunction(aFunction, theScript, theProcessed);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// pass functions, that depends on nonexisting ones
|
||||||
|
//jfa:test//bool doComment = false;
|
||||||
|
TDF_LabelSequence aSeq;
|
||||||
|
theFunction->GetDependency(aSeq);
|
||||||
|
Standard_Integer aLen = aSeq.Length();
|
||||||
|
//jfa:test//for (Standard_Integer i = 1; i <= aLen && !doComment; i++) {
|
||||||
|
for (Standard_Integer i = 1; i <= aLen; i++) {
|
||||||
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
|
||||||
|
//jfa:test//if (aFunction.IsNull()) doComment = true;
|
||||||
|
//jfa:test//else if (!theProcessed.Contains(aFunction)) doComment = true;
|
||||||
|
if (aFunction.IsNull()) return;
|
||||||
|
if (!theProcessed.Contains(aFunction)) return;
|
||||||
|
}
|
||||||
|
|
||||||
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
||||||
if(aDescr.Length() == 0) {
|
if(aDescr.Length() == 0) {
|
||||||
//cout << "Warning: the function has no description" << endl;
|
//cout << "Warning: the function has no description" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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;
|
||||||
|
|
||||||
theScript += "\n\t";
|
theScript += "\n\t";
|
||||||
|
//jfa:test//if (doComment) theScript += "#";
|
||||||
theScript += aDescr;
|
theScript += aDescr;
|
||||||
|
|
||||||
theProcessed.Add(theFunction);
|
theProcessed.Add(theFunction);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -726,13 +742,13 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin
|
|||||||
|
|
||||||
isFound = Standard_False;
|
isFound = Standard_False;
|
||||||
while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
|
while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
|
||||||
c = (int)arr[j++];
|
c = (int)arr[j++];
|
||||||
if(c == 58) isFound = Standard_True;
|
if(c == 58) isFound = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isFound && arr[j-2] != 58) { // last char should be a diggit
|
if(isFound && arr[j-2] != 58) { // last char should be a diggit
|
||||||
aSeq->Append(i+1); // +1 because AsciiString starts from 1
|
aSeq->Append(i+1); // +1 because AsciiString starts from 1
|
||||||
aSeq->Append(j-1);
|
aSeq->Append(j-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user