-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_Gen_i_DumpPython.cxx
// Created : Thu Mar 24 17:17:59 2005
// Author : Julia DOROVSKIKH
// Module : SMESH
// $Header : $
-
+//
#include "SMESH_PythonDump.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Filter_i.hxx"
// Add trace of API methods calls and replace study entries by names
TCollection_AsciiString aScript =
"### This file is generated by SALOME automatically by dump python functionality of SMESH component\n\n";
- aScript += DumpPython_impl(aStudy->StudyId(), aMap, aMapNames,
+ aScript += DumpPython_impl(aStudy, aMap, aMapNames,
isPublished, isValidScript, aSavedTrace);
//inserting export for Object Names
*/
//=============================================================================
TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
- (int theStudyID,
+ (SALOMEDS::Study_ptr theStudy,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
Resource_DataMapOfAsciiStringAsciiString& theNames,
bool isPublished,
}
// Dump trace of API methods calls
- TCollection_AsciiString aNewLines = GetNewPythonLines(theStudyID);
+ TCollection_AsciiString aNewLines = GetNewPythonLines(theStudy->StudyId());
if (aNewLines.Length() > 0) {
aScript += helper + "\n" + aNewLines;
}
if (aSeq->Value(aLen) < aScriptLength)
anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
-
- SMESH_Gen_i* aSMESHGenI = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr aStudy = aSMESHGenI->GetCurrentStudy();
- if( !CORBA::is_nil(aStudy) )
+ // Set colors
+ SALOMEDS::SObject_var aComp = theStudy->FindComponent(ComponentDataType());
+ if( !CORBA::is_nil(aComp) )
{
- SALOMEDS::SObject_var aComp = aStudy->FindComponent(ComponentDataType());
- if( !CORBA::is_nil(aComp) )
+ SALOMEDS::ChildIterator_var Itr = theStudy->NewChildIterator(aComp);
+ for( Itr->InitEx(true); Itr->More(); Itr->Next() )
{
- SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aComp);
- for( Itr->InitEx(true); Itr->More(); Itr->Next() )
+ SALOMEDS::SObject_var aSObj = Itr->Value();
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SObjectToObject( aSObj ) );
+ // mesh auto color
+ if( !CORBA::is_nil(aMesh) && aMesh->GetAutoColor() )
{
- SALOMEDS::SObject_var aSObj = Itr->Value();
- CORBA::String_var aName = aSObj->GetName();
-
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
- if( !CORBA::is_nil(aMesh) )
- {
- bool isAutoColor = aMesh->GetAutoColor();
- if( isAutoColor )
- {
- anUpdatedScript += "\n\t";
- anUpdatedScript += (char*)aName.in();
- anUpdatedScript += ".SetAutoColor(1)";
- }
- }
-
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
- if( !CORBA::is_nil(aGroup) )
- {
- SALOMEDS::Color aColor = aGroup->GetColor();
- if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
- {
- anUpdatedScript += "\n\t";
- anUpdatedScript += (char*)aName.in();
- anUpdatedScript += ".SetColor(SALOMEDS.Color(";
- anUpdatedScript += aColor.R;
- anUpdatedScript += ",";
- anUpdatedScript += aColor.G;
- anUpdatedScript += ",";
- anUpdatedScript += aColor.B;
- anUpdatedScript += "))";
- }
- }
+ CORBA::String_var anEntry = aSObj->GetID();
+ anUpdatedScript +=
+ SMESH_Comment("\n\t") << theObjectNames(anEntry.inout()) << ".SetAutoColor(1)";
+ }
+ SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SObjectToObject(aSObj));
+ if( !CORBA::is_nil(aGroup) )
+ {
+ SALOMEDS::Color aColor = aGroup->GetColor();
+ if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
+ {
+ CORBA::String_var anEntry = aSObj->GetID();
+ anUpdatedScript += SMESH_Comment("\n\t")
+ << theObjectNames(anEntry.inout()) << ".SetColor(SALOMEDS.Color("
+ << aColor.R <<", "<< aColor.G <<", "<< aColor.B <<" ))";
+ }
}
}
}