fix dumping colors:

use valid python names instead of names in Study
This commit is contained in:
eap 2009-02-24 14:56:11 +00:00
parent df4afe2d50
commit 2b1b345532

View File

@ -33,6 +33,7 @@
#include <TColStd_HSequenceOfInteger.hxx> #include <TColStd_HSequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <SMESH_Comment.hxx>
#ifdef _DEBUG_ #ifdef _DEBUG_
@ -772,10 +773,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
if (aSeq->Value(aLen) < aScriptLength) if (aSeq->Value(aLen) < aScriptLength)
anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength); anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
// Set colors
//SMESH_Gen_i* aSMESHGenI = SMESH_Gen_i::GetSMESHGen();
if( !CORBA::is_nil(theStudy) )
{
SALOMEDS::SObject_var aComp = theStudy->FindComponent(ComponentDataType()); SALOMEDS::SObject_var aComp = theStudy->FindComponent(ComponentDataType());
if( !CORBA::is_nil(aComp) ) if( !CORBA::is_nil(aComp) )
{ {
@ -783,36 +781,24 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
for( Itr->InitEx(true); Itr->More(); Itr->Next() ) for( Itr->InitEx(true); Itr->More(); Itr->Next() )
{ {
SALOMEDS::SObject_var aSObj = Itr->Value(); SALOMEDS::SObject_var aSObj = Itr->Value();
CORBA::String_var aName = aSObj->GetName(); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SObjectToObject( aSObj ) );
// mesh auto color
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) ); if( !CORBA::is_nil(aMesh) && aMesh->GetAutoColor() )
if( !CORBA::is_nil(aMesh) )
{ {
bool isAutoColor = aMesh->GetAutoColor(); anEntry = aSObj->GetID();
if( isAutoColor ) anUpdatedScript +=
{ SMESH_Comment("\n\t") << theObjectNames(anEntry) << ".SetAutoColor(1)";
anUpdatedScript += "\n\t";
anUpdatedScript += (char*)aName.in();
anUpdatedScript += ".SetAutoColor(1)";
} }
} SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SObjectToObject(aSObj));
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
if( !CORBA::is_nil(aGroup) ) if( !CORBA::is_nil(aGroup) )
{ {
SALOMEDS::Color aColor = aGroup->GetColor(); SALOMEDS::Color aColor = aGroup->GetColor();
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
{ {
anUpdatedScript += "\n\t"; anEntry = aSObj->GetID();
anUpdatedScript += (char*)aName.in(); anUpdatedScript +=
anUpdatedScript += ".SetColor(SALOMEDS.Color("; SMESH_Comment("\n\t") << theObjectNames(anEntry) << ".SetColor(SALOMEDS.Color("
anUpdatedScript += aColor.R; << aColor.R <<", "<< aColor.G <<", "<< aColor.B <<" ))";
anUpdatedScript += ",";
anUpdatedScript += aColor.G;
anUpdatedScript += ",";
anUpdatedScript += aColor.B;
anUpdatedScript += "))";
}
} }
} }
} }