#include "HYDROData_Tool.h"
#include "HYDROData_Zone.h"
+#define CALCULATION_REGIONS_PREF GetName() + "_Reg"
+#define CALCULATION_ZONES_PREF GetName() + "_Zone"
+
#define PYTHON_CALCULATION_ID "KIND_CALCULATION"
IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
if ( aSplitedZones.isEmpty() )
return;
+ QString aRegsPref = CALCULATION_REGIONS_PREF;
+ QString aZonesPref = CALCULATION_ZONES_PREF;
+
// Create result regions for case, by default one zone for one region
HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitedZones );
while( anIter.hasNext() )
// Create new region
Handle(HYDROData_Region) aRegion = addNewRegion();
- QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
+ QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref );
aRegion->SetName( aRegionName );
// Add the zone for region
Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone();
- QString aZoneName = HYDROData_Tool::GenerateObjectName( aDocument, "Zone" );
+ QString aZoneName = HYDROData_Tool::GenerateObjectName( aDocument, aZonesPref );
aRegionZone->SetName( aZoneName );
aRegionZone->SetShape( aSplitData.Face() );
Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
if ( !aDocument.IsNull() )
{
- QString aNewRegionName = HYDROData_Tool::GenerateObjectName( aDocument, "Region" );
+ QString aRegsPref = CALCULATION_REGIONS_PREF;
+
+ QString aNewRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref );
aNewRegion->SetName( aNewRegionName );
}
return GetReferenceObjects( DataTag_Region );
}
+void HYDROData_CalculationCase::UpdateRegionsOrder()
+{
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if ( aDocument.IsNull() )
+ return;
+
+ HYDROData_SequenceOfObjects aRegions = GetRegions();
+
+ HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( anIter.Value() );
+ if ( aRegion.IsNull() )
+ continue;
+
+ aRegion->SetName( "" );
+ }
+
+ QString aRegsPref = CALCULATION_REGIONS_PREF;
+
+ anIter.Init( aRegions );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( anIter.Value() );
+ if ( aRegion.IsNull() )
+ continue;
+
+ QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref );
+ aRegion->SetName( aRegionName );
+ }
+}
+
void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
{
if ( theRegion.IsNull() )
#include "HYDROData_Region.h"
+#include "HYDROData_CalculationCase.h"
#include "HYDROData_Document.h"
#include "HYDROData_Iterator.h"
#include "HYDROData_Zone.h"
return aResList;
}
+void HYDROData_Region::Remove()
+{
+ Handle(HYDROData_CalculationCase) aFatherCalc =
+ Handle(HYDROData_CalculationCase)::DownCast( GetFatherObject() );
+
+ HYDROData_Entity::Remove();
+
+ if ( !aFatherCalc.IsNull() )
+ aFatherCalc->UpdateRegionsOrder();
+}
+
bool HYDROData_Region::AddZone( const Handle(HYDROData_Zone)& theZone )
{
if ( theZone.IsNull() )