1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROData_CalculationCase.h"
20 #include "HYDROData_ArtificialObject.h"
21 #include "HYDROData_IAltitudeObject.h"
22 #include "HYDROData_Document.h"
23 #include "HYDROData_ShapesGroup.h"
24 #include "HYDROData_Iterator.h"
25 #include "HYDROData_NaturalObject.h"
26 #include "HYDROData_PolylineXY.h"
27 #include "HYDROData_StricklerTable.h"
28 #include "HYDROData_LandCoverMap.h"
29 #include "HYDROData_SplittedShapesGroup.h"
30 #include "HYDROData_Region.h"
31 #include "HYDROData_Tool.h"
32 #include "HYDROData_GeomTool.h"
35 #pragma warning ( disable: 4251 )
43 #pragma warning ( default: 4251 )
49 #include <TopoDS_Shell.hxx>
50 #include <TopoDS_Edge.hxx>
52 #include <BRep_Builder.hxx>
53 #include <BRepBuilderAPI_Sewing.hxx>
54 #include <BRepTopAdaptor_FClass2d.hxx>
56 #include <BRepTools.hxx>
59 #include <TopExp_Explorer.hxx>
61 #include <TopTools_ListOfShape.hxx>
62 #include <TopTools_ListIteratorOfListOfShape.hxx>
63 #include <TDataStd_Integer.hxx>
65 //#define DEB_CALCULATION 1
66 #ifdef DEB_CALCULATION
67 #include <BRepTools.hxx>
68 #include <TopLoc_Location.hxx>
70 #define CALCULATION_REGIONS_PREF GetName() + "_Reg"
71 #define CALCULATION_ZONES_PREF GetName() + "_Zone"
72 #define CALCULATION_GROUPS_PREF GetName() + "_"
73 //#define DEB_CLASS2D 1
75 #include <BRepBuilderAPI_MakeVertex.hxx>
78 #define EXPORT_NAME "HYDRO_" + GetName()
80 IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
81 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
83 HYDROData_CalculationCase::HYDROData_CalculationCase()
84 : HYDROData_Entity( Geom_2d_and_groups )
88 HYDROData_CalculationCase::~HYDROData_CalculationCase()
92 void HYDROData_CalculationCase::SetName( const QString& theName )
94 QString anOldCaseName = GetName();
95 if ( anOldCaseName != theName )
97 // Update names of regions and its zones
98 UpdateRegionsNames( GetRegions(), anOldCaseName, theName );
100 HYDROData_SequenceOfObjects aGroups = GetSplittedGroups();
102 HYDROData_SequenceOfObjects::Iterator anIter;
103 anIter.Init( aGroups );
104 for ( ; anIter.More(); anIter.Next() )
106 Handle(HYDROData_SplittedShapesGroup) aGroup =
107 Handle(HYDROData_SplittedShapesGroup)::DownCast( anIter.Value() );
108 if ( aGroup.IsNull() )
111 HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aGroup );
115 HYDROData_Entity::SetName( theName );
118 QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
120 QStringList aResList = dumpObjectCreation( theTreatedObjects );
121 aResList.prepend( "# Calculation case" );
123 QString aCalculName = GetObjPyName();
125 AssignmentMode aMode = GetAssignmentMode();
126 QString aModeStr = aMode==MANUAL ? "HYDROData_CalculationCase.MANUAL" : "HYDROData_CalculationCase.AUTOMATIC";
127 aResList << QString( "%0.SetAssignmentMode( %1 )" ).arg( aCalculName ).arg( aModeStr );
129 HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
130 HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
131 for ( ; anIter.More(); anIter.Next() )
133 Handle(HYDROData_Object) aRefGeomObj =
134 Handle(HYDROData_Object)::DownCast( anIter.Value() );
135 setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
137 aResList << QString( "" );
139 QString aGroupName = HYDROData_Tool::GenerateNameForPython( theTreatedObjects, "case_geom_group" );
141 HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
142 anIter.Init( aGeomGroups );
143 for ( ; anIter.More(); anIter.Next() )
145 Handle(HYDROData_ShapesGroup) aGeomGroup =
146 Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
147 if ( aGeomGroup.IsNull() )
150 Handle(HYDROData_Object) aFatherGeom =
151 Handle(HYDROData_Object)::DownCast( aGeomGroup->GetFatherObject() );
152 if ( aFatherGeom.IsNull() )
155 int aGroupId = aFatherGeom->GetGroupId( aGeomGroup );
156 aResList << QString( "%1 = %2.GetGroup( %3 );" )
157 .arg( aGroupName ).arg( aFatherGeom->GetObjPyName() ).arg( aGroupId );
159 aResList << QString( "%1.AddGeometryGroup( %2 );" ).arg( aCalculName ).arg( aGroupName );
162 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
163 setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
165 if( aMode==AUTOMATIC )
166 DumpRulesToPython( aCalculName, aResList );
168 aResList << QString( "" );
169 aResList << "# Start the algorithm of the partition and assignment";
170 aResList << QString( "%1.Update();" ).arg( aCalculName );
174 // Now we restore the
175 // - regions and zones order
176 DumpRegionsToPython( aResList, theTreatedObjects, GetRegions() );
179 // Export calculation case
180 aResList << QString( "" );
181 aResList << "# Export of the calculation case";
182 QString aStudyName = "theStudy";
183 QString anEntryVar = aCalculName + "_entry";
184 aResList << QString( "%1 = %2.Export( %3._get_StudyId() )" ).arg( anEntryVar ).arg( aCalculName ).arg( aStudyName );
186 // Get geometry object and print debug information
188 aResList << "# Get geometry shape and print debug information";
189 aResList << "import GEOM";
190 aResList << QString( "print \"Entry:\", %1" ).arg( anEntryVar );
191 QString aGeomShapeName = aCalculName + "_geom";
192 aResList << QString( "%1 = salome.IDToObject( str( %2 ) )" ).arg( aGeomShapeName ).arg( anEntryVar );
193 aResList << QString( "print \"Geom shape:\", %1" ).arg( aGeomShapeName );
194 aResList << QString( "print \"Geom shape name:\", %1.GetName()" ).arg( aGeomShapeName );
196 DumpSampleMeshing( aResList, aStudyName, aGeomShapeName, aCalculName+"_mesh" );
198 aResList << QString( "" );
202 void HYDROData_CalculationCase::DumpSampleMeshing( QStringList& theResList,
203 const QString& theStudyName,
204 const QString& theGeomShapeName,
205 const QString& theMeshName ) const
208 theResList << "# Meshing";
209 theResList << "import SMESH, SALOMEDS";
210 theResList << "from salome.smesh import smeshBuilder";
211 theResList << "from salome.geom import geomBuilder";
213 theResList << QString( "smesh = smeshBuilder.New( %1 )" ).arg( theStudyName );
214 theResList << QString( "%1 = smesh.Mesh( %2 )" ).arg( theMeshName ).arg( theGeomShapeName );
215 theResList << QString( "MEFISTO_2D = %1.Triangle( algo=smeshBuilder.MEFISTO )" ).arg( theMeshName );
216 theResList << "Max_Element_Area_1 = MEFISTO_2D.MaxElementArea( 10 )";
217 theResList << QString( "Regular_1D = %1.Segment()" ).arg( theMeshName );
218 theResList << "Max_Size_1 = Regular_1D.MaxSize(10)";
219 theResList << QString( "isDone = %1.Compute()" ).arg( theMeshName );
222 theResList << "# Set names of Mesh objects";
223 theResList << "smesh.SetName( MEFISTO_2D.GetAlgorithm(), 'MEFISTO_2D' )";
224 theResList << "smesh.SetName( Regular_1D.GetAlgorithm(), 'Regular_1D' )";
225 theResList << "smesh.SetName( Max_Size_1, 'Max Size_1' )";
226 theResList << "smesh.SetName( Max_Element_Area_1, 'Max. Element Area_1' )";
227 theResList << QString( "smesh.SetName( %1.GetMesh(), '%1' )" ).arg( theMeshName );
230 theResList << "# Greate SMESH groups";
231 theResList << QString( "geompy = geomBuilder.New( %1 )" ).arg( theStudyName );
232 theResList << QString( "geom_groups = geompy.GetGroups( %1 )" ).arg( theGeomShapeName );
233 theResList << QString( "for group in geom_groups:" );
234 theResList << QString( " smesh_group = %1.GroupOnGeom(group, group.GetName(), SMESH.EDGE)" )
236 theResList << QString( " smesh.SetName(smesh_group, group.GetName())" );
237 theResList << QString( " print \"SMESH group '%s': %s\" % (smesh_group.GetName(), smesh_group)" );
240 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() const
242 HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
244 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
245 if ( !aBoundaryPolyline.IsNull() )
246 aResSeq.Append( aBoundaryPolyline );
248 HYDROData_SequenceOfObjects aSeqOfGeomObjs = GetGeometryObjects();
249 aResSeq.Append( aSeqOfGeomObjs );
252 HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions();
253 aResSeq.Append( aSeqOfRegions );
258 void HYDROData_CalculationCase::Update()
260 HYDROData_Entity::Update();
263 // At first we remove previously created objects
265 RemoveSplittedGroups();
267 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
268 if ( aDocument.IsNull() )
272 HYDROData_SplitToZonesTool::SplitDataList aZonesList, anEdgesList;
274 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
275 HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
276 if ( !aGeomObjects.IsEmpty() ) {
277 HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
279 HYDROData_SplitToZonesTool::SplitDataList aSplitObjects =
280 HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline );
281 if ( !aSplitObjects.isEmpty() ) {
282 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitObjects );
283 while( anIter.hasNext() ) {
284 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
285 if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Zone )
286 aZonesList.append( aSplitData );
287 else if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Edge )
288 anEdgesList.append( aSplitData );
293 switch( GetAssignmentMode() )
296 CreateRegionsDef( aDocument, aZonesList );
299 CreateRegionsAuto( aDocument, aZonesList );
303 CreateEdgeGroupsDef( aDocument, anEdgesList );
306 void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
307 const HYDROData_SplitToZonesTool::SplitDataList& theZones )
309 // Create result regions for case, by default one zone for one region
310 QString aRegsPref = CALCULATION_REGIONS_PREF;
311 QString aZonesPref = CALCULATION_ZONES_PREF;
313 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones );
314 while( anIter.hasNext() )
316 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
318 Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref );
320 // Add the zone for region
321 Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames );
325 void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
326 const HYDROData_SplitToZonesTool::SplitDataList& theZones )
328 QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
329 QMap<QString, QString> aRegionNameToObjNameMap;
330 QString aZonesPref = CALCULATION_ZONES_PREF;
331 HYDROData_PriorityQueue aPr( this, DataTag_CustomRules );
333 // 1. First we create a default region for each object included into the calculation case
334 HYDROData_SequenceOfObjects anObjects = GetGeometryObjects();
335 for( int i = anObjects.Lower(), n = anObjects.Upper(); i<=n; i++ )
337 Handle(HYDROData_Entity) anObj = anObjects.Value( i );
340 QString anObjName = anObj->GetName();
341 QString aRegName = anObjName + "_reg";
342 Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, false );
343 aRegionsMap.insert( anObjName, aRegion );
344 aRegionNameToObjNameMap.insert( aRegName, anObjName );
347 // 2. Now for each zone it is necessary to determine the most priority object
348 // and assign to zone to corresponding region
349 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones );
350 while( anIter.hasNext() )
352 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
353 HYDROData_Zone::MergeType aMergeType;
354 Handle(HYDROData_Entity) aRegObj = aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType );
355 if( aRegObj.IsNull() )
357 Handle(HYDROData_Region) aRegion = aRegionsMap[aRegObj->GetName()];
358 if( aRegion.IsNull() )
360 Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames );
362 if( aSplitData.ObjectNames.count() > 1 && aMergeType==HYDROData_Zone::Merge_UNKNOWN )
364 qDebug( "Error in algorithm: unresolved conflicts" );
367 Handle(HYDROData_Entity) aMergeEntity = aRegObj;
368 Handle(HYDROData_Object) aMergeObject = Handle(HYDROData_Object)::DownCast( aMergeEntity );
369 if ( !aMergeObject.IsNull() ) {
370 aMergeEntity = aMergeObject->GetAltitudeObject();
375 case HYDROData_Zone::Merge_ZMIN:
376 case HYDROData_Zone::Merge_ZMAX:
377 aRegionZone->SetMergeType( aMergeType );
379 case HYDROData_Zone::Merge_Object:
380 aRegionZone->SetMergeType( aMergeType );
381 aRegionZone->RemoveMergeObject();
382 aRegionZone->SetMergeObject( aMergeEntity );
387 QStringList anObjectsWithEmptyRegions;
388 QMap<QString, Handle(HYDROData_Region)>::const_iterator
389 anIt = aRegionsMap.begin(), aLast = aRegionsMap.end();
390 for( ; anIt!=aLast; anIt++ )
392 Handle(HYDROData_Region) aRegion = anIt.value();
393 if( aRegion->GetZones().IsEmpty() )
395 QString aRegName = aRegion->GetName();
396 QString anObjName = aRegionNameToObjNameMap[aRegName];
397 anObjectsWithEmptyRegions.append( anObjName );
401 if( !anObjectsWithEmptyRegions.empty() )
403 QString aData = anObjectsWithEmptyRegions.join( ", " );
404 SetWarning( WARN_EMPTY_REGIONS, aData );
408 void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
409 const HYDROData_SplitToZonesTool::SplitDataList& theEdges )
411 QMap<QString,Handle(HYDROData_SplittedShapesGroup)> aSplittedEdgesGroupsMap;
413 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theEdges );
414 while( anIter.hasNext() )
416 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
417 // Create new edges group
418 if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() )
421 QString anObjName = aSplitData.ObjectNames.first();
422 if ( anObjName.isEmpty() )
424 #ifdef DEB_CALCULATION
425 QString aStr = aSplitData.ObjectNames.join(" ");
426 cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;
428 Handle(HYDROData_SplittedShapesGroup) aSplittedGroup;
429 if ( !aSplittedEdgesGroupsMap.contains( anObjName ) )
431 aSplittedGroup = addNewSplittedGroup( CALCULATION_GROUPS_PREF + anObjName );
432 aSplittedEdgesGroupsMap.insert( anObjName, aSplittedGroup );
436 aSplittedGroup = aSplittedEdgesGroupsMap[ anObjName ];
438 if ( aSplittedGroup.IsNull() )
441 aSplittedGroup->AddShape( aSplitData.Shape );
445 bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
447 if ( !HYDROData_Tool::IsGeometryObject( theObject ) )
448 return false; // Wrong type of object
450 if ( HasReference( theObject, DataTag_GeometryObject ) )
451 return false; // Object is already in reference list
453 AddReferenceObject( theObject, DataTag_GeometryObject );
455 // Indicate model of the need to update splitting
461 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryObjects() const
463 return GetReferenceObjects( DataTag_GeometryObject );
466 void HYDROData_CalculationCase::RemoveGeometryObject( const Handle(HYDROData_Object)& theObject )
468 if ( theObject.IsNull() )
471 RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
473 // Indicate model of the need to update splitting
477 void HYDROData_CalculationCase::RemoveGeometryObjects()
479 ClearReferenceObjects( DataTag_GeometryObject );
481 // Indicate model of the need to update splitting
485 bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
487 if ( theGroup.IsNull() )
490 if ( HasReference( theGroup, DataTag_GeometryGroup ) )
491 return false; // Object is already in reference list
493 AddReferenceObject( theGroup, DataTag_GeometryGroup );
495 // Indicate model of the need to update splitting
496 Changed( Geom_Groups );
501 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryGroups() const
503 return GetReferenceObjects( DataTag_GeometryGroup );
506 void HYDROData_CalculationCase::RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
508 if ( theGroup.IsNull() )
511 RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
513 // Indicate model of the need to update splitting
514 Changed( Geom_Groups );
517 void HYDROData_CalculationCase::RemoveGeometryGroups()
519 ClearReferenceObjects( DataTag_GeometryGroup );
521 // Indicate model of the need to update splitting
522 Changed( Geom_Groups );
525 void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
527 Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
529 SetReferenceObject( thePolyline, DataTag_Polyline );
531 // Indicate model of the need to update zones splitting
532 if( !IsEqual( aPrevPolyline, thePolyline ) )
536 Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
538 return Handle(HYDROData_PolylineXY)::DownCast(
539 GetReferenceObject( DataTag_Polyline ) );
542 void HYDROData_CalculationCase::RemoveBoundaryPolyline()
544 Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
546 ClearReferenceObjects( DataTag_Polyline );
548 // Indicate model of the need to update zones splitting
552 void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_StricklerTable)& theStricklerTable )
554 Handle(HYDROData_StricklerTable) aPrevStricklerTable = GetStricklerTable();
556 SetReferenceObject( theStricklerTable, DataTag_StricklerTable );
558 // Indicate model of the need to update land covers partition
559 if( !IsEqual( aPrevStricklerTable, theStricklerTable ) )
563 Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
565 return Handle(HYDROData_StricklerTable)::DownCast(
566 GetReferenceObject( DataTag_StricklerTable ) );
569 void HYDROData_CalculationCase::RemoveStricklerTable()
571 Handle(HYDROData_StricklerTable) aPrevStricklerTable = GetStricklerTable();
573 ClearReferenceObjects( DataTag_StricklerTable );
575 // Indicate model of the need to update land covers partition
579 Handle(HYDROData_LandCoverMap) HYDROData_CalculationCase::GetLandCoverMap() const
581 Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast(
582 GetReferenceObject( DataTag_LandCoverMap ) );
586 void HYDROData_CalculationCase::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap )
588 SetReferenceObject( theMap, DataTag_LandCoverMap );
591 Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
596 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
597 Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
598 if ( aNewRegion.IsNull() )
601 aNewRegion->AddZone( theZone );
606 bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion )
608 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
610 if ( theRegion.IsNull() )
613 HYDROData_CalculationCase::DataTag aDataTag = DataTag_Region;
615 if ( HasReference( theRegion, aDataTag ) )
616 return false; // Object is already in reference list
618 // Move the region from other calculation
619 Handle(HYDROData_CalculationCase) aFatherCalc =
620 Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
621 if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
623 Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
624 theRegion->CopyTo( aNewRegion, true );
626 aFatherCalc->RemoveRegion( theRegion );
628 theRegion->SetLabel( aNewRegion->Label() );
632 AddReferenceObject( theRegion, aDataTag );
638 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions() const
640 return GetReferenceObjects( DataTag_Region );
643 void HYDROData_CalculationCase::UpdateRegionsOrder()
645 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
646 if ( aDocument.IsNull() )
649 HYDROData_SequenceOfObjects aRegions = GetRegions();
650 HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
651 for ( ; anIter.More(); anIter.Next() )
653 Handle(HYDROData_Region) aRegion =
654 Handle(HYDROData_Region)::DownCast( anIter.Value() );
655 if ( aRegion.IsNull() )
658 aRegion->SetName( "" );
661 QString aRegsPref = CALCULATION_REGIONS_PREF;
663 anIter.Init( aRegions );
664 for ( ; anIter.More(); anIter.Next() )
666 Handle(HYDROData_Region) aRegion =
667 Handle(HYDROData_Region)::DownCast( anIter.Value() );
668 if ( aRegion.IsNull() )
671 QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref );
672 aRegion->SetName( aRegionName );
676 void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
678 if ( theRegion.IsNull() )
681 HYDROData_CalculationCase::DataTag aDataTag = DataTag_Region;
682 RemoveReferenceObject( theRegion->Label(), aDataTag );
684 // Remove region from data model
685 Handle(HYDROData_CalculationCase) aFatherCalc =
686 Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
687 if ( !aFatherCalc.IsNull() && aFatherCalc->Label() == myLab )
691 void HYDROData_CalculationCase::RemoveRegions()
693 myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes();
696 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplittedGroups() const
698 return GetReferenceObjects( DataTag_SplittedGroups );
701 void HYDROData_CalculationCase::RemoveSplittedGroups()
703 myLab.FindChild( DataTag_SplittedGroups ).ForgetAllAttributes();
706 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const
708 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
709 return GetAltitudeForPoint( thePoint, aZone );
712 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
713 const Handle(HYDROData_Region)& theRegion ) const
715 double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
717 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
718 if ( !aZone.IsNull() )
720 Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
721 if ( IsEqual( aRefRegion, theRegion ) )
722 aResAltitude = GetAltitudeForPoint( thePoint, aZone );
728 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
729 const Handle(HYDROData_Zone)& theZone ) const
731 double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
732 if ( theZone.IsNull() )
735 HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType();
736 if ( !theZone->IsMergingNeed() )
738 aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
740 else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
745 HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
746 if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
748 Handle(HYDROData_IAltitudeObject) aMergeAltitude =
749 Handle(HYDROData_IAltitudeObject)::DownCast( theZone->GetMergeObject() );
750 if ( !aMergeAltitude.IsNull() )
752 if ( aZoneInterpolator != NULL )
754 aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
755 aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
758 aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
763 HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects();
764 HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
765 for ( ; anIter.More(); anIter.Next() )
767 Handle(HYDROData_Object) aZoneObj =
768 Handle(HYDROData_Object)::DownCast( anIter.Value() );
769 if ( aZoneObj.IsNull() )
772 Handle(HYDROData_IAltitudeObject) anObjAltitude = aZoneObj->GetAltitudeObject();
773 if ( anObjAltitude.IsNull() )
776 double aPointAltitude = 0.0;
777 if ( aZoneInterpolator != NULL )
779 aZoneInterpolator->SetAltitudeObject( anObjAltitude );
780 aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
783 aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
785 if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
788 if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
790 aResAltitude = aPointAltitude;
793 else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMIN )
795 if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
796 aResAltitude > aPointAltitude )
798 aResAltitude = aPointAltitude;
801 else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMAX )
803 if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
804 aResAltitude < aPointAltitude )
806 aResAltitude = aPointAltitude;
815 NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
816 const NCollection_Sequence<gp_XY>& thePoints,
817 const Handle(HYDROData_Region)& theRegion ) const
819 NCollection_Sequence<double> aResSeq;
821 for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
823 const gp_XY& thePnt = thePoints.Value( i );
825 double anAltitude = GetAltitudeForPoint( thePnt, theRegion );
826 aResSeq.Append( anAltitude );
832 NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
833 const NCollection_Sequence<gp_XY>& thePoints,
834 const Handle(HYDROData_Zone)& theZone ) const
836 NCollection_Sequence<double> aResSeq;
838 for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
840 const gp_XY& thePnt = thePoints.Value( i );
842 double anAltitude = GetAltitudeForPoint( thePnt, theZone );
843 aResSeq.Append( anAltitude );
849 double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const
851 Handle( HYDROData_LandCoverMap ) aMap = GetLandCoverMap();
852 Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
857 aMap->FindByPoint( thePoint, aType );
858 double aCoeff = aTable->Get( aType, 0.0 );
862 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
864 Handle(HYDROData_Region) aResRegion;
866 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
867 if ( !aZone.IsNull() )
868 aResRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
873 Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint ) const
875 Handle(HYDROData_Zone) aResZone;
877 HYDROData_SequenceOfObjects aRegions = GetRegions();
879 HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
880 for ( ; anIter.More() && aResZone.IsNull(); anIter.Next() )
882 Handle(HYDROData_Region) aRegion =
883 Handle(HYDROData_Region)::DownCast( anIter.Value() );
884 if ( aRegion.IsNull() )
887 HYDROData_SequenceOfObjects aZones = aRegion->GetZones();
888 HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
889 for ( ; aZonesIter.More() && aResZone.IsNull(); aZonesIter.Next() )
891 Handle(HYDROData_Zone) aRegZone =
892 Handle(HYDROData_Zone)::DownCast( aZonesIter.Value() );
893 if ( aRegZone.IsNull() )
896 PointClassification aPointRelation = GetPointClassification( thePoint, aRegZone );
897 if ( aPointRelation != POINT_OUT )
898 aResZone = aRegZone; // We found the desired zone
905 HYDROData_CalculationCase::PointClassification HYDROData_CalculationCase::GetPointClassification(
906 const gp_XY& thePoint,
907 const Handle(HYDROData_Zone)& theZone ) const
909 PointClassification aRes = POINT_OUT;
910 if ( theZone.IsNull() )
913 TopoDS_Face aZoneFace = TopoDS::Face( theZone->GetShape() );
914 if ( aZoneFace.IsNull() )
917 TopoDS_Compound aCmp;
919 aBB.MakeCompound(aCmp);
920 aBB.Add(aCmp, aZoneFace);
921 gp_Pnt aPnt (thePoint.X(), thePoint.Y(), 0.);
922 BRepBuilderAPI_MakeVertex aMk(aPnt);
923 aBB.Add(aCmp, aMk.Vertex());
924 BRepTools::Write(aCmp, "FCL2d.brep");
926 TopAbs_State State = HYDROData_Tool::ComputePointState(thePoint, aZoneFace);
927 if (State == TopAbs_OUT)
929 else if(State == TopAbs_IN)
931 else if(State == TopAbs_ON)
936 Handle(HYDROData_Region) HYDROData_CalculationCase::addNewRegion( const Handle(HYDROData_Document)& theDoc,
937 const QString& thePrefixOrName,
940 TDF_Label aNewLab = myLab.FindChild( DataTag_ChildRegion ).NewChild();
941 int aTag = aNewLab.Tag();
943 Handle(HYDROData_Region) aNewRegion =
944 Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) );
945 AddRegion( aNewRegion );
947 QString aRegionName = isPrefix ? HYDROData_Tool::GenerateObjectName( theDoc, thePrefixOrName ) : thePrefixOrName;
948 aNewRegion->SetName( aRegionName );
953 Handle(HYDROData_SplittedShapesGroup) HYDROData_CalculationCase::addNewSplittedGroup( const QString& theName )
955 TDF_Label aNewLab = myLab.FindChild( DataTag_SplittedGroups ).NewChild();
957 Handle(HYDROData_SplittedShapesGroup) aNewGroup =
958 Handle(HYDROData_SplittedShapesGroup)::DownCast(
959 HYDROData_Iterator::CreateObject( aNewLab, KIND_SPLITTED_GROUP ) );
960 AddReferenceObject( aNewGroup, DataTag_SplittedGroups );
962 aNewGroup->SetName( theName );
967 QString HYDROData_CalculationCase::Export( int theStudyId ) const
972 GEOM::GEOM_Gen_var aGEOMEngine = HYDROData_GeomTool::GetGeomGen();
973 SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId );
975 QString aGeomObjEntry, anErrorMsg;
976 bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg );
977 return isOK ? aGeomObjEntry : QString();
982 bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
983 SALOMEDS::Study_ptr theStudy,
984 QString& theGeomObjEntry,
985 QString& theErrorMsg ) const
987 HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs;
989 // Get groups definitions
990 HYDROData_SequenceOfObjects aSplittedGroups = GetSplittedGroups();
992 HYDROData_SequenceOfObjects::Iterator anIter( aSplittedGroups );
993 for ( ; anIter.More(); anIter.Next() )
996 Handle(HYDROData_ShapesGroup) aGroup =
997 Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
998 if ( aGroup.IsNull() )
1001 HYDROData_ShapesGroup::GroupDefinition aGroupDef;
1003 aGroupDef.Name = aGroup->GetName().toLatin1().constData();
1004 aGroup->GetShapes( aGroupDef.Shapes );
1006 aSeqOfGroupsDefs.Append( aGroupDef );
1010 bool isAllNotSubmersible = true;
1011 TopTools_ListOfShape aFaces;
1012 HYDROData_SequenceOfObjects aCaseRegions = GetRegions();
1013 HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions );
1014 for ( ; aRegionIter.More(); aRegionIter.Next() )
1016 Handle(HYDROData_Region) aRegion =
1017 Handle(HYDROData_Region)::DownCast( aRegionIter.Value() );
1018 if( aRegion.IsNull() || !aRegion->IsSubmersible() )
1021 if ( isAllNotSubmersible )
1022 isAllNotSubmersible = false;
1024 TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs );
1025 aFaces.Append( aRegionShape );
1030 if ( aCaseRegions.IsEmpty() ) {
1031 theErrorMsg = QString("the list of regions is empty.");
1032 } else if ( isAllNotSubmersible ) {
1033 theErrorMsg = QString("there are no submersible regions.");
1035 aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );;
1041 bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
1042 SALOMEDS::Study_ptr theStudy,
1043 const TopTools_ListOfShape& theFaces,
1044 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs,
1045 QString& theGeomObjEntry ) const
1048 BRepBuilderAPI_Sewing aSewing( Precision::Confusion() * 10.0 );
1049 aSewing.SetNonManifoldMode( Standard_False );
1050 #ifdef DEB_CALCULATION
1051 TCollection_AsciiString aNam("Sh_");
1054 TopTools_ListIteratorOfListOfShape aFaceIter( theFaces );
1055 for ( ; aFaceIter.More(); aFaceIter.Next() )
1057 TopoDS_Shape aShape = aFaceIter.Value();
1058 if ( aShape.IsNull() )
1061 if ( aShape.ShapeType() == TopAbs_FACE )
1063 aSewing.Add( aShape );
1064 #ifdef DEB_CALCULATION
1065 TCollection_AsciiString aName = aNam + ++i + ".brep";
1066 BRepTools::Write(aShape ,aName.ToCString());
1071 #ifdef DEB_CALCULATION
1074 TopExp_Explorer anExp( aShape, TopAbs_FACE );
1075 for (; anExp.More(); anExp.Next() ) {
1076 aSewing.Add( anExp.Current() );
1077 #ifdef DEB_CALCULATION
1079 TCollection_AsciiString aName = aNam + i + "_" + ++j + ".brep";
1080 BRepTools::Write(anExp.Current() ,aName.ToCString());
1087 TopoDS_Shape aSewedShape = aSewing.SewedShape();
1089 // If the sewed shape is empty - return false
1090 if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() )
1093 #ifdef DEB_CALCULATION
1094 BRepTools::Write(aSewedShape ,"Sew.brep");
1096 // Publish the sewed shape
1097 QString aName = EXPORT_NAME;
1098 GEOM::GEOM_Object_ptr aMainShape =
1099 HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry );
1101 if ( aMainShape->_is_nil() )
1104 if ( theGroupsDefs.IsEmpty() )
1108 TopTools_IndexedMapOfShape aMapOfSubShapes;
1109 TopExp::MapShapes( aSewedShape, aMapOfSubShapes );
1111 NCollection_DataMap< TCollection_AsciiString, NCollection_Sequence<int> > aGroupsData;
1113 for ( int aGrId = 1, nbGroups = theGroupsDefs.Length(); aGrId <= nbGroups; ++aGrId )
1115 const HYDROData_ShapesGroup::GroupDefinition& aGroupDef = theGroupsDefs.Value( aGrId );
1117 NCollection_Sequence<int> aGroupIndexes;
1118 for( int i = 1, n = aGroupDef.Shapes.Length(); i <= n; i++ )
1120 const TopoDS_Shape& aShape = aGroupDef.Shapes.Value( i );
1121 #ifdef DEB_CALCULATION
1122 cout << "\nOld shape(" << i << ") = " << aShape.TShape() <<endl;
1125 TopoDS_Shape aModifiedShape = aShape;
1126 if ( aSewing.IsModified( aShape ) )
1127 aModifiedShape = aSewing.Modified( aShape );
1128 else if ( aSewing.IsModifiedSubShape( aShape ) )
1129 aModifiedShape = aSewing.ModifiedSubShape( aShape );
1131 #ifdef DEB_CALCULATION
1132 const TopLoc_Location& aL1 = aShape.Location();
1133 const TopLoc_Location& aL2 = aModifiedShape.Location();
1134 cout << "\nNew shape(" << i << ") = " << aModifiedShape.TShape() << " Location is Equal = " << aL1.IsEqual(aL2)<<endl;
1137 int anIndex = aMapOfSubShapes.FindIndex(aModifiedShape);
1138 if ( anIndex > 0 ) {
1139 aGroupIndexes.Append( anIndex );
1141 #ifdef DEB_CALCULATION
1142 TCollection_AsciiString aNam("Lost_");
1143 if(!aMapOfSubShapes.Contains(aModifiedShape)) {
1144 for ( int anIndex = 1; anIndex <= aMapOfSubShapes.Extent(); anIndex++ )
1146 const TopoDS_Shape& aS = aMapOfSubShapes.FindKey( anIndex );
1147 if ( aModifiedShape.IsPartner( aS ) )
1149 cout <<"\nIndex in Map = " << anIndex << "TShape = " << aS.TShape() <<endl;
1150 TCollection_AsciiString aName = aNam + i + "_" + anIndex + ".brep";
1151 BRepTools::Write(aS ,aName.ToCString());
1159 if ( !aGroupIndexes.IsEmpty() )
1160 aGroupsData.Bind( aGroupDef.Name, aGroupIndexes );
1163 if ( !aGroupsData.IsEmpty() )
1165 GEOM::GEOM_IGroupOperations_var aGroupOp =
1166 theGeomEngine->GetIGroupOperations( theStudy->StudyId() );
1168 NCollection_DataMap< TCollection_AsciiString, NCollection_Sequence<int> >::Iterator aMapIt( aGroupsData );
1169 for ( ; aMapIt.More(); aMapIt.Next() )
1171 const TCollection_AsciiString& aGroupName = aMapIt.Key();
1172 const NCollection_Sequence<int>& aGroupIndexes = aMapIt.Value();
1174 GEOM::GEOM_Object_var aGeomGroup = aGroupOp->CreateGroup( aMainShape, TopAbs_EDGE );
1175 if ( CORBA::is_nil( aGeomGroup ) || !aGroupOp->IsDone() )
1178 GEOM::ListOfLong_var aGeomIndexes = new GEOM::ListOfLong;
1179 aGeomIndexes->length( aGroupIndexes.Length() );
1181 for( int i = 1, n = aGroupIndexes.Length(); i <= n; i++ )
1182 aGeomIndexes[ i - 1 ] = aGroupIndexes.Value( i );
1184 aGroupOp->UnionIDs( aGeomGroup, aGeomIndexes );
1185 if ( aGroupOp->IsDone() )
1187 SALOMEDS::SObject_var aGroupSO =
1188 theGeomEngine->AddInStudy( theStudy, aGeomGroup, aGroupName.ToCString(), aMainShape );
1197 void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag theDataTag,
1198 const bool theIsSetToUpdate )
1200 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1201 HYDROData_PriorityQueue::ClearRules( aRulesLab );
1203 // Indicate model of the need to update splitting
1204 if ( theIsSetToUpdate ) {
1209 void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)& theObject1,
1210 HYDROData_PriorityType thePriority,
1211 const Handle(HYDROData_Entity)& theObject2,
1212 HYDROData_Zone::MergeType theMergeType,
1213 HYDROData_CalculationCase::DataTag theDataTag )
1215 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1216 HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
1218 // Indicate model of the need to update splitting
1222 QString HYDROData_CalculationCase::DumpRules() const
1224 TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
1225 return HYDROData_PriorityQueue::DumpRules( aRulesLab );
1228 void HYDROData_CalculationCase::SetAssignmentMode( AssignmentMode theMode )
1230 TDF_Label aModeLab = myLab.FindChild( DataTag_AssignmentMode );
1231 TDataStd_Integer::Set( aModeLab, ( int ) theMode );
1233 // Indicate model of the need to update splitting
1237 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentMode() const
1239 Handle(TDataStd_Integer) aModeAttr;
1240 bool isOK = myLab.FindChild( DataTag_AssignmentMode ).FindAttribute( TDataStd_Integer::GetID(), aModeAttr );
1242 return ( AssignmentMode ) aModeAttr->Get();
1247 void HYDROData_CalculationCase::DumpRulesToPython( const QString& theCalcCaseName,
1248 QStringList& theScript ) const
1250 TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
1251 HYDROData_PriorityQueue::DumpRulesToPython( aRulesLab, theCalcCaseName, theScript );
1254 HYDROData_Warning HYDROData_CalculationCase::GetLastWarning() const
1256 return myLastWarning;
1259 void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const QString& theData )
1261 myLastWarning.Type = theType;
1262 myLastWarning.Data = theData;
1265 void HYDROData_CalculationCase::UpdateRegionsNames( const HYDROData_SequenceOfObjects& theRegions,
1266 const QString& theOldCaseName,
1267 const QString& theName )
1269 HYDROData_SequenceOfObjects::Iterator anIter( theRegions );
1270 for ( ; anIter.More(); anIter.Next() )
1272 Handle(HYDROData_Region) aRegion =
1273 Handle(HYDROData_Region)::DownCast( anIter.Value() );
1274 if ( aRegion.IsNull() )
1277 HYDROData_Tool::UpdateChildObjectName( theOldCaseName, theName, aRegion );
1279 HYDROData_SequenceOfObjects aZones = aRegion->GetZones();
1280 HYDROData_SequenceOfObjects::Iterator anIter( aZones );
1281 for ( ; anIter.More(); anIter.Next() )
1283 Handle(HYDROData_Zone) aRegZone =
1284 Handle(HYDROData_Zone)::DownCast( anIter.Value() );
1285 if ( aRegZone.IsNull() )
1288 HYDROData_Tool::UpdateChildObjectName( theOldCaseName, theName, aRegZone );
1293 void HYDROData_CalculationCase::DumpRegionsToPython( QStringList& theResList,
1294 MapOfTreatedObjects& theTreatedObjects,
1295 const HYDROData_SequenceOfObjects& theRegions ) const
1297 HYDROData_SequenceOfObjects::Iterator anIter;
1298 anIter.Init( theRegions );
1299 for ( ; anIter.More(); anIter.Next() )
1301 Handle(HYDROData_Region) aRegion =
1302 Handle(HYDROData_Region)::DownCast( anIter.Value() );
1303 if ( aRegion.IsNull() )
1306 theTreatedObjects.insert( aRegion->GetName(), aRegion );
1307 QStringList aRegDump = aRegion->DumpToPython( theTreatedObjects );
1308 theResList << aRegDump;
1312 bool HYDROData_CalculationCase::GetRule( int theIndex,
1313 Handle(HYDROData_Entity)& theObject1,
1314 HYDROData_PriorityType& thePriority,
1315 Handle(HYDROData_Entity)& theObject2,
1316 HYDROData_Zone::MergeType& theMergeType,
1317 HYDROData_CalculationCase::DataTag& theDataTag) const
1319 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1320 return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
1321 theObject1, thePriority, theObject2, theMergeType );