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"
21 #include "HYDROData_ArtificialObject.h"
22 #include "HYDROData_IAltitudeObject.h"
23 #include "HYDROData_Document.h"
24 #include "HYDROData_ShapesGroup.h"
25 #include "HYDROData_Iterator.h"
26 #include "HYDROData_NaturalObject.h"
27 #include "HYDROData_PolylineXY.h"
28 #include "HYDROData_StricklerTable.h"
29 #include "HYDROData_LandCover.h"
30 #include "HYDROData_SplittedShapesGroup.h"
31 #include "HYDROData_Region.h"
32 #include "HYDROData_Tool.h"
33 #include "HYDROData_GeomTool.h"
40 #include <TopoDS_Shell.hxx>
41 #include <TopoDS_Edge.hxx>
43 #include <BRep_Builder.hxx>
44 #include <BRepBuilderAPI_Sewing.hxx>
45 #include <BRepTopAdaptor_FClass2d.hxx>
47 #include <BRepTools.hxx>
50 #include <TopExp_Explorer.hxx>
52 #include <TopTools_ListOfShape.hxx>
53 #include <TopTools_ListIteratorOfListOfShape.hxx>
54 #include <TDataStd_Integer.hxx>
56 //#define DEB_CALCULATION 1
57 #ifdef DEB_CALCULATION
58 #include <BRepTools.hxx>
59 #include <TopLoc_Location.hxx>
61 #define CALCULATION_REGIONS_PREF GetName() + "_Reg"
62 #define CALCULATION_ZONES_PREF GetName() + "_Zone"
63 #define CALCULATION_GROUPS_PREF GetName() + "_"
64 //#define DEB_CLASS2D 1
66 #include <BRepBuilderAPI_MakeVertex.hxx>
69 #define EXPORT_NAME "HYDRO_" + GetName()
71 IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
72 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
74 HYDROData_CalculationCase::HYDROData_CalculationCase()
79 HYDROData_CalculationCase::~HYDROData_CalculationCase()
83 void HYDROData_CalculationCase::SetName( const QString& theName )
85 QString anOldCaseName = GetName();
86 if ( anOldCaseName != theName )
88 HYDROData_SequenceOfObjects aRegions = GetRegions();
90 HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
91 for ( ; anIter.More(); anIter.Next() )
93 Handle(HYDROData_Region) aRegion =
94 Handle(HYDROData_Region)::DownCast( anIter.Value() );
95 if ( aRegion.IsNull() )
98 HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aRegion );
100 HYDROData_SequenceOfObjects aZones = aRegion->GetZones();
101 HYDROData_SequenceOfObjects::Iterator anIter( aZones );
102 for ( ; anIter.More(); anIter.Next() )
104 Handle(HYDROData_Zone) aRegZone =
105 Handle(HYDROData_Zone)::DownCast( anIter.Value() );
106 if ( aRegZone.IsNull() )
109 HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aRegZone );
113 HYDROData_SequenceOfObjects aGroups = GetSplittedGroups();
115 anIter.Init( aGroups );
116 for ( ; anIter.More(); anIter.Next() )
118 Handle(HYDROData_SplittedShapesGroup) aGroup =
119 Handle(HYDROData_SplittedShapesGroup)::DownCast( anIter.Value() );
120 if ( aGroup.IsNull() )
123 HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aGroup );
127 HYDROData_Entity::SetName( theName );
130 QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
132 QStringList aResList = dumpObjectCreation( theTreatedObjects );
133 aResList.prepend( "# Calculation case" );
135 QString aCalculName = GetObjPyName();
137 AssignmentMode aMode = GetAssignmentMode();
138 QString aModeStr = aMode==MANUAL ? "HYDROData_CalculationCase.MANUAL" : "HYDROData_CalculationCase.AUTOMATIC";
139 aResList << QString( "%0.SetAssignmentMode( %1 )" ).arg( aCalculName ).arg( aModeStr );
141 HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
142 HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
143 for ( ; anIter.More(); anIter.Next() )
145 Handle(HYDROData_Object) aRefGeomObj =
146 Handle(HYDROData_Object)::DownCast( anIter.Value() );
147 setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
149 aResList << QString( "" );
151 QString aGroupName = HYDROData_Tool::GenerateNameForPython( theTreatedObjects, "case_geom_group" );
153 HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
154 anIter.Init( aGeomGroups );
155 for ( ; anIter.More(); anIter.Next() )
157 Handle(HYDROData_ShapesGroup) aGeomGroup =
158 Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
159 if ( aGeomGroup.IsNull() )
162 Handle(HYDROData_Object) aFatherGeom =
163 Handle(HYDROData_Object)::DownCast( aGeomGroup->GetFatherObject() );
164 if ( aFatherGeom.IsNull() )
167 int aGroupId = aFatherGeom->GetGroupId( aGeomGroup );
168 aResList << QString( "%1 = %2.GetGroup( %3 );" )
169 .arg( aGroupName ).arg( aFatherGeom->GetObjPyName() ).arg( aGroupId );
171 aResList << QString( "%1.AddGeometryGroup( %2 );" ).arg( aCalculName ).arg( aGroupName );
174 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
175 setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
177 if( aMode==AUTOMATIC )
178 DumpRulesToPython( aCalculName, aResList );
180 aResList << QString( "" );
181 aResList << "# Start the algorithm of the partition and assignment";
182 aResList << QString( "%1.Update();" ).arg( aCalculName );
186 // Now we restore the regions and zones order
187 HYDROData_SequenceOfObjects aRegions = GetRegions();
188 anIter.Init( aRegions );
189 for ( ; anIter.More(); anIter.Next() )
191 Handle(HYDROData_Region) aRegion =
192 Handle(HYDROData_Region)::DownCast( anIter.Value() );
193 if ( aRegion.IsNull() )
196 theTreatedObjects.insert( aRegion->GetName(), aRegion );
197 QStringList aRegDump = aRegion->DumpToPython( theTreatedObjects );
198 aResList << aRegDump;
202 // Export calculation case
203 aResList << QString( "" );
204 aResList << "# Export of the calculation case";
205 QString aStudyName = "theStudy";
206 QString anEntryVar = aCalculName + "_entry";
207 aResList << QString( "%1 = %2.Export( %3._get_StudyId() )" ).arg( anEntryVar ).arg( aCalculName ).arg( aStudyName );
209 // Get geometry object and print debug information
211 aResList << "# Get geometry shape and print debug information";
212 aResList << "import GEOM";
213 aResList << QString( "print \"Entry:\", %1" ).arg( anEntryVar );
214 QString aGeomShapeName = aCalculName + "_geom";
215 aResList << QString( "%1 = salome.IDToObject( str( %2 ) )" ).arg( aGeomShapeName ).arg( anEntryVar );
216 aResList << QString( "print \"Geom shape:\", %1" ).arg( aGeomShapeName );
217 aResList << QString( "print \"Geom shape name:\", %1.GetName()" ).arg( aGeomShapeName );
219 DumpSampleMeshing( aResList, aStudyName, aGeomShapeName, aCalculName+"_mesh" );
221 aResList << QString( "" );
225 void HYDROData_CalculationCase::DumpSampleMeshing( QStringList& theResList,
226 const QString& theStudyName,
227 const QString& theGeomShapeName,
228 const QString& theMeshName ) const
231 theResList << "# Meshing";
232 theResList << "import SMESH, SALOMEDS";
233 theResList << "from salome.smesh import smeshBuilder";
234 theResList << "from salome.geom import geomBuilder";
236 theResList << QString( "smesh = smeshBuilder.New( %1 )" ).arg( theStudyName );
237 theResList << QString( "%1 = smesh.Mesh( %2 )" ).arg( theMeshName ).arg( theGeomShapeName );
238 theResList << QString( "MEFISTO_2D = %1.Triangle( algo=smeshBuilder.MEFISTO )" ).arg( theMeshName );
239 theResList << "Max_Element_Area_1 = MEFISTO_2D.MaxElementArea( 10 )";
240 theResList << QString( "Regular_1D = %1.Segment()" ).arg( theMeshName );
241 theResList << "Max_Size_1 = Regular_1D.MaxSize(10)";
242 theResList << QString( "isDone = %1.Compute()" ).arg( theMeshName );
245 theResList << "# Set names of Mesh objects";
246 theResList << "smesh.SetName( MEFISTO_2D.GetAlgorithm(), 'MEFISTO_2D' )";
247 theResList << "smesh.SetName( Regular_1D.GetAlgorithm(), 'Regular_1D' )";
248 theResList << "smesh.SetName( Max_Size_1, 'Max Size_1' )";
249 theResList << "smesh.SetName( Max_Element_Area_1, 'Max. Element Area_1' )";
250 theResList << QString( "smesh.SetName( %1.GetMesh(), '%1' )" ).arg( theMeshName );
253 theResList << "# Greate SMESH groups";
254 theResList << QString( "geompy = geomBuilder.New( %1 )" ).arg( theStudyName );
255 theResList << QString( "geom_groups = geompy.GetGroups( %1 )" ).arg( theGeomShapeName );
256 theResList << QString( "for group in geom_groups:" );
257 theResList << QString( " smesh_group = %1.GroupOnGeom(group, group.GetName(), SMESH.EDGE)" )
259 theResList << QString( " smesh.SetName(smesh_group, group.GetName())" );
260 theResList << QString( " print \"SMESH group '%s': %s\" % (smesh_group.GetName(), smesh_group)" );
263 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() const
265 HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
267 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
268 if ( !aBoundaryPolyline.IsNull() )
269 aResSeq.Append( aBoundaryPolyline );
271 HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions();
272 aResSeq.Append( aSeqOfRegions );
277 void HYDROData_CalculationCase::Update()
279 HYDROData_Entity::Update();
282 // At first we remove previously created objects
284 RemoveSplittedGroups();
286 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
287 if ( aDocument.IsNull() )
290 Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
291 HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
292 if ( aGeomObjects.IsEmpty() )
295 HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
297 HYDROData_SplitToZonesTool::SplitDataList aSplitObjects =
298 HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline );
299 if ( aSplitObjects.isEmpty() )
302 HYDROData_SplitToZonesTool::SplitDataList aZonesList, anEdgesList;
304 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitObjects );
305 while( anIter.hasNext() )
307 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
308 if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Zone )
309 aZonesList.append( aSplitData );
310 else if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Edge )
311 anEdgesList.append( aSplitData );
314 switch( GetAssignmentMode() )
317 CreateRegionsDef( aDocument, aZonesList );
320 CreateRegionsAuto( aDocument, aZonesList );
323 CreateEdgeGroupsDef( aDocument, anEdgesList );
326 void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
327 const HYDROData_SplitToZonesTool::SplitDataList& theZones )
329 // Create result regions for case, by default one zone for one region
330 QString aRegsPref = CALCULATION_REGIONS_PREF;
331 QString aZonesPref = CALCULATION_ZONES_PREF;
333 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones );
334 while( anIter.hasNext() )
336 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
338 Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref );
340 // Add the zone for region
341 Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames );
345 void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
346 const HYDROData_SplitToZonesTool::SplitDataList& theZones )
348 QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
349 QMap<QString, QString> aRegionNameToObjNameMap;
350 QString aZonesPref = CALCULATION_ZONES_PREF;
351 HYDROData_PriorityQueue aPr( this, DataTag_CustomRules );
353 // 1. First we create a default region for each object included into the calculation case
354 HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
355 for( int i=aGeomObjects.Lower(), n=aGeomObjects.Upper(); i<=n; i++ )
357 Handle(HYDROData_Object) anObj = Handle(HYDROData_Object)::DownCast( aGeomObjects.Value( i ) );
360 QString anObjName = anObj->GetName();
361 QString aRegName = anObjName + "_reg";
362 Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, false );
363 aRegionsMap.insert( anObjName, aRegion );
364 aRegionNameToObjNameMap.insert( aRegName, anObjName );
367 // 2. Now for each zone it is necessary to determine the most priority object
368 // and assign to zone to corresponding region
369 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones );
370 while( anIter.hasNext() )
372 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
373 HYDROData_Zone::MergeAltitudesType aMergeType;
374 Handle(HYDROData_Object) aRegObj =
375 Handle(HYDROData_Object)::DownCast( aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType ) );
376 if( aRegObj.IsNull() )
378 Handle(HYDROData_Region) aRegion = aRegionsMap[aRegObj->GetName()];
379 if( aRegion.IsNull() )
381 Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames );
383 if( aSplitData.ObjectNames.count() > 1 && aMergeType==HYDROData_Zone::Merge_UNKNOWN )
385 qDebug( "Error in algorithm: unresolved conflicts" );
390 case HYDROData_Zone::Merge_ZMIN:
391 case HYDROData_Zone::Merge_ZMAX:
392 aRegionZone->SetMergeType( aMergeType );
394 case HYDROData_Zone::Merge_Object:
395 aRegionZone->SetMergeType( aMergeType );
396 aRegionZone->RemoveMergeAltitude();
397 aRegionZone->SetMergeAltitude( aRegObj->GetAltitudeObject() );
402 QStringList anObjectsWithEmptyRegions;
403 QMap<QString, Handle(HYDROData_Region)>::const_iterator
404 anIt = aRegionsMap.begin(), aLast = aRegionsMap.end();
405 for( ; anIt!=aLast; anIt++ )
407 Handle(HYDROData_Region) aRegion = anIt.value();
408 if( aRegion->GetZones().IsEmpty() )
410 QString aRegName = aRegion->GetName();
411 QString anObjName = aRegionNameToObjNameMap[aRegName];
412 anObjectsWithEmptyRegions.append( anObjName );
416 if( !anObjectsWithEmptyRegions.empty() )
418 QString aData = anObjectsWithEmptyRegions.join( ", " );
419 SetWarning( WARN_EMPTY_REGIONS, aData );
423 void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
424 const HYDROData_SplitToZonesTool::SplitDataList& theEdges )
426 QMap<QString,Handle(HYDROData_SplittedShapesGroup)> aSplittedEdgesGroupsMap;
428 HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theEdges );
429 while( anIter.hasNext() )
431 const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
432 // Create new edges group
433 if ( aSplitData.ObjectNames.isEmpty() || aSplitData.Shape.IsNull() )
436 QString anObjName = aSplitData.ObjectNames.first();
437 if ( anObjName.isEmpty() )
439 #ifdef DEB_CALCULATION
440 QString aStr = aSplitData.ObjectNames.join(" ");
441 cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;
443 Handle(HYDROData_SplittedShapesGroup) aSplittedGroup;
444 if ( !aSplittedEdgesGroupsMap.contains( anObjName ) )
446 aSplittedGroup = addNewSplittedGroup( CALCULATION_GROUPS_PREF + anObjName );
447 aSplittedEdgesGroupsMap.insert( anObjName, aSplittedGroup );
451 aSplittedGroup = aSplittedEdgesGroupsMap[ anObjName ];
453 if ( aSplittedGroup.IsNull() )
456 aSplittedGroup->AddShape( aSplitData.Shape );
460 bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
462 if ( !HYDROData_Tool::IsGeometryObject( theObject ) )
463 return false; // Wrong type of object
465 if ( HasReference( theObject, DataTag_GeometryObject ) )
466 return false; // Object is already in reference list
468 AddReferenceObject( theObject, DataTag_GeometryObject );
470 // Indicate model of the need to update splitting
476 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryObjects() const
478 return GetReferenceObjects( DataTag_GeometryObject );
481 void HYDROData_CalculationCase::RemoveGeometryObject( const Handle(HYDROData_Object)& theObject )
483 if ( theObject.IsNull() )
486 RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
488 // Indicate model of the need to update splitting
492 void HYDROData_CalculationCase::RemoveGeometryObjects()
494 ClearReferenceObjects( DataTag_GeometryObject );
496 // Indicate model of the need to update splitting
500 bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
502 if ( theGroup.IsNull() )
505 if ( HasReference( theGroup, DataTag_GeometryGroup ) )
506 return false; // Object is already in reference list
508 AddReferenceObject( theGroup, DataTag_GeometryGroup );
510 // Indicate model of the need to update splitting
516 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryGroups() const
518 return GetReferenceObjects( DataTag_GeometryGroup );
521 void HYDROData_CalculationCase::RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
523 if ( theGroup.IsNull() )
526 RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
528 // Indicate model of the need to update splitting
532 void HYDROData_CalculationCase::RemoveGeometryGroups()
534 ClearReferenceObjects( DataTag_GeometryGroup );
536 // Indicate model of the need to update splitting
540 void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
542 Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
544 SetReferenceObject( thePolyline, DataTag_Polyline );
546 // Indicate model of the need to update zones splitting
547 SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
550 Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
552 return Handle(HYDROData_PolylineXY)::DownCast(
553 GetReferenceObject( DataTag_Polyline ) );
556 void HYDROData_CalculationCase::RemoveBoundaryPolyline()
558 Handle(HYDROData_PolylineXY) aPrevPolyline = GetBoundaryPolyline();
560 ClearReferenceObjects( DataTag_Polyline );
562 // Indicate model of the need to update zones splitting
563 SetToUpdate( !aPrevPolyline.IsNull() || IsMustBeUpdated() );
566 void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_StricklerTable)& theStricklerTable )
568 Handle(HYDROData_StricklerTable) aPrevStricklerTable = GetStricklerTable();
570 SetReferenceObject( theStricklerTable, DataTag_StricklerTable );
572 // Indicate model of the need to update land covers partition
573 SetToUpdate( !IsEqual( aPrevStricklerTable, theStricklerTable ) || IsMustBeUpdated() );
576 Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
578 return Handle(HYDROData_StricklerTable)::DownCast(
579 GetReferenceObject( DataTag_StricklerTable ) );
582 void HYDROData_CalculationCase::RemoveStricklerTable()
584 Handle(HYDROData_StricklerTable) aPrevStricklerTable = GetStricklerTable();
586 ClearReferenceObjects( DataTag_StricklerTable );
588 // Indicate model of the need to update land covers partition
589 SetToUpdate( !aPrevStricklerTable.IsNull() || IsMustBeUpdated() );
592 bool HYDROData_CalculationCase::AddLandCover( const Handle(HYDROData_LandCover)& theLandCover )
594 if ( HasReference( theLandCover, DataTag_LandCover ) )
595 return false; // Land cover is already in reference list
597 AddReferenceObject( theLandCover, DataTag_LandCover );
599 // Indicate model of the need to update land covers partition
605 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetLandCovers() const
607 return GetReferenceObjects( DataTag_LandCover );
610 void HYDROData_CalculationCase::RemoveLandCover( const Handle(HYDROData_LandCover)& theLandCover )
612 if ( theLandCover.IsNull() )
615 RemoveReferenceObject( theLandCover->Label(), DataTag_LandCover );
617 // Indicate model of the need to update land cover partition
621 void HYDROData_CalculationCase::RemoveLandCovers()
623 ClearReferenceObjects( DataTag_LandCover );
625 // Indicate model of the need to update land cover partition
629 Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
631 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
632 Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
633 if ( aNewRegion.IsNull() )
636 aNewRegion->AddZone( theZone );
641 bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion )
643 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
645 if ( theRegion.IsNull() )
648 if ( HasReference( theRegion, DataTag_Region ) )
649 return false; // Object is already in reference list
651 // Move the region from other calculation
652 Handle(HYDROData_CalculationCase) aFatherCalc =
653 Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
654 if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
656 Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
657 theRegion->CopyTo( aNewRegion );
659 aFatherCalc->RemoveRegion( theRegion );
661 theRegion->SetLabel( aNewRegion->Label() );
665 AddReferenceObject( theRegion, DataTag_Region );
671 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions() const
673 return GetReferenceObjects( DataTag_Region );
676 void HYDROData_CalculationCase::UpdateRegionsOrder()
678 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
679 if ( aDocument.IsNull() )
682 HYDROData_SequenceOfObjects aRegions = GetRegions();
684 HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
685 for ( ; anIter.More(); anIter.Next() )
687 Handle(HYDROData_Region) aRegion =
688 Handle(HYDROData_Region)::DownCast( anIter.Value() );
689 if ( aRegion.IsNull() )
692 aRegion->SetName( "" );
695 QString aRegsPref = CALCULATION_REGIONS_PREF;
697 anIter.Init( aRegions );
698 for ( ; anIter.More(); anIter.Next() )
700 Handle(HYDROData_Region) aRegion =
701 Handle(HYDROData_Region)::DownCast( anIter.Value() );
702 if ( aRegion.IsNull() )
705 QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref );
706 aRegion->SetName( aRegionName );
710 void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion )
712 if ( theRegion.IsNull() )
715 RemoveReferenceObject( theRegion->Label(), DataTag_Region );
717 // Remove region from data model
718 Handle(HYDROData_CalculationCase) aFatherCalc =
719 Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() );
720 if ( !aFatherCalc.IsNull() && aFatherCalc->Label() == myLab )
724 void HYDROData_CalculationCase::RemoveRegions()
726 myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes();
729 HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplittedGroups() const
731 return GetReferenceObjects( DataTag_SplittedGroups );
734 void HYDROData_CalculationCase::RemoveSplittedGroups()
736 myLab.FindChild( DataTag_SplittedGroups ).ForgetAllAttributes();
739 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const
741 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
742 return GetAltitudeForPoint( thePoint, aZone );
745 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
746 const Handle(HYDROData_Region)& theRegion ) const
748 double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
750 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
751 if ( !aZone.IsNull() )
753 Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
754 if ( IsEqual( aRefRegion, theRegion ) )
755 aResAltitude = GetAltitudeForPoint( thePoint, aZone );
761 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
762 const Handle(HYDROData_Zone)& theZone ) const
764 double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
765 if ( theZone.IsNull() )
768 HYDROData_Zone::MergeAltitudesType aZoneMergeType = theZone->GetMergeType();
769 if ( !theZone->IsMergingNeed() )
771 aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
773 else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
778 HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
779 if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
781 Handle(HYDROData_IAltitudeObject) aMergeAltitude = theZone->GetMergeAltitude();
782 if ( !aMergeAltitude.IsNull() )
784 if ( aZoneInterpolator != NULL )
786 aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
787 aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
790 aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
795 HYDROData_SequenceOfObjects aZoneObjects = theZone->GetGeometryObjects();
796 HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
797 for ( ; anIter.More(); anIter.Next() )
799 Handle(HYDROData_Object) aZoneObj =
800 Handle(HYDROData_Object)::DownCast( anIter.Value() );
801 if ( aZoneObj.IsNull() )
804 Handle(HYDROData_IAltitudeObject) anObjAltitude = aZoneObj->GetAltitudeObject();
805 if ( anObjAltitude.IsNull() )
808 double aPointAltitude = 0.0;
809 if ( aZoneInterpolator != NULL )
811 aZoneInterpolator->SetAltitudeObject( anObjAltitude );
812 aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
815 aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
817 if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
820 if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
822 aResAltitude = aPointAltitude;
825 else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMIN )
827 if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
828 aResAltitude > aPointAltitude )
830 aResAltitude = aPointAltitude;
833 else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMAX )
835 if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ||
836 aResAltitude < aPointAltitude )
838 aResAltitude = aPointAltitude;
847 NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
848 const NCollection_Sequence<gp_XY>& thePoints,
849 const Handle(HYDROData_Region)& theRegion ) const
851 NCollection_Sequence<double> aResSeq;
853 for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
855 const gp_XY& thePnt = thePoints.Value( i );
857 double anAltitude = GetAltitudeForPoint( thePnt, theRegion );
858 aResSeq.Append( anAltitude );
864 NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
865 const NCollection_Sequence<gp_XY>& thePoints,
866 const Handle(HYDROData_Zone)& theZone ) const
868 NCollection_Sequence<double> aResSeq;
870 for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
872 const gp_XY& thePnt = thePoints.Value( i );
874 double anAltitude = GetAltitudeForPoint( thePnt, theZone );
875 aResSeq.Append( anAltitude );
881 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
883 Handle(HYDROData_Region) aResRegion;
885 Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
886 if ( !aZone.IsNull() )
887 aResRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
892 Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint ) const
894 Handle(HYDROData_Zone) aResZone;
896 HYDROData_SequenceOfObjects aRegions = GetRegions();
898 HYDROData_SequenceOfObjects::Iterator anIter( aRegions );
899 for ( ; anIter.More() && aResZone.IsNull(); anIter.Next() )
901 Handle(HYDROData_Region) aRegion =
902 Handle(HYDROData_Region)::DownCast( anIter.Value() );
903 if ( aRegion.IsNull() )
906 HYDROData_SequenceOfObjects aZones = aRegion->GetZones();
907 HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
908 for ( ; aZonesIter.More() && aResZone.IsNull(); aZonesIter.Next() )
910 Handle(HYDROData_Zone) aRegZone =
911 Handle(HYDROData_Zone)::DownCast( aZonesIter.Value() );
912 if ( aRegZone.IsNull() )
915 PointClassification aPointRelation = GetPointClassification( thePoint, aRegZone );
916 if ( aPointRelation != POINT_OUT )
917 aResZone = aRegZone; // We found the desired zone
924 HYDROData_CalculationCase::PointClassification HYDROData_CalculationCase::GetPointClassification(
925 const gp_XY& thePoint,
926 const Handle(HYDROData_Zone)& theZone ) const
928 PointClassification aRes = POINT_OUT;
929 if ( theZone.IsNull() )
932 TopoDS_Face aZoneFace = TopoDS::Face( theZone->GetShape() );
933 if ( aZoneFace.IsNull() )
936 TopoDS_Compound aCmp;
938 aBB.MakeCompound(aCmp);
939 aBB.Add(aCmp, aZoneFace);
940 gp_Pnt aPnt (thePoint.X(), thePoint.Y(), 0.);
941 BRepBuilderAPI_MakeVertex aMk(aPnt);
942 aBB.Add(aCmp, aMk.Vertex());
943 BRepTools::Write(aCmp, "FCL2d.brep");
945 TopAbs_State State = HYDROData_Tool::ComputePointState(thePoint, aZoneFace);
946 if (State == TopAbs_OUT)
948 else if(State == TopAbs_IN)
950 else if(State == TopAbs_ON)
955 Handle(HYDROData_Region) HYDROData_CalculationCase::addNewRegion( const Handle(HYDROData_Document)& theDoc,
956 const QString& thePrefixOrName,
959 TDF_Label aNewLab = myLab.FindChild( DataTag_ChildRegion ).NewChild();
960 int aTag = aNewLab.Tag();
962 Handle(HYDROData_Region) aNewRegion =
963 Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) );
964 AddRegion( aNewRegion );
966 QString aRegionName = isPrefix ? HYDROData_Tool::GenerateObjectName( theDoc, thePrefixOrName ) : thePrefixOrName;
967 aNewRegion->SetName( aRegionName );
972 Handle(HYDROData_SplittedShapesGroup) HYDROData_CalculationCase::addNewSplittedGroup( const QString& theName )
974 TDF_Label aNewLab = myLab.FindChild( DataTag_SplittedGroups ).NewChild();
976 Handle(HYDROData_SplittedShapesGroup) aNewGroup =
977 Handle(HYDROData_SplittedShapesGroup)::DownCast(
978 HYDROData_Iterator::CreateObject( aNewLab, KIND_SPLITTED_GROUP ) );
979 AddReferenceObject( aNewGroup, DataTag_SplittedGroups );
981 aNewGroup->SetName( theName );
986 QString HYDROData_CalculationCase::Export( int theStudyId ) const
988 GEOM::GEOM_Gen_var aGEOMEngine = HYDROData_GeomTool::GetGeomGen();
989 SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId );
991 QString aGeomObjEntry;
992 bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry );
993 return isOK ? aGeomObjEntry : QString();
996 bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
997 SALOMEDS::Study_ptr theStudy,
998 QString& theGeomObjEntry ) const
1000 HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs;
1002 // Get groups definitions
1003 HYDROData_SequenceOfObjects aSplittedGroups = GetSplittedGroups();
1005 HYDROData_SequenceOfObjects::Iterator anIter( aSplittedGroups );
1006 for ( ; anIter.More(); anIter.Next() )
1009 Handle(HYDROData_ShapesGroup) aGroup =
1010 Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
1011 if ( aGroup.IsNull() )
1014 HYDROData_ShapesGroup::GroupDefinition aGroupDef;
1016 aGroupDef.Name = aGroup->GetName().toLatin1().constData();
1017 aGroup->GetShapes( aGroupDef.Shapes );
1019 aSeqOfGroupsDefs.Append( aGroupDef );
1023 TopTools_ListOfShape aFaces;
1024 HYDROData_SequenceOfObjects aCaseRegions = GetRegions();
1025 HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions );
1026 for ( ; aRegionIter.More(); aRegionIter.Next() )
1028 Handle(HYDROData_Region) aRegion =
1029 Handle(HYDROData_Region)::DownCast( aRegionIter.Value() );
1030 if( aRegion.IsNull() || !aRegion->IsSubmersible() )
1033 TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs );
1034 aFaces.Append( aRegionShape );
1037 return Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );
1040 bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
1041 SALOMEDS::Study_ptr theStudy,
1042 const TopTools_ListOfShape& theFaces,
1043 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs,
1044 QString& theGeomObjEntry ) const
1047 BRepBuilderAPI_Sewing aSewing( Precision::Confusion() * 10.0 );
1048 aSewing.SetNonManifoldMode( Standard_False );
1049 #ifdef DEB_CALCULATION
1050 TCollection_AsciiString aNam("Sh_");
1053 TopTools_ListIteratorOfListOfShape aFaceIter( theFaces );
1054 for ( ; aFaceIter.More(); aFaceIter.Next() )
1056 TopoDS_Shape aShape = aFaceIter.Value();
1057 if ( aShape.IsNull() )
1060 if ( aShape.ShapeType() == TopAbs_FACE )
1062 aSewing.Add( aShape );
1063 #ifdef DEB_CALCULATION
1064 TCollection_AsciiString aName = aNam + ++i + ".brep";
1065 BRepTools::Write(aShape ,aName.ToCString());
1070 #ifdef DEB_CALCULATION
1073 TopExp_Explorer anExp( aShape, TopAbs_FACE );
1074 for (; anExp.More(); anExp.Next() ) {
1075 aSewing.Add( anExp.Current() );
1076 #ifdef DEB_CALCULATION
1078 TCollection_AsciiString aName = aNam + i + "_" + ++j + ".brep";
1079 BRepTools::Write(anExp.Current() ,aName.ToCString());
1086 TopoDS_Shape aSewedShape = aSewing.SewedShape();
1088 // If the sewed shape is empty - return false
1089 if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() )
1092 #ifdef DEB_CALCULATION
1093 BRepTools::Write(aSewedShape ,"Sew.brep");
1095 // Publish the sewed shape
1096 QString aName = EXPORT_NAME;
1097 GEOM::GEOM_Object_ptr aMainShape =
1098 HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry );
1100 if ( aMainShape->_is_nil() )
1103 if ( theGroupsDefs.IsEmpty() )
1107 TopTools_IndexedMapOfShape aMapOfSubShapes;
1108 TopExp::MapShapes( aSewedShape, aMapOfSubShapes );
1110 NCollection_DataMap< TCollection_AsciiString, NCollection_Sequence<int> > aGroupsData;
1112 for ( int aGrId = 1, nbGroups = theGroupsDefs.Length(); aGrId <= nbGroups; ++aGrId )
1114 const HYDROData_ShapesGroup::GroupDefinition& aGroupDef = theGroupsDefs.Value( aGrId );
1116 NCollection_Sequence<int> aGroupIndexes;
1117 for( int i = 1, n = aGroupDef.Shapes.Length(); i <= n; i++ )
1119 const TopoDS_Shape& aShape = aGroupDef.Shapes.Value( i );
1120 #ifdef DEB_CALCULATION
1121 cout << "\nOld shape(" << i << ") = " << aShape.TShape() <<endl;
1124 TopoDS_Shape aModifiedShape = aShape;
1125 if ( aSewing.IsModified( aShape ) )
1126 aModifiedShape = aSewing.Modified( aShape );
1127 else if ( aSewing.IsModifiedSubShape( aShape ) )
1128 aModifiedShape = aSewing.ModifiedSubShape( aShape );
1130 #ifdef DEB_CALCULATION
1131 const TopLoc_Location& aL1 = aShape.Location();
1132 const TopLoc_Location& aL2 = aModifiedShape.Location();
1133 cout << "\nNew shape(" << i << ") = " << aModifiedShape.TShape() << " Location is Equal = " << aL1.IsEqual(aL2)<<endl;
1136 int anIndex = aMapOfSubShapes.FindIndex(aModifiedShape);
1137 if ( anIndex > 0 ) {
1138 aGroupIndexes.Append( anIndex );
1140 #ifdef DEB_CALCULATION
1141 TCollection_AsciiString aNam("Lost_");
1142 if(!aMapOfSubShapes.Contains(aModifiedShape)) {
1143 for ( int anIndex = 1; anIndex <= aMapOfSubShapes.Extent(); anIndex++ )
1145 const TopoDS_Shape& aS = aMapOfSubShapes.FindKey( anIndex );
1146 if ( aModifiedShape.IsPartner( aS ) )
1148 cout <<"\nIndex in Map = " << anIndex << "TShape = " << aS.TShape() <<endl;
1149 TCollection_AsciiString aName = aNam + i + "_" + anIndex + ".brep";
1150 BRepTools::Write(aS ,aName.ToCString());
1158 if ( !aGroupIndexes.IsEmpty() )
1159 aGroupsData.Bind( aGroupDef.Name, aGroupIndexes );
1162 if ( !aGroupsData.IsEmpty() )
1164 GEOM::GEOM_IGroupOperations_var aGroupOp =
1165 theGeomEngine->GetIGroupOperations( theStudy->StudyId() );
1167 NCollection_DataMap< TCollection_AsciiString, NCollection_Sequence<int> >::Iterator aMapIt( aGroupsData );
1168 for ( ; aMapIt.More(); aMapIt.Next() )
1170 const TCollection_AsciiString& aGroupName = aMapIt.Key();
1171 const NCollection_Sequence<int>& aGroupIndexes = aMapIt.Value();
1173 GEOM::GEOM_Object_var aGeomGroup = aGroupOp->CreateGroup( aMainShape, TopAbs_EDGE );
1174 if ( CORBA::is_nil( aGeomGroup ) || !aGroupOp->IsDone() )
1177 GEOM::ListOfLong_var aGeomIndexes = new GEOM::ListOfLong;
1178 aGeomIndexes->length( aGroupIndexes.Length() );
1180 for( int i = 1, n = aGroupIndexes.Length(); i <= n; i++ )
1181 aGeomIndexes[ i - 1 ] = aGroupIndexes.Value( i );
1183 aGroupOp->UnionIDs( aGeomGroup, aGeomIndexes );
1184 if ( aGroupOp->IsDone() )
1186 SALOMEDS::SObject_var aGroupSO =
1187 theGeomEngine->AddInStudy( theStudy, aGeomGroup, aGroupName.ToCString(), aMainShape );
1195 void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag theDataTag,
1196 const bool theIsSetToUpdate )
1198 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1199 HYDROData_PriorityQueue::ClearRules( aRulesLab );
1201 // Indicate model of the need to update splitting
1202 if ( theIsSetToUpdate ) {
1203 SetToUpdate( true );
1207 void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)& theObject1,
1208 HYDROData_PriorityType thePriority,
1209 const Handle(HYDROData_Entity)& theObject2,
1210 HYDROData_Zone::MergeAltitudesType theMergeType,
1211 HYDROData_CalculationCase::DataTag theDataTag )
1213 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1214 HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
1216 // Indicate model of the need to update splitting
1217 SetToUpdate( true );
1220 QString HYDROData_CalculationCase::DumpRules() const
1222 TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
1223 return HYDROData_PriorityQueue::DumpRules( aRulesLab );
1226 void HYDROData_CalculationCase::SetAssignmentMode( AssignmentMode theMode )
1228 TDF_Label aModeLab = myLab.FindChild( DataTag_AssignmentMode );
1229 TDataStd_Integer::Set( aModeLab, ( int ) theMode );
1231 // Indicate model of the need to update splitting
1232 SetToUpdate( true );
1235 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentMode() const
1237 Handle(TDataStd_Integer) aModeAttr;
1238 bool isOK = myLab.FindChild( DataTag_AssignmentMode ).FindAttribute( TDataStd_Integer::GetID(), aModeAttr );
1240 return ( AssignmentMode ) aModeAttr->Get();
1245 void HYDROData_CalculationCase::DumpRulesToPython( const QString& theCalcCaseName,
1246 QStringList& theScript ) const
1248 TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
1249 HYDROData_PriorityQueue::DumpRulesToPython( aRulesLab, theCalcCaseName, theScript );
1252 HYDROData_Warning HYDROData_CalculationCase::GetLastWarning() const
1254 return myLastWarning;
1257 void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const QString& theData )
1259 myLastWarning.Type = theType;
1260 myLastWarning.Data = theData;
1263 bool HYDROData_CalculationCase::GetRule( int theIndex,
1264 Handle(HYDROData_Entity)& theObject1,
1265 HYDROData_PriorityType& thePriority,
1266 Handle(HYDROData_Entity)& theObject2,
1267 HYDROData_Zone::MergeAltitudesType& theMergeType,
1268 HYDROData_CalculationCase::DataTag& theDataTag) const
1270 TDF_Label aRulesLab = myLab.FindChild( theDataTag );
1271 return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
1272 theObject1, thePriority, theObject2, theMergeType );
1275 void HYDROData_CalculationCase::SetAssignmentLandCoverMode( AssignmentMode theMode )
1277 TDF_Label aModeLab = myLab.FindChild( DataTag_AssignmentLandCoverMode );
1278 TDataStd_Integer::Set( aModeLab, ( int ) theMode );
1280 // Indicate model of the need to update land covers partition
1281 SetToUpdate( true );
1284 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentLandCoverMode() const
1286 Handle(TDataStd_Integer) aModeAttr;
1287 bool isOK = myLab.FindChild( DataTag_AssignmentLandCoverMode ).FindAttribute( TDataStd_Integer::GetID(), aModeAttr );
1289 return ( AssignmentMode ) aModeAttr->Get();