Salome HOME
Bug #168: filter for invalid polyline.
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index 97fa637dacb92d837d388e49ec1e942190d8c49c..a418024d6f5c685a090fa941453d3227fad02b8d 100644 (file)
@@ -267,7 +267,10 @@ void HYDROData_CalculationCase::Update()
       QString anObjName = aSplitData.ObjectNames.first();
       if ( anObjName.isEmpty() )
         continue;
-
+#ifdef DEB_CALCULATION
+      QString aStr = aSplitData.ObjectNames.join(" "); 
+         cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl; 
+#endif
       Handle(HYDROData_SplittedShapesGroup) aSplittedGroup;
       if ( !aSplittedEdgesGroupsMap.contains( anObjName ) )
       {
@@ -537,11 +540,20 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
     return aResAltitude;
   }
 
+  HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
   if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
   {
     Handle(HYDROData_IAltitudeObject) aMergeAltitude = theZone->GetMergeAltitude();
     if ( !aMergeAltitude.IsNull() )
-      aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+    {
+      if ( aZoneInterpolator != NULL )
+      {
+        aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
+        aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+      }
+      else
+        aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+    }
   }
   else
   {
@@ -558,7 +570,15 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
       if ( anObjAltitude.IsNull() )
         continue;
 
-      double aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+      double aPointAltitude = 0.0;
+      if ( aZoneInterpolator != NULL )
+      {
+        aZoneInterpolator->SetAltitudeObject( anObjAltitude );
+        aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+      }
+      else
+        aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+
       if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
         continue;
 
@@ -589,6 +609,23 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
   return aResAltitude;
 }
 
+NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints( 
+  const NCollection_Sequence<gp_XY>& thePoints,
+  const Handle(HYDROData_Zone)&      theZone ) const
+{
+  NCollection_Sequence<double> aResSeq;
+
+  for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
+  {
+    const gp_XY& thePnt = thePoints.Value( i );
+    
+    double anAltitude = GetAltitudeForPoint( thePnt, theZone );
+    aResSeq.Append( anAltitude );
+  }
+
+  return aResSeq;
+}
+
 Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint ) const
 {
   Handle(HYDROData_Zone) aResZone;