Salome HOME
ImportFromFile()
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index de643ebba34e2712e453207b3a6ae7ea90d911ba..fef44bd1741569f6fb7ffead13ba75e45e49d84e 100644 (file)
 
 #define EXPORT_NAME "HYDRO_" + GetName()
 
+#ifndef LIGHT_MODE
 #include <SALOME_NamingService.hxx>
 #include <SALOME_LifeCycleCORBA.hxx>
+#endif
 
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
@@ -196,9 +198,10 @@ QStringList HYDROData_CalculationCase::DumpToPython( const QString&       thePyS
   aResList << "import GEOM";
   aResList << QString( "print \"Entry:\", %1" ).arg( anEntryVar );
   QString aGeomShapeName = aCalculName + "_geom";
-  aResList << QString( "%1 = salome.IDToObject( str( %2 ) )" ).arg( aGeomShapeName ).arg( anEntryVar );
-  aResList << QString( "print \"Geom shape:\", %1" ).arg( aGeomShapeName );
-  aResList << QString( "print \"Geom shape name:\", %1.GetName()" ).arg( aGeomShapeName );
+  aResList << QString( "HYDRO_%1 = salome.IDToObject( str( %2 ) )" ).arg( GetName() ).arg( anEntryVar );
+  aResList << QString( "print \"Geom shape:\", HYDRO_%1" ).arg( GetName() );
+  aResList << QString( "print \"Geom shape name:\", HYDRO_%1.GetName()" ).arg( GetName() );
+
 
   //DumpSampleMeshing( aResList, aStudyName, aGeomShapeName, aCalculName+"_mesh" );
 
@@ -279,12 +282,15 @@ void HYDROData_CalculationCase::Update()
   HYDROData_SplitToZonesTool::SplitDataList aZonesList, anEdgesList;
 
   Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
+
+  HYDROData_SequenceOfObjects InterPolys = GetInterPolyObjects();
+
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
   if ( !aGeomObjects.IsEmpty() ) {
     HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
 
     HYDROData_SplitToZonesTool::SplitDataList aSplitObjects =
-      HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline );
+      HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline, InterPolys );
     if ( !aSplitObjects.isEmpty() ) {
       HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitObjects );
       while( anIter.hasNext() ) {
@@ -899,6 +905,20 @@ double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY&
   return aCoeff;
 }
 
+std::vector<double> HYDROData_CalculationCase::GetStricklerCoefficientForPoints(const std::vector<gp_XY>& thePoints,
+  double DefValue, bool UseMax ) const
+{
+  Handle( HYDROData_LandCoverMap ) aLCM = GetLandCoverMap();
+  Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+  std::vector<double> theCoeffs;
+  if( aLCM.IsNull() || aTable.IsNull() )
+    return theCoeffs;
+
+  aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax );
+
+  return theCoeffs;
+}
+
 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
 {
   Handle(HYDROData_Region) aResRegion;
@@ -1376,3 +1396,32 @@ bool HYDROData_CalculationCase::GetRule( int theIndex,
   return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
     theObject1, thePriority, theObject2, theMergeType );
 }
+
+bool HYDROData_CalculationCase::AddInterPoly( const Handle(HYDROData_PolylineXY)& theInterPolyline )
+{
+  HYDROData_CalculationCase::DataTag aDataTag = DataTag_InterPoly;
+
+  if ( HasReference( theInterPolyline, aDataTag ) )
+    return false; 
+
+  AddReferenceObject( theInterPolyline, aDataTag );
+
+  return true;
+}
+
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetInterPolyObjects() const
+{
+  return GetReferenceObjects( DataTag_InterPoly ); 
+}
+
+void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_PolylineXY)& theInterPolyline ) 
+{
+  if ( theInterPolyline.IsNull() )
+    return;
+
+  RemoveReferenceObject( theInterPolyline->Label(), DataTag_InterPoly );
+
+}
+
+
+