The class for Altitude object has been added.
set(PROJECT_HEADERS
HYDROData.h
+ HYDROData_AltitudeObject.h
HYDROData_Application.h
HYDROData_ArtificialObject.h
HYDROData_Bathymetry.h
HYDROData_Calculation.h
HYDROData_Document.h
HYDROData_Entity.h
+ HYDROData_IAltitudeObject.h
HYDROData_Image.h
HYDROData_ImmersibleZone.h
HYDROData_Iterator.h
)
set(PROJECT_SOURCES
+ HYDROData_AltitudeObject.cxx
HYDROData_Application.cxx
HYDROData_ArtificialObject.cxx
HYDROData_Bathymetry.cxx
HYDROData_Calculation.cxx
HYDROData_Document.cxx
HYDROData_Entity.cxx
+ HYDROData_IAltitudeObject.cxx
HYDROData_Image.cxx
HYDROData_ImmersibleZone.cxx
HYDROData_Iterator.cxx
--- /dev/null
+
+#include "HYDROData_AltitudeObject.h"
+#include "HYDROData_Document.h"
+
+#include <QStringList>
+
+#define PYTHON_ALTITUDE_ID "KIND_ALTITUDE"
+
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_AltitudeObject, HYDROData_IAltitudeObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_AltitudeObject, HYDROData_IAltitudeObject)
+
+HYDROData_AltitudeObject::HYDROData_AltitudeObject()
+: HYDROData_IAltitudeObject()
+{
+}
+
+HYDROData_AltitudeObject::~HYDROData_AltitudeObject()
+{
+}
+
+QStringList HYDROData_AltitudeObject::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList;
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+ if ( aDocument.IsNull() )
+ return aResList;
+
+ QString aDocName = aDocument->GetDocPyName();
+ QString anAltitudeName = GetName();
+
+ aResList << QString( "%1 = %2.CreateObject( %3 );" )
+ .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_ALTITUDE_ID );
+ aResList << QString( "%1.SetName( \"%2\" );" )
+ .arg( anAltitudeName ).arg( anAltitudeName );
+
+ // TODO
+
+ return aResList;
+}
+
+double HYDROData_AltitudeObject::GetAltitudeForPoint( const gp_XY& thePoint ) const
+{
+ double aResAltitude = GetInvalidAltitude();
+
+ return aResAltitude;
+}
+
+
+
+
--- /dev/null
+
+#ifndef HYDROData_AltitudeObject_HeaderFile
+#define HYDROData_AltitudeObject_HeaderFile
+
+
+#include "HYDROData_IAltitudeObject.h"
+
+
+DEFINE_STANDARD_HANDLE(HYDROData_AltitudeObject, HYDROData_IAltitudeObject)
+
+
+/**\class HYDROData_AltitudeObject
+ * \brief Class that stores/retreives information about the Altitude.
+ *
+ */
+class HYDROData_AltitudeObject : public HYDROData_IAltitudeObject
+{
+protected:
+
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
+ };
+
+public:
+
+ DEFINE_STANDARD_RTTI(HYDROData_AltitudeObject);
+
+ /**
+ * Returns the kind of this object.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_ALTITUDE; }
+
+
+ /**
+ * Dump Altitude object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+public:
+
+ // Public methods to work with altitudes.
+
+ /**
+ * Returns altitude for given point.
+ * \param thePoint the point to examine
+ * \return altitude value
+ */
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+
+protected:
+
+ friend class HYDROData_Iterator;
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_AltitudeObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_AltitudeObject();
+};
+
+#endif
#include <QPolygonF>
#include <QStringList>
-#define INVALID_ALTITUDE_VALUE -9999.0
#define PYTHON_BATHYMETRY_ID "KIND_BATHYMETRY"
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Entity)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_Entity)
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
HYDROData_Bathymetry::HYDROData_Bathymetry()
-: HYDROData_Entity()
+: HYDROData_IAltitudeObject()
{
}
return aResList;
}
-double HYDROData_Bathymetry::GetInvalidAltitude()
-{
- return INVALID_ALTITUDE_VALUE;
-}
-
void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints )
{
RemoveAltitudePoints();
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 ] );
#ifndef HYDROData_Bathymetry_HeaderFile
#define HYDROData_Bathymetry_HeaderFile
-#include <HYDROData_Entity.h>
+#include "HYDROData_IAltitudeObject.h"
-class gp_XY;
-class gp_XYZ;
-class QPointF;
class QFile;
+class gp_XYZ;
-DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_Entity)
+DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
/**\class HYDROData_Bathymetry
*
* The Bathymetry represents measurement of the altitude of points on the terrain.
*/
-class HYDROData_Bathymetry : public HYDROData_Entity
+class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
{
public:
*/
enum DataTag
{
- DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
DataTag_AltitudePoints, ///< altitude points, array of reals
DataTag_FilePath ///< bathymetry imported file path
};
public:
// Public methods to work with Bathymetry altitudes.
- /**
- * Returns altitude points list.
- * \return points list
- */
- HYDRODATA_EXPORT static double GetInvalidAltitude();
-
/**
* Replace current altitude points by new one.
* \param thePoints the altitude points list
*/
HYDRODATA_EXPORT virtual void RemoveAltitudePoints();
- /**
- * Returns altitude for given point.
- * \param thePoint the point to examine
- * \return altitude value
- */
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const QPointF& thePoint ) const;
-
/**
* Returns altitude for given point.
* \param thePoint the point to examine
*/
HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ using HYDROData_IAltitudeObject::GetAltitudeForPoint;
+
public:
// Public methods to work with files.
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_IMAGE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_POLYLINE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_BATHYMETRY );
+ aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_ALTITUDE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_IMMERSIBLE_ZONE );
aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_CALCULATION );
const ObjectKind KIND_IMAGE = 1;
const ObjectKind KIND_POLYLINE = 2;
const ObjectKind KIND_BATHYMETRY = 3;
-const ObjectKind KIND_IMMERSIBLE_ZONE = 4;
-const ObjectKind KIND_GUIDE_LINE = 5;
-const ObjectKind KIND_PROFILE = 6;
-const ObjectKind KIND_CALCULATION = 7;
-const ObjectKind KIND_ZONE = 8;
-const ObjectKind KIND_REGION = 9;
-const ObjectKind KIND_VISUAL_STATE = 10;
+const ObjectKind KIND_ALTITUDE = 4;
+const ObjectKind KIND_IMMERSIBLE_ZONE = 5;
+const ObjectKind KIND_GUIDE_LINE = 6;
+const ObjectKind KIND_PROFILE = 7;
+const ObjectKind KIND_CALCULATION = 8;
+const ObjectKind KIND_ZONE = 9;
+const ObjectKind KIND_REGION = 10;
+const ObjectKind KIND_VISUAL_STATE = 11;
const ObjectKind KIND_LAST = KIND_VISUAL_STATE;
DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
--- /dev/null
+
+#include "HYDROData_IAltitudeObject.h"
+
+#include <gp_XY.hxx>
+
+#include <QPointF>
+
+#define INVALID_ALTITUDE_VALUE -9999.0
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_IAltitudeObject, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IAltitudeObject, HYDROData_Entity)
+
+HYDROData_IAltitudeObject::HYDROData_IAltitudeObject()
+: HYDROData_Entity()
+{
+}
+
+HYDROData_IAltitudeObject::~HYDROData_IAltitudeObject()
+{
+}
+
+double HYDROData_IAltitudeObject::GetInvalidAltitude()
+{
+ return INVALID_ALTITUDE_VALUE;
+}
+
+double HYDROData_IAltitudeObject::GetAltitudeForPoint( const QPointF& thePoint ) const
+{
+ gp_XY aGpPoint( thePoint.x(), thePoint.y() );
+ return GetAltitudeForPoint( aGpPoint );
+}
+
+
+
--- /dev/null
+
+#ifndef HYDROData_IAltitudeObject_HeaderFile
+#define HYDROData_IAltitudeObject_HeaderFile
+
+#include "HYDROData_Entity.h"
+
+class gp_XY;
+class QPointF;
+
+DEFINE_STANDARD_HANDLE(HYDROData_IAltitudeObject, HYDROData_Entity)
+
+
+/**\class HYDROData_IAltitudeObject
+ * \briefThe base class for all altitude objects in the HYDRO module.
+ *
+ */
+class HYDROData_IAltitudeObject : public HYDROData_Entity
+{
+protected:
+
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+ };
+
+public:
+
+ DEFINE_STANDARD_RTTI(HYDROData_IAltitudeObject);
+
+ /**
+ * Returns the kind of this object. Must be redefined in all objects of known type.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const = 0;
+
+public:
+ // Public methods to work with altitudes.
+
+ /**
+ * Returns altitude points list.
+ * \return points list
+ */
+ HYDRODATA_EXPORT static double GetInvalidAltitude();
+
+ /**
+ * Returns altitude for given point.
+ * \param thePoint the point to examine
+ * \return altitude value
+ */
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const QPointF& thePoint ) const;
+
+ /**
+ * Returns altitude for given point.
+ * \param thePoint the point to examine
+ * \return altitude value
+ */
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const = 0;
+
+
+protected:
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDROData_IAltitudeObject();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ ~HYDROData_IAltitudeObject();
+};
+
+#endif
#include "HYDROData_Iterator.h"
+#include "HYDROData_AltitudeObject.h"
#include "HYDROData_Bathymetry.h"
#include "HYDROData_Calculation.h"
#include "HYDROData_Image.h"
case KIND_BATHYMETRY:
aResult = new HYDROData_Bathymetry();
break;
+ case KIND_ALTITUDE:
+ aResult = new HYDROData_AltitudeObject();
+ break;
case KIND_IMMERSIBLE_ZONE:
aResult = new HYDROData_ImmersibleZone();
break;