#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <QStringList>
+#include <QColor>
//#define DEB_GET_REGION_SHAPE
HYDROData_Region::HYDROData_Region()
- : HYDROData_Entity()
+ : HYDROData_Entity( Geom_2d )
{
}
if ( !aFatherRegion.IsNull() && aFatherRegion->Label() != myLab )
{
Handle(HYDROData_Zone) aNewZone = addNewZone( aDocument, "", TopoDS_Face(), QStringList() );
- theZone->CopyTo( aNewZone );
+ theZone->CopyTo( aNewZone, false );
// To prevent changing of stored shape
aNewZone->SetShape( theZone->GetShape() );
for ( int i = 0, n = theRefObjects.length(); i < n; ++i )
{
const QString& anObjName = theRefObjects.at( i );
- Handle(HYDROData_Object) aRefObject =
- Handle(HYDROData_Object)::DownCast( theDoc->FindObjectByName( anObjName ) );
+ Handle(HYDROData_Entity) aRefObject = theDoc->FindObjectByName( anObjName );
if ( aRefObject.IsNull() )
continue;
return aResShape;
}
-QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+QStringList HYDROData_Region::DumpToPython( const QString& thePyScriptPath,
+ MapOfTreatedObjects& theTreatedObjects,
+ QString defRegName ) const
{
QStringList aResList;
// Find region
- findPythonReferenceObject( theTreatedObjects, aResList );
+ findPythonReferenceObject( aResList, defRegName );
// Add zones
HYDROData_SequenceOfObjects aZones = GetZones();
}
// find zone
- aZone->findPythonReferenceObject( theTreatedObjects, aResList );
+ aZone->findPythonReferenceObject( aResList );
theTreatedObjects.insert( aZone->GetName(), aZone );
// set zone merge type
if ( aMergeType == HYDROData_Zone::Merge_Object ) {
Handle(HYDROData_Entity) aMergeObject = aZone->GetMergeObject();
if ( !aMergeObject.IsNull() ) {
- aMergeObject->findPythonReferenceObject( theTreatedObjects, aResList );
+ aMergeObject->findPythonReferenceObject( aResList );
aResList << QString( "%1.SetMergeObject( %2 )" ).arg( aZone->GetObjPyName() )
.arg( aMergeObject->GetObjPyName() );
}
}
-
+ // set color
+ QColor zoneColor = aZone->GetColor(Qt::darkBlue);
+ aResList << QString( "%1.SetColor( QColor( %2, %3, %4 ))" )
+ .arg( aZone->GetObjPyName() ).arg( zoneColor.red() ).arg( zoneColor.green() ).arg( zoneColor.blue() );
// add zone
- setPythonReferenceObject( theTreatedObjects, aResList, aZone, "AddZone" );
+ setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aZone, "AddZone" );
+
}
return aResList;