#include <QPolygonF>
#include <QStringList>
-#define INVALID_ALTITUDE_VALUE -9999.0
#define PYTHON_BATHYMETRY_ID "KIND_BATHYMETRY"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Object)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_Object)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
HYDROData_Bathymetry::HYDROData_Bathymetry()
+: HYDROData_IAltitudeObject()
{
}
return aResList;
}
-double HYDROData_Bathymetry::GetInvalidAltitude()
-{
- return INVALID_ALTITUDE_VALUE;
-}
-
void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints )
{
RemoveAltitudePoints();
if ( !myLab.FindChild( DataTag_AltitudePoints ).FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) )
return aPoints;
- int aLowerIdx = aCoordsArray->Lower();
- int anUpperIdx = aCoordsArray->Upper();
for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; )
{
- if ( i + 3 > n )
+ if ( i + 3 > n + 1 )
break;
AltitudePoint aPoint;
theResPoint.SetZ( aResVal );
}
-double HYDROData_Bathymetry::GetAltitudeForPoint( const QPointF& thePoint ) const
-{
- gp_XY aGpPoint( thePoint.x(), thePoint.y() );
- return GetAltitudeForPoint( aGpPoint );
-}
-
double HYDROData_Bathymetry::GetAltitudeForPoint( const gp_XY& thePoint ) const
{
- double aResAltitude = -9999.90;
+ double aResAltitude = GetInvalidAltitude();
AltitudePoints anAltitudePoints = GetAltitudePoints();
if ( anAltitudePoints.isEmpty() )
// [ 0 (top-left) ] [ 1 (top-right) ]
// thePoint
// [ 2 (bot-left) ] [ 3 (bot-right) ]
- AltitudePoint aBounds[ 4 ] = { AltitudePoint( -DBL_MAX, -DBL_MAX, INVALID_ALTITUDE_VALUE ),
- AltitudePoint( DBL_MAX, -DBL_MAX, INVALID_ALTITUDE_VALUE ),
- AltitudePoint( -DBL_MAX, DBL_MAX, INVALID_ALTITUDE_VALUE ),
- AltitudePoint( DBL_MAX, DBL_MAX, INVALID_ALTITUDE_VALUE ) };
+ AltitudePoint aBounds[ 4 ] = { AltitudePoint( -DBL_MAX, -DBL_MAX, GetInvalidAltitude() ),
+ AltitudePoint( DBL_MAX, -DBL_MAX, GetInvalidAltitude() ),
+ AltitudePoint( -DBL_MAX, DBL_MAX, GetInvalidAltitude() ),
+ AltitudePoint( DBL_MAX, DBL_MAX, GetInvalidAltitude() ) };
AltitudePoints::const_iterator aListItBeg = anAltitudePoints.constBegin();
AltitudePoints::const_iterator aListItEnd = anAltitudePoints.constEnd();
// Check if requested point is inside of our bounding rectangle
if ( !aBoundingRect.boundingRect().contains( thePoint.X(), thePoint.Y() ) )
- return INVALID_ALTITUDE_VALUE;
+ return aResAltitude;
// Calculate result altitude for point
AltitudePoint aFirstPoint( aBounds[ 0 ] ), aSecPoint( aBounds[ 1 ] );